camox 0.9.1 → 0.10.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/components/lexical/SidebarLexicalEditor.js +2 -1
- package/dist/core/createApp.d.ts +231 -209
- package/dist/core/createApp.js +17 -17
- package/dist/core/createBlock.d.ts +74 -72
- package/dist/core/createBlock.js +386 -363
- package/dist/core/createLayout.d.ts +100 -80
- package/dist/core/createLayout.js +93 -65
- package/dist/features/preview/CamoxPreview.js +76 -54
- package/dist/features/preview/components/AddBlockSheet.js +13 -13
- package/dist/features/preview/components/AssetFieldEditor.js +1 -1
- package/dist/features/preview/components/AssetLightbox.js +1 -1
- package/dist/features/preview/components/AssetPickerGrid.js +1 -1
- package/dist/features/preview/components/BlockActionsPopover.js +26 -26
- package/dist/features/preview/components/BlockErrorBoundary.js +59 -0
- package/dist/features/preview/components/{CreatePageSheet.js → CreatePageModal.js} +17 -19
- package/dist/features/preview/components/{EditPageSheet.js → EditPageModal.js} +27 -24
- package/dist/features/preview/components/Frame.js +1 -1
- package/dist/features/preview/components/ItemFieldsEditor.js +134 -98
- package/dist/features/preview/components/LinkFieldEditor.js +166 -146
- package/dist/features/preview/components/PageContentSheet.js +42 -37
- package/dist/features/preview/components/PageLocationFieldset.js +28 -26
- package/dist/features/preview/components/PagePicker.js +4 -4
- package/dist/features/preview/components/PageTree.js +337 -351
- package/dist/features/preview/components/PeekedBlock.js +38 -26
- package/dist/features/preview/components/PreviewPanel.js +16 -2
- package/dist/features/preview/components/PreviewSideSheet.js +26 -42
- package/dist/features/preview/components/RepeatableItemsList.js +7 -7
- package/dist/features/preview/components/useUpdateBlockPosition.js +1 -1
- package/dist/features/preview/previewStore.js +7 -7
- package/dist/features/provider/CamoxProvider.js +1 -1
- package/dist/features/routes/ogRoute.js +2 -2
- package/dist/features/routes/pageRoute.js +5 -4
- package/dist/features/studio/CamoxStudio.js +1 -1
- package/dist/features/studio/components/Navbar.js +1 -1
- package/dist/features/studio/components/ProjectMenu.js +1 -1
- package/dist/features/studio/components/UserButton.js +46 -30
- package/dist/features/vite/definitionsSync.js +20 -20
- package/dist/features/vite/routeGeneration.js +1 -0
- package/dist/features/vite/vite.js +51 -7
- package/dist/studio-overlays.css +34 -0
- package/dist/studio.css +1 -1
- package/package.json +4 -4
- package/skills/camox-layout/SKILL.md +34 -30
package/dist/core/createBlock.js
CHANGED
|
@@ -20,6 +20,7 @@ import { Popover, PopoverContent, PopoverTrigger } from "@camox/ui/popover";
|
|
|
20
20
|
import { toast } from "@camox/ui/toaster";
|
|
21
21
|
import { Type as Type$1 } from "@sinclair/typebox";
|
|
22
22
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
23
|
+
import { useLocation } from "@tanstack/react-router";
|
|
23
24
|
import { useSelector } from "@xstate/store/react";
|
|
24
25
|
import { generateKeyBetween } from "fractional-indexing";
|
|
25
26
|
import * as React from "react";
|
|
@@ -35,9 +36,16 @@ const normalizeLinkValue = (value) => {
|
|
|
35
36
|
};
|
|
36
37
|
return value;
|
|
37
38
|
};
|
|
38
|
-
/**
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Resolve a LinkValue to an href string.
|
|
41
|
+
*
|
|
42
|
+
* Hash-only and empty hrefs are anchored to `currentPathname` so TanStack Router's
|
|
43
|
+
* `<Link to>` builds the same `href` on SSR and client — bare `"#"` otherwise
|
|
44
|
+
* resolves inconsistently across environments, causing hydration mismatches.
|
|
45
|
+
*/
|
|
46
|
+
const resolveLinkHref = (link, pages, currentPathname) => {
|
|
47
|
+
if (link.type === "page") return (pages?.find((p) => String(p.id) === link.pageId))?.fullPath ?? currentPathname;
|
|
48
|
+
if (!link.href || link.href.startsWith("#")) return `${currentPathname}${link.href ?? ""}`;
|
|
41
49
|
return link.href;
|
|
42
50
|
};
|
|
43
51
|
let hasShownEmbedLockToast = false;
|
|
@@ -170,7 +178,7 @@ function createBlock(options) {
|
|
|
170
178
|
* Repeater item fields: blockId__itemId__fieldName
|
|
171
179
|
*/
|
|
172
180
|
const getOverlayFieldId = (blockId, repeaterContext, fieldName) => {
|
|
173
|
-
if (repeaterContext?.itemId) return `${blockId}__${repeaterContext.itemId}__${fieldName}`;
|
|
181
|
+
if (repeaterContext?.itemId != null) return `${blockId}__${repeaterContext.itemId}__${fieldName}`;
|
|
174
182
|
return `${blockId}__${fieldName}`;
|
|
175
183
|
};
|
|
176
184
|
const Field = ({ name, children }) => {
|
|
@@ -196,12 +204,12 @@ function createBlock(options) {
|
|
|
196
204
|
const handleChange = React.useCallback((newValue) => {
|
|
197
205
|
if (repeaterContext) {
|
|
198
206
|
const { itemId } = repeaterContext;
|
|
199
|
-
if (itemId) updateRepeatableContent.mutate({
|
|
200
|
-
id:
|
|
207
|
+
if (itemId != null) updateRepeatableContent.mutate({
|
|
208
|
+
id: itemId,
|
|
201
209
|
content: { [name]: newValue }
|
|
202
210
|
});
|
|
203
211
|
} else updateBlockContent.mutate({
|
|
204
|
-
id:
|
|
212
|
+
id: blockId,
|
|
205
213
|
content: { [name]: newValue }
|
|
206
214
|
});
|
|
207
215
|
}, [
|
|
@@ -213,7 +221,7 @@ function createBlock(options) {
|
|
|
213
221
|
]);
|
|
214
222
|
const handleFocus = React.useCallback(() => {
|
|
215
223
|
setIsEditorFocused(true);
|
|
216
|
-
if (repeaterContext?.itemId) previewStore.send({
|
|
224
|
+
if (repeaterContext?.itemId != null) previewStore.send({
|
|
217
225
|
type: "selectItemField",
|
|
218
226
|
blockId,
|
|
219
227
|
itemId: repeaterContext.itemId,
|
|
@@ -354,12 +362,12 @@ function createBlock(options) {
|
|
|
354
362
|
setUrlValue(newValue);
|
|
355
363
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
356
364
|
timerRef.current = window.setTimeout(() => {
|
|
357
|
-
if (repeaterContext?.itemId) updateRepeatableContent.mutate({
|
|
358
|
-
id:
|
|
365
|
+
if (repeaterContext?.itemId != null) updateRepeatableContent.mutate({
|
|
366
|
+
id: repeaterContext.itemId,
|
|
359
367
|
content: { [name]: newValue }
|
|
360
368
|
});
|
|
361
369
|
else updateBlockContent.mutate({
|
|
362
|
-
id:
|
|
370
|
+
id: blockId,
|
|
363
371
|
content: { [name]: newValue }
|
|
364
372
|
});
|
|
365
373
|
}, 500);
|
|
@@ -376,7 +384,7 @@ function createBlock(options) {
|
|
|
376
384
|
if ($[23] !== blockId || $[24] !== name || $[25] !== repeaterContext) {
|
|
377
385
|
t13 = (open, _eventDetails) => {
|
|
378
386
|
setIsOpen(open);
|
|
379
|
-
if (open) if (repeaterContext?.itemId) previewStore.send({
|
|
387
|
+
if (open) if (repeaterContext?.itemId != null) previewStore.send({
|
|
380
388
|
type: "selectItemField",
|
|
381
389
|
blockId,
|
|
382
390
|
itemId: repeaterContext.itemId,
|
|
@@ -506,7 +514,7 @@ function createBlock(options) {
|
|
|
506
514
|
return t28;
|
|
507
515
|
};
|
|
508
516
|
const Link = (t0) => {
|
|
509
|
-
const $ = c(
|
|
517
|
+
const $ = c(37);
|
|
510
518
|
const { name, children } = t0;
|
|
511
519
|
const blockContext = React.use(Context);
|
|
512
520
|
if (!blockContext) throw new Error("Link must be used within a Block Component");
|
|
@@ -554,7 +562,12 @@ function createBlock(options) {
|
|
|
554
562
|
$[8] = t6;
|
|
555
563
|
} else t6 = $[8];
|
|
556
564
|
const { data: pages } = useQuery(t6);
|
|
557
|
-
|
|
565
|
+
let t7;
|
|
566
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
567
|
+
t7 = { select: _temp2 };
|
|
568
|
+
$[9] = t7;
|
|
569
|
+
} else t7 = $[9];
|
|
570
|
+
const resolvedHref = resolveLinkHref(fieldValue, pages, useLocation(t7));
|
|
558
571
|
const fieldId = getOverlayFieldId(blockId, repeaterContext, String(name));
|
|
559
572
|
const [isEditing, setIsEditing] = React.useState(false);
|
|
560
573
|
const [displayText, setDisplayText] = React.useState(fieldValue.text);
|
|
@@ -566,41 +579,41 @@ function createBlock(options) {
|
|
|
566
579
|
if (!isEditing) setDisplayText(fieldValue.text);
|
|
567
580
|
}, [fieldValue.text, isEditing]);
|
|
568
581
|
const isHoveredFromSidebar = useOverlayMessage(iframeWindow, isContentEditable, "CAMOX_HOVER_FIELD", "CAMOX_HOVER_FIELD_END", { fieldId });
|
|
569
|
-
let t7;
|
|
570
582
|
let t8;
|
|
571
|
-
|
|
572
|
-
|
|
583
|
+
let t9;
|
|
584
|
+
if ($[10] !== isHoveredFromSidebar) {
|
|
585
|
+
t8 = () => {
|
|
573
586
|
setIsHovered(isHoveredFromSidebar);
|
|
574
587
|
};
|
|
575
|
-
|
|
576
|
-
$[
|
|
577
|
-
$[10] = t7;
|
|
588
|
+
t9 = [isHoveredFromSidebar];
|
|
589
|
+
$[10] = isHoveredFromSidebar;
|
|
578
590
|
$[11] = t8;
|
|
591
|
+
$[12] = t9;
|
|
579
592
|
} else {
|
|
580
|
-
t7 = $[10];
|
|
581
593
|
t8 = $[11];
|
|
594
|
+
t9 = $[12];
|
|
582
595
|
}
|
|
583
|
-
React.useEffect(
|
|
584
|
-
let
|
|
585
|
-
if ($[
|
|
586
|
-
|
|
587
|
-
if (repeaterContext?.itemId) updateRepeatableContent.mutate({
|
|
588
|
-
id:
|
|
596
|
+
React.useEffect(t8, t9);
|
|
597
|
+
let t10;
|
|
598
|
+
if ($[13] !== blockId || $[14] !== name || $[15] !== repeaterContext || $[16] !== updateBlockContent || $[17] !== updateRepeatableContent) {
|
|
599
|
+
t10 = (newLinkValue) => {
|
|
600
|
+
if (repeaterContext?.itemId != null) updateRepeatableContent.mutate({
|
|
601
|
+
id: repeaterContext.itemId,
|
|
589
602
|
content: { [name]: newLinkValue }
|
|
590
603
|
});
|
|
591
604
|
else updateBlockContent.mutate({
|
|
592
|
-
id:
|
|
605
|
+
id: blockId,
|
|
593
606
|
content: { [name]: newLinkValue }
|
|
594
607
|
});
|
|
595
608
|
};
|
|
596
|
-
$[
|
|
597
|
-
$[
|
|
598
|
-
$[
|
|
599
|
-
$[
|
|
600
|
-
$[
|
|
601
|
-
$[
|
|
602
|
-
} else
|
|
603
|
-
const saveLinkValue =
|
|
609
|
+
$[13] = blockId;
|
|
610
|
+
$[14] = name;
|
|
611
|
+
$[15] = repeaterContext;
|
|
612
|
+
$[16] = updateBlockContent;
|
|
613
|
+
$[17] = updateRepeatableContent;
|
|
614
|
+
$[18] = t10;
|
|
615
|
+
} else t10 = $[18];
|
|
616
|
+
const saveLinkValue = t10;
|
|
604
617
|
const handleInput = (e) => {
|
|
605
618
|
const newText = e.target.textContent || "";
|
|
606
619
|
saveLinkValue({
|
|
@@ -608,12 +621,12 @@ function createBlock(options) {
|
|
|
608
621
|
text: newText
|
|
609
622
|
});
|
|
610
623
|
};
|
|
611
|
-
let
|
|
612
|
-
if ($[
|
|
613
|
-
|
|
624
|
+
let t11;
|
|
625
|
+
if ($[19] !== blockId || $[20] !== name || $[21] !== repeaterContext) {
|
|
626
|
+
t11 = () => {
|
|
614
627
|
setIsEditing(true);
|
|
615
628
|
setIsEditorFocused(true);
|
|
616
|
-
if (repeaterContext?.itemId) previewStore.send({
|
|
629
|
+
if (repeaterContext?.itemId != null) previewStore.send({
|
|
617
630
|
type: "selectItemField",
|
|
618
631
|
blockId,
|
|
619
632
|
itemId: repeaterContext.itemId,
|
|
@@ -627,32 +640,32 @@ function createBlock(options) {
|
|
|
627
640
|
fieldType: "Link"
|
|
628
641
|
});
|
|
629
642
|
};
|
|
630
|
-
$[
|
|
631
|
-
$[
|
|
632
|
-
$[
|
|
633
|
-
$[21] = t10;
|
|
634
|
-
} else t10 = $[21];
|
|
635
|
-
const handleFocus = t10;
|
|
636
|
-
let t11;
|
|
637
|
-
if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
|
|
638
|
-
t11 = () => {
|
|
639
|
-
setIsEditing(false);
|
|
640
|
-
setIsEditorFocused(false);
|
|
641
|
-
};
|
|
643
|
+
$[19] = blockId;
|
|
644
|
+
$[20] = name;
|
|
645
|
+
$[21] = repeaterContext;
|
|
642
646
|
$[22] = t11;
|
|
643
647
|
} else t11 = $[22];
|
|
644
|
-
const
|
|
648
|
+
const handleFocus = t11;
|
|
645
649
|
let t12;
|
|
646
650
|
if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
|
|
647
|
-
t12 = (
|
|
651
|
+
t12 = () => {
|
|
652
|
+
setIsEditing(false);
|
|
653
|
+
setIsEditorFocused(false);
|
|
654
|
+
};
|
|
655
|
+
$[23] = t12;
|
|
656
|
+
} else t12 = $[23];
|
|
657
|
+
const handleBlur = t12;
|
|
658
|
+
let t13;
|
|
659
|
+
if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
|
|
660
|
+
t13 = (e_0) => {
|
|
648
661
|
e_0.stopPropagation();
|
|
649
662
|
previewStore.send({ type: "toggleContentSheet" });
|
|
650
663
|
setIsEditorFocused(false);
|
|
651
664
|
setIsEditing(false);
|
|
652
665
|
};
|
|
653
|
-
$[
|
|
654
|
-
} else
|
|
655
|
-
const handleEditLink =
|
|
666
|
+
$[24] = t13;
|
|
667
|
+
} else t13 = $[24];
|
|
668
|
+
const handleEditLink = t13;
|
|
656
669
|
const linkData = {
|
|
657
670
|
text: displayText,
|
|
658
671
|
href: resolvedHref,
|
|
@@ -664,16 +677,16 @@ function createBlock(options) {
|
|
|
664
677
|
rel: fieldValue.newTab ? "noreferrer" : void 0,
|
|
665
678
|
children: fieldValue.text
|
|
666
679
|
}, linkData) });
|
|
667
|
-
let t13;
|
|
668
680
|
let t14;
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
t14 = () => setIsHovered(
|
|
672
|
-
|
|
681
|
+
let t15;
|
|
682
|
+
if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
|
|
683
|
+
t14 = () => setIsHovered(true);
|
|
684
|
+
t15 = () => setIsHovered(false);
|
|
673
685
|
$[25] = t14;
|
|
686
|
+
$[26] = t15;
|
|
674
687
|
} else {
|
|
675
|
-
t13 = $[24];
|
|
676
688
|
t14 = $[25];
|
|
689
|
+
t15 = $[26];
|
|
677
690
|
}
|
|
678
691
|
const linkProps = {
|
|
679
692
|
ref: elementRef,
|
|
@@ -686,56 +699,56 @@ function createBlock(options) {
|
|
|
686
699
|
"data-camox-focused": isFocused || void 0,
|
|
687
700
|
"data-camox-overlay-mode": mode === "layout" ? "layout" : void 0,
|
|
688
701
|
contentEditable: true,
|
|
689
|
-
onClick:
|
|
702
|
+
onClick: _temp3,
|
|
690
703
|
onInput: handleInput,
|
|
691
704
|
onFocus: handleFocus,
|
|
692
705
|
onBlur: handleBlur,
|
|
693
|
-
onMouseEnter:
|
|
694
|
-
onMouseLeave:
|
|
695
|
-
onKeyDown:
|
|
706
|
+
onMouseEnter: t14,
|
|
707
|
+
onMouseLeave: t15,
|
|
708
|
+
onKeyDown: _temp4,
|
|
696
709
|
spellCheck: false,
|
|
697
710
|
suppressContentEditableWarning: true
|
|
698
711
|
};
|
|
699
712
|
const T0 = Popover;
|
|
700
|
-
const
|
|
701
|
-
let
|
|
702
|
-
if ($[
|
|
703
|
-
|
|
713
|
+
const t16 = children(linkProps, linkData);
|
|
714
|
+
let t17;
|
|
715
|
+
if ($[27] !== handleEditLink) {
|
|
716
|
+
t17 = /* @__PURE__ */ jsx("button", {
|
|
704
717
|
type: "button",
|
|
705
718
|
className: "hover:bg-accent flex items-center gap-1.5 rounded-md px-2 py-1 text-sm transition-colors",
|
|
706
|
-
onMouseDown:
|
|
719
|
+
onMouseDown: _temp5,
|
|
707
720
|
onClick: handleEditLink,
|
|
708
721
|
children: "Edit link"
|
|
709
722
|
});
|
|
710
|
-
$[
|
|
711
|
-
$[
|
|
712
|
-
} else
|
|
713
|
-
let
|
|
714
|
-
if ($[
|
|
715
|
-
|
|
723
|
+
$[27] = handleEditLink;
|
|
724
|
+
$[28] = t17;
|
|
725
|
+
} else t17 = $[28];
|
|
726
|
+
let t18;
|
|
727
|
+
if ($[29] !== elementRef || $[30] !== t17) {
|
|
728
|
+
t18 = /* @__PURE__ */ jsx(PopoverContent, {
|
|
716
729
|
className: "w-auto p-2",
|
|
717
730
|
initialFocus: false,
|
|
718
731
|
anchor: elementRef,
|
|
719
732
|
align: "end",
|
|
720
|
-
children:
|
|
733
|
+
children: t17
|
|
721
734
|
});
|
|
722
|
-
$[
|
|
723
|
-
$[29] = t16;
|
|
735
|
+
$[29] = elementRef;
|
|
724
736
|
$[30] = t17;
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
737
|
+
$[31] = t18;
|
|
738
|
+
} else t18 = $[31];
|
|
739
|
+
let t19;
|
|
740
|
+
if ($[32] !== T0 || $[33] !== isEditorFocused || $[34] !== t16 || $[35] !== t18) {
|
|
741
|
+
t19 = /* @__PURE__ */ jsxs(T0, {
|
|
729
742
|
open: isEditorFocused,
|
|
730
|
-
children: [
|
|
743
|
+
children: [t16, t18]
|
|
731
744
|
});
|
|
732
|
-
$[
|
|
733
|
-
$[
|
|
734
|
-
$[
|
|
735
|
-
$[34] = t17;
|
|
745
|
+
$[32] = T0;
|
|
746
|
+
$[33] = isEditorFocused;
|
|
747
|
+
$[34] = t16;
|
|
736
748
|
$[35] = t18;
|
|
737
|
-
|
|
738
|
-
|
|
749
|
+
$[36] = t19;
|
|
750
|
+
} else t19 = $[36];
|
|
751
|
+
return t19;
|
|
739
752
|
};
|
|
740
753
|
const Image = (t0) => {
|
|
741
754
|
const $ = c(25);
|
|
@@ -787,8 +800,8 @@ function createBlock(options) {
|
|
|
787
800
|
if ($[9] !== blockId || $[10] !== isContentEditable || $[11] !== name || $[12] !== repeaterContext) {
|
|
788
801
|
t6 = () => {
|
|
789
802
|
if (!isContentEditable) return;
|
|
790
|
-
const imageFieldName = repeaterContext &&
|
|
791
|
-
if (repeaterContext?.itemId) previewStore.send({
|
|
803
|
+
const imageFieldName = repeaterContext && repeaterContext.itemId == null ? repeaterContext.arrayFieldName : String(name);
|
|
804
|
+
if (repeaterContext?.itemId != null) previewStore.send({
|
|
792
805
|
type: "selectItemField",
|
|
793
806
|
blockId,
|
|
794
807
|
itemId: repeaterContext.itemId,
|
|
@@ -892,64 +905,67 @@ function createBlock(options) {
|
|
|
892
905
|
const isContentEditable = useIsEditable(mode);
|
|
893
906
|
const { window: iframeWindow } = useFrame();
|
|
894
907
|
const isRepeaterHovered = React.useContext(RepeaterHoverContext);
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
908
|
+
const t1 = String(blockId);
|
|
909
|
+
const t2 = String(itemId);
|
|
910
|
+
let t3;
|
|
911
|
+
if ($[0] !== t1 || $[1] !== t2) {
|
|
912
|
+
t3 = {
|
|
913
|
+
blockId: t1,
|
|
914
|
+
itemId: t2
|
|
900
915
|
};
|
|
901
|
-
$[0] =
|
|
902
|
-
$[1] =
|
|
903
|
-
$[2] =
|
|
904
|
-
} else
|
|
905
|
-
const isHovered = useOverlayMessage(iframeWindow, isContentEditable, "CAMOX_HOVER_REPEATER_ITEM", "CAMOX_HOVER_REPEATER_ITEM_END",
|
|
916
|
+
$[0] = t1;
|
|
917
|
+
$[1] = t2;
|
|
918
|
+
$[2] = t3;
|
|
919
|
+
} else t3 = $[2];
|
|
920
|
+
const isHovered = useOverlayMessage(iframeWindow, isContentEditable, "CAMOX_HOVER_REPEATER_ITEM", "CAMOX_HOVER_REPEATER_ITEM_END", t3);
|
|
906
921
|
const showOverlay = isContentEditable && (isHovered || isRepeaterHovered);
|
|
907
|
-
const
|
|
908
|
-
const
|
|
909
|
-
const
|
|
910
|
-
let
|
|
911
|
-
if ($[3] !== children || $[4] !==
|
|
912
|
-
|
|
913
|
-
"data-camox-repeater-item-id":
|
|
914
|
-
"data-camox-hovered":
|
|
915
|
-
"data-camox-overlay-mode":
|
|
922
|
+
const t4 = isContentEditable ? itemId : void 0;
|
|
923
|
+
const t5 = showOverlay || void 0;
|
|
924
|
+
const t6 = mode === "layout" ? "layout" : void 0;
|
|
925
|
+
let t7;
|
|
926
|
+
if ($[3] !== children || $[4] !== t4 || $[5] !== t5 || $[6] !== t6) {
|
|
927
|
+
t7 = /* @__PURE__ */ jsx("div", {
|
|
928
|
+
"data-camox-repeater-item-id": t4,
|
|
929
|
+
"data-camox-hovered": t5,
|
|
930
|
+
"data-camox-overlay-mode": t6,
|
|
916
931
|
children
|
|
917
932
|
});
|
|
918
933
|
$[3] = children;
|
|
919
|
-
$[4] =
|
|
920
|
-
$[5] =
|
|
921
|
-
$[6] =
|
|
922
|
-
$[7] =
|
|
923
|
-
} else
|
|
924
|
-
return
|
|
934
|
+
$[4] = t4;
|
|
935
|
+
$[5] = t5;
|
|
936
|
+
$[6] = t6;
|
|
937
|
+
$[7] = t7;
|
|
938
|
+
} else t7 = $[7];
|
|
939
|
+
return t7;
|
|
925
940
|
};
|
|
926
941
|
const RepeaterHoverProvider = (t0) => {
|
|
927
942
|
const $ = c(6);
|
|
928
943
|
const { blockId, fieldName, children } = t0;
|
|
929
944
|
const isContentEditable = useIsEditable("site");
|
|
930
945
|
const { window: iframeWindow } = useFrame();
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
946
|
+
const t1 = String(blockId);
|
|
947
|
+
let t2;
|
|
948
|
+
if ($[0] !== fieldName || $[1] !== t1) {
|
|
949
|
+
t2 = {
|
|
950
|
+
blockId: t1,
|
|
935
951
|
fieldName
|
|
936
952
|
};
|
|
937
|
-
$[0] =
|
|
938
|
-
$[1] =
|
|
939
|
-
$[2] =
|
|
940
|
-
} else
|
|
941
|
-
const isHovered = useOverlayMessage(iframeWindow, isContentEditable, "CAMOX_HOVER_REPEATER", "CAMOX_HOVER_REPEATER_END",
|
|
942
|
-
let
|
|
953
|
+
$[0] = fieldName;
|
|
954
|
+
$[1] = t1;
|
|
955
|
+
$[2] = t2;
|
|
956
|
+
} else t2 = $[2];
|
|
957
|
+
const isHovered = useOverlayMessage(iframeWindow, isContentEditable, "CAMOX_HOVER_REPEATER", "CAMOX_HOVER_REPEATER_END", t2);
|
|
958
|
+
let t3;
|
|
943
959
|
if ($[3] !== children || $[4] !== isHovered) {
|
|
944
|
-
|
|
960
|
+
t3 = /* @__PURE__ */ jsx(RepeaterHoverContext.Provider, {
|
|
945
961
|
value: isHovered,
|
|
946
962
|
children
|
|
947
963
|
});
|
|
948
964
|
$[3] = children;
|
|
949
965
|
$[4] = isHovered;
|
|
950
|
-
$[5] =
|
|
951
|
-
} else
|
|
952
|
-
return
|
|
966
|
+
$[5] = t3;
|
|
967
|
+
} else t3 = $[5];
|
|
968
|
+
return t3;
|
|
953
969
|
};
|
|
954
970
|
const Repeater = (t0) => {
|
|
955
971
|
const $ = c(10);
|
|
@@ -1008,7 +1024,7 @@ function createBlock(options) {
|
|
|
1008
1024
|
...repeatableItemDefaults[fieldName],
|
|
1009
1025
|
...isDbItem ? item_0.content : item_0
|
|
1010
1026
|
};
|
|
1011
|
-
const itemId = isDbItem ?
|
|
1027
|
+
const itemId = isDbItem ? item_0.id : void 0;
|
|
1012
1028
|
return /* @__PURE__ */ jsx(RepeaterItemContext.Provider, {
|
|
1013
1029
|
value: {
|
|
1014
1030
|
arrayFieldName: fieldName,
|
|
@@ -1022,7 +1038,7 @@ function createBlock(options) {
|
|
|
1022
1038
|
mode,
|
|
1023
1039
|
children: children(itemComponents, index)
|
|
1024
1040
|
})
|
|
1025
|
-
}, itemId
|
|
1041
|
+
}, itemId ?? index);
|
|
1026
1042
|
});
|
|
1027
1043
|
let t3;
|
|
1028
1044
|
if ($[5] !== T0 || $[6] !== blockId || $[7] !== fieldName || $[8] !== t2) {
|
|
@@ -1045,9 +1061,9 @@ function createBlock(options) {
|
|
|
1045
1061
|
const isContentEditable = useIsEditable(mode);
|
|
1046
1062
|
const { window: iframeWindow } = useFrame();
|
|
1047
1063
|
const [isHovered, setIsHovered] = React.useState(false);
|
|
1048
|
-
const selection = useSelector(previewStore,
|
|
1049
|
-
const isPageContentSheetOpen = useSelector(previewStore,
|
|
1050
|
-
const isAddBlockSheetOpen = useSelector(previewStore,
|
|
1064
|
+
const selection = useSelector(previewStore, _temp6);
|
|
1065
|
+
const isPageContentSheetOpen = useSelector(previewStore, _temp7);
|
|
1066
|
+
const isAddBlockSheetOpen = useSelector(previewStore, _temp8);
|
|
1051
1067
|
const isAnySideSheetOpen = useIsPreviewSheetOpen();
|
|
1052
1068
|
const isBlockSelected = selection?.blockId === blockData._id;
|
|
1053
1069
|
const ref = React.useRef(null);
|
|
@@ -1092,42 +1108,43 @@ function createBlock(options) {
|
|
|
1092
1108
|
$[9] = t4;
|
|
1093
1109
|
} else t4 = $[9];
|
|
1094
1110
|
React.useEffect(t3, t4);
|
|
1095
|
-
|
|
1096
|
-
if ($[10] !== blockData._id) {
|
|
1097
|
-
t5 = { blockId: blockData._id };
|
|
1098
|
-
$[10] = blockData._id;
|
|
1099
|
-
$[11] = t5;
|
|
1100
|
-
} else t5 = $[11];
|
|
1101
|
-
const isHoveredFromSidebar = useOverlayMessage(iframeWindow, isContentEditable, "CAMOX_HOVER_BLOCK", "CAMOX_HOVER_BLOCK_END", t5);
|
|
1111
|
+
const t5 = String(blockData._id);
|
|
1102
1112
|
let t6;
|
|
1113
|
+
if ($[10] !== t5) {
|
|
1114
|
+
t6 = { blockId: t5 };
|
|
1115
|
+
$[10] = t5;
|
|
1116
|
+
$[11] = t6;
|
|
1117
|
+
} else t6 = $[11];
|
|
1118
|
+
const isHoveredFromSidebar = useOverlayMessage(iframeWindow, isContentEditable, "CAMOX_HOVER_BLOCK", "CAMOX_HOVER_BLOCK_END", t6);
|
|
1103
1119
|
let t7;
|
|
1120
|
+
let t8;
|
|
1104
1121
|
if ($[12] !== isHoveredFromSidebar) {
|
|
1105
|
-
|
|
1122
|
+
t7 = () => {
|
|
1106
1123
|
setIsHovered(isHoveredFromSidebar);
|
|
1107
1124
|
};
|
|
1108
|
-
|
|
1125
|
+
t8 = [isHoveredFromSidebar];
|
|
1109
1126
|
$[12] = isHoveredFromSidebar;
|
|
1110
|
-
$[13] =
|
|
1111
|
-
$[14] =
|
|
1127
|
+
$[13] = t7;
|
|
1128
|
+
$[14] = t8;
|
|
1112
1129
|
} else {
|
|
1113
|
-
|
|
1114
|
-
|
|
1130
|
+
t7 = $[13];
|
|
1131
|
+
t8 = $[14];
|
|
1115
1132
|
}
|
|
1116
|
-
React.useEffect(
|
|
1133
|
+
React.useEffect(t7, t8);
|
|
1117
1134
|
let result;
|
|
1118
1135
|
if ($[15] !== blockData.content) {
|
|
1119
1136
|
result = { ...blockData.content };
|
|
1120
1137
|
for (const key in result) {
|
|
1121
1138
|
const value = result[key];
|
|
1122
|
-
if (Array.isArray(value) && value.length > 0 && value[0]?.content !== void 0) result[key] = value.map(
|
|
1139
|
+
if (Array.isArray(value) && value.length > 0 && value[0]?.content !== void 0) result[key] = value.map(_temp9);
|
|
1123
1140
|
}
|
|
1124
1141
|
$[15] = blockData.content;
|
|
1125
1142
|
$[16] = result;
|
|
1126
1143
|
} else result = $[16];
|
|
1127
1144
|
const normalizedContent = result;
|
|
1128
|
-
let
|
|
1145
|
+
let t9;
|
|
1129
1146
|
if ($[17] !== blockData._id || $[18] !== isContentEditable) {
|
|
1130
|
-
|
|
1147
|
+
t9 = (e) => {
|
|
1131
1148
|
if (!isContentEditable) return;
|
|
1132
1149
|
if (e.target.closest("[data-camox-field-id]")) return;
|
|
1133
1150
|
previewStore.send({
|
|
@@ -1137,30 +1154,30 @@ function createBlock(options) {
|
|
|
1137
1154
|
};
|
|
1138
1155
|
$[17] = blockData._id;
|
|
1139
1156
|
$[18] = isContentEditable;
|
|
1140
|
-
$[19] =
|
|
1141
|
-
} else
|
|
1142
|
-
const handleClick =
|
|
1143
|
-
let
|
|
1157
|
+
$[19] = t9;
|
|
1158
|
+
} else t9 = $[19];
|
|
1159
|
+
const handleClick = t9;
|
|
1160
|
+
let t10;
|
|
1144
1161
|
if ($[20] !== isContentEditable) {
|
|
1145
|
-
|
|
1162
|
+
t10 = () => {
|
|
1146
1163
|
if (isContentEditable) setIsHovered(true);
|
|
1147
1164
|
};
|
|
1148
1165
|
$[20] = isContentEditable;
|
|
1149
|
-
$[21] =
|
|
1150
|
-
} else
|
|
1151
|
-
const handleMouseEnter =
|
|
1152
|
-
let
|
|
1166
|
+
$[21] = t10;
|
|
1167
|
+
} else t10 = $[21];
|
|
1168
|
+
const handleMouseEnter = t10;
|
|
1169
|
+
let t11;
|
|
1153
1170
|
if ($[22] !== isContentEditable) {
|
|
1154
|
-
|
|
1171
|
+
t11 = () => {
|
|
1155
1172
|
if (isContentEditable) setIsHovered(false);
|
|
1156
1173
|
};
|
|
1157
1174
|
$[22] = isContentEditable;
|
|
1158
|
-
$[23] =
|
|
1159
|
-
} else
|
|
1160
|
-
const handleMouseLeave =
|
|
1161
|
-
let
|
|
1175
|
+
$[23] = t11;
|
|
1176
|
+
} else t11 = $[23];
|
|
1177
|
+
const handleMouseLeave = t11;
|
|
1178
|
+
let t12;
|
|
1162
1179
|
if ($[24] !== addBlockAfterPosition || $[25] !== blockData.position) {
|
|
1163
|
-
|
|
1180
|
+
t12 = (insertPosition) => {
|
|
1164
1181
|
postOverlayMessage({
|
|
1165
1182
|
type: "CAMOX_ADD_BLOCK_REQUEST",
|
|
1166
1183
|
blockPosition: blockData.position,
|
|
@@ -1170,35 +1187,35 @@ function createBlock(options) {
|
|
|
1170
1187
|
};
|
|
1171
1188
|
$[24] = addBlockAfterPosition;
|
|
1172
1189
|
$[25] = blockData.position;
|
|
1173
|
-
$[26] =
|
|
1174
|
-
} else
|
|
1175
|
-
const handleAddBlockClick =
|
|
1190
|
+
$[26] = t12;
|
|
1191
|
+
} else t12 = $[26];
|
|
1192
|
+
const handleAddBlockClick = t12;
|
|
1176
1193
|
const shouldShowOverlay = isContentEditable && (isHovered || isBlockSelected) && !isAddBlockSheetOpen;
|
|
1177
1194
|
const shouldShowSheetOverlay = isAddBlockSheetOpen && mode !== "peek" || isPageContentSheetOpen && !isBlockSelected;
|
|
1178
|
-
let
|
|
1195
|
+
let t13;
|
|
1179
1196
|
if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1180
|
-
|
|
1197
|
+
t13 = {
|
|
1181
1198
|
position: "relative",
|
|
1182
1199
|
scrollMargin: "5rem",
|
|
1183
1200
|
background: "var(--background)"
|
|
1184
1201
|
};
|
|
1185
|
-
$[27] =
|
|
1186
|
-
} else
|
|
1187
|
-
const
|
|
1188
|
-
const
|
|
1189
|
-
const
|
|
1190
|
-
const
|
|
1191
|
-
const
|
|
1192
|
-
let
|
|
1202
|
+
$[27] = t13;
|
|
1203
|
+
} else t13 = $[27];
|
|
1204
|
+
const t14 = isContentEditable ? blockData._id : void 0;
|
|
1205
|
+
const t15 = shouldShowOverlay && !isBlockSelected || void 0;
|
|
1206
|
+
const t16 = shouldShowOverlay && isBlockSelected || void 0;
|
|
1207
|
+
const t17 = mode === "layout" ? "layout" : void 0;
|
|
1208
|
+
const t18 = blockData._id;
|
|
1209
|
+
let t19;
|
|
1193
1210
|
if ($[28] !== blockData.content) {
|
|
1194
|
-
|
|
1211
|
+
t19 = {
|
|
1195
1212
|
...contentDefaults,
|
|
1196
1213
|
...blockData.content
|
|
1197
1214
|
};
|
|
1198
1215
|
$[28] = blockData.content;
|
|
1199
|
-
$[29] =
|
|
1200
|
-
} else
|
|
1201
|
-
const merged =
|
|
1216
|
+
$[29] = t19;
|
|
1217
|
+
} else t19 = $[29];
|
|
1218
|
+
const merged = t19;
|
|
1202
1219
|
let overrides;
|
|
1203
1220
|
if ($[30] !== merged) {
|
|
1204
1221
|
overrides = {};
|
|
@@ -1209,33 +1226,33 @@ function createBlock(options) {
|
|
|
1209
1226
|
$[30] = merged;
|
|
1210
1227
|
$[31] = overrides;
|
|
1211
1228
|
} else overrides = $[31];
|
|
1212
|
-
let
|
|
1229
|
+
let t20;
|
|
1213
1230
|
if ($[32] !== merged || $[33] !== overrides) {
|
|
1214
|
-
|
|
1231
|
+
t20 = {
|
|
1215
1232
|
...merged,
|
|
1216
1233
|
...overrides
|
|
1217
1234
|
};
|
|
1218
1235
|
$[32] = merged;
|
|
1219
1236
|
$[33] = overrides;
|
|
1220
|
-
$[34] =
|
|
1221
|
-
} else
|
|
1222
|
-
const
|
|
1223
|
-
let
|
|
1237
|
+
$[34] = t20;
|
|
1238
|
+
} else t20 = $[34];
|
|
1239
|
+
const t21 = t20;
|
|
1240
|
+
let t22;
|
|
1224
1241
|
if ($[35] !== blockData.settings) {
|
|
1225
|
-
|
|
1242
|
+
t22 = {
|
|
1226
1243
|
...settingsDefaults,
|
|
1227
1244
|
...blockData.settings
|
|
1228
1245
|
};
|
|
1229
1246
|
$[35] = blockData.settings;
|
|
1230
|
-
$[36] =
|
|
1231
|
-
} else
|
|
1232
|
-
const
|
|
1233
|
-
let
|
|
1234
|
-
if ($[37] !== blockData._id || $[38] !== isHovered || $[39] !== mode || $[40] !==
|
|
1235
|
-
|
|
1236
|
-
blockId:
|
|
1237
|
-
content:
|
|
1238
|
-
settings:
|
|
1247
|
+
$[36] = t22;
|
|
1248
|
+
} else t22 = $[36];
|
|
1249
|
+
const t23 = t22;
|
|
1250
|
+
let t24;
|
|
1251
|
+
if ($[37] !== blockData._id || $[38] !== isHovered || $[39] !== mode || $[40] !== t21 || $[41] !== t23) {
|
|
1252
|
+
t24 = {
|
|
1253
|
+
blockId: t18,
|
|
1254
|
+
content: t21,
|
|
1255
|
+
settings: t23,
|
|
1239
1256
|
mode,
|
|
1240
1257
|
isHovered,
|
|
1241
1258
|
setIsHovered
|
|
@@ -1243,38 +1260,38 @@ function createBlock(options) {
|
|
|
1243
1260
|
$[37] = blockData._id;
|
|
1244
1261
|
$[38] = isHovered;
|
|
1245
1262
|
$[39] = mode;
|
|
1246
|
-
$[40] =
|
|
1247
|
-
$[41] =
|
|
1248
|
-
$[42] =
|
|
1249
|
-
} else
|
|
1250
|
-
let
|
|
1263
|
+
$[40] = t21;
|
|
1264
|
+
$[41] = t23;
|
|
1265
|
+
$[42] = t24;
|
|
1266
|
+
} else t24 = $[42];
|
|
1267
|
+
let t25;
|
|
1251
1268
|
if ($[43] !== normalizedContent) {
|
|
1252
|
-
|
|
1269
|
+
t25 = /* @__PURE__ */ jsx(options.component, { content: normalizedContent });
|
|
1253
1270
|
$[43] = normalizedContent;
|
|
1254
|
-
$[44] =
|
|
1255
|
-
} else
|
|
1256
|
-
let t25;
|
|
1257
|
-
if ($[45] !== t23 || $[46] !== t24) {
|
|
1258
|
-
t25 = /* @__PURE__ */ jsx(Context.Provider, {
|
|
1259
|
-
value: t23,
|
|
1260
|
-
children: t24
|
|
1261
|
-
});
|
|
1262
|
-
$[45] = t23;
|
|
1263
|
-
$[46] = t24;
|
|
1264
|
-
$[47] = t25;
|
|
1265
|
-
} else t25 = $[47];
|
|
1271
|
+
$[44] = t25;
|
|
1272
|
+
} else t25 = $[44];
|
|
1266
1273
|
let t26;
|
|
1274
|
+
if ($[45] !== t24 || $[46] !== t25) {
|
|
1275
|
+
t26 = /* @__PURE__ */ jsx(Context.Provider, {
|
|
1276
|
+
value: t24,
|
|
1277
|
+
children: t25
|
|
1278
|
+
});
|
|
1279
|
+
$[45] = t24;
|
|
1280
|
+
$[46] = t25;
|
|
1281
|
+
$[47] = t26;
|
|
1282
|
+
} else t26 = $[47];
|
|
1283
|
+
let t27;
|
|
1267
1284
|
if ($[48] !== shouldShowSheetOverlay) {
|
|
1268
|
-
|
|
1285
|
+
t27 = /* @__PURE__ */ jsx("div", {
|
|
1269
1286
|
className: "camox-sheet-overlay",
|
|
1270
1287
|
...shouldShowSheetOverlay ? { "data-camox-visible": "" } : {}
|
|
1271
1288
|
});
|
|
1272
1289
|
$[48] = shouldShowSheetOverlay;
|
|
1273
|
-
$[49] =
|
|
1274
|
-
} else
|
|
1275
|
-
let
|
|
1290
|
+
$[49] = t27;
|
|
1291
|
+
} else t27 = $[49];
|
|
1292
|
+
let t28;
|
|
1276
1293
|
if ($[50] !== handleAddBlockClick || $[51] !== isAnySideSheetOpen || $[52] !== isFirstBlock || $[53] !== mode || $[54] !== shouldShowOverlay || $[55] !== showAddBlockBottom || $[56] !== showAddBlockTop) {
|
|
1277
|
-
|
|
1294
|
+
t28 = shouldShowOverlay && /* @__PURE__ */ jsxs(Fragment, { children: [(showAddBlockTop ?? (mode !== "layout" && !isFirstBlock)) && /* @__PURE__ */ jsx(AddBlockControlBar, {
|
|
1278
1295
|
position: "top",
|
|
1279
1296
|
hidden: isAnySideSheetOpen,
|
|
1280
1297
|
onMouseLeave: () => setIsHovered(false),
|
|
@@ -1292,40 +1309,40 @@ function createBlock(options) {
|
|
|
1292
1309
|
$[54] = shouldShowOverlay;
|
|
1293
1310
|
$[55] = showAddBlockBottom;
|
|
1294
1311
|
$[56] = showAddBlockTop;
|
|
1295
|
-
$[57] =
|
|
1296
|
-
} else
|
|
1297
|
-
let
|
|
1298
|
-
if ($[58] !== handleClick || $[59] !== handleMouseEnter || $[60] !== handleMouseLeave || $[61] !==
|
|
1299
|
-
|
|
1312
|
+
$[57] = t28;
|
|
1313
|
+
} else t28 = $[57];
|
|
1314
|
+
let t29;
|
|
1315
|
+
if ($[58] !== handleClick || $[59] !== handleMouseEnter || $[60] !== handleMouseLeave || $[61] !== t14 || $[62] !== t15 || $[63] !== t16 || $[64] !== t17 || $[65] !== t26 || $[66] !== t27 || $[67] !== t28) {
|
|
1316
|
+
t29 = /* @__PURE__ */ jsxs("div", {
|
|
1300
1317
|
className: "group visual-editing-block",
|
|
1301
1318
|
ref,
|
|
1302
|
-
style:
|
|
1303
|
-
"data-camox-block-id":
|
|
1304
|
-
"data-camox-hovered":
|
|
1305
|
-
"data-camox-focused":
|
|
1306
|
-
"data-camox-overlay-mode":
|
|
1319
|
+
style: t13,
|
|
1320
|
+
"data-camox-block-id": t14,
|
|
1321
|
+
"data-camox-hovered": t15,
|
|
1322
|
+
"data-camox-focused": t16,
|
|
1323
|
+
"data-camox-overlay-mode": t17,
|
|
1307
1324
|
onClick: handleClick,
|
|
1308
1325
|
onMouseEnter: handleMouseEnter,
|
|
1309
1326
|
onMouseLeave: handleMouseLeave,
|
|
1310
1327
|
children: [
|
|
1311
|
-
t25,
|
|
1312
1328
|
t26,
|
|
1313
|
-
t27
|
|
1329
|
+
t27,
|
|
1330
|
+
t28
|
|
1314
1331
|
]
|
|
1315
1332
|
});
|
|
1316
1333
|
$[58] = handleClick;
|
|
1317
1334
|
$[59] = handleMouseEnter;
|
|
1318
1335
|
$[60] = handleMouseLeave;
|
|
1319
|
-
$[61] =
|
|
1320
|
-
$[62] =
|
|
1321
|
-
$[63] =
|
|
1322
|
-
$[64] =
|
|
1323
|
-
$[65] =
|
|
1324
|
-
$[66] =
|
|
1325
|
-
$[67] =
|
|
1326
|
-
$[68] =
|
|
1327
|
-
} else
|
|
1328
|
-
return
|
|
1336
|
+
$[61] = t14;
|
|
1337
|
+
$[62] = t15;
|
|
1338
|
+
$[63] = t16;
|
|
1339
|
+
$[64] = t17;
|
|
1340
|
+
$[65] = t26;
|
|
1341
|
+
$[66] = t27;
|
|
1342
|
+
$[67] = t28;
|
|
1343
|
+
$[68] = t29;
|
|
1344
|
+
} else t29 = $[68];
|
|
1345
|
+
return t29;
|
|
1329
1346
|
};
|
|
1330
1347
|
const useSetting = (name) => {
|
|
1331
1348
|
const ctx = React.use(Context);
|
|
@@ -1344,38 +1361,39 @@ function createBlock(options) {
|
|
|
1344
1361
|
const { blockId, mode, isHovered, setIsHovered } = ctx;
|
|
1345
1362
|
const isContentEditable = useIsEditable(mode);
|
|
1346
1363
|
const { window: iframeWindow } = useFrame();
|
|
1347
|
-
const selection = useSelector(previewStore,
|
|
1348
|
-
const isAddBlockSheetOpen = useSelector(previewStore,
|
|
1349
|
-
const isPageContentSheetOpen = useSelector(previewStore,
|
|
1364
|
+
const selection = useSelector(previewStore, _temp0);
|
|
1365
|
+
const isAddBlockSheetOpen = useSelector(previewStore, _temp1);
|
|
1366
|
+
const isPageContentSheetOpen = useSelector(previewStore, _temp10);
|
|
1350
1367
|
const isBlockSelected = selection?.blockId === blockId;
|
|
1351
|
-
|
|
1352
|
-
if ($[0] !== blockId) {
|
|
1353
|
-
t1 = { blockId };
|
|
1354
|
-
$[0] = blockId;
|
|
1355
|
-
$[1] = t1;
|
|
1356
|
-
} else t1 = $[1];
|
|
1357
|
-
const isHoveredFromSidebar = useOverlayMessage(iframeWindow, isContentEditable, "CAMOX_HOVER_BLOCK", "CAMOX_HOVER_BLOCK_END", t1);
|
|
1368
|
+
const t1 = String(blockId);
|
|
1358
1369
|
let t2;
|
|
1370
|
+
if ($[0] !== t1) {
|
|
1371
|
+
t2 = { blockId: t1 };
|
|
1372
|
+
$[0] = t1;
|
|
1373
|
+
$[1] = t2;
|
|
1374
|
+
} else t2 = $[1];
|
|
1375
|
+
const isHoveredFromSidebar = useOverlayMessage(iframeWindow, isContentEditable, "CAMOX_HOVER_BLOCK", "CAMOX_HOVER_BLOCK_END", t2);
|
|
1359
1376
|
let t3;
|
|
1377
|
+
let t4;
|
|
1360
1378
|
if ($[2] !== isHoveredFromSidebar || $[3] !== setIsHovered) {
|
|
1361
|
-
|
|
1379
|
+
t3 = () => {
|
|
1362
1380
|
setIsHovered(isHoveredFromSidebar);
|
|
1363
1381
|
};
|
|
1364
|
-
|
|
1382
|
+
t4 = [isHoveredFromSidebar, setIsHovered];
|
|
1365
1383
|
$[2] = isHoveredFromSidebar;
|
|
1366
1384
|
$[3] = setIsHovered;
|
|
1367
|
-
$[4] =
|
|
1368
|
-
$[5] =
|
|
1385
|
+
$[4] = t3;
|
|
1386
|
+
$[5] = t4;
|
|
1369
1387
|
} else {
|
|
1370
|
-
|
|
1371
|
-
|
|
1388
|
+
t3 = $[4];
|
|
1389
|
+
t4 = $[5];
|
|
1372
1390
|
}
|
|
1373
|
-
React.useEffect(
|
|
1391
|
+
React.useEffect(t3, t4);
|
|
1374
1392
|
const shouldShowOverlay = isContentEditable && (isHovered || isBlockSelected) && !isAddBlockSheetOpen;
|
|
1375
1393
|
const shouldShowSheetOverlay = isAddBlockSheetOpen && mode !== "peek" || isPageContentSheetOpen && !isBlockSelected;
|
|
1376
|
-
let
|
|
1394
|
+
let t5;
|
|
1377
1395
|
if ($[6] !== blockId || $[7] !== isContentEditable) {
|
|
1378
|
-
|
|
1396
|
+
t5 = (e) => {
|
|
1379
1397
|
if (!isContentEditable) return;
|
|
1380
1398
|
e.stopPropagation();
|
|
1381
1399
|
previewStore.send({
|
|
@@ -1385,36 +1403,36 @@ function createBlock(options) {
|
|
|
1385
1403
|
};
|
|
1386
1404
|
$[6] = blockId;
|
|
1387
1405
|
$[7] = isContentEditable;
|
|
1388
|
-
$[8] =
|
|
1389
|
-
} else
|
|
1390
|
-
const handleClick =
|
|
1391
|
-
let
|
|
1406
|
+
$[8] = t5;
|
|
1407
|
+
} else t5 = $[8];
|
|
1408
|
+
const handleClick = t5;
|
|
1409
|
+
let t6;
|
|
1392
1410
|
if ($[9] !== isContentEditable || $[10] !== setIsHovered) {
|
|
1393
|
-
|
|
1411
|
+
t6 = () => {
|
|
1394
1412
|
if (isContentEditable) setIsHovered(true);
|
|
1395
1413
|
};
|
|
1396
1414
|
$[9] = isContentEditable;
|
|
1397
1415
|
$[10] = setIsHovered;
|
|
1398
|
-
$[11] =
|
|
1399
|
-
} else
|
|
1400
|
-
const handleMouseEnter =
|
|
1401
|
-
let
|
|
1416
|
+
$[11] = t6;
|
|
1417
|
+
} else t6 = $[11];
|
|
1418
|
+
const handleMouseEnter = t6;
|
|
1419
|
+
let t7;
|
|
1402
1420
|
if ($[12] !== isContentEditable || $[13] !== setIsHovered) {
|
|
1403
|
-
|
|
1421
|
+
t7 = () => {
|
|
1404
1422
|
if (isContentEditable) setIsHovered(false);
|
|
1405
1423
|
};
|
|
1406
1424
|
$[12] = isContentEditable;
|
|
1407
1425
|
$[13] = setIsHovered;
|
|
1408
|
-
$[14] =
|
|
1409
|
-
} else
|
|
1410
|
-
const handleMouseLeave =
|
|
1426
|
+
$[14] = t7;
|
|
1427
|
+
} else t7 = $[14];
|
|
1428
|
+
const handleMouseLeave = t7;
|
|
1411
1429
|
const [container, setContainer] = React.useState(null);
|
|
1412
|
-
const
|
|
1413
|
-
let
|
|
1414
|
-
if ($[15] !== children || $[16] !== handleClick || $[17] !== handleMouseEnter || $[18] !== handleMouseLeave || $[19] !==
|
|
1415
|
-
|
|
1430
|
+
const t8 = shouldShowSheetOverlay ? 0 : 1;
|
|
1431
|
+
let t9;
|
|
1432
|
+
if ($[15] !== children || $[16] !== handleClick || $[17] !== handleMouseEnter || $[18] !== handleMouseLeave || $[19] !== t8) {
|
|
1433
|
+
t9 = children({
|
|
1416
1434
|
ref: setContainer,
|
|
1417
|
-
style: { opacity:
|
|
1435
|
+
style: { opacity: t8 },
|
|
1418
1436
|
onClick: handleClick,
|
|
1419
1437
|
onMouseEnter: handleMouseEnter,
|
|
1420
1438
|
onMouseLeave: handleMouseLeave
|
|
@@ -1423,12 +1441,12 @@ function createBlock(options) {
|
|
|
1423
1441
|
$[16] = handleClick;
|
|
1424
1442
|
$[17] = handleMouseEnter;
|
|
1425
1443
|
$[18] = handleMouseLeave;
|
|
1426
|
-
$[19] =
|
|
1427
|
-
$[20] =
|
|
1428
|
-
} else
|
|
1429
|
-
let
|
|
1444
|
+
$[19] = t8;
|
|
1445
|
+
$[20] = t9;
|
|
1446
|
+
} else t9 = $[20];
|
|
1447
|
+
let t10;
|
|
1430
1448
|
if ($[21] !== blockId || $[22] !== container || $[23] !== isBlockSelected || $[24] !== mode || $[25] !== shouldShowOverlay) {
|
|
1431
|
-
|
|
1449
|
+
t10 = container && createPortal(/* @__PURE__ */ jsx(Fragment, { children: shouldShowOverlay && /* @__PURE__ */ jsx("div", {
|
|
1432
1450
|
"data-camox-block-id": blockId,
|
|
1433
1451
|
"data-camox-detached": true,
|
|
1434
1452
|
"data-camox-hovered": !isBlockSelected || void 0,
|
|
@@ -1445,19 +1463,18 @@ function createBlock(options) {
|
|
|
1445
1463
|
$[23] = isBlockSelected;
|
|
1446
1464
|
$[24] = mode;
|
|
1447
1465
|
$[25] = shouldShowOverlay;
|
|
1448
|
-
$[26] =
|
|
1449
|
-
} else
|
|
1450
|
-
let
|
|
1451
|
-
if ($[27] !==
|
|
1452
|
-
|
|
1453
|
-
$[27] =
|
|
1466
|
+
$[26] = t10;
|
|
1467
|
+
} else t10 = $[26];
|
|
1468
|
+
let t11;
|
|
1469
|
+
if ($[27] !== t10 || $[28] !== t9) {
|
|
1470
|
+
t11 = /* @__PURE__ */ jsxs(Fragment, { children: [t9, t10] });
|
|
1471
|
+
$[27] = t10;
|
|
1454
1472
|
$[28] = t9;
|
|
1455
|
-
$[29] =
|
|
1456
|
-
} else
|
|
1457
|
-
return
|
|
1473
|
+
$[29] = t11;
|
|
1474
|
+
} else t11 = $[29];
|
|
1475
|
+
return t11;
|
|
1458
1476
|
};
|
|
1459
1477
|
return {
|
|
1460
|
-
Component: BlockComponent,
|
|
1461
1478
|
Detached,
|
|
1462
1479
|
Field,
|
|
1463
1480
|
Embed,
|
|
@@ -1466,60 +1483,63 @@ function createBlock(options) {
|
|
|
1466
1483
|
File,
|
|
1467
1484
|
Repeater,
|
|
1468
1485
|
useSetting,
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
const
|
|
1483
|
-
|
|
1484
|
-
|
|
1486
|
+
_internal: {
|
|
1487
|
+
Component: BlockComponent,
|
|
1488
|
+
id: options.id,
|
|
1489
|
+
title: options.title,
|
|
1490
|
+
description: options.description,
|
|
1491
|
+
contentSchema,
|
|
1492
|
+
settingsSchema,
|
|
1493
|
+
layoutOnly: options.layoutOnly ?? false,
|
|
1494
|
+
getInitialBundle: () => {
|
|
1495
|
+
const counter = { value: 0 };
|
|
1496
|
+
const allSeeds = [];
|
|
1497
|
+
const content = { ...contentDefaults };
|
|
1498
|
+
buildInitialSeeds(typeboxSchema.properties, null, content, allSeeds, counter);
|
|
1499
|
+
const storageContent = {};
|
|
1500
|
+
for (const [key, prop] of Object.entries(typeboxSchema.properties)) {
|
|
1501
|
+
const ft = prop.fieldType;
|
|
1502
|
+
const ait = prop.arrayItemType;
|
|
1503
|
+
if (ft === "Image" || ft === "File" || ft === "RepeatableItem" || ait === "Image" || ait === "File") continue;
|
|
1504
|
+
if ("default" in prop) storageContent[key] = prop.default;
|
|
1505
|
+
}
|
|
1506
|
+
return {
|
|
1507
|
+
content: storageContent,
|
|
1508
|
+
settings: { ...settingsDefaults },
|
|
1509
|
+
repeatableItems: allSeeds
|
|
1510
|
+
};
|
|
1511
|
+
},
|
|
1512
|
+
getInitialContent: () => {
|
|
1513
|
+
return { ...contentDefaultsForStorage };
|
|
1514
|
+
},
|
|
1515
|
+
getInitialSettings: () => {
|
|
1516
|
+
return { ...settingsDefaults };
|
|
1517
|
+
},
|
|
1518
|
+
getPeekBundle: () => {
|
|
1519
|
+
const PEEK_BLOCK_ID = -1;
|
|
1520
|
+
const counter = { value: 0 };
|
|
1521
|
+
const allItems = [];
|
|
1522
|
+
const content = { ...contentDefaults };
|
|
1523
|
+
buildPeekItems(typeboxSchema.properties, PEEK_BLOCK_ID, null, content, allItems, counter);
|
|
1524
|
+
return {
|
|
1525
|
+
block: {
|
|
1526
|
+
id: PEEK_BLOCK_ID,
|
|
1527
|
+
pageId: null,
|
|
1528
|
+
layoutId: null,
|
|
1529
|
+
type: options.id,
|
|
1530
|
+
content,
|
|
1531
|
+
settings: settingsDefaults,
|
|
1532
|
+
placement: null,
|
|
1533
|
+
summary: "",
|
|
1534
|
+
position: "",
|
|
1535
|
+
createdAt: 0,
|
|
1536
|
+
updatedAt: 0
|
|
1537
|
+
},
|
|
1538
|
+
repeatableItems: allItems,
|
|
1539
|
+
files: []
|
|
1540
|
+
};
|
|
1485
1541
|
}
|
|
1486
|
-
|
|
1487
|
-
content: storageContent,
|
|
1488
|
-
settings: { ...settingsDefaults },
|
|
1489
|
-
repeatableItems: allSeeds
|
|
1490
|
-
};
|
|
1491
|
-
},
|
|
1492
|
-
getInitialContent: () => {
|
|
1493
|
-
return { ...contentDefaultsForStorage };
|
|
1494
|
-
},
|
|
1495
|
-
getInitialSettings: () => {
|
|
1496
|
-
return { ...settingsDefaults };
|
|
1497
|
-
},
|
|
1498
|
-
getPeekBundle: () => {
|
|
1499
|
-
const PEEK_BLOCK_ID = -1;
|
|
1500
|
-
const counter = { value: 0 };
|
|
1501
|
-
const allItems = [];
|
|
1502
|
-
const content = { ...contentDefaults };
|
|
1503
|
-
buildPeekItems(typeboxSchema.properties, PEEK_BLOCK_ID, null, content, allItems, counter);
|
|
1504
|
-
return {
|
|
1505
|
-
block: {
|
|
1506
|
-
id: PEEK_BLOCK_ID,
|
|
1507
|
-
pageId: null,
|
|
1508
|
-
layoutId: null,
|
|
1509
|
-
type: options.id,
|
|
1510
|
-
content,
|
|
1511
|
-
settings: settingsDefaults,
|
|
1512
|
-
placement: null,
|
|
1513
|
-
summary: "",
|
|
1514
|
-
position: "",
|
|
1515
|
-
createdAt: 0,
|
|
1516
|
-
updatedAt: 0
|
|
1517
|
-
},
|
|
1518
|
-
repeatableItems: allItems,
|
|
1519
|
-
files: []
|
|
1520
|
-
};
|
|
1521
|
-
},
|
|
1522
|
-
layoutOnly: options.layoutOnly ?? false
|
|
1542
|
+
}
|
|
1523
1543
|
};
|
|
1524
1544
|
}
|
|
1525
1545
|
function _temp() {
|
|
@@ -1531,34 +1551,37 @@ function _temp() {
|
|
|
1531
1551
|
" to interact with the embed content"
|
|
1532
1552
|
] }));
|
|
1533
1553
|
}
|
|
1534
|
-
function _temp2(
|
|
1554
|
+
function _temp2(l) {
|
|
1555
|
+
return l.pathname;
|
|
1556
|
+
}
|
|
1557
|
+
function _temp3(e_1) {
|
|
1535
1558
|
return e_1.preventDefault();
|
|
1536
1559
|
}
|
|
1537
|
-
function
|
|
1560
|
+
function _temp4(e_2) {
|
|
1538
1561
|
if (e_2.key === "Escape") e_2.target.blur();
|
|
1539
1562
|
}
|
|
1540
|
-
function
|
|
1563
|
+
function _temp5(e_3) {
|
|
1541
1564
|
return e_3.preventDefault();
|
|
1542
1565
|
}
|
|
1543
|
-
function
|
|
1566
|
+
function _temp6(state) {
|
|
1544
1567
|
return state.context.selection;
|
|
1545
1568
|
}
|
|
1546
|
-
function
|
|
1569
|
+
function _temp7(state_0) {
|
|
1547
1570
|
return state_0.context.isPageContentSheetOpen;
|
|
1548
1571
|
}
|
|
1549
|
-
function
|
|
1572
|
+
function _temp8(state_1) {
|
|
1550
1573
|
return state_1.context.isAddBlockSheetOpen;
|
|
1551
1574
|
}
|
|
1552
|
-
function
|
|
1575
|
+
function _temp9(item) {
|
|
1553
1576
|
return item.content;
|
|
1554
1577
|
}
|
|
1555
|
-
function
|
|
1578
|
+
function _temp0(state) {
|
|
1556
1579
|
return state.context.selection;
|
|
1557
1580
|
}
|
|
1558
|
-
function
|
|
1581
|
+
function _temp1(state_0) {
|
|
1559
1582
|
return state_0.context.isAddBlockSheetOpen;
|
|
1560
1583
|
}
|
|
1561
|
-
function
|
|
1584
|
+
function _temp10(state_1) {
|
|
1562
1585
|
return state_1.context.isPageContentSheetOpen;
|
|
1563
1586
|
}
|
|
1564
1587
|
|