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
|
@@ -184,7 +184,7 @@ function MobilePreviewDrawer({ page, projectName }) {
|
|
|
184
184
|
className: "w-full",
|
|
185
185
|
disabled: page.status === "published" || page.livePublishedCheckpointId == null,
|
|
186
186
|
onClick: () => previewStore.send({ type: "viewLivePage" }),
|
|
187
|
-
children: "View
|
|
187
|
+
children: "View live page"
|
|
188
188
|
})
|
|
189
189
|
}),
|
|
190
190
|
/* @__PURE__ */ jsxs("div", {
|
|
@@ -251,9 +251,9 @@ function MobilePreviewDrawer({ page, projectName }) {
|
|
|
251
251
|
}
|
|
252
252
|
function DrawerTile(t0) {
|
|
253
253
|
const $ = c(13);
|
|
254
|
-
if ($[0] !== "
|
|
254
|
+
if ($[0] !== "621776a19ae594038e7ff74376eaee55067cbd45ac5f2b72eb73e9a66d3c4ae0") {
|
|
255
255
|
for (let $i = 0; $i < 13; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
256
|
-
$[0] = "
|
|
256
|
+
$[0] = "621776a19ae594038e7ff74376eaee55067cbd45ac5f2b72eb73e9a66d3c4ae0";
|
|
257
257
|
}
|
|
258
258
|
const { title, icon: Icon, onClick, fullWidth: t1, disabled: t2 } = t0;
|
|
259
259
|
const fullWidth = t1 === void 0 ? false : t1;
|
|
@@ -11,20 +11,19 @@ import { useSelector } from "@xstate/store-react";
|
|
|
11
11
|
* Listening for focus commands from parent (for sidebar-triggered focus)
|
|
12
12
|
*/
|
|
13
13
|
const OverlayTracker = () => {
|
|
14
|
-
const $ = c(
|
|
15
|
-
if ($[0] !== "
|
|
16
|
-
for (let $i = 0; $i <
|
|
17
|
-
$[0] = "
|
|
14
|
+
const $ = c(8);
|
|
15
|
+
if ($[0] !== "ebfece21400ea0599bf93e9f81b5244a330a6049bfb4c02fcc51a02e95e8e214") {
|
|
16
|
+
for (let $i = 0; $i < 8; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
17
|
+
$[0] = "ebfece21400ea0599bf93e9f81b5244a330a6049bfb4c02fcc51a02e95e8e214";
|
|
18
18
|
}
|
|
19
19
|
const { window: iframeWindow } = useFrame();
|
|
20
|
-
const
|
|
21
|
-
const isAddBlockSidebarOpen = useSelector(previewStore, _temp2);
|
|
20
|
+
const isAddBlockSidebarOpen = useSelector(previewStore, _temp);
|
|
22
21
|
let t0;
|
|
23
22
|
let t1;
|
|
24
23
|
if ($[1] !== iframeWindow || $[2] !== isAddBlockSidebarOpen) {
|
|
25
24
|
t0 = () => {
|
|
26
25
|
if (!iframeWindow || !isAddBlockSidebarOpen) return;
|
|
27
|
-
const handleClick =
|
|
26
|
+
const handleClick = _temp2;
|
|
28
27
|
iframeWindow.document.addEventListener("click", handleClick);
|
|
29
28
|
return () => iframeWindow.document.removeEventListener("click", handleClick);
|
|
30
29
|
};
|
|
@@ -40,14 +39,13 @@ const OverlayTracker = () => {
|
|
|
40
39
|
React.useEffect(t0, t1);
|
|
41
40
|
let t2;
|
|
42
41
|
let t3;
|
|
43
|
-
if ($[5] !== iframeWindow
|
|
42
|
+
if ($[5] !== iframeWindow) {
|
|
44
43
|
t2 = () => {
|
|
45
44
|
if (!iframeWindow) return;
|
|
46
45
|
const handleMessage = (event) => {
|
|
47
46
|
if (!isOverlayMessage(event.data)) return;
|
|
48
47
|
const { type } = event.data;
|
|
49
48
|
if (type === "CAMOX_FOCUS_FIELD") {
|
|
50
|
-
if (isPageEditorSidebarOpen) return;
|
|
51
49
|
const { fieldId } = event.data;
|
|
52
50
|
const element = iframeWindow.document.querySelector(`[data-camox-field-id="${fieldId}"]`);
|
|
53
51
|
if (element) element.focus();
|
|
@@ -56,25 +54,21 @@ const OverlayTracker = () => {
|
|
|
56
54
|
iframeWindow.addEventListener("message", handleMessage);
|
|
57
55
|
return () => iframeWindow.removeEventListener("message", handleMessage);
|
|
58
56
|
};
|
|
59
|
-
t3 = [iframeWindow
|
|
57
|
+
t3 = [iframeWindow];
|
|
60
58
|
$[5] = iframeWindow;
|
|
61
|
-
$[6] =
|
|
62
|
-
$[7] =
|
|
63
|
-
$[8] = t3;
|
|
59
|
+
$[6] = t2;
|
|
60
|
+
$[7] = t3;
|
|
64
61
|
} else {
|
|
65
|
-
t2 = $[
|
|
66
|
-
t3 = $[
|
|
62
|
+
t2 = $[6];
|
|
63
|
+
t3 = $[7];
|
|
67
64
|
}
|
|
68
65
|
React.useEffect(t2, t3);
|
|
69
66
|
return null;
|
|
70
67
|
};
|
|
71
68
|
function _temp(state) {
|
|
72
|
-
return state.context.
|
|
69
|
+
return state.context.isAddBlockSidebarOpen;
|
|
73
70
|
}
|
|
74
|
-
function _temp2(
|
|
75
|
-
return state_0.context.isAddBlockSidebarOpen;
|
|
76
|
-
}
|
|
77
|
-
function _temp3() {
|
|
71
|
+
function _temp2() {
|
|
78
72
|
previewStore.send({ type: "exitPeekedBlock" });
|
|
79
73
|
}
|
|
80
74
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { usePageBlocks } from "../../../lib/normalized-data.js";
|
|
2
|
-
import { previewStore } from "../previewStore.js";
|
|
2
|
+
import { previewStore, selectIsEditMode } from "../previewStore.js";
|
|
3
3
|
import { isOverlayMessage } from "../overlayMessages.js";
|
|
4
4
|
import { usePreviewedPage } from "../CamoxPreview.js";
|
|
5
5
|
import { c } from "react/compiler-runtime";
|
|
@@ -10,9 +10,9 @@ import { useSelector } from "@xstate/store-react";
|
|
|
10
10
|
//#region src/features/preview/components/Overlays.tsx
|
|
11
11
|
function CuratedAddBlockListener() {
|
|
12
12
|
const $ = c(4);
|
|
13
|
-
if ($[0] !== "
|
|
13
|
+
if ($[0] !== "6fe49b666f3f81b9063fd01dd7ea74a4df9732064d2b113c5ce2770c9992f6b4") {
|
|
14
14
|
for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
15
|
-
$[0] = "
|
|
15
|
+
$[0] = "6fe49b666f3f81b9063fd01dd7ea74a4df9732064d2b113c5ce2770c9992f6b4";
|
|
16
16
|
}
|
|
17
17
|
const { pageBlocks } = usePageBlocks(usePreviewedPage());
|
|
18
18
|
let t0;
|
|
@@ -23,10 +23,7 @@ function CuratedAddBlockListener() {
|
|
|
23
23
|
if (!isOverlayMessage(event.data)) return;
|
|
24
24
|
const message = event.data;
|
|
25
25
|
if (message.type === "CAMOX_ADD_BLOCK_REQUEST") {
|
|
26
|
-
if (previewStore.getSnapshot()
|
|
27
|
-
previewStore.send({ type: "requestDraftSwitch" });
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
26
|
+
if (!selectIsEditMode(previewStore.getSnapshot())) return;
|
|
30
27
|
const { blockPosition, insertPosition } = message;
|
|
31
28
|
let afterPosition = null;
|
|
32
29
|
if (message.afterPosition !== void 0) afterPosition = message.afterPosition;
|
|
@@ -38,8 +35,7 @@ function CuratedAddBlockListener() {
|
|
|
38
35
|
}
|
|
39
36
|
previewStore.send({
|
|
40
37
|
type: "openAddBlockSidebar",
|
|
41
|
-
afterPosition
|
|
42
|
-
via: "overlay"
|
|
38
|
+
afterPosition
|
|
43
39
|
});
|
|
44
40
|
}
|
|
45
41
|
};
|
|
@@ -58,20 +54,18 @@ function CuratedAddBlockListener() {
|
|
|
58
54
|
return null;
|
|
59
55
|
}
|
|
60
56
|
const Overlays = (t0) => {
|
|
61
|
-
const $ = c(
|
|
62
|
-
if ($[0] !== "
|
|
63
|
-
for (let $i = 0; $i <
|
|
64
|
-
$[0] = "
|
|
57
|
+
const $ = c(11);
|
|
58
|
+
if ($[0] !== "6fe49b666f3f81b9063fd01dd7ea74a4df9732064d2b113c5ce2770c9992f6b4") {
|
|
59
|
+
for (let $i = 0; $i < 11; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
60
|
+
$[0] = "6fe49b666f3f81b9063fd01dd7ea74a4df9732064d2b113c5ce2770c9992f6b4";
|
|
65
61
|
}
|
|
66
62
|
const { iframeElement, canAddBlocks: t1 } = t0;
|
|
67
63
|
const canAddBlocks = t1 === void 0 ? false : t1;
|
|
68
|
-
const
|
|
69
|
-
const
|
|
70
|
-
const peekedBlock = useSelector(previewStore, _temp3);
|
|
64
|
+
const selection = useSelector(previewStore, _temp);
|
|
65
|
+
const peekedBlock = useSelector(previewStore, _temp2);
|
|
71
66
|
let t2;
|
|
72
|
-
if ($[1] !== iframeElement?.contentWindow || $[2] !==
|
|
67
|
+
if ($[1] !== iframeElement?.contentWindow || $[2] !== peekedBlock || $[3] !== selection) {
|
|
73
68
|
t2 = () => {
|
|
74
|
-
if (isPageEditorSidebarOpen) return;
|
|
75
69
|
if (peekedBlock) return;
|
|
76
70
|
if (!selection) return;
|
|
77
71
|
if (selection.type !== "block-field" && selection.type !== "item-field") return;
|
|
@@ -85,42 +79,36 @@ const Overlays = (t0) => {
|
|
|
85
79
|
iframeElement?.contentWindow?.postMessage(message, "*");
|
|
86
80
|
};
|
|
87
81
|
$[1] = iframeElement?.contentWindow;
|
|
88
|
-
$[2] =
|
|
89
|
-
$[3] =
|
|
90
|
-
$[4] =
|
|
91
|
-
|
|
92
|
-
} else t2 = $[5];
|
|
82
|
+
$[2] = peekedBlock;
|
|
83
|
+
$[3] = selection;
|
|
84
|
+
$[4] = t2;
|
|
85
|
+
} else t2 = $[4];
|
|
93
86
|
let t3;
|
|
94
|
-
if ($[
|
|
87
|
+
if ($[5] !== iframeElement || $[6] !== peekedBlock || $[7] !== selection) {
|
|
95
88
|
t3 = [
|
|
96
89
|
selection,
|
|
97
|
-
isPageEditorSidebarOpen,
|
|
98
90
|
peekedBlock,
|
|
99
91
|
iframeElement
|
|
100
92
|
];
|
|
101
|
-
$[
|
|
102
|
-
$[
|
|
103
|
-
$[
|
|
104
|
-
$[
|
|
105
|
-
|
|
106
|
-
} else t3 = $[10];
|
|
93
|
+
$[5] = iframeElement;
|
|
94
|
+
$[6] = peekedBlock;
|
|
95
|
+
$[7] = selection;
|
|
96
|
+
$[8] = t3;
|
|
97
|
+
} else t3 = $[8];
|
|
107
98
|
React.useEffect(t2, t3);
|
|
108
99
|
let t4;
|
|
109
|
-
if ($[
|
|
100
|
+
if ($[9] !== canAddBlocks) {
|
|
110
101
|
t4 = canAddBlocks ? /* @__PURE__ */ jsx(CuratedAddBlockListener, {}) : null;
|
|
111
|
-
$[
|
|
112
|
-
$[
|
|
113
|
-
} else t4 = $[
|
|
102
|
+
$[9] = canAddBlocks;
|
|
103
|
+
$[10] = t4;
|
|
104
|
+
} else t4 = $[10];
|
|
114
105
|
return t4;
|
|
115
106
|
};
|
|
116
107
|
function _temp(state) {
|
|
117
|
-
return state.context.
|
|
108
|
+
return state.context.selection;
|
|
118
109
|
}
|
|
119
110
|
function _temp2(state_0) {
|
|
120
|
-
return state_0.context.
|
|
121
|
-
}
|
|
122
|
-
function _temp3(state_1) {
|
|
123
|
-
return state_1.context.peekedBlock;
|
|
111
|
+
return state_0.context.peekedBlock;
|
|
124
112
|
}
|
|
125
113
|
|
|
126
114
|
//#endregion
|