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.
Files changed (60) hide show
  1. package/dist/core/components/lexical/SidebarLexicalEditor.js +42 -39
  2. package/dist/core/createApp.d.ts +16 -2
  3. package/dist/core/createBlock.js +11 -25
  4. package/dist/core/editing/BlockEditingRuntime.js +4 -4
  5. package/dist/core/editing/CompleteBlockEditingRuntime.js +5 -5
  6. package/dist/core/editing/createEditableBlock.d.ts +8 -1
  7. package/dist/core/editing/createEditableBlock.js +684 -644
  8. package/dist/core/hooks/useIsEditable.js +4 -7
  9. package/dist/core/hooks/useOverlayState.js +11 -0
  10. package/dist/core/hooks/useRequireDraftSource.js +7 -11
  11. package/dist/core/lib/fieldTypes.js +5 -5
  12. package/dist/core/lib/lexicalState.js +17 -1
  13. package/dist/features/preview/CamoxPreview.js +123 -137
  14. package/dist/features/preview/DerivedPreview.js +6 -9
  15. package/dist/features/preview/commentsEnabled.js +8 -0
  16. package/dist/features/preview/components/AddBlockSidebar.js +79 -89
  17. package/dist/features/preview/components/AssetLightbox.js +4 -11
  18. package/dist/features/preview/components/AttachedComments.js +194 -0
  19. package/dist/features/preview/components/BlockActionsPopover.js +19 -70
  20. package/dist/features/preview/components/CommentHeader.js +122 -0
  21. package/dist/features/preview/components/CommentSidebar.js +29 -0
  22. package/dist/features/preview/components/CommentTargetQuote.js +166 -0
  23. package/dist/features/preview/components/CreatePageModal.js +2 -8
  24. package/dist/features/preview/components/DerivedLayoutSidebar.js +4 -7
  25. package/dist/features/preview/components/ItemFieldsEditor.js +275 -204
  26. package/dist/features/preview/components/LeftSidebar.js +18 -18
  27. package/dist/features/preview/components/LinkFieldEditor.js +3 -4
  28. package/dist/features/preview/components/MobilePreviewDrawer.js +3 -3
  29. package/dist/features/preview/components/OverlayTracker.js +14 -20
  30. package/dist/features/preview/components/Overlays.js +28 -40
  31. package/dist/features/preview/components/PageEditorSidebar.js +231 -241
  32. package/dist/features/preview/components/PageInfoSidebar.js +126 -157
  33. package/dist/features/preview/components/PagePicker.js +13 -8
  34. package/dist/features/preview/components/PageTree.js +255 -319
  35. package/dist/features/preview/components/PreviewComments.js +56 -0
  36. package/dist/features/preview/components/PreviewPanel.js +149 -107
  37. package/dist/features/preview/components/PreviewToolbar.js +292 -246
  38. package/dist/features/preview/components/PreviewToolbarSpacer.js +43 -0
  39. package/dist/features/preview/components/PublicationRow.js +11 -24
  40. package/dist/features/preview/components/RightSidebar.js +14 -11
  41. package/dist/features/preview/components/SidebarSection.js +121 -0
  42. package/dist/features/preview/previewCommentsStore.js +115 -0
  43. package/dist/features/preview/previewSelection.js +75 -0
  44. package/dist/features/preview/previewStore.js +32 -63
  45. package/dist/features/provider/AuthenticatedCamoxProvider.js +46 -34
  46. package/dist/features/provider/components/CommandPalette.js +142 -58
  47. package/dist/features/provider/useAdminShortcuts.js +20 -8
  48. package/dist/features/routes/pageRuntime.js +0 -6
  49. package/dist/features/runtime/RuntimeChrome.js +102 -87
  50. package/dist/features/studio/CamoxStudio.js +30 -50
  51. package/dist/features/studio/components/UserButton.js +4 -4
  52. package/dist/features/vite/runtimeDev.js +4 -1
  53. package/dist/features/vite/vite.d.ts +3 -2
  54. package/dist/features/vite/vite.js +9 -5
  55. package/dist/hooks/use-file-upload.js +0 -2
  56. package/dist/studio.css +1 -1
  57. package/package.json +5 -7
  58. package/dist/features/preview/components/DraftSwitchDialog.js +0 -66
  59. package/dist/lib/telemetry-client.js +0 -66
  60. 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] !== "a3e376179cf3461f650a645c5d9591b7c0b2bd69400f81ba76076063ea10dffc") {
9
+ if ($[0] !== "baeaba7613c819c1f4460b64af1c246a057a26cf699e41daca4193d0ee512f1c") {
10
10
  for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
11
- $[0] = "a3e376179cf3461f650a645c5d9591b7c0b2bd69400f81ba76076063ea10dffc";
11
+ $[0] = "baeaba7613c819c1f4460b64af1c246a057a26cf699e41daca4193d0ee512f1c";
12
12
  }
13
13
  const isAuthenticated = useIsAuthenticated();
14
- const isEditMode = useSelector(previewStore, _temp);
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
- * Gate any edit attempt on the current preview source. If the studio is
7
- * previewing 'draft', `requireDraft()` returns true and the caller proceeds.
8
- * Otherwise it opens the "Switch to draft to edit?" dialog and returns false
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] !== "0362e577777f438ffefe38cac1aa50ad433841f5f7cbde91e17cf0313273dbef") {
12
+ if ($[0] !== "cb874573187dc3b9520288b70786314b287b85d7bd338855d2b28db5ee7c09c2") {
15
13
  for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
16
- $[0] = "0362e577777f438ffefe38cac1aa50ad433841f5f7cbde91e17cf0313273dbef";
14
+ $[0] = "cb874573187dc3b9520288b70786314b287b85d7bd338855d2b28db5ee7c09c2";
17
15
  }
18
16
  return _temp;
19
17
  }
