@templatical/media-library 0.31.0 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/chunks/{icons-CUkYjM9P.js → icons-OHMFmDQ6.js} +9 -9
- package/dist/cdn/chunks/icons-OHMFmDQ6.js.map +1 -0
- package/dist/cdn/media-library.css +1 -1
- package/dist/cdn/media-library.js +1109 -1097
- package/dist/cdn/media-library.js.map +1 -1
- package/dist/templatical-media-library.css +1 -1
- package/dist/templatical-media-library.js +371 -356
- package/package.json +5 -5
- package/dist/cdn/chunks/icons-CUkYjM9P.js.map +0 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { API_ROUTES as e, ApiClient as t, buildUrl as n, createSdkAuthManager as r } from "@templatical/core/cloud";
|
|
2
2
|
import { Fragment as i, Teleport as a, Transition as o, computed as s, createApp as c, createBlock as l, createCommentVNode as u, createElementBlock as d, createElementVNode as f, createTextVNode as p, createVNode as m, defineComponent as h, h as g, inject as _, isRef as v, normalizeClass as y, normalizeStyle as b, onMounted as x, openBlock as S, provide as C, ref as w, renderList as T, resolveComponent as E, toDisplayString as D, toRef as O, unref as k, vModelText as A, watch as j, withCtx as M, withDirectives as N, withKeys as P, withModifiers as F } from "vue";
|
|
3
|
-
import { Check as I, ChevronRight as L, Copy as R, File as z, Folder as B, Grid2x2 as V, Link as H, List as U, LoaderCircle as W, PanelLeft as G, Pencil as K, Plus as q, RefreshCw as
|
|
4
|
-
import { Cropper as
|
|
5
|
-
import { onClickOutside as
|
|
3
|
+
import { Check as I, ChevronRight as L, Copy as R, File as z, Folder as B, Grid2x2 as V, Link as H, List as U, LoaderCircle as W, PanelLeft as G, Pencil as K, Plus as q, RefreshCw as J, Search as Y, Star as ee, Trash2 as X, Upload as te, X as ne } from "@lucide/vue";
|
|
4
|
+
import { Cropper as re } from "vue-advanced-cropper";
|
|
5
|
+
import { onClickOutside as ie, useClipboard as ae, useDebounceFn as oe, useDropZone as se, useEventListener as ce, useFileDialog as le, useIntersectionObserver as ue } from "@vueuse/core";
|
|
6
6
|
//#region \0rolldown/runtime.js
|
|
7
|
-
var
|
|
7
|
+
var de = Object.defineProperty, fe = (e, t) => {
|
|
8
8
|
let n = {};
|
|
9
|
-
for (var r in e)
|
|
9
|
+
for (var r in e) de(n, r, {
|
|
10
10
|
get: e[r],
|
|
11
11
|
enumerable: !0
|
|
12
12
|
});
|
|
13
|
-
return t ||
|
|
14
|
-
},
|
|
13
|
+
return t || de(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
14
|
+
}, pe = class {
|
|
15
15
|
authManager;
|
|
16
16
|
constructor(e) {
|
|
17
17
|
this.authManager = e;
|
|
@@ -168,9 +168,9 @@ var fe = Object.defineProperty, pe = (e, t) => {
|
|
|
168
168
|
};
|
|
169
169
|
//#endregion
|
|
170
170
|
//#region src/composable.ts
|
|
171
|
-
function
|
|
171
|
+
function me(e) {
|
|
172
172
|
if (!e.projectId) throw Error("projectId is required for useMediaLibrary");
|
|
173
|
-
let t = new
|
|
173
|
+
let t = new pe(e.authManager), n = w([]), r = w([]), i = w(null), a = w("files"), o = w(""), s = w(null), c = w("newest"), l = w(!1), u = w(!1), d = w(!1), f = w(null), p = w(null), m = w(/* @__PURE__ */ new Set()), h = w(null), g = w([]), _ = w({}), v = w(!1), y = w([]), b = w(!1), x = w(null), S = w(!1), C = w(null), T = w(!1), E = w(null), D = w(null), O = 0;
|
|
174
174
|
async function k() {
|
|
175
175
|
let r = ++O;
|
|
176
176
|
l.value = !0;
|
|
@@ -333,50 +333,50 @@ function he(e) {
|
|
|
333
333
|
function q() {
|
|
334
334
|
m.value = /* @__PURE__ */ new Set(), h.value = null;
|
|
335
335
|
}
|
|
336
|
-
function
|
|
336
|
+
function J(e) {
|
|
337
337
|
h.value = e, m.value = /* @__PURE__ */ new Set([e.id]);
|
|
338
338
|
}
|
|
339
|
-
async function
|
|
339
|
+
async function Y() {
|
|
340
340
|
try {
|
|
341
341
|
r.value = await t.getMediaFolders();
|
|
342
342
|
} catch (t) {
|
|
343
343
|
e.onError?.(t);
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
|
-
async function
|
|
346
|
+
async function ee(n, r) {
|
|
347
347
|
try {
|
|
348
348
|
let e = await t.createMediaFolder(n, r);
|
|
349
|
-
return await
|
|
349
|
+
return await Y(), e;
|
|
350
350
|
} catch (t) {
|
|
351
351
|
return e.onError?.(t), null;
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
|
-
function
|
|
354
|
+
function X(e, t) {
|
|
355
355
|
for (let n of e) {
|
|
356
356
|
if (n.id === t) return n;
|
|
357
357
|
if (n.children) {
|
|
358
|
-
let e =
|
|
358
|
+
let e = X(n.children, t);
|
|
359
359
|
if (e) return e;
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
362
|
return null;
|
|
363
363
|
}
|
|
364
|
-
async function
|
|
364
|
+
async function te(n, r) {
|
|
365
365
|
try {
|
|
366
|
-
await t.renameMediaFolder(n, r), await
|
|
366
|
+
await t.renameMediaFolder(n, r), await Y();
|
|
367
367
|
} catch (t) {
|
|
368
368
|
e.onError?.(t);
|
|
369
369
|
}
|
|
370
370
|
}
|
|
371
|
-
async function
|
|
371
|
+
async function ne(n) {
|
|
372
372
|
try {
|
|
373
|
-
let e =
|
|
374
|
-
await t.deleteMediaFolder(n), i.value === n && (i.value = e), await
|
|
373
|
+
let e = X(r.value, n)?.parent_id ?? null;
|
|
374
|
+
await t.deleteMediaFolder(n), i.value === n && (i.value = e), await Y(), await k();
|
|
375
375
|
} catch (t) {
|
|
376
376
|
e.onError?.(t);
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
|
-
async function
|
|
379
|
+
async function re(n) {
|
|
380
380
|
E.value = n, C.value = null;
|
|
381
381
|
try {
|
|
382
382
|
let e = await t.checkMediaUsage([n.id]);
|
|
@@ -385,10 +385,10 @@ function he(e) {
|
|
|
385
385
|
e.onError?.(t);
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
|
-
function
|
|
388
|
+
function ie() {
|
|
389
389
|
T.value = !1, E.value = null, D.value = null, C.value = null;
|
|
390
390
|
}
|
|
391
|
-
async function
|
|
391
|
+
async function ae(r) {
|
|
392
392
|
if (!E.value) return null;
|
|
393
393
|
S.value = !0, C.value = null;
|
|
394
394
|
try {
|
|
@@ -400,7 +400,7 @@ function he(e) {
|
|
|
400
400
|
S.value = !1;
|
|
401
401
|
}
|
|
402
402
|
}
|
|
403
|
-
async function
|
|
403
|
+
async function oe(r, i) {
|
|
404
404
|
try {
|
|
405
405
|
let e = await t.replaceMedia(r, i);
|
|
406
406
|
return n.value = n.value.map((t) => t.id === e.id ? e : t), g.value = g.value.map((t) => t.id === e.id ? e : t), h.value?.id === e.id && (h.value = e), e;
|
|
@@ -442,12 +442,12 @@ function he(e) {
|
|
|
442
442
|
importFromUrl: G,
|
|
443
443
|
toggleSelection: K,
|
|
444
444
|
clearSelection: q,
|
|
445
|
-
selectItem:
|
|
446
|
-
loadFolders:
|
|
447
|
-
createFolder:
|
|
448
|
-
renameFolder:
|
|
449
|
-
deleteFolder:
|
|
450
|
-
findFolderInTree:
|
|
445
|
+
selectItem: J,
|
|
446
|
+
loadFolders: Y,
|
|
447
|
+
createFolder: ee,
|
|
448
|
+
renameFolder: te,
|
|
449
|
+
deleteFolder: ne,
|
|
450
|
+
findFolderInTree: X,
|
|
451
451
|
loadFrequentlyUsed: V,
|
|
452
452
|
checkUsageBeforeDelete: H,
|
|
453
453
|
confirmDelete: U,
|
|
@@ -457,15 +457,15 @@ function he(e) {
|
|
|
457
457
|
showReplaceWarning: T,
|
|
458
458
|
pendingReplaceItem: E,
|
|
459
459
|
replaceUsageInfo: D,
|
|
460
|
-
checkUsageBeforeReplace:
|
|
461
|
-
cancelReplace:
|
|
462
|
-
replaceFile:
|
|
463
|
-
replaceMediaDirectly:
|
|
460
|
+
checkUsageBeforeReplace: re,
|
|
461
|
+
cancelReplace: ie,
|
|
462
|
+
replaceFile: ae,
|
|
463
|
+
replaceMediaDirectly: oe
|
|
464
464
|
};
|
|
465
465
|
}
|
|
466
466
|
//#endregion
|
|
467
467
|
//#region src/keys.ts
|
|
468
|
-
var
|
|
468
|
+
var he = Symbol("templaticalMediaPlanConfig"), ge = Symbol("templaticalMediaPopoverTarget"), _e = Symbol("templaticalMediaTranslations"), ve = Symbol("templaticalMediaUiTheme"), ye = Symbol("templaticalMediaUiLocale"), be = /* @__PURE__ */ fe({ default: () => xe }), xe = { mediaLibrary: {
|
|
469
469
|
title: "Media Library",
|
|
470
470
|
searchPlaceholder: "Search files...",
|
|
471
471
|
allFiles: "All Files",
|
|
@@ -551,8 +551,8 @@ var ge = Symbol("templaticalMediaPlanConfig"), _e = Symbol("templaticalMediaPopo
|
|
|
551
551
|
} };
|
|
552
552
|
//#endregion
|
|
553
553
|
//#region src/composables/useI18n.ts
|
|
554
|
-
function
|
|
555
|
-
let t = e ?? _(
|
|
554
|
+
function Z(e) {
|
|
555
|
+
let t = e ?? _(_e, null), n = (v(t) ? t.value : t) ?? xe;
|
|
556
556
|
function r(e, t) {
|
|
557
557
|
return e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : `{${n}}`);
|
|
558
558
|
}
|
|
@@ -578,7 +578,7 @@ var Se = {
|
|
|
578
578
|
},
|
|
579
579
|
emits: ["navigate"],
|
|
580
580
|
setup(e, { emit: t }) {
|
|
581
|
-
let n = e, r = t, { t: a } =
|
|
581
|
+
let n = e, r = t, { t: a } = Z(), o = s(() => {
|
|
582
582
|
if (!n.currentFolderId) return [];
|
|
583
583
|
let e = [];
|
|
584
584
|
return c(n.folders, n.currentFolderId, e), e;
|
|
@@ -607,8 +607,8 @@ var Se = {
|
|
|
607
607
|
});
|
|
608
608
|
//#endregion
|
|
609
609
|
//#region src/composables/useMediaCategories.ts
|
|
610
|
-
function
|
|
611
|
-
let t = e ?? _(
|
|
610
|
+
function Q(e) {
|
|
611
|
+
let t = e ?? _(he, null);
|
|
612
612
|
if (!t) throw Error("[Templatical] useMediaCategories() needs a plan config in scope. Render it under <MediaLibraryModal> (pass its `planConfig` prop) or provide PLAN_CONFIG_KEY yourself.");
|
|
613
613
|
let n = s(() => t.config.value?.media ?? null), r = s(() => n.value?.use_media_library ?? !0), i = s(() => n.value?.categories ?? null), a = s(() => i.value ? Object.values(i.value).flatMap((e) => e.mime_types) : []), o = s(() => a.value.join(",")), c = s(() => n.value?.max_file_size ?? 0);
|
|
614
614
|
function l(e, t) {
|
|
@@ -755,7 +755,7 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
755
755
|
},
|
|
756
756
|
emits: ["save", "close"],
|
|
757
757
|
setup(e, { emit: t }) {
|
|
758
|
-
let n = e, r = t, { t: c } =
|
|
758
|
+
let n = e, r = t, { t: c } = Z(), h = _(ve, null), g = _(ge, w(null)), v = c.mediaLibrary, { isImageMimeType: x } = Q(), C = w(""), E = w(""), O = w(null), P = w("free"), I = w(void 0), L = w(void 0), R = w(""), z = w(""), B = w(void 0), V = w(null), H = w(!1), U = w(!1), W = w(!1), G = s(() => n.item ? [
|
|
759
759
|
"image/jpeg",
|
|
760
760
|
"image/png",
|
|
761
761
|
"image/webp",
|
|
@@ -764,24 +764,24 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
764
764
|
j(() => n.visible, (e) => {
|
|
765
765
|
e && n.item && (C.value = n.item.filename, E.value = n.item.alt_text || "", P.value = "free", I.value = void 0, L.value = void 0, R.value = "", z.value = "", B.value = void 0, V.value = null, H.value = !1, W.value = !1, n.item.width && n.item.height && (B.value = n.item.width / n.item.height));
|
|
766
766
|
});
|
|
767
|
-
function
|
|
767
|
+
function J(e) {
|
|
768
768
|
e.coordinates && (V.value = {
|
|
769
769
|
width: Math.round(e.coordinates.width),
|
|
770
770
|
height: Math.round(e.coordinates.height)
|
|
771
771
|
}, W.value = !0);
|
|
772
772
|
}
|
|
773
|
-
function
|
|
773
|
+
function Y() {
|
|
774
774
|
H.value = !0, !B.value && n.item?.width && n.item?.height && (B.value = n.item.width / n.item.height);
|
|
775
775
|
}
|
|
776
|
-
function
|
|
776
|
+
function ee(e) {
|
|
777
777
|
let t = e.target.value;
|
|
778
778
|
R.value = t, I.value = t && parseInt(t, 10) || void 0;
|
|
779
779
|
}
|
|
780
|
-
function
|
|
780
|
+
function X(e) {
|
|
781
781
|
let t = e.target.value;
|
|
782
782
|
z.value = t, L.value = t && parseInt(t, 10) || void 0;
|
|
783
783
|
}
|
|
784
|
-
async function
|
|
784
|
+
async function te() {
|
|
785
785
|
let e = C.value.trim();
|
|
786
786
|
if (!e || !n.item || U.value) return;
|
|
787
787
|
let t = x(n.item.mime_type), i;
|
|
@@ -801,8 +801,8 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
801
801
|
}
|
|
802
802
|
r("save", n.item.id, e, t ? E.value : void 0, i), r("close");
|
|
803
803
|
}
|
|
804
|
-
function
|
|
805
|
-
e.key === "Enter" && !U.value && (e.preventDefault(),
|
|
804
|
+
function ne(e) {
|
|
805
|
+
e.key === "Enter" && !U.value && (e.preventDefault(), te()), e.key === "Escape" && r("close");
|
|
806
806
|
}
|
|
807
807
|
return (t, n) => (S(), l(a, { to: k(g) || "body" }, [m(o, {
|
|
808
808
|
"enter-active-class": "tpl:transition tpl:ease-out tpl:duration-150",
|
|
@@ -818,22 +818,22 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
818
818
|
class: "tpl tpl:fixed tpl:inset-0 tpl:z-[10000] tpl:flex tpl:items-center tpl:justify-center tpl:p-4",
|
|
819
819
|
style: { "background-color": "var(--tpl-overlay)" },
|
|
820
820
|
onClick: n[3] ||= F((e) => r("close"), ["self"]),
|
|
821
|
-
onKeydown:
|
|
821
|
+
onKeydown: ne
|
|
822
822
|
}, [f("div", {
|
|
823
823
|
class: y(["tpl:flex tpl:max-h-[90%] tpl:w-full tpl:flex-col tpl:overflow-hidden tpl:rounded-lg tpl:shadow-xl", G.value ? "tpl:max-w-2xl" : "tpl:max-w-sm"]),
|
|
824
824
|
style: { "background-color": "var(--tpl-bg-elevated)" }
|
|
825
825
|
}, [
|
|
826
826
|
f("div", Me, [f("h3", Ne, D(k(c).mediaLibrary.editFile), 1)]),
|
|
827
827
|
f("div", Pe, [
|
|
828
|
-
G.value ? (S(), d("div", Fe, [f("div", Ie, [m(k(
|
|
828
|
+
G.value ? (S(), d("div", Fe, [f("div", Ie, [m(k(re), {
|
|
829
829
|
ref_key: "cropperRef",
|
|
830
830
|
ref: O,
|
|
831
831
|
src: e.item.url,
|
|
832
832
|
"stencil-props": { aspectRatio: K.value },
|
|
833
833
|
class: "tpl:h-full tpl:w-full",
|
|
834
834
|
"background-class": "tpl-cropper-background",
|
|
835
|
-
onChange:
|
|
836
|
-
onReady:
|
|
835
|
+
onChange: J,
|
|
836
|
+
onReady: Y
|
|
837
837
|
}, null, 8, ["src", "stencil-props"])]), f("div", Le, [
|
|
838
838
|
f("div", null, [f("label", Re, D(k(c).mediaLibrary.cropAspectRatio), 1), f("div", ze, [(S(), d(i, null, T([
|
|
839
839
|
"free",
|
|
@@ -863,7 +863,7 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
863
863
|
color: "var(--tpl-text)"
|
|
864
864
|
},
|
|
865
865
|
placeholder: V.value?.width?.toString() || "",
|
|
866
|
-
onInput:
|
|
866
|
+
onInput: ee
|
|
867
867
|
}, null, 40, Ke), f("span", qe, D(k(c).mediaLibrary.cropPixels), 1)])]), f("div", Je, [f("label", Ye, [p(D(k(c).mediaLibrary.cropMaxHeight) + " ", 1), f("span", Xe, D(k(c).mediaLibrary.cropOptional), 1)]), f("div", Ze, [f("input", {
|
|
868
868
|
value: z.value,
|
|
869
869
|
type: "number",
|
|
@@ -875,7 +875,7 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
875
875
|
color: "var(--tpl-text)"
|
|
876
876
|
},
|
|
877
877
|
placeholder: V.value?.height?.toString() || "",
|
|
878
|
-
onInput:
|
|
878
|
+
onInput: X
|
|
879
879
|
}, null, 40, Qe), f("span", $e, D(k(c).mediaLibrary.cropPixels), 1)])])]),
|
|
880
880
|
q.value ? (S(), d("div", et, [f("span", null, D(k(c).mediaLibrary.cropOutputSize) + ": ", 1), f("span", tt, D(q.value.width) + " x " + D(q.value.height) + " " + D(k(c).mediaLibrary.cropPixels), 1)])) : u("", !0)
|
|
881
881
|
])])) : u("", !0),
|
|
@@ -914,7 +914,7 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
914
914
|
class: "tpl:cursor-pointer tpl:rounded-md tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:text-white tpl:transition-all tpl:duration-150 tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50",
|
|
915
915
|
style: { background: "linear-gradient(\n 135deg,\n var(--tpl-primary),\n var(--tpl-primary-hover)\n )" },
|
|
916
916
|
disabled: U.value,
|
|
917
|
-
onClick:
|
|
917
|
+
onClick: te
|
|
918
918
|
}, D(U.value ? k(c).mediaLibrary.saving : k(c).mediaLibrary.saveChanges), 9, lt)])
|
|
919
919
|
], 2)], 40, je)) : u("", !0)]),
|
|
920
920
|
_: 1
|
|
@@ -947,7 +947,7 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
947
947
|
"deleteFolder"
|
|
948
948
|
],
|
|
949
949
|
setup(e, { emit: t }) {
|
|
950
|
-
let n = e, r = t, { t: a } =
|
|
950
|
+
let n = e, r = t, { t: a } = Z(), o = w(!1), c = w(!1), p = w(""), h = w(!1), g = w(""), _ = s(() => (n.folder.children?.length ?? 0) > 0), v = s(() => n.depth < 4), x = s(() => n.currentFolderId === n.folder.id), C = s(() => !n.currentFolderId || !n.folder.children ? !1 : j(n.folder.children, n.currentFolderId)), O = s(() => o.value || C.value);
|
|
951
951
|
function j(e, t) {
|
|
952
952
|
for (let n of e) if (n.id === t || n.children && j(n.children, t)) return !0;
|
|
953
953
|
return !1;
|
|
@@ -1037,7 +1037,7 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1037
1037
|
f("button", {
|
|
1038
1038
|
class: "tpl:flex tpl:size-6 tpl:items-center tpl:justify-center tpl:rounded tpl:transition-colors",
|
|
1039
1039
|
onClick: n[3] ||= F((t) => r("deleteFolder", e.folder.id), ["stop"])
|
|
1040
|
-
}, [m(k(
|
|
1040
|
+
}, [m(k(X), {
|
|
1041
1041
|
size: 12,
|
|
1042
1042
|
"stroke-width": 2,
|
|
1043
1043
|
style: { color: "var(--tpl-danger)" }
|
|
@@ -1095,7 +1095,7 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1095
1095
|
"showFrequentlyUsed"
|
|
1096
1096
|
],
|
|
1097
1097
|
setup(e, { emit: t }) {
|
|
1098
|
-
let n = t, { t: r } =
|
|
1098
|
+
let n = t, { t: r } = Z(), a = w(!1), o = w("");
|
|
1099
1099
|
function s() {
|
|
1100
1100
|
a.value = !0, o.value = "";
|
|
1101
1101
|
}
|
|
@@ -1160,7 +1160,7 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1160
1160
|
color: e.viewMode === "frequently-used" ? "var(--tpl-primary)" : "var(--tpl-text)"
|
|
1161
1161
|
}),
|
|
1162
1162
|
onClick: g[6] ||= (e) => n("showFrequentlyUsed")
|
|
1163
|
-
}, [m(k(
|
|
1163
|
+
}, [m(k(ee), {
|
|
1164
1164
|
size: 14,
|
|
1165
1165
|
"stroke-width": 1.5
|
|
1166
1166
|
}), p(" " + D(k(r).mediaLibrary.frequentlyUsed), 1)], 4)) : u("", !0)
|
|
@@ -1336,48 +1336,63 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1336
1336
|
style: b({ color: i.value.color })
|
|
1337
1337
|
}, D(i.value.label), 5)]));
|
|
1338
1338
|
}
|
|
1339
|
-
})
|
|
1339
|
+
});
|
|
1340
|
+
//#endregion
|
|
1341
|
+
//#region src/utils/formatAbsoluteDate.ts
|
|
1342
|
+
function Dt(e, t, n) {
|
|
1343
|
+
let r = new Date(e);
|
|
1344
|
+
if (Number.isNaN(r.getTime())) return "";
|
|
1345
|
+
let i = t?.trim().replace(/_/g, "-") || void 0;
|
|
1346
|
+
try {
|
|
1347
|
+
return r.toLocaleDateString(i, n);
|
|
1348
|
+
} catch {
|
|
1349
|
+
return r.toLocaleDateString(void 0, n);
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
//#endregion
|
|
1353
|
+
//#region src/components/media/MediaGrid.vue?vue&type=script&setup=true&lang.ts
|
|
1354
|
+
var Ot = { class: "tpl:p-4" }, kt = {
|
|
1340
1355
|
key: 1,
|
|
1341
1356
|
class: "tpl:flex tpl:flex-col tpl:items-center tpl:justify-center tpl:py-16"
|
|
1342
|
-
},
|
|
1357
|
+
}, At = {
|
|
1343
1358
|
class: "tpl:text-xs",
|
|
1344
1359
|
style: { color: "var(--tpl-text-muted)" }
|
|
1345
|
-
},
|
|
1360
|
+
}, jt = {
|
|
1346
1361
|
key: 2,
|
|
1347
1362
|
class: "tpl:grid tpl:grid-cols-4 tpl:gap-3"
|
|
1348
|
-
},
|
|
1363
|
+
}, Mt = ["onClick"], Nt = { class: "tpl:aspect-square" }, Pt = ["src", "alt"], Ft = { class: "tpl:px-2 tpl:py-1.5" }, It = {
|
|
1349
1364
|
class: "tpl:truncate tpl:text-[10px] tpl:font-medium",
|
|
1350
1365
|
style: { color: "var(--tpl-text)" }
|
|
1351
|
-
},
|
|
1366
|
+
}, Lt = {
|
|
1352
1367
|
class: "tpl:flex tpl:justify-between tpl:text-[9px]",
|
|
1353
1368
|
style: { color: "var(--tpl-text-muted)" }
|
|
1354
|
-
},
|
|
1369
|
+
}, Rt = { key: 0 }, zt = { class: "tpl:absolute tpl:top-1.5 tpl:left-1.5 tpl:flex tpl:gap-1 tpl:opacity-0 tpl:transition-opacity tpl:duration-150 tpl:group-hover:opacity-100" }, Bt = ["title", "onClick"], Vt = ["title", "onClick"], Ht = {
|
|
1355
1370
|
key: 0,
|
|
1356
1371
|
class: "tpl:absolute tpl:top-1.5 tpl:right-1.5 tpl:flex tpl:size-5 tpl:items-center tpl:justify-center tpl:rounded-full tpl:text-white",
|
|
1357
1372
|
style: { "background-color": "var(--tpl-primary)" }
|
|
1358
|
-
},
|
|
1373
|
+
}, Ut = {
|
|
1359
1374
|
key: 3,
|
|
1360
1375
|
class: "tpl:flex tpl:flex-col tpl:gap-1"
|
|
1361
|
-
},
|
|
1376
|
+
}, Wt = ["onClick"], Gt = {
|
|
1362
1377
|
class: "tpl:size-10 tpl:shrink-0 tpl:overflow-hidden tpl:rounded",
|
|
1363
1378
|
style: { "background-color": "var(--tpl-bg-hover)" }
|
|
1364
|
-
},
|
|
1379
|
+
}, Kt = ["src", "alt"], qt = {
|
|
1365
1380
|
key: 1,
|
|
1366
1381
|
class: "tpl-list-icon tpl:size-full"
|
|
1367
|
-
},
|
|
1382
|
+
}, Jt = { class: "tpl:min-w-0 tpl:flex-1" }, Yt = {
|
|
1368
1383
|
class: "tpl:truncate tpl:text-xs tpl:font-medium",
|
|
1369
1384
|
style: { color: "var(--tpl-text)" }
|
|
1370
|
-
},
|
|
1385
|
+
}, Xt = {
|
|
1371
1386
|
class: "tpl:text-[10px]",
|
|
1372
1387
|
style: { color: "var(--tpl-text-muted)" }
|
|
1373
|
-
},
|
|
1388
|
+
}, Zt = { class: "tpl:flex tpl:gap-1 tpl:opacity-0 tpl:transition-opacity tpl:duration-150 tpl:group-hover:opacity-100" }, Qt = ["title", "onClick"], $t = ["title", "onClick"], en = {
|
|
1374
1389
|
key: 0,
|
|
1375
1390
|
class: "tpl:flex tpl:size-5 tpl:shrink-0 tpl:items-center tpl:justify-center tpl:rounded-full tpl:text-white",
|
|
1376
1391
|
style: { "background-color": "var(--tpl-primary)" }
|
|
1377
|
-
},
|
|
1392
|
+
}, tn = {
|
|
1378
1393
|
key: 4,
|
|
1379
1394
|
class: "tpl:flex tpl:justify-center tpl:py-4"
|
|
1380
|
-
},
|
|
1395
|
+
}, nn = /*#__PURE__*/ dt(/* @__PURE__ */ h({
|
|
1381
1396
|
__name: "MediaGrid",
|
|
1382
1397
|
props: {
|
|
1383
1398
|
items: {},
|
|
@@ -1395,28 +1410,28 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1395
1410
|
"replace"
|
|
1396
1411
|
],
|
|
1397
1412
|
setup(e, { emit: t }) {
|
|
1398
|
-
let n = e, r = t, { isAcceptedMimeType: a, isImageMimeType: o } =
|
|
1413
|
+
let n = e, r = t, { isAcceptedMimeType: a, isImageMimeType: o } = Q();
|
|
1399
1414
|
function s(e) {
|
|
1400
1415
|
return !n.accept || n.accept.length === 0 || a(e.mime_type, n.accept);
|
|
1401
1416
|
}
|
|
1402
1417
|
function c(e) {
|
|
1403
1418
|
r("select", e);
|
|
1404
1419
|
}
|
|
1405
|
-
let { t: h } =
|
|
1406
|
-
|
|
1420
|
+
let { t: h } = Z(), g = _(ye, null), v = w(null);
|
|
1421
|
+
ue(v, ([{ isIntersecting: e }]) => {
|
|
1407
1422
|
e && n.hasMore && !n.isLoading && r("loadMore");
|
|
1408
1423
|
}, { threshold: .1 });
|
|
1409
|
-
function
|
|
1424
|
+
function x(e) {
|
|
1410
1425
|
return e < 1024 ? `${e} B` : e < 1048576 ? `${(e / 1024).toFixed(1)} KB` : `${(e / 1048576).toFixed(1)} MB`;
|
|
1411
1426
|
}
|
|
1412
|
-
function
|
|
1413
|
-
return
|
|
1427
|
+
function C(e) {
|
|
1428
|
+
return Dt(e, g?.value, {
|
|
1414
1429
|
year: "numeric",
|
|
1415
1430
|
month: "short",
|
|
1416
1431
|
day: "numeric"
|
|
1417
1432
|
});
|
|
1418
1433
|
}
|
|
1419
|
-
return (t, n) => (S(), d("div",
|
|
1434
|
+
return (t, n) => (S(), d("div", Ot, [
|
|
1420
1435
|
e.isLoading && e.items.length === 0 ? (S(), d("div", {
|
|
1421
1436
|
key: 0,
|
|
1422
1437
|
class: y(e.layout === "list" ? "tpl:flex tpl:flex-col tpl:gap-1" : "tpl:grid tpl:grid-cols-4 tpl:gap-3")
|
|
@@ -1424,26 +1439,26 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1424
1439
|
key: t,
|
|
1425
1440
|
class: y(["tpl-pulse tpl:rounded-lg", e.layout === "list" ? "tpl:h-12" : "tpl:aspect-square"]),
|
|
1426
1441
|
style: { "background-color": "var(--tpl-bg-hover)" }
|
|
1427
|
-
}, null, 2)), 64))], 2)) : e.items.length === 0 ? (S(), d("div",
|
|
1442
|
+
}, null, 2)), 64))], 2)) : e.items.length === 0 ? (S(), d("div", kt, [m(k(z), {
|
|
1428
1443
|
class: "tpl:mb-3",
|
|
1429
1444
|
size: 40,
|
|
1430
1445
|
"stroke-width": 1,
|
|
1431
1446
|
style: { color: "var(--tpl-text-dim)" }
|
|
1432
|
-
}), f("p",
|
|
1447
|
+
}), f("p", At, D(k(h).mediaLibrary.noFiles), 1)])) : e.layout === "list" ? (S(), d("div", Ut, [(S(!0), d(i, null, T(e.items, (t) => (S(), d("div", {
|
|
1433
1448
|
key: t.id,
|
|
1434
1449
|
class: y(["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", [!s(t) && !e.selectedIds.has(t.id) ? "tpl:opacity-60" : ""]]),
|
|
1435
1450
|
style: b({ backgroundColor: e.selectedIds.has(t.id) ? "var(--tpl-bg-hover)" : "transparent" }),
|
|
1436
1451
|
onClick: (e) => c(t)
|
|
1437
1452
|
}, [
|
|
1438
|
-
f("div",
|
|
1453
|
+
f("div", Gt, [k(o)(t.mime_type) ? (S(), d("img", {
|
|
1439
1454
|
key: 0,
|
|
1440
1455
|
src: t.small_url || t.url,
|
|
1441
1456
|
alt: t.filename,
|
|
1442
1457
|
class: "tpl:size-full tpl:object-cover",
|
|
1443
1458
|
loading: "lazy"
|
|
1444
|
-
}, null, 8,
|
|
1445
|
-
f("div",
|
|
1446
|
-
f("div",
|
|
1459
|
+
}, null, 8, Kt)) : (S(), d("div", qt, [m(Et, { "mime-type": t.mime_type }, null, 8, ["mime-type"])]))]),
|
|
1460
|
+
f("div", Jt, [f("p", Yt, D(t.filename), 1), f("p", Xt, [p(D(x(t.size)) + " · " + D(C(t.created_at)) + " ", 1), k(o)(t.mime_type) && t.width && t.height ? (S(), d(i, { key: 0 }, [p(" · " + D(t.width) + "×" + D(t.height), 1)], 64)) : u("", !0)])]),
|
|
1461
|
+
f("div", Zt, [f("button", {
|
|
1447
1462
|
class: "tpl:flex tpl:size-6 tpl:shrink-0 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded",
|
|
1448
1463
|
style: { color: "var(--tpl-text-muted)" },
|
|
1449
1464
|
title: k(h).mediaLibrary.editFile,
|
|
@@ -1451,20 +1466,20 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1451
1466
|
}, [m(k(K), {
|
|
1452
1467
|
size: 12,
|
|
1453
1468
|
"stroke-width": 2
|
|
1454
|
-
})], 8,
|
|
1469
|
+
})], 8, Qt), f("button", {
|
|
1455
1470
|
class: "tpl:flex tpl:size-6 tpl:shrink-0 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded",
|
|
1456
1471
|
style: { color: "var(--tpl-text-muted)" },
|
|
1457
1472
|
title: k(h).mediaLibrary.replaceFile,
|
|
1458
1473
|
onClick: F((e) => r("replace", t), ["stop"])
|
|
1459
|
-
}, [m(k(
|
|
1474
|
+
}, [m(k(J), {
|
|
1460
1475
|
size: 12,
|
|
1461
1476
|
"stroke-width": 2
|
|
1462
|
-
})], 8,
|
|
1463
|
-
e.selectedIds.has(t.id) ? (S(), d("div",
|
|
1477
|
+
})], 8, $t)]),
|
|
1478
|
+
e.selectedIds.has(t.id) ? (S(), d("div", en, [m(k(I), {
|
|
1464
1479
|
size: 12,
|
|
1465
1480
|
"stroke-width": 3
|
|
1466
1481
|
})])) : u("", !0)
|
|
1467
|
-
], 14,
|
|
1482
|
+
], 14, Wt))), 128))])) : (S(), d("div", jt, [(S(!0), d(i, null, T(e.items, (t) => (S(), d("div", {
|
|
1468
1483
|
key: t.id,
|
|
1469
1484
|
class: y(["tpl-media-item tpl:group tpl:relative tpl:overflow-hidden tpl:rounded-lg tpl:border-2 tpl:transition-all tpl:duration-150", [
|
|
1470
1485
|
"tpl:cursor-pointer",
|
|
@@ -1477,18 +1492,18 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1477
1492
|
}),
|
|
1478
1493
|
onClick: (e) => c(t)
|
|
1479
1494
|
}, [
|
|
1480
|
-
f("div",
|
|
1495
|
+
f("div", Nt, [k(o)(t.mime_type) ? (S(), d("img", {
|
|
1481
1496
|
key: 0,
|
|
1482
1497
|
src: t.small_url || t.url,
|
|
1483
1498
|
alt: t.filename,
|
|
1484
1499
|
class: "tpl:size-full tpl:object-cover",
|
|
1485
1500
|
loading: "lazy"
|
|
1486
|
-
}, null, 8,
|
|
1501
|
+
}, null, 8, Pt)) : (S(), l(Et, {
|
|
1487
1502
|
key: 1,
|
|
1488
1503
|
"mime-type": t.mime_type
|
|
1489
1504
|
}, null, 8, ["mime-type"]))]),
|
|
1490
|
-
f("div",
|
|
1491
|
-
f("div",
|
|
1505
|
+
f("div", Ft, [f("p", It, D(t.filename), 1), f("p", Lt, [f("span", null, D(x(t.size)), 1), k(o)(t.mime_type) && t.width && t.height ? (S(), d("span", Rt, D(t.width) + "×" + D(t.height), 1)) : u("", !0)])]),
|
|
1506
|
+
f("div", zt, [f("button", {
|
|
1492
1507
|
class: "tpl:flex tpl:size-6 tpl:items-center tpl:justify-center tpl:rounded-full tpl:text-white",
|
|
1493
1508
|
style: { "background-color": "rgba(0, 0, 0, 0.6)" },
|
|
1494
1509
|
title: k(h).mediaLibrary.editFile,
|
|
@@ -1496,26 +1511,26 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1496
1511
|
}, [m(k(K), {
|
|
1497
1512
|
size: 11,
|
|
1498
1513
|
"stroke-width": 2
|
|
1499
|
-
})], 8,
|
|
1514
|
+
})], 8, Bt), f("button", {
|
|
1500
1515
|
class: "tpl:flex tpl:size-6 tpl:items-center tpl:justify-center tpl:rounded-full tpl:text-white",
|
|
1501
1516
|
style: { "background-color": "rgba(0, 0, 0, 0.6)" },
|
|
1502
1517
|
title: k(h).mediaLibrary.replaceFile,
|
|
1503
1518
|
onClick: F((e) => r("replace", t), ["stop"])
|
|
1504
|
-
}, [m(k(
|
|
1519
|
+
}, [m(k(J), {
|
|
1505
1520
|
size: 11,
|
|
1506
1521
|
"stroke-width": 2
|
|
1507
|
-
})], 8,
|
|
1508
|
-
e.selectedIds.has(t.id) ? (S(), d("div",
|
|
1522
|
+
})], 8, Vt)]),
|
|
1523
|
+
e.selectedIds.has(t.id) ? (S(), d("div", Ht, [m(k(I), {
|
|
1509
1524
|
size: 12,
|
|
1510
1525
|
"stroke-width": 3
|
|
1511
1526
|
})])) : u("", !0)
|
|
1512
|
-
], 14,
|
|
1527
|
+
], 14, Mt))), 128))])),
|
|
1513
1528
|
f("div", {
|
|
1514
1529
|
ref_key: "sentinelRef",
|
|
1515
|
-
ref:
|
|
1530
|
+
ref: v,
|
|
1516
1531
|
class: "tpl:h-4"
|
|
1517
1532
|
}, null, 512),
|
|
1518
|
-
e.isLoading && e.items.length > 0 ? (S(), d("div",
|
|
1533
|
+
e.isLoading && e.items.length > 0 ? (S(), d("div", tn, [m(k(W), {
|
|
1519
1534
|
class: "tpl-spinner",
|
|
1520
1535
|
size: 20,
|
|
1521
1536
|
"stroke-width": 2,
|
|
@@ -1523,20 +1538,20 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1523
1538
|
})])) : u("", !0)
|
|
1524
1539
|
]));
|
|
1525
1540
|
}
|
|
1526
|
-
}), [["__scopeId", "data-v-
|
|
1541
|
+
}), [["__scopeId", "data-v-5b4cc2c6"]]), rn = ["data-tpl-theme"], an = {
|
|
1527
1542
|
class: "tpl:max-h-[90%] tpl:w-full tpl:max-w-sm tpl:overflow-y-auto tpl:rounded-lg tpl:p-5 tpl:shadow-xl",
|
|
1528
1543
|
style: { "background-color": "var(--tpl-bg-elevated)" }
|
|
1529
|
-
},
|
|
1544
|
+
}, on = {
|
|
1530
1545
|
class: "tpl:mb-4 tpl:text-sm tpl:font-semibold",
|
|
1531
1546
|
style: { color: "var(--tpl-text)" }
|
|
1532
|
-
},
|
|
1547
|
+
}, sn = { class: "tpl:mb-3" }, cn = ["placeholder", "disabled"], ln = {
|
|
1533
1548
|
key: 0,
|
|
1534
1549
|
class: "tpl:mb-3 tpl:text-xs",
|
|
1535
1550
|
style: { color: "var(--tpl-danger)" }
|
|
1536
|
-
},
|
|
1551
|
+
}, un = { class: "tpl:flex tpl:justify-end tpl:gap-2" }, dn = ["disabled"], fn = ["disabled"], pn = {
|
|
1537
1552
|
key: 0,
|
|
1538
1553
|
class: "tpl:flex tpl:items-center tpl:gap-1.5"
|
|
1539
|
-
},
|
|
1554
|
+
}, mn = { key: 1 }, hn = /* @__PURE__ */ h({
|
|
1540
1555
|
__name: "MediaImportUrlModal",
|
|
1541
1556
|
props: {
|
|
1542
1557
|
visible: { type: Boolean },
|
|
@@ -1545,13 +1560,13 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1545
1560
|
},
|
|
1546
1561
|
emits: ["import", "close"],
|
|
1547
1562
|
setup(e, { emit: t }) {
|
|
1548
|
-
let n = e, r = t, { t: i } =
|
|
1563
|
+
let n = e, r = t, { t: i } = Z(), s = _(ve, null), c = _(ge, w(null)), h = w("");
|
|
1549
1564
|
j(() => n.visible, (e) => {
|
|
1550
1565
|
e && (h.value = "");
|
|
1551
1566
|
});
|
|
1552
1567
|
function g() {
|
|
1553
1568
|
let e = h.value.trim();
|
|
1554
|
-
|
|
1569
|
+
e && !n.isImporting && r("import", e);
|
|
1555
1570
|
}
|
|
1556
1571
|
function v() {
|
|
1557
1572
|
n.isImporting || r("close");
|
|
@@ -1574,9 +1589,9 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1574
1589
|
style: { "background-color": "var(--tpl-overlay)" },
|
|
1575
1590
|
onClick: F(v, ["self"]),
|
|
1576
1591
|
onKeydown: b
|
|
1577
|
-
}, [f("div",
|
|
1578
|
-
f("h3",
|
|
1579
|
-
f("div",
|
|
1592
|
+
}, [f("div", an, [
|
|
1593
|
+
f("h3", on, D(k(i).mediaLibrary.importFromUrl), 1),
|
|
1594
|
+
f("div", sn, [N(f("input", {
|
|
1580
1595
|
"onUpdate:modelValue": n[0] ||= (e) => h.value = e,
|
|
1581
1596
|
type: "url",
|
|
1582
1597
|
class: "tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:outline-none",
|
|
@@ -1588,9 +1603,9 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1588
1603
|
placeholder: k(i).mediaLibrary.importUrlPlaceholder,
|
|
1589
1604
|
disabled: e.isImporting,
|
|
1590
1605
|
autofocus: ""
|
|
1591
|
-
}, null, 8,
|
|
1592
|
-
e.error ? (S(), d("p",
|
|
1593
|
-
f("div",
|
|
1606
|
+
}, null, 8, cn), [[A, h.value]])]),
|
|
1607
|
+
e.error ? (S(), d("p", ln, D(e.error), 1)) : u("", !0),
|
|
1608
|
+
f("div", un, [f("button", {
|
|
1594
1609
|
class: y(["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 }]),
|
|
1595
1610
|
style: {
|
|
1596
1611
|
"border-color": "var(--tpl-border)",
|
|
@@ -1599,25 +1614,25 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1599
1614
|
},
|
|
1600
1615
|
disabled: e.isImporting,
|
|
1601
1616
|
onClick: v
|
|
1602
|
-
}, D(k(i).mediaLibrary.cancel), 11,
|
|
1617
|
+
}, D(k(i).mediaLibrary.cancel), 11, dn), f("button", {
|
|
1603
1618
|
class: "tpl:cursor-pointer tpl:rounded-md tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:text-white tpl:transition-all tpl:duration-150 tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50",
|
|
1604
1619
|
style: { background: "linear-gradient(\n 135deg,\n var(--tpl-primary),\n var(--tpl-primary-hover)\n )" },
|
|
1605
1620
|
disabled: !h.value.trim() || e.isImporting,
|
|
1606
1621
|
onClick: g
|
|
1607
|
-
}, [e.isImporting ? (S(), d("span",
|
|
1622
|
+
}, [e.isImporting ? (S(), d("span", pn, [m(k(W), {
|
|
1608
1623
|
class: "tpl:animate-spin",
|
|
1609
1624
|
size: 12,
|
|
1610
1625
|
"stroke-width": 2
|
|
1611
|
-
}), p(" " + D(k(i).mediaLibrary.importing), 1)])) : (S(), d("span",
|
|
1612
|
-
])], 40,
|
|
1626
|
+
}), p(" " + D(k(i).mediaLibrary.importing), 1)])) : (S(), d("span", mn, D(k(i).mediaLibrary.import), 1))], 8, fn)])
|
|
1627
|
+
])], 40, rn)) : u("", !0)]),
|
|
1613
1628
|
_: 1
|
|
1614
1629
|
})], 8, ["to"]));
|
|
1615
1630
|
}
|
|
1616
|
-
}),
|
|
1631
|
+
}), gn = { class: "tpl:max-h-56 tpl:overflow-y-auto tpl:py-1" }, _n = ["disabled", "onClick"], vn = { class: "tpl:truncate" }, yn = {
|
|
1617
1632
|
key: 0,
|
|
1618
1633
|
class: "tpl:shrink-0",
|
|
1619
1634
|
style: { color: "var(--tpl-text-dim)" }
|
|
1620
|
-
},
|
|
1635
|
+
}, bn = /* @__PURE__ */ h({
|
|
1621
1636
|
__name: "MediaMovePicker",
|
|
1622
1637
|
props: {
|
|
1623
1638
|
folders: {},
|
|
@@ -1625,7 +1640,7 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1625
1640
|
},
|
|
1626
1641
|
emits: ["select", "close"],
|
|
1627
1642
|
setup(e, { emit: t }) {
|
|
1628
|
-
let n = t, { t: r } =
|
|
1643
|
+
let n = t, { t: r } = Z(), a = w(null);
|
|
1629
1644
|
function o(e, t = 0) {
|
|
1630
1645
|
let n = [];
|
|
1631
1646
|
for (let r of e) n.push({
|
|
@@ -1635,7 +1650,7 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1635
1650
|
}), r.children?.length && n.push(...o(r.children, t + 1));
|
|
1636
1651
|
return n;
|
|
1637
1652
|
}
|
|
1638
|
-
return
|
|
1653
|
+
return ie(a, () => {
|
|
1639
1654
|
n("close");
|
|
1640
1655
|
}), (t, s) => (S(), d("div", {
|
|
1641
1656
|
ref_key: "pickerRef",
|
|
@@ -1645,7 +1660,7 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1645
1660
|
"border-color": "var(--tpl-border)",
|
|
1646
1661
|
"background-color": "var(--tpl-bg-elevated)"
|
|
1647
1662
|
}
|
|
1648
|
-
}, [f("div",
|
|
1663
|
+
}, [f("div", gn, [e.currentFolderId === null ? u("", !0) : (S(), d("button", {
|
|
1649
1664
|
key: 0,
|
|
1650
1665
|
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",
|
|
1651
1666
|
style: { color: "var(--tpl-text)" },
|
|
@@ -1670,27 +1685,27 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1670
1685
|
size: 14,
|
|
1671
1686
|
"stroke-width": 1.5
|
|
1672
1687
|
}),
|
|
1673
|
-
f("span",
|
|
1674
|
-
t.id === e.currentFolderId ? (S(), d("span",
|
|
1675
|
-
], 12,
|
|
1688
|
+
f("span", vn, D(t.name), 1),
|
|
1689
|
+
t.id === e.currentFolderId ? (S(), d("span", yn, D(k(r).mediaLibrary.currentFolder), 1)) : u("", !0)
|
|
1690
|
+
], 12, _n))), 128))])], 512));
|
|
1676
1691
|
}
|
|
1677
|
-
}),
|
|
1692
|
+
}), xn = { class: "tpl:flex tpl:items-center tpl:gap-3" }, Sn = ["src", "alt"], Cn = {
|
|
1678
1693
|
key: 1,
|
|
1679
1694
|
class: "tpl:flex tpl:size-10 tpl:shrink-0 tpl:items-center tpl:justify-center tpl:overflow-hidden tpl:rounded",
|
|
1680
1695
|
style: { border: "1px solid var(--tpl-border)" }
|
|
1681
|
-
},
|
|
1696
|
+
}, wn = { class: "tpl:min-w-0 tpl:flex-1" }, Tn = {
|
|
1682
1697
|
class: "tpl:truncate tpl:text-xs tpl:font-medium",
|
|
1683
1698
|
style: { color: "var(--tpl-text)" }
|
|
1684
|
-
},
|
|
1699
|
+
}, En = {
|
|
1685
1700
|
class: "tpl:mt-0.5 tpl:text-[10px]",
|
|
1686
1701
|
style: { color: "var(--tpl-text-muted)" }
|
|
1687
|
-
},
|
|
1702
|
+
}, Dn = {
|
|
1688
1703
|
key: 2,
|
|
1689
1704
|
class: "tpl:shrink-0"
|
|
1690
|
-
},
|
|
1705
|
+
}, On = {
|
|
1691
1706
|
class: "tpl:block tpl:text-[10px]",
|
|
1692
1707
|
style: { color: "var(--tpl-text-muted)" }
|
|
1693
|
-
},
|
|
1708
|
+
}, kn = ["value"], An = ["value"], jn = /*#__PURE__*/ dt(/* @__PURE__ */ h({
|
|
1694
1709
|
__name: "MediaPreviewPanel",
|
|
1695
1710
|
props: {
|
|
1696
1711
|
item: {},
|
|
@@ -1699,8 +1714,8 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1699
1714
|
},
|
|
1700
1715
|
emits: ["update:selectedConversion"],
|
|
1701
1716
|
setup(e, { emit: t }) {
|
|
1702
|
-
let n = e, r = t, { t: a } =
|
|
1703
|
-
if (!
|
|
1717
|
+
let n = e, r = t, { t: a } = Z(), o = _(ye, null), { isImageMimeType: c } = Q(), l = s(() => {
|
|
1718
|
+
if (!C.value || !n.item.conversions_generated) return [];
|
|
1704
1719
|
let e = [];
|
|
1705
1720
|
return n.item.small_url && e.push({
|
|
1706
1721
|
value: "small",
|
|
@@ -1719,8 +1734,8 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1719
1734
|
label: a.mediaLibrary.conversionOriginal,
|
|
1720
1735
|
url: n.item.url
|
|
1721
1736
|
}), e;
|
|
1722
|
-
}),
|
|
1723
|
-
if (!
|
|
1737
|
+
}), h = s(() => C.value && l.value.length > 1), g = s(() => {
|
|
1738
|
+
if (!C.value) return null;
|
|
1724
1739
|
switch (n.selectedConversion) {
|
|
1725
1740
|
case "small": return n.item.small_url || n.item.url;
|
|
1726
1741
|
case "medium": return n.item.medium_url || n.item.url;
|
|
@@ -1728,69 +1743,69 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1728
1743
|
default: return n.item.url;
|
|
1729
1744
|
}
|
|
1730
1745
|
});
|
|
1731
|
-
function
|
|
1746
|
+
function v(e) {
|
|
1732
1747
|
let t = e.target;
|
|
1733
1748
|
r("update:selectedConversion", t.value);
|
|
1734
1749
|
}
|
|
1735
|
-
function
|
|
1750
|
+
function b(e, t, n = []) {
|
|
1736
1751
|
for (let r of e) {
|
|
1737
1752
|
let e = [...n, r.name];
|
|
1738
1753
|
if (r.id === t) return e;
|
|
1739
1754
|
if (r.children) {
|
|
1740
|
-
let n =
|
|
1755
|
+
let n = b(r.children, t, e);
|
|
1741
1756
|
if (n) return n;
|
|
1742
1757
|
}
|
|
1743
1758
|
}
|
|
1744
1759
|
return null;
|
|
1745
1760
|
}
|
|
1746
|
-
let
|
|
1761
|
+
let x = s(() => {
|
|
1747
1762
|
if (!n.item.folder_id || !n.folders) return null;
|
|
1748
|
-
let e =
|
|
1763
|
+
let e = b(n.folders, n.item.folder_id);
|
|
1749
1764
|
return e ? e.join("/") : null;
|
|
1750
|
-
}),
|
|
1751
|
-
function
|
|
1765
|
+
}), C = s(() => c(n.item.mime_type));
|
|
1766
|
+
function w(e) {
|
|
1752
1767
|
return e < 1024 ? `${e} B` : e < 1048576 ? `${(e / 1024).toFixed(1)} KB` : `${(e / 1048576).toFixed(1)} MB`;
|
|
1753
1768
|
}
|
|
1754
|
-
function
|
|
1755
|
-
return
|
|
1769
|
+
function E(e) {
|
|
1770
|
+
return Dt(e, o?.value, {
|
|
1756
1771
|
year: "numeric",
|
|
1757
1772
|
month: "short",
|
|
1758
1773
|
day: "numeric"
|
|
1759
1774
|
});
|
|
1760
1775
|
}
|
|
1761
|
-
return (t, n) => (S(), d("div",
|
|
1762
|
-
|
|
1776
|
+
return (t, n) => (S(), d("div", xn, [
|
|
1777
|
+
C.value ? (S(), d("img", {
|
|
1763
1778
|
key: 0,
|
|
1764
|
-
src:
|
|
1779
|
+
src: g.value ?? void 0,
|
|
1765
1780
|
alt: e.item.alt_text || e.item.filename,
|
|
1766
1781
|
class: "tpl:size-10 tpl:shrink-0 tpl:rounded tpl:object-cover",
|
|
1767
1782
|
style: { border: "1px solid var(--tpl-border)" }
|
|
1768
|
-
}, null, 8,
|
|
1783
|
+
}, null, 8, Sn)) : (S(), d("div", Cn, [m(Et, {
|
|
1769
1784
|
"mime-type": e.item.mime_type,
|
|
1770
1785
|
class: "tpl-preview-icon"
|
|
1771
1786
|
}, null, 8, ["mime-type"])])),
|
|
1772
|
-
f("div",
|
|
1773
|
-
f("p",
|
|
1774
|
-
f("p",
|
|
1775
|
-
p(D(
|
|
1776
|
-
|
|
1777
|
-
|
|
1787
|
+
f("div", wn, [
|
|
1788
|
+
f("p", Tn, D(e.item.filename), 1),
|
|
1789
|
+
f("p", En, [
|
|
1790
|
+
p(D(w(e.item.size)) + " · " + D(E(e.item.created_at)) + " ", 1),
|
|
1791
|
+
C.value && e.item.width && e.item.height ? (S(), d(i, { key: 0 }, [p(" · " + D(e.item.width) + "×" + D(e.item.height) + "px ", 1)], 64)) : u("", !0),
|
|
1792
|
+
x.value ? (S(), d(i, { key: 1 }, [
|
|
1778
1793
|
n[0] ||= p(" · ", -1),
|
|
1779
1794
|
m(k(B), {
|
|
1780
1795
|
class: "tpl:mb-px tpl:inline",
|
|
1781
1796
|
size: 9,
|
|
1782
1797
|
"stroke-width": 2
|
|
1783
1798
|
}),
|
|
1784
|
-
p(" " + D(
|
|
1799
|
+
p(" " + D(x.value), 1)
|
|
1785
1800
|
], 64)) : u("", !0)
|
|
1786
1801
|
]),
|
|
1787
|
-
|
|
1802
|
+
C.value ? (S(), d("p", {
|
|
1788
1803
|
key: 0,
|
|
1789
1804
|
class: y(["tpl:mt-0.5 tpl:truncate tpl:text-[10px] tpl:italic", { "tpl:invisible": !e.item.alt_text }]),
|
|
1790
1805
|
style: { color: "var(--tpl-text-dim)" }
|
|
1791
1806
|
}, D(e.item.alt_text || "\xA0"), 3)) : u("", !0)
|
|
1792
1807
|
]),
|
|
1793
|
-
|
|
1808
|
+
h.value ? (S(), d("div", Dn, [f("label", On, D(k(a).mediaLibrary.conversionLabel), 1), f("select", {
|
|
1794
1809
|
class: "tpl:mt-0.5 tpl:rounded-md tpl:border tpl:py-1 tpl:pr-6 tpl:pl-2 tpl:text-xs tpl:outline-none",
|
|
1795
1810
|
style: {
|
|
1796
1811
|
"border-color": "var(--tpl-border)",
|
|
@@ -1798,40 +1813,40 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1798
1813
|
color: "var(--tpl-text)"
|
|
1799
1814
|
},
|
|
1800
1815
|
value: e.selectedConversion,
|
|
1801
|
-
onChange:
|
|
1802
|
-
}, [(S(!0), d(i, null, T(
|
|
1816
|
+
onChange: v
|
|
1817
|
+
}, [(S(!0), d(i, null, T(l.value, (e) => (S(), d("option", {
|
|
1803
1818
|
key: e.value,
|
|
1804
1819
|
value: e.value
|
|
1805
|
-
}, D(e.label), 9,
|
|
1820
|
+
}, D(e.label), 9, An))), 128))], 40, kn)])) : u("", !0)
|
|
1806
1821
|
]));
|
|
1807
1822
|
}
|
|
1808
|
-
}), [["__scopeId", "data-v-
|
|
1823
|
+
}), [["__scopeId", "data-v-79f055d7"]]), Mn = ["data-tpl-theme"], Nn = {
|
|
1809
1824
|
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",
|
|
1810
1825
|
style: { "background-color": "var(--tpl-bg-elevated)" }
|
|
1811
|
-
},
|
|
1826
|
+
}, Pn = {
|
|
1812
1827
|
class: "tpl:mb-2 tpl:text-sm tpl:font-semibold",
|
|
1813
1828
|
style: { color: "var(--tpl-text)" }
|
|
1814
|
-
},
|
|
1829
|
+
}, Fn = {
|
|
1815
1830
|
class: "tpl:mb-2 tpl:text-xs",
|
|
1816
1831
|
style: { color: "var(--tpl-text-muted)" }
|
|
1817
|
-
},
|
|
1832
|
+
}, In = {
|
|
1818
1833
|
key: 0,
|
|
1819
1834
|
class: "tpl:mb-3 tpl:text-xs",
|
|
1820
1835
|
style: { color: "var(--tpl-warning)" }
|
|
1821
|
-
},
|
|
1836
|
+
}, Ln = {
|
|
1822
1837
|
class: "tpl:mb-3 tpl:rounded tpl:border tpl:p-2",
|
|
1823
1838
|
style: { "border-color": "var(--tpl-border)" }
|
|
1824
|
-
},
|
|
1839
|
+
}, Rn = {
|
|
1825
1840
|
class: "tpl:truncate tpl:text-xs tpl:font-medium",
|
|
1826
1841
|
style: { color: "var(--tpl-text)" }
|
|
1827
|
-
},
|
|
1842
|
+
}, zn = { class: "tpl:mb-4" }, Bn = {
|
|
1828
1843
|
class: "tpl:mb-1 tpl:block tpl:text-xs tpl:font-medium",
|
|
1829
1844
|
style: { color: "var(--tpl-text-muted)" }
|
|
1830
|
-
},
|
|
1845
|
+
}, Vn = ["accept"], Hn = {
|
|
1831
1846
|
key: 1,
|
|
1832
1847
|
class: "tpl:mb-3 tpl:text-xs",
|
|
1833
1848
|
style: { color: "var(--tpl-danger)" }
|
|
1834
|
-
},
|
|
1849
|
+
}, Un = { class: "tpl:flex tpl:justify-end tpl:gap-2" }, Wn = ["disabled"], Gn = ["disabled"], Kn = /* @__PURE__ */ h({
|
|
1835
1850
|
__name: "MediaReplaceModal",
|
|
1836
1851
|
props: {
|
|
1837
1852
|
visible: { type: Boolean },
|
|
@@ -1842,7 +1857,7 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1842
1857
|
},
|
|
1843
1858
|
emits: ["replace", "close"],
|
|
1844
1859
|
setup(e, { emit: t }) {
|
|
1845
|
-
let n = e, r = t, { t: i } =
|
|
1860
|
+
let n = e, r = t, { t: i } = Z(), c = _(ve, null), p = _(ge, w(null)), h = w(null), g = w(null), v = s(() => {
|
|
1846
1861
|
if (!n.item) return "";
|
|
1847
1862
|
let e = n.item.filename.split(".");
|
|
1848
1863
|
return e.length > 1 ? e[e.length - 1].toLowerCase() : "";
|
|
@@ -1875,12 +1890,12 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1875
1890
|
style: { "background-color": "var(--tpl-overlay)" },
|
|
1876
1891
|
onClick: n[1] ||= F((e) => r("close"), ["self"]),
|
|
1877
1892
|
onKeydown: T
|
|
1878
|
-
}, [f("div",
|
|
1879
|
-
f("h3",
|
|
1880
|
-
f("p",
|
|
1881
|
-
b.value ? (S(), d("p",
|
|
1882
|
-
f("div",
|
|
1883
|
-
f("div",
|
|
1893
|
+
}, [f("div", Nn, [
|
|
1894
|
+
f("h3", Pn, D(k(i).mediaLibrary.replaceWarningTitle), 1),
|
|
1895
|
+
f("p", Fn, D(k(i).mediaLibrary.replaceWarningMessage.replace("{extension}", `.${v.value}`)), 1),
|
|
1896
|
+
b.value ? (S(), d("p", In, D(k(i).mediaLibrary.replaceWarningUsageNote.replace("{count}", e.usageInfo.template_count.toString())), 1)) : u("", !0),
|
|
1897
|
+
f("div", Ln, [f("p", Rn, D(e.item.filename), 1)]),
|
|
1898
|
+
f("div", zn, [f("label", Bn, D(k(i).mediaLibrary.replaceSelectFile), 1), f("input", {
|
|
1884
1899
|
ref_key: "fileInputRef",
|
|
1885
1900
|
ref: h,
|
|
1886
1901
|
type: "file",
|
|
@@ -1892,9 +1907,9 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1892
1907
|
color: "var(--tpl-text)"
|
|
1893
1908
|
},
|
|
1894
1909
|
onChange: x
|
|
1895
|
-
}, null, 40,
|
|
1896
|
-
e.error ? (S(), d("p",
|
|
1897
|
-
f("div",
|
|
1910
|
+
}, null, 40, Vn)]),
|
|
1911
|
+
e.error ? (S(), d("p", Hn, D(e.error), 1)) : u("", !0),
|
|
1912
|
+
f("div", Un, [f("button", {
|
|
1898
1913
|
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",
|
|
1899
1914
|
style: {
|
|
1900
1915
|
"border-color": "var(--tpl-border)",
|
|
@@ -1903,29 +1918,29 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1903
1918
|
},
|
|
1904
1919
|
disabled: e.isReplacing,
|
|
1905
1920
|
onClick: n[0] ||= (e) => r("close")
|
|
1906
|
-
}, D(k(i).mediaLibrary.cancel), 9,
|
|
1921
|
+
}, D(k(i).mediaLibrary.cancel), 9, Wn), f("button", {
|
|
1907
1922
|
class: "tpl:cursor-pointer tpl:rounded-md tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:text-white tpl:transition-all tpl:duration-150 tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50",
|
|
1908
1923
|
style: { background: "linear-gradient(\n 135deg,\n var(--tpl-primary),\n var(--tpl-primary-hover)\n )" },
|
|
1909
1924
|
disabled: !g.value || e.isReplacing,
|
|
1910
1925
|
onClick: C
|
|
1911
|
-
}, D(e.isReplacing ? k(i).mediaLibrary.replacing : k(i).mediaLibrary.replace), 9,
|
|
1912
|
-
])], 40,
|
|
1926
|
+
}, D(e.isReplacing ? k(i).mediaLibrary.replacing : k(i).mediaLibrary.replace), 9, Gn)])
|
|
1927
|
+
])], 40, Mn)) : u("", !0)]),
|
|
1913
1928
|
_: 1
|
|
1914
1929
|
})], 8, ["to"]));
|
|
1915
1930
|
}
|
|
1916
|
-
}),
|
|
1931
|
+
}), qn = {
|
|
1917
1932
|
key: 0,
|
|
1918
1933
|
class: "tpl:flex tpl:items-center tpl:gap-2"
|
|
1919
|
-
}, qn = {
|
|
1920
|
-
class: "tpl:text-xs",
|
|
1921
|
-
style: { color: "var(--tpl-text-muted)" }
|
|
1922
1934
|
}, Jn = {
|
|
1923
1935
|
class: "tpl:text-xs",
|
|
1924
1936
|
style: { color: "var(--tpl-text-muted)" }
|
|
1925
1937
|
}, Yn = {
|
|
1938
|
+
class: "tpl:text-xs",
|
|
1939
|
+
style: { color: "var(--tpl-text-muted)" }
|
|
1940
|
+
}, Xn = {
|
|
1926
1941
|
class: "tpl:mt-1 tpl:text-[10px]",
|
|
1927
1942
|
style: { color: "var(--tpl-text-dim)" }
|
|
1928
|
-
},
|
|
1943
|
+
}, Zn = /* @__PURE__ */ h({
|
|
1929
1944
|
__name: "MediaUploadZone",
|
|
1930
1945
|
props: {
|
|
1931
1946
|
isUploading: { type: Boolean },
|
|
@@ -1933,7 +1948,7 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1933
1948
|
},
|
|
1934
1949
|
emits: ["upload"],
|
|
1935
1950
|
setup(e, { emit: t }) {
|
|
1936
|
-
let n = t, { t: r, format: a } =
|
|
1951
|
+
let n = t, { t: r, format: a } = Z(), { allAcceptedMimeTypes: o, allAcceptedInputString: s, maxFileSize: c } = Q(), l = w();
|
|
1937
1952
|
function u(e) {
|
|
1938
1953
|
let t = [];
|
|
1939
1954
|
for (let n of Array.from(e)) o.value.includes(n.type) && n.size <= c.value && t.push(n);
|
|
@@ -1943,9 +1958,9 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1943
1958
|
let t = u(e);
|
|
1944
1959
|
t.length && n("upload", t);
|
|
1945
1960
|
}
|
|
1946
|
-
let { isOverDropZone: h } =
|
|
1961
|
+
let { isOverDropZone: h } = se(l, { onDrop: (e) => {
|
|
1947
1962
|
e?.length && p(e);
|
|
1948
|
-
} }), { open: g, onChange: _ } =
|
|
1963
|
+
} }), { open: g, onChange: _ } = le({
|
|
1949
1964
|
accept: s.value,
|
|
1950
1965
|
multiple: !0
|
|
1951
1966
|
});
|
|
@@ -1960,35 +1975,35 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1960
1975
|
"background-color": "var(--tpl-bg)"
|
|
1961
1976
|
},
|
|
1962
1977
|
onClick: n[0] ||= (e) => k(g)()
|
|
1963
|
-
}, [e.isUploading ? (S(), d("div",
|
|
1978
|
+
}, [e.isUploading ? (S(), d("div", qn, [m(k(W), {
|
|
1964
1979
|
class: "tpl-spinner",
|
|
1965
1980
|
size: 20,
|
|
1966
1981
|
"stroke-width": 2,
|
|
1967
1982
|
style: { color: "var(--tpl-primary)" }
|
|
1968
|
-
}), f("span",
|
|
1983
|
+
}), f("span", Jn, D(e.uploadProgress && e.uploadProgress.total > 1 ? k(a)(k(r).mediaLibrary.uploadingProgress, {
|
|
1969
1984
|
current: e.uploadProgress.current,
|
|
1970
1985
|
total: e.uploadProgress.total
|
|
1971
1986
|
}) : k(r).mediaLibrary.uploading), 1)])) : (S(), d(i, { key: 1 }, [
|
|
1972
|
-
m(k(
|
|
1987
|
+
m(k(te), {
|
|
1973
1988
|
class: "tpl:mb-2",
|
|
1974
1989
|
size: 24,
|
|
1975
1990
|
"stroke-width": 1.5,
|
|
1976
1991
|
style: { color: "var(--tpl-text-dim)" }
|
|
1977
1992
|
}),
|
|
1978
|
-
f("p",
|
|
1979
|
-
f("p",
|
|
1993
|
+
f("p", Yn, D(k(r).mediaLibrary.dropOrClick), 1),
|
|
1994
|
+
f("p", Xn, D(k(r).mediaLibrary.acceptedFormats), 1)
|
|
1980
1995
|
], 64))], 2));
|
|
1981
1996
|
}
|
|
1982
|
-
}),
|
|
1997
|
+
}), Qn = [
|
|
1983
1998
|
"width",
|
|
1984
1999
|
"height",
|
|
1985
2000
|
"viewBox"
|
|
1986
|
-
],
|
|
2001
|
+
], $n = [
|
|
1987
2002
|
"cx",
|
|
1988
2003
|
"cy",
|
|
1989
2004
|
"r",
|
|
1990
2005
|
"stroke-width"
|
|
1991
|
-
],
|
|
2006
|
+
], er = [
|
|
1992
2007
|
"cx",
|
|
1993
2008
|
"cy",
|
|
1994
2009
|
"r",
|
|
@@ -1996,14 +2011,14 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1996
2011
|
"stroke",
|
|
1997
2012
|
"stroke-dasharray",
|
|
1998
2013
|
"stroke-dashoffset"
|
|
1999
|
-
],
|
|
2014
|
+
], tr = {
|
|
2000
2015
|
key: 0,
|
|
2001
2016
|
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",
|
|
2002
2017
|
style: {
|
|
2003
2018
|
"background-color": "var(--tpl-text)",
|
|
2004
2019
|
color: "var(--tpl-bg-elevated)"
|
|
2005
2020
|
}
|
|
2006
|
-
},
|
|
2021
|
+
}, nr = /* @__PURE__ */ h({
|
|
2007
2022
|
__name: "StorageProgressRing",
|
|
2008
2023
|
props: {
|
|
2009
2024
|
usedBytes: {},
|
|
@@ -2011,7 +2026,7 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
2011
2026
|
size: {}
|
|
2012
2027
|
},
|
|
2013
2028
|
setup(e) {
|
|
2014
|
-
let t = e, { t: n, format: r } =
|
|
2029
|
+
let t = e, { t: n, format: r } = Z(), i = w(!1), a = s(() => t.size ?? 24), c = s(() => Math.max(2, a.value / 8)), l = s(() => (a.value - c.value) / 2), h = s(() => 2 * Math.PI * l.value), g = s(() => t.limitBytes <= 0 ? 0 : Math.min(100, t.usedBytes / t.limitBytes * 100)), _ = s(() => h.value - g.value / 100 * h.value), v = s(() => g.value >= 95 ? "var(--tpl-danger)" : g.value >= 75 ? "var(--tpl-warning, #f59e0b)" : "var(--tpl-primary)");
|
|
2015
2030
|
function y(e) {
|
|
2016
2031
|
if (e === 0) return "0 B";
|
|
2017
2032
|
let t = 1024, n = [
|
|
@@ -2043,7 +2058,7 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
2043
2058
|
fill: "none",
|
|
2044
2059
|
"stroke-width": c.value,
|
|
2045
2060
|
style: { stroke: "var(--tpl-border)" }
|
|
2046
|
-
}, null, 8,
|
|
2061
|
+
}, null, 8, $n), f("circle", {
|
|
2047
2062
|
cx: a.value / 2,
|
|
2048
2063
|
cy: a.value / 2,
|
|
2049
2064
|
r: l.value,
|
|
@@ -2054,7 +2069,7 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
2054
2069
|
"stroke-dasharray": h.value,
|
|
2055
2070
|
"stroke-dashoffset": _.value,
|
|
2056
2071
|
class: "tpl:transition-all tpl:duration-300 tpl:ease-out"
|
|
2057
|
-
}, null, 8,
|
|
2072
|
+
}, null, 8, er)], 8, Qn)), m(o, {
|
|
2058
2073
|
"enter-active-class": "tpl:transition tpl:ease-out tpl:duration-150",
|
|
2059
2074
|
"enter-from-class": "tpl:opacity-0 tpl:translate-y-1",
|
|
2060
2075
|
"enter-to-class": "tpl:opacity-100 tpl:translate-y-0",
|
|
@@ -2062,7 +2077,7 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
2062
2077
|
"leave-from-class": "tpl:opacity-100 tpl:translate-y-0",
|
|
2063
2078
|
"leave-to-class": "tpl:opacity-0 tpl:translate-y-1"
|
|
2064
2079
|
}, {
|
|
2065
|
-
default: M(() => [i.value ? (S(), d("div",
|
|
2080
|
+
default: M(() => [i.value ? (S(), d("div", tr, [p(D(E.value) + " ", 1), t[2] ||= f("div", {
|
|
2066
2081
|
class: "tpl:absolute tpl:-top-1 tpl:left-1/2 tpl:size-2 tpl:-translate-x-1/2 tpl:rotate-45",
|
|
2067
2082
|
style: { "background-color": "var(--tpl-text)" }
|
|
2068
2083
|
}, null, -1)])) : u("", !0)]),
|
|
@@ -2072,7 +2087,7 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
2072
2087
|
});
|
|
2073
2088
|
//#endregion
|
|
2074
2089
|
//#region src/composables/useMediaLibraryUI.ts
|
|
2075
|
-
function
|
|
2090
|
+
function rr(e) {
|
|
2076
2091
|
let { library: t, translations: n } = e;
|
|
2077
2092
|
function r() {
|
|
2078
2093
|
return "value" in n && typeof n.value == "object" ? n.value : n;
|
|
@@ -2100,13 +2115,13 @@ function nr(e) {
|
|
|
2100
2115
|
}), j(() => t.previewItem.value?.id, () => {
|
|
2101
2116
|
c.value = "original";
|
|
2102
2117
|
});
|
|
2103
|
-
let v =
|
|
2118
|
+
let v = oe((e) => {
|
|
2104
2119
|
t.search(e);
|
|
2105
2120
|
}, 300);
|
|
2106
2121
|
function y(e) {
|
|
2107
2122
|
o.value = e, v(e);
|
|
2108
2123
|
}
|
|
2109
|
-
let { copy: b, copied: x } =
|
|
2124
|
+
let { copy: b, copied: x } = ae({
|
|
2110
2125
|
copiedDuring: 2e3,
|
|
2111
2126
|
legacy: !0
|
|
2112
2127
|
});
|
|
@@ -2182,7 +2197,7 @@ function nr(e) {
|
|
|
2182
2197
|
}
|
|
2183
2198
|
//#endregion
|
|
2184
2199
|
//#region src/i18n/index.ts
|
|
2185
|
-
var
|
|
2200
|
+
var ir = /* #__PURE__ */ Object.assign({
|
|
2186
2201
|
"./locales/ca.ts": () => import("./ca-DnghH5Xn.js"),
|
|
2187
2202
|
"./locales/de.ts": () => import("./de-ByQyu2jv.js"),
|
|
2188
2203
|
"./locales/en.ts": () => Promise.resolve().then(() => be),
|
|
@@ -2191,30 +2206,30 @@ var rr = /* #__PURE__ */ Object.assign({
|
|
|
2191
2206
|
"./locales/nl.ts": () => import("./nl-DGT1t3Be.js"),
|
|
2192
2207
|
"./locales/pt-BR.ts": () => import("./pt-BR-C0Hzc26R.js")
|
|
2193
2208
|
});
|
|
2194
|
-
function
|
|
2209
|
+
function ar(e) {
|
|
2195
2210
|
return Object.keys(e).map((e) => e.match(/\/([^/]+)\.ts$/)?.[1]).filter((e) => !!e);
|
|
2196
2211
|
}
|
|
2197
|
-
var
|
|
2198
|
-
function or(e) {
|
|
2199
|
-
return e.trim().replace(/_/g, "-").toLowerCase();
|
|
2200
|
-
}
|
|
2212
|
+
var or = ar(ir);
|
|
2201
2213
|
function sr(e) {
|
|
2202
|
-
|
|
2203
|
-
return ar.find((e) => or(e) === t);
|
|
2214
|
+
return e.trim().replace(/_/g, "-").toLowerCase();
|
|
2204
2215
|
}
|
|
2205
2216
|
function cr(e) {
|
|
2206
|
-
|
|
2217
|
+
let t = sr(e);
|
|
2218
|
+
return or.find((e) => sr(e) === t);
|
|
2207
2219
|
}
|
|
2208
2220
|
function lr(e) {
|
|
2209
|
-
return sr(e)
|
|
2221
|
+
return sr(e).split("-")[0];
|
|
2210
2222
|
}
|
|
2211
|
-
|
|
2212
|
-
|
|
2223
|
+
function ur(e) {
|
|
2224
|
+
return cr(e) ?? cr(lr(e)) ?? "en";
|
|
2225
|
+
}
|
|
2226
|
+
async function dr(e) {
|
|
2227
|
+
let t = ir[`./locales/${ur(e)}.ts`];
|
|
2213
2228
|
return (await t()).default;
|
|
2214
2229
|
}
|
|
2215
2230
|
//#endregion
|
|
2216
2231
|
//#region src/components/MediaLibraryModal.vue?vue&type=script&setup=true&lang.ts
|
|
2217
|
-
var
|
|
2232
|
+
var fr = ["data-tpl-theme"], pr = {
|
|
2218
2233
|
class: "tpl-media-modal tpl-scale-in tpl:flex tpl:flex-col tpl:overflow-hidden tpl:rounded-[var(--tpl-radius-lg)]",
|
|
2219
2234
|
style: {
|
|
2220
2235
|
width: "900px",
|
|
@@ -2225,59 +2240,59 @@ var dr = ["data-tpl-theme"], fr = {
|
|
|
2225
2240
|
border: "1px solid var(--tpl-border)",
|
|
2226
2241
|
"box-shadow": "var(--tpl-shadow-xl)"
|
|
2227
2242
|
}
|
|
2228
|
-
},
|
|
2243
|
+
}, mr = {
|
|
2229
2244
|
class: "tpl:flex tpl:shrink-0 tpl:items-center tpl:justify-between tpl:border-b tpl:px-5 tpl:py-3.5",
|
|
2230
2245
|
style: { "border-color": "var(--tpl-border)" }
|
|
2231
|
-
},
|
|
2246
|
+
}, hr = {
|
|
2232
2247
|
class: "tpl:text-sm tpl:font-semibold",
|
|
2233
2248
|
style: { color: "var(--tpl-text)" }
|
|
2234
|
-
},
|
|
2249
|
+
}, gr = { class: "tpl:flex tpl:items-center tpl:gap-3" }, _r = { class: "tpl:relative" }, vr = ["value", "placeholder"], yr = { class: "tpl:flex tpl:min-h-0 tpl:flex-1 tpl:overflow-hidden" }, br = {
|
|
2235
2250
|
key: 0,
|
|
2236
2251
|
class: "tpl:flex tpl:w-48 tpl:shrink-0 tpl:flex-col tpl:border-r",
|
|
2237
2252
|
style: {
|
|
2238
2253
|
"border-color": "var(--tpl-border)",
|
|
2239
2254
|
"background-color": "var(--tpl-bg)"
|
|
2240
2255
|
}
|
|
2241
|
-
},
|
|
2256
|
+
}, xr = { class: "tpl:flex tpl:min-w-0 tpl:flex-1 tpl:flex-col" }, Sr = {
|
|
2242
2257
|
class: "tpl:flex tpl:shrink-0 tpl:items-center tpl:justify-between tpl:border-b tpl:px-4 tpl:py-2.5",
|
|
2243
2258
|
style: { "border-color": "var(--tpl-border)" }
|
|
2244
|
-
},
|
|
2259
|
+
}, Cr = { class: "tpl:flex tpl:items-center tpl:gap-2" }, wr = ["title"], Tr = {
|
|
2245
2260
|
key: 0,
|
|
2246
2261
|
class: "tpl:text-xs tpl:font-medium",
|
|
2247
2262
|
style: { color: "var(--tpl-text)" }
|
|
2248
|
-
},
|
|
2263
|
+
}, Er = {
|
|
2249
2264
|
class: "tpl:flex tpl:rounded-md tpl:p-0.5",
|
|
2250
2265
|
style: {
|
|
2251
2266
|
border: "1px solid var(--tpl-border)",
|
|
2252
2267
|
"background-color": "var(--tpl-bg)"
|
|
2253
2268
|
}
|
|
2254
|
-
},
|
|
2269
|
+
}, Dr = ["title"], Or = ["title"], kr = { class: "tpl:flex tpl:items-center tpl:gap-2" }, Ar = ["value"], jr = { value: "" }, Mr = ["value"], Nr = ["value"], Pr = { value: "newest" }, Fr = { value: "oldest" }, Ir = { value: "name_asc" }, Lr = { value: "name_desc" }, Rr = { value: "size_asc" }, zr = { value: "size_desc" }, Br = { class: "tpl:min-h-0 tpl:flex-1 tpl:overflow-y-auto" }, Vr = {
|
|
2255
2270
|
key: 0,
|
|
2256
2271
|
class: "tpl:px-4 tpl:pt-3"
|
|
2257
|
-
},
|
|
2272
|
+
}, Hr = {
|
|
2258
2273
|
class: "tpl-scale-in tpl:mx-4 tpl:w-full tpl:max-w-sm tpl:rounded-[var(--tpl-radius-lg)] tpl:p-5",
|
|
2259
2274
|
style: {
|
|
2260
2275
|
"background-color": "var(--tpl-bg-elevated)",
|
|
2261
2276
|
"box-shadow": "var(--tpl-shadow-xl)"
|
|
2262
2277
|
}
|
|
2263
|
-
},
|
|
2278
|
+
}, Ur = {
|
|
2264
2279
|
class: "tpl:mb-2 tpl:text-sm tpl:font-semibold",
|
|
2265
2280
|
style: { color: "var(--tpl-text)" }
|
|
2266
|
-
},
|
|
2281
|
+
}, Wr = {
|
|
2267
2282
|
key: 0,
|
|
2268
2283
|
class: "tpl:mb-4 tpl:text-xs",
|
|
2269
2284
|
style: { color: "var(--tpl-text-muted)" }
|
|
2270
|
-
},
|
|
2285
|
+
}, Gr = {
|
|
2271
2286
|
key: 1,
|
|
2272
2287
|
class: "tpl:mb-4 tpl:max-h-32 tpl:overflow-y-auto tpl:rounded tpl:border tpl:p-2",
|
|
2273
2288
|
style: { "border-color": "var(--tpl-border)" }
|
|
2274
|
-
},
|
|
2289
|
+
}, Kr = { class: "tpl:font-medium" }, qr = { style: { color: "var(--tpl-text-muted)" } }, Jr = { class: "tpl:flex tpl:justify-end tpl:gap-2" }, Yr = {
|
|
2275
2290
|
class: "tpl:flex tpl:shrink-0 tpl:items-center tpl:justify-between tpl:border-t tpl:px-5 tpl:py-3",
|
|
2276
2291
|
style: { "border-color": "var(--tpl-border)" }
|
|
2277
|
-
},
|
|
2292
|
+
}, Xr = { class: "tpl:flex tpl:min-w-0 tpl:flex-1 tpl:items-center tpl:gap-3" }, Zr = { class: "tpl:flex tpl:items-center tpl:gap-5" }, Qr = {
|
|
2278
2293
|
key: 0,
|
|
2279
2294
|
class: "tpl:flex tpl:items-center tpl:gap-2"
|
|
2280
|
-
},
|
|
2295
|
+
}, $r = { class: "tpl:relative" }, ei = { class: "tpl:flex tpl:items-center tpl:gap-2" }, ti = ["disabled"], ni = /* @__PURE__ */ h({
|
|
2281
2296
|
__name: "MediaLibraryModal",
|
|
2282
2297
|
props: {
|
|
2283
2298
|
visible: { type: Boolean },
|
|
@@ -2293,16 +2308,16 @@ var dr = ["data-tpl-theme"], fr = {
|
|
|
2293
2308
|
setup(e, { emit: t }) {
|
|
2294
2309
|
let n = e, r = t, c = w(null);
|
|
2295
2310
|
j(() => n.locale, async (e) => {
|
|
2296
|
-
c.value = await
|
|
2297
|
-
}, { immediate: !0 }), C(
|
|
2311
|
+
c.value = await dr(e ?? "en");
|
|
2312
|
+
}, { immediate: !0 }), C(_e, c);
|
|
2298
2313
|
let h = s(() => c.value), g = s(() => n.uiTheme);
|
|
2299
|
-
C(
|
|
2314
|
+
C(ve, g);
|
|
2300
2315
|
let _ = O(() => n.popoverTarget ?? null);
|
|
2301
|
-
C(
|
|
2302
|
-
let v = s(() => n.planConfig.config.value?.storage.used_bytes ?? 0), x = s(() => n.planConfig.config.value?.storage.limit_bytes ?? 0), { isAcceptedMimeType: E, availableCategories: A } =
|
|
2316
|
+
C(ge, _), C(ye, O(() => n.locale)), C(he, n.planConfig);
|
|
2317
|
+
let v = s(() => n.planConfig.config.value?.storage.used_bytes ?? 0), x = s(() => n.planConfig.config.value?.storage.limit_bytes ?? 0), { isAcceptedMimeType: E, availableCategories: A } = Q(n.planConfig), N = me({
|
|
2303
2318
|
projectId: n.projectId,
|
|
2304
2319
|
authManager: n.authManager
|
|
2305
|
-
}), P =
|
|
2320
|
+
}), P = rr({
|
|
2306
2321
|
library: N,
|
|
2307
2322
|
translations: h
|
|
2308
2323
|
});
|
|
@@ -2312,7 +2327,7 @@ var dr = ["data-tpl-theme"], fr = {
|
|
|
2312
2327
|
function L(e) {
|
|
2313
2328
|
e.key === "Escape" && r("close");
|
|
2314
2329
|
}
|
|
2315
|
-
|
|
2330
|
+
ce(document, "keydown", L);
|
|
2316
2331
|
function z() {
|
|
2317
2332
|
return N.previewItem.value ? !n.accept?.length || E(N.previewItem.value.mime_type, n.accept) : !1;
|
|
2318
2333
|
}
|
|
@@ -2338,14 +2353,14 @@ var dr = ["data-tpl-theme"], fr = {
|
|
|
2338
2353
|
"data-tpl-theme": g.value,
|
|
2339
2354
|
class: "tpl tpl-media-overlay tpl:fixed tpl:inset-0 tpl:z-[9999] tpl:flex tpl:items-center tpl:justify-center tpl:p-4",
|
|
2340
2355
|
onClick: n[18] ||= F((e) => r("close"), ["self"])
|
|
2341
|
-
}, [f("div",
|
|
2342
|
-
f("div",
|
|
2343
|
-
m(
|
|
2356
|
+
}, [f("div", pr, [
|
|
2357
|
+
f("div", mr, [f("h2", hr, D(h.value.mediaLibrary.title), 1), f("div", gr, [
|
|
2358
|
+
m(nr, {
|
|
2344
2359
|
"used-bytes": v.value,
|
|
2345
2360
|
"limit-bytes": x.value,
|
|
2346
2361
|
size: 22
|
|
2347
2362
|
}, null, 8, ["used-bytes", "limit-bytes"]),
|
|
2348
|
-
f("div",
|
|
2363
|
+
f("div", _r, [f("input", {
|
|
2349
2364
|
value: k(P).searchInput.value,
|
|
2350
2365
|
type: "text",
|
|
2351
2366
|
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)]",
|
|
@@ -2356,7 +2371,7 @@ var dr = ["data-tpl-theme"], fr = {
|
|
|
2356
2371
|
},
|
|
2357
2372
|
placeholder: h.value.mediaLibrary.searchPlaceholder,
|
|
2358
2373
|
onInput: n[0] ||= (e) => k(P).handleSearchInput(e.target.value)
|
|
2359
|
-
}, null, 40,
|
|
2374
|
+
}, null, 40, vr), m(k(Y), {
|
|
2360
2375
|
class: "tpl:absolute tpl:top-1/2 tpl:left-2.5 tpl:-translate-y-1/2",
|
|
2361
2376
|
size: 13,
|
|
2362
2377
|
"stroke-width": 2,
|
|
@@ -2366,12 +2381,12 @@ var dr = ["data-tpl-theme"], fr = {
|
|
|
2366
2381
|
class: "tpl:flex tpl:size-7 tpl:items-center tpl:justify-center tpl:rounded-md tpl:transition-all tpl:duration-150",
|
|
2367
2382
|
style: { color: "var(--tpl-text-muted)" },
|
|
2368
2383
|
onClick: n[1] ||= (e) => r("close")
|
|
2369
|
-
}, [m(k(
|
|
2384
|
+
}, [m(k(ne), {
|
|
2370
2385
|
size: 18,
|
|
2371
2386
|
"stroke-width": 2
|
|
2372
2387
|
})])
|
|
2373
2388
|
])]),
|
|
2374
|
-
f("div",
|
|
2389
|
+
f("div", yr, [m(o, {
|
|
2375
2390
|
"enter-active-class": "tpl:transition-all tpl:duration-200 tpl:ease-out",
|
|
2376
2391
|
"enter-from-class": "tpl:-ml-48 tpl:opacity-0",
|
|
2377
2392
|
"enter-to-class": "tpl:ml-0 tpl:opacity-100",
|
|
@@ -2379,7 +2394,7 @@ var dr = ["data-tpl-theme"], fr = {
|
|
|
2379
2394
|
"leave-from-class": "tpl:ml-0 tpl:opacity-100",
|
|
2380
2395
|
"leave-to-class": "tpl:-ml-48 tpl:opacity-0"
|
|
2381
2396
|
}, {
|
|
2382
|
-
default: M(() => [k(P).showSidebar.value ? (S(), d("div",
|
|
2397
|
+
default: M(() => [k(P).showSidebar.value ? (S(), d("div", br, [m(wt, {
|
|
2383
2398
|
folders: k(N).folders.value,
|
|
2384
2399
|
"current-folder-id": k(N).currentFolderId.value,
|
|
2385
2400
|
"view-mode": k(N).viewMode.value,
|
|
@@ -2401,7 +2416,7 @@ var dr = ["data-tpl-theme"], fr = {
|
|
|
2401
2416
|
"onShowFrequentlyUsed"
|
|
2402
2417
|
])])) : u("", !0)]),
|
|
2403
2418
|
_: 1
|
|
2404
|
-
}), f("div",
|
|
2419
|
+
}), f("div", xr, [f("div", Sr, [f("div", Cr, [
|
|
2405
2420
|
f("button", {
|
|
2406
2421
|
class: "tpl:flex tpl:size-7 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-md tpl:transition-all tpl:duration-150",
|
|
2407
2422
|
style: b({
|
|
@@ -2414,8 +2429,8 @@ var dr = ["data-tpl-theme"], fr = {
|
|
|
2414
2429
|
}, [m(k(G), {
|
|
2415
2430
|
size: 16,
|
|
2416
2431
|
"stroke-width": 2
|
|
2417
|
-
})], 12,
|
|
2418
|
-
k(N).viewMode.value === "frequently-used" ? (S(), d("span",
|
|
2432
|
+
})], 12, wr),
|
|
2433
|
+
k(N).viewMode.value === "frequently-used" ? (S(), d("span", Tr, D(h.value.mediaLibrary.frequentlyUsed), 1)) : (S(), l(Te, {
|
|
2419
2434
|
key: 1,
|
|
2420
2435
|
folders: k(N).folders.value,
|
|
2421
2436
|
"current-folder-id": k(N).currentFolderId.value,
|
|
@@ -2425,7 +2440,7 @@ var dr = ["data-tpl-theme"], fr = {
|
|
|
2425
2440
|
"current-folder-id",
|
|
2426
2441
|
"onNavigate"
|
|
2427
2442
|
])),
|
|
2428
|
-
f("div",
|
|
2443
|
+
f("div", Er, [f("button", {
|
|
2429
2444
|
class: "tpl:flex tpl:size-6 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded tpl:transition-all tpl:duration-150",
|
|
2430
2445
|
style: b({
|
|
2431
2446
|
color: k(P).layoutMode.value === "grid" ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
|
|
@@ -2436,7 +2451,7 @@ var dr = ["data-tpl-theme"], fr = {
|
|
|
2436
2451
|
}, [m(k(V), {
|
|
2437
2452
|
size: 14,
|
|
2438
2453
|
"stroke-width": 2
|
|
2439
|
-
})], 12,
|
|
2454
|
+
})], 12, Dr), f("button", {
|
|
2440
2455
|
class: "tpl:flex tpl:size-6 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded tpl:transition-all tpl:duration-150",
|
|
2441
2456
|
style: b({
|
|
2442
2457
|
color: k(P).layoutMode.value === "list" ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
|
|
@@ -2447,8 +2462,8 @@ var dr = ["data-tpl-theme"], fr = {
|
|
|
2447
2462
|
}, [m(k(U), {
|
|
2448
2463
|
size: 14,
|
|
2449
2464
|
"stroke-width": 2
|
|
2450
|
-
})], 12,
|
|
2451
|
-
]), f("div",
|
|
2465
|
+
})], 12, Or)])
|
|
2466
|
+
]), f("div", kr, [k(A).length > 1 ? (S(), d("select", {
|
|
2452
2467
|
key: 0,
|
|
2453
2468
|
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",
|
|
2454
2469
|
style: {
|
|
@@ -2458,10 +2473,10 @@ var dr = ["data-tpl-theme"], fr = {
|
|
|
2458
2473
|
},
|
|
2459
2474
|
value: k(N).categoryFilter.value ?? "",
|
|
2460
2475
|
onChange: n[5] ||= (e) => k(N).filterByCategory(e.target.value || null)
|
|
2461
|
-
}, [f("option",
|
|
2476
|
+
}, [f("option", jr, D(h.value.mediaLibrary.filterAll), 1), (S(!0), d(i, null, T(k(A), (e) => (S(), d("option", {
|
|
2462
2477
|
key: e,
|
|
2463
2478
|
value: e
|
|
2464
|
-
}, D(k(P).getCategoryLabel(e)), 9,
|
|
2479
|
+
}, D(k(P).getCategoryLabel(e)), 9, Mr))), 128))], 40, Ar)) : u("", !0), f("select", {
|
|
2465
2480
|
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",
|
|
2466
2481
|
style: {
|
|
2467
2482
|
"border-color": "var(--tpl-border)",
|
|
@@ -2471,13 +2486,13 @@ var dr = ["data-tpl-theme"], fr = {
|
|
|
2471
2486
|
value: k(N).sortOption.value,
|
|
2472
2487
|
onChange: n[6] ||= (e) => k(N).sortBy(e.target.value)
|
|
2473
2488
|
}, [
|
|
2474
|
-
f("option",
|
|
2475
|
-
f("option",
|
|
2476
|
-
f("option",
|
|
2477
|
-
f("option",
|
|
2478
|
-
f("option",
|
|
2479
|
-
f("option",
|
|
2480
|
-
], 40,
|
|
2489
|
+
f("option", Pr, D(h.value.mediaLibrary.sortNewest), 1),
|
|
2490
|
+
f("option", Fr, D(h.value.mediaLibrary.sortOldest), 1),
|
|
2491
|
+
f("option", Ir, D(h.value.mediaLibrary.sortNameAsc), 1),
|
|
2492
|
+
f("option", Lr, D(h.value.mediaLibrary.sortNameDesc), 1),
|
|
2493
|
+
f("option", Rr, D(h.value.mediaLibrary.sortSizeAsc), 1),
|
|
2494
|
+
f("option", zr, D(h.value.mediaLibrary.sortSizeDesc), 1)
|
|
2495
|
+
], 40, Nr)])]), f("div", Br, [k(N).viewMode.value === "files" ? (S(), d("div", Vr, [m(Zn, {
|
|
2481
2496
|
"is-uploading": k(N).isUploading.value,
|
|
2482
2497
|
"upload-progress": k(N).uploadProgress.value,
|
|
2483
2498
|
onUpload: k(P).handleUpload
|
|
@@ -2496,7 +2511,7 @@ var dr = ["data-tpl-theme"], fr = {
|
|
|
2496
2511
|
}, [m(k(H), {
|
|
2497
2512
|
size: 14,
|
|
2498
2513
|
"stroke-width": 2
|
|
2499
|
-
}), p(" " + D(h.value.mediaLibrary.importFromUrl), 1)])])) : u("", !0), m(
|
|
2514
|
+
}), p(" " + D(h.value.mediaLibrary.importFromUrl), 1)])])) : u("", !0), m(nn, {
|
|
2500
2515
|
items: k(P).displayItems.value,
|
|
2501
2516
|
"selected-ids": k(N).selectedItems.value,
|
|
2502
2517
|
"is-loading": k(N).isLoading.value,
|
|
@@ -2521,7 +2536,7 @@ var dr = ["data-tpl-theme"], fr = {
|
|
|
2521
2536
|
"onEdit",
|
|
2522
2537
|
"onReplace"
|
|
2523
2538
|
])])])]),
|
|
2524
|
-
m(
|
|
2539
|
+
m(hn, {
|
|
2525
2540
|
visible: k(P).showImportUrlModal.value,
|
|
2526
2541
|
"is-importing": k(N).isImportingFromUrl.value,
|
|
2527
2542
|
error: k(N).importFromUrlError.value,
|
|
@@ -2543,7 +2558,7 @@ var dr = ["data-tpl-theme"], fr = {
|
|
|
2543
2558
|
"item",
|
|
2544
2559
|
"onSave"
|
|
2545
2560
|
]),
|
|
2546
|
-
m(
|
|
2561
|
+
m(Kn, {
|
|
2547
2562
|
visible: k(N).showReplaceWarning.value,
|
|
2548
2563
|
item: k(N).pendingReplaceItem.value,
|
|
2549
2564
|
"usage-info": k(N).replaceUsageInfo.value,
|
|
@@ -2577,19 +2592,19 @@ var dr = ["data-tpl-theme"], fr = {
|
|
|
2577
2592
|
"-webkit-backdrop-filter": "blur(8px)"
|
|
2578
2593
|
},
|
|
2579
2594
|
onClick: n[12] ||= F((...e) => k(N).cancelDelete && k(N).cancelDelete(...e), ["self"])
|
|
2580
|
-
}, [f("div",
|
|
2581
|
-
f("h3",
|
|
2595
|
+
}, [f("div", Hr, [
|
|
2596
|
+
f("h3", Ur, D(h.value.mediaLibrary.deleteWarningTitle), 1),
|
|
2582
2597
|
f("p", {
|
|
2583
2598
|
class: y(["tpl:text-xs", k(P).hasUsedFiles.value ? "tpl:mb-2" : "tpl:mb-4"]),
|
|
2584
2599
|
style: { color: "var(--tpl-text-muted)" }
|
|
2585
2600
|
}, D(h.value.mediaLibrary.deleteWarningMessage), 3),
|
|
2586
|
-
k(P).hasUsedFiles.value ? (S(), d("p",
|
|
2587
|
-
k(P).hasUsedFiles.value ? (S(), d("div",
|
|
2601
|
+
k(P).hasUsedFiles.value ? (S(), d("p", Wr, D(h.value.mediaLibrary.deleteWarningUsageNote), 1)) : u("", !0),
|
|
2602
|
+
k(P).hasUsedFiles.value ? (S(), d("div", Gr, [(S(!0), d(i, null, T(k(N).deleteUsageInfo.value, (e, t) => (S(), d("div", {
|
|
2588
2603
|
key: t,
|
|
2589
2604
|
class: "tpl:text-xs",
|
|
2590
2605
|
style: { color: "var(--tpl-text)" }
|
|
2591
|
-
}, [e.template_count > 0 ? (S(), d(i, { key: 0 }, [f("span",
|
|
2592
|
-
f("div",
|
|
2606
|
+
}, [e.template_count > 0 ? (S(), d(i, { key: 0 }, [f("span", Kr, D(k(P).displayItems.value.find((e) => e.id === t)?.filename || t), 1), f("span", qr, " - " + D(h.value.mediaLibrary.usedInTemplates.replace("{count}", e.template_count.toString())), 1)], 64)) : u("", !0)]))), 128))])) : u("", !0),
|
|
2607
|
+
f("div", Jr, [f("button", {
|
|
2593
2608
|
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",
|
|
2594
2609
|
style: {
|
|
2595
2610
|
"border-color": "var(--tpl-border)",
|
|
@@ -2609,7 +2624,7 @@ var dr = ["data-tpl-theme"], fr = {
|
|
|
2609
2624
|
])])) : u("", !0)]),
|
|
2610
2625
|
_: 1
|
|
2611
2626
|
}),
|
|
2612
|
-
f("div",
|
|
2627
|
+
f("div", Yr, [f("div", Xr, [k(N).previewItem.value ? (S(), l(jn, {
|
|
2613
2628
|
key: 0,
|
|
2614
2629
|
"selected-conversion": k(P).selectedConversion.value,
|
|
2615
2630
|
"onUpdate:selectedConversion": n[13] ||= (e) => k(P).selectedConversion.value = e,
|
|
@@ -2619,7 +2634,7 @@ var dr = ["data-tpl-theme"], fr = {
|
|
|
2619
2634
|
"selected-conversion",
|
|
2620
2635
|
"item",
|
|
2621
2636
|
"folders"
|
|
2622
|
-
])) : u("", !0)]), f("div",
|
|
2637
|
+
])) : u("", !0)]), f("div", Zr, [k(N).selectedItems.value.size > 0 ? (S(), d("div", Qr, [k(N).previewItem.value ? (S(), d("button", {
|
|
2623
2638
|
key: 0,
|
|
2624
2639
|
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",
|
|
2625
2640
|
style: b({
|
|
@@ -2636,7 +2651,7 @@ var dr = ["data-tpl-theme"], fr = {
|
|
|
2636
2651
|
key: 0,
|
|
2637
2652
|
size: 12,
|
|
2638
2653
|
"stroke-width": 2
|
|
2639
|
-
})), p(" " + D(k(P).copied.value ? h.value.mediaLibrary.copied : h.value.mediaLibrary.copyUrl), 1)], 4)) : u("", !0), f("div",
|
|
2654
|
+
})), p(" " + D(k(P).copied.value ? h.value.mediaLibrary.copied : h.value.mediaLibrary.copyUrl), 1)], 4)) : u("", !0), f("div", $r, [f("button", {
|
|
2640
2655
|
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",
|
|
2641
2656
|
style: {
|
|
2642
2657
|
"border-color": "var(--tpl-border)",
|
|
@@ -2644,7 +2659,7 @@ var dr = ["data-tpl-theme"], fr = {
|
|
|
2644
2659
|
"background-color": "var(--tpl-bg)"
|
|
2645
2660
|
},
|
|
2646
2661
|
onClick: n[15] ||= (e) => k(P).showMovePicker.value = !k(P).showMovePicker.value
|
|
2647
|
-
}, D(h.value.mediaLibrary.moveSelected), 1), k(P).showMovePicker.value ? (S(), l(
|
|
2662
|
+
}, D(h.value.mediaLibrary.moveSelected), 1), k(P).showMovePicker.value ? (S(), l(bn, {
|
|
2648
2663
|
key: 0,
|
|
2649
2664
|
folders: k(N).folders.value,
|
|
2650
2665
|
"current-folder-id": k(N).currentFolderId.value,
|
|
@@ -2654,7 +2669,7 @@ var dr = ["data-tpl-theme"], fr = {
|
|
|
2654
2669
|
"folders",
|
|
2655
2670
|
"current-folder-id",
|
|
2656
2671
|
"onSelect"
|
|
2657
|
-
])) : u("", !0)])])) : u("", !0), f("div",
|
|
2672
|
+
])) : u("", !0)])])) : u("", !0), f("div", ei, [k(N).selectedItems.value.size > 0 ? (S(), d("button", {
|
|
2658
2673
|
key: 0,
|
|
2659
2674
|
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",
|
|
2660
2675
|
style: {
|
|
@@ -2671,15 +2686,15 @@ var dr = ["data-tpl-theme"], fr = {
|
|
|
2671
2686
|
},
|
|
2672
2687
|
disabled: !z(),
|
|
2673
2688
|
onClick: B
|
|
2674
|
-
}, D(e.accept?.length ? h.value.mediaLibrary.selectImage : h.value.mediaLibrary.selectFile), 9,
|
|
2675
|
-
])], 8,
|
|
2689
|
+
}, D(e.accept?.length ? h.value.mediaLibrary.selectImage : h.value.mediaLibrary.selectFile), 9, ti)])])])
|
|
2690
|
+
])], 8, fr)) : u("", !0)]),
|
|
2676
2691
|
_: 1
|
|
2677
2692
|
})], 8, ["to"]));
|
|
2678
2693
|
}
|
|
2679
2694
|
});
|
|
2680
2695
|
//#endregion
|
|
2681
2696
|
//#region src/composables/useMediaPicker.ts
|
|
2682
|
-
function
|
|
2697
|
+
function ri() {
|
|
2683
2698
|
let e = _("onRequestMedia"), t = w(!1), n = s(() => !!e);
|
|
2684
2699
|
async function r(n) {
|
|
2685
2700
|
if (!e) return null;
|
|
@@ -2698,7 +2713,7 @@ function ni() {
|
|
|
2698
2713
|
}
|
|
2699
2714
|
//#endregion
|
|
2700
2715
|
//#region src/standalone/MediaLibrary.vue?vue&type=script&setup=true&lang.ts
|
|
2701
|
-
var
|
|
2716
|
+
var ii = {
|
|
2702
2717
|
class: "tpl tpl:flex tpl:flex-col tpl:overflow-hidden tpl:rounded-[var(--tpl-radius-lg)]",
|
|
2703
2718
|
style: {
|
|
2704
2719
|
width: "100%",
|
|
@@ -2706,59 +2721,59 @@ var ri = {
|
|
|
2706
2721
|
"background-color": "var(--tpl-bg-elevated)",
|
|
2707
2722
|
border: "1px solid var(--tpl-border)"
|
|
2708
2723
|
}
|
|
2709
|
-
},
|
|
2724
|
+
}, ai = {
|
|
2710
2725
|
class: "tpl:flex tpl:shrink-0 tpl:items-center tpl:justify-between tpl:border-b tpl:px-5 tpl:py-3.5",
|
|
2711
2726
|
style: { "border-color": "var(--tpl-border)" }
|
|
2712
|
-
},
|
|
2727
|
+
}, oi = {
|
|
2713
2728
|
class: "tpl:text-sm tpl:font-semibold",
|
|
2714
2729
|
style: { color: "var(--tpl-text)" }
|
|
2715
|
-
},
|
|
2730
|
+
}, si = { class: "tpl:flex tpl:items-center tpl:gap-3" }, ci = { class: "tpl:relative" }, li = ["value", "placeholder"], ui = { class: "tpl:flex tpl:min-h-0 tpl:flex-1 tpl:overflow-hidden" }, di = {
|
|
2716
2731
|
key: 0,
|
|
2717
2732
|
class: "tpl:flex tpl:w-48 tpl:shrink-0 tpl:flex-col tpl:border-r",
|
|
2718
2733
|
style: {
|
|
2719
2734
|
"border-color": "var(--tpl-border)",
|
|
2720
2735
|
"background-color": "var(--tpl-bg)"
|
|
2721
2736
|
}
|
|
2722
|
-
},
|
|
2737
|
+
}, fi = { class: "tpl:flex tpl:min-w-0 tpl:flex-1 tpl:flex-col" }, pi = {
|
|
2723
2738
|
class: "tpl:flex tpl:shrink-0 tpl:items-center tpl:justify-between tpl:border-b tpl:px-4 tpl:py-2.5",
|
|
2724
2739
|
style: { "border-color": "var(--tpl-border)" }
|
|
2725
|
-
},
|
|
2740
|
+
}, mi = { class: "tpl:flex tpl:items-center tpl:gap-2" }, hi = ["title"], gi = {
|
|
2726
2741
|
key: 0,
|
|
2727
2742
|
class: "tpl:text-xs tpl:font-medium",
|
|
2728
2743
|
style: { color: "var(--tpl-text)" }
|
|
2729
|
-
},
|
|
2744
|
+
}, _i = {
|
|
2730
2745
|
class: "tpl:flex tpl:rounded-md tpl:p-0.5",
|
|
2731
2746
|
style: {
|
|
2732
2747
|
border: "1px solid var(--tpl-border)",
|
|
2733
2748
|
"background-color": "var(--tpl-bg)"
|
|
2734
2749
|
}
|
|
2735
|
-
},
|
|
2750
|
+
}, vi = ["title"], yi = ["title"], bi = { class: "tpl:flex tpl:items-center tpl:gap-2" }, xi = ["value"], Si = { value: "" }, Ci = ["value"], wi = ["value"], Ti = { value: "newest" }, Ei = { value: "oldest" }, Di = { value: "name_asc" }, Oi = { value: "name_desc" }, ki = { value: "size_asc" }, Ai = { value: "size_desc" }, ji = { class: "tpl:min-h-0 tpl:flex-1 tpl:overflow-y-auto" }, Mi = {
|
|
2736
2751
|
key: 0,
|
|
2737
2752
|
class: "tpl:px-4 tpl:pt-3"
|
|
2738
|
-
},
|
|
2753
|
+
}, Ni = {
|
|
2739
2754
|
class: "tpl-scale-in tpl:mx-4 tpl:w-full tpl:max-w-sm tpl:rounded-[var(--tpl-radius-lg)] tpl:p-5",
|
|
2740
2755
|
style: {
|
|
2741
2756
|
"background-color": "var(--tpl-bg-elevated)",
|
|
2742
2757
|
"box-shadow": "var(--tpl-shadow-xl)"
|
|
2743
2758
|
}
|
|
2744
|
-
},
|
|
2759
|
+
}, Pi = {
|
|
2745
2760
|
class: "tpl:mb-2 tpl:text-sm tpl:font-semibold",
|
|
2746
2761
|
style: { color: "var(--tpl-text)" }
|
|
2747
|
-
},
|
|
2762
|
+
}, Fi = {
|
|
2748
2763
|
key: 0,
|
|
2749
2764
|
class: "tpl:mb-4 tpl:text-xs",
|
|
2750
2765
|
style: { color: "var(--tpl-text-muted)" }
|
|
2751
|
-
},
|
|
2766
|
+
}, Ii = {
|
|
2752
2767
|
key: 1,
|
|
2753
2768
|
class: "tpl:mb-4 tpl:max-h-32 tpl:overflow-y-auto tpl:rounded tpl:border tpl:p-2",
|
|
2754
2769
|
style: { "border-color": "var(--tpl-border)" }
|
|
2755
|
-
},
|
|
2770
|
+
}, Li = { class: "tpl:font-medium" }, Ri = { style: { color: "var(--tpl-text-muted)" } }, zi = { class: "tpl:flex tpl:justify-end tpl:gap-2" }, Bi = {
|
|
2756
2771
|
class: "tpl:flex tpl:shrink-0 tpl:items-center tpl:justify-between tpl:border-t tpl:px-5 tpl:py-3",
|
|
2757
2772
|
style: { "border-color": "var(--tpl-border)" }
|
|
2758
|
-
},
|
|
2773
|
+
}, Vi = { class: "tpl:flex tpl:min-w-0 tpl:flex-1 tpl:items-center tpl:gap-3" }, Hi = { class: "tpl:flex tpl:items-center tpl:gap-5" }, Ui = {
|
|
2759
2774
|
key: 0,
|
|
2760
2775
|
class: "tpl:flex tpl:items-center tpl:gap-2"
|
|
2761
|
-
},
|
|
2776
|
+
}, Wi = { class: "tpl:relative" }, Gi = { class: "tpl:flex tpl:items-center tpl:gap-2" }, Ki = ["disabled"], qi = /* @__PURE__ */ h({
|
|
2762
2777
|
__name: "MediaLibrary",
|
|
2763
2778
|
props: {
|
|
2764
2779
|
authManager: {},
|
|
@@ -2771,7 +2786,7 @@ var ri = {
|
|
|
2771
2786
|
emits: ["ready"],
|
|
2772
2787
|
setup(e, { emit: t }) {
|
|
2773
2788
|
let n = e, r = t, a = s(() => n.translations);
|
|
2774
|
-
C(
|
|
2789
|
+
C(_e, w(n.translations));
|
|
2775
2790
|
let c = {
|
|
2776
2791
|
config: w(n.planConfig),
|
|
2777
2792
|
isLoading: w(!1),
|
|
@@ -2779,12 +2794,12 @@ var ri = {
|
|
|
2779
2794
|
features: s(() => n.planConfig.features),
|
|
2780
2795
|
fetchConfig: async () => {}
|
|
2781
2796
|
};
|
|
2782
|
-
C(
|
|
2783
|
-
let h = s(() => n.planConfig.storage.used_bytes ?? 0), g = s(() => n.planConfig.storage.limit_bytes ?? 0), { availableCategories: _ } =
|
|
2797
|
+
C(he, c);
|
|
2798
|
+
let h = s(() => n.planConfig.storage.used_bytes ?? 0), g = s(() => n.planConfig.storage.limit_bytes ?? 0), { availableCategories: _ } = Q(c), v = me({
|
|
2784
2799
|
projectId: n.projectId,
|
|
2785
2800
|
authManager: n.authManager,
|
|
2786
2801
|
onError: n.onError
|
|
2787
|
-
}), E =
|
|
2802
|
+
}), E = rr({
|
|
2788
2803
|
library: v,
|
|
2789
2804
|
translations: a
|
|
2790
2805
|
});
|
|
@@ -2798,12 +2813,12 @@ var ri = {
|
|
|
2798
2813
|
}
|
|
2799
2814
|
return x(() => {
|
|
2800
2815
|
v.loadItems(), v.loadFrequentlyUsed(), r("ready");
|
|
2801
|
-
}), (t, n) => (S(), d("div",
|
|
2802
|
-
f("div",
|
|
2816
|
+
}), (t, n) => (S(), d("div", ii, [
|
|
2817
|
+
f("div", ai, [f("h2", oi, D(a.value.mediaLibrary.title), 1), f("div", si, [m(nr, {
|
|
2803
2818
|
"used-bytes": h.value,
|
|
2804
2819
|
"limit-bytes": g.value,
|
|
2805
2820
|
size: 22
|
|
2806
|
-
}, null, 8, ["used-bytes", "limit-bytes"]), f("div",
|
|
2821
|
+
}, null, 8, ["used-bytes", "limit-bytes"]), f("div", ci, [f("input", {
|
|
2807
2822
|
value: k(E).searchInput.value,
|
|
2808
2823
|
type: "text",
|
|
2809
2824
|
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)]",
|
|
@@ -2814,13 +2829,13 @@ var ri = {
|
|
|
2814
2829
|
},
|
|
2815
2830
|
placeholder: a.value.mediaLibrary.searchPlaceholder,
|
|
2816
2831
|
onInput: n[0] ||= (e) => k(E).handleSearchInput(e.target.value)
|
|
2817
|
-
}, null, 40,
|
|
2832
|
+
}, null, 40, li), m(k(Y), {
|
|
2818
2833
|
class: "tpl:absolute tpl:top-1/2 tpl:left-2.5 tpl:-translate-y-1/2",
|
|
2819
2834
|
size: 13,
|
|
2820
2835
|
"stroke-width": 2,
|
|
2821
2836
|
style: { color: "var(--tpl-text-dim)" }
|
|
2822
2837
|
})])])]),
|
|
2823
|
-
f("div",
|
|
2838
|
+
f("div", ui, [m(o, {
|
|
2824
2839
|
"enter-active-class": "tpl:transition-all tpl:duration-200 tpl:ease-out",
|
|
2825
2840
|
"enter-from-class": "tpl:-ml-48 tpl:opacity-0",
|
|
2826
2841
|
"enter-to-class": "tpl:ml-0 tpl:opacity-100",
|
|
@@ -2828,7 +2843,7 @@ var ri = {
|
|
|
2828
2843
|
"leave-from-class": "tpl:ml-0 tpl:opacity-100",
|
|
2829
2844
|
"leave-to-class": "tpl:-ml-48 tpl:opacity-0"
|
|
2830
2845
|
}, {
|
|
2831
|
-
default: M(() => [k(E).showSidebar.value ? (S(), d("div",
|
|
2846
|
+
default: M(() => [k(E).showSidebar.value ? (S(), d("div", di, [m(wt, {
|
|
2832
2847
|
folders: k(v).folders.value,
|
|
2833
2848
|
"current-folder-id": k(v).currentFolderId.value,
|
|
2834
2849
|
"view-mode": k(v).viewMode.value,
|
|
@@ -2850,7 +2865,7 @@ var ri = {
|
|
|
2850
2865
|
"onShowFrequentlyUsed"
|
|
2851
2866
|
])])) : u("", !0)]),
|
|
2852
2867
|
_: 1
|
|
2853
|
-
}), f("div",
|
|
2868
|
+
}), f("div", fi, [f("div", pi, [f("div", mi, [
|
|
2854
2869
|
f("button", {
|
|
2855
2870
|
class: "tpl:flex tpl:size-7 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-md tpl:transition-all tpl:duration-150",
|
|
2856
2871
|
style: b({
|
|
@@ -2863,8 +2878,8 @@ var ri = {
|
|
|
2863
2878
|
}, [m(k(G), {
|
|
2864
2879
|
size: 16,
|
|
2865
2880
|
"stroke-width": 2
|
|
2866
|
-
})], 12,
|
|
2867
|
-
k(v).viewMode.value === "frequently-used" ? (S(), d("span",
|
|
2881
|
+
})], 12, hi),
|
|
2882
|
+
k(v).viewMode.value === "frequently-used" ? (S(), d("span", gi, D(a.value.mediaLibrary.frequentlyUsed), 1)) : (S(), l(Te, {
|
|
2868
2883
|
key: 1,
|
|
2869
2884
|
folders: k(v).folders.value,
|
|
2870
2885
|
"current-folder-id": k(v).currentFolderId.value,
|
|
@@ -2874,7 +2889,7 @@ var ri = {
|
|
|
2874
2889
|
"current-folder-id",
|
|
2875
2890
|
"onNavigate"
|
|
2876
2891
|
])),
|
|
2877
|
-
f("div",
|
|
2892
|
+
f("div", _i, [f("button", {
|
|
2878
2893
|
class: "tpl:flex tpl:size-6 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded tpl:transition-all tpl:duration-150",
|
|
2879
2894
|
style: b({
|
|
2880
2895
|
color: k(E).layoutMode.value === "grid" ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
|
|
@@ -2885,7 +2900,7 @@ var ri = {
|
|
|
2885
2900
|
}, [m(k(V), {
|
|
2886
2901
|
size: 14,
|
|
2887
2902
|
"stroke-width": 2
|
|
2888
|
-
})], 12,
|
|
2903
|
+
})], 12, vi), f("button", {
|
|
2889
2904
|
class: "tpl:flex tpl:size-6 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded tpl:transition-all tpl:duration-150",
|
|
2890
2905
|
style: b({
|
|
2891
2906
|
color: k(E).layoutMode.value === "list" ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
|
|
@@ -2896,8 +2911,8 @@ var ri = {
|
|
|
2896
2911
|
}, [m(k(U), {
|
|
2897
2912
|
size: 14,
|
|
2898
2913
|
"stroke-width": 2
|
|
2899
|
-
})], 12,
|
|
2900
|
-
]), f("div",
|
|
2914
|
+
})], 12, yi)])
|
|
2915
|
+
]), f("div", bi, [k(_).length > 1 ? (S(), d("select", {
|
|
2901
2916
|
key: 0,
|
|
2902
2917
|
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",
|
|
2903
2918
|
style: {
|
|
@@ -2907,10 +2922,10 @@ var ri = {
|
|
|
2907
2922
|
},
|
|
2908
2923
|
value: k(v).categoryFilter.value ?? "",
|
|
2909
2924
|
onChange: n[4] ||= (e) => k(v).filterByCategory(e.target.value || null)
|
|
2910
|
-
}, [f("option",
|
|
2925
|
+
}, [f("option", Si, D(a.value.mediaLibrary.filterAll), 1), (S(!0), d(i, null, T(k(_), (e) => (S(), d("option", {
|
|
2911
2926
|
key: e,
|
|
2912
2927
|
value: e
|
|
2913
|
-
}, D(k(E).getCategoryLabel(e)), 9,
|
|
2928
|
+
}, D(k(E).getCategoryLabel(e)), 9, Ci))), 128))], 40, xi)) : u("", !0), f("select", {
|
|
2914
2929
|
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",
|
|
2915
2930
|
style: {
|
|
2916
2931
|
"border-color": "var(--tpl-border)",
|
|
@@ -2920,13 +2935,13 @@ var ri = {
|
|
|
2920
2935
|
value: k(v).sortOption.value,
|
|
2921
2936
|
onChange: n[5] ||= (e) => k(v).sortBy(e.target.value)
|
|
2922
2937
|
}, [
|
|
2923
|
-
f("option",
|
|
2924
|
-
f("option",
|
|
2925
|
-
f("option",
|
|
2926
|
-
f("option",
|
|
2927
|
-
f("option",
|
|
2928
|
-
f("option",
|
|
2929
|
-
], 40,
|
|
2938
|
+
f("option", Ti, D(a.value.mediaLibrary.sortNewest), 1),
|
|
2939
|
+
f("option", Ei, D(a.value.mediaLibrary.sortOldest), 1),
|
|
2940
|
+
f("option", Di, D(a.value.mediaLibrary.sortNameAsc), 1),
|
|
2941
|
+
f("option", Oi, D(a.value.mediaLibrary.sortNameDesc), 1),
|
|
2942
|
+
f("option", ki, D(a.value.mediaLibrary.sortSizeAsc), 1),
|
|
2943
|
+
f("option", Ai, D(a.value.mediaLibrary.sortSizeDesc), 1)
|
|
2944
|
+
], 40, wi)])]), f("div", ji, [k(v).viewMode.value === "files" ? (S(), d("div", Mi, [m(Zn, {
|
|
2930
2945
|
"is-uploading": k(v).isUploading.value,
|
|
2931
2946
|
"upload-progress": k(v).uploadProgress.value,
|
|
2932
2947
|
onUpload: k(E).handleUpload
|
|
@@ -2945,7 +2960,7 @@ var ri = {
|
|
|
2945
2960
|
}, [m(k(H), {
|
|
2946
2961
|
size: 14,
|
|
2947
2962
|
"stroke-width": 2
|
|
2948
|
-
}), p(" " + D(a.value.mediaLibrary.importFromUrl), 1)])])) : u("", !0), m(
|
|
2963
|
+
}), p(" " + D(a.value.mediaLibrary.importFromUrl), 1)])])) : u("", !0), m(nn, {
|
|
2949
2964
|
items: k(E).displayItems.value,
|
|
2950
2965
|
"selected-ids": k(v).selectedItems.value,
|
|
2951
2966
|
"is-loading": k(v).isLoading.value,
|
|
@@ -2968,7 +2983,7 @@ var ri = {
|
|
|
2968
2983
|
"onEdit",
|
|
2969
2984
|
"onReplace"
|
|
2970
2985
|
])])])]),
|
|
2971
|
-
m(
|
|
2986
|
+
m(hn, {
|
|
2972
2987
|
visible: k(E).showImportUrlModal.value,
|
|
2973
2988
|
"is-importing": k(v).isImportingFromUrl.value,
|
|
2974
2989
|
error: k(v).importFromUrlError.value,
|
|
@@ -2990,7 +3005,7 @@ var ri = {
|
|
|
2990
3005
|
"item",
|
|
2991
3006
|
"onSave"
|
|
2992
3007
|
]),
|
|
2993
|
-
m(
|
|
3008
|
+
m(Kn, {
|
|
2994
3009
|
visible: k(v).showReplaceWarning.value,
|
|
2995
3010
|
item: k(v).pendingReplaceItem.value,
|
|
2996
3011
|
"usage-info": k(v).replaceUsageInfo.value,
|
|
@@ -3024,19 +3039,19 @@ var ri = {
|
|
|
3024
3039
|
"-webkit-backdrop-filter": "blur(8px)"
|
|
3025
3040
|
},
|
|
3026
3041
|
onClick: n[11] ||= F((...e) => k(v).cancelDelete && k(v).cancelDelete(...e), ["self"])
|
|
3027
|
-
}, [f("div",
|
|
3028
|
-
f("h3",
|
|
3042
|
+
}, [f("div", Ni, [
|
|
3043
|
+
f("h3", Pi, D(a.value.mediaLibrary.deleteWarningTitle), 1),
|
|
3029
3044
|
f("p", {
|
|
3030
3045
|
class: y(["tpl:text-xs", k(E).hasUsedFiles.value ? "tpl:mb-2" : "tpl:mb-4"]),
|
|
3031
3046
|
style: { color: "var(--tpl-text-muted)" }
|
|
3032
3047
|
}, D(a.value.mediaLibrary.deleteWarningMessage), 3),
|
|
3033
|
-
k(E).hasUsedFiles.value ? (S(), d("p",
|
|
3034
|
-
k(E).hasUsedFiles.value ? (S(), d("div",
|
|
3048
|
+
k(E).hasUsedFiles.value ? (S(), d("p", Fi, D(a.value.mediaLibrary.deleteWarningUsageNote), 1)) : u("", !0),
|
|
3049
|
+
k(E).hasUsedFiles.value ? (S(), d("div", Ii, [(S(!0), d(i, null, T(k(v).deleteUsageInfo.value, (e, t) => (S(), d("div", {
|
|
3035
3050
|
key: t,
|
|
3036
3051
|
class: "tpl:text-xs",
|
|
3037
3052
|
style: { color: "var(--tpl-text)" }
|
|
3038
|
-
}, [e.template_count > 0 ? (S(), d(i, { key: 0 }, [f("span",
|
|
3039
|
-
f("div",
|
|
3053
|
+
}, [e.template_count > 0 ? (S(), d(i, { key: 0 }, [f("span", Li, D(k(E).displayItems.value.find((e) => e.id === t)?.filename || t), 1), f("span", Ri, " - " + D(a.value.mediaLibrary.usedInTemplates.replace("{count}", e.template_count.toString())), 1)], 64)) : u("", !0)]))), 128))])) : u("", !0),
|
|
3054
|
+
f("div", zi, [f("button", {
|
|
3040
3055
|
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",
|
|
3041
3056
|
style: {
|
|
3042
3057
|
"border-color": "var(--tpl-border)",
|
|
@@ -3056,7 +3071,7 @@ var ri = {
|
|
|
3056
3071
|
])])) : u("", !0)]),
|
|
3057
3072
|
_: 1
|
|
3058
3073
|
}),
|
|
3059
|
-
f("div",
|
|
3074
|
+
f("div", Bi, [f("div", Vi, [k(v).previewItem.value ? (S(), l(jn, {
|
|
3060
3075
|
key: 0,
|
|
3061
3076
|
"selected-conversion": k(E).selectedConversion.value,
|
|
3062
3077
|
"onUpdate:selectedConversion": n[12] ||= (e) => k(E).selectedConversion.value = e,
|
|
@@ -3066,7 +3081,7 @@ var ri = {
|
|
|
3066
3081
|
"selected-conversion",
|
|
3067
3082
|
"item",
|
|
3068
3083
|
"folders"
|
|
3069
|
-
])) : u("", !0)]), f("div",
|
|
3084
|
+
])) : u("", !0)]), f("div", Hi, [k(v).selectedItems.value.size > 0 ? (S(), d("div", Ui, [k(v).previewItem.value ? (S(), d("button", {
|
|
3070
3085
|
key: 0,
|
|
3071
3086
|
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",
|
|
3072
3087
|
style: b({
|
|
@@ -3083,7 +3098,7 @@ var ri = {
|
|
|
3083
3098
|
key: 0,
|
|
3084
3099
|
size: 12,
|
|
3085
3100
|
"stroke-width": 2
|
|
3086
|
-
})), p(" " + D(k(E).copied.value ? a.value.mediaLibrary.copied : a.value.mediaLibrary.copyUrl), 1)], 4)) : u("", !0), f("div",
|
|
3101
|
+
})), p(" " + D(k(E).copied.value ? a.value.mediaLibrary.copied : a.value.mediaLibrary.copyUrl), 1)], 4)) : u("", !0), f("div", Wi, [f("button", {
|
|
3087
3102
|
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",
|
|
3088
3103
|
style: {
|
|
3089
3104
|
"border-color": "var(--tpl-border)",
|
|
@@ -3091,7 +3106,7 @@ var ri = {
|
|
|
3091
3106
|
"background-color": "var(--tpl-bg)"
|
|
3092
3107
|
},
|
|
3093
3108
|
onClick: n[14] ||= (e) => k(E).showMovePicker.value = !k(E).showMovePicker.value
|
|
3094
|
-
}, D(a.value.mediaLibrary.moveSelected), 1), k(E).showMovePicker.value ? (S(), l(
|
|
3109
|
+
}, D(a.value.mediaLibrary.moveSelected), 1), k(E).showMovePicker.value ? (S(), l(bn, {
|
|
3095
3110
|
key: 0,
|
|
3096
3111
|
folders: k(v).folders.value,
|
|
3097
3112
|
"current-folder-id": k(v).currentFolderId.value,
|
|
@@ -3101,7 +3116,7 @@ var ri = {
|
|
|
3101
3116
|
"folders",
|
|
3102
3117
|
"current-folder-id",
|
|
3103
3118
|
"onSelect"
|
|
3104
|
-
])) : u("", !0)])])) : u("", !0), f("div",
|
|
3119
|
+
])) : u("", !0)])])) : u("", !0), f("div", Gi, [k(v).selectedItems.value.size > 0 ? (S(), d("button", {
|
|
3105
3120
|
key: 0,
|
|
3106
3121
|
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",
|
|
3107
3122
|
style: {
|
|
@@ -3119,50 +3134,50 @@ var ri = {
|
|
|
3119
3134
|
},
|
|
3120
3135
|
disabled: !k(v).previewItem.value,
|
|
3121
3136
|
onClick: O
|
|
3122
|
-
}, D(a.value.mediaLibrary.selectFile), 9,
|
|
3137
|
+
}, D(a.value.mediaLibrary.selectFile), 9, Ki)) : u("", !0)])])])
|
|
3123
3138
|
]));
|
|
3124
3139
|
}
|
|
3125
|
-
}),
|
|
3126
|
-
async function
|
|
3140
|
+
}), $ = null, Ji = w(null);
|
|
3141
|
+
async function Yi(e) {
|
|
3127
3142
|
let n = typeof e.container == "string" ? document.querySelector(e.container) : e.container;
|
|
3128
3143
|
if (!n) throw Error(`Container element not found: ${e.container}`);
|
|
3129
3144
|
let i = r(e.auth, e.onError);
|
|
3130
3145
|
await i.initialize();
|
|
3131
|
-
let a = await new t(i).fetchConfig(), o = await
|
|
3132
|
-
return
|
|
3146
|
+
let a = await new t(i).fetchConfig(), o = await dr(e.locale ?? "en");
|
|
3147
|
+
return Zi(n, e.theme), $ && Xi(), new Promise((t, r) => {
|
|
3133
3148
|
try {
|
|
3134
|
-
|
|
3149
|
+
$ = c({ setup() {
|
|
3135
3150
|
let r = () => {
|
|
3136
3151
|
t({
|
|
3137
|
-
setTheme: (e) =>
|
|
3138
|
-
unmount:
|
|
3152
|
+
setTheme: (e) => Zi(n, e),
|
|
3153
|
+
unmount: Xi
|
|
3139
3154
|
});
|
|
3140
3155
|
};
|
|
3141
|
-
return () => g(
|
|
3156
|
+
return () => g(qi, {
|
|
3142
3157
|
authManager: i,
|
|
3143
3158
|
projectId: i.projectId,
|
|
3144
3159
|
planConfig: a,
|
|
3145
3160
|
translations: o,
|
|
3146
3161
|
onSelect: e.onSelect,
|
|
3147
3162
|
onError: e.onError,
|
|
3148
|
-
ref:
|
|
3163
|
+
ref: Ji,
|
|
3149
3164
|
onReady: r
|
|
3150
3165
|
});
|
|
3151
|
-
} }),
|
|
3166
|
+
} }), $.mount(n);
|
|
3152
3167
|
} catch (e) {
|
|
3153
3168
|
r(e);
|
|
3154
3169
|
}
|
|
3155
3170
|
});
|
|
3156
3171
|
}
|
|
3157
|
-
function
|
|
3158
|
-
|
|
3172
|
+
function Xi() {
|
|
3173
|
+
$ && ($.unmount(), $ = null, Ji.value = null);
|
|
3159
3174
|
}
|
|
3160
|
-
function
|
|
3175
|
+
function Zi(e, t) {
|
|
3161
3176
|
t && (t.primaryColor && e.style.setProperty("--tpl-primary", t.primaryColor), t.borderRadius !== void 0 && (e.style.setProperty("--tpl-radius", `${t.borderRadius}px`), e.style.setProperty("--tpl-radius-sm", `${Math.max(0, t.borderRadius - 3)}px`), e.style.setProperty("--tpl-radius-lg", `${t.borderRadius + 4}px`)));
|
|
3162
3177
|
}
|
|
3163
3178
|
typeof window < "u" && (window.TemplaticalMedia = {
|
|
3164
|
-
init:
|
|
3165
|
-
unmount:
|
|
3179
|
+
init: Yi,
|
|
3180
|
+
unmount: Xi
|
|
3166
3181
|
});
|
|
3167
3182
|
//#endregion
|
|
3168
|
-
export {
|
|
3183
|
+
export { pe as MediaApiClient, ni as MediaLibraryModal, Yi as init, Xi as unmount, Z as useI18n, Q as useMediaCategories, me as useMediaLibrary, ri as useMediaPicker };
|