camox 0.32.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/core/createBlock.d.ts +1 -1
- package/dist/core/createBlock.js +88 -108
- package/dist/core/hooks/useIsEditable.js +6 -10
- package/dist/core/lib/fieldTypes.js +10 -219
- package/dist/features/agent-chat/components/AgentChatSidebar.js +172 -0
- package/dist/features/agent-chat/components/AgentChatThread.js +9 -9
- package/dist/features/preview/CamoxPreview.js +137 -729
- package/dist/features/preview/components/{AddBlockSheet.js → AddBlockSidebar.js} +121 -131
- package/dist/features/preview/components/AssetFieldEditor.js +107 -82
- package/dist/features/preview/components/AssetLightbox.js +4 -4
- package/dist/features/preview/components/AssetPickerModal.js +277 -0
- package/dist/features/preview/components/BlockActionsPopover.js +18 -24
- package/dist/features/preview/components/CreatePageModal.js +6 -6
- package/dist/features/preview/components/FieldToolbar.js +64 -127
- package/dist/features/preview/components/ItemFieldsEditor.js +98 -125
- package/dist/features/preview/components/LeftSidebar.js +64 -0
- package/dist/features/preview/components/LinkFieldEditor.js +1 -1
- package/dist/features/preview/components/MultipleAssetFieldEditor.js +94 -56
- package/dist/features/preview/components/OverlayTracker.js +15 -15
- package/dist/features/preview/components/Overlays.js +12 -12
- package/dist/features/preview/components/PageEditorSidebar.js +563 -0
- package/dist/features/preview/components/PageInfoSidebar.js +1453 -0
- package/dist/features/preview/components/PageNavigatorSidebar.js +590 -0
- package/dist/features/preview/components/PagePicker.js +3 -3
- package/dist/features/preview/components/PageStatusBadge.js +1 -1
- package/dist/features/preview/components/PageTree.js +204 -564
- package/dist/features/preview/components/PreviewPanel.js +123 -158
- package/dist/features/preview/components/PreviewToolbar.js +260 -256
- package/dist/features/preview/components/PublishDialog.js +2 -2
- package/dist/features/preview/components/RepeatableItemsList.js +2 -2
- package/dist/features/preview/components/RightSidebar.js +109 -0
- package/dist/features/preview/components/UnlinkAssetButton.js +2 -2
- package/dist/features/preview/components/useRepeatableItemActions.js +3 -138
- package/dist/features/preview/components/useUpdateBlockPosition.js +1 -1
- package/dist/features/preview/previewQueryFns.js +23 -0
- package/dist/features/preview/previewStore.js +46 -63
- package/dist/features/provider/CamoxProvider.js +255 -70
- package/dist/features/provider/useAdminShortcuts.js +5 -48
- package/dist/features/routes/pageRoute.js +1 -1
- package/dist/features/studio/CamoxStudio.js +6 -5
- package/dist/features/studio/components/EnvironmentMenu.js +2 -2
- package/dist/features/studio/components/Navbar.js +53 -71
- package/dist/features/studio/components/ProjectMenu.js +1 -1
- package/dist/features/studio/components/UserButton.js +1 -1
- package/dist/features/studio/routes.js +7 -0
- package/dist/features/studio/useTheme.js +67 -33
- package/dist/features/vite/routeGeneration.js +68 -66
- package/dist/hooks/use-file-upload.js +1 -1
- package/dist/lib/auth.js +23 -22
- package/dist/lib/utils.js +1 -1
- package/dist/studio-overlays.css +1 -1
- package/dist/studio.css +1 -1
- package/package.json +4 -4
- package/dist/features/agent-chat/components/AgentChatSheet.js +0 -207
- package/dist/features/preview/components/AssetPickerGrid.js +0 -236
- package/dist/features/preview/components/PageContentSheet.js +0 -608
- package/dist/features/preview/components/PageMetadataModal.js +0 -908
- package/dist/features/preview/components/PreviewSideSheet.js +0 -76
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { trackClientEvent } from "../../../lib/telemetry-client.js";
|
|
2
|
-
import { previewStore } from "../previewStore.js";
|
|
3
|
-
import { PreviewSideSheet, Sheet } from "./PreviewSideSheet.js";
|
|
4
1
|
import { useProjectSlug } from "../../../lib/auth.js";
|
|
5
2
|
import { blockMutations, blockQueries, projectQueries } from "../../../lib/queries.js";
|
|
3
|
+
import { trackClientEvent } from "../../../lib/telemetry-client.js";
|
|
4
|
+
import { previewStore } from "../previewStore.js";
|
|
6
5
|
import { usePageBlocks } from "../../../lib/normalized-data.js";
|
|
7
6
|
import { useCamoxApp } from "../../provider/components/CamoxAppContext.js";
|
|
8
7
|
import { useRequireDraftSource } from "../../../core/hooks/useRequireDraftSource.js";
|
|
@@ -13,16 +12,19 @@ import { useLocation } from "@tanstack/react-router";
|
|
|
13
12
|
import { useSelector } from "@xstate/store-react";
|
|
14
13
|
import { generateKeyBetween } from "fractional-indexing";
|
|
15
14
|
import * as React from "react";
|
|
16
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
15
|
import { queryKeys } from "@camox/api-contract/query-keys";
|
|
16
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
+
import { Button } from "@camox/ui/button";
|
|
18
|
+
import { ArrowLeft } from "lucide-react";
|
|
18
19
|
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "@camox/ui/command";
|
|
20
|
+
import { PanelContent } from "@camox/ui/panel";
|
|
19
21
|
|
|
20
|
-
//#region src/features/preview/components/
|
|
21
|
-
const
|
|
22
|
-
const $ = c(
|
|
23
|
-
if ($[0] !== "
|
|
24
|
-
for (let $i = 0; $i <
|
|
25
|
-
$[0] = "
|
|
22
|
+
//#region src/features/preview/components/AddBlockSidebar.tsx
|
|
23
|
+
const AddBlockSidebar = () => {
|
|
24
|
+
const $ = c(58);
|
|
25
|
+
if ($[0] !== "27e7cb036200fff6fa774c3b5c9184e0f19bdb13228e0c714ed0cebcdf6abec5") {
|
|
26
|
+
for (let $i = 0; $i < 58; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
27
|
+
$[0] = "27e7cb036200fff6fa774c3b5c9184e0f19bdb13228e0c714ed0cebcdf6abec5";
|
|
26
28
|
}
|
|
27
29
|
const [highlightedValue, setHighlightedValue] = React.useState("");
|
|
28
30
|
const queryClient = useQueryClient();
|
|
@@ -163,9 +165,8 @@ const AddBlockSheet = () => {
|
|
|
163
165
|
$[16] = t8;
|
|
164
166
|
} else t8 = $[16];
|
|
165
167
|
const pageCounts = t8;
|
|
166
|
-
const
|
|
167
|
-
const
|
|
168
|
-
const addBlockSource = useSelector(previewStore, _temp6);
|
|
168
|
+
const peekedBlockPosition = useSelector(previewStore, _temp4);
|
|
169
|
+
const addBlockSource = useSelector(previewStore, _temp5);
|
|
169
170
|
let t9;
|
|
170
171
|
if ($[17] !== addBlockSource || $[18] !== createBlock || $[19] !== page || $[20] !== pageBlocks_0 || $[21] !== peekedBlockPosition || $[22] !== requireDraft) {
|
|
171
172
|
t9 = async (block_0) => {
|
|
@@ -221,74 +222,64 @@ const AddBlockSheet = () => {
|
|
|
221
222
|
if (block_2) handlePreviewBlock(block_2);
|
|
222
223
|
else previewStore.send({ type: "clearPeekedBlock" });
|
|
223
224
|
};
|
|
224
|
-
const handleOpenChange = _temp7;
|
|
225
225
|
let t11;
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
t11 = () => {
|
|
229
|
-
if (isOpen) setHighlightedValue("");
|
|
230
|
-
};
|
|
231
|
-
t12 = [isOpen];
|
|
232
|
-
$[27] = isOpen;
|
|
233
|
-
$[28] = t11;
|
|
234
|
-
$[29] = t12;
|
|
235
|
-
} else {
|
|
236
|
-
t11 = $[28];
|
|
237
|
-
t12 = $[29];
|
|
238
|
-
}
|
|
239
|
-
React.useEffect(t11, t12);
|
|
240
|
-
let t13;
|
|
241
|
-
if ($[30] !== pageCounts || $[31] !== totalCounts) {
|
|
242
|
-
t13 = (blockId_0) => {
|
|
226
|
+
if ($[27] !== pageCounts || $[28] !== totalCounts) {
|
|
227
|
+
t11 = (blockId_0) => {
|
|
243
228
|
const total = totalCounts[blockId_0] ?? 0;
|
|
244
229
|
if (total === 0) return "Never used";
|
|
245
230
|
const page_0 = pageCounts[blockId_0] ?? "none";
|
|
246
231
|
return `${total} use${total > 1 ? "s" : ""} (${page_0} here)`;
|
|
247
232
|
};
|
|
248
|
-
$[
|
|
249
|
-
$[
|
|
250
|
-
$[
|
|
251
|
-
} else
|
|
252
|
-
const displayCount =
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
233
|
+
$[27] = pageCounts;
|
|
234
|
+
$[28] = totalCounts;
|
|
235
|
+
$[29] = t11;
|
|
236
|
+
} else t11 = $[29];
|
|
237
|
+
const displayCount = t11;
|
|
238
|
+
let t12;
|
|
239
|
+
if ($[30] === Symbol.for("react.memo_cache_sentinel")) {
|
|
240
|
+
t12 = /* @__PURE__ */ jsx("div", {
|
|
241
|
+
className: "px-2 pt-4",
|
|
242
|
+
children: /* @__PURE__ */ jsxs(Button, {
|
|
243
|
+
variant: "ghost",
|
|
244
|
+
className: "w-full justify-start",
|
|
245
|
+
onClick: _temp6,
|
|
246
|
+
children: [/* @__PURE__ */ jsx(ArrowLeft, { className: "text-muted-foreground" }), "Add new block"]
|
|
247
|
+
})
|
|
260
248
|
});
|
|
261
|
-
$[
|
|
262
|
-
} else
|
|
263
|
-
const
|
|
249
|
+
$[30] = t12;
|
|
250
|
+
} else t12 = $[30];
|
|
251
|
+
const T0 = PanelContent;
|
|
252
|
+
const t13 = "flex grow basis-0 flex-col overflow-auto px-2 py-2";
|
|
264
253
|
const T1 = Command;
|
|
265
|
-
const
|
|
266
|
-
const
|
|
267
|
-
let
|
|
268
|
-
if ($[
|
|
269
|
-
|
|
254
|
+
const t14 = "overflow-visible rounded-none! bg-transparent! p-0!";
|
|
255
|
+
const t15 = _temp7;
|
|
256
|
+
let t16;
|
|
257
|
+
if ($[31] === Symbol.for("react.memo_cache_sentinel")) {
|
|
258
|
+
t16 = /* @__PURE__ */ jsx(CommandInput, {
|
|
270
259
|
placeholder: "Search blocks...",
|
|
260
|
+
className: "px-0 pt-0",
|
|
271
261
|
autoFocus: true
|
|
272
262
|
});
|
|
273
|
-
$[
|
|
274
|
-
} else
|
|
263
|
+
$[31] = t16;
|
|
264
|
+
} else t16 = $[31];
|
|
275
265
|
const T2 = CommandList;
|
|
276
|
-
const
|
|
277
|
-
let
|
|
278
|
-
if ($[
|
|
279
|
-
|
|
280
|
-
$[
|
|
281
|
-
} else
|
|
266
|
+
const t17 = "mt-2 max-h-full";
|
|
267
|
+
let t18;
|
|
268
|
+
if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
|
|
269
|
+
t18 = /* @__PURE__ */ jsx(CommandEmpty, { children: "No blocks found." });
|
|
270
|
+
$[32] = t18;
|
|
271
|
+
} else t18 = $[32];
|
|
282
272
|
const T3 = CommandGroup;
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
$[
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
273
|
+
const t19 = "p-0";
|
|
274
|
+
let t20;
|
|
275
|
+
if ($[33] !== totalCounts) {
|
|
276
|
+
t20 = (a, b_3) => (totalCounts[b_3._internal.id] ?? 0) - (totalCounts[a._internal.id] ?? 0);
|
|
277
|
+
$[33] = totalCounts;
|
|
278
|
+
$[34] = t20;
|
|
279
|
+
} else t20 = $[34];
|
|
280
|
+
let t21;
|
|
281
|
+
if ($[35] !== displayCount || $[36] !== handleAddBlock) {
|
|
282
|
+
t21 = (block_3) => /* @__PURE__ */ jsx(CommandItem, {
|
|
292
283
|
value: block_3._internal.title,
|
|
293
284
|
onSelect: () => {
|
|
294
285
|
handleAddBlock(block_3);
|
|
@@ -302,65 +293,67 @@ const AddBlockSheet = () => {
|
|
|
302
293
|
})]
|
|
303
294
|
})
|
|
304
295
|
}, block_3._internal.id);
|
|
305
|
-
$[
|
|
306
|
-
$[
|
|
296
|
+
$[35] = displayCount;
|
|
297
|
+
$[36] = handleAddBlock;
|
|
298
|
+
$[37] = t21;
|
|
299
|
+
} else t21 = $[37];
|
|
300
|
+
const t22 = availableBlocks.sort(t20).map(t21);
|
|
301
|
+
let t23;
|
|
302
|
+
if ($[38] !== T3 || $[39] !== t22) {
|
|
303
|
+
t23 = /* @__PURE__ */ jsx(T3, {
|
|
304
|
+
className: t19,
|
|
305
|
+
children: t22
|
|
306
|
+
});
|
|
307
|
+
$[38] = T3;
|
|
308
|
+
$[39] = t22;
|
|
307
309
|
$[40] = t23;
|
|
308
310
|
} else t23 = $[40];
|
|
309
|
-
|
|
311
|
+
let t24;
|
|
312
|
+
if ($[41] !== T2 || $[42] !== t18 || $[43] !== t23) {
|
|
313
|
+
t24 = /* @__PURE__ */ jsxs(T2, {
|
|
314
|
+
className: t17,
|
|
315
|
+
children: [t18, t23]
|
|
316
|
+
});
|
|
317
|
+
$[41] = T2;
|
|
318
|
+
$[42] = t18;
|
|
319
|
+
$[43] = t23;
|
|
320
|
+
$[44] = t24;
|
|
321
|
+
} else t24 = $[44];
|
|
310
322
|
let t25;
|
|
311
|
-
if ($[
|
|
312
|
-
t25 = /* @__PURE__ */
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
323
|
+
if ($[45] !== T1 || $[46] !== handleValueChange || $[47] !== highlightedValue || $[48] !== t15 || $[49] !== t16 || $[50] !== t24) {
|
|
324
|
+
t25 = /* @__PURE__ */ jsxs(T1, {
|
|
325
|
+
value: highlightedValue,
|
|
326
|
+
onValueChange: handleValueChange,
|
|
327
|
+
className: t14,
|
|
328
|
+
onKeyDown: t15,
|
|
329
|
+
children: [t16, t24]
|
|
330
|
+
});
|
|
331
|
+
$[45] = T1;
|
|
332
|
+
$[46] = handleValueChange;
|
|
333
|
+
$[47] = highlightedValue;
|
|
334
|
+
$[48] = t15;
|
|
335
|
+
$[49] = t16;
|
|
336
|
+
$[50] = t24;
|
|
337
|
+
$[51] = t25;
|
|
338
|
+
} else t25 = $[51];
|
|
317
339
|
let t26;
|
|
318
|
-
if ($[
|
|
319
|
-
t26 = /* @__PURE__ */
|
|
320
|
-
className:
|
|
321
|
-
children:
|
|
340
|
+
if ($[52] !== T0 || $[53] !== t25) {
|
|
341
|
+
t26 = /* @__PURE__ */ jsx(T0, {
|
|
342
|
+
className: t13,
|
|
343
|
+
children: t25
|
|
322
344
|
});
|
|
323
|
-
$[
|
|
324
|
-
$[
|
|
325
|
-
$[
|
|
326
|
-
|
|
327
|
-
} else t26 = $[47];
|
|
345
|
+
$[52] = T0;
|
|
346
|
+
$[53] = t25;
|
|
347
|
+
$[54] = t26;
|
|
348
|
+
} else t26 = $[54];
|
|
328
349
|
let t27;
|
|
329
|
-
if ($[
|
|
330
|
-
t27 = /* @__PURE__ */
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
onKeyDown: t18,
|
|
337
|
-
children: [t19, t26]
|
|
338
|
-
})
|
|
339
|
-
});
|
|
340
|
-
$[48] = T1;
|
|
341
|
-
$[49] = handleValueChange;
|
|
342
|
-
$[50] = highlightedValue;
|
|
343
|
-
$[51] = t18;
|
|
344
|
-
$[52] = t19;
|
|
345
|
-
$[53] = t26;
|
|
346
|
-
$[54] = t27;
|
|
347
|
-
} else t27 = $[54];
|
|
348
|
-
let t28;
|
|
349
|
-
if ($[55] !== T0 || $[56] !== handleOpenChange || $[57] !== isOpen || $[58] !== t15 || $[59] !== t27) {
|
|
350
|
-
t28 = /* @__PURE__ */ jsxs(T0, {
|
|
351
|
-
open: isOpen,
|
|
352
|
-
onOpenChange: handleOpenChange,
|
|
353
|
-
className: t14,
|
|
354
|
-
children: [t15, t27]
|
|
355
|
-
});
|
|
356
|
-
$[55] = T0;
|
|
357
|
-
$[56] = handleOpenChange;
|
|
358
|
-
$[57] = isOpen;
|
|
359
|
-
$[58] = t15;
|
|
360
|
-
$[59] = t27;
|
|
361
|
-
$[60] = t28;
|
|
362
|
-
} else t28 = $[60];
|
|
363
|
-
return t28;
|
|
350
|
+
if ($[55] !== t12 || $[56] !== t26) {
|
|
351
|
+
t27 = /* @__PURE__ */ jsxs(Fragment, { children: [t12, t26] });
|
|
352
|
+
$[55] = t12;
|
|
353
|
+
$[56] = t26;
|
|
354
|
+
$[57] = t27;
|
|
355
|
+
} else t27 = $[57];
|
|
356
|
+
return t27;
|
|
364
357
|
};
|
|
365
358
|
function _temp(state) {
|
|
366
359
|
return state.context.peekedPagePathname;
|
|
@@ -372,20 +365,17 @@ function _temp3(b_1) {
|
|
|
372
365
|
return !b_1._internal.layoutOnly;
|
|
373
366
|
}
|
|
374
367
|
function _temp4(state_0) {
|
|
375
|
-
return state_0.context.
|
|
368
|
+
return state_0.context.peekedBlockPosition;
|
|
376
369
|
}
|
|
377
370
|
function _temp5(state_1) {
|
|
378
|
-
return state_1.context.
|
|
379
|
-
}
|
|
380
|
-
function _temp6(state_2) {
|
|
381
|
-
return state_2.context.addBlockSource;
|
|
371
|
+
return state_1.context.addBlockSource;
|
|
382
372
|
}
|
|
383
|
-
function
|
|
384
|
-
|
|
373
|
+
function _temp6() {
|
|
374
|
+
return previewStore.send({ type: "closeAddBlockSidebar" });
|
|
385
375
|
}
|
|
386
|
-
function
|
|
387
|
-
if (e.key === "Escape") previewStore.send({ type: "
|
|
376
|
+
function _temp7(e) {
|
|
377
|
+
if (e.key === "Escape") previewStore.send({ type: "closeAddBlockSidebar" });
|
|
388
378
|
}
|
|
389
379
|
|
|
390
380
|
//#endregion
|
|
391
|
-
export {
|
|
381
|
+
export { AddBlockSidebar };
|
|
@@ -5,7 +5,7 @@ import { UploadDropZone } from "../../content/components/UploadDropZone.js";
|
|
|
5
5
|
import { UploadItemRow } from "../../content/components/UploadProgressDrawer.js";
|
|
6
6
|
import { useFileUpload } from "../../../hooks/use-file-upload.js";
|
|
7
7
|
import { AssetLightbox } from "./AssetLightbox.js";
|
|
8
|
-
import {
|
|
8
|
+
import { AssetPickerModal } from "./AssetPickerModal.js";
|
|
9
9
|
import { UnlinkAssetButton } from "./UnlinkAssetButton.js";
|
|
10
10
|
import { c } from "react/compiler-runtime";
|
|
11
11
|
import { useQuery } from "@tanstack/react-query";
|
|
@@ -21,9 +21,9 @@ function assetLabel(isImage, multiple) {
|
|
|
21
21
|
}
|
|
22
22
|
const AssetActionButtons = (t0) => {
|
|
23
23
|
const $ = c(27);
|
|
24
|
-
if ($[0] !== "
|
|
24
|
+
if ($[0] !== "4a65b10e6768746c3b5e48410da30f980b826ef25e0b19c47e522622b4dd7baf") {
|
|
25
25
|
for (let $i = 0; $i < 27; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
26
|
-
$[0] = "
|
|
26
|
+
$[0] = "4a65b10e6768746c3b5e48410da30f980b826ef25e0b19c47e522622b4dd7baf";
|
|
27
27
|
}
|
|
28
28
|
const { isImage, multiple, fileInputRef, onPickerOpen, onFilesSelected, uploads } = t0;
|
|
29
29
|
let t1;
|
|
@@ -125,10 +125,10 @@ const AssetActionButtons = (t0) => {
|
|
|
125
125
|
return t11;
|
|
126
126
|
};
|
|
127
127
|
const SingleAssetFieldEditor = (t0) => {
|
|
128
|
-
const $ = c(
|
|
129
|
-
if ($[0] !== "
|
|
130
|
-
for (let $i = 0; $i <
|
|
131
|
-
$[0] = "
|
|
128
|
+
const $ = c(37);
|
|
129
|
+
if ($[0] !== "4a65b10e6768746c3b5e48410da30f980b826ef25e0b19c47e522622b4dd7baf") {
|
|
130
|
+
for (let $i = 0; $i < 37; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
131
|
+
$[0] = "4a65b10e6768746c3b5e48410da30f980b826ef25e0b19c47e522622b4dd7baf";
|
|
132
132
|
}
|
|
133
133
|
const { fieldName, assetType, currentData, onFieldChange } = t0;
|
|
134
134
|
const asset = currentData[fieldName];
|
|
@@ -189,87 +189,112 @@ const SingleAssetFieldEditor = (t0) => {
|
|
|
189
189
|
} else t6 = $[13];
|
|
190
190
|
const handleSelectExisting = t6;
|
|
191
191
|
let t7;
|
|
192
|
-
if ($[14] !== asset || $[15] !==
|
|
193
|
-
t7 =
|
|
192
|
+
if ($[14] !== asset || $[15] !== fieldName || $[16] !== hasAsset || $[17] !== isImage || $[18] !== lightboxOpen || $[19] !== onFieldChange) {
|
|
193
|
+
t7 = hasAsset && /* @__PURE__ */ jsxs("div", {
|
|
194
|
+
className: "text-foreground hover:bg-accent/75 flex max-w-full flex-row items-center gap-2 rounded-lg border-2 px-1 py-1",
|
|
195
|
+
children: [
|
|
196
|
+
/* @__PURE__ */ jsxs("button", {
|
|
197
|
+
type: "button",
|
|
198
|
+
className: "flex min-w-0 flex-1 cursor-zoom-in items-center gap-2 rounded-sm p-1",
|
|
199
|
+
onClick: () => setLightboxOpen(true),
|
|
200
|
+
children: [isImage ? /* @__PURE__ */ jsx("div", {
|
|
201
|
+
className: "border-border h-10 w-10 shrink-0 overflow-hidden rounded border",
|
|
202
|
+
children: /* @__PURE__ */ jsx("img", {
|
|
203
|
+
src: transformImageUrl(asset.url, {
|
|
204
|
+
width: 128,
|
|
205
|
+
mimeType: asset.mimeType,
|
|
206
|
+
size: asset.size
|
|
207
|
+
}),
|
|
208
|
+
alt: asset.alt || asset.filename,
|
|
209
|
+
className: "h-full w-full object-cover"
|
|
210
|
+
})
|
|
211
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
212
|
+
className: "border-border bg-muted flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden rounded border",
|
|
213
|
+
children: /* @__PURE__ */ jsx(FileIcon, { className: "text-muted-foreground h-5 w-5" })
|
|
214
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
215
|
+
className: "flex-1 truncate text-left text-sm",
|
|
216
|
+
title: asset.filename,
|
|
217
|
+
children: asset.filename || "Untitled"
|
|
218
|
+
})]
|
|
219
|
+
}),
|
|
220
|
+
/* @__PURE__ */ jsx(UnlinkAssetButton, {
|
|
221
|
+
fileId: asset._fileId != null ? Number(asset._fileId) : void 0,
|
|
222
|
+
onUnlink: () => {
|
|
223
|
+
onFieldChange(fieldName, null);
|
|
224
|
+
}
|
|
225
|
+
}),
|
|
226
|
+
asset._fileId && /* @__PURE__ */ jsx(AssetLightbox, {
|
|
227
|
+
open: lightboxOpen,
|
|
228
|
+
onOpenChange: setLightboxOpen,
|
|
229
|
+
fileId: Number(asset._fileId)
|
|
230
|
+
})
|
|
231
|
+
]
|
|
232
|
+
});
|
|
233
|
+
$[14] = asset;
|
|
234
|
+
$[15] = fieldName;
|
|
235
|
+
$[16] = hasAsset;
|
|
236
|
+
$[17] = isImage;
|
|
237
|
+
$[18] = lightboxOpen;
|
|
238
|
+
$[19] = onFieldChange;
|
|
239
|
+
$[20] = t7;
|
|
240
|
+
} else t7 = $[20];
|
|
241
|
+
let t8;
|
|
242
|
+
if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
|
|
243
|
+
t8 = () => setPickerOpen(true);
|
|
244
|
+
$[21] = t8;
|
|
245
|
+
} else t8 = $[21];
|
|
246
|
+
let t9;
|
|
247
|
+
if ($[22] !== handleDrop || $[23] !== isImage || $[24] !== uploads) {
|
|
248
|
+
t9 = /* @__PURE__ */ jsx(AssetActionButtons, {
|
|
249
|
+
isImage,
|
|
250
|
+
multiple: false,
|
|
251
|
+
fileInputRef,
|
|
252
|
+
onPickerOpen: t8,
|
|
253
|
+
onFilesSelected: handleDrop,
|
|
254
|
+
uploads
|
|
255
|
+
});
|
|
256
|
+
$[22] = handleDrop;
|
|
257
|
+
$[23] = isImage;
|
|
258
|
+
$[24] = uploads;
|
|
259
|
+
$[25] = t9;
|
|
260
|
+
} else t9 = $[25];
|
|
261
|
+
let t10;
|
|
262
|
+
if ($[26] !== t7 || $[27] !== t9) {
|
|
263
|
+
t10 = /* @__PURE__ */ jsxs("div", {
|
|
264
|
+
className: "space-y-4 px-2 py-4",
|
|
265
|
+
children: [t7, t9]
|
|
266
|
+
});
|
|
267
|
+
$[26] = t7;
|
|
268
|
+
$[27] = t9;
|
|
269
|
+
$[28] = t10;
|
|
270
|
+
} else t10 = $[28];
|
|
271
|
+
let t11;
|
|
272
|
+
if ($[29] !== assetType || $[30] !== handleSelectExisting || $[31] !== pickerOpen) {
|
|
273
|
+
t11 = /* @__PURE__ */ jsx(AssetPickerModal, {
|
|
274
|
+
open: pickerOpen,
|
|
275
|
+
onOpenChange: setPickerOpen,
|
|
194
276
|
assetType,
|
|
195
277
|
mode: "single",
|
|
196
278
|
onSelectSingle: handleSelectExisting,
|
|
197
|
-
onSelectMultiple: _temp2
|
|
198
|
-
onClose: () => setPickerOpen(false)
|
|
199
|
-
}) : /* @__PURE__ */ jsxs("div", {
|
|
200
|
-
className: "space-y-4 px-4 py-4",
|
|
201
|
-
children: [hasAsset && /* @__PURE__ */ jsxs("div", {
|
|
202
|
-
className: "text-foreground hover:bg-accent/75 flex max-w-full flex-row items-center gap-2 rounded-lg border-2 px-1 py-1",
|
|
203
|
-
children: [
|
|
204
|
-
/* @__PURE__ */ jsxs("button", {
|
|
205
|
-
type: "button",
|
|
206
|
-
className: "flex min-w-0 flex-1 cursor-zoom-in items-center gap-2 rounded-sm p-1",
|
|
207
|
-
onClick: () => setLightboxOpen(true),
|
|
208
|
-
children: [isImage ? /* @__PURE__ */ jsx("div", {
|
|
209
|
-
className: "border-border h-10 w-10 shrink-0 overflow-hidden rounded border",
|
|
210
|
-
children: /* @__PURE__ */ jsx("img", {
|
|
211
|
-
src: transformImageUrl(asset.url, {
|
|
212
|
-
width: 128,
|
|
213
|
-
mimeType: asset.mimeType,
|
|
214
|
-
size: asset.size
|
|
215
|
-
}),
|
|
216
|
-
alt: asset.alt || asset.filename,
|
|
217
|
-
className: "h-full w-full object-cover"
|
|
218
|
-
})
|
|
219
|
-
}) : /* @__PURE__ */ jsx("div", {
|
|
220
|
-
className: "border-border bg-muted flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden rounded border",
|
|
221
|
-
children: /* @__PURE__ */ jsx(FileIcon, { className: "text-muted-foreground h-5 w-5" })
|
|
222
|
-
}), /* @__PURE__ */ jsx("p", {
|
|
223
|
-
className: "flex-1 truncate text-left text-sm",
|
|
224
|
-
title: asset.filename,
|
|
225
|
-
children: asset.filename || "Untitled"
|
|
226
|
-
})]
|
|
227
|
-
}),
|
|
228
|
-
/* @__PURE__ */ jsx(UnlinkAssetButton, {
|
|
229
|
-
fileId: asset._fileId != null ? Number(asset._fileId) : void 0,
|
|
230
|
-
onUnlink: () => {
|
|
231
|
-
onFieldChange(fieldName, null);
|
|
232
|
-
}
|
|
233
|
-
}),
|
|
234
|
-
asset._fileId && /* @__PURE__ */ jsx(AssetLightbox, {
|
|
235
|
-
open: lightboxOpen,
|
|
236
|
-
onOpenChange: setLightboxOpen,
|
|
237
|
-
fileId: Number(asset._fileId)
|
|
238
|
-
})
|
|
239
|
-
]
|
|
240
|
-
}), /* @__PURE__ */ jsx(AssetActionButtons, {
|
|
241
|
-
isImage,
|
|
242
|
-
multiple: false,
|
|
243
|
-
fileInputRef,
|
|
244
|
-
onPickerOpen: () => setPickerOpen(true),
|
|
245
|
-
onFilesSelected: handleDrop,
|
|
246
|
-
uploads
|
|
247
|
-
})]
|
|
279
|
+
onSelectMultiple: _temp2
|
|
248
280
|
});
|
|
249
|
-
$[
|
|
250
|
-
$[
|
|
251
|
-
$[
|
|
252
|
-
$[
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
$[22] = onFieldChange;
|
|
258
|
-
$[23] = pickerOpen;
|
|
259
|
-
$[24] = uploads;
|
|
260
|
-
$[25] = t7;
|
|
261
|
-
} else t7 = $[25];
|
|
262
|
-
let t8;
|
|
263
|
-
if ($[26] !== handleDrop || $[27] !== t7) {
|
|
264
|
-
t8 = /* @__PURE__ */ jsx(UploadDropZone, {
|
|
281
|
+
$[29] = assetType;
|
|
282
|
+
$[30] = handleSelectExisting;
|
|
283
|
+
$[31] = pickerOpen;
|
|
284
|
+
$[32] = t11;
|
|
285
|
+
} else t11 = $[32];
|
|
286
|
+
let t12;
|
|
287
|
+
if ($[33] !== handleDrop || $[34] !== t10 || $[35] !== t11) {
|
|
288
|
+
t12 = /* @__PURE__ */ jsxs(UploadDropZone, {
|
|
265
289
|
onDrop: handleDrop,
|
|
266
|
-
children:
|
|
290
|
+
children: [t10, t11]
|
|
267
291
|
});
|
|
268
|
-
$[
|
|
269
|
-
$[
|
|
270
|
-
$[
|
|
271
|
-
|
|
272
|
-
|
|
292
|
+
$[33] = handleDrop;
|
|
293
|
+
$[34] = t10;
|
|
294
|
+
$[35] = t11;
|
|
295
|
+
$[36] = t12;
|
|
296
|
+
} else t12 = $[36];
|
|
297
|
+
return t12;
|
|
273
298
|
};
|
|
274
299
|
function _temp(item) {
|
|
275
300
|
return /* @__PURE__ */ jsx(UploadItemRow, { item }, item.id);
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { trackClientEvent } from "../../../lib/telemetry-client.js";
|
|
2
1
|
import { getAuthCookieHeader } from "../../../lib/auth.js";
|
|
3
2
|
import { getApiUrl, getEnvironmentName } from "../../../lib/api-client.js";
|
|
4
3
|
import { fileMutations, fileQueries } from "../../../lib/queries.js";
|
|
4
|
+
import { trackClientEvent } from "../../../lib/telemetry-client.js";
|
|
5
5
|
import { isRasterImage, transformImageUrl } from "../../../core/lib/imageTransform.js";
|
|
6
6
|
import { UploadDropZone } from "../../content/components/UploadDropZone.js";
|
|
7
7
|
import { DebouncedFieldEditor } from "./DebouncedFieldEditor.js";
|
|
8
8
|
import { c } from "react/compiler-runtime";
|
|
9
9
|
import { Label } from "@camox/ui/label";
|
|
10
|
-
import { toast } from "@camox/ui/toaster";
|
|
11
10
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
12
11
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
13
12
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { toast } from "@camox/ui/toaster";
|
|
14
14
|
import { Button } from "@camox/ui/button";
|
|
15
|
+
import { Check, Download, FileIcon, Info, Link, Loader2, Trash2, X } from "lucide-react";
|
|
16
|
+
import { Dialog, DialogContent, DialogTitle } from "@camox/ui/dialog";
|
|
15
17
|
import { ButtonGroup } from "@camox/ui/button-group";
|
|
16
18
|
import { Switch } from "@camox/ui/switch";
|
|
17
19
|
import { Tooltip, TooltipContent, TooltipTrigger } from "@camox/ui/tooltip";
|
|
18
|
-
import { Check, Download, FileIcon, Info, Link, Loader2, Trash2, X } from "lucide-react";
|
|
19
|
-
import { Dialog, DialogContent, DialogTitle } from "@camox/ui/dialog";
|
|
20
20
|
|
|
21
21
|
//#region src/features/preview/components/AssetLightbox.tsx
|
|
22
22
|
function MetadataRow(t0) {
|