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
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
import { useIsAuthenticated } from "../../lib/auth.js";
|
|
2
|
-
import { previewStore } from "../../features/preview/previewStore.js";
|
|
2
|
+
import { previewStore, selectIsEditMode } from "../../features/preview/previewStore.js";
|
|
3
3
|
import { c } from "react/compiler-runtime";
|
|
4
4
|
import { useSelector } from "@xstate/store-react";
|
|
5
5
|
|
|
6
6
|
//#region src/core/hooks/useIsEditable.ts
|
|
7
7
|
function useIsEditable(mode) {
|
|
8
8
|
const $ = c(1);
|
|
9
|
-
if ($[0] !== "
|
|
9
|
+
if ($[0] !== "baeaba7613c819c1f4460b64af1c246a057a26cf699e41daca4193d0ee512f1c") {
|
|
10
10
|
for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
11
|
-
$[0] = "
|
|
11
|
+
$[0] = "baeaba7613c819c1f4460b64af1c246a057a26cf699e41daca4193d0ee512f1c";
|
|
12
12
|
}
|
|
13
13
|
const isAuthenticated = useIsAuthenticated();
|
|
14
|
-
const isEditMode = useSelector(previewStore,
|
|
14
|
+
const isEditMode = useSelector(previewStore, selectIsEditMode);
|
|
15
15
|
return isAuthenticated && (mode === "site" || mode === "layout") && isEditMode;
|
|
16
16
|
}
|
|
17
|
-
function _temp(state) {
|
|
18
|
-
return state.context.isEditMode;
|
|
19
|
-
}
|
|
20
17
|
|
|
21
18
|
//#endregion
|
|
22
19
|
export { useIsEditable };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/core/hooks/useOverlayState.ts
|
|
2
|
+
/** Native and sidebar hover use the same overlay attributes in every editing mode. */
|
|
3
|
+
function useOverlayState(hovered, focused = false) {
|
|
4
|
+
return {
|
|
5
|
+
"data-camox-hovered": hovered || void 0,
|
|
6
|
+
"data-camox-focused": focused || void 0
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
export { useOverlayState };
|
|
@@ -1,26 +1,22 @@
|
|
|
1
|
-
import { previewStore } from "../../features/preview/previewStore.js";
|
|
1
|
+
import { previewStore, selectPreviewSource } from "../../features/preview/previewStore.js";
|
|
2
2
|
import { c } from "react/compiler-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/core/hooks/useRequireDraftSource.ts
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* so the caller aborts. The dialog's CTA only switches the source — it does
|
|
10
|
-
* not retry the original attempt; the user re-issues the edit themselves.
|
|
6
|
+
* Ignore stale editor callbacks after switching to live preview.
|
|
7
|
+
* Draft editing is guaranteed by the store's mode; this guard also covers
|
|
8
|
+
* callbacks from hidden controls and edits that finish asynchronously.
|
|
11
9
|
*/
|
|
12
10
|
function useRequireDraftSource() {
|
|
13
11
|
const $ = c(1);
|
|
14
|
-
if ($[0] !== "
|
|
12
|
+
if ($[0] !== "cb874573187dc3b9520288b70786314b287b85d7bd338855d2b28db5ee7c09c2") {
|
|
15
13
|
for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
16
|
-
$[0] = "
|
|
14
|
+
$[0] = "cb874573187dc3b9520288b70786314b287b85d7bd338855d2b28db5ee7c09c2";
|
|
17
15
|
}
|
|
18
16
|
return _temp;
|
|
19
17
|
}
|
|
20
18
|
function _temp() {
|
|
21
|
-
|
|
22
|
-
previewStore.send({ type: "requestDraftSwitch" });
|
|
23
|
-
return false;
|
|
19
|
+
return selectPreviewSource(previewStore.getSnapshot()) === "draft";
|
|
24
20
|
}
|
|
25
21
|
|
|
26
22
|
//#endregion
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
//#region src/core/lib/fieldTypes.tsx
|
|
2
2
|
const fieldTypesDictionary = {
|
|
3
|
-
String: { hasOwnView:
|
|
4
|
-
Repeater: { hasOwnView:
|
|
5
|
-
Enum: { hasOwnView:
|
|
6
|
-
Boolean: { hasOwnView:
|
|
7
|
-
Embed: { hasOwnView:
|
|
3
|
+
String: { hasOwnView: true },
|
|
4
|
+
Repeater: { hasOwnView: true },
|
|
5
|
+
Enum: { hasOwnView: true },
|
|
6
|
+
Boolean: { hasOwnView: true },
|
|
7
|
+
Embed: { hasOwnView: true },
|
|
8
8
|
Link: { hasOwnView: true },
|
|
9
9
|
Image: { hasOwnView: true },
|
|
10
10
|
File: { hasOwnView: true },
|
|
@@ -12,6 +12,22 @@ function isLexicalState(value) {
|
|
|
12
12
|
return false;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
+
function lexicalStateToPlainText(serialized) {
|
|
16
|
+
try {
|
|
17
|
+
return extractText((typeof serialized === "object" ? serialized : JSON.parse(serialized)).root);
|
|
18
|
+
} catch {
|
|
19
|
+
return typeof serialized === "string" ? serialized : "";
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function extractText(node) {
|
|
23
|
+
if (node.type === "text") return node.text ?? "";
|
|
24
|
+
if (node.type === "linebreak") return "\n";
|
|
25
|
+
if (!node.children) return "";
|
|
26
|
+
const parts = [];
|
|
27
|
+
for (const child of node.children) parts.push(extractText(child));
|
|
28
|
+
if (node.type === "paragraph" || node.type === "inline-paragraph" || node.type === "heading") return parts.join("");
|
|
29
|
+
return parts.join(node.type === "root" ? "\n\n" : "");
|
|
30
|
+
}
|
|
15
31
|
function lexicalStateToMarkdown(serialized) {
|
|
16
32
|
try {
|
|
17
33
|
return extractMarkdown((typeof serialized === "object" ? serialized : JSON.parse(serialized)).root);
|
|
@@ -224,4 +240,4 @@ function parseTokens(tokens, format) {
|
|
|
224
240
|
}
|
|
225
241
|
|
|
226
242
|
//#endregion
|
|
227
|
-
export { isLexicalState, lexicalStateToMarkdown, markdownToLexicalState };
|
|
243
|
+
export { isLexicalState, lexicalStateToMarkdown, lexicalStateToPlainText, markdownToLexicalState };
|
|
@@ -8,14 +8,14 @@ import { blockQueries, pageQueries, projectQueries } from "../../lib/queries.js"
|
|
|
8
8
|
import { cn } from "../../lib/utils.js";
|
|
9
9
|
import { useCamoxApp } from "../provider/components/CamoxAppContext.js";
|
|
10
10
|
import { SharedChromeContext } from "../runtime/SharedChromeContext.js";
|
|
11
|
-
import { previewStore } from "./previewStore.js";
|
|
11
|
+
import { previewStore, selectIsEditMode, selectPreviewSource } from "./previewStore.js";
|
|
12
12
|
import { Navbar } from "../studio/components/Navbar.js";
|
|
13
13
|
import { CreatePageModal } from "./components/CreatePageModal.js";
|
|
14
|
-
import { DraftSwitchDialog } from "./components/DraftSwitchDialog.js";
|
|
15
14
|
import { EDIT_MODE_SHORTCUT } from "./previewConstants.js";
|
|
16
15
|
import { LeftSidebar } from "./components/LeftSidebar.js";
|
|
17
16
|
import { PeekedBlock } from "./components/PeekedBlock.js";
|
|
18
17
|
import { PreviewPanel } from "./components/PreviewPanel.js";
|
|
18
|
+
import { PreviewToolbarSpacer } from "./components/PreviewToolbarSpacer.js";
|
|
19
19
|
import { RightSidebar } from "./components/RightSidebar.js";
|
|
20
20
|
import { c } from "react/compiler-runtime";
|
|
21
21
|
import { useQuery, useQueryClient, useSuspenseQuery } from "@tanstack/react-query";
|
|
@@ -36,9 +36,9 @@ function getMobileStudioSnapshot() {
|
|
|
36
36
|
}
|
|
37
37
|
function useIsMobileStudio() {
|
|
38
38
|
const $ = c(1);
|
|
39
|
-
if ($[0] !== "
|
|
39
|
+
if ($[0] !== "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b") {
|
|
40
40
|
for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
41
|
-
$[0] = "
|
|
41
|
+
$[0] = "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b";
|
|
42
42
|
}
|
|
43
43
|
return React.useSyncExternalStore(subscribeToMobileStudio, getMobileStudioSnapshot, _temp);
|
|
44
44
|
}
|
|
@@ -71,13 +71,13 @@ function pageStructureQueryFn(path, projectSlug, source) {
|
|
|
71
71
|
}
|
|
72
72
|
function usePreviewedPage() {
|
|
73
73
|
const $ = c(11);
|
|
74
|
-
if ($[0] !== "
|
|
74
|
+
if ($[0] !== "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b") {
|
|
75
75
|
for (let $i = 0; $i < 11; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
76
|
-
$[0] = "
|
|
76
|
+
$[0] = "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b";
|
|
77
77
|
}
|
|
78
78
|
const { pathname } = useLocation();
|
|
79
79
|
const projectSlug = useProjectSlug();
|
|
80
|
-
const previewSource = useSelector(previewStore,
|
|
80
|
+
const previewSource = useSelector(previewStore, selectPreviewSource);
|
|
81
81
|
let t0;
|
|
82
82
|
if ($[1] !== pathname || $[2] !== previewSource) {
|
|
83
83
|
t0 = queryKeys.pages.getByPath(pathname, previewSource);
|
|
@@ -107,17 +107,14 @@ function usePreviewedPage() {
|
|
|
107
107
|
const { data: currentPage } = useSuspenseQuery(t2);
|
|
108
108
|
return currentPage;
|
|
109
109
|
}
|
|
110
|
-
function _temp2(state) {
|
|
111
|
-
return state.context.previewSource;
|
|
112
|
-
}
|
|
113
110
|
const BlockRenderer = (t0) => {
|
|
114
111
|
const $ = c(23);
|
|
115
|
-
if ($[0] !== "
|
|
112
|
+
if ($[0] !== "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b") {
|
|
116
113
|
for (let $i = 0; $i < 23; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
117
|
-
$[0] = "
|
|
114
|
+
$[0] = "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b";
|
|
118
115
|
}
|
|
119
116
|
const { blockId, mode, showAddBlockTop, showAddBlockBottom } = t0;
|
|
120
|
-
const previewSource = useSelector(previewStore,
|
|
117
|
+
const previewSource = useSelector(previewStore, selectPreviewSource);
|
|
121
118
|
let t1;
|
|
122
119
|
if ($[1] !== blockId || $[2] !== previewSource) {
|
|
123
120
|
t1 = blockQueries.get(blockId, previewSource);
|
|
@@ -191,8 +188,8 @@ const BlockRenderer = (t0) => {
|
|
|
191
188
|
};
|
|
192
189
|
const PageContent = () => {
|
|
193
190
|
const pageData = usePreviewedPage();
|
|
194
|
-
const { pageBlocks, beforeBlocks, afterBlocks, layoutFiles, layoutItems } = usePageBlocks(pageData, useSelector(previewStore,
|
|
195
|
-
const peekedBlockPosition = useSelector(previewStore, (
|
|
191
|
+
const { pageBlocks, beforeBlocks, afterBlocks, layoutFiles, layoutItems } = usePageBlocks(pageData, useSelector(previewStore, selectPreviewSource));
|
|
192
|
+
const peekedBlockPosition = useSelector(previewStore, (state) => state.context.peekedBlockPosition);
|
|
196
193
|
const displayedPositionRef = React.useRef(null);
|
|
197
194
|
if (peekedBlockPosition !== null) displayedPositionRef.current = peekedBlockPosition;
|
|
198
195
|
const effectivePosition = peekedBlockPosition ?? displayedPositionRef.current;
|
|
@@ -257,9 +254,9 @@ const PageContent = () => {
|
|
|
257
254
|
};
|
|
258
255
|
function useHydrateDraftCache() {
|
|
259
256
|
const $ = c(7);
|
|
260
|
-
if ($[0] !== "
|
|
257
|
+
if ($[0] !== "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b") {
|
|
261
258
|
for (let $i = 0; $i < 7; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
262
|
-
$[0] = "
|
|
259
|
+
$[0] = "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b";
|
|
263
260
|
}
|
|
264
261
|
const isAuthenticated = useIsAuthenticated();
|
|
265
262
|
const queryClient = useQueryClient();
|
|
@@ -284,7 +281,7 @@ function useHydrateDraftCache() {
|
|
|
284
281
|
projectName: data.projectName,
|
|
285
282
|
project: data.project
|
|
286
283
|
});
|
|
287
|
-
}).catch(
|
|
284
|
+
}).catch(_temp2);
|
|
288
285
|
return () => {
|
|
289
286
|
cancelled = true;
|
|
290
287
|
};
|
|
@@ -307,12 +304,12 @@ function useHydrateDraftCache() {
|
|
|
307
304
|
}
|
|
308
305
|
React.useEffect(t0, t1);
|
|
309
306
|
}
|
|
310
|
-
function
|
|
307
|
+
function _temp2() {}
|
|
311
308
|
const CamoxPreview = (t0) => {
|
|
312
309
|
const $ = c(4);
|
|
313
|
-
if ($[0] !== "
|
|
310
|
+
if ($[0] !== "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b") {
|
|
314
311
|
for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
315
|
-
$[0] = "
|
|
312
|
+
$[0] = "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b";
|
|
316
313
|
}
|
|
317
314
|
const { children } = t0;
|
|
318
315
|
const pageData = usePreviewedPage();
|
|
@@ -331,20 +328,20 @@ const CamoxPreview = (t0) => {
|
|
|
331
328
|
};
|
|
332
329
|
/** Studio chrome is shared; only curated previews require a Camox page record. */
|
|
333
330
|
const PreviewShell = (t0) => {
|
|
334
|
-
const $ = c(
|
|
335
|
-
if ($[0] !== "
|
|
336
|
-
for (let $i = 0; $i <
|
|
337
|
-
$[0] = "
|
|
331
|
+
const $ = c(59);
|
|
332
|
+
if ($[0] !== "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b") {
|
|
333
|
+
for (let $i = 0; $i < 59; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
334
|
+
$[0] = "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b";
|
|
338
335
|
}
|
|
339
336
|
const { children, pageData, hasLiveVersion: t1, derivedLayoutId, derivedLayout } = t0;
|
|
340
337
|
const hasLiveVersion = t1 === void 0 ? false : t1;
|
|
341
338
|
const isAuthenticated = useIsAuthenticated();
|
|
342
339
|
const isMobileStudio = useIsMobileStudio();
|
|
343
340
|
const sharedChrome = React.useContext(SharedChromeContext);
|
|
344
|
-
const isEditMode = useSelector(previewStore,
|
|
345
|
-
const isToolbarHidden = useSelector(previewStore,
|
|
346
|
-
const isAddBlockSidebarOpen = useSelector(previewStore,
|
|
347
|
-
const previewSource = useSelector(previewStore,
|
|
341
|
+
const isEditMode = useSelector(previewStore, selectIsEditMode);
|
|
342
|
+
const isToolbarHidden = useSelector(previewStore, _temp3);
|
|
343
|
+
const isAddBlockSidebarOpen = useSelector(previewStore, _temp4);
|
|
344
|
+
const previewSource = useSelector(previewStore, selectPreviewSource);
|
|
348
345
|
const hasLiveCheckpoint = pageData ? pageData.page.livePublishedCheckpointId != null : hasLiveVersion;
|
|
349
346
|
let t2;
|
|
350
347
|
let t3;
|
|
@@ -379,7 +376,7 @@ const PreviewShell = (t0) => {
|
|
|
379
376
|
],
|
|
380
377
|
groupLabel: "Preview",
|
|
381
378
|
checkIfAvailable: () => isAuthenticated && isEditMode,
|
|
382
|
-
execute:
|
|
379
|
+
execute: _temp5,
|
|
383
380
|
shortcut: EDIT_MODE_SHORTCUT
|
|
384
381
|
},
|
|
385
382
|
{
|
|
@@ -392,7 +389,7 @@ const PreviewShell = (t0) => {
|
|
|
392
389
|
],
|
|
393
390
|
groupLabel: "Preview",
|
|
394
391
|
checkIfAvailable: () => isAuthenticated && !isEditMode && !isMobileStudio,
|
|
395
|
-
execute:
|
|
392
|
+
execute: _temp6,
|
|
396
393
|
shortcut: EDIT_MODE_SHORTCUT
|
|
397
394
|
},
|
|
398
395
|
{
|
|
@@ -405,7 +402,7 @@ const PreviewShell = (t0) => {
|
|
|
405
402
|
],
|
|
406
403
|
groupLabel: "Preview",
|
|
407
404
|
checkIfAvailable: () => isAuthenticated && previewSource === "draft" && hasLiveCheckpoint,
|
|
408
|
-
execute:
|
|
405
|
+
execute: _temp7,
|
|
409
406
|
shortcut: {
|
|
410
407
|
key: "d",
|
|
411
408
|
withAlt: true
|
|
@@ -421,7 +418,7 @@ const PreviewShell = (t0) => {
|
|
|
421
418
|
],
|
|
422
419
|
groupLabel: "Preview",
|
|
423
420
|
checkIfAvailable: () => isAuthenticated && previewSource === "live",
|
|
424
|
-
execute:
|
|
421
|
+
execute: _temp8,
|
|
425
422
|
shortcut: {
|
|
426
423
|
key: "d",
|
|
427
424
|
withAlt: true
|
|
@@ -432,8 +429,8 @@ const PreviewShell = (t0) => {
|
|
|
432
429
|
label: "Clear selection",
|
|
433
430
|
aliases: ["Deselect", "Unselect"],
|
|
434
431
|
groupLabel: "Preview",
|
|
435
|
-
checkIfAvailable:
|
|
436
|
-
execute:
|
|
432
|
+
checkIfAvailable: _temp9,
|
|
433
|
+
execute: _temp0,
|
|
437
434
|
shortcut: { key: "Escape" }
|
|
438
435
|
}
|
|
439
436
|
];
|
|
@@ -444,7 +441,7 @@ const PreviewShell = (t0) => {
|
|
|
444
441
|
return () => {
|
|
445
442
|
actionsStore.send({
|
|
446
443
|
type: "unregisterManyActions",
|
|
447
|
-
ids: actions.map(
|
|
444
|
+
ids: actions.map(_temp1)
|
|
448
445
|
});
|
|
449
446
|
};
|
|
450
447
|
};
|
|
@@ -492,7 +489,7 @@ const PreviewShell = (t0) => {
|
|
|
492
489
|
children: [/* @__PURE__ */ jsx(Navbar, { isPreview: true }), pageData && isAddBlockSidebarOpen && /* @__PURE__ */ jsx("div", {
|
|
493
490
|
className: "absolute inset-0 z-20",
|
|
494
491
|
style: { background: "rgba(0, 0, 0, 0.66)" },
|
|
495
|
-
onClick:
|
|
492
|
+
onClick: _temp10
|
|
496
493
|
})]
|
|
497
494
|
});
|
|
498
495
|
$[16] = isAddBlockSidebarOpen;
|
|
@@ -520,101 +517,101 @@ const PreviewShell = (t0) => {
|
|
|
520
517
|
} else t10 = $[27];
|
|
521
518
|
const t11 = pageData?.page;
|
|
522
519
|
const t12 = pageData?.projectName;
|
|
523
|
-
const t13 = pageData?.page.
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
520
|
+
const t13 = pageData?.page.id;
|
|
521
|
+
const t14 = pageData?.page.status;
|
|
522
|
+
let t15;
|
|
523
|
+
if ($[28] !== hasLiveCheckpoint || $[29] !== t13 || $[30] !== t14) {
|
|
524
|
+
t15 = {
|
|
525
|
+
pageId: t13,
|
|
526
|
+
pageStatus: t14,
|
|
528
527
|
hasLiveVersion: hasLiveCheckpoint
|
|
529
528
|
};
|
|
530
529
|
$[28] = hasLiveCheckpoint;
|
|
531
530
|
$[29] = t13;
|
|
532
531
|
$[30] = t14;
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
if ($[31] !== isEditMode || $[32] !== isMobileStudio) {
|
|
536
|
-
t15 = !isMobileStudio && isEditMode && /* @__PURE__ */ jsx("div", { style: {
|
|
537
|
-
height: "80px",
|
|
538
|
-
background: "transparent"
|
|
539
|
-
} });
|
|
540
|
-
$[31] = isEditMode;
|
|
541
|
-
$[32] = isMobileStudio;
|
|
542
|
-
$[33] = t15;
|
|
543
|
-
} else t15 = $[33];
|
|
532
|
+
$[31] = t15;
|
|
533
|
+
} else t15 = $[31];
|
|
544
534
|
let t16;
|
|
545
|
-
if ($[
|
|
546
|
-
t16 = /* @__PURE__ */
|
|
535
|
+
if ($[32] !== isEditMode || $[33] !== isMobileStudio) {
|
|
536
|
+
t16 = !isMobileStudio && isEditMode && /* @__PURE__ */ jsx(PreviewToolbarSpacer, {});
|
|
537
|
+
$[32] = isEditMode;
|
|
538
|
+
$[33] = isMobileStudio;
|
|
539
|
+
$[34] = t16;
|
|
540
|
+
} else t16 = $[34];
|
|
541
|
+
let t17;
|
|
542
|
+
if ($[35] !== children || $[36] !== isMobileStudio || $[37] !== t11 || $[38] !== t12 || $[39] !== t15 || $[40] !== t16) {
|
|
543
|
+
t17 = /* @__PURE__ */ jsxs(PreviewPanel, {
|
|
547
544
|
isMobileExperience: isMobileStudio,
|
|
548
545
|
page: t11,
|
|
549
546
|
projectName: t12,
|
|
550
|
-
toolbarProps:
|
|
551
|
-
children: [children,
|
|
547
|
+
toolbarProps: t15,
|
|
548
|
+
children: [children, t16]
|
|
552
549
|
});
|
|
553
|
-
$[
|
|
554
|
-
$[
|
|
555
|
-
$[
|
|
556
|
-
$[
|
|
557
|
-
$[38] = t14;
|
|
550
|
+
$[35] = children;
|
|
551
|
+
$[36] = isMobileStudio;
|
|
552
|
+
$[37] = t11;
|
|
553
|
+
$[38] = t12;
|
|
558
554
|
$[39] = t15;
|
|
559
555
|
$[40] = t16;
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
556
|
+
$[41] = t17;
|
|
557
|
+
} else t17 = $[41];
|
|
558
|
+
let t18;
|
|
559
|
+
if ($[42] !== derivedLayoutId || $[43] !== isEditMode || $[44] !== isMobileStudio || $[45] !== pageData?.page) {
|
|
560
|
+
t18 = !isMobileStudio && isEditMode && /* @__PURE__ */ jsx(RightSidebar, {
|
|
564
561
|
pageId: pageData?.page.id,
|
|
565
562
|
derivedLayoutId
|
|
566
563
|
});
|
|
567
|
-
$[
|
|
568
|
-
$[
|
|
569
|
-
$[
|
|
570
|
-
$[
|
|
571
|
-
$[
|
|
572
|
-
} else
|
|
573
|
-
let
|
|
574
|
-
if ($[
|
|
575
|
-
|
|
564
|
+
$[42] = derivedLayoutId;
|
|
565
|
+
$[43] = isEditMode;
|
|
566
|
+
$[44] = isMobileStudio;
|
|
567
|
+
$[45] = pageData?.page;
|
|
568
|
+
$[46] = t18;
|
|
569
|
+
} else t18 = $[46];
|
|
570
|
+
let t19;
|
|
571
|
+
if ($[47] !== t10 || $[48] !== t17 || $[49] !== t18) {
|
|
572
|
+
t19 = /* @__PURE__ */ jsxs("div", {
|
|
576
573
|
className: "flex h-full flex-row items-stretch",
|
|
577
574
|
children: [
|
|
578
575
|
t10,
|
|
579
|
-
|
|
580
|
-
|
|
576
|
+
t17,
|
|
577
|
+
t18
|
|
581
578
|
]
|
|
582
579
|
});
|
|
583
|
-
$[
|
|
584
|
-
$[47] = t16;
|
|
580
|
+
$[47] = t10;
|
|
585
581
|
$[48] = t17;
|
|
586
582
|
$[49] = t18;
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
if ($[50] !== isEditMode || $[51] !== isMobileStudio) {
|
|
590
|
-
t19 = (isMobileStudio || isEditMode) && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(CreatePageModal, {}), /* @__PURE__ */ jsx(DraftSwitchDialog, {})] });
|
|
591
|
-
$[50] = isEditMode;
|
|
592
|
-
$[51] = isMobileStudio;
|
|
593
|
-
$[52] = t19;
|
|
594
|
-
} else t19 = $[52];
|
|
583
|
+
$[50] = t19;
|
|
584
|
+
} else t19 = $[50];
|
|
595
585
|
let t20;
|
|
596
|
-
if ($[
|
|
597
|
-
t20 = /* @__PURE__ */
|
|
586
|
+
if ($[51] !== isEditMode || $[52] !== isMobileStudio) {
|
|
587
|
+
t20 = (isMobileStudio || isEditMode) && /* @__PURE__ */ jsx(CreatePageModal, {});
|
|
588
|
+
$[51] = isEditMode;
|
|
589
|
+
$[52] = isMobileStudio;
|
|
590
|
+
$[53] = t20;
|
|
591
|
+
} else t20 = $[53];
|
|
592
|
+
let t21;
|
|
593
|
+
if ($[54] !== t19 || $[55] !== t20 || $[56] !== t8 || $[57] !== t9) {
|
|
594
|
+
t21 = /* @__PURE__ */ jsxs("div", {
|
|
598
595
|
className: t8,
|
|
599
596
|
children: [
|
|
600
597
|
t9,
|
|
601
|
-
|
|
602
|
-
|
|
598
|
+
t19,
|
|
599
|
+
t20
|
|
603
600
|
]
|
|
604
601
|
});
|
|
605
|
-
$[53] = t18;
|
|
606
602
|
$[54] = t19;
|
|
607
|
-
$[55] =
|
|
608
|
-
$[56] =
|
|
609
|
-
$[57] =
|
|
610
|
-
|
|
611
|
-
|
|
603
|
+
$[55] = t20;
|
|
604
|
+
$[56] = t8;
|
|
605
|
+
$[57] = t9;
|
|
606
|
+
$[58] = t21;
|
|
607
|
+
} else t21 = $[58];
|
|
608
|
+
return t21;
|
|
612
609
|
};
|
|
613
610
|
function usePreviewPagesActions() {
|
|
614
611
|
const $ = c(13);
|
|
615
|
-
if ($[0] !== "
|
|
612
|
+
if ($[0] !== "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b") {
|
|
616
613
|
for (let $i = 0; $i < 13; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
617
|
-
$[0] = "
|
|
614
|
+
$[0] = "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b";
|
|
618
615
|
}
|
|
619
616
|
const navigate = useNavigate();
|
|
620
617
|
const { pathname } = useLocation();
|
|
@@ -655,8 +652,8 @@ function usePreviewPagesActions() {
|
|
|
655
652
|
label: "Create page",
|
|
656
653
|
aliases: ["New page", "Add page"],
|
|
657
654
|
groupLabel: "Preview",
|
|
658
|
-
checkIfAvailable:
|
|
659
|
-
execute:
|
|
655
|
+
checkIfAvailable: _temp11,
|
|
656
|
+
execute: _temp12
|
|
660
657
|
},
|
|
661
658
|
{
|
|
662
659
|
id: "edit-current-page",
|
|
@@ -687,14 +684,14 @@ function usePreviewPagesActions() {
|
|
|
687
684
|
groupLabel: "Preview",
|
|
688
685
|
checkIfAvailable: () => !!pages,
|
|
689
686
|
hasChildren: true,
|
|
690
|
-
execute:
|
|
687
|
+
execute: _temp13
|
|
691
688
|
},
|
|
692
689
|
...pages ? pages.map((page) => ({
|
|
693
690
|
id: `go-to-page-${page.id}`,
|
|
694
691
|
parentActionId: "go-to-page",
|
|
695
692
|
label: `Go to "${page.nickname}"`,
|
|
696
693
|
groupLabel: "Preview",
|
|
697
|
-
checkIfAvailable:
|
|
694
|
+
checkIfAvailable: _temp14,
|
|
698
695
|
execute: () => navigate({ to: page.fullPath })
|
|
699
696
|
})) : []
|
|
700
697
|
];
|
|
@@ -705,7 +702,7 @@ function usePreviewPagesActions() {
|
|
|
705
702
|
return () => {
|
|
706
703
|
actionsStore.send({
|
|
707
704
|
type: "unregisterManyActions",
|
|
708
|
-
ids: actions.map(
|
|
705
|
+
ids: actions.map(_temp15)
|
|
709
706
|
});
|
|
710
707
|
};
|
|
711
708
|
};
|
|
@@ -725,62 +722,51 @@ function usePreviewPagesActions() {
|
|
|
725
722
|
}
|
|
726
723
|
React.useEffect(t4, t5);
|
|
727
724
|
}
|
|
728
|
-
function
|
|
725
|
+
function _temp15(a) {
|
|
729
726
|
return a.id;
|
|
730
727
|
}
|
|
731
|
-
function
|
|
728
|
+
function _temp14() {
|
|
732
729
|
return true;
|
|
733
730
|
}
|
|
734
|
-
function
|
|
735
|
-
function
|
|
731
|
+
function _temp13() {}
|
|
732
|
+
function _temp12() {
|
|
736
733
|
return previewStore.send({ type: "openCreatePageModal" });
|
|
737
734
|
}
|
|
738
|
-
function
|
|
735
|
+
function _temp11() {
|
|
739
736
|
return true;
|
|
740
737
|
}
|
|
741
738
|
function _temp3(state) {
|
|
742
|
-
return state.context.
|
|
739
|
+
return state.context.isToolbarHidden;
|
|
743
740
|
}
|
|
744
|
-
function
|
|
745
|
-
return
|
|
741
|
+
function _temp4(state_0) {
|
|
742
|
+
return state_0.context.isAddBlockSidebarOpen;
|
|
746
743
|
}
|
|
747
|
-
function
|
|
748
|
-
return state_0.context.isToolbarHidden;
|
|
749
|
-
}
|
|
750
|
-
function _temp7(state_1) {
|
|
751
|
-
return state_1.context.isAddBlockSidebarOpen;
|
|
752
|
-
}
|
|
753
|
-
function _temp8(state_2) {
|
|
754
|
-
return state_2.context.previewSource;
|
|
755
|
-
}
|
|
756
|
-
function _temp9() {
|
|
744
|
+
function _temp5() {
|
|
757
745
|
return previewStore.send({ type: "exitEditMode" });
|
|
758
746
|
}
|
|
759
|
-
function
|
|
747
|
+
function _temp6() {
|
|
760
748
|
return previewStore.send({ type: "enterEditMode" });
|
|
761
749
|
}
|
|
762
|
-
function
|
|
763
|
-
return previewStore.send({
|
|
764
|
-
type: "setPreviewSource",
|
|
765
|
-
source: "live"
|
|
766
|
-
});
|
|
750
|
+
function _temp7() {
|
|
751
|
+
return previewStore.send({ type: "viewLivePage" });
|
|
767
752
|
}
|
|
768
|
-
function
|
|
769
|
-
return previewStore.send({
|
|
770
|
-
type: "setPreviewSource",
|
|
771
|
-
source: "draft"
|
|
772
|
-
});
|
|
753
|
+
function _temp8() {
|
|
754
|
+
return previewStore.send({ type: "viewDraftPage" });
|
|
773
755
|
}
|
|
774
|
-
function
|
|
756
|
+
function _temp9() {
|
|
775
757
|
return true;
|
|
776
758
|
}
|
|
777
|
-
function
|
|
759
|
+
function _temp0() {
|
|
760
|
+
previewStore.send({
|
|
761
|
+
type: "setCommentMode",
|
|
762
|
+
enabled: false
|
|
763
|
+
});
|
|
778
764
|
previewStore.send({ type: "clearSelection" });
|
|
779
765
|
}
|
|
780
|
-
function
|
|
766
|
+
function _temp1(a) {
|
|
781
767
|
return a.id;
|
|
782
768
|
}
|
|
783
|
-
function
|
|
769
|
+
function _temp10() {
|
|
784
770
|
return previewStore.send({ type: "closeAddBlockSidebar" });
|
|
785
771
|
}
|
|
786
772
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useIsAuthenticated, useProjectSlug } from "../../lib/auth.js";
|
|
2
2
|
import { getApiClient } from "../../lib/api-client.js";
|
|
3
3
|
import { seedBlockCaches } from "../../lib/normalized-data.js";
|
|
4
|
-
import { previewStore } from "./previewStore.js";
|
|
4
|
+
import { previewStore, selectPreviewSource } from "./previewStore.js";
|
|
5
5
|
import { PreviewShell } from "./CamoxPreview.js";
|
|
6
6
|
import { DerivedPageContent } from "../page/DerivedPageContent.js";
|
|
7
7
|
import { c } from "react/compiler-runtime";
|
|
@@ -13,9 +13,9 @@ import { queryKeys } from "@camox/api-contract/query-keys";
|
|
|
13
13
|
//#region src/features/preview/DerivedPreview.tsx
|
|
14
14
|
function DerivedPreview(props) {
|
|
15
15
|
const $ = c(5);
|
|
16
|
-
if ($[0] !== "
|
|
16
|
+
if ($[0] !== "b948df7cf2e5c6cd498f94bb7b9f2055507563755e12fa92cc29001f25ecad40") {
|
|
17
17
|
for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
18
|
-
$[0] = "
|
|
18
|
+
$[0] = "b948df7cf2e5c6cd498f94bb7b9f2055507563755e12fa92cc29001f25ecad40";
|
|
19
19
|
}
|
|
20
20
|
if (!useIsAuthenticated()) {
|
|
21
21
|
let t0;
|
|
@@ -36,12 +36,12 @@ function DerivedPreview(props) {
|
|
|
36
36
|
}
|
|
37
37
|
function AuthenticatedDerivedPreview(t0) {
|
|
38
38
|
const $ = c(26);
|
|
39
|
-
if ($[0] !== "
|
|
39
|
+
if ($[0] !== "b948df7cf2e5c6cd498f94bb7b9f2055507563755e12fa92cc29001f25ecad40") {
|
|
40
40
|
for (let $i = 0; $i < 26; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
41
|
-
$[0] = "
|
|
41
|
+
$[0] = "b948df7cf2e5c6cd498f94bb7b9f2055507563755e12fa92cc29001f25ecad40";
|
|
42
42
|
}
|
|
43
43
|
const { camoxApp, derived, source } = t0;
|
|
44
|
-
const previewSource = useSelector(previewStore,
|
|
44
|
+
const previewSource = useSelector(previewStore, selectPreviewSource);
|
|
45
45
|
const projectSlug = useProjectSlug();
|
|
46
46
|
const queryClient = useQueryClient();
|
|
47
47
|
let t1;
|
|
@@ -129,9 +129,6 @@ function AuthenticatedDerivedPreview(t0) {
|
|
|
129
129
|
} else t8 = $[25];
|
|
130
130
|
return t8;
|
|
131
131
|
}
|
|
132
|
-
function _temp(state) {
|
|
133
|
-
return state.context.previewSource;
|
|
134
|
-
}
|
|
135
132
|
|
|
136
133
|
//#endregion
|
|
137
134
|
export { DerivedPreview };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/features/preview/commentsEnabled.ts
|
|
2
|
+
/** Opt-in prototype flag, replaced by the Camox Vite plugin in both client and SSR builds. */
|
|
3
|
+
function areCommentsEnabled() {
|
|
4
|
+
return typeof __CAMOX_ENABLE_COMMENTS__ !== "undefined" && __CAMOX_ENABLE_COMMENTS__;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
export { areCommentsEnabled };
|