20
18
  function _temp() {
21
- if (previewStore.getSnapshot().context.previewSource === "draft") return true;
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: false },
4
- Repeater: { hasOwnView: false },
5
- Enum: { hasOwnView: false },
6
- Boolean: { hasOwnView: false },
7
- Embed: { hasOwnView: false },
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] !== "24b649dd4428fd20f053be5828fab17890ad150c780fc5ba746c0c95ac30dd2a") {
39
+ if ($[0] !== "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b") {
40
40
  for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
41
- $[0] = "24b649dd4428fd20f053be5828fab17890ad150c780fc5ba746c0c95ac30dd2a";
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] !== "24b649dd4428fd20f053be5828fab17890ad150c780fc5ba746c0c95ac30dd2a") {
74
+ if ($[0] !== "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b") {
75
75
  for (let $i = 0; $i < 11; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
76
- $[0] = "24b649dd4428fd20f053be5828fab17890ad150c780fc5ba746c0c95ac30dd2a";
76
+ $[0] = "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b";
77
77
  }
78
78
  const { pathname } = useLocation();
79
79
  const projectSlug = useProjectSlug();
80
- const previewSource = useSelector(previewStore, _temp2);
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] !== "24b649dd4428fd20f053be5828fab17890ad150c780fc5ba746c0c95ac30dd2a") {
112
+ if ($[0] !== "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b") {
116
113
  for (let $i = 0; $i < 23; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
117
- $[0] = "24b649dd4428fd20f053be5828fab17890ad150c780fc5ba746c0c95ac30dd2a";
114
+ $[0] = "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b";
118
115
  }
119
116
  const { blockId, mode, showAddBlockTop, showAddBlockBottom } = t0;
120
- const previewSource = useSelector(previewStore, _temp3);
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, (state) => state.context.previewSource));
195
- const peekedBlockPosition = useSelector(previewStore, (state_0) => state_0.context.peekedBlockPosition);
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] !== "24b649dd4428fd20f053be5828fab17890ad150c780fc5ba746c0c95ac30dd2a") {
257
+ if ($[0] !== "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b") {
261
258
  for (let $i = 0; $i < 7; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
262
- $[0] = "24b649dd4428fd20f053be5828fab17890ad150c780fc5ba746c0c95ac30dd2a";
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(_temp4);
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 _temp4() {}
307
+ function _temp2() {}
311
308
  const CamoxPreview = (t0) => {
312
309
  const $ = c(4);
313
- if ($[0] !== "24b649dd4428fd20f053be5828fab17890ad150c780fc5ba746c0c95ac30dd2a") {
310
+ if ($[0] !== "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b") {
314
311
  for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
315
- $[0] = "24b649dd4428fd20f053be5828fab17890ad150c780fc5ba746c0c95ac30dd2a";
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(58);
335
- if ($[0] !== "24b649dd4428fd20f053be5828fab17890ad150c780fc5ba746c0c95ac30dd2a") {
336
- for (let $i = 0; $i < 58; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
337
- $[0] = "24b649dd4428fd20f053be5828fab17890ad150c780fc5ba746c0c95ac30dd2a";
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, _temp5);
345
- const isToolbarHidden = useSelector(previewStore, _temp6);
346
- const isAddBlockSidebarOpen = useSelector(previewStore, _temp7);
347
- const previewSource = useSelector(previewStore, _temp8);
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: _temp9,
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: _temp0,
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: _temp1,
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: _temp10,
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: _temp11,
436
- execute: _temp12,
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(_temp13)
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: _temp14
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.status;
524
- let t14;
525
- if ($[28] !== hasLiveCheckpoint || $[29] !== t13) {
526
- t14 = {
527
- pageStatus: t13,
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
- } else t14 = $[30];
534
- let t15;
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 ($[34] !== children || $[35] !== isMobileStudio || $[36] !== t11 || $[37] !== t12 || $[38] !== t14 || $[39] !== t15) {
546
- t16 = /* @__PURE__ */ jsxs(PreviewPanel, {
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: t14,
551
- children: [children, t15]
547
+ toolbarProps: t15,
548
+ children: [children, t16]
552
549
  });
553
- $[34] = children;
554
- $[35] = isMobileStudio;
555
- $[36] = t11;
556
- $[37] = t12;
557
- $[38] = t14;
550
+ $[35] = children;
551
+ $[36] = isMobileStudio;
552
+ $[37] = t11;
553
+ $[38] = t12;
558
554
  $[39] = t15;
559
555
  $[40] = t16;
560
- } else t16 = $[40];
561
- let t17;
562
- if ($[41] !== derivedLayoutId || $[42] !== isEditMode || $[43] !== isMobileStudio || $[44] !== pageData?.page) {
563
- t17 = !isMobileStudio && isEditMode && /* @__PURE__ */ jsx(RightSidebar, {
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
- $[41] = derivedLayoutId;
568
- $[42] = isEditMode;
569
- $[43] = isMobileStudio;
570
- $[44] = pageData?.page;
571
- $[45] = t17;
572
- } else t17 = $[45];
573
- let t18;
574
- if ($[46] !== t10 || $[47] !== t16 || $[48] !== t17) {
575
- t18 = /* @__PURE__ */ jsxs("div", {
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
- t16,
580
- t17
576
+ t17,
577
+ t18
581
578
  ]
582
579
  });
583
- $[46] = t10;
584
- $[47] = t16;
580
+ $[47] = t10;
585
581
  $[48] = t17;
586
582
  $[49] = t18;
587
- } else t18 = $[49];
588
- let t19;
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 ($[53] !== t18 || $[54] !== t19 || $[55] !== t8 || $[56] !== t9) {
597
- t20 = /* @__PURE__ */ jsxs("div", {
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
- t18,
602
- t19
598
+ t19,
599
+ t20
603
600
  ]
604
601
  });
605
- $[53] = t18;
606
602
  $[54] = t19;
607
- $[55] = t8;
608
- $[56] = t9;
609
- $[57] = t20;
610
- } else t20 = $[57];
611
- return t20;
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] !== "24b649dd4428fd20f053be5828fab17890ad150c780fc5ba746c0c95ac30dd2a") {
612
+ if ($[0] !== "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b") {
616
613
  for (let $i = 0; $i < 13; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
617
- $[0] = "24b649dd4428fd20f053be5828fab17890ad150c780fc5ba746c0c95ac30dd2a";
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: _temp15,
659
- execute: _temp16
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: _temp17
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: _temp18,
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(_temp19)
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 _temp19(a) {
725
+ function _temp15(a) {
729
726
  return a.id;
730
727
  }
731
- function _temp18() {
728
+ function _temp14() {
732
729
  return true;
733
730
  }
734
- function _temp17() {}
735
- function _temp16() {
731
+ function _temp13() {}
732
+ function _temp12() {
736
733
  return previewStore.send({ type: "openCreatePageModal" });
737
734
  }
738
- function _temp15() {
735
+ function _temp11() {
739
736
  return true;
740
737
  }
741
738
  function _temp3(state) {
742
- return state.context.previewSource;
739
+ return state.context.isToolbarHidden;
743
740
  }
744
- function _temp5(state) {
745
- return state.context.isEditMode;
741
+ function _temp4(state_0) {
742
+ return state_0.context.isAddBlockSidebarOpen;
746
743
  }
747
- function _temp6(state_0) {
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 _temp0() {
747
+ function _temp6() {
760
748
  return previewStore.send({ type: "enterEditMode" });
761
749
  }
762
- function _temp1() {
763
- return previewStore.send({
764
- type: "setPreviewSource",
765
- source: "live"
766
- });
750
+ function _temp7() {
751
+ return previewStore.send({ type: "viewLivePage" });
767
752
  }
768
- function _temp10() {
769
- return previewStore.send({
770
- type: "setPreviewSource",
771
- source: "draft"
772
- });
753
+ function _temp8() {
754
+ return previewStore.send({ type: "viewDraftPage" });
773
755
  }
774
- function _temp11() {
756
+ function _temp9() {
775
757
  return true;
776
758
  }
777
- function _temp12() {
759
+ function _temp0() {
760
+ previewStore.send({
761
+ type: "setCommentMode",
762
+ enabled: false
763
+ });
778
764
  previewStore.send({ type: "clearSelection" });
779
765
  }
780
- function _temp13(a) {
766
+ function _temp1(a) {
781
767
  return a.id;
782
768
  }
783
- function _temp14() {
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] !== "261aac3044f545b5b17e0449fc914e6311b0108f3d16c419141b242a12b10dbe") {
16
+ if ($[0] !== "b948df7cf2e5c6cd498f94bb7b9f2055507563755e12fa92cc29001f25ecad40") {
17
17
  for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
18
- $[0] = "261aac3044f545b5b17e0449fc914e6311b0108f3d16c419141b242a12b10dbe";
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] !== "261aac3044f545b5b17e0449fc914e6311b0108f3d16c419141b242a12b10dbe") {
39
+ if ($[0] !== "b948df7cf2e5c6cd498f94bb7b9f2055507563755e12fa92cc29001f25ecad40") {
40
40
  for (let $i = 0; $i < 26; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
41
- $[0] = "261aac3044f545b5b17e0449fc914e6311b0108f3d16c419141b242a12b10dbe";
41
+ $[0] = "b948df7cf2e5c6cd498f94bb7b9f2055507563755e12fa92cc29001f25ecad40";
42
42
  }
43
43
  const { camoxApp, derived, source } = t0;
44
- const previewSource = useSelector(previewStore, _temp);
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 };