camox 0.41.1 → 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 +18 -4
- package/dist/core/createLayout.d.ts +1 -1
- package/dist/core/editing/createEditableBlock.d.ts +8 -1
- package/dist/core/editing/createEditableBlock.js +636 -459
- package/dist/core/hooks/useOverlayState.js +11 -0
- package/dist/core/lib/fieldTypes.js +5 -5
- package/dist/core/lib/lexicalState.js +17 -1
- package/dist/features/preview/CamoxPreview.js +80 -73
- 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 +13 -64
- 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/ItemFieldsEditor.js +275 -204
- package/dist/features/preview/components/LeftSidebar.js +18 -18
- package/dist/features/preview/components/OverlayTracker.js +14 -20
- package/dist/features/preview/components/Overlays.js +26 -35
- package/dist/features/preview/components/PageEditorSidebar.js +89 -90
- 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 +158 -156
- package/dist/features/preview/components/PreviewComments.js +56 -0
- package/dist/features/preview/components/PreviewPanel.js +122 -78
- package/dist/features/preview/components/PreviewToolbar.js +280 -231
- package/dist/features/preview/components/PublicationRow.js +4 -11
- 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 +19 -39
- package/dist/features/provider/AuthenticatedCamoxProvider.js +46 -34
- package/dist/features/provider/components/CommandPalette.js +142 -58
- package/dist/features/provider/useAdminShortcuts.js +19 -8
- package/dist/features/routes/pageRuntime.js +0 -6
- package/dist/features/runtime/RuntimeChrome.js +40 -37
- package/dist/features/studio/CamoxStudio.js +30 -50
- 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/lib/telemetry-client.js +0 -66
- package/dist/lib/telemetry.js +0 -26
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { actionsStore } from "../../provider/actionsStore.js";
|
|
2
2
|
import { checkIfInputFocused, cn } from "../../../lib/utils.js";
|
|
3
3
|
import { SharedChromeContext } from "../../runtime/SharedChromeContext.js";
|
|
4
|
-
import {
|
|
4
|
+
import { areCommentsEnabled } from "../commentsEnabled.js";
|
|
5
|
+
import { previewStore, selectIsCommentMode, selectIsEditMode } from "../previewStore.js";
|
|
5
6
|
import { useBlockActionsShortcuts } from "./BlockActionsPopover.js";
|
|
7
|
+
import { PreviewPageContext } from "../previewSelection.js";
|
|
6
8
|
import { FieldOverlayStyles } from "./FieldOverlayStyles.js";
|
|
7
9
|
import { FieldToolbar } from "./FieldToolbar.js";
|
|
8
10
|
import { Frame, useFrame } from "./Frame.js";
|
|
9
11
|
import { MobilePreviewDrawer } from "./MobilePreviewDrawer.js";
|
|
10
12
|
import { Overlays } from "./Overlays.js";
|
|
11
13
|
import { OverlayTracker } from "./OverlayTracker.js";
|
|
14
|
+
import { PreviewComments } from "./PreviewComments.js";
|
|
12
15
|
import { PreviewToolbar } from "./PreviewToolbar.js";
|
|
13
16
|
import { c } from "react/compiler-runtime";
|
|
14
17
|
import * as React from "react";
|
|
@@ -19,9 +22,9 @@ import { PanelContent } from "@camox/ui/panel";
|
|
|
19
22
|
//#region src/features/preview/components/PreviewPanel.tsx
|
|
20
23
|
const PreviewFrame = (t0) => {
|
|
21
24
|
const $ = c(9);
|
|
22
|
-
if ($[0] !== "
|
|
25
|
+
if ($[0] !== "2ff281df7470ab1480710764847a6828eb3009ff64e2feadae4454d04b90f99e") {
|
|
23
26
|
for (let $i = 0; $i < 9; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
24
|
-
$[0] = "
|
|
27
|
+
$[0] = "2ff281df7470ab1480710764847a6828eb3009ff64e2feadae4454d04b90f99e";
|
|
25
28
|
}
|
|
26
29
|
const { children, style, className, onIframeReady } = t0;
|
|
27
30
|
let t1;
|
|
@@ -62,9 +65,9 @@ const PreviewFrame = (t0) => {
|
|
|
62
65
|
};
|
|
63
66
|
const KeyDownForwarder = () => {
|
|
64
67
|
const $ = c(5);
|
|
65
|
-
if ($[0] !== "
|
|
68
|
+
if ($[0] !== "2ff281df7470ab1480710764847a6828eb3009ff64e2feadae4454d04b90f99e") {
|
|
66
69
|
for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
67
|
-
$[0] = "
|
|
70
|
+
$[0] = "2ff281df7470ab1480710764847a6828eb3009ff64e2feadae4454d04b90f99e";
|
|
68
71
|
}
|
|
69
72
|
const { window: iframeWindow } = useFrame();
|
|
70
73
|
const actions = useSelector(actionsStore, _temp);
|
|
@@ -78,7 +81,7 @@ const KeyDownForwarder = () => {
|
|
|
78
81
|
if (!action.shortcut) return false;
|
|
79
82
|
if (!action.checkIfAvailable()) return false;
|
|
80
83
|
if (checkIfInputFocused(iframeWindow.document)) {
|
|
81
|
-
if (!action.shortcut.withMeta && !action.shortcut.withAlt) return false;
|
|
84
|
+
if (action.shortcut.key !== "Escape" && !action.shortcut.withMeta && !action.shortcut.withAlt) return false;
|
|
82
85
|
if (action.shortcut.key === "Backspace") return false;
|
|
83
86
|
}
|
|
84
87
|
const { key, withMeta, withAlt, withShift } = action.shortcut;
|
|
@@ -87,15 +90,26 @@ const KeyDownForwarder = () => {
|
|
|
87
90
|
if (matchingAction) {
|
|
88
91
|
e.preventDefault();
|
|
89
92
|
e.stopPropagation();
|
|
93
|
+
if (e.key === "Escape" && checkIfInputFocused(iframeWindow.document)) iframeWindow.document.activeElement.blur();
|
|
90
94
|
iframeWindow.parent.postMessage({
|
|
91
95
|
type: "executeAction",
|
|
92
96
|
actionId: matchingAction.id
|
|
93
97
|
}, "*");
|
|
94
98
|
}
|
|
95
99
|
};
|
|
96
|
-
|
|
100
|
+
const handleCapturedKeyDown = (event) => {
|
|
101
|
+
if (event.key === "Escape") return;
|
|
102
|
+
handleKeyDown(event);
|
|
103
|
+
};
|
|
104
|
+
const handleEscape = (event_0) => {
|
|
105
|
+
if (event_0.key !== "Escape" || event_0.defaultPrevented) return;
|
|
106
|
+
handleKeyDown(event_0);
|
|
107
|
+
};
|
|
108
|
+
iframeWindow.addEventListener("keydown", handleCapturedKeyDown, true);
|
|
109
|
+
iframeWindow.addEventListener("keydown", handleEscape);
|
|
97
110
|
return () => {
|
|
98
|
-
iframeWindow.removeEventListener("keydown",
|
|
111
|
+
iframeWindow.removeEventListener("keydown", handleCapturedKeyDown, true);
|
|
112
|
+
iframeWindow.removeEventListener("keydown", handleEscape);
|
|
99
113
|
};
|
|
100
114
|
};
|
|
101
115
|
t1 = [iframeWindow, actions];
|
|
@@ -116,82 +130,102 @@ const viewportClassName = {
|
|
|
116
130
|
};
|
|
117
131
|
function CuratedBlockShortcuts() {
|
|
118
132
|
const $ = c(1);
|
|
119
|
-
if ($[0] !== "
|
|
133
|
+
if ($[0] !== "2ff281df7470ab1480710764847a6828eb3009ff64e2feadae4454d04b90f99e") {
|
|
120
134
|
for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
121
|
-
$[0] = "
|
|
135
|
+
$[0] = "2ff281df7470ab1480710764847a6828eb3009ff64e2feadae4454d04b90f99e";
|
|
122
136
|
}
|
|
123
137
|
useBlockActionsShortcuts();
|
|
124
138
|
return null;
|
|
125
139
|
}
|
|
126
140
|
const PreviewPanel = (t0) => {
|
|
127
|
-
const $ = c(
|
|
128
|
-
if ($[0] !== "
|
|
129
|
-
for (let $i = 0; $i <
|
|
130
|
-
$[0] = "
|
|
141
|
+
const $ = c(34);
|
|
142
|
+
if ($[0] !== "2ff281df7470ab1480710764847a6828eb3009ff64e2feadae4454d04b90f99e") {
|
|
143
|
+
for (let $i = 0; $i < 34; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
144
|
+
$[0] = "2ff281df7470ab1480710764847a6828eb3009ff64e2feadae4454d04b90f99e";
|
|
131
145
|
}
|
|
132
146
|
const { children, isMobileExperience: t1, page, projectName: t2, toolbarProps } = t0;
|
|
133
147
|
const isMobileExperience = t1 === void 0 ? false : t1;
|
|
134
148
|
const projectName = t2 === void 0 ? "Project" : t2;
|
|
135
149
|
const sharedChrome = React.useContext(SharedChromeContext);
|
|
150
|
+
const t3 = page?.id ?? null;
|
|
151
|
+
let t4;
|
|
152
|
+
if ($[1] !== children || $[2] !== t3) {
|
|
153
|
+
t4 = /* @__PURE__ */ jsx(PreviewPageContext, {
|
|
154
|
+
value: t3,
|
|
155
|
+
children
|
|
156
|
+
});
|
|
157
|
+
$[1] = children;
|
|
158
|
+
$[2] = t3;
|
|
159
|
+
$[3] = t4;
|
|
160
|
+
} else t4 = $[3];
|
|
161
|
+
const previewContent = t4;
|
|
136
162
|
const iframeElement = useSelector(previewStore, _temp2);
|
|
137
163
|
const handleIframeReady = _temp3;
|
|
138
164
|
const viewportMode = useSelector(previewStore, _temp4);
|
|
139
165
|
const isEditMode = useSelector(previewStore, selectIsEditMode);
|
|
166
|
+
const isCommentMode = useSelector(previewStore, selectIsCommentMode);
|
|
140
167
|
const isToolbarHidden = useSelector(previewStore, _temp5);
|
|
141
|
-
let
|
|
142
|
-
if ($[
|
|
143
|
-
|
|
144
|
-
$[
|
|
145
|
-
} else
|
|
146
|
-
React.useEffect(_temp15,
|
|
168
|
+
let t5;
|
|
169
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
170
|
+
t5 = [];
|
|
171
|
+
$[4] = t5;
|
|
172
|
+
} else t5 = $[4];
|
|
173
|
+
React.useEffect(_temp15, t5);
|
|
147
174
|
if (isMobileExperience) {
|
|
148
|
-
let
|
|
149
|
-
if ($[
|
|
150
|
-
|
|
175
|
+
let t6;
|
|
176
|
+
if ($[5] !== previewContent) {
|
|
177
|
+
t6 = /* @__PURE__ */ jsx("div", {
|
|
151
178
|
className: "relative min-h-0 flex-1",
|
|
152
179
|
children: /* @__PURE__ */ jsx(PreviewFrame, {
|
|
153
180
|
className: "h-full w-full",
|
|
154
181
|
onIframeReady: handleIframeReady,
|
|
155
|
-
children
|
|
182
|
+
children: previewContent
|
|
156
183
|
})
|
|
157
184
|
});
|
|
158
|
-
$[
|
|
159
|
-
$[
|
|
160
|
-
} else
|
|
161
|
-
let
|
|
162
|
-
if ($[
|
|
163
|
-
|
|
185
|
+
$[5] = previewContent;
|
|
186
|
+
$[6] = t6;
|
|
187
|
+
} else t6 = $[6];
|
|
188
|
+
let t7;
|
|
189
|
+
if ($[7] !== isToolbarHidden || $[8] !== page || $[9] !== projectName || $[10] !== sharedChrome || $[11] !== toolbarProps) {
|
|
190
|
+
t7 = !isToolbarHidden && (page ? /* @__PURE__ */ jsx(MobilePreviewDrawer, {
|
|
164
191
|
page,
|
|
165
192
|
projectName
|
|
166
193
|
}) : !sharedChrome && /* @__PURE__ */ jsx(PreviewToolbar, { ...toolbarProps }));
|
|
167
|
-
$[
|
|
168
|
-
$[
|
|
169
|
-
$[
|
|
170
|
-
$[
|
|
171
|
-
$[
|
|
172
|
-
$[
|
|
173
|
-
} else
|
|
174
|
-
let
|
|
175
|
-
if ($[
|
|
176
|
-
|
|
194
|
+
$[7] = isToolbarHidden;
|
|
195
|
+
$[8] = page;
|
|
196
|
+
$[9] = projectName;
|
|
197
|
+
$[10] = sharedChrome;
|
|
198
|
+
$[11] = toolbarProps;
|
|
199
|
+
$[12] = t7;
|
|
200
|
+
} else t7 = $[12];
|
|
201
|
+
let t8;
|
|
202
|
+
if ($[13] !== t6 || $[14] !== t7) {
|
|
203
|
+
t8 = /* @__PURE__ */ jsxs(PanelContent, {
|
|
177
204
|
className: "flex min-h-0 flex-col overflow-hidden bg-black",
|
|
178
|
-
children: [
|
|
205
|
+
children: [t6, t7]
|
|
179
206
|
});
|
|
180
|
-
$[
|
|
181
|
-
$[
|
|
182
|
-
$[
|
|
183
|
-
} else
|
|
184
|
-
return
|
|
207
|
+
$[13] = t6;
|
|
208
|
+
$[14] = t7;
|
|
209
|
+
$[15] = t8;
|
|
210
|
+
} else t8 = $[15];
|
|
211
|
+
return t8;
|
|
185
212
|
}
|
|
186
|
-
let
|
|
187
|
-
if ($[
|
|
188
|
-
|
|
189
|
-
$[
|
|
190
|
-
$[
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
213
|
+
let t6;
|
|
214
|
+
if ($[16] !== isCommentMode || $[17] !== page) {
|
|
215
|
+
t6 = page && !isCommentMode && /* @__PURE__ */ jsx(CuratedBlockShortcuts, {});
|
|
216
|
+
$[16] = isCommentMode;
|
|
217
|
+
$[17] = page;
|
|
218
|
+
$[18] = t6;
|
|
219
|
+
} else t6 = $[18];
|
|
220
|
+
let t7;
|
|
221
|
+
if ($[19] !== page) {
|
|
222
|
+
t7 = areCommentsEnabled() && page && /* @__PURE__ */ jsx(PreviewComments, {}, page.id);
|
|
223
|
+
$[19] = page;
|
|
224
|
+
$[20] = t7;
|
|
225
|
+
} else t7 = $[20];
|
|
226
|
+
let t8;
|
|
227
|
+
if ($[21] !== iframeElement || $[22] !== isCommentMode || $[23] !== isEditMode || $[24] !== page || $[25] !== previewContent || $[26] !== sharedChrome || $[27] !== toolbarProps || $[28] !== viewportMode) {
|
|
228
|
+
t8 = /* @__PURE__ */ jsx(PanelContent, {
|
|
195
229
|
className: "relative overflow-hidden bg-black",
|
|
196
230
|
children: /* @__PURE__ */ jsx("div", {
|
|
197
231
|
className: "absolute inset-0",
|
|
@@ -199,13 +233,13 @@ const PreviewPanel = (t0) => {
|
|
|
199
233
|
/* @__PURE__ */ jsx(PreviewFrame, {
|
|
200
234
|
className: "checkered h-full w-full",
|
|
201
235
|
onIframeReady: handleIframeReady,
|
|
202
|
-
children
|
|
236
|
+
children: previewContent
|
|
203
237
|
}),
|
|
204
|
-
isEditMode && /* @__PURE__ */ jsx(Overlays, {
|
|
238
|
+
isEditMode && !isCommentMode && /* @__PURE__ */ jsx(Overlays, {
|
|
205
239
|
iframeElement,
|
|
206
240
|
canAddBlocks: !!page
|
|
207
241
|
}),
|
|
208
|
-
isEditMode && /* @__PURE__ */ jsx(FieldToolbar, {}),
|
|
242
|
+
isEditMode && !isCommentMode && /* @__PURE__ */ jsx(FieldToolbar, {}),
|
|
209
243
|
!sharedChrome && /* @__PURE__ */ jsx(PreviewToolbar, { ...toolbarProps })
|
|
210
244
|
] }) : /* @__PURE__ */ jsxs("div", {
|
|
211
245
|
className: cn("checkered flex h-full justify-center", isEditMode ? "items-start" : "items-center"),
|
|
@@ -215,35 +249,41 @@ const PreviewPanel = (t0) => {
|
|
|
215
249
|
children: [/* @__PURE__ */ jsx(PreviewFrame, {
|
|
216
250
|
className: "overflow-auto",
|
|
217
251
|
onIframeReady: handleIframeReady,
|
|
218
|
-
children
|
|
219
|
-
}), isEditMode && /* @__PURE__ */ jsx(Overlays, {
|
|
252
|
+
children: previewContent
|
|
253
|
+
}), isEditMode && !isCommentMode && /* @__PURE__ */ jsx(Overlays, {
|
|
220
254
|
iframeElement,
|
|
221
255
|
canAddBlocks: !!page
|
|
222
256
|
})]
|
|
223
257
|
}),
|
|
224
|
-
isEditMode && /* @__PURE__ */ jsx(FieldToolbar, {}),
|
|
258
|
+
isEditMode && !isCommentMode && /* @__PURE__ */ jsx(FieldToolbar, {}),
|
|
225
259
|
!sharedChrome && /* @__PURE__ */ jsx(PreviewToolbar, { ...toolbarProps })
|
|
226
260
|
]
|
|
227
261
|
})
|
|
228
262
|
})
|
|
229
263
|
});
|
|
230
|
-
$[
|
|
231
|
-
$[
|
|
232
|
-
$[
|
|
233
|
-
$[
|
|
234
|
-
$[
|
|
235
|
-
$[
|
|
236
|
-
$[
|
|
237
|
-
$[
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
264
|
+
$[21] = iframeElement;
|
|
265
|
+
$[22] = isCommentMode;
|
|
266
|
+
$[23] = isEditMode;
|
|
267
|
+
$[24] = page;
|
|
268
|
+
$[25] = previewContent;
|
|
269
|
+
$[26] = sharedChrome;
|
|
270
|
+
$[27] = toolbarProps;
|
|
271
|
+
$[28] = viewportMode;
|
|
272
|
+
$[29] = t8;
|
|
273
|
+
} else t8 = $[29];
|
|
274
|
+
let t9;
|
|
275
|
+
if ($[30] !== t6 || $[31] !== t7 || $[32] !== t8) {
|
|
276
|
+
t9 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
277
|
+
t6,
|
|
278
|
+
t7,
|
|
279
|
+
t8
|
|
280
|
+
] });
|
|
281
|
+
$[30] = t6;
|
|
282
|
+
$[31] = t7;
|
|
283
|
+
$[32] = t8;
|
|
284
|
+
$[33] = t9;
|
|
285
|
+
} else t9 = $[33];
|
|
286
|
+
return t9;
|
|
247
287
|
};
|
|
248
288
|
function _temp(state) {
|
|
249
289
|
return state.context.actions;
|
|
@@ -300,6 +340,10 @@ function _temp12() {
|
|
|
300
340
|
return true;
|
|
301
341
|
}
|
|
302
342
|
function _temp13() {
|
|
343
|
+
previewStore.send({
|
|
344
|
+
type: "setCommentMode",
|
|
345
|
+
enabled: false
|
|
346
|
+
});
|
|
303
347
|
previewStore.send({ type: "clearSelection" });
|
|
304
348
|
}
|
|
305
349
|
function _temp14(a) {
|