camox 0.32.0 → 0.33.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/components/AuthGate.js +5 -4
- package/dist/core/createBlock.d.ts +1 -1
- package/dist/core/createBlock.js +88 -108
- package/dist/core/hooks/useIsEditable.js +6 -10
- package/dist/core/lib/fieldTypes.js +10 -219
- package/dist/features/agent-chat/components/AgentChatSidebar.js +172 -0
- package/dist/features/agent-chat/components/AgentChatThread.js +14 -15
- package/dist/features/preview/CamoxPreview.js +137 -729
- package/dist/features/preview/components/{AddBlockSheet.js → AddBlockSidebar.js} +121 -131
- package/dist/features/preview/components/AssetFieldEditor.js +107 -82
- package/dist/features/preview/components/AssetLightbox.js +14 -13
- package/dist/features/preview/components/AssetPickerModal.js +277 -0
- package/dist/features/preview/components/BlockActionsPopover.js +18 -24
- package/dist/features/preview/components/CreatePageModal.js +6 -6
- package/dist/features/preview/components/FieldToolbar.js +64 -127
- package/dist/features/preview/components/ItemFieldsEditor.js +98 -125
- package/dist/features/preview/components/LeftSidebar.js +64 -0
- package/dist/features/preview/components/LinkFieldEditor.js +1 -1
- package/dist/features/preview/components/MultipleAssetFieldEditor.js +94 -56
- package/dist/features/preview/components/OverlayTracker.js +15 -15
- package/dist/features/preview/components/Overlays.js +12 -12
- package/dist/features/preview/components/PageEditorSidebar.js +563 -0
- package/dist/features/preview/components/PageInfoSidebar.js +1453 -0
- package/dist/features/preview/components/PageNavigatorSidebar.js +590 -0
- package/dist/features/preview/components/PagePicker.js +3 -3
- package/dist/features/preview/components/PageStatusBadge.js +1 -1
- package/dist/features/preview/components/PageTree.js +204 -564
- package/dist/features/preview/components/PreviewPanel.js +123 -158
- package/dist/features/preview/components/PreviewToolbar.js +260 -256
- package/dist/features/preview/components/PublishDialog.js +2 -2
- package/dist/features/preview/components/RepeatableItemsList.js +2 -2
- package/dist/features/preview/components/RightSidebar.js +109 -0
- package/dist/features/preview/components/UnlinkAssetButton.js +2 -2
- package/dist/features/preview/components/useRepeatableItemActions.js +3 -138
- package/dist/features/preview/components/useUpdateBlockPosition.js +1 -1
- package/dist/features/preview/previewQueryFns.js +23 -0
- package/dist/features/preview/previewStore.js +46 -63
- package/dist/features/provider/CamoxProvider.js +255 -70
- package/dist/features/provider/useAdminShortcuts.js +5 -48
- package/dist/features/routes/pageRoute.js +1 -1
- package/dist/features/studio/CamoxStudio.js +6 -5
- package/dist/features/studio/components/EnvironmentMenu.js +2 -2
- package/dist/features/studio/components/Navbar.js +53 -71
- package/dist/features/studio/components/ProjectMenu.js +1 -1
- package/dist/features/studio/components/UserButton.js +1 -1
- package/dist/features/studio/routes.js +7 -0
- package/dist/features/studio/useTheme.js +67 -33
- package/dist/features/vite/routeGeneration.js +68 -66
- package/dist/hooks/use-file-upload.js +4 -2
- package/dist/lib/api-client.js +6 -3
- package/dist/lib/auth.js +29 -25
- package/dist/lib/queries.js +6 -4
- package/dist/lib/utils.js +1 -1
- package/dist/studio-overlays.css +1 -1
- package/dist/studio.css +1 -1
- package/package.json +4 -4
- package/dist/features/agent-chat/components/AgentChatSheet.js +0 -207
- package/dist/features/preview/components/AssetPickerGrid.js +0 -236
- package/dist/features/preview/components/PageContentSheet.js +0 -608
- package/dist/features/preview/components/PageMetadataModal.js +0 -908
- package/dist/features/preview/components/PreviewSideSheet.js +0 -76
|
@@ -4,13 +4,14 @@ import { c } from "react/compiler-runtime";
|
|
|
4
4
|
//#region src/components/AuthGate.tsx
|
|
5
5
|
function AuthGate(t0) {
|
|
6
6
|
const $ = c(1);
|
|
7
|
-
if ($[0] !== "
|
|
7
|
+
if ($[0] !== "6de4384ece40c4b5e89894da23db2a5fb013bb295503fd2026710f49f69dd9a6") {
|
|
8
8
|
for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
9
|
-
$[0] = "
|
|
9
|
+
$[0] = "6de4384ece40c4b5e89894da23db2a5fb013bb295503fd2026710f49f69dd9a6";
|
|
10
10
|
}
|
|
11
|
-
const { authenticated, unauthenticated } = t0;
|
|
11
|
+
const { authenticated, unauthenticated, loading: t1 } = t0;
|
|
12
|
+
const loading = t1 === void 0 ? null : t1;
|
|
12
13
|
const { isAuthenticated, isLoading } = useAuthState();
|
|
13
|
-
if (isLoading) return
|
|
14
|
+
if (isLoading) return loading;
|
|
14
15
|
return isAuthenticated ? authenticated : unauthenticated;
|
|
15
16
|
}
|
|
16
17
|
|
|
@@ -47,7 +47,7 @@ interface CreateBlockOptions<TSchemaShape extends Record<string, TSchema> = Reco
|
|
|
47
47
|
*/
|
|
48
48
|
settings?: TSettingsShape;
|
|
49
49
|
/**
|
|
50
|
-
* When true, this block can only be used inside layouts and won't appear in the
|
|
50
|
+
* When true, this block can only be used inside layouts and won't appear in the AddBlockSidebar
|
|
51
51
|
* or be available for AI page generation.
|
|
52
52
|
*/
|
|
53
53
|
layoutOnly?: TLayoutOnly;
|
package/dist/core/createBlock.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { trackClientEvent } from "../lib/telemetry-client.js";
|
|
2
|
-
import { previewStore } from "../features/preview/previewStore.js";
|
|
3
|
-
import { useIsPreviewSheetOpen } from "../features/preview/components/PreviewSideSheet.js";
|
|
4
1
|
import { useProjectSlug } from "../lib/auth.js";
|
|
5
2
|
import { blockMutations, pageQueries, projectQueries, repeatableItemMutations } from "../lib/queries.js";
|
|
3
|
+
import { trackClientEvent } from "../lib/telemetry-client.js";
|
|
6
4
|
import { useFrame } from "../features/preview/components/Frame.js";
|
|
7
5
|
import { postOverlayMessage } from "../features/preview/overlayMessages.js";
|
|
6
|
+
import { previewStore } from "../features/preview/previewStore.js";
|
|
8
7
|
import { isFileMarker, isItemMarker, resolveFileMarker, useNormalizedData } from "../lib/normalized-data.js";
|
|
9
8
|
import { AddBlockControlBar } from "./components/AddBlockControlBar.js";
|
|
10
9
|
import { InlineLexicalEditor } from "./components/lexical/InlineLexicalEditor.js";
|
|
@@ -16,10 +15,8 @@ import { buildImageSrcSet, getDefaultImageSizes, getDefaultImageWidth, transform
|
|
|
16
15
|
import { markdownToReactNodes } from "./lib/lexicalReact.js";
|
|
17
16
|
import { c } from "react/compiler-runtime";
|
|
18
17
|
import { Input } from "@camox/ui/input";
|
|
19
|
-
import { Kbd } from "@camox/ui/kbd";
|
|
20
18
|
import { Label } from "@camox/ui/label";
|
|
21
19
|
import { Popover, PopoverContent, PopoverTrigger } from "@camox/ui/popover";
|
|
22
|
-
import { toast } from "@camox/ui/toaster";
|
|
23
20
|
import { Type as Type$1 } from "@sinclair/typebox";
|
|
24
21
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
25
22
|
import { useLocation } from "@tanstack/react-router";
|
|
@@ -50,7 +47,6 @@ const resolveLinkHref = (link, pages, currentPathname) => {
|
|
|
50
47
|
if (!link.href || link.href.startsWith("#")) return `${currentPathname}${link.href ?? ""}`;
|
|
51
48
|
return link.href;
|
|
52
49
|
};
|
|
53
|
-
let hasShownEmbedLockToast = false;
|
|
54
50
|
/**
|
|
55
51
|
* Recursively walks schema properties to generate RepeatableItemSeed objects.
|
|
56
52
|
* Sets `_itemId` placeholder markers on `content` for each repeatable field,
|
|
@@ -208,8 +204,8 @@ function createBlock(options) {
|
|
|
208
204
|
const fieldValue = repeaterContext ? repeaterContext.itemContent[name] : content[name];
|
|
209
205
|
const [isHovered, setIsHovered] = React.useState(false);
|
|
210
206
|
const [isEditorFocused, setIsEditorFocused] = React.useState(false);
|
|
211
|
-
const
|
|
212
|
-
const isFocused = isEditorFocused ||
|
|
207
|
+
const isSelectedFromSelection = useFieldSelection(blockId, String(name), "String", repeaterContext?.itemId);
|
|
208
|
+
const isFocused = isEditorFocused || isSelectedFromSelection;
|
|
213
209
|
const isHoveredFromSidebar = useOverlayMessage(iframeWindow, isContentEditable, "CAMOX_HOVER_FIELD", "CAMOX_HOVER_FIELD_END", { fieldId });
|
|
214
210
|
React.useEffect(() => {
|
|
215
211
|
setIsHovered(isHoveredFromSidebar);
|
|
@@ -293,9 +289,9 @@ function createBlock(options) {
|
|
|
293
289
|
};
|
|
294
290
|
const Embed = (t0) => {
|
|
295
291
|
const $ = c(59);
|
|
296
|
-
if ($[0] !== "
|
|
292
|
+
if ($[0] !== "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407") {
|
|
297
293
|
for (let $i = 0; $i < 59; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
298
|
-
$[0] = "
|
|
294
|
+
$[0] = "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407";
|
|
299
295
|
}
|
|
300
296
|
const { name, children } = t0;
|
|
301
297
|
const blockContext = React.use(Context);
|
|
@@ -480,14 +476,11 @@ function createBlock(options) {
|
|
|
480
476
|
} else t24 = $[42];
|
|
481
477
|
let t25;
|
|
482
478
|
if ($[43] !== isContentEditable) {
|
|
483
|
-
t25 = isContentEditable && /* @__PURE__ */ jsx("div", {
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
},
|
|
489
|
-
onClick: _temp
|
|
490
|
-
});
|
|
479
|
+
t25 = isContentEditable && /* @__PURE__ */ jsx("div", { style: {
|
|
480
|
+
position: "absolute",
|
|
481
|
+
inset: 0,
|
|
482
|
+
zIndex: 10
|
|
483
|
+
} });
|
|
491
484
|
$[43] = isContentEditable;
|
|
492
485
|
$[44] = t25;
|
|
493
486
|
} else t25 = $[44];
|
|
@@ -543,9 +536,9 @@ function createBlock(options) {
|
|
|
543
536
|
};
|
|
544
537
|
const Link = (t0) => {
|
|
545
538
|
const $ = c(38);
|
|
546
|
-
if ($[0] !== "
|
|
539
|
+
if ($[0] !== "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407") {
|
|
547
540
|
for (let $i = 0; $i < 38; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
548
|
-
$[0] = "
|
|
541
|
+
$[0] = "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407";
|
|
549
542
|
}
|
|
550
543
|
const { name, children } = t0;
|
|
551
544
|
const blockContext = React.use(Context);
|
|
@@ -596,7 +589,7 @@ function createBlock(options) {
|
|
|
596
589
|
const { data: pages } = useQuery(t6);
|
|
597
590
|
let t7;
|
|
598
591
|
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
599
|
-
t7 = { select:
|
|
592
|
+
t7 = { select: _temp };
|
|
600
593
|
$[10] = t7;
|
|
601
594
|
} else t7 = $[10];
|
|
602
595
|
const resolvedHref = resolveLinkHref(fieldValue, pages, useLocation(t7));
|
|
@@ -605,8 +598,8 @@ function createBlock(options) {
|
|
|
605
598
|
const [displayText, setDisplayText] = React.useState(fieldValue.text);
|
|
606
599
|
const [isHovered, setIsHovered] = React.useState(false);
|
|
607
600
|
const [isEditorFocused, setIsEditorFocused] = React.useState(false);
|
|
608
|
-
const
|
|
609
|
-
const isFocused = isEditorFocused ||
|
|
601
|
+
const isSelectedFromSelection = useFieldSelection(blockId, String(name), "Link", repeaterContext?.itemId);
|
|
602
|
+
const isFocused = isEditorFocused || isSelectedFromSelection;
|
|
610
603
|
React.useEffect(() => {
|
|
611
604
|
if (!isEditing) setDisplayText(fieldValue.text);
|
|
612
605
|
}, [fieldValue.text, isEditing]);
|
|
@@ -731,13 +724,13 @@ function createBlock(options) {
|
|
|
731
724
|
"data-camox-focused": isFocused || void 0,
|
|
732
725
|
"data-camox-overlay-mode": mode === "layout" ? "layout" : void 0,
|
|
733
726
|
contentEditable: true,
|
|
734
|
-
onClick:
|
|
727
|
+
onClick: _temp2,
|
|
735
728
|
onInput: handleInput,
|
|
736
729
|
onFocus: handleFocus,
|
|
737
730
|
onBlur: handleBlur,
|
|
738
731
|
onMouseEnter: t14,
|
|
739
732
|
onMouseLeave: t15,
|
|
740
|
-
onKeyDown:
|
|
733
|
+
onKeyDown: _temp3,
|
|
741
734
|
spellCheck: false,
|
|
742
735
|
suppressContentEditableWarning: true
|
|
743
736
|
};
|
|
@@ -748,7 +741,7 @@ function createBlock(options) {
|
|
|
748
741
|
t17 = /* @__PURE__ */ jsx("button", {
|
|
749
742
|
type: "button",
|
|
750
743
|
className: "hover:bg-accent flex items-center gap-1.5 rounded-md px-2 py-1 text-sm transition-colors",
|
|
751
|
-
onMouseDown:
|
|
744
|
+
onMouseDown: _temp4,
|
|
752
745
|
onClick: handleEditLink,
|
|
753
746
|
children: "Edit link"
|
|
754
747
|
});
|
|
@@ -784,9 +777,9 @@ function createBlock(options) {
|
|
|
784
777
|
};
|
|
785
778
|
const Image = (t0) => {
|
|
786
779
|
const $ = c(22);
|
|
787
|
-
if ($[0] !== "
|
|
780
|
+
if ($[0] !== "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407") {
|
|
788
781
|
for (let $i = 0; $i < 22; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
789
|
-
$[0] = "
|
|
782
|
+
$[0] = "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407";
|
|
790
783
|
}
|
|
791
784
|
const { name, children } = t0;
|
|
792
785
|
const blockContext = React.use(Context);
|
|
@@ -908,9 +901,9 @@ function createBlock(options) {
|
|
|
908
901
|
};
|
|
909
902
|
const File = (t0) => {
|
|
910
903
|
const $ = c(9);
|
|
911
|
-
if ($[0] !== "
|
|
904
|
+
if ($[0] !== "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407") {
|
|
912
905
|
for (let $i = 0; $i < 9; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
913
|
-
$[0] = "
|
|
906
|
+
$[0] = "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407";
|
|
914
907
|
}
|
|
915
908
|
const { name, children } = t0;
|
|
916
909
|
const blockContext = React.use(Context);
|
|
@@ -985,9 +978,9 @@ function createBlock(options) {
|
|
|
985
978
|
const FileList = _AssetList;
|
|
986
979
|
const RepeaterItemWrapper = (t0) => {
|
|
987
980
|
const $ = c(9);
|
|
988
|
-
if ($[0] !== "
|
|
981
|
+
if ($[0] !== "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407") {
|
|
989
982
|
for (let $i = 0; $i < 9; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
990
|
-
$[0] = "
|
|
983
|
+
$[0] = "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407";
|
|
991
984
|
}
|
|
992
985
|
const { itemId, blockId, mode, children } = t0;
|
|
993
986
|
const isContentEditable = useIsEditable(mode);
|
|
@@ -1028,9 +1021,9 @@ function createBlock(options) {
|
|
|
1028
1021
|
};
|
|
1029
1022
|
const RepeaterHoverProvider = (t0) => {
|
|
1030
1023
|
const $ = c(7);
|
|
1031
|
-
if ($[0] !== "
|
|
1024
|
+
if ($[0] !== "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407") {
|
|
1032
1025
|
for (let $i = 0; $i < 7; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
1033
|
-
$[0] = "
|
|
1026
|
+
$[0] = "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407";
|
|
1034
1027
|
}
|
|
1035
1028
|
const { blockId, fieldName, children } = t0;
|
|
1036
1029
|
const isContentEditable = useIsEditable("site");
|
|
@@ -1061,9 +1054,9 @@ function createBlock(options) {
|
|
|
1061
1054
|
};
|
|
1062
1055
|
const Repeater = (t0) => {
|
|
1063
1056
|
const $ = c(27);
|
|
1064
|
-
if ($[0] !== "
|
|
1057
|
+
if ($[0] !== "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407") {
|
|
1065
1058
|
for (let $i = 0; $i < 27; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
1066
|
-
$[0] = "
|
|
1059
|
+
$[0] = "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407";
|
|
1067
1060
|
}
|
|
1068
1061
|
const { name, children } = t0;
|
|
1069
1062
|
const blockContext = React.use(Context);
|
|
@@ -1188,19 +1181,18 @@ function createBlock(options) {
|
|
|
1188
1181
|
};
|
|
1189
1182
|
const BlockComponent = (t0) => {
|
|
1190
1183
|
const $ = c(78);
|
|
1191
|
-
if ($[0] !== "
|
|
1184
|
+
if ($[0] !== "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407") {
|
|
1192
1185
|
for (let $i = 0; $i < 78; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
1193
|
-
$[0] = "
|
|
1186
|
+
$[0] = "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407";
|
|
1194
1187
|
}
|
|
1195
1188
|
const { blockData, mode, isFirstBlock, showAddBlockTop, showAddBlockBottom, addBlockAfterPosition } = t0;
|
|
1196
1189
|
const isContentEditable = useIsEditable(mode);
|
|
1197
1190
|
const { window: iframeWindow } = useFrame();
|
|
1198
1191
|
const [isHovered, setIsHovered] = React.useState(false);
|
|
1199
|
-
const selection = useSelector(previewStore,
|
|
1200
|
-
const
|
|
1201
|
-
const
|
|
1202
|
-
const
|
|
1203
|
-
const pendingAgentBlockFocus = useSelector(previewStore, _temp9);
|
|
1192
|
+
const selection = useSelector(previewStore, _temp5);
|
|
1193
|
+
const isPageEditorSidebarOpen = useSelector(previewStore, _temp6);
|
|
1194
|
+
const isAddBlockSidebarOpen = useSelector(previewStore, _temp7);
|
|
1195
|
+
const pendingAgentBlockFocus = useSelector(previewStore, _temp8);
|
|
1204
1196
|
const isBlockSelected = selection?.blockId === blockData._id;
|
|
1205
1197
|
const ref = React.useRef(null);
|
|
1206
1198
|
const [isFirstRender, setIsFirstRender] = React.useState(true);
|
|
@@ -1236,18 +1228,18 @@ function createBlock(options) {
|
|
|
1236
1228
|
$[8] = t3;
|
|
1237
1229
|
} else t3 = $[8];
|
|
1238
1230
|
let t4;
|
|
1239
|
-
if ($[9] !== blockData._id || $[10] !== isBlockSelected || $[11] !== isFirstRender || $[12] !==
|
|
1231
|
+
if ($[9] !== blockData._id || $[10] !== isBlockSelected || $[11] !== isFirstRender || $[12] !== isPageEditorSidebarOpen || $[13] !== pendingAgentBlockFocus) {
|
|
1240
1232
|
t4 = [
|
|
1241
1233
|
blockData._id,
|
|
1242
1234
|
isBlockSelected,
|
|
1243
1235
|
isFirstRender,
|
|
1244
|
-
|
|
1236
|
+
isPageEditorSidebarOpen,
|
|
1245
1237
|
pendingAgentBlockFocus
|
|
1246
1238
|
];
|
|
1247
1239
|
$[9] = blockData._id;
|
|
1248
1240
|
$[10] = isBlockSelected;
|
|
1249
1241
|
$[11] = isFirstRender;
|
|
1250
|
-
$[12] =
|
|
1242
|
+
$[12] = isPageEditorSidebarOpen;
|
|
1251
1243
|
$[13] = pendingAgentBlockFocus;
|
|
1252
1244
|
$[14] = t4;
|
|
1253
1245
|
} else t4 = $[14];
|
|
@@ -1305,7 +1297,7 @@ function createBlock(options) {
|
|
|
1305
1297
|
result = { ...blockData.content };
|
|
1306
1298
|
for (const key in result) {
|
|
1307
1299
|
const value = result[key];
|
|
1308
|
-
if (Array.isArray(value) && value.length > 0 && value[0]?.content !== void 0) result[key] = value.map(
|
|
1300
|
+
if (Array.isArray(value) && value.length > 0 && value[0]?.content !== void 0) result[key] = value.map(_temp9);
|
|
1309
1301
|
}
|
|
1310
1302
|
$[24] = blockData.content;
|
|
1311
1303
|
$[25] = result;
|
|
@@ -1359,8 +1351,8 @@ function createBlock(options) {
|
|
|
1359
1351
|
$[35] = t14;
|
|
1360
1352
|
} else t14 = $[35];
|
|
1361
1353
|
const handleAddBlockClick = t14;
|
|
1362
|
-
const shouldShowOverlay = isContentEditable && (isHovered || isBlockSelected) && !
|
|
1363
|
-
const
|
|
1354
|
+
const shouldShowOverlay = isContentEditable && (isHovered || isBlockSelected) && !isAddBlockSidebarOpen;
|
|
1355
|
+
const shouldShowAddBlockOverlay = isAddBlockSidebarOpen && mode !== "peek";
|
|
1364
1356
|
let t15;
|
|
1365
1357
|
if ($[36] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1366
1358
|
t15 = {
|
|
@@ -1449,40 +1441,41 @@ function createBlock(options) {
|
|
|
1449
1441
|
$[55] = t27;
|
|
1450
1442
|
$[56] = t28;
|
|
1451
1443
|
} else t28 = $[56];
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1444
|
+
const t29 = shouldShowAddBlockOverlay || void 0;
|
|
1445
|
+
let t30;
|
|
1446
|
+
if ($[57] !== t29) {
|
|
1447
|
+
t30 = /* @__PURE__ */ jsx("div", {
|
|
1455
1448
|
className: "camox-sheet-overlay",
|
|
1456
|
-
|
|
1449
|
+
"data-camox-visible": t29
|
|
1457
1450
|
});
|
|
1458
|
-
$[57] =
|
|
1459
|
-
$[58] =
|
|
1460
|
-
} else
|
|
1461
|
-
let
|
|
1462
|
-
if ($[59] !== handleAddBlockClick || $[60] !==
|
|
1463
|
-
|
|
1451
|
+
$[57] = t29;
|
|
1452
|
+
$[58] = t30;
|
|
1453
|
+
} else t30 = $[58];
|
|
1454
|
+
let t31;
|
|
1455
|
+
if ($[59] !== handleAddBlockClick || $[60] !== isAddBlockSidebarOpen || $[61] !== isFirstBlock || $[62] !== mode || $[63] !== shouldShowOverlay || $[64] !== showAddBlockBottom || $[65] !== showAddBlockTop) {
|
|
1456
|
+
t31 = shouldShowOverlay && /* @__PURE__ */ jsxs(Fragment, { children: [(showAddBlockTop ?? (mode !== "layout" && !isFirstBlock)) && /* @__PURE__ */ jsx(AddBlockControlBar, {
|
|
1464
1457
|
position: "top",
|
|
1465
|
-
hidden:
|
|
1458
|
+
hidden: isAddBlockSidebarOpen,
|
|
1466
1459
|
onMouseLeave: () => setIsHovered(false),
|
|
1467
1460
|
onClick: () => handleAddBlockClick("before")
|
|
1468
1461
|
}), (showAddBlockBottom ?? mode !== "layout") && /* @__PURE__ */ jsx(AddBlockControlBar, {
|
|
1469
1462
|
position: "bottom",
|
|
1470
|
-
hidden:
|
|
1463
|
+
hidden: isAddBlockSidebarOpen,
|
|
1471
1464
|
onMouseLeave: () => setIsHovered(false),
|
|
1472
1465
|
onClick: () => handleAddBlockClick("after")
|
|
1473
1466
|
})] });
|
|
1474
1467
|
$[59] = handleAddBlockClick;
|
|
1475
|
-
$[60] =
|
|
1468
|
+
$[60] = isAddBlockSidebarOpen;
|
|
1476
1469
|
$[61] = isFirstBlock;
|
|
1477
1470
|
$[62] = mode;
|
|
1478
1471
|
$[63] = shouldShowOverlay;
|
|
1479
1472
|
$[64] = showAddBlockBottom;
|
|
1480
1473
|
$[65] = showAddBlockTop;
|
|
1481
|
-
$[66] =
|
|
1482
|
-
} else
|
|
1483
|
-
let
|
|
1484
|
-
if ($[67] !== handleClick || $[68] !== handleMouseEnter || $[69] !== handleMouseLeave || $[70] !== t16 || $[71] !== t17 || $[72] !== t18 || $[73] !== t19 || $[74] !== t28 || $[75] !==
|
|
1485
|
-
|
|
1474
|
+
$[66] = t31;
|
|
1475
|
+
} else t31 = $[66];
|
|
1476
|
+
let t32;
|
|
1477
|
+
if ($[67] !== handleClick || $[68] !== handleMouseEnter || $[69] !== handleMouseLeave || $[70] !== t16 || $[71] !== t17 || $[72] !== t18 || $[73] !== t19 || $[74] !== t28 || $[75] !== t30 || $[76] !== t31) {
|
|
1478
|
+
t32 = /* @__PURE__ */ jsxs("div", {
|
|
1486
1479
|
className: "group visual-editing-block",
|
|
1487
1480
|
ref,
|
|
1488
1481
|
style: t15,
|
|
@@ -1495,8 +1488,8 @@ function createBlock(options) {
|
|
|
1495
1488
|
onMouseLeave: handleMouseLeave,
|
|
1496
1489
|
children: [
|
|
1497
1490
|
t28,
|
|
1498
|
-
|
|
1499
|
-
|
|
1491
|
+
t30,
|
|
1492
|
+
t31
|
|
1500
1493
|
]
|
|
1501
1494
|
});
|
|
1502
1495
|
$[67] = handleClick;
|
|
@@ -1507,11 +1500,11 @@ function createBlock(options) {
|
|
|
1507
1500
|
$[72] = t18;
|
|
1508
1501
|
$[73] = t19;
|
|
1509
1502
|
$[74] = t28;
|
|
1510
|
-
$[75] =
|
|
1511
|
-
$[76] =
|
|
1512
|
-
$[77] =
|
|
1513
|
-
} else
|
|
1514
|
-
return
|
|
1503
|
+
$[75] = t30;
|
|
1504
|
+
$[76] = t31;
|
|
1505
|
+
$[77] = t32;
|
|
1506
|
+
} else t32 = $[77];
|
|
1507
|
+
return t32;
|
|
1515
1508
|
};
|
|
1516
1509
|
const useSetting = (name) => {
|
|
1517
1510
|
const ctx = React.use(Context);
|
|
@@ -1524,9 +1517,9 @@ function createBlock(options) {
|
|
|
1524
1517
|
*/
|
|
1525
1518
|
const Detached = (t0) => {
|
|
1526
1519
|
const $ = c(31);
|
|
1527
|
-
if ($[0] !== "
|
|
1520
|
+
if ($[0] !== "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407") {
|
|
1528
1521
|
for (let $i = 0; $i < 31; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
1529
|
-
$[0] = "
|
|
1522
|
+
$[0] = "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407";
|
|
1530
1523
|
}
|
|
1531
1524
|
const { children } = t0;
|
|
1532
1525
|
const ctx = React.use(Context);
|
|
@@ -1534,9 +1527,8 @@ function createBlock(options) {
|
|
|
1534
1527
|
const { blockId, mode, isHovered, setIsHovered } = ctx;
|
|
1535
1528
|
const isContentEditable = useIsEditable(mode);
|
|
1536
1529
|
const { window: iframeWindow } = useFrame();
|
|
1537
|
-
const selection = useSelector(previewStore,
|
|
1538
|
-
const
|
|
1539
|
-
const isPageContentSheetOpen = useSelector(previewStore, _temp11);
|
|
1530
|
+
const selection = useSelector(previewStore, _temp0);
|
|
1531
|
+
const isAddBlockSidebarOpen = useSelector(previewStore, _temp1);
|
|
1540
1532
|
const isBlockSelected = selection?.blockId === blockId;
|
|
1541
1533
|
const t1 = String(blockId);
|
|
1542
1534
|
let t2;
|
|
@@ -1562,8 +1554,8 @@ function createBlock(options) {
|
|
|
1562
1554
|
t4 = $[6];
|
|
1563
1555
|
}
|
|
1564
1556
|
React.useEffect(t3, t4);
|
|
1565
|
-
const shouldShowOverlay = isContentEditable && (isHovered || isBlockSelected) && !
|
|
1566
|
-
const
|
|
1557
|
+
const shouldShowOverlay = isContentEditable && (isHovered || isBlockSelected) && !isAddBlockSidebarOpen;
|
|
1558
|
+
const shouldHideForAddBlockSidebar = isAddBlockSidebarOpen && mode !== "peek";
|
|
1567
1559
|
let t5;
|
|
1568
1560
|
if ($[7] !== blockId || $[8] !== isContentEditable) {
|
|
1569
1561
|
t5 = (e) => {
|
|
@@ -1600,7 +1592,7 @@ function createBlock(options) {
|
|
|
1600
1592
|
} else t7 = $[15];
|
|
1601
1593
|
const handleMouseLeave = t7;
|
|
1602
1594
|
const [container, setContainer] = React.useState(null);
|
|
1603
|
-
const t8 =
|
|
1595
|
+
const t8 = shouldHideForAddBlockSidebar ? 0 : 1;
|
|
1604
1596
|
let t9;
|
|
1605
1597
|
if ($[16] !== children || $[17] !== handleClick || $[18] !== handleMouseEnter || $[19] !== handleMouseLeave || $[20] !== t8) {
|
|
1606
1598
|
t9 = children({
|
|
@@ -1721,50 +1713,38 @@ function createBlock(options) {
|
|
|
1721
1713
|
}
|
|
1722
1714
|
};
|
|
1723
1715
|
}
|
|
1724
|
-
function _temp() {
|
|
1725
|
-
if (hasShownEmbedLockToast) return;
|
|
1726
|
-
hasShownEmbedLockToast = true;
|
|
1727
|
-
toast(/* @__PURE__ */ jsxs("span", { children: [
|
|
1728
|
-
"Hold ",
|
|
1729
|
-
/* @__PURE__ */ jsx(Kbd, { children: "L" }),
|
|
1730
|
-
" to interact with the embed content"
|
|
1731
|
-
] }));
|
|
1732
|
-
}
|
|
1733
|
-
function _temp2(l) {
|
|
1716
|
+
function _temp(l) {
|
|
1734
1717
|
return l.pathname;
|
|
1735
1718
|
}
|
|
1736
|
-
function
|
|
1719
|
+
function _temp2(e_1) {
|
|
1737
1720
|
return e_1.preventDefault();
|
|
1738
1721
|
}
|
|
1739
|
-
function
|
|
1722
|
+
function _temp3(e_2) {
|
|
1740
1723
|
if (e_2.key === "Escape") e_2.target.blur();
|
|
1741
1724
|
}
|
|
1742
|
-
function
|
|
1725
|
+
function _temp4(e_3) {
|
|
1743
1726
|
return e_3.preventDefault();
|
|
1744
1727
|
}
|
|
1745
|
-
function
|
|
1728
|
+
function _temp5(state) {
|
|
1746
1729
|
return state.context.selection;
|
|
1747
1730
|
}
|
|
1748
|
-
function
|
|
1749
|
-
return state_0.context.
|
|
1731
|
+
function _temp6(state_0) {
|
|
1732
|
+
return state_0.context.isPageEditorSidebarOpen;
|
|
1750
1733
|
}
|
|
1751
|
-
function
|
|
1752
|
-
return state_1.context.
|
|
1734
|
+
function _temp7(state_1) {
|
|
1735
|
+
return state_1.context.isAddBlockSidebarOpen;
|
|
1753
1736
|
}
|
|
1754
|
-
function
|
|
1737
|
+
function _temp8(state_2) {
|
|
1755
1738
|
return state_2.context.pendingAgentBlockFocus;
|
|
1756
1739
|
}
|
|
1757
|
-
function
|
|
1740
|
+
function _temp9(item) {
|
|
1758
1741
|
return item.content;
|
|
1759
1742
|
}
|
|
1760
|
-
function
|
|
1743
|
+
function _temp0(state) {
|
|
1761
1744
|
return state.context.selection;
|
|
1762
1745
|
}
|
|
1763
|
-
function
|
|
1764
|
-
return state_0.context.
|
|
1765
|
-
}
|
|
1766
|
-
function _temp11(state_1) {
|
|
1767
|
-
return state_1.context.isPageContentSheetOpen;
|
|
1746
|
+
function _temp1(state_0) {
|
|
1747
|
+
return state_0.context.isAddBlockSidebarOpen;
|
|
1768
1748
|
}
|
|
1769
1749
|
|
|
1770
1750
|
//#endregion
|
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
import { previewStore } from "../../features/preview/previewStore.js";
|
|
2
1
|
import { useIsAuthenticated } from "../../lib/auth.js";
|
|
2
|
+
import { previewStore } 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] !== "a3e376179cf3461f650a645c5d9591b7c0b2bd69400f81ba76076063ea10dffc") {
|
|
10
10
|
for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
11
|
-
$[0] = "
|
|
11
|
+
$[0] = "a3e376179cf3461f650a645c5d9591b7c0b2bd69400f81ba76076063ea10dffc";
|
|
12
12
|
}
|
|
13
13
|
const isAuthenticated = useIsAuthenticated();
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
return isAuthenticated && (mode === "site" || mode === "layout") && !isPresentationMode && !isContentLocked;
|
|
17
|
-
}
|
|
18
|
-
function _temp2(state_0) {
|
|
19
|
-
return state_0.context.isContentLocked;
|
|
14
|
+
const isEditMode = useSelector(previewStore, _temp);
|
|
15
|
+
return isAuthenticated && (mode === "site" || mode === "layout") && isEditMode;
|
|
20
16
|
}
|
|
21
17
|
function _temp(state) {
|
|
22
|
-
return state.context.
|
|
18
|
+
return state.context.isEditMode;
|
|
23
19
|
}
|
|
24
20
|
|
|
25
21
|
//#endregion
|