camox 0.41.0 → 0.41.1
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/createApp.d.ts +2 -2
- package/dist/core/createBlock.js +11 -25
- package/dist/core/createLayout.d.ts +1 -1
- package/dist/core/editing/BlockEditingRuntime.js +4 -4
- package/dist/core/editing/CompleteBlockEditingRuntime.js +5 -5
- package/dist/core/editing/createEditableBlock.js +169 -306
- package/dist/core/hooks/useIsEditable.js +4 -7
- package/dist/core/hooks/useRequireDraftSource.js +7 -11
- package/dist/features/preview/CamoxPreview.js +59 -80
- package/dist/features/preview/DerivedPreview.js +6 -9
- package/dist/features/preview/components/BlockActionsPopover.js +8 -8
- package/dist/features/preview/components/DerivedLayoutSidebar.js +4 -7
- package/dist/features/preview/components/LinkFieldEditor.js +3 -4
- package/dist/features/preview/components/MobilePreviewDrawer.js +3 -3
- package/dist/features/preview/components/Overlays.js +6 -9
- package/dist/features/preview/components/PageEditorSidebar.js +194 -203
- package/dist/features/preview/components/PageTree.js +162 -228
- package/dist/features/preview/components/PreviewPanel.js +39 -41
- package/dist/features/preview/components/PreviewToolbar.js +15 -18
- package/dist/features/preview/components/PreviewToolbarSpacer.js +43 -0
- package/dist/features/preview/components/PublicationRow.js +11 -17
- package/dist/features/preview/previewStore.js +18 -29
- package/dist/features/provider/useAdminShortcuts.js +5 -4
- package/dist/features/runtime/RuntimeChrome.js +98 -86
- package/dist/features/studio/components/UserButton.js +4 -4
- package/package.json +4 -4
- package/dist/features/preview/components/DraftSwitchDialog.js +0 -66
|
@@ -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
|
|
@@ -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] !== "11649479464867dae9140a3e12df376e886901a1c7db652f3f404c61e069d60d") {
|
|
40
40
|
for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
41
|
-
$[0] = "
|
|
41
|
+
$[0] = "11649479464867dae9140a3e12df376e886901a1c7db652f3f404c61e069d60d";
|
|
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] !== "11649479464867dae9140a3e12df376e886901a1c7db652f3f404c61e069d60d") {
|
|
75
75
|
for (let $i = 0; $i < 11; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
76
|
-
$[0] = "
|
|
76
|
+
$[0] = "11649479464867dae9140a3e12df376e886901a1c7db652f3f404c61e069d60d";
|
|
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] !== "11649479464867dae9140a3e12df376e886901a1c7db652f3f404c61e069d60d") {
|
|
116
113
|
for (let $i = 0; $i < 23; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
117
|
-
$[0] = "
|
|
114
|
+
$[0] = "11649479464867dae9140a3e12df376e886901a1c7db652f3f404c61e069d60d";
|
|
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] !== "11649479464867dae9140a3e12df376e886901a1c7db652f3f404c61e069d60d") {
|
|
261
258
|
for (let $i = 0; $i < 7; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
262
|
-
$[0] = "
|
|
259
|
+
$[0] = "11649479464867dae9140a3e12df376e886901a1c7db652f3f404c61e069d60d";
|
|
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] !== "11649479464867dae9140a3e12df376e886901a1c7db652f3f404c61e069d60d") {
|
|
314
311
|
for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
315
|
-
$[0] = "
|
|
312
|
+
$[0] = "11649479464867dae9140a3e12df376e886901a1c7db652f3f404c61e069d60d";
|
|
316
313
|
}
|
|
317
314
|
const { children } = t0;
|
|
318
315
|
const pageData = usePreviewedPage();
|
|
@@ -332,19 +329,19 @@ const CamoxPreview = (t0) => {
|
|
|
332
329
|
/** Studio chrome is shared; only curated previews require a Camox page record. */
|
|
333
330
|
const PreviewShell = (t0) => {
|
|
334
331
|
const $ = c(58);
|
|
335
|
-
if ($[0] !== "
|
|
332
|
+
if ($[0] !== "11649479464867dae9140a3e12df376e886901a1c7db652f3f404c61e069d60d") {
|
|
336
333
|
for (let $i = 0; $i < 58; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
337
|
-
$[0] = "
|
|
334
|
+
$[0] = "11649479464867dae9140a3e12df376e886901a1c7db652f3f404c61e069d60d";
|
|
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;
|
|
@@ -533,10 +530,7 @@ const PreviewShell = (t0) => {
|
|
|
533
530
|
} else t14 = $[30];
|
|
534
531
|
let t15;
|
|
535
532
|
if ($[31] !== isEditMode || $[32] !== isMobileStudio) {
|
|
536
|
-
t15 = !isMobileStudio && isEditMode && /* @__PURE__ */ jsx(
|
|
537
|
-
height: "80px",
|
|
538
|
-
background: "transparent"
|
|
539
|
-
} });
|
|
533
|
+
t15 = !isMobileStudio && isEditMode && /* @__PURE__ */ jsx(PreviewToolbarSpacer, {});
|
|
540
534
|
$[31] = isEditMode;
|
|
541
535
|
$[32] = isMobileStudio;
|
|
542
536
|
$[33] = t15;
|
|
@@ -587,7 +581,7 @@ const PreviewShell = (t0) => {
|
|
|
587
581
|
} else t18 = $[49];
|
|
588
582
|
let t19;
|
|
589
583
|
if ($[50] !== isEditMode || $[51] !== isMobileStudio) {
|
|
590
|
-
t19 = (isMobileStudio || isEditMode) && /* @__PURE__ */
|
|
584
|
+
t19 = (isMobileStudio || isEditMode) && /* @__PURE__ */ jsx(CreatePageModal, {});
|
|
591
585
|
$[50] = isEditMode;
|
|
592
586
|
$[51] = isMobileStudio;
|
|
593
587
|
$[52] = t19;
|
|
@@ -612,9 +606,9 @@ const PreviewShell = (t0) => {
|
|
|
612
606
|
};
|
|
613
607
|
function usePreviewPagesActions() {
|
|
614
608
|
const $ = c(13);
|
|
615
|
-
if ($[0] !== "
|
|
609
|
+
if ($[0] !== "11649479464867dae9140a3e12df376e886901a1c7db652f3f404c61e069d60d") {
|
|
616
610
|
for (let $i = 0; $i < 13; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
617
|
-
$[0] = "
|
|
611
|
+
$[0] = "11649479464867dae9140a3e12df376e886901a1c7db652f3f404c61e069d60d";
|
|
618
612
|
}
|
|
619
613
|
const navigate = useNavigate();
|
|
620
614
|
const { pathname } = useLocation();
|
|
@@ -655,8 +649,8 @@ function usePreviewPagesActions() {
|
|
|
655
649
|
label: "Create page",
|
|
656
650
|
aliases: ["New page", "Add page"],
|
|
657
651
|
groupLabel: "Preview",
|
|
658
|
-
checkIfAvailable:
|
|
659
|
-
execute:
|
|
652
|
+
checkIfAvailable: _temp11,
|
|
653
|
+
execute: _temp12
|
|
660
654
|
},
|
|
661
655
|
{
|
|
662
656
|
id: "edit-current-page",
|
|
@@ -687,14 +681,14 @@ function usePreviewPagesActions() {
|
|
|
687
681
|
groupLabel: "Preview",
|
|
688
682
|
checkIfAvailable: () => !!pages,
|
|
689
683
|
hasChildren: true,
|
|
690
|
-
execute:
|
|
684
|
+
execute: _temp13
|
|
691
685
|
},
|
|
692
686
|
...pages ? pages.map((page) => ({
|
|
693
687
|
id: `go-to-page-${page.id}`,
|
|
694
688
|
parentActionId: "go-to-page",
|
|
695
689
|
label: `Go to "${page.nickname}"`,
|
|
696
690
|
groupLabel: "Preview",
|
|
697
|
-
checkIfAvailable:
|
|
691
|
+
checkIfAvailable: _temp14,
|
|
698
692
|
execute: () => navigate({ to: page.fullPath })
|
|
699
693
|
})) : []
|
|
700
694
|
];
|
|
@@ -705,7 +699,7 @@ function usePreviewPagesActions() {
|
|
|
705
699
|
return () => {
|
|
706
700
|
actionsStore.send({
|
|
707
701
|
type: "unregisterManyActions",
|
|
708
|
-
ids: actions.map(
|
|
702
|
+
ids: actions.map(_temp15)
|
|
709
703
|
});
|
|
710
704
|
};
|
|
711
705
|
};
|
|
@@ -725,62 +719,47 @@ function usePreviewPagesActions() {
|
|
|
725
719
|
}
|
|
726
720
|
React.useEffect(t4, t5);
|
|
727
721
|
}
|
|
728
|
-
function
|
|
722
|
+
function _temp15(a) {
|
|
729
723
|
return a.id;
|
|
730
724
|
}
|
|
731
|
-
function
|
|
725
|
+
function _temp14() {
|
|
732
726
|
return true;
|
|
733
727
|
}
|
|
734
|
-
function
|
|
735
|
-
function
|
|
728
|
+
function _temp13() {}
|
|
729
|
+
function _temp12() {
|
|
736
730
|
return previewStore.send({ type: "openCreatePageModal" });
|
|
737
731
|
}
|
|
738
|
-
function
|
|
732
|
+
function _temp11() {
|
|
739
733
|
return true;
|
|
740
734
|
}
|
|
741
735
|
function _temp3(state) {
|
|
742
|
-
return state.context.
|
|
743
|
-
}
|
|
744
|
-
function _temp5(state) {
|
|
745
|
-
return state.context.isEditMode;
|
|
746
|
-
}
|
|
747
|
-
function _temp6(state_0) {
|
|
748
|
-
return state_0.context.isToolbarHidden;
|
|
749
|
-
}
|
|
750
|
-
function _temp7(state_1) {
|
|
751
|
-
return state_1.context.isAddBlockSidebarOpen;
|
|
736
|
+
return state.context.isToolbarHidden;
|
|
752
737
|
}
|
|
753
|
-
function
|
|
754
|
-
return
|
|
738
|
+
function _temp4(state_0) {
|
|
739
|
+
return state_0.context.isAddBlockSidebarOpen;
|
|
755
740
|
}
|
|
756
|
-
function
|
|
741
|
+
function _temp5() {
|
|
757
742
|
return previewStore.send({ type: "exitEditMode" });
|
|
758
743
|
}
|
|
759
|
-
function
|
|
744
|
+
function _temp6() {
|
|
760
745
|
return previewStore.send({ type: "enterEditMode" });
|
|
761
746
|
}
|
|
762
|
-
function
|
|
763
|
-
return previewStore.send({
|
|
764
|
-
type: "setPreviewSource",
|
|
765
|
-
source: "live"
|
|
766
|
-
});
|
|
747
|
+
function _temp7() {
|
|
748
|
+
return previewStore.send({ type: "viewLivePage" });
|
|
767
749
|
}
|
|
768
|
-
function
|
|
769
|
-
return previewStore.send({
|
|
770
|
-
type: "setPreviewSource",
|
|
771
|
-
source: "draft"
|
|
772
|
-
});
|
|
750
|
+
function _temp8() {
|
|
751
|
+
return previewStore.send({ type: "viewDraftPage" });
|
|
773
752
|
}
|
|
774
|
-
function
|
|
753
|
+
function _temp9() {
|
|
775
754
|
return true;
|
|
776
755
|
}
|
|
777
|
-
function
|
|
756
|
+
function _temp0() {
|
|
778
757
|
previewStore.send({ type: "clearSelection" });
|
|
779
758
|
}
|
|
780
|
-
function
|
|
759
|
+
function _temp1(a) {
|
|
781
760
|
return a.id;
|
|
782
761
|
}
|
|
783
|
-
function
|
|
762
|
+
function _temp10() {
|
|
784
763
|
return previewStore.send({ type: "closeAddBlockSidebar" });
|
|
785
764
|
}
|
|
786
765
|
|
|
@@ -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 };
|
|
@@ -279,9 +279,9 @@ function isLayoutBlockId(page, blockId) {
|
|
|
279
279
|
}
|
|
280
280
|
function useBlockActionsShortcuts() {
|
|
281
281
|
const $ = c(20);
|
|
282
|
-
if ($[0] !== "
|
|
282
|
+
if ($[0] !== "2439a21a93e7dc68e5e2199bf795bec817fbc1286e567fde9de806e04fd01b64") {
|
|
283
283
|
for (let $i = 0; $i < 20; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
284
|
-
$[0] = "
|
|
284
|
+
$[0] = "2439a21a93e7dc68e5e2199bf795bec817fbc1286e567fde9de806e04fd01b64";
|
|
285
285
|
}
|
|
286
286
|
const camoxApp = useCamoxApp();
|
|
287
287
|
const page = usePreviewedPage();
|
|
@@ -327,7 +327,7 @@ function useBlockActionsShortcuts() {
|
|
|
327
327
|
},
|
|
328
328
|
checkIfAvailable: () => {
|
|
329
329
|
const ctx = previewStore.getSnapshot().context;
|
|
330
|
-
if (
|
|
330
|
+
if (ctx.mode !== "editing-draft") return false;
|
|
331
331
|
const sel = ctx.selection;
|
|
332
332
|
if (!sel) return false;
|
|
333
333
|
if (isLayoutBlockId(page, sel.blockId)) return false;
|
|
@@ -369,7 +369,7 @@ function useBlockActionsShortcuts() {
|
|
|
369
369
|
},
|
|
370
370
|
checkIfAvailable: () => {
|
|
371
371
|
const ctx_0 = previewStore.getSnapshot().context;
|
|
372
|
-
if (
|
|
372
|
+
if (ctx_0.mode !== "editing-draft") return false;
|
|
373
373
|
const sel_1 = ctx_0.selection;
|
|
374
374
|
if (!sel_1) return false;
|
|
375
375
|
if (isLayoutBlockId(page, sel_1.blockId)) return false;
|
|
@@ -398,7 +398,7 @@ function useBlockActionsShortcuts() {
|
|
|
398
398
|
},
|
|
399
399
|
checkIfAvailable: () => {
|
|
400
400
|
const ctx_1 = previewStore.getSnapshot().context;
|
|
401
|
-
if (
|
|
401
|
+
if (ctx_1.mode !== "editing-draft") return false;
|
|
402
402
|
const sel_3 = ctx_1.selection;
|
|
403
403
|
if (!sel_3 || !page) return false;
|
|
404
404
|
if (isLayoutBlockId(page, sel_3.blockId)) return false;
|
|
@@ -429,7 +429,7 @@ function useBlockActionsShortcuts() {
|
|
|
429
429
|
},
|
|
430
430
|
checkIfAvailable: () => {
|
|
431
431
|
const ctx_2 = previewStore.getSnapshot().context;
|
|
432
|
-
if (
|
|
432
|
+
if (ctx_2.mode !== "editing-draft") return false;
|
|
433
433
|
const sel_5 = ctx_2.selection;
|
|
434
434
|
if (!sel_5 || !page) return false;
|
|
435
435
|
if (isLayoutBlockId(page, sel_5.blockId)) return false;
|
|
@@ -538,12 +538,12 @@ function _temp12(a) {
|
|
|
538
538
|
}
|
|
539
539
|
function _temp11() {
|
|
540
540
|
const ctx_4 = previewStore.getSnapshot().context;
|
|
541
|
-
if (
|
|
541
|
+
if (ctx_4.mode !== "editing-draft") return false;
|
|
542
542
|
return ctx_4.selection !== null;
|
|
543
543
|
}
|
|
544
544
|
function _temp10() {
|
|
545
545
|
const ctx_3 = previewStore.getSnapshot().context;
|
|
546
|
-
if (
|
|
546
|
+
if (ctx_3.mode !== "editing-draft") return false;
|
|
547
547
|
return ctx_3.selection !== null;
|
|
548
548
|
}
|
|
549
549
|
function _temp1() {
|
|
@@ -2,7 +2,7 @@ import { useProjectSlug } from "../../../lib/auth.js";
|
|
|
2
2
|
import { usePageBlocks } from "../../../lib/normalized-data.js";
|
|
3
3
|
import { layoutQueries, projectQueries } from "../../../lib/queries.js";
|
|
4
4
|
import { useCamoxApp } from "../../provider/components/CamoxAppContext.js";
|
|
5
|
-
import { previewStore } from "../previewStore.js";
|
|
5
|
+
import { previewStore, selectPreviewSource } from "../previewStore.js";
|
|
6
6
|
import { PagePicker } from "./PagePicker.js";
|
|
7
7
|
import { LayoutBlockItem } from "./PageTree.js";
|
|
8
8
|
import { PublicationRow } from "./PublicationRow.js";
|
|
@@ -17,12 +17,12 @@ import { PanelContent, PanelHeader } from "@camox/ui/panel";
|
|
|
17
17
|
const EMPTY_PAGE = { blockIds: [] };
|
|
18
18
|
function DerivedLayoutSidebar(t0) {
|
|
19
19
|
const $ = c(32);
|
|
20
|
-
if ($[0] !== "
|
|
20
|
+
if ($[0] !== "2c7da8bd37fd1558e1c31149d4435d439cdd1425cb374116d681960617531266") {
|
|
21
21
|
for (let $i = 0; $i < 32; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
22
|
-
$[0] = "
|
|
22
|
+
$[0] = "2c7da8bd37fd1558e1c31149d4435d439cdd1425cb374116d681960617531266";
|
|
23
23
|
}
|
|
24
24
|
const { layout } = t0;
|
|
25
|
-
const source = useSelector(previewStore,
|
|
25
|
+
const source = useSelector(previewStore, selectPreviewSource);
|
|
26
26
|
let t1;
|
|
27
27
|
if ($[1] !== layout) {
|
|
28
28
|
t1 = {
|
|
@@ -155,9 +155,6 @@ function DerivedLayoutSidebar(t0) {
|
|
|
155
155
|
} else t14 = $[31];
|
|
156
156
|
return t14;
|
|
157
157
|
}
|
|
158
|
-
function _temp(state) {
|
|
159
|
-
return state.context.previewSource;
|
|
160
|
-
}
|
|
161
158
|
|
|
162
159
|
//#endregion
|
|
163
160
|
export { DerivedLayoutSidebar };
|
|
@@ -26,9 +26,9 @@ const normalizeLinkValue = (value) => {
|
|
|
26
26
|
};
|
|
27
27
|
const LinkFieldEditor = (t0) => {
|
|
28
28
|
const $ = c(74);
|
|
29
|
-
if ($[0] !== "
|
|
29
|
+
if ($[0] !== "cdb2f56fb4805e0de235a068b1342c61e1eade64737868f8170208f1ecf497ab") {
|
|
30
30
|
for (let $i = 0; $i < 74; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
31
|
-
$[0] = "
|
|
31
|
+
$[0] = "cdb2f56fb4805e0de235a068b1342c61e1eade64737868f8170208f1ecf497ab";
|
|
32
32
|
}
|
|
33
33
|
const { fieldName, linkValue: rawLinkValue, onSave } = t0;
|
|
34
34
|
let t1;
|
|
@@ -173,8 +173,7 @@ const LinkFieldEditor = (t0) => {
|
|
|
173
173
|
value: textField.value,
|
|
174
174
|
onChange: t16,
|
|
175
175
|
onFocus: textField.onFocus,
|
|
176
|
-
onBlur: textField.onBlur
|
|
177
|
-
autoFocus: true
|
|
176
|
+
onBlur: textField.onBlur
|
|
178
177
|
});
|
|
179
178
|
$[33] = t15;
|
|
180
179
|
$[34] = t16;
|
|
@@ -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;
|
|
@@ -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] !== "4124232297ed208895aa29251e0b658d39227311caca40cca61d1b2baedf5559") {
|
|
14
14
|
for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
15
|
-
$[0] = "
|
|
15
|
+
$[0] = "4124232297ed208895aa29251e0b658d39227311caca40cca61d1b2baedf5559";
|
|
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;
|
|
@@ -59,9 +56,9 @@ function CuratedAddBlockListener() {
|
|
|
59
56
|
}
|
|
60
57
|
const Overlays = (t0) => {
|
|
61
58
|
const $ = c(13);
|
|
62
|
-
if ($[0] !== "
|
|
59
|
+
if ($[0] !== "4124232297ed208895aa29251e0b658d39227311caca40cca61d1b2baedf5559") {
|
|
63
60
|
for (let $i = 0; $i < 13; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
64
|
-
$[0] = "
|
|
61
|
+
$[0] = "4124232297ed208895aa29251e0b658d39227311caca40cca61d1b2baedf5559";
|
|
65
62
|
}
|
|
66
63
|
const { iframeElement, canAddBlocks: t1 } = t0;
|
|
67
64
|
const canAddBlocks = t1 === void 0 ? false : t1;
|