camox 0.3.0 → 0.3.1
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/components/AuthGate.js +2 -1
- package/dist/core/components/AddBlockControlBar.js +117 -44
- package/dist/core/components/lexical/InlineContentEditable.js +37 -17
- package/dist/core/components/lexical/InlineLexicalEditor.js +84 -25
- package/dist/core/components/lexical/SelectionBroadcaster.js +84 -47
- package/dist/core/components/lexical/SidebarLexicalEditor.js +54 -19
- package/dist/core/createBlock.js +1172 -414
- package/dist/core/createLayout.js +48 -16
- package/dist/core/hooks/useFieldSelection.js +24 -13
- package/dist/core/hooks/useIsEditable.js +8 -2
- package/dist/core/hooks/useOverlayMessage.js +51 -20
- package/dist/features/content/CamoxContent.js +239 -107
- package/dist/features/content/components/AssetCard.js +78 -16
- package/dist/features/content/components/AssetCardSkeleton.js +11 -4
- package/dist/features/content/components/ContentSidebar.js +15 -8
- package/dist/features/content/components/UploadDropZone.js +77 -34
- package/dist/features/content/components/UploadProgressDrawer.js +201 -58
- package/dist/features/metadata/sitemap.js +15 -0
- package/dist/features/preview/CamoxPreview.js +447 -179
- package/dist/features/preview/components/AddBlockSheet.js +344 -167
- package/dist/features/preview/components/AgentChatSheet.js +32 -10
- package/dist/features/preview/components/AssetFieldEditor.js +185 -50
- package/dist/features/preview/components/AssetLightbox.js +60 -33
- package/dist/features/preview/components/AssetPickerGrid.js +203 -71
- package/dist/features/preview/components/BlockActionsPopover.js +295 -218
- package/dist/features/preview/components/CreatePageSheet.js +3 -3
- package/dist/features/preview/components/DebouncedFieldEditor.js +80 -23
- package/dist/features/preview/components/EditPageSheet.js +241 -86
- package/dist/features/preview/components/ItemFieldsEditor.js +209 -115
- package/dist/features/preview/components/LinkFieldEditor.js +351 -153
- package/dist/features/preview/components/MultipleAssetFieldEditor.js +245 -92
- package/dist/features/preview/components/OverlayTracker.js +58 -23
- package/dist/features/preview/components/Overlays.js +85 -43
- package/dist/features/preview/components/PageContentSheet.js +18 -18
- package/dist/features/preview/components/PageLocationFieldset.js +229 -63
- package/dist/features/preview/components/PagePicker.js +27 -27
- package/dist/features/preview/components/PageTree.js +921 -319
- package/dist/features/preview/components/PeekedBlock.js +173 -63
- package/dist/features/preview/components/PreviewPanel.js +271 -148
- package/dist/features/preview/components/PreviewSideSheet.js +44 -11
- package/dist/features/preview/components/PreviewToolbar.js +262 -59
- package/dist/features/preview/components/RepeatableItemsList.js +187 -78
- package/dist/features/preview/components/ShikiMarkdown.js +46 -20
- package/dist/features/preview/components/TextFormatToolbar.js +81 -23
- package/dist/features/preview/components/UnlinkAssetButton.js +161 -40
- package/dist/features/preview/components/useUpdateBlockPosition.js +64 -47
- package/dist/features/preview/previewStore.d.ts +2 -2
- package/dist/features/provider/CamoxProvider.js +69 -21
- package/dist/features/provider/actionsStore.d.ts +2 -2
- package/dist/features/provider/components/CamoxAppContext.js +15 -5
- package/dist/features/provider/components/CommandPalette.js +199 -92
- package/dist/features/provider/useAdminShortcuts.js +80 -64
- package/dist/features/routes/pageRoute.js +8 -1
- package/dist/features/studio/CamoxStudio.js +45 -9
- package/dist/features/studio/components/EnvironmentMenu.js +47 -12
- package/dist/features/studio/components/Navbar.js +163 -65
- package/dist/features/studio/components/ProjectMenu.js +263 -82
- package/dist/features/studio/components/UserButton.js +21 -6
- package/dist/features/studio/studioStore.d.ts +2 -2
- package/dist/features/studio/useTheme.js +128 -74
- package/dist/hooks/use-file-upload.js +11 -11
- package/dist/hooks/use-marquee-selection.js +121 -74
- package/dist/lib/auth.js +95 -51
- package/dist/lib/normalized-data.js +103 -30
- package/dist/lib/use-project-room.js +55 -22
- package/dist/studio.css +2 -2
- package/package.json +29 -26
- package/dist/lib/auth.d.ts +0 -2130
- package/dist/lib/auth.d.ts.map +0 -1
|
@@ -2,6 +2,7 @@ import { useProjectSlug } from "../../../lib/auth.js";
|
|
|
2
2
|
import { fileQueries, projectQueries } from "../../../lib/queries.js";
|
|
3
3
|
import { AssetLightbox } from "./AssetLightbox.js";
|
|
4
4
|
import { AssetCard } from "../../content/components/AssetCard.js";
|
|
5
|
+
import { c } from "react/compiler-runtime";
|
|
5
6
|
import { useQuery } from "@tanstack/react-query";
|
|
6
7
|
import * as React from "react";
|
|
7
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -9,90 +10,221 @@ import { Button } from "@camox/ui/button";
|
|
|
9
10
|
import { ArrowLeft } from "lucide-react";
|
|
10
11
|
import { Skeleton } from "@camox/ui/skeleton";
|
|
11
12
|
//#region src/features/preview/components/AssetPickerGrid.tsx
|
|
12
|
-
var AssetPickerGrid = (
|
|
13
|
+
var AssetPickerGrid = (t0) => {
|
|
14
|
+
const $ = c(45);
|
|
15
|
+
const { assetType, mode, onSelectSingle, onSelectMultiple, onClose } = t0;
|
|
13
16
|
const projectSlug = useProjectSlug();
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
let t1;
|
|
18
|
+
if ($[0] !== projectSlug) {
|
|
19
|
+
t1 = projectQueries.getBySlug(projectSlug);
|
|
20
|
+
$[0] = projectSlug;
|
|
21
|
+
$[1] = t1;
|
|
22
|
+
} else t1 = $[1];
|
|
23
|
+
const { data: project } = useQuery(t1);
|
|
24
|
+
let t2;
|
|
25
|
+
if ($[2] !== project?.id) {
|
|
26
|
+
t2 = fileQueries.list(project?.id ?? 0);
|
|
27
|
+
$[2] = project?.id;
|
|
28
|
+
$[3] = t2;
|
|
29
|
+
} else t2 = $[3];
|
|
30
|
+
const t3 = !!project;
|
|
31
|
+
let t4;
|
|
32
|
+
if ($[4] !== t2 || $[5] !== t3) {
|
|
33
|
+
t4 = {
|
|
34
|
+
...t2,
|
|
35
|
+
enabled: t3
|
|
36
|
+
};
|
|
37
|
+
$[4] = t2;
|
|
38
|
+
$[5] = t3;
|
|
39
|
+
$[6] = t4;
|
|
40
|
+
} else t4 = $[6];
|
|
41
|
+
const { data: allFiles } = useQuery(t4);
|
|
42
|
+
let t5;
|
|
43
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
44
|
+
t5 = /* @__PURE__ */ new Set();
|
|
45
|
+
$[7] = t5;
|
|
46
|
+
} else t5 = $[7];
|
|
47
|
+
const [selectedIds, setSelectedIds] = React.useState(t5);
|
|
20
48
|
const [lightboxFile, setLightboxFile] = React.useState(null);
|
|
21
49
|
const isImage = assetType === "Image";
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (!
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
50
|
+
let t6;
|
|
51
|
+
bb0: {
|
|
52
|
+
if (!allFiles) {
|
|
53
|
+
t6 = void 0;
|
|
54
|
+
break bb0;
|
|
55
|
+
}
|
|
56
|
+
if (!isImage) {
|
|
57
|
+
t6 = allFiles;
|
|
58
|
+
break bb0;
|
|
59
|
+
}
|
|
60
|
+
let t7;
|
|
61
|
+
if ($[8] !== allFiles) {
|
|
62
|
+
t7 = allFiles.filter(_temp);
|
|
63
|
+
$[8] = allFiles;
|
|
64
|
+
$[9] = t7;
|
|
65
|
+
} else t7 = $[9];
|
|
66
|
+
t6 = t7;
|
|
67
|
+
}
|
|
68
|
+
const files = t6;
|
|
69
|
+
let t7;
|
|
70
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
71
|
+
t7 = (fileId) => {
|
|
72
|
+
setSelectedIds((prev) => {
|
|
73
|
+
const next = new Set(prev);
|
|
74
|
+
if (next.has(fileId)) next.delete(fileId);
|
|
75
|
+
else next.add(fileId);
|
|
76
|
+
return next;
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
$[10] = t7;
|
|
80
|
+
} else t7 = $[10];
|
|
81
|
+
const toggleSelection = t7;
|
|
82
|
+
let t8;
|
|
83
|
+
if ($[11] !== files || $[12] !== onSelectMultiple || $[13] !== selectedIds) {
|
|
84
|
+
t8 = () => {
|
|
85
|
+
if (!files) return;
|
|
86
|
+
onSelectMultiple(files.filter((f_0) => selectedIds.has(f_0.id)));
|
|
87
|
+
};
|
|
88
|
+
$[11] = files;
|
|
89
|
+
$[12] = onSelectMultiple;
|
|
90
|
+
$[13] = selectedIds;
|
|
91
|
+
$[14] = t8;
|
|
92
|
+
} else t8 = $[14];
|
|
93
|
+
const handleConfirmMultiple = t8;
|
|
94
|
+
const title = mode === "multiple" ? `Select ${isImage ? "images" : "files"}` : `Select ${isImage ? "image" : "file"}`;
|
|
95
|
+
let t9;
|
|
96
|
+
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
|
97
|
+
t9 = /* @__PURE__ */ jsx(ArrowLeft, { className: "h-4 w-4" });
|
|
98
|
+
$[15] = t9;
|
|
99
|
+
} else t9 = $[15];
|
|
100
|
+
let t10;
|
|
101
|
+
if ($[16] !== onClose || $[17] !== title) {
|
|
102
|
+
t10 = /* @__PURE__ */ jsxs(Button, {
|
|
103
|
+
variant: "ghost",
|
|
104
|
+
size: "sm",
|
|
105
|
+
onClick: onClose,
|
|
106
|
+
children: [t9, title]
|
|
33
107
|
});
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
/* @__PURE__ */ jsxs(
|
|
108
|
+
$[16] = onClose;
|
|
109
|
+
$[17] = title;
|
|
110
|
+
$[18] = t10;
|
|
111
|
+
} else t10 = $[18];
|
|
112
|
+
let t11;
|
|
113
|
+
if ($[19] !== handleConfirmMultiple || $[20] !== mode || $[21] !== selectedIds) {
|
|
114
|
+
t11 = mode === "multiple" && /* @__PURE__ */ jsxs(Button, {
|
|
115
|
+
variant: "default",
|
|
116
|
+
size: "sm",
|
|
117
|
+
className: "ml-auto",
|
|
118
|
+
disabled: selectedIds.size === 0,
|
|
119
|
+
onClick: handleConfirmMultiple,
|
|
120
|
+
children: [
|
|
121
|
+
"Add selected (",
|
|
122
|
+
selectedIds.size,
|
|
123
|
+
")"
|
|
124
|
+
]
|
|
125
|
+
});
|
|
126
|
+
$[19] = handleConfirmMultiple;
|
|
127
|
+
$[20] = mode;
|
|
128
|
+
$[21] = selectedIds;
|
|
129
|
+
$[22] = t11;
|
|
130
|
+
} else t11 = $[22];
|
|
131
|
+
let t12;
|
|
132
|
+
if ($[23] !== t10 || $[24] !== t11) {
|
|
133
|
+
t12 = /* @__PURE__ */ jsxs("div", {
|
|
41
134
|
className: "bg-background sticky top-0 z-10 flex items-center gap-2 px-4 py-4",
|
|
42
|
-
children: [
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
135
|
+
children: [t10, t11]
|
|
136
|
+
});
|
|
137
|
+
$[23] = t10;
|
|
138
|
+
$[24] = t11;
|
|
139
|
+
$[25] = t12;
|
|
140
|
+
} else t12 = $[25];
|
|
141
|
+
let t13;
|
|
142
|
+
if ($[26] !== files) {
|
|
143
|
+
t13 = files === void 0 && /* @__PURE__ */ jsx("div", {
|
|
144
|
+
className: "grid grid-cols-[repeat(auto-fill,minmax(140px,1fr))] gap-3",
|
|
145
|
+
children: Array.from({ length: 6 }).map(_temp2)
|
|
146
|
+
});
|
|
147
|
+
$[26] = files;
|
|
148
|
+
$[27] = t13;
|
|
149
|
+
} else t13 = $[27];
|
|
150
|
+
let t14;
|
|
151
|
+
if ($[28] !== files?.length) {
|
|
152
|
+
t14 = files?.length === 0 && /* @__PURE__ */ jsx("p", {
|
|
153
|
+
className: "text-muted-foreground py-8 text-center text-sm",
|
|
154
|
+
children: "No assets yet"
|
|
155
|
+
});
|
|
156
|
+
$[28] = files?.length;
|
|
157
|
+
$[29] = t14;
|
|
158
|
+
} else t14 = $[29];
|
|
159
|
+
let t15;
|
|
160
|
+
if ($[30] !== files || $[31] !== mode || $[32] !== onSelectSingle || $[33] !== selectedIds) {
|
|
161
|
+
t15 = files && files.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
162
|
+
className: "grid grid-cols-[repeat(auto-fill,minmax(140px,1fr))] gap-3",
|
|
163
|
+
children: files.map((file) => /* @__PURE__ */ jsx(AssetCard, {
|
|
164
|
+
file,
|
|
165
|
+
selected: selectedIds.has(file.id),
|
|
166
|
+
onSelect: () => {
|
|
167
|
+
if (mode === "single") onSelectSingle(file);
|
|
168
|
+
else toggleSelection(file.id);
|
|
169
|
+
},
|
|
170
|
+
onOpen: () => setLightboxFile(file)
|
|
171
|
+
}, file.id))
|
|
172
|
+
});
|
|
173
|
+
$[30] = files;
|
|
174
|
+
$[31] = mode;
|
|
175
|
+
$[32] = onSelectSingle;
|
|
176
|
+
$[33] = selectedIds;
|
|
177
|
+
$[34] = t15;
|
|
178
|
+
} else t15 = $[34];
|
|
179
|
+
let t16;
|
|
180
|
+
if ($[35] !== t13 || $[36] !== t14 || $[37] !== t15) {
|
|
181
|
+
t16 = /* @__PURE__ */ jsxs("div", {
|
|
61
182
|
className: "px-4 pb-4",
|
|
62
183
|
children: [
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
className: "flex flex-col gap-1.5 rounded-lg p-2",
|
|
67
|
-
children: [/* @__PURE__ */ jsx(Skeleton, { className: "aspect-4/3 w-full rounded-md" }), /* @__PURE__ */ jsx(Skeleton, { className: "h-3.5 w-3/4 rounded" })]
|
|
68
|
-
}, i))
|
|
69
|
-
}),
|
|
70
|
-
files?.length === 0 && /* @__PURE__ */ jsx("p", {
|
|
71
|
-
className: "text-muted-foreground py-8 text-center text-sm",
|
|
72
|
-
children: "No assets yet"
|
|
73
|
-
}),
|
|
74
|
-
files && files.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
75
|
-
className: "grid grid-cols-[repeat(auto-fill,minmax(140px,1fr))] gap-3",
|
|
76
|
-
children: files.map((file) => /* @__PURE__ */ jsx(AssetCard, {
|
|
77
|
-
file,
|
|
78
|
-
selected: selectedIds.has(file.id),
|
|
79
|
-
onSelect: () => {
|
|
80
|
-
if (mode === "single") onSelectSingle(file);
|
|
81
|
-
else toggleSelection(file.id);
|
|
82
|
-
},
|
|
83
|
-
onOpen: () => setLightboxFile(file)
|
|
84
|
-
}, file.id))
|
|
85
|
-
})
|
|
184
|
+
t13,
|
|
185
|
+
t14,
|
|
186
|
+
t15
|
|
86
187
|
]
|
|
87
|
-
})
|
|
88
|
-
|
|
188
|
+
});
|
|
189
|
+
$[35] = t13;
|
|
190
|
+
$[36] = t14;
|
|
191
|
+
$[37] = t15;
|
|
192
|
+
$[38] = t16;
|
|
193
|
+
} else t16 = $[38];
|
|
194
|
+
let t17;
|
|
195
|
+
if ($[39] !== lightboxFile) {
|
|
196
|
+
t17 = lightboxFile && /* @__PURE__ */ jsx(AssetLightbox, {
|
|
89
197
|
open: !!lightboxFile,
|
|
90
198
|
onOpenChange: (open) => {
|
|
91
199
|
if (!open) setLightboxFile(null);
|
|
92
200
|
},
|
|
93
201
|
fileId: lightboxFile.id
|
|
94
|
-
})
|
|
95
|
-
|
|
202
|
+
});
|
|
203
|
+
$[39] = lightboxFile;
|
|
204
|
+
$[40] = t17;
|
|
205
|
+
} else t17 = $[40];
|
|
206
|
+
let t18;
|
|
207
|
+
if ($[41] !== t12 || $[42] !== t16 || $[43] !== t17) {
|
|
208
|
+
t18 = /* @__PURE__ */ jsxs("div", { children: [
|
|
209
|
+
t12,
|
|
210
|
+
t16,
|
|
211
|
+
t17
|
|
212
|
+
] });
|
|
213
|
+
$[41] = t12;
|
|
214
|
+
$[42] = t16;
|
|
215
|
+
$[43] = t17;
|
|
216
|
+
$[44] = t18;
|
|
217
|
+
} else t18 = $[44];
|
|
218
|
+
return t18;
|
|
96
219
|
};
|
|
220
|
+
function _temp(f) {
|
|
221
|
+
return f.mimeType?.startsWith("image/");
|
|
222
|
+
}
|
|
223
|
+
function _temp2(_, i) {
|
|
224
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
225
|
+
className: "flex flex-col gap-1.5 rounded-lg p-2",
|
|
226
|
+
children: [/* @__PURE__ */ jsx(Skeleton, { className: "aspect-4/3 w-full rounded-md" }), /* @__PURE__ */ jsx(Skeleton, { className: "h-3.5 w-3/4 rounded" })]
|
|
227
|
+
}, i);
|
|
228
|
+
}
|
|
97
229
|
//#endregion
|
|
98
230
|
export { AssetPickerGrid };
|