camox 0.41.0 → 0.42.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/components/lexical/SidebarLexicalEditor.js +42 -39
- package/dist/core/createApp.d.ts +16 -2
- package/dist/core/createBlock.js +11 -25
- package/dist/core/editing/BlockEditingRuntime.js +4 -4
- package/dist/core/editing/CompleteBlockEditingRuntime.js +5 -5
- package/dist/core/editing/createEditableBlock.d.ts +8 -1
- package/dist/core/editing/createEditableBlock.js +684 -644
- package/dist/core/hooks/useIsEditable.js +4 -7
- package/dist/core/hooks/useOverlayState.js +11 -0
- package/dist/core/hooks/useRequireDraftSource.js +7 -11
- package/dist/core/lib/fieldTypes.js +5 -5
- package/dist/core/lib/lexicalState.js +17 -1
- package/dist/features/preview/CamoxPreview.js +123 -137
- package/dist/features/preview/DerivedPreview.js +6 -9
- package/dist/features/preview/commentsEnabled.js +8 -0
- package/dist/features/preview/components/AddBlockSidebar.js +79 -89
- package/dist/features/preview/components/AssetLightbox.js +4 -11
- package/dist/features/preview/components/AttachedComments.js +194 -0
- package/dist/features/preview/components/BlockActionsPopover.js +19 -70
- package/dist/features/preview/components/CommentHeader.js +122 -0
- package/dist/features/preview/components/CommentSidebar.js +29 -0
- package/dist/features/preview/components/CommentTargetQuote.js +166 -0
- package/dist/features/preview/components/CreatePageModal.js +2 -8
- package/dist/features/preview/components/DerivedLayoutSidebar.js +4 -7
- package/dist/features/preview/components/ItemFieldsEditor.js +275 -204
- package/dist/features/preview/components/LeftSidebar.js +18 -18
- package/dist/features/preview/components/LinkFieldEditor.js +3 -4
- package/dist/features/preview/components/MobilePreviewDrawer.js +3 -3
- package/dist/features/preview/components/OverlayTracker.js +14 -20
- package/dist/features/preview/components/Overlays.js +28 -40
- package/dist/features/preview/components/PageEditorSidebar.js +231 -241
- package/dist/features/preview/components/PageInfoSidebar.js +126 -157
- package/dist/features/preview/components/PagePicker.js +13 -8
- package/dist/features/preview/components/PageTree.js +255 -319
- package/dist/features/preview/components/PreviewComments.js +56 -0
- package/dist/features/preview/components/PreviewPanel.js +149 -107
- package/dist/features/preview/components/PreviewToolbar.js +292 -246
- package/dist/features/preview/components/PreviewToolbarSpacer.js +43 -0
- package/dist/features/preview/components/PublicationRow.js +11 -24
- package/dist/features/preview/components/RightSidebar.js +14 -11
- package/dist/features/preview/components/SidebarSection.js +121 -0
- package/dist/features/preview/previewCommentsStore.js +115 -0
- package/dist/features/preview/previewSelection.js +75 -0
- package/dist/features/preview/previewStore.js +32 -63
- package/dist/features/provider/AuthenticatedCamoxProvider.js +46 -34
- package/dist/features/provider/components/CommandPalette.js +142 -58
- package/dist/features/provider/useAdminShortcuts.js +20 -8
- package/dist/features/routes/pageRuntime.js +0 -6
- package/dist/features/runtime/RuntimeChrome.js +102 -87
- package/dist/features/studio/CamoxStudio.js +30 -50
- package/dist/features/studio/components/UserButton.js +4 -4
- package/dist/features/vite/runtimeDev.js +4 -1
- package/dist/features/vite/vite.d.ts +3 -2
- package/dist/features/vite/vite.js +9 -5
- package/dist/hooks/use-file-upload.js +0 -2
- package/dist/studio.css +1 -1
- package/package.json +5 -7
- package/dist/features/preview/components/DraftSwitchDialog.js +0 -66
- package/dist/lib/telemetry-client.js +0 -66
- package/dist/lib/telemetry.js +0 -26
|
@@ -3,7 +3,6 @@ import { usePageBlocks } from "../../../lib/normalized-data.js";
|
|
|
3
3
|
import { blockMutations, repeatableItemMutations } from "../../../lib/queries.js";
|
|
4
4
|
import { formatShortcut } from "../../../lib/utils.js";
|
|
5
5
|
import { useCamoxApp } from "../../provider/components/CamoxAppContext.js";
|
|
6
|
-
import { trackClientEvent } from "../../../lib/telemetry-client.js";
|
|
7
6
|
import { previewStore, selectionItemId } from "../previewStore.js";
|
|
8
7
|
import { useRequireDraftSource } from "../../../core/hooks/useRequireDraftSource.js";
|
|
9
8
|
import { useUpdateBlockPosition } from "./useUpdateBlockPosition.js";
|
|
@@ -13,7 +12,7 @@ import { useMutation } from "@tanstack/react-query";
|
|
|
13
12
|
import * as React from "react";
|
|
14
13
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
15
14
|
import { useSelector } from "@xstate/store-react";
|
|
16
|
-
import { Copy,
|
|
15
|
+
import { Copy, Trash2 } from "lucide-react";
|
|
17
16
|
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@camox/ui/alert-dialog";
|
|
18
17
|
import { Popover, PopoverContent, PopoverTrigger } from "@camox/ui/popover";
|
|
19
18
|
import { toast } from "@camox/ui/toaster";
|
|
@@ -22,7 +21,6 @@ import { Command, CommandGroup, CommandInput, CommandItem, CommandList, CommandS
|
|
|
22
21
|
//#region src/features/preview/components/BlockActionsPopover.tsx
|
|
23
22
|
const BlockActionsPopover = ({ block, children, open, onOpenChange, align = "start", isLayoutBlock, layoutPlacement }) => {
|
|
24
23
|
const [blockToDelete, setBlockToDelete] = React.useState(null);
|
|
25
|
-
const camoxApp = useCamoxApp();
|
|
26
24
|
const page = usePreviewedPage();
|
|
27
25
|
const { pageBlocks } = usePageBlocks(page);
|
|
28
26
|
const deleteBlock = useMutation(blockMutations.delete());
|
|
@@ -31,10 +29,6 @@ const BlockActionsPopover = ({ block, children, open, onOpenChange, align = "sta
|
|
|
31
29
|
const handleDeleteBlock = async (block_0) => {
|
|
32
30
|
try {
|
|
33
31
|
await deleteBlock.mutateAsync({ id: block_0.id });
|
|
34
|
-
trackClientEvent("block_deleted", {
|
|
35
|
-
projectId: page?.page.projectId,
|
|
36
|
-
blockType: block_0.type
|
|
37
|
-
});
|
|
38
32
|
toast.success(`Deleted "${block_0.summary || block_0.type}" block`);
|
|
39
33
|
} catch (error) {
|
|
40
34
|
console.error("Failed to delete block:", error);
|
|
@@ -46,10 +40,6 @@ const BlockActionsPopover = ({ block, children, open, onOpenChange, align = "sta
|
|
|
46
40
|
const handleDuplicateBlock = async (block_1) => {
|
|
47
41
|
try {
|
|
48
42
|
await duplicateBlock.mutateAsync({ id: block_1.id });
|
|
49
|
-
trackClientEvent("block_duplicated", {
|
|
50
|
-
projectId: page?.page.projectId,
|
|
51
|
-
blockType: block_1.type
|
|
52
|
-
});
|
|
53
43
|
toast.success(`Duplicated "${block_1.summary}" block`);
|
|
54
44
|
} catch (error_0) {
|
|
55
45
|
console.error("Failed to duplicate block:", error_0);
|
|
@@ -62,15 +52,13 @@ const BlockActionsPopover = ({ block, children, open, onOpenChange, align = "sta
|
|
|
62
52
|
const afterPosition = blockIndex > 0 ? pageBlocks[blockIndex - 1].position : "";
|
|
63
53
|
previewStore.send({
|
|
64
54
|
type: "openAddBlockSidebar",
|
|
65
|
-
afterPosition
|
|
66
|
-
via: "popover-above"
|
|
55
|
+
afterPosition
|
|
67
56
|
});
|
|
68
57
|
};
|
|
69
58
|
const handleAddBlockBelow = (block_3) => {
|
|
70
59
|
previewStore.send({
|
|
71
60
|
type: "openAddBlockSidebar",
|
|
72
|
-
afterPosition: block_3.position
|
|
73
|
-
via: "popover-below"
|
|
61
|
+
afterPosition: block_3.position
|
|
74
62
|
});
|
|
75
63
|
};
|
|
76
64
|
const getBlocksAbove = (block_4) => {
|
|
@@ -114,46 +102,11 @@ const BlockActionsPopover = ({ block, children, open, onOpenChange, align = "sta
|
|
|
114
102
|
children: /* @__PURE__ */ jsxs(Command, { children: [/* @__PURE__ */ jsx(CommandInput, { placeholder: "Search actions..." }), /* @__PURE__ */ jsxs(CommandList, {
|
|
115
103
|
className: "max-h-[350px]",
|
|
116
104
|
children: [
|
|
117
|
-
/* @__PURE__ */
|
|
118
|
-
className: "justify-between",
|
|
119
|
-
onSelect: () => {
|
|
120
|
-
previewStore.send({
|
|
121
|
-
type: "openBlockContentSheet",
|
|
122
|
-
blockId: block.id
|
|
123
|
-
});
|
|
124
|
-
onOpenChange(false);
|
|
125
|
-
},
|
|
126
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
127
|
-
className: "flex items-center gap-2",
|
|
128
|
-
children: [/* @__PURE__ */ jsx(Pen, { className: "h-4 w-4" }), "Edit in form"]
|
|
129
|
-
}), /* @__PURE__ */ jsx(CommandShortcut, { children: formatShortcut({
|
|
130
|
-
key: "j",
|
|
131
|
-
withMeta: true
|
|
132
|
-
}) })]
|
|
133
|
-
}), !isLayoutBlock && (() => {
|
|
134
|
-
const blockDef = camoxApp.getBlockById(block.type);
|
|
135
|
-
if (!(blockDef?._internal.settingsSchema?.properties && Object.keys(blockDef._internal.settingsSchema.properties).length > 0)) return null;
|
|
136
|
-
return /* @__PURE__ */ jsx(CommandItem, {
|
|
137
|
-
className: "justify-between",
|
|
138
|
-
onSelect: () => {
|
|
139
|
-
previewStore.send({
|
|
140
|
-
type: "openBlockContentSheet",
|
|
141
|
-
blockId: block.id
|
|
142
|
-
});
|
|
143
|
-
onOpenChange(false);
|
|
144
|
-
},
|
|
145
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
146
|
-
className: "flex items-center gap-2",
|
|
147
|
-
children: [/* @__PURE__ */ jsx(Settings, { className: "h-4 w-4" }), "Open settings"]
|
|
148
|
-
})
|
|
149
|
-
});
|
|
150
|
-
})()] }),
|
|
151
|
-
isLayoutBlock && layoutPlacement === "before" && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(CommandSeparator, {}), /* @__PURE__ */ jsx(CommandGroup, { children: /* @__PURE__ */ jsx(CommandItem, {
|
|
105
|
+
isLayoutBlock && layoutPlacement === "before" && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(CommandGroup, { children: /* @__PURE__ */ jsx(CommandItem, {
|
|
152
106
|
onSelect: () => {
|
|
153
107
|
previewStore.send({
|
|
154
108
|
type: "openAddBlockSidebar",
|
|
155
|
-
afterPosition: ""
|
|
156
|
-
via: "layout-popover-below"
|
|
109
|
+
afterPosition: ""
|
|
157
110
|
});
|
|
158
111
|
onOpenChange(false);
|
|
159
112
|
},
|
|
@@ -161,14 +114,13 @@ const BlockActionsPopover = ({ block, children, open, onOpenChange, align = "sta
|
|
|
161
114
|
className: "flex items-center gap-2",
|
|
162
115
|
children: [/* @__PURE__ */ jsx("span", { className: "w-4" }), "Add block below"]
|
|
163
116
|
})
|
|
164
|
-
}) })
|
|
165
|
-
isLayoutBlock && layoutPlacement === "after" && /* @__PURE__ */
|
|
117
|
+
}) }) }),
|
|
118
|
+
isLayoutBlock && layoutPlacement === "after" && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(CommandGroup, { children: /* @__PURE__ */ jsx(CommandItem, {
|
|
166
119
|
onSelect: () => {
|
|
167
120
|
const lastPageBlock = pageBlocks[pageBlocks.length - 1];
|
|
168
121
|
previewStore.send({
|
|
169
122
|
type: "openAddBlockSidebar",
|
|
170
|
-
afterPosition: lastPageBlock?.position
|
|
171
|
-
via: "layout-popover-above"
|
|
123
|
+
afterPosition: lastPageBlock?.position
|
|
172
124
|
});
|
|
173
125
|
onOpenChange(false);
|
|
174
126
|
},
|
|
@@ -176,9 +128,8 @@ const BlockActionsPopover = ({ block, children, open, onOpenChange, align = "sta
|
|
|
176
128
|
className: "flex items-center gap-2",
|
|
177
129
|
children: [/* @__PURE__ */ jsx("span", { className: "w-4" }), "Add block above"]
|
|
178
130
|
})
|
|
179
|
-
}) })
|
|
131
|
+
}) }) }),
|
|
180
132
|
!isLayoutBlock && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
181
|
-
/* @__PURE__ */ jsx(CommandSeparator, {}),
|
|
182
133
|
/* @__PURE__ */ jsxs(CommandGroup, { children: [/* @__PURE__ */ jsxs(CommandItem, {
|
|
183
134
|
className: "justify-between",
|
|
184
135
|
onSelect: () => {
|
|
@@ -279,9 +230,9 @@ function isLayoutBlockId(page, blockId) {
|
|
|
279
230
|
}
|
|
280
231
|
function useBlockActionsShortcuts() {
|
|
281
232
|
const $ = c(20);
|
|
282
|
-
if ($[0] !== "
|
|
233
|
+
if ($[0] !== "a91fc105ded90c35296c42adc5eec1823e26e305818bf9026d22b67a24a3ca04") {
|
|
283
234
|
for (let $i = 0; $i < 20; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
284
|
-
$[0] = "
|
|
235
|
+
$[0] = "a91fc105ded90c35296c42adc5eec1823e26e305818bf9026d22b67a24a3ca04";
|
|
285
236
|
}
|
|
286
237
|
const camoxApp = useCamoxApp();
|
|
287
238
|
const page = usePreviewedPage();
|
|
@@ -327,7 +278,7 @@ function useBlockActionsShortcuts() {
|
|
|
327
278
|
},
|
|
328
279
|
checkIfAvailable: () => {
|
|
329
280
|
const ctx = previewStore.getSnapshot().context;
|
|
330
|
-
if (
|
|
281
|
+
if (ctx.mode !== "editing-draft") return false;
|
|
331
282
|
const sel = ctx.selection;
|
|
332
283
|
if (!sel) return false;
|
|
333
284
|
if (isLayoutBlockId(page, sel.blockId)) return false;
|
|
@@ -369,7 +320,7 @@ function useBlockActionsShortcuts() {
|
|
|
369
320
|
},
|
|
370
321
|
checkIfAvailable: () => {
|
|
371
322
|
const ctx_0 = previewStore.getSnapshot().context;
|
|
372
|
-
if (
|
|
323
|
+
if (ctx_0.mode !== "editing-draft") return false;
|
|
373
324
|
const sel_1 = ctx_0.selection;
|
|
374
325
|
if (!sel_1) return false;
|
|
375
326
|
if (isLayoutBlockId(page, sel_1.blockId)) return false;
|
|
@@ -398,7 +349,7 @@ function useBlockActionsShortcuts() {
|
|
|
398
349
|
},
|
|
399
350
|
checkIfAvailable: () => {
|
|
400
351
|
const ctx_1 = previewStore.getSnapshot().context;
|
|
401
|
-
if (
|
|
352
|
+
if (ctx_1.mode !== "editing-draft") return false;
|
|
402
353
|
const sel_3 = ctx_1.selection;
|
|
403
354
|
if (!sel_3 || !page) return false;
|
|
404
355
|
if (isLayoutBlockId(page, sel_3.blockId)) return false;
|
|
@@ -429,7 +380,7 @@ function useBlockActionsShortcuts() {
|
|
|
429
380
|
},
|
|
430
381
|
checkIfAvailable: () => {
|
|
431
382
|
const ctx_2 = previewStore.getSnapshot().context;
|
|
432
|
-
if (
|
|
383
|
+
if (ctx_2.mode !== "editing-draft") return false;
|
|
433
384
|
const sel_5 = ctx_2.selection;
|
|
434
385
|
if (!sel_5 || !page) return false;
|
|
435
386
|
if (isLayoutBlockId(page, sel_5.blockId)) return false;
|
|
@@ -465,8 +416,7 @@ function useBlockActionsShortcuts() {
|
|
|
465
416
|
if (!block_2) return;
|
|
466
417
|
previewStore.send({
|
|
467
418
|
type: "openAddBlockSidebar",
|
|
468
|
-
afterPosition: block_2.position
|
|
469
|
-
via: "shortcut-below"
|
|
419
|
+
afterPosition: block_2.position
|
|
470
420
|
});
|
|
471
421
|
}
|
|
472
422
|
},
|
|
@@ -488,8 +438,7 @@ function useBlockActionsShortcuts() {
|
|
|
488
438
|
const afterPosition_1 = blockIndex > 0 ? pageBlocks[blockIndex - 1].position : "";
|
|
489
439
|
previewStore.send({
|
|
490
440
|
type: "openAddBlockSidebar",
|
|
491
|
-
afterPosition: afterPosition_1
|
|
492
|
-
via: "shortcut-above"
|
|
441
|
+
afterPosition: afterPosition_1
|
|
493
442
|
});
|
|
494
443
|
}
|
|
495
444
|
}
|
|
@@ -538,12 +487,12 @@ function _temp12(a) {
|
|
|
538
487
|
}
|
|
539
488
|
function _temp11() {
|
|
540
489
|
const ctx_4 = previewStore.getSnapshot().context;
|
|
541
|
-
if (
|
|
490
|
+
if (ctx_4.mode !== "editing-draft") return false;
|
|
542
491
|
return ctx_4.selection !== null;
|
|
543
492
|
}
|
|
544
493
|
function _temp10() {
|
|
545
494
|
const ctx_3 = previewStore.getSnapshot().context;
|
|
546
|
-
if (
|
|
495
|
+
if (ctx_3.mode !== "editing-draft") return false;
|
|
547
496
|
return ctx_3.selection !== null;
|
|
548
497
|
}
|
|
549
498
|
function _temp1() {
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { c } from "react/compiler-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { Avatar, AvatarFallback, AvatarImage } from "@camox/ui/avatar";
|
|
5
|
+
|
|
6
|
+
//#region src/features/preview/components/CommentHeader.tsx
|
|
7
|
+
function CommentHeader(t0) {
|
|
8
|
+
const $ = c(27);
|
|
9
|
+
if ($[0] !== "7228323105605d4be0594558d7e4fb389f5d49bc9cb13e6a90c0c2fc6f9ff60f") {
|
|
10
|
+
for (let $i = 0; $i < 27; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
11
|
+
$[0] = "7228323105605d4be0594558d7e4fb389f5d49bc9cb13e6a90c0c2fc6f9ff60f";
|
|
12
|
+
}
|
|
13
|
+
const { author, createdAt } = t0;
|
|
14
|
+
const [now, setNow] = React.useState(Date.now);
|
|
15
|
+
let t1;
|
|
16
|
+
let t2;
|
|
17
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
18
|
+
t1 = () => {
|
|
19
|
+
const timer = window.setInterval(() => setNow(Date.now()), 6e4);
|
|
20
|
+
return () => window.clearInterval(timer);
|
|
21
|
+
};
|
|
22
|
+
t2 = [];
|
|
23
|
+
$[1] = t1;
|
|
24
|
+
$[2] = t2;
|
|
25
|
+
} else {
|
|
26
|
+
t1 = $[1];
|
|
27
|
+
t2 = $[2];
|
|
28
|
+
}
|
|
29
|
+
React.useEffect(t1, t2);
|
|
30
|
+
const minutes = Math.max(0, Math.floor((now - createdAt) / 6e4));
|
|
31
|
+
const age = minutes < 1 ? "now" : minutes < 60 ? `${minutes}m` : minutes < 1440 ? `${Math.floor(minutes / 60)}h` : `${Math.floor(minutes / 1440)}d`;
|
|
32
|
+
let t3;
|
|
33
|
+
if ($[3] !== author.name) {
|
|
34
|
+
t3 = author.name.trim().split(/\s+/).map(_temp).join("").slice(0, 2).toUpperCase();
|
|
35
|
+
$[3] = author.name;
|
|
36
|
+
$[4] = t3;
|
|
37
|
+
} else t3 = $[4];
|
|
38
|
+
const initials = t3;
|
|
39
|
+
let t4;
|
|
40
|
+
if ($[5] !== author.image || $[6] !== author.name) {
|
|
41
|
+
t4 = author.image && /* @__PURE__ */ jsx(AvatarImage, {
|
|
42
|
+
src: author.image,
|
|
43
|
+
alt: author.name
|
|
44
|
+
});
|
|
45
|
+
$[5] = author.image;
|
|
46
|
+
$[6] = author.name;
|
|
47
|
+
$[7] = t4;
|
|
48
|
+
} else t4 = $[7];
|
|
49
|
+
let t5;
|
|
50
|
+
if ($[8] !== initials) {
|
|
51
|
+
t5 = /* @__PURE__ */ jsx(AvatarFallback, { children: initials });
|
|
52
|
+
$[8] = initials;
|
|
53
|
+
$[9] = t5;
|
|
54
|
+
} else t5 = $[9];
|
|
55
|
+
let t6;
|
|
56
|
+
if ($[10] !== t4 || $[11] !== t5) {
|
|
57
|
+
t6 = /* @__PURE__ */ jsxs(Avatar, {
|
|
58
|
+
size: "sm",
|
|
59
|
+
children: [t4, t5]
|
|
60
|
+
});
|
|
61
|
+
$[10] = t4;
|
|
62
|
+
$[11] = t5;
|
|
63
|
+
$[12] = t6;
|
|
64
|
+
} else t6 = $[12];
|
|
65
|
+
let t7;
|
|
66
|
+
if ($[13] !== author.name) {
|
|
67
|
+
t7 = /* @__PURE__ */ jsx("span", {
|
|
68
|
+
className: "truncate text-sm font-medium",
|
|
69
|
+
title: author.name,
|
|
70
|
+
children: author.name
|
|
71
|
+
});
|
|
72
|
+
$[13] = author.name;
|
|
73
|
+
$[14] = t7;
|
|
74
|
+
} else t7 = $[14];
|
|
75
|
+
let t8;
|
|
76
|
+
if ($[15] !== createdAt) {
|
|
77
|
+
t8 = new Date(createdAt).toISOString();
|
|
78
|
+
$[15] = createdAt;
|
|
79
|
+
$[16] = t8;
|
|
80
|
+
} else t8 = $[16];
|
|
81
|
+
let t9;
|
|
82
|
+
if ($[17] !== createdAt) {
|
|
83
|
+
t9 = new Date(createdAt).toLocaleString();
|
|
84
|
+
$[17] = createdAt;
|
|
85
|
+
$[18] = t9;
|
|
86
|
+
} else t9 = $[18];
|
|
87
|
+
let t10;
|
|
88
|
+
if ($[19] !== age || $[20] !== t8 || $[21] !== t9) {
|
|
89
|
+
t10 = /* @__PURE__ */ jsx("time", {
|
|
90
|
+
className: "text-muted-foreground shrink-0 text-xs",
|
|
91
|
+
dateTime: t8,
|
|
92
|
+
title: t9,
|
|
93
|
+
children: age
|
|
94
|
+
});
|
|
95
|
+
$[19] = age;
|
|
96
|
+
$[20] = t8;
|
|
97
|
+
$[21] = t9;
|
|
98
|
+
$[22] = t10;
|
|
99
|
+
} else t10 = $[22];
|
|
100
|
+
let t11;
|
|
101
|
+
if ($[23] !== t10 || $[24] !== t6 || $[25] !== t7) {
|
|
102
|
+
t11 = /* @__PURE__ */ jsxs("header", {
|
|
103
|
+
className: "mb-2 flex min-w-0 items-center gap-2",
|
|
104
|
+
children: [
|
|
105
|
+
t6,
|
|
106
|
+
t7,
|
|
107
|
+
t10
|
|
108
|
+
]
|
|
109
|
+
});
|
|
110
|
+
$[23] = t10;
|
|
111
|
+
$[24] = t6;
|
|
112
|
+
$[25] = t7;
|
|
113
|
+
$[26] = t11;
|
|
114
|
+
} else t11 = $[26];
|
|
115
|
+
return t11;
|
|
116
|
+
}
|
|
117
|
+
function _temp(part) {
|
|
118
|
+
return part[0];
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
//#endregion
|
|
122
|
+
export { CommentHeader };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AttachedComments } from "./AttachedComments.js";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/features/preview/components/CommentSidebar.tsx
|
|
6
|
+
function CommentSidebar(t0) {
|
|
7
|
+
const $ = c(3);
|
|
8
|
+
if ($[0] !== "d6df60b689386423d40951e6785b3daf7545c90c2ab947b318a4d6c91e5fdf67") {
|
|
9
|
+
for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
10
|
+
$[0] = "d6df60b689386423d40951e6785b3daf7545c90c2ab947b318a4d6c91e5fdf67";
|
|
11
|
+
}
|
|
12
|
+
const { pageId } = t0;
|
|
13
|
+
let t1;
|
|
14
|
+
if ($[1] !== pageId) {
|
|
15
|
+
t1 = /* @__PURE__ */ jsx("div", {
|
|
16
|
+
className: "min-h-0 flex-1 overflow-auto",
|
|
17
|
+
children: /* @__PURE__ */ jsx(AttachedComments, {
|
|
18
|
+
pageId,
|
|
19
|
+
allPageComments: true
|
|
20
|
+
})
|
|
21
|
+
});
|
|
22
|
+
$[1] = pageId;
|
|
23
|
+
$[2] = t1;
|
|
24
|
+
} else t1 = $[2];
|
|
25
|
+
return t1;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
export { CommentSidebar };
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { isLexicalState, lexicalStateToPlainText } from "../../../core/lib/lexicalState.js";
|
|
2
|
+
import { blockQueries, pageQueries } from "../../../lib/queries.js";
|
|
3
|
+
import { c } from "react/compiler-runtime";
|
|
4
|
+
import { useQuery } from "@tanstack/react-query";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/features/preview/components/CommentTargetQuote.tsx
|
|
8
|
+
function Quote(t0) {
|
|
9
|
+
const $ = c(3);
|
|
10
|
+
if ($[0] !== "c7d7da293bb0be577af3f96a804786ef95d893a2ac7e10598c27ec5225cf9e92") {
|
|
11
|
+
for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
12
|
+
$[0] = "c7d7da293bb0be577af3f96a804786ef95d893a2ac7e10598c27ec5225cf9e92";
|
|
13
|
+
}
|
|
14
|
+
const { children } = t0;
|
|
15
|
+
let t1;
|
|
16
|
+
if ($[1] !== children) {
|
|
17
|
+
t1 = /* @__PURE__ */ jsx("blockquote", {
|
|
18
|
+
className: "text-muted-foreground my-2 border-l-2 border-yellow-600 pl-2 text-sm wrap-break-word whitespace-pre-wrap",
|
|
19
|
+
children
|
|
20
|
+
});
|
|
21
|
+
$[1] = children;
|
|
22
|
+
$[2] = t1;
|
|
23
|
+
} else t1 = $[2];
|
|
24
|
+
return t1;
|
|
25
|
+
}
|
|
26
|
+
function PageQuote(t0) {
|
|
27
|
+
const $ = c(5);
|
|
28
|
+
if ($[0] !== "c7d7da293bb0be577af3f96a804786ef95d893a2ac7e10598c27ec5225cf9e92") {
|
|
29
|
+
for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
30
|
+
$[0] = "c7d7da293bb0be577af3f96a804786ef95d893a2ac7e10598c27ec5225cf9e92";
|
|
31
|
+
}
|
|
32
|
+
const { pageId } = t0;
|
|
33
|
+
let t1;
|
|
34
|
+
if ($[1] !== pageId) {
|
|
35
|
+
t1 = pageQueries.getById(pageId);
|
|
36
|
+
$[1] = pageId;
|
|
37
|
+
$[2] = t1;
|
|
38
|
+
} else t1 = $[2];
|
|
39
|
+
const { data: page, isPending } = useQuery(t1);
|
|
40
|
+
const t2 = page?.nickname || (isPending ? "Loading…" : "Page unavailable");
|
|
41
|
+
let t3;
|
|
42
|
+
if ($[3] !== t2) {
|
|
43
|
+
t3 = /* @__PURE__ */ jsx(Quote, { children: t2 });
|
|
44
|
+
$[3] = t2;
|
|
45
|
+
$[4] = t3;
|
|
46
|
+
} else t3 = $[4];
|
|
47
|
+
return t3;
|
|
48
|
+
}
|
|
49
|
+
function BlockQuote(t0) {
|
|
50
|
+
const $ = c(19);
|
|
51
|
+
if ($[0] !== "c7d7da293bb0be577af3f96a804786ef95d893a2ac7e10598c27ec5225cf9e92") {
|
|
52
|
+
for (let $i = 0; $i < 19; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
53
|
+
$[0] = "c7d7da293bb0be577af3f96a804786ef95d893a2ac7e10598c27ec5225cf9e92";
|
|
54
|
+
}
|
|
55
|
+
const { target } = t0;
|
|
56
|
+
let t1;
|
|
57
|
+
if ($[1] !== target.blockId) {
|
|
58
|
+
t1 = blockQueries.get(target.blockId);
|
|
59
|
+
$[1] = target.blockId;
|
|
60
|
+
$[2] = t1;
|
|
61
|
+
} else t1 = $[2];
|
|
62
|
+
const { data: bundle, isPending } = useQuery(t1);
|
|
63
|
+
if (!bundle) {
|
|
64
|
+
const t2 = isPending ? "Loading…" : "Content unavailable";
|
|
65
|
+
let t3;
|
|
66
|
+
if ($[3] !== t2) {
|
|
67
|
+
t3 = /* @__PURE__ */ jsx(Quote, { children: t2 });
|
|
68
|
+
$[3] = t2;
|
|
69
|
+
$[4] = t3;
|
|
70
|
+
} else t3 = $[4];
|
|
71
|
+
return t3;
|
|
72
|
+
}
|
|
73
|
+
let t2;
|
|
74
|
+
if ($[5] !== bundle.block || $[6] !== bundle.repeatableItems || $[7] !== target.itemId) {
|
|
75
|
+
t2 = target.itemId == null ? bundle.block : bundle.repeatableItems.find((item) => item.id === target.itemId);
|
|
76
|
+
$[5] = bundle.block;
|
|
77
|
+
$[6] = bundle.repeatableItems;
|
|
78
|
+
$[7] = target.itemId;
|
|
79
|
+
$[8] = t2;
|
|
80
|
+
} else t2 = $[8];
|
|
81
|
+
const subject = t2;
|
|
82
|
+
if (!subject) {
|
|
83
|
+
let t3;
|
|
84
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
85
|
+
t3 = /* @__PURE__ */ jsx(Quote, { children: "Content unavailable" });
|
|
86
|
+
$[9] = t3;
|
|
87
|
+
} else t3 = $[9];
|
|
88
|
+
return t3;
|
|
89
|
+
}
|
|
90
|
+
if (target.fieldName != null) {
|
|
91
|
+
const value = subject.content[target.fieldName];
|
|
92
|
+
if (target.fieldType === "String" || target.fieldType == null) {
|
|
93
|
+
if (typeof value === "string" || isLexicalState(value)) {
|
|
94
|
+
let t3;
|
|
95
|
+
if ($[10] !== value) {
|
|
96
|
+
t3 = lexicalStateToPlainText(value) || "Empty text";
|
|
97
|
+
$[10] = value;
|
|
98
|
+
$[11] = t3;
|
|
99
|
+
} else t3 = $[11];
|
|
100
|
+
let t4;
|
|
101
|
+
if ($[12] !== t3) {
|
|
102
|
+
t4 = /* @__PURE__ */ jsx(Quote, { children: t3 });
|
|
103
|
+
$[12] = t3;
|
|
104
|
+
$[13] = t4;
|
|
105
|
+
} else t4 = $[13];
|
|
106
|
+
return t4;
|
|
107
|
+
}
|
|
108
|
+
if (value == null && target.fieldType === "String") {
|
|
109
|
+
let t3;
|
|
110
|
+
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
|
111
|
+
t3 = /* @__PURE__ */ jsx(Quote, { children: "Empty text" });
|
|
112
|
+
$[14] = t3;
|
|
113
|
+
} else t3 = $[14];
|
|
114
|
+
return t3;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (target.fieldType === "Link" && value && typeof value === "object" && "text" in value && typeof value.text === "string") {
|
|
118
|
+
const t3 = value.text || "Empty link text";
|
|
119
|
+
let t4;
|
|
120
|
+
if ($[15] !== t3) {
|
|
121
|
+
t4 = /* @__PURE__ */ jsx(Quote, { children: t3 });
|
|
122
|
+
$[15] = t3;
|
|
123
|
+
$[16] = t4;
|
|
124
|
+
} else t4 = $[16];
|
|
125
|
+
return t4;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
const t3 = subject.summary || (target.itemId == null ? "Untitled block" : "Untitled item");
|
|
129
|
+
let t4;
|
|
130
|
+
if ($[17] !== t3) {
|
|
131
|
+
t4 = /* @__PURE__ */ jsx(Quote, { children: t3 });
|
|
132
|
+
$[17] = t3;
|
|
133
|
+
$[18] = t4;
|
|
134
|
+
} else t4 = $[18];
|
|
135
|
+
return t4;
|
|
136
|
+
}
|
|
137
|
+
function CommentTargetQuote(t0) {
|
|
138
|
+
const $ = c(5);
|
|
139
|
+
if ($[0] !== "c7d7da293bb0be577af3f96a804786ef95d893a2ac7e10598c27ec5225cf9e92") {
|
|
140
|
+
for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
141
|
+
$[0] = "c7d7da293bb0be577af3f96a804786ef95d893a2ac7e10598c27ec5225cf9e92";
|
|
142
|
+
}
|
|
143
|
+
const { pageId, target } = t0;
|
|
144
|
+
if (target.blockId == null) {
|
|
145
|
+
let t1;
|
|
146
|
+
if ($[1] !== pageId) {
|
|
147
|
+
t1 = /* @__PURE__ */ jsx(PageQuote, { pageId });
|
|
148
|
+
$[1] = pageId;
|
|
149
|
+
$[2] = t1;
|
|
150
|
+
} else t1 = $[2];
|
|
151
|
+
return t1;
|
|
152
|
+
}
|
|
153
|
+
let t1;
|
|
154
|
+
if ($[3] !== target) {
|
|
155
|
+
t1 = /* @__PURE__ */ jsx(BlockQuote, { target: {
|
|
156
|
+
...target,
|
|
157
|
+
blockId: target.blockId
|
|
158
|
+
} });
|
|
159
|
+
$[3] = target;
|
|
160
|
+
$[4] = t1;
|
|
161
|
+
} else t1 = $[4];
|
|
162
|
+
return t1;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
//#endregion
|
|
166
|
+
export { CommentTargetQuote };
|
|
@@ -2,7 +2,6 @@ import { useNavigate } from "../../navigation/navigation.js";
|
|
|
2
2
|
import { useProjectSlug } from "../../../lib/auth.js";
|
|
3
3
|
import { layoutQueries, pageMutations, pageQueries, projectQueries } from "../../../lib/queries.js";
|
|
4
4
|
import { useCamoxApp } from "../../provider/components/CamoxAppContext.js";
|
|
5
|
-
import { trackClientEvent } from "../../../lib/telemetry-client.js";
|
|
6
5
|
import { previewStore } from "../previewStore.js";
|
|
7
6
|
import { PageLocationFieldset } from "./PageLocationFieldset.js";
|
|
8
7
|
import { PageNicknameField } from "./PageNicknameField.js";
|
|
@@ -27,9 +26,9 @@ const slugifyPathSegment = (nickname) => {
|
|
|
27
26
|
};
|
|
28
27
|
const CreatePageModal = () => {
|
|
29
28
|
const $ = c(59);
|
|
30
|
-
if ($[0] !== "
|
|
29
|
+
if ($[0] !== "ca72d8f393684234f7d5819b751bb6885d41445b1c76ee71638b787efcf67eb9") {
|
|
31
30
|
for (let $i = 0; $i < 59; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
32
|
-
$[0] = "
|
|
31
|
+
$[0] = "ca72d8f393684234f7d5819b751bb6885d41445b1c76ee71638b787efcf67eb9";
|
|
33
32
|
}
|
|
34
33
|
const projectSlug = useProjectSlug();
|
|
35
34
|
const open = useSelector(previewStore, _temp);
|
|
@@ -128,11 +127,6 @@ const CreatePageModal = () => {
|
|
|
128
127
|
error: "Failed to create page"
|
|
129
128
|
});
|
|
130
129
|
const { fullPath } = await createPagePromise;
|
|
131
|
-
trackClientEvent("page_created", {
|
|
132
|
-
projectId: project.id,
|
|
133
|
-
pathSegment: values.value.pathSegment,
|
|
134
|
-
layoutId: values.value.layoutId
|
|
135
|
-
});
|
|
136
130
|
previewStore.send({ type: "closeCreatePageModal" });
|
|
137
131
|
form.reset();
|
|
138
132
|
await new Promise(_temp2);
|
|
@@ -2,7 +2,7 @@ import { useProjectSlug } from "../../../lib/auth.js";
|
|
|
2
2
|
import { usePageBlocks } from "../../../lib/normalized-data.js";
|
|
3
3
|
import { layoutQueries, projectQueries } from "../../../lib/queries.js";
|
|
4
4
|
import { useCamoxApp } from "../../provider/components/CamoxAppContext.js";
|
|
5
|
-
import { previewStore } from "../previewStore.js";
|
|
5
|
+
import { previewStore, selectPreviewSource } from "../previewStore.js";
|
|
6
6
|
import { PagePicker } from "./PagePicker.js";
|
|
7
7
|
import { LayoutBlockItem } from "./PageTree.js";
|
|
8
8
|
import { PublicationRow } from "./PublicationRow.js";
|
|
@@ -17,12 +17,12 @@ import { PanelContent, PanelHeader } from "@camox/ui/panel";
|
|
|
17
17
|
const EMPTY_PAGE = { blockIds: [] };
|
|
18
18
|
function DerivedLayoutSidebar(t0) {
|
|
19
19
|
const $ = c(32);
|
|
20
|
-
if ($[0] !== "
|
|
20
|
+
if ($[0] !== "2c7da8bd37fd1558e1c31149d4435d439cdd1425cb374116d681960617531266") {
|
|
21
21
|
for (let $i = 0; $i < 32; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
22
|
-
$[0] = "
|
|
22
|
+
$[0] = "2c7da8bd37fd1558e1c31149d4435d439cdd1425cb374116d681960617531266";
|
|
23
23
|
}
|
|
24
24
|
const { layout } = t0;
|
|
25
|
-
const source = useSelector(previewStore,
|
|
25
|
+
const source = useSelector(previewStore, selectPreviewSource);
|
|
26
26
|
let t1;
|
|
27
27
|
if ($[1] !== layout) {
|
|
28
28
|
t1 = {
|
|
@@ -155,9 +155,6 @@ function DerivedLayoutSidebar(t0) {
|
|
|
155
155
|
} else t14 = $[31];
|
|
156
156
|
return t14;
|
|
157
157
|
}
|
|
158
|
-
function _temp(state) {
|
|
159
|
-
return state.context.previewSource;
|
|
160
|
-
}
|
|
161
158
|
|
|
162
159
|
//#endregion
|
|
163
160
|
export { DerivedLayoutSidebar };
|