camox 0.31.5 → 0.33.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/InlineLexicalEditor.js +79 -11
- package/dist/core/components/lexical/SelectionBroadcaster.js +106 -20
- package/dist/core/components/lexical/SidebarLexicalEditor.js +442 -8
- package/dist/core/components/lexical/TextLinkPopover.js +327 -0
- package/dist/core/components/lexical/editorConfig.js +11 -5
- package/dist/core/createApp.d.ts +9 -0
- package/dist/core/createBlock.d.ts +7 -2
- package/dist/core/createBlock.js +101 -110
- package/dist/core/hooks/useIsEditable.js +6 -10
- package/dist/core/lib/fieldTypes.js +10 -219
- package/dist/core/lib/lexicalReact.d.ts +26 -0
- package/dist/core/lib/lexicalReact.js +50 -15
- package/dist/core/lib/lexicalState.js +34 -0
- package/dist/core/lib/textLinks.js +28 -0
- package/dist/features/agent-chat/components/AgentChatSidebar.js +172 -0
- package/dist/features/agent-chat/components/AgentChatThread.js +9 -9
- 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 +4 -4
- 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 +118 -111
- 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/features/vite/vite.js +2 -0
- package/dist/hooks/use-file-upload.js +1 -1
- package/dist/lib/auth.js +23 -22
- package/dist/lib/utils.js +1 -1
- package/dist/studio-overlays.css +1 -1
- package/dist/studio.css +1 -1
- package/package.json +5 -4
- package/skills/camox-block/SKILL.md +23 -1
- 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
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,
|
|
@@ -189,20 +185,27 @@ function createBlock(options) {
|
|
|
189
185
|
if (repeaterContext?.itemId != null) return `${blockId}__${repeaterContext.itemId}__${fieldName}`;
|
|
190
186
|
return `${blockId}__${fieldName}`;
|
|
191
187
|
};
|
|
192
|
-
const Field = ({ name, children }) => {
|
|
188
|
+
const Field = ({ name, components, children }) => {
|
|
193
189
|
const blockContext = React.use(Context);
|
|
194
190
|
if (!blockContext) throw new Error("Field must be used within a Block Component");
|
|
195
191
|
const { blockId, content, mode } = blockContext;
|
|
196
192
|
const isContentEditable = useIsEditable(mode);
|
|
197
193
|
const elementRef = React.useRef(null);
|
|
198
194
|
const { window: iframeWindow } = useFrame();
|
|
195
|
+
const projectSlug = useProjectSlug();
|
|
196
|
+
const { data: project } = useQuery(projectQueries.getBySlug(projectSlug));
|
|
197
|
+
const { data: pages } = useQuery({
|
|
198
|
+
...pageQueries.list(project?.id ?? 0),
|
|
199
|
+
enabled: !!project
|
|
200
|
+
});
|
|
201
|
+
const currentPathname = useLocation({ select: (l) => l.pathname });
|
|
199
202
|
const repeaterContext = React.use(RepeaterItemContext);
|
|
200
203
|
const fieldId = getOverlayFieldId(blockId, repeaterContext, String(name));
|
|
201
204
|
const fieldValue = repeaterContext ? repeaterContext.itemContent[name] : content[name];
|
|
202
205
|
const [isHovered, setIsHovered] = React.useState(false);
|
|
203
206
|
const [isEditorFocused, setIsEditorFocused] = React.useState(false);
|
|
204
|
-
const
|
|
205
|
-
const isFocused = isEditorFocused ||
|
|
207
|
+
const isSelectedFromSelection = useFieldSelection(blockId, String(name), "String", repeaterContext?.itemId);
|
|
208
|
+
const isFocused = isEditorFocused || isSelectedFromSelection;
|
|
206
209
|
const isHoveredFromSidebar = useOverlayMessage(iframeWindow, isContentEditable, "CAMOX_HOVER_FIELD", "CAMOX_HOVER_FIELD_END", { fieldId });
|
|
207
210
|
React.useEffect(() => {
|
|
208
211
|
setIsHovered(isHoveredFromSidebar);
|
|
@@ -262,7 +265,11 @@ function createBlock(options) {
|
|
|
262
265
|
if (isContentEditable) setIsHovered(false);
|
|
263
266
|
};
|
|
264
267
|
const fieldData = { text: fieldValue };
|
|
265
|
-
if (!isContentEditable) return /* @__PURE__ */ jsx(Fragment, { children: children({ children: markdownToReactNodes(fieldValue
|
|
268
|
+
if (!isContentEditable) return /* @__PURE__ */ jsx(Fragment, { children: children({ children: markdownToReactNodes(fieldValue, {
|
|
269
|
+
pages,
|
|
270
|
+
fallbackHref: currentPathname,
|
|
271
|
+
components
|
|
272
|
+
}) }, fieldData) });
|
|
266
273
|
return /* @__PURE__ */ jsx(Fragment, { children: children({
|
|
267
274
|
ref: elementRef,
|
|
268
275
|
"data-camox-field-id": fieldId,
|
|
@@ -282,9 +289,9 @@ function createBlock(options) {
|
|
|
282
289
|
};
|
|
283
290
|
const Embed = (t0) => {
|
|
284
291
|
const $ = c(59);
|
|
285
|
-
if ($[0] !== "
|
|
292
|
+
if ($[0] !== "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407") {
|
|
286
293
|
for (let $i = 0; $i < 59; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
287
|
-
$[0] = "
|
|
294
|
+
$[0] = "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407";
|
|
288
295
|
}
|
|
289
296
|
const { name, children } = t0;
|
|
290
297
|
const blockContext = React.use(Context);
|
|
@@ -469,14 +476,11 @@ function createBlock(options) {
|
|
|
469
476
|
} else t24 = $[42];
|
|
470
477
|
let t25;
|
|
471
478
|
if ($[43] !== isContentEditable) {
|
|
472
|
-
t25 = isContentEditable && /* @__PURE__ */ jsx("div", {
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
},
|
|
478
|
-
onClick: _temp
|
|
479
|
-
});
|
|
479
|
+
t25 = isContentEditable && /* @__PURE__ */ jsx("div", { style: {
|
|
480
|
+
position: "absolute",
|
|
481
|
+
inset: 0,
|
|
482
|
+
zIndex: 10
|
|
483
|
+
} });
|
|
480
484
|
$[43] = isContentEditable;
|
|
481
485
|
$[44] = t25;
|
|
482
486
|
} else t25 = $[44];
|
|
@@ -532,9 +536,9 @@ function createBlock(options) {
|
|
|
532
536
|
};
|
|
533
537
|
const Link = (t0) => {
|
|
534
538
|
const $ = c(38);
|
|
535
|
-
if ($[0] !== "
|
|
539
|
+
if ($[0] !== "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407") {
|
|
536
540
|
for (let $i = 0; $i < 38; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
537
|
-
$[0] = "
|
|
541
|
+
$[0] = "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407";
|
|
538
542
|
}
|
|
539
543
|
const { name, children } = t0;
|
|
540
544
|
const blockContext = React.use(Context);
|
|
@@ -585,7 +589,7 @@ function createBlock(options) {
|
|
|
585
589
|
const { data: pages } = useQuery(t6);
|
|
586
590
|
let t7;
|
|
587
591
|
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
588
|
-
t7 = { select:
|
|
592
|
+
t7 = { select: _temp };
|
|
589
593
|
$[10] = t7;
|
|
590
594
|
} else t7 = $[10];
|
|
591
595
|
const resolvedHref = resolveLinkHref(fieldValue, pages, useLocation(t7));
|
|
@@ -594,8 +598,8 @@ function createBlock(options) {
|
|
|
594
598
|
const [displayText, setDisplayText] = React.useState(fieldValue.text);
|
|
595
599
|
const [isHovered, setIsHovered] = React.useState(false);
|
|
596
600
|
const [isEditorFocused, setIsEditorFocused] = React.useState(false);
|
|
597
|
-
const
|
|
598
|
-
const isFocused = isEditorFocused ||
|
|
601
|
+
const isSelectedFromSelection = useFieldSelection(blockId, String(name), "Link", repeaterContext?.itemId);
|
|
602
|
+
const isFocused = isEditorFocused || isSelectedFromSelection;
|
|
599
603
|
React.useEffect(() => {
|
|
600
604
|
if (!isEditing) setDisplayText(fieldValue.text);
|
|
601
605
|
}, [fieldValue.text, isEditing]);
|
|
@@ -720,13 +724,13 @@ function createBlock(options) {
|
|
|
720
724
|
"data-camox-focused": isFocused || void 0,
|
|
721
725
|
"data-camox-overlay-mode": mode === "layout" ? "layout" : void 0,
|
|
722
726
|
contentEditable: true,
|
|
723
|
-
onClick:
|
|
727
|
+
onClick: _temp2,
|
|
724
728
|
onInput: handleInput,
|
|
725
729
|
onFocus: handleFocus,
|
|
726
730
|
onBlur: handleBlur,
|
|
727
731
|
onMouseEnter: t14,
|
|
728
732
|
onMouseLeave: t15,
|
|
729
|
-
onKeyDown:
|
|
733
|
+
onKeyDown: _temp3,
|
|
730
734
|
spellCheck: false,
|
|
731
735
|
suppressContentEditableWarning: true
|
|
732
736
|
};
|
|
@@ -737,7 +741,7 @@ function createBlock(options) {
|
|
|
737
741
|
t17 = /* @__PURE__ */ jsx("button", {
|
|
738
742
|
type: "button",
|
|
739
743
|
className: "hover:bg-accent flex items-center gap-1.5 rounded-md px-2 py-1 text-sm transition-colors",
|
|
740
|
-
onMouseDown:
|
|
744
|
+
onMouseDown: _temp4,
|
|
741
745
|
onClick: handleEditLink,
|
|
742
746
|
children: "Edit link"
|
|
743
747
|
});
|
|
@@ -773,9 +777,9 @@ function createBlock(options) {
|
|
|
773
777
|
};
|
|
774
778
|
const Image = (t0) => {
|
|
775
779
|
const $ = c(22);
|
|
776
|
-
if ($[0] !== "
|
|
780
|
+
if ($[0] !== "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407") {
|
|
777
781
|
for (let $i = 0; $i < 22; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
778
|
-
$[0] = "
|
|
782
|
+
$[0] = "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407";
|
|
779
783
|
}
|
|
780
784
|
const { name, children } = t0;
|
|
781
785
|
const blockContext = React.use(Context);
|
|
@@ -897,9 +901,9 @@ function createBlock(options) {
|
|
|
897
901
|
};
|
|
898
902
|
const File = (t0) => {
|
|
899
903
|
const $ = c(9);
|
|
900
|
-
if ($[0] !== "
|
|
904
|
+
if ($[0] !== "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407") {
|
|
901
905
|
for (let $i = 0; $i < 9; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
902
|
-
$[0] = "
|
|
906
|
+
$[0] = "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407";
|
|
903
907
|
}
|
|
904
908
|
const { name, children } = t0;
|
|
905
909
|
const blockContext = React.use(Context);
|
|
@@ -974,9 +978,9 @@ function createBlock(options) {
|
|
|
974
978
|
const FileList = _AssetList;
|
|
975
979
|
const RepeaterItemWrapper = (t0) => {
|
|
976
980
|
const $ = c(9);
|
|
977
|
-
if ($[0] !== "
|
|
981
|
+
if ($[0] !== "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407") {
|
|
978
982
|
for (let $i = 0; $i < 9; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
979
|
-
$[0] = "
|
|
983
|
+
$[0] = "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407";
|
|
980
984
|
}
|
|
981
985
|
const { itemId, blockId, mode, children } = t0;
|
|
982
986
|
const isContentEditable = useIsEditable(mode);
|
|
@@ -1017,9 +1021,9 @@ function createBlock(options) {
|
|
|
1017
1021
|
};
|
|
1018
1022
|
const RepeaterHoverProvider = (t0) => {
|
|
1019
1023
|
const $ = c(7);
|
|
1020
|
-
if ($[0] !== "
|
|
1024
|
+
if ($[0] !== "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407") {
|
|
1021
1025
|
for (let $i = 0; $i < 7; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
1022
|
-
$[0] = "
|
|
1026
|
+
$[0] = "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407";
|
|
1023
1027
|
}
|
|
1024
1028
|
const { blockId, fieldName, children } = t0;
|
|
1025
1029
|
const isContentEditable = useIsEditable("site");
|
|
@@ -1050,9 +1054,9 @@ function createBlock(options) {
|
|
|
1050
1054
|
};
|
|
1051
1055
|
const Repeater = (t0) => {
|
|
1052
1056
|
const $ = c(27);
|
|
1053
|
-
if ($[0] !== "
|
|
1057
|
+
if ($[0] !== "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407") {
|
|
1054
1058
|
for (let $i = 0; $i < 27; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
1055
|
-
$[0] = "
|
|
1059
|
+
$[0] = "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407";
|
|
1056
1060
|
}
|
|
1057
1061
|
const { name, children } = t0;
|
|
1058
1062
|
const blockContext = React.use(Context);
|
|
@@ -1177,19 +1181,18 @@ function createBlock(options) {
|
|
|
1177
1181
|
};
|
|
1178
1182
|
const BlockComponent = (t0) => {
|
|
1179
1183
|
const $ = c(78);
|
|
1180
|
-
if ($[0] !== "
|
|
1184
|
+
if ($[0] !== "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407") {
|
|
1181
1185
|
for (let $i = 0; $i < 78; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
1182
|
-
$[0] = "
|
|
1186
|
+
$[0] = "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407";
|
|
1183
1187
|
}
|
|
1184
1188
|
const { blockData, mode, isFirstBlock, showAddBlockTop, showAddBlockBottom, addBlockAfterPosition } = t0;
|
|
1185
1189
|
const isContentEditable = useIsEditable(mode);
|
|
1186
1190
|
const { window: iframeWindow } = useFrame();
|
|
1187
1191
|
const [isHovered, setIsHovered] = React.useState(false);
|
|
1188
|
-
const selection = useSelector(previewStore,
|
|
1189
|
-
const
|
|
1190
|
-
const
|
|
1191
|
-
const
|
|
1192
|
-
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);
|
|
1193
1196
|
const isBlockSelected = selection?.blockId === blockData._id;
|
|
1194
1197
|
const ref = React.useRef(null);
|
|
1195
1198
|
const [isFirstRender, setIsFirstRender] = React.useState(true);
|
|
@@ -1225,18 +1228,18 @@ function createBlock(options) {
|
|
|
1225
1228
|
$[8] = t3;
|
|
1226
1229
|
} else t3 = $[8];
|
|
1227
1230
|
let t4;
|
|
1228
|
-
if ($[9] !== blockData._id || $[10] !== isBlockSelected || $[11] !== isFirstRender || $[12] !==
|
|
1231
|
+
if ($[9] !== blockData._id || $[10] !== isBlockSelected || $[11] !== isFirstRender || $[12] !== isPageEditorSidebarOpen || $[13] !== pendingAgentBlockFocus) {
|
|
1229
1232
|
t4 = [
|
|
1230
1233
|
blockData._id,
|
|
1231
1234
|
isBlockSelected,
|
|
1232
1235
|
isFirstRender,
|
|
1233
|
-
|
|
1236
|
+
isPageEditorSidebarOpen,
|
|
1234
1237
|
pendingAgentBlockFocus
|
|
1235
1238
|
];
|
|
1236
1239
|
$[9] = blockData._id;
|
|
1237
1240
|
$[10] = isBlockSelected;
|
|
1238
1241
|
$[11] = isFirstRender;
|
|
1239
|
-
$[12] =
|
|
1242
|
+
$[12] = isPageEditorSidebarOpen;
|
|
1240
1243
|
$[13] = pendingAgentBlockFocus;
|
|
1241
1244
|
$[14] = t4;
|
|
1242
1245
|
} else t4 = $[14];
|
|
@@ -1294,7 +1297,7 @@ function createBlock(options) {
|
|
|
1294
1297
|
result = { ...blockData.content };
|
|
1295
1298
|
for (const key in result) {
|
|
1296
1299
|
const value = result[key];
|
|
1297
|
-
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);
|
|
1298
1301
|
}
|
|
1299
1302
|
$[24] = blockData.content;
|
|
1300
1303
|
$[25] = result;
|
|
@@ -1348,8 +1351,8 @@ function createBlock(options) {
|
|
|
1348
1351
|
$[35] = t14;
|
|
1349
1352
|
} else t14 = $[35];
|
|
1350
1353
|
const handleAddBlockClick = t14;
|
|
1351
|
-
const shouldShowOverlay = isContentEditable && (isHovered || isBlockSelected) && !
|
|
1352
|
-
const
|
|
1354
|
+
const shouldShowOverlay = isContentEditable && (isHovered || isBlockSelected) && !isAddBlockSidebarOpen;
|
|
1355
|
+
const shouldShowAddBlockOverlay = isAddBlockSidebarOpen && mode !== "peek";
|
|
1353
1356
|
let t15;
|
|
1354
1357
|
if ($[36] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1355
1358
|
t15 = {
|
|
@@ -1438,40 +1441,41 @@ function createBlock(options) {
|
|
|
1438
1441
|
$[55] = t27;
|
|
1439
1442
|
$[56] = t28;
|
|
1440
1443
|
} else t28 = $[56];
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
+
const t29 = shouldShowAddBlockOverlay || void 0;
|
|
1445
|
+
let t30;
|
|
1446
|
+
if ($[57] !== t29) {
|
|
1447
|
+
t30 = /* @__PURE__ */ jsx("div", {
|
|
1444
1448
|
className: "camox-sheet-overlay",
|
|
1445
|
-
|
|
1449
|
+
"data-camox-visible": t29
|
|
1446
1450
|
});
|
|
1447
|
-
$[57] =
|
|
1448
|
-
$[58] =
|
|
1449
|
-
} else
|
|
1450
|
-
let
|
|
1451
|
-
if ($[59] !== handleAddBlockClick || $[60] !==
|
|
1452
|
-
|
|
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, {
|
|
1453
1457
|
position: "top",
|
|
1454
|
-
hidden:
|
|
1458
|
+
hidden: isAddBlockSidebarOpen,
|
|
1455
1459
|
onMouseLeave: () => setIsHovered(false),
|
|
1456
1460
|
onClick: () => handleAddBlockClick("before")
|
|
1457
1461
|
}), (showAddBlockBottom ?? mode !== "layout") && /* @__PURE__ */ jsx(AddBlockControlBar, {
|
|
1458
1462
|
position: "bottom",
|
|
1459
|
-
hidden:
|
|
1463
|
+
hidden: isAddBlockSidebarOpen,
|
|
1460
1464
|
onMouseLeave: () => setIsHovered(false),
|
|
1461
1465
|
onClick: () => handleAddBlockClick("after")
|
|
1462
1466
|
})] });
|
|
1463
1467
|
$[59] = handleAddBlockClick;
|
|
1464
|
-
$[60] =
|
|
1468
|
+
$[60] = isAddBlockSidebarOpen;
|
|
1465
1469
|
$[61] = isFirstBlock;
|
|
1466
1470
|
$[62] = mode;
|
|
1467
1471
|
$[63] = shouldShowOverlay;
|
|
1468
1472
|
$[64] = showAddBlockBottom;
|
|
1469
1473
|
$[65] = showAddBlockTop;
|
|
1470
|
-
$[66] =
|
|
1471
|
-
} else
|
|
1472
|
-
let
|
|
1473
|
-
if ($[67] !== handleClick || $[68] !== handleMouseEnter || $[69] !== handleMouseLeave || $[70] !== t16 || $[71] !== t17 || $[72] !== t18 || $[73] !== t19 || $[74] !== t28 || $[75] !==
|
|
1474
|
-
|
|
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", {
|
|
1475
1479
|
className: "group visual-editing-block",
|
|
1476
1480
|
ref,
|
|
1477
1481
|
style: t15,
|
|
@@ -1484,8 +1488,8 @@ function createBlock(options) {
|
|
|
1484
1488
|
onMouseLeave: handleMouseLeave,
|
|
1485
1489
|
children: [
|
|
1486
1490
|
t28,
|
|
1487
|
-
|
|
1488
|
-
|
|
1491
|
+
t30,
|
|
1492
|
+
t31
|
|
1489
1493
|
]
|
|
1490
1494
|
});
|
|
1491
1495
|
$[67] = handleClick;
|
|
@@ -1496,11 +1500,11 @@ function createBlock(options) {
|
|
|
1496
1500
|
$[72] = t18;
|
|
1497
1501
|
$[73] = t19;
|
|
1498
1502
|
$[74] = t28;
|
|
1499
|
-
$[75] =
|
|
1500
|
-
$[76] =
|
|
1501
|
-
$[77] =
|
|
1502
|
-
} else
|
|
1503
|
-
return
|
|
1503
|
+
$[75] = t30;
|
|
1504
|
+
$[76] = t31;
|
|
1505
|
+
$[77] = t32;
|
|
1506
|
+
} else t32 = $[77];
|
|
1507
|
+
return t32;
|
|
1504
1508
|
};
|
|
1505
1509
|
const useSetting = (name) => {
|
|
1506
1510
|
const ctx = React.use(Context);
|
|
@@ -1513,9 +1517,9 @@ function createBlock(options) {
|
|
|
1513
1517
|
*/
|
|
1514
1518
|
const Detached = (t0) => {
|
|
1515
1519
|
const $ = c(31);
|
|
1516
|
-
if ($[0] !== "
|
|
1520
|
+
if ($[0] !== "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407") {
|
|
1517
1521
|
for (let $i = 0; $i < 31; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
1518
|
-
$[0] = "
|
|
1522
|
+
$[0] = "9cd21990f1cb26b8613f764719b3c2aa84ab101438380ec49833d48adbdfe407";
|
|
1519
1523
|
}
|
|
1520
1524
|
const { children } = t0;
|
|
1521
1525
|
const ctx = React.use(Context);
|
|
@@ -1523,9 +1527,8 @@ function createBlock(options) {
|
|
|
1523
1527
|
const { blockId, mode, isHovered, setIsHovered } = ctx;
|
|
1524
1528
|
const isContentEditable = useIsEditable(mode);
|
|
1525
1529
|
const { window: iframeWindow } = useFrame();
|
|
1526
|
-
const selection = useSelector(previewStore,
|
|
1527
|
-
const
|
|
1528
|
-
const isPageContentSheetOpen = useSelector(previewStore, _temp11);
|
|
1530
|
+
const selection = useSelector(previewStore, _temp0);
|
|
1531
|
+
const isAddBlockSidebarOpen = useSelector(previewStore, _temp1);
|
|
1529
1532
|
const isBlockSelected = selection?.blockId === blockId;
|
|
1530
1533
|
const t1 = String(blockId);
|
|
1531
1534
|
let t2;
|
|
@@ -1551,8 +1554,8 @@ function createBlock(options) {
|
|
|
1551
1554
|
t4 = $[6];
|
|
1552
1555
|
}
|
|
1553
1556
|
React.useEffect(t3, t4);
|
|
1554
|
-
const shouldShowOverlay = isContentEditable && (isHovered || isBlockSelected) && !
|
|
1555
|
-
const
|
|
1557
|
+
const shouldShowOverlay = isContentEditable && (isHovered || isBlockSelected) && !isAddBlockSidebarOpen;
|
|
1558
|
+
const shouldHideForAddBlockSidebar = isAddBlockSidebarOpen && mode !== "peek";
|
|
1556
1559
|
let t5;
|
|
1557
1560
|
if ($[7] !== blockId || $[8] !== isContentEditable) {
|
|
1558
1561
|
t5 = (e) => {
|
|
@@ -1589,7 +1592,7 @@ function createBlock(options) {
|
|
|
1589
1592
|
} else t7 = $[15];
|
|
1590
1593
|
const handleMouseLeave = t7;
|
|
1591
1594
|
const [container, setContainer] = React.useState(null);
|
|
1592
|
-
const t8 =
|
|
1595
|
+
const t8 = shouldHideForAddBlockSidebar ? 0 : 1;
|
|
1593
1596
|
let t9;
|
|
1594
1597
|
if ($[16] !== children || $[17] !== handleClick || $[18] !== handleMouseEnter || $[19] !== handleMouseLeave || $[20] !== t8) {
|
|
1595
1598
|
t9 = children({
|
|
@@ -1710,50 +1713,38 @@ function createBlock(options) {
|
|
|
1710
1713
|
}
|
|
1711
1714
|
};
|
|
1712
1715
|
}
|
|
1713
|
-
function _temp() {
|
|
1714
|
-
if (hasShownEmbedLockToast) return;
|
|
1715
|
-
hasShownEmbedLockToast = true;
|
|
1716
|
-
toast(/* @__PURE__ */ jsxs("span", { children: [
|
|
1717
|
-
"Hold ",
|
|
1718
|
-
/* @__PURE__ */ jsx(Kbd, { children: "L" }),
|
|
1719
|
-
" to interact with the embed content"
|
|
1720
|
-
] }));
|
|
1721
|
-
}
|
|
1722
|
-
function _temp2(l) {
|
|
1716
|
+
function _temp(l) {
|
|
1723
1717
|
return l.pathname;
|
|
1724
1718
|
}
|
|
1725
|
-
function
|
|
1719
|
+
function _temp2(e_1) {
|
|
1726
1720
|
return e_1.preventDefault();
|
|
1727
1721
|
}
|
|
1728
|
-
function
|
|
1722
|
+
function _temp3(e_2) {
|
|
1729
1723
|
if (e_2.key === "Escape") e_2.target.blur();
|
|
1730
1724
|
}
|
|
1731
|
-
function
|
|
1725
|
+
function _temp4(e_3) {
|
|
1732
1726
|
return e_3.preventDefault();
|
|
1733
1727
|
}
|
|
1734
|
-
function
|
|
1728
|
+
function _temp5(state) {
|
|
1735
1729
|
return state.context.selection;
|
|
1736
1730
|
}
|
|
1737
|
-
function
|
|
1738
|
-
return state_0.context.
|
|
1731
|
+
function _temp6(state_0) {
|
|
1732
|
+
return state_0.context.isPageEditorSidebarOpen;
|
|
1739
1733
|
}
|
|
1740
|
-
function
|
|
1741
|
-
return state_1.context.
|
|
1734
|
+
function _temp7(state_1) {
|
|
1735
|
+
return state_1.context.isAddBlockSidebarOpen;
|
|
1742
1736
|
}
|
|
1743
|
-
function
|
|
1737
|
+
function _temp8(state_2) {
|
|
1744
1738
|
return state_2.context.pendingAgentBlockFocus;
|
|
1745
1739
|
}
|
|
1746
|
-
function
|
|
1740
|
+
function _temp9(item) {
|
|
1747
1741
|
return item.content;
|
|
1748
1742
|
}
|
|
1749
|
-
function
|
|
1743
|
+
function _temp0(state) {
|
|
1750
1744
|
return state.context.selection;
|
|
1751
1745
|
}
|
|
1752
|
-
function
|
|
1753
|
-
return state_0.context.
|
|
1754
|
-
}
|
|
1755
|
-
function _temp11(state_1) {
|
|
1756
|
-
return state_1.context.isPageContentSheetOpen;
|
|
1746
|
+
function _temp1(state_0) {
|
|
1747
|
+
return state_0.context.isAddBlockSidebarOpen;
|
|
1757
1748
|
}
|
|
1758
1749
|
|
|
1759
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
|