@chaibuilder/pages 0.4.8-beta.2 → 0.4.8-beta.5
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/{B4MFY5CR-Y1TSYFEO.js → B4MFY5CR-BwIm3qbQ.js} +1 -1
- package/dist/{B4MFY5CR-De2uSYsE.cjs → B4MFY5CR-DY8Z5ymd.cjs} +1 -1
- package/dist/{HO4MOOFI-BYHU8reo.js → HO4MOOFI-B4ibIKNg.js} +2 -2
- package/dist/{HO4MOOFI-D_Wsaygd.cjs → HO4MOOFI-BYBE5fZ8.cjs} +1 -1
- package/dist/{HUY7CZI3-DrOAHzjx.cjs → HUY7CZI3-8v8-fX5C.cjs} +1 -1
- package/dist/{HUY7CZI3-Bu2JpU4v.js → HUY7CZI3-B9mlw8Vt.js} +2 -2
- package/dist/{asset-metadata-editor-r5vYHUfm.js → asset-metadata-editor-CyTBhS-V.js} +9 -9
- package/dist/{asset-metadata-editor-zw9u1BB9.cjs → asset-metadata-editor-IRTgc3or.cjs} +1 -1
- package/dist/{digital-asset-manager-C8r5r7TV.js → digital-asset-manager-D5mWFg9t.js} +120 -118
- package/dist/digital-asset-manager-yZJivo7V.cjs +1 -0
- package/dist/{image-editor-CwVua57o.js → image-editor-By8RDHso.js} +20 -20
- package/dist/{image-editor-D8wu5UNM.cjs → image-editor-DHmv5L8S.cjs} +1 -1
- package/dist/{index-B9qohq82.cjs → index-CisI4Eqe.cjs} +1 -1
- package/dist/{index-C657rWjb.js → index-gqdpcAQ2.js} +3 -3
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/server.cjs +1 -1
- package/dist/server.d.ts +4 -4
- package/dist/server.js +108 -90
- package/package.json +3 -3
- package/dist/digital-asset-manager-CBnrDmR9.cjs +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c, T as l, P as m, a as u, D as v, Q as i } from "./B4MFY5CR-
|
|
2
|
-
import { g as d, c as f, a as e } from "./index-
|
|
1
|
+
import { c, T as l, P as m, a as u, D as v, Q as i } from "./B4MFY5CR-BwIm3qbQ.js";
|
|
2
|
+
import { g as d, c as f, a as e } from "./index-gqdpcAQ2.js";
|
|
3
3
|
var p = (a) => {
|
|
4
4
|
const [r, t] = c({
|
|
5
5
|
prefix: "TanstackQueryDevtools"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./B4MFY5CR-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./B4MFY5CR-DY8Z5ymd.cjs"),t=require("./index-CisI4Eqe.cjs");var s=c=>{const[r,o]=e.createLocalStorage({prefix:"TanstackQueryDevtools"}),l=t.getPreferredColorScheme(),a=t.createMemo(()=>{const n=r.theme_preference||e.THEME_PREFERENCE;return n!=="system"?n:l()});return t.createComponent(e.QueryDevtoolsContext.Provider,{value:c,get children(){return t.createComponent(e.PiPProvider,{localStore:r,setLocalStore:o,get children(){return t.createComponent(e.ThemeContext.Provider,{value:a,get children(){return t.createComponent(e.Devtools,{localStore:r,setLocalStore:o})}})}})}})},u=s;exports.default=u;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./B4MFY5CR-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./B4MFY5CR-DY8Z5ymd.cjs"),t=require("./index-CisI4Eqe.cjs");var u=o=>{const[r,n]=e.createLocalStorage({prefix:"TanstackQueryDevtools"}),c=t.getPreferredColorScheme(),a=t.createMemo(()=>{const l=r.theme_preference||e.THEME_PREFERENCE;return l!=="system"?l:c()});return t.createComponent(e.QueryDevtoolsContext.Provider,{value:o,get children(){return t.createComponent(e.PiPProvider,{disabled:!0,localStore:r,setLocalStore:n,get children(){return t.createComponent(e.ThemeContext.Provider,{value:a,get children(){return t.createComponent(e.ParentPanel,{get children(){return t.createComponent(e.ContentView,{localStore:r,setLocalStore:n,get onClose(){return o.onClose},showPanelViewOnly:!0})}})}})}})}})},i=u;exports.default=i;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as s, T as c, P as u, a as i, b as m, C as P, Q as d } from "./B4MFY5CR-
|
|
2
|
-
import { g as v, c as C, a as e } from "./index-
|
|
1
|
+
import { c as s, T as c, P as u, a as i, b as m, C as P, Q as d } from "./B4MFY5CR-BwIm3qbQ.js";
|
|
2
|
+
import { g as v, c as C, a as e } from "./index-gqdpcAQ2.js";
|
|
3
3
|
var h = (t) => {
|
|
4
4
|
const [r, o] = s({
|
|
5
5
|
prefix: "TanstackQueryDevtools"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as i, Fragment as w, jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { Dialog as u, DialogContent as h, DialogHeader as
|
|
3
|
-
import { Eye as
|
|
2
|
+
import { Dialog as u, DialogContent as h, DialogHeader as N, DialogTitle as b, Label as r, Textarea as D, DialogFooter as F, Button as p } from "@chaibuilder/sdk/ui";
|
|
3
|
+
import { Eye as y } from "lucide-react";
|
|
4
4
|
import { useState as n } from "react";
|
|
5
|
-
function
|
|
5
|
+
function k({
|
|
6
6
|
asset: e,
|
|
7
7
|
onSave: l,
|
|
8
8
|
onCancel: o
|
|
@@ -19,7 +19,7 @@ function E({
|
|
|
19
19
|
};
|
|
20
20
|
return /* @__PURE__ */ i(w, { children: [
|
|
21
21
|
/* @__PURE__ */ a(u, { open: !0, onOpenChange: () => o(), children: /* @__PURE__ */ i(h, { className: "sm:max-w-[700px]", children: [
|
|
22
|
-
/* @__PURE__ */ a(
|
|
22
|
+
/* @__PURE__ */ a(N, { children: /* @__PURE__ */ a(b, { children: "Edit Asset Details" }) }),
|
|
23
23
|
/* @__PURE__ */ i("div", { className: "flex gap-4", children: [
|
|
24
24
|
/* @__PURE__ */ i("div", { className: "relative group", children: [
|
|
25
25
|
/* @__PURE__ */ a(
|
|
@@ -34,7 +34,7 @@ function E({
|
|
|
34
34
|
{
|
|
35
35
|
onClick: () => s(!0),
|
|
36
36
|
className: "absolute inset-0 flex items-center justify-center bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity rounded-md",
|
|
37
|
-
children: /* @__PURE__ */ a(
|
|
37
|
+
children: /* @__PURE__ */ a(y, { className: "h-8 w-8 text-white" })
|
|
38
38
|
}
|
|
39
39
|
)
|
|
40
40
|
] }),
|
|
@@ -62,7 +62,7 @@ function E({
|
|
|
62
62
|
/* @__PURE__ */ i("div", { className: "grid gap-2", children: [
|
|
63
63
|
/* @__PURE__ */ a(r, { htmlFor: "description", children: "Description" }),
|
|
64
64
|
/* @__PURE__ */ a(
|
|
65
|
-
|
|
65
|
+
D,
|
|
66
66
|
{
|
|
67
67
|
id: "description",
|
|
68
68
|
value: c,
|
|
@@ -74,7 +74,7 @@ function E({
|
|
|
74
74
|
] })
|
|
75
75
|
] })
|
|
76
76
|
] }),
|
|
77
|
-
/* @__PURE__ */ i(
|
|
77
|
+
/* @__PURE__ */ i(F, { children: [
|
|
78
78
|
/* @__PURE__ */ a(p, { variant: "outline", onClick: o, children: "Cancel" }),
|
|
79
79
|
/* @__PURE__ */ a(p, { onClick: x, disabled: d, children: d ? "Saving..." : "Save Changes" })
|
|
80
80
|
] })
|
|
@@ -90,7 +90,7 @@ function E({
|
|
|
90
90
|
] });
|
|
91
91
|
}
|
|
92
92
|
function S(e) {
|
|
93
|
-
return e < 1024 ? `${e.toFixed(2)} KB` : `${(e / 1024).toFixed(2)} MB`;
|
|
93
|
+
return e < 1024 ? `${e.toFixed(2)} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(2)} KB` : `${(e / (1024 * 1024)).toFixed(2)} MB`;
|
|
94
94
|
}
|
|
95
95
|
function g(e) {
|
|
96
96
|
if (!e) return "N/A";
|
|
@@ -104,5 +104,5 @@ function g(e) {
|
|
|
104
104
|
}).format(l);
|
|
105
105
|
}
|
|
106
106
|
export {
|
|
107
|
-
|
|
107
|
+
k as default
|
|
108
108
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("@chaibuilder/sdk/ui"),g=require("lucide-react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("@chaibuilder/sdk/ui"),g=require("lucide-react"),r=require("react");function p({asset:t,onSave:l,onCancel:n}){const[s,m]=r.useState(t.description||""),[o,c]=r.useState(!1),[x,d]=r.useState(!1),h=async()=>{c(!0);try{await l({description:s||void 0})}finally{c(!1)}};return e.jsxs(e.Fragment,{children:[e.jsx(a.Dialog,{open:!0,onOpenChange:()=>n(),children:e.jsxs(a.DialogContent,{className:"sm:max-w-[700px]",children:[e.jsx(a.DialogHeader,{children:e.jsx(a.DialogTitle,{children:"Edit Asset Details"})}),e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("div",{className:"relative group",children:[e.jsx("img",{src:t.url,className:"max-h-96 w-96 border rounded-md p-2"}),e.jsx("button",{onClick:()=>d(!0),className:"absolute inset-0 flex items-center justify-center bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity rounded-md",children:e.jsx(g.Eye,{className:"h-8 w-8 text-white"})})]}),e.jsxs("div",{className:"grid gap-3 w-full",children:[e.jsx(a.Label,{htmlFor:"description",children:"Details"}),e.jsx("div",{className:"grid grid-cols-1 gap-2 text-sm border rounded-md p-2",children:[{label:"File Name",value:t.name},{label:"Type",value:t.type},{label:"Format",value:t.format},{label:"Size",value:f(t.size)},{label:"Dimensions",value:`${t.width} × ${t.height}`},{label:"Created",value:u(t.createdAt)},{label:"Updated",value:u((t==null?void 0:t.updatedAt)||"")}].map(i=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(a.Label,{className:"w-max text-left px-2 w-1/4 font-normal text-gray-700",children:i.label}),":",e.jsx("div",{className:"w-max text-left font-medium text-gray-900 capitalize",children:i.value})]}))}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(a.Label,{htmlFor:"description",children:"Description"}),e.jsx(a.Textarea,{id:"description",value:s,placeholder:"Enter a description for the asset",onChange:i=>m(i.target.value),rows:3})]})]})]}),e.jsxs(a.DialogFooter,{children:[e.jsx(a.Button,{variant:"outline",onClick:n,children:"Cancel"}),e.jsx(a.Button,{onClick:h,disabled:o,children:o?"Saving...":"Save Changes"})]})]})}),e.jsx(a.Dialog,{open:x,onOpenChange:d,children:e.jsx(a.DialogContent,{className:"w-[60vw] h-[60vh] p-0 flex items-center justify-center bg-gray-100",children:e.jsx("img",{src:t.url,className:"w-full h-full object-contain",alt:t.name})})})]})}function f(t){return t<1024?`${t.toFixed(2)} B`:t<1024*1024?`${(t/1024).toFixed(2)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function u(t){if(!t)return"N/A";const l=new Date(t);return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"}).format(l)}exports.default=p;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
1
|
+
import { jsxs as t, Fragment as Q, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import Z, { useState as S, useCallback as w, useMemo as ce, useRef as de, Suspense as Y } from "react";
|
|
3
3
|
import { mergeClasses as $ } from "@chaibuilder/sdk";
|
|
4
|
-
import { Tabs as
|
|
5
|
-
import { debounce as Ae, find as Se, merge as
|
|
6
|
-
import { Search as
|
|
7
|
-
import { useDropzone as
|
|
8
|
-
import { useQueryClient as R, useMutation as K, useQuery as
|
|
4
|
+
import { Tabs as ue, TabsList as me, TabsTrigger as H, Button as f, TabsContent as V, Input as he, Card as ge, CardContent as pe, Dialog as fe, DialogContent as ye, DialogHeader as ve, DialogTitle as xe, DialogDescription as Ne, DialogFooter as we } from "@chaibuilder/sdk/ui";
|
|
5
|
+
import { debounce as Ae, find as Se, pick as W, first as be, merge as Ce } from "lodash-es";
|
|
6
|
+
import { Search as Ee, Film as Te, ImageIcon as De, Edit as Pe, Trash2 as Ue, Loader2 as X, Upload as Fe } from "lucide-react";
|
|
7
|
+
import { useDropzone as ze } from "react-dropzone";
|
|
8
|
+
import { useQueryClient as R, useMutation as K, useQuery as ke } from "@tanstack/react-query";
|
|
9
9
|
import { toast as b } from "sonner";
|
|
10
|
-
import { W as F, X as z, Y as y, Z as k } from "./index-
|
|
11
|
-
const
|
|
12
|
-
const
|
|
10
|
+
import { W as F, X as z, Y as y, Z as k } from "./index-gqdpcAQ2.js";
|
|
11
|
+
const Me = () => {
|
|
12
|
+
const a = F(), r = R(), o = z();
|
|
13
13
|
return K({
|
|
14
14
|
mutationFn: async ({
|
|
15
15
|
file: i,
|
|
16
16
|
folderId: d,
|
|
17
17
|
name: u
|
|
18
|
-
}) => o(
|
|
18
|
+
}) => o(a, {
|
|
19
19
|
action: y.UPLOAD_ASSET,
|
|
20
20
|
data: { file: i, folderId: d, name: u }
|
|
21
21
|
}),
|
|
@@ -28,10 +28,10 @@ const ze = () => {
|
|
|
28
28
|
b.error("Failed to upload asset");
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
-
},
|
|
32
|
-
const
|
|
31
|
+
}, Ie = () => {
|
|
32
|
+
const a = F(), r = R(), o = z();
|
|
33
33
|
return K({
|
|
34
|
-
mutationFn: async (i) => o(
|
|
34
|
+
mutationFn: async (i) => o(a, {
|
|
35
35
|
action: y.DELETE_ASSET,
|
|
36
36
|
data: { id: i }
|
|
37
37
|
}),
|
|
@@ -44,10 +44,10 @@ const ze = () => {
|
|
|
44
44
|
b.error("Failed to delete asset");
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
|
-
},
|
|
48
|
-
const
|
|
47
|
+
}, qe = () => {
|
|
48
|
+
const a = F(), r = R(), o = z();
|
|
49
49
|
return K({
|
|
50
|
-
mutationFn: async (i) => o(
|
|
50
|
+
mutationFn: async (i) => o(a, {
|
|
51
51
|
action: y.UPDATE_ASSET,
|
|
52
52
|
data: i
|
|
53
53
|
}),
|
|
@@ -60,9 +60,9 @@ const ze = () => {
|
|
|
60
60
|
b.error("Failed to update asset");
|
|
61
61
|
}
|
|
62
62
|
});
|
|
63
|
-
},
|
|
64
|
-
const r = F(), o = z(), { search: i, page: d = 1, limit: u = 10 } =
|
|
65
|
-
return
|
|
63
|
+
}, je = (a = {}) => {
|
|
64
|
+
const r = F(), o = z(), { search: i, page: d = 1, limit: u = 10 } = a;
|
|
65
|
+
return ke({
|
|
66
66
|
queryKey: [k, y.GET_ASSETS, i, d, u],
|
|
67
67
|
queryFn: async () => await o(r, {
|
|
68
68
|
action: y.GET_ASSETS,
|
|
@@ -75,16 +75,16 @@ const ze = () => {
|
|
|
75
75
|
retry: 1
|
|
76
76
|
});
|
|
77
77
|
};
|
|
78
|
-
function
|
|
79
|
-
const [r, o] =
|
|
78
|
+
function _e() {
|
|
79
|
+
const [r, o] = S([]), [i, d] = S({
|
|
80
80
|
query: "",
|
|
81
81
|
page: 1,
|
|
82
82
|
pageSize: 10
|
|
83
|
-
}), u = Ae(() => i.query, 300)(), { data: n, isLoading: C } =
|
|
83
|
+
}), u = Ae(() => i.query, 300)(), { data: n, isLoading: C } = je({
|
|
84
84
|
search: (u == null ? void 0 : u.toLowerCase().trim()) || "",
|
|
85
85
|
page: i.page,
|
|
86
86
|
limit: i.pageSize
|
|
87
|
-
}), v = n ? Math.ceil(n.total / n.pageSize) : 0, c = (n == null ? void 0 : n.page) || 1,
|
|
87
|
+
}), v = n ? Math.ceil(n.total / n.pageSize) : 0, c = (n == null ? void 0 : n.page) || 1, p = c < v, m = c > 1, { mutate: E, isPending: M } = qe(), { mutate: A, isPending: g } = Me(), { mutate: T, isPending: D } = Ie(), x = w(
|
|
88
88
|
(h) => {
|
|
89
89
|
h >= 1 && h <= v && d((N) => ({
|
|
90
90
|
...N,
|
|
@@ -92,23 +92,23 @@ function qe() {
|
|
|
92
92
|
}));
|
|
93
93
|
},
|
|
94
94
|
[v]
|
|
95
|
-
), I =
|
|
96
|
-
|
|
97
|
-
}, [c,
|
|
95
|
+
), I = w(() => {
|
|
96
|
+
p && x(c + 1);
|
|
97
|
+
}, [c, p, x]), q = w(() => {
|
|
98
98
|
m && x(c - 1);
|
|
99
|
-
}, [c, m, x]), j =
|
|
99
|
+
}, [c, m, x]), j = w((h) => {
|
|
100
100
|
d((N) => ({
|
|
101
101
|
...N,
|
|
102
102
|
query: h,
|
|
103
103
|
page: 1
|
|
104
104
|
// Reset to first page on new search
|
|
105
105
|
}));
|
|
106
|
-
}, []), P =
|
|
106
|
+
}, []), P = w(
|
|
107
107
|
(h) => {
|
|
108
108
|
o((N) => Se(N, { id: h.id }) ? [] : [h]);
|
|
109
109
|
},
|
|
110
110
|
[!1]
|
|
111
|
-
), _ =
|
|
111
|
+
), _ = w(() => {
|
|
112
112
|
o([]);
|
|
113
113
|
}, []);
|
|
114
114
|
return {
|
|
@@ -118,10 +118,10 @@ function qe() {
|
|
|
118
118
|
assets: (n == null ? void 0 : n.assets) || [],
|
|
119
119
|
currentPage: c,
|
|
120
120
|
totalPages: v,
|
|
121
|
-
hasNextPage:
|
|
121
|
+
hasNextPage: p,
|
|
122
122
|
hasPreviousPage: m,
|
|
123
123
|
// Mutations
|
|
124
|
-
uploadAsset:
|
|
124
|
+
uploadAsset: A,
|
|
125
125
|
updateAsset: E,
|
|
126
126
|
deleteAsset: T,
|
|
127
127
|
goToPage: x,
|
|
@@ -132,22 +132,22 @@ function qe() {
|
|
|
132
132
|
updateSelectedAssets: P,
|
|
133
133
|
// Loading
|
|
134
134
|
isLoadingAssets: C,
|
|
135
|
-
isUploadingAsset:
|
|
135
|
+
isUploadingAsset: g,
|
|
136
136
|
isUpdatingAsset: M,
|
|
137
137
|
isDeletingAsset: D
|
|
138
138
|
};
|
|
139
139
|
}
|
|
140
|
-
const
|
|
141
|
-
function
|
|
142
|
-
close:
|
|
140
|
+
const Le = Z.lazy(() => import("./asset-metadata-editor-CyTBhS-V.js")), Be = Z.lazy(() => import("./image-editor-By8RDHso.js"));
|
|
141
|
+
function Je({
|
|
142
|
+
close: a,
|
|
143
143
|
onSelect: r,
|
|
144
144
|
mode: o = "image"
|
|
145
145
|
}) {
|
|
146
|
-
const d =
|
|
146
|
+
const d = ce(() => [o], [o]), [u, n] = S("browse"), [C, v] = S(null), [c, p] = S(null), [m, E] = S({ show: !1, file: "" }), {
|
|
147
147
|
// Data
|
|
148
148
|
query: M,
|
|
149
|
-
assets:
|
|
150
|
-
selectedAssets:
|
|
149
|
+
assets: A,
|
|
150
|
+
selectedAssets: g,
|
|
151
151
|
// Mutations
|
|
152
152
|
uploadAsset: T,
|
|
153
153
|
updateAsset: D,
|
|
@@ -160,7 +160,7 @@ function Xe({
|
|
|
160
160
|
isUploadingAsset: _,
|
|
161
161
|
isUpdatingAsset: h
|
|
162
162
|
// isDeletingAsset,
|
|
163
|
-
} =
|
|
163
|
+
} = _e(), N = de(null), G = w(
|
|
164
164
|
async (s) => new Promise((l, L) => {
|
|
165
165
|
const O = s[0], U = new FileReader();
|
|
166
166
|
U.readAsDataURL(O), U.onload = async () => {
|
|
@@ -180,25 +180,27 @@ function Xe({
|
|
|
180
180
|
}, U.onerror = (B) => L(B);
|
|
181
181
|
}),
|
|
182
182
|
[T]
|
|
183
|
-
), { getRootProps:
|
|
183
|
+
), { getRootProps: J, getInputProps: ee, isDragActive: se } = ze({
|
|
184
184
|
onDrop: G,
|
|
185
185
|
accept: {
|
|
186
186
|
"image/*": d.includes("image") ? [] : []
|
|
187
187
|
},
|
|
188
188
|
maxSize: 10 * 1024 * 1024
|
|
189
|
-
}),
|
|
190
|
-
|
|
189
|
+
}), te = () => {
|
|
190
|
+
g.length !== 0 && (r(
|
|
191
|
+
W(be(g), ["url", "width", "height", "description"])
|
|
192
|
+
), a());
|
|
191
193
|
}, ae = async (s) => {
|
|
192
|
-
|
|
193
|
-
},
|
|
194
|
-
c && (await x(c.id),
|
|
195
|
-
},
|
|
194
|
+
p(s);
|
|
195
|
+
}, le = async () => {
|
|
196
|
+
c && (await x(c.id), p(null));
|
|
197
|
+
}, ie = (s) => {
|
|
196
198
|
v(s);
|
|
197
|
-
},
|
|
198
|
-
await D(
|
|
199
|
-
},
|
|
199
|
+
}, ne = async (s, l) => {
|
|
200
|
+
await D(Ce(s, W(l, ["id", "description"]))), a();
|
|
201
|
+
}, re = (s) => {
|
|
200
202
|
I(s.target.value);
|
|
201
|
-
},
|
|
203
|
+
}, oe = async (s, l) => {
|
|
202
204
|
try {
|
|
203
205
|
l ? await T({
|
|
204
206
|
file: s,
|
|
@@ -212,23 +214,23 @@ function Xe({
|
|
|
212
214
|
console.error("Error saving edited image:", L);
|
|
213
215
|
}
|
|
214
216
|
};
|
|
215
|
-
return /* @__PURE__ */
|
|
216
|
-
/* @__PURE__ */
|
|
217
|
+
return /* @__PURE__ */ t(Q, { children: [
|
|
218
|
+
/* @__PURE__ */ t("div", { className: "min-w-[700px] min-h-[600px] w-[900px] max-w-[900px]", children: [
|
|
217
219
|
/* @__PURE__ */ e("h1", { className: "text-lg font-medium pb-4", children: "Digital Asset Manager" }),
|
|
218
|
-
/* @__PURE__ */
|
|
219
|
-
|
|
220
|
+
/* @__PURE__ */ t(
|
|
221
|
+
ue,
|
|
220
222
|
{
|
|
221
223
|
value: u,
|
|
222
224
|
onValueChange: (s) => n(s),
|
|
223
225
|
className: "flex-1 flex flex-col h-full",
|
|
224
226
|
children: [
|
|
225
|
-
/* @__PURE__ */
|
|
226
|
-
/* @__PURE__ */
|
|
227
|
+
/* @__PURE__ */ t("div", { className: "flex justify-between items-center mb-2", children: [
|
|
228
|
+
/* @__PURE__ */ t(me, { children: [
|
|
227
229
|
/* @__PURE__ */ e(H, { value: "browse", children: "Browse Assets" }),
|
|
228
230
|
/* @__PURE__ */ e(H, { value: "upload", children: "Upload" })
|
|
229
231
|
] }),
|
|
230
|
-
/* @__PURE__ */
|
|
231
|
-
|
|
232
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: [
|
|
233
|
+
g.length > 0 && /* @__PURE__ */ e(Q, { children: /* @__PURE__ */ e(
|
|
232
234
|
f,
|
|
233
235
|
{
|
|
234
236
|
variant: "outline",
|
|
@@ -242,27 +244,27 @@ function Xe({
|
|
|
242
244
|
f,
|
|
243
245
|
{
|
|
244
246
|
size: "sm",
|
|
245
|
-
onClick:
|
|
246
|
-
disabled:
|
|
247
|
+
onClick: te,
|
|
248
|
+
disabled: g.length === 0,
|
|
247
249
|
children: "Select Asset"
|
|
248
250
|
}
|
|
249
251
|
)
|
|
250
252
|
] })
|
|
251
253
|
] }),
|
|
252
|
-
/* @__PURE__ */
|
|
253
|
-
/* @__PURE__ */ e("div", { className: "flex items-center gap-2 mb-2", children: /* @__PURE__ */
|
|
254
|
-
/* @__PURE__ */ e(
|
|
254
|
+
/* @__PURE__ */ t(V, { value: "browse", className: "flex-1 flex flex-col", children: [
|
|
255
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-2 mb-2", children: /* @__PURE__ */ t("div", { className: "relative w-full", children: [
|
|
256
|
+
/* @__PURE__ */ e(Ee, { className: "absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
|
|
255
257
|
/* @__PURE__ */ e(
|
|
256
|
-
|
|
258
|
+
he,
|
|
257
259
|
{
|
|
258
260
|
placeholder: "Search assets...",
|
|
259
261
|
value: M,
|
|
260
|
-
onChange:
|
|
262
|
+
onChange: re,
|
|
261
263
|
className: "pl-8"
|
|
262
264
|
}
|
|
263
265
|
)
|
|
264
266
|
] }) }),
|
|
265
|
-
P &&
|
|
267
|
+
P && A.length === 0 ? /* @__PURE__ */ t("div", { className: "grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-2 overflow-y-auto max-h-[550px] p-1", children: [
|
|
266
268
|
/* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
|
|
267
269
|
/* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
|
|
268
270
|
/* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
|
|
@@ -273,28 +275,28 @@ function Xe({
|
|
|
273
275
|
/* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
|
|
274
276
|
/* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
|
|
275
277
|
/* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" })
|
|
276
|
-
] }) :
|
|
277
|
-
/* @__PURE__ */
|
|
278
|
+
] }) : A.length === 0 ? /* @__PURE__ */ t("div", { className: "flex flex-col items-center justify-center text-center p-12 h-[380px]", children: [
|
|
279
|
+
/* @__PURE__ */ t("div", { className: "text-muted-foreground mb-2", children: [
|
|
278
280
|
/* @__PURE__ */ e("h3", { className: "text-gray-800 font-medium", children: "No assets to display" }),
|
|
279
281
|
/* @__PURE__ */ e("p", { className: "text-sm", children: "You haven't uploaded any assets yet. Start by uploading your first asset." })
|
|
280
282
|
] }),
|
|
281
283
|
/* @__PURE__ */ e("div", { className: "flex gap-2 pt-4", children: /* @__PURE__ */ e(f, { size: "lg", onClick: () => n("upload"), children: "Upload Assets" }) })
|
|
282
|
-
] }) : /* @__PURE__ */
|
|
284
|
+
] }) : /* @__PURE__ */ t(
|
|
283
285
|
"div",
|
|
284
286
|
{
|
|
285
287
|
ref: N,
|
|
286
288
|
className: "grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-2 overflow-y-auto max-h-[550px] p-1",
|
|
287
289
|
children: [
|
|
288
|
-
|
|
289
|
-
|
|
290
|
+
A.map((s) => /* @__PURE__ */ e(
|
|
291
|
+
ge,
|
|
290
292
|
{
|
|
291
293
|
className: $(
|
|
292
294
|
"cursor-pointer overflow-hidden transition-all",
|
|
293
|
-
|
|
295
|
+
g.some((l) => l.id === s.id) ? "ring-2 ring-primary" : "hover:ring-2 hover:ring-primary/20"
|
|
294
296
|
),
|
|
295
297
|
onClick: () => j(s),
|
|
296
|
-
children: /* @__PURE__ */
|
|
297
|
-
/* @__PURE__ */
|
|
298
|
+
children: /* @__PURE__ */ t(pe, { className: "p-0 relative group", children: [
|
|
299
|
+
/* @__PURE__ */ t("div", { className: "aspect-square relative overflow-hidden bg-muted", children: [
|
|
298
300
|
s.type === "image" ? /* @__PURE__ */ e(
|
|
299
301
|
"img",
|
|
300
302
|
{
|
|
@@ -302,8 +304,8 @@ function Xe({
|
|
|
302
304
|
alt: s.name,
|
|
303
305
|
className: "object-cover w-full h-full min-h-[100px]"
|
|
304
306
|
}
|
|
305
|
-
) : /* @__PURE__ */
|
|
306
|
-
/* @__PURE__ */ e(
|
|
307
|
+
) : /* @__PURE__ */ t("div", { className: "flex items-center justify-center h-full", children: [
|
|
308
|
+
/* @__PURE__ */ e(Te, { className: "h-12 w-12 text-muted-foreground" }),
|
|
307
309
|
s.thumbnailUrl && /* @__PURE__ */ e(
|
|
308
310
|
"img",
|
|
309
311
|
{
|
|
@@ -313,7 +315,7 @@ function Xe({
|
|
|
313
315
|
}
|
|
314
316
|
)
|
|
315
317
|
] }),
|
|
316
|
-
/* @__PURE__ */
|
|
318
|
+
/* @__PURE__ */ t("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-2", children: [
|
|
317
319
|
/* @__PURE__ */ e(
|
|
318
320
|
f,
|
|
319
321
|
{
|
|
@@ -321,9 +323,9 @@ function Xe({
|
|
|
321
323
|
size: "icon",
|
|
322
324
|
className: "h-8 w-8",
|
|
323
325
|
onClick: (l) => {
|
|
324
|
-
l.stopPropagation(),
|
|
326
|
+
l.stopPropagation(), ie(s);
|
|
325
327
|
},
|
|
326
|
-
children: /* @__PURE__ */ e(
|
|
328
|
+
children: /* @__PURE__ */ e(De, { className: "h-4 w-4" })
|
|
327
329
|
}
|
|
328
330
|
),
|
|
329
331
|
/* @__PURE__ */ e(
|
|
@@ -340,7 +342,7 @@ function Xe({
|
|
|
340
342
|
name: s.name
|
|
341
343
|
});
|
|
342
344
|
},
|
|
343
|
-
children: /* @__PURE__ */ e(
|
|
345
|
+
children: /* @__PURE__ */ e(Pe, { className: "h-4 w-4" })
|
|
344
346
|
}
|
|
345
347
|
),
|
|
346
348
|
/* @__PURE__ */ e(
|
|
@@ -352,15 +354,15 @@ function Xe({
|
|
|
352
354
|
onClick: (l) => {
|
|
353
355
|
l.stopPropagation(), ae(s);
|
|
354
356
|
},
|
|
355
|
-
children: /* @__PURE__ */ e(
|
|
357
|
+
children: /* @__PURE__ */ e(Ue, { className: "h-4 w-4" })
|
|
356
358
|
}
|
|
357
359
|
)
|
|
358
360
|
] }),
|
|
359
|
-
|
|
361
|
+
g.some((l) => l.id === s.id) && /* @__PURE__ */ e("div", { className: "absolute top-2 left-2", children: /* @__PURE__ */ e(
|
|
360
362
|
"input",
|
|
361
363
|
{
|
|
362
364
|
type: "checkbox",
|
|
363
|
-
checked:
|
|
365
|
+
checked: g.some(
|
|
364
366
|
(l) => l.id === s.id
|
|
365
367
|
),
|
|
366
368
|
readOnly: !0,
|
|
@@ -368,7 +370,7 @@ function Xe({
|
|
|
368
370
|
}
|
|
369
371
|
) })
|
|
370
372
|
] }),
|
|
371
|
-
/* @__PURE__ */
|
|
373
|
+
/* @__PURE__ */ t("div", { className: "p-2", children: [
|
|
372
374
|
/* @__PURE__ */ e(
|
|
373
375
|
"div",
|
|
374
376
|
{
|
|
@@ -377,44 +379,44 @@ function Xe({
|
|
|
377
379
|
children: s.name
|
|
378
380
|
}
|
|
379
381
|
),
|
|
380
|
-
/* @__PURE__ */
|
|
381
|
-
/* @__PURE__ */ e("span", { children:
|
|
382
|
-
/* @__PURE__ */ e("span", { children:
|
|
382
|
+
/* @__PURE__ */ t("div", { className: "text-xs text-muted-foreground flex items-center justify-between", children: [
|
|
383
|
+
/* @__PURE__ */ e("span", { children: Qe((s == null ? void 0 : s.size) || 0) }),
|
|
384
|
+
/* @__PURE__ */ e("span", { children: Re(s.createdAt) })
|
|
383
385
|
] })
|
|
384
386
|
] })
|
|
385
387
|
] })
|
|
386
388
|
},
|
|
387
389
|
s.id
|
|
388
390
|
)),
|
|
389
|
-
P &&
|
|
391
|
+
P && A.length > 0 && /* @__PURE__ */ e("div", { className: "col-span-full flex justify-center py-4", children: /* @__PURE__ */ e(X, { className: "h-6 w-6 animate-spin text-muted-foreground" }) })
|
|
390
392
|
]
|
|
391
393
|
}
|
|
392
394
|
)
|
|
393
395
|
] }),
|
|
394
|
-
/* @__PURE__ */ e(V, { value: "upload", className: "flex-1 ", children: /* @__PURE__ */
|
|
396
|
+
/* @__PURE__ */ e(V, { value: "upload", className: "flex-1 ", children: /* @__PURE__ */ t(
|
|
395
397
|
"div",
|
|
396
398
|
{
|
|
397
|
-
...
|
|
399
|
+
...J(),
|
|
398
400
|
className: $(
|
|
399
401
|
"border-2 border-dashed rounded-lg h-[380px] flex flex-col items-center justify-center text-center cursor-pointer hover:bg-gray-50",
|
|
400
|
-
|
|
402
|
+
se ? "border-primary bg-primary/5" : "border-muted-foreground/20"
|
|
401
403
|
),
|
|
402
404
|
children: [
|
|
403
|
-
/* @__PURE__ */ e("input", { ...
|
|
404
|
-
h || _ ? /* @__PURE__ */
|
|
405
|
-
/* @__PURE__ */ e(
|
|
405
|
+
/* @__PURE__ */ e("input", { ...ee() }),
|
|
406
|
+
h || _ ? /* @__PURE__ */ t("div", { className: "flex flex-col items-center", children: [
|
|
407
|
+
/* @__PURE__ */ e(X, { className: "h-12 w-12 text-primary animate-spin mb-4" }),
|
|
406
408
|
/* @__PURE__ */ e("h3", { className: "text-lg font-medium mb-1", children: "Uploading files..." }),
|
|
407
409
|
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: "Please wait while your files are being processed." })
|
|
408
|
-
] }) : /* @__PURE__ */
|
|
409
|
-
/* @__PURE__ */ e(
|
|
410
|
+
] }) : /* @__PURE__ */ t(Q, { children: [
|
|
411
|
+
/* @__PURE__ */ e(Fe, { className: "h-12 w-12 text-muted-foreground mb-4" }),
|
|
410
412
|
/* @__PURE__ */ e("h3", { className: "text-lg font-medium mb-1", children: "Drag & drop files here" }),
|
|
411
413
|
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground mb-4", children: "or click to browse your files" }),
|
|
412
|
-
/* @__PURE__ */
|
|
413
|
-
/* @__PURE__ */
|
|
414
|
+
/* @__PURE__ */ t("div", { className: "text-xs text-muted-foreground", children: [
|
|
415
|
+
/* @__PURE__ */ t("p", { children: [
|
|
414
416
|
"Accepted file types: ",
|
|
415
417
|
d.join(", ")
|
|
416
418
|
] }),
|
|
417
|
-
/* @__PURE__ */
|
|
419
|
+
/* @__PURE__ */ t("p", { children: [
|
|
418
420
|
"Maximum file size: ",
|
|
419
421
|
10,
|
|
420
422
|
"MB"
|
|
@@ -429,53 +431,53 @@ function Xe({
|
|
|
429
431
|
)
|
|
430
432
|
] }),
|
|
431
433
|
C && /* @__PURE__ */ e(Y, { fallback: /* @__PURE__ */ e("div", { children: "Loading..." }), children: /* @__PURE__ */ e(
|
|
432
|
-
|
|
434
|
+
Le,
|
|
433
435
|
{
|
|
434
436
|
asset: C,
|
|
435
|
-
onSave: (s) =>
|
|
437
|
+
onSave: (s) => ne(C, s),
|
|
436
438
|
onCancel: () => {
|
|
437
439
|
v(null);
|
|
438
440
|
}
|
|
439
441
|
}
|
|
440
442
|
) }),
|
|
441
443
|
m.show && /* @__PURE__ */ e(Y, { fallback: /* @__PURE__ */ e("div", { children: "Loading..." }), children: /* @__PURE__ */ e(
|
|
442
|
-
|
|
444
|
+
Be,
|
|
443
445
|
{
|
|
444
446
|
imageUrl: m.file,
|
|
445
|
-
onSave:
|
|
447
|
+
onSave: oe,
|
|
446
448
|
onClose: () => E({ show: !1, file: "" }),
|
|
447
449
|
defaultSavedImageName: m.name,
|
|
448
450
|
isEditing: !!m.id
|
|
449
451
|
}
|
|
450
452
|
) }),
|
|
451
453
|
c && /* @__PURE__ */ e(
|
|
452
|
-
|
|
454
|
+
fe,
|
|
453
455
|
{
|
|
454
456
|
open: !!c,
|
|
455
|
-
onOpenChange: () =>
|
|
456
|
-
children: /* @__PURE__ */
|
|
457
|
-
/* @__PURE__ */
|
|
458
|
-
/* @__PURE__ */ e(
|
|
459
|
-
/* @__PURE__ */
|
|
457
|
+
onOpenChange: () => p(null),
|
|
458
|
+
children: /* @__PURE__ */ t(ye, { children: [
|
|
459
|
+
/* @__PURE__ */ t(ve, { children: [
|
|
460
|
+
/* @__PURE__ */ e(xe, { children: "Delete Asset" }),
|
|
461
|
+
/* @__PURE__ */ t(Ne, { children: [
|
|
460
462
|
'Are you sure you want to delete "',
|
|
461
463
|
c.name,
|
|
462
464
|
'"? This action cannot be undone.'
|
|
463
465
|
] })
|
|
464
466
|
] }),
|
|
465
|
-
/* @__PURE__ */
|
|
466
|
-
/* @__PURE__ */ e(f, { variant: "outline", onClick: () =>
|
|
467
|
-
/* @__PURE__ */ e(f, { variant: "destructive", onClick:
|
|
467
|
+
/* @__PURE__ */ t(we, { className: "gap-2 sm:gap-0", children: [
|
|
468
|
+
/* @__PURE__ */ e(f, { variant: "outline", onClick: () => p(null), children: "Cancel" }),
|
|
469
|
+
/* @__PURE__ */ e(f, { variant: "destructive", onClick: le, children: "Delete" })
|
|
468
470
|
] })
|
|
469
471
|
] })
|
|
470
472
|
}
|
|
471
473
|
)
|
|
472
474
|
] });
|
|
473
475
|
}
|
|
474
|
-
function
|
|
475
|
-
return
|
|
476
|
+
function Qe(a) {
|
|
477
|
+
return a < 1024 ? `${a.toFixed(2)} B` : a < 1024 * 1024 ? `${(a / 1024).toFixed(2)} KB` : `${(a / (1024 * 1024)).toFixed(2)} MB`;
|
|
476
478
|
}
|
|
477
|
-
function
|
|
478
|
-
const r = new Date(
|
|
479
|
+
function Re(a) {
|
|
480
|
+
const r = new Date(a);
|
|
479
481
|
return new Intl.DateTimeFormat("en-US", {
|
|
480
482
|
month: "short",
|
|
481
483
|
day: "numeric",
|
|
@@ -483,5 +485,5 @@ function Be(t) {
|
|
|
483
485
|
}).format(r);
|
|
484
486
|
}
|
|
485
487
|
export {
|
|
486
|
-
|
|
488
|
+
Je as default
|
|
487
489
|
};
|