camox 0.14.2 → 0.16.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/components/AuthGate.js +6 -0
- package/dist/core/components/AddBlockControlBar.js +30 -26
- package/dist/core/components/lexical/InlineContentEditable.js +19 -15
- package/dist/core/components/lexical/InlineLexicalEditor.js +62 -42
- package/dist/core/components/lexical/SelectionBroadcaster.js +25 -21
- package/dist/core/components/lexical/SidebarLexicalEditor.js +33 -21
- package/dist/core/createBlock.js +524 -488
- package/dist/core/createLayout.js +40 -28
- package/dist/core/hooks/useFieldSelection.js +12 -8
- package/dist/core/hooks/useIsEditable.js +6 -0
- package/dist/core/hooks/useOverlayMessage.js +19 -15
- package/dist/core/lib/contentType.d.ts +8 -8
- package/dist/core/lib/contentType.js +63 -0
- package/dist/features/content/CamoxContent.js +92 -88
- package/dist/features/content/components/AssetCard.js +46 -42
- package/dist/features/content/components/AssetCardSkeleton.js +8 -4
- package/dist/features/content/components/ContentSidebar.js +8 -4
- package/dist/features/content/components/UploadDropZone.js +31 -27
- package/dist/features/content/components/UploadProgressDrawer.js +98 -90
- package/dist/features/preview/CamoxPreview.js +162 -146
- package/dist/features/preview/components/AddBlockSheet.js +105 -101
- package/dist/features/preview/components/AgentChatSheet.js +74 -21
- package/dist/features/preview/components/AssetFieldEditor.js +98 -90
- package/dist/features/preview/components/AssetLightbox.js +21 -17
- package/dist/features/preview/components/AssetPickerGrid.js +84 -80
- package/dist/features/preview/components/BlockActionsPopover.js +35 -31
- package/dist/features/preview/components/BlockErrorBoundary.js +12 -8
- package/dist/features/preview/components/CreatePageModal.js +1 -1
- package/dist/features/preview/components/DebouncedFieldEditor.js +41 -37
- package/dist/features/preview/components/EditPageModal.js +114 -98
- package/dist/features/preview/components/FieldOverlayStyles.js +8 -4
- package/dist/features/preview/components/FieldToolbar.js +95 -54
- package/dist/features/preview/components/Frame.js +50 -46
- package/dist/features/preview/components/ItemFieldsEditor.js +81 -79
- package/dist/features/preview/components/LinkFieldEditor.js +138 -134
- package/dist/features/preview/components/MultipleAssetFieldEditor.js +105 -97
- package/dist/features/preview/components/OverlayTracker.js +19 -15
- package/dist/features/preview/components/Overlays.js +27 -23
- package/dist/features/preview/components/PageContentSheet.js +54 -4
- package/dist/features/preview/components/PageLocationFieldset.js +113 -109
- package/dist/features/preview/components/PagePicker.js +1 -1
- package/dist/features/preview/components/PageTree.js +443 -399
- package/dist/features/preview/components/PeekedBlock.js +69 -65
- package/dist/features/preview/components/PreviewPanel.js +64 -52
- package/dist/features/preview/components/PreviewSideSheet.js +25 -16
- package/dist/features/preview/components/PreviewToolbar.js +127 -123
- package/dist/features/preview/components/RepeatableItemsList.js +176 -171
- package/dist/features/preview/components/ShikiMarkdown.js +18 -14
- package/dist/features/preview/components/UnlinkAssetButton.js +74 -70
- package/dist/features/preview/components/useRepeatableItemActions.js +266 -0
- package/dist/features/preview/components/useUpdateBlockPosition.js +13 -9
- package/dist/features/provider/CamoxProvider.js +60 -52
- package/dist/features/provider/components/CamoxAppContext.js +10 -6
- package/dist/features/provider/components/CommandPalette.js +77 -69
- package/dist/features/provider/useAdminShortcuts.js +11 -7
- package/dist/features/routes/pageRoute.js +8 -4
- package/dist/features/studio/CamoxStudio.js +23 -19
- package/dist/features/studio/components/EnvironmentMenu.js +32 -28
- package/dist/features/studio/components/Navbar.js +62 -54
- package/dist/features/studio/components/ProjectMenu.js +131 -123
- package/dist/features/studio/components/UserButton.js +15 -11
- package/dist/features/studio/useTheme.js +82 -42
- package/dist/features/vite/definitionsSync.js +5 -5
- package/dist/features/vite/skillGeneration.js +43 -8
- package/dist/features/vite/vite.d.ts +1 -1
- package/dist/features/vite/vite.js +20 -2
- package/dist/hooks/use-marquee-selection.js +36 -32
- package/dist/lib/auth.js +49 -22
- package/dist/lib/normalized-data.js +55 -47
- package/dist/lib/use-project-room.js +22 -18
- package/dist/studio.css +1 -1
- package/package.json +10 -11
- package/skills/camox-block/SKILL.md +4 -0
- package/skills/camox-cli/SKILL.md +142 -0
- package/skills/camox-layout/SKILL.md +4 -0
|
@@ -4,12 +4,16 @@ import overlayStyles from "virtual:camox-overlay-css";
|
|
|
4
4
|
|
|
5
5
|
//#region src/features/preview/components/FieldOverlayStyles.tsx
|
|
6
6
|
const FieldOverlayStyles = () => {
|
|
7
|
-
const $ = c(
|
|
7
|
+
const $ = c(2);
|
|
8
|
+
if ($[0] !== "83d25ec6adf4086440810b5b8470ed59a6027bd66aa8eceb3fd93db084e20139") {
|
|
9
|
+
for (let $i = 0; $i < 2; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
10
|
+
$[0] = "83d25ec6adf4086440810b5b8470ed59a6027bd66aa8eceb3fd93db084e20139";
|
|
11
|
+
}
|
|
8
12
|
let t0;
|
|
9
|
-
if ($[
|
|
13
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
10
14
|
t0 = /* @__PURE__ */ jsx("style", { children: overlayStyles });
|
|
11
|
-
$[
|
|
12
|
-
} else t0 = $[
|
|
15
|
+
$[1] = t0;
|
|
16
|
+
} else t0 = $[1];
|
|
13
17
|
return t0;
|
|
14
18
|
};
|
|
15
19
|
|
|
@@ -3,6 +3,8 @@ import { useIsPreviewSheetOpen } from "./PreviewSideSheet.js";
|
|
|
3
3
|
import { cn, formatShortcut } from "../../../lib/utils.js";
|
|
4
4
|
import { isOverlayMessage } from "../overlayMessages.js";
|
|
5
5
|
import { FORMAT_FLAGS } from "../../../core/lib/modifierFormats.js";
|
|
6
|
+
import { useCurrentItemActions } from "./useRepeatableItemActions.js";
|
|
7
|
+
import { formatFieldName } from "./ItemFieldsEditor.js";
|
|
6
8
|
import { c } from "react/compiler-runtime";
|
|
7
9
|
import { Kbd } from "@camox/ui/kbd";
|
|
8
10
|
import { useSelector } from "@xstate/store/react";
|
|
@@ -10,7 +12,7 @@ import * as React from "react";
|
|
|
10
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
13
|
import { Button } from "@camox/ui/button";
|
|
12
14
|
import * as Tooltip$1 from "@camox/ui/tooltip";
|
|
13
|
-
import { Bold, Italic } from "lucide-react";
|
|
15
|
+
import { Bold, CircleMinus, CirclePlus, Italic } from "lucide-react";
|
|
14
16
|
import { ButtonGroup } from "@camox/ui/button-group";
|
|
15
17
|
import { FloatingToolbar } from "@camox/ui/floating-toolbar";
|
|
16
18
|
import { Toggle } from "@camox/ui/toggle";
|
|
@@ -30,7 +32,11 @@ const FORMAT_BUTTONS = [{
|
|
|
30
32
|
shortcut: "⌘ I"
|
|
31
33
|
}];
|
|
32
34
|
const FieldToolbar = () => {
|
|
33
|
-
const $ = c(
|
|
35
|
+
const $ = c(28);
|
|
36
|
+
if ($[0] !== "2bc1b4ab9dff6fa8d9298792c58691f963acc7a7be512835cfd07df609766f8a") {
|
|
37
|
+
for (let $i = 0; $i < 28; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
38
|
+
$[0] = "2bc1b4ab9dff6fa8d9298792c58691f963acc7a7be512835cfd07df609766f8a";
|
|
39
|
+
}
|
|
34
40
|
const iframeElement = useSelector(previewStore, _temp);
|
|
35
41
|
const selection = useSelector(previewStore, _temp2);
|
|
36
42
|
const isAnySideSheetOpen = useIsPreviewSheetOpen();
|
|
@@ -38,7 +44,7 @@ const FieldToolbar = () => {
|
|
|
38
44
|
const [activeFormats, setActiveFormats] = React.useState(0);
|
|
39
45
|
let t0;
|
|
40
46
|
let t1;
|
|
41
|
-
if ($[
|
|
47
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
42
48
|
t0 = () => {
|
|
43
49
|
const handleMessage = (event) => {
|
|
44
50
|
const data = event.data;
|
|
@@ -50,28 +56,31 @@ const FieldToolbar = () => {
|
|
|
50
56
|
return () => window.removeEventListener("message", handleMessage);
|
|
51
57
|
};
|
|
52
58
|
t1 = [];
|
|
53
|
-
$[
|
|
54
|
-
$[
|
|
59
|
+
$[1] = t0;
|
|
60
|
+
$[2] = t1;
|
|
55
61
|
} else {
|
|
56
|
-
t0 = $[
|
|
57
|
-
t1 = $[
|
|
62
|
+
t0 = $[1];
|
|
63
|
+
t1 = $[2];
|
|
58
64
|
}
|
|
59
65
|
React.useEffect(t0, t1);
|
|
60
66
|
let t2;
|
|
61
|
-
if ($[
|
|
67
|
+
if ($[3] !== iframeElement?.contentWindow) {
|
|
62
68
|
t2 = (formatKey) => {
|
|
63
69
|
iframeElement?.contentWindow?.postMessage({
|
|
64
70
|
type: "CAMOX_FORMAT_TEXT",
|
|
65
71
|
formatKey
|
|
66
72
|
}, "*");
|
|
67
73
|
};
|
|
68
|
-
$[
|
|
69
|
-
$[
|
|
70
|
-
} else t2 = $[
|
|
74
|
+
$[3] = iframeElement?.contentWindow;
|
|
75
|
+
$[4] = t2;
|
|
76
|
+
} else t2 = $[4];
|
|
71
77
|
const sendFormat = t2;
|
|
72
|
-
const
|
|
78
|
+
const isOnField = selection?.type === "block-field" || selection?.type === "item-field";
|
|
79
|
+
const isOnItemField = selection?.type === "item-field";
|
|
80
|
+
const isVisible = isOnField && !isAnySideSheetOpen;
|
|
81
|
+
const { canAdd, addItem, canRemove, removeItem, currentItem } = useCurrentItemActions(isOnItemField ? selection.blockId : null, isOnItemField ? selection.itemId : null);
|
|
73
82
|
let t3;
|
|
74
|
-
if ($[
|
|
83
|
+
if ($[5] !== selection) {
|
|
75
84
|
t3 = () => {
|
|
76
85
|
if (!selection) return;
|
|
77
86
|
previewStore.send({
|
|
@@ -79,43 +88,67 @@ const FieldToolbar = () => {
|
|
|
79
88
|
blockId: selection.blockId
|
|
80
89
|
});
|
|
81
90
|
};
|
|
82
|
-
$[
|
|
83
|
-
$[
|
|
84
|
-
} else t3 = $[
|
|
91
|
+
$[5] = selection;
|
|
92
|
+
$[6] = t3;
|
|
93
|
+
} else t3 = $[6];
|
|
85
94
|
const handleEditInForm = t3;
|
|
86
95
|
const t4 = isVisible ? "opacity-100 translate-y-0" : "opacity-0 pointer-events-none translate-y-2";
|
|
87
96
|
let t5;
|
|
88
|
-
if ($[
|
|
97
|
+
if ($[7] !== t4) {
|
|
89
98
|
t5 = cn("bottom-17 gap-2", t4);
|
|
90
|
-
$[
|
|
91
|
-
$[
|
|
92
|
-
} else t5 = $[
|
|
99
|
+
$[7] = t4;
|
|
100
|
+
$[8] = t5;
|
|
101
|
+
} else t5 = $[8];
|
|
93
102
|
let t6;
|
|
94
|
-
if ($[
|
|
95
|
-
t6 =
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
key: "j",
|
|
99
|
-
withAlt: true
|
|
100
|
-
})
|
|
103
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
104
|
+
t6 = formatShortcut({
|
|
105
|
+
key: "j",
|
|
106
|
+
withAlt: true
|
|
101
107
|
});
|
|
102
|
-
$[
|
|
103
|
-
} else t6 = $[
|
|
108
|
+
$[9] = t6;
|
|
109
|
+
} else t6 = $[9];
|
|
104
110
|
let t7;
|
|
105
|
-
if ($[
|
|
111
|
+
if ($[10] !== handleEditInForm) {
|
|
106
112
|
t7 = /* @__PURE__ */ jsxs(Button, {
|
|
107
|
-
variant: "
|
|
108
|
-
size: "sm",
|
|
113
|
+
variant: "outline",
|
|
109
114
|
onClick: handleEditInForm,
|
|
110
|
-
children: ["Edit in form
|
|
115
|
+
children: ["Edit in form", t6]
|
|
111
116
|
});
|
|
112
|
-
$[
|
|
113
|
-
$[
|
|
114
|
-
} else t7 = $[
|
|
117
|
+
$[10] = handleEditInForm;
|
|
118
|
+
$[11] = t7;
|
|
119
|
+
} else t7 = $[11];
|
|
115
120
|
let t8;
|
|
116
|
-
if ($[
|
|
117
|
-
t8 =
|
|
118
|
-
|
|
121
|
+
if ($[12] !== addItem || $[13] !== canAdd || $[14] !== canRemove || $[15] !== currentItem || $[16] !== isOnItemField || $[17] !== removeItem) {
|
|
122
|
+
t8 = isOnItemField && currentItem && (canAdd || canRemove) && /* @__PURE__ */ jsx(Tooltip$1.TooltipProvider, {
|
|
123
|
+
delay: 0,
|
|
124
|
+
children: /* @__PURE__ */ jsxs(ButtonGroup, { children: [canAdd && /* @__PURE__ */ jsxs(Tooltip$1.Tooltip, { children: [/* @__PURE__ */ jsx(Tooltip$1.TooltipTrigger, {
|
|
125
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
126
|
+
variant: "outline",
|
|
127
|
+
size: "icon",
|
|
128
|
+
onClick: () => addItem({ afterPosition: currentItem.position })
|
|
129
|
+
}),
|
|
130
|
+
children: /* @__PURE__ */ jsx(CirclePlus, {})
|
|
131
|
+
}), /* @__PURE__ */ jsxs(Tooltip$1.TooltipContent, { children: ["Add item to ", formatFieldName(currentItem.fieldName)] })] }), canRemove && /* @__PURE__ */ jsxs(Tooltip$1.Tooltip, { children: [/* @__PURE__ */ jsx(Tooltip$1.TooltipTrigger, {
|
|
132
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
133
|
+
variant: "outline",
|
|
134
|
+
size: "icon",
|
|
135
|
+
onClick: () => removeItem(currentItem.id, { onSuccess: _temp4 })
|
|
136
|
+
}),
|
|
137
|
+
children: /* @__PURE__ */ jsx(CircleMinus, {})
|
|
138
|
+
}), /* @__PURE__ */ jsxs(Tooltip$1.TooltipContent, { children: ["Remove item from ", formatFieldName(currentItem.fieldName)] })] })] })
|
|
139
|
+
});
|
|
140
|
+
$[12] = addItem;
|
|
141
|
+
$[13] = canAdd;
|
|
142
|
+
$[14] = canRemove;
|
|
143
|
+
$[15] = currentItem;
|
|
144
|
+
$[16] = isOnItemField;
|
|
145
|
+
$[17] = removeItem;
|
|
146
|
+
$[18] = t8;
|
|
147
|
+
} else t8 = $[18];
|
|
148
|
+
let t9;
|
|
149
|
+
if ($[19] !== activeFormats || $[20] !== hasSelection || $[21] !== sendFormat) {
|
|
150
|
+
t9 = hasSelection && /* @__PURE__ */ jsx(ButtonGroup, { children: FORMAT_BUTTONS.map((t10) => {
|
|
151
|
+
const { key, flag, icon: Icon, label, shortcut } = t10;
|
|
119
152
|
const isActive = !!(activeFormats & flag);
|
|
120
153
|
return /* @__PURE__ */ jsxs(Tooltip$1.Tooltip, { children: [/* @__PURE__ */ jsx(Tooltip$1.TooltipTrigger, {
|
|
121
154
|
render: /* @__PURE__ */ jsx(Toggle, {
|
|
@@ -131,24 +164,29 @@ const FieldToolbar = () => {
|
|
|
131
164
|
/* @__PURE__ */ jsx(Kbd, { children: shortcut })
|
|
132
165
|
] })] }, key);
|
|
133
166
|
}) });
|
|
134
|
-
$[
|
|
135
|
-
$[
|
|
136
|
-
$[
|
|
137
|
-
$[
|
|
138
|
-
} else
|
|
139
|
-
let
|
|
140
|
-
if ($[
|
|
141
|
-
|
|
167
|
+
$[19] = activeFormats;
|
|
168
|
+
$[20] = hasSelection;
|
|
169
|
+
$[21] = sendFormat;
|
|
170
|
+
$[22] = t9;
|
|
171
|
+
} else t9 = $[22];
|
|
172
|
+
let t10;
|
|
173
|
+
if ($[23] !== t5 || $[24] !== t7 || $[25] !== t8 || $[26] !== t9) {
|
|
174
|
+
t10 = /* @__PURE__ */ jsxs(FloatingToolbar, {
|
|
142
175
|
onMouseDown: _temp3,
|
|
143
176
|
className: t5,
|
|
144
|
-
children: [
|
|
177
|
+
children: [
|
|
178
|
+
t7,
|
|
179
|
+
t8,
|
|
180
|
+
t9
|
|
181
|
+
]
|
|
145
182
|
});
|
|
146
|
-
$[
|
|
147
|
-
$[
|
|
148
|
-
$[
|
|
149
|
-
$[
|
|
150
|
-
|
|
151
|
-
|
|
183
|
+
$[23] = t5;
|
|
184
|
+
$[24] = t7;
|
|
185
|
+
$[25] = t8;
|
|
186
|
+
$[26] = t9;
|
|
187
|
+
$[27] = t10;
|
|
188
|
+
} else t10 = $[27];
|
|
189
|
+
return t10;
|
|
152
190
|
};
|
|
153
191
|
function _temp(state) {
|
|
154
192
|
return state.context.iframeElement;
|
|
@@ -159,6 +197,9 @@ function _temp2(state_0) {
|
|
|
159
197
|
function _temp3(e) {
|
|
160
198
|
return e.preventDefault();
|
|
161
199
|
}
|
|
200
|
+
function _temp4() {
|
|
201
|
+
return previewStore.send({ type: "selectParent" });
|
|
202
|
+
}
|
|
162
203
|
|
|
163
204
|
//#endregion
|
|
164
205
|
export { FieldToolbar };
|
|
@@ -15,7 +15,11 @@ function useFrame() {
|
|
|
15
15
|
return context;
|
|
16
16
|
}
|
|
17
17
|
const Frame = (t0) => {
|
|
18
|
-
const $ = c(
|
|
18
|
+
const $ = c(26);
|
|
19
|
+
if ($[0] !== "d86eac45c10b92a7f69f3cd224c85551755f967726be09bb5f6e2728732531a8") {
|
|
20
|
+
for (let $i = 0; $i < 26; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
21
|
+
$[0] = "d86eac45c10b92a7f69f3cd224c85551755f967726be09bb5f6e2728732531a8";
|
|
22
|
+
}
|
|
19
23
|
const { children, className, style, copyStyles: t1, onIframeReady } = t0;
|
|
20
24
|
const copyStyles = t1 === void 0 ? true : t1;
|
|
21
25
|
const iframeRef = React.useRef(null);
|
|
@@ -25,7 +29,7 @@ const Frame = (t0) => {
|
|
|
25
29
|
const [hasOpenPopup, setHasOpenPopup] = React.useState(false);
|
|
26
30
|
let t2;
|
|
27
31
|
let t3;
|
|
28
|
-
if ($[
|
|
32
|
+
if ($[1] !== copyStyles || $[2] !== onIframeReady) {
|
|
29
33
|
t2 = () => {
|
|
30
34
|
const iframe = iframeRef.current;
|
|
31
35
|
if (!iframe) return;
|
|
@@ -53,18 +57,18 @@ const Frame = (t0) => {
|
|
|
53
57
|
};
|
|
54
58
|
};
|
|
55
59
|
t3 = [copyStyles, onIframeReady];
|
|
56
|
-
$[
|
|
57
|
-
$[
|
|
58
|
-
$[
|
|
59
|
-
$[
|
|
60
|
+
$[1] = copyStyles;
|
|
61
|
+
$[2] = onIframeReady;
|
|
62
|
+
$[3] = t2;
|
|
63
|
+
$[4] = t3;
|
|
60
64
|
} else {
|
|
61
|
-
t2 = $[
|
|
62
|
-
t3 = $[
|
|
65
|
+
t2 = $[3];
|
|
66
|
+
t3 = $[4];
|
|
63
67
|
}
|
|
64
68
|
React.useEffect(t2, t3);
|
|
65
69
|
let t4;
|
|
66
70
|
let t5;
|
|
67
|
-
if ($[
|
|
71
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
68
72
|
t4 = () => {
|
|
69
73
|
const checkForOpenPopup = () => {
|
|
70
74
|
setHasOpenPopup(document.body.querySelector("[data-base-ui-portal] [data-open]") !== null);
|
|
@@ -82,73 +86,73 @@ const Frame = (t0) => {
|
|
|
82
86
|
};
|
|
83
87
|
};
|
|
84
88
|
t5 = [];
|
|
85
|
-
$[
|
|
86
|
-
$[
|
|
89
|
+
$[5] = t4;
|
|
90
|
+
$[6] = t5;
|
|
87
91
|
} else {
|
|
88
|
-
t4 = $[
|
|
89
|
-
t5 = $[
|
|
92
|
+
t4 = $[5];
|
|
93
|
+
t5 = $[6];
|
|
90
94
|
}
|
|
91
95
|
React.useEffect(t4, t5);
|
|
92
96
|
let t6;
|
|
93
|
-
if ($[
|
|
97
|
+
if ($[7] !== className) {
|
|
94
98
|
t6 = cn("relative w-full h-full", className);
|
|
95
|
-
$[
|
|
96
|
-
$[
|
|
97
|
-
} else t6 = $[
|
|
99
|
+
$[7] = className;
|
|
100
|
+
$[8] = t6;
|
|
101
|
+
} else t6 = $[8];
|
|
98
102
|
let t7;
|
|
99
|
-
if ($[
|
|
103
|
+
if ($[9] !== hasOpenPopup) {
|
|
100
104
|
t7 = hasOpenPopup && /* @__PURE__ */ jsx("div", { className: "absolute top-0 left-0 h-full w-full" });
|
|
101
|
-
$[
|
|
102
|
-
$[
|
|
103
|
-
} else t7 = $[
|
|
105
|
+
$[9] = hasOpenPopup;
|
|
106
|
+
$[10] = t7;
|
|
107
|
+
} else t7 = $[10];
|
|
104
108
|
let t8;
|
|
105
|
-
if ($[
|
|
109
|
+
if ($[11] !== iframeElement || $[12] !== iframeWindow) {
|
|
106
110
|
t8 = {
|
|
107
111
|
window: iframeWindow,
|
|
108
112
|
iframeElement
|
|
109
113
|
};
|
|
110
|
-
$[
|
|
111
|
-
$[
|
|
112
|
-
$[
|
|
113
|
-
} else t8 = $[
|
|
114
|
+
$[11] = iframeElement;
|
|
115
|
+
$[12] = iframeWindow;
|
|
116
|
+
$[13] = t8;
|
|
117
|
+
} else t8 = $[13];
|
|
114
118
|
let t9;
|
|
115
|
-
if ($[
|
|
119
|
+
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
|
116
120
|
t9 = /* @__PURE__ */ jsx("iframe", {
|
|
117
121
|
ref: iframeRef,
|
|
118
122
|
className: cn("w-full h-full")
|
|
119
123
|
});
|
|
120
|
-
$[
|
|
121
|
-
} else t9 = $[
|
|
124
|
+
$[14] = t9;
|
|
125
|
+
} else t9 = $[14];
|
|
122
126
|
let t10;
|
|
123
|
-
if ($[
|
|
127
|
+
if ($[15] !== children || $[16] !== mountNode) {
|
|
124
128
|
t10 = mountNode && createPortal(children, mountNode);
|
|
125
|
-
$[
|
|
126
|
-
$[
|
|
127
|
-
$[
|
|
128
|
-
} else t10 = $[
|
|
129
|
+
$[15] = children;
|
|
130
|
+
$[16] = mountNode;
|
|
131
|
+
$[17] = t10;
|
|
132
|
+
} else t10 = $[17];
|
|
129
133
|
let t11;
|
|
130
|
-
if ($[
|
|
134
|
+
if ($[18] !== t10 || $[19] !== t8) {
|
|
131
135
|
t11 = /* @__PURE__ */ jsxs(FrameContext.Provider, {
|
|
132
136
|
value: t8,
|
|
133
137
|
children: [t9, t10]
|
|
134
138
|
});
|
|
135
|
-
$[
|
|
136
|
-
$[
|
|
137
|
-
$[
|
|
138
|
-
} else t11 = $[
|
|
139
|
+
$[18] = t10;
|
|
140
|
+
$[19] = t8;
|
|
141
|
+
$[20] = t11;
|
|
142
|
+
} else t11 = $[20];
|
|
139
143
|
let t12;
|
|
140
|
-
if ($[
|
|
144
|
+
if ($[21] !== style || $[22] !== t11 || $[23] !== t6 || $[24] !== t7) {
|
|
141
145
|
t12 = /* @__PURE__ */ jsxs("div", {
|
|
142
146
|
className: t6,
|
|
143
147
|
style,
|
|
144
148
|
children: [t7, t11]
|
|
145
149
|
});
|
|
146
|
-
$[
|
|
147
|
-
$[
|
|
148
|
-
$[
|
|
149
|
-
$[
|
|
150
|
-
$[
|
|
151
|
-
} else t12 = $[
|
|
150
|
+
$[21] = style;
|
|
151
|
+
$[22] = t11;
|
|
152
|
+
$[23] = t6;
|
|
153
|
+
$[24] = t7;
|
|
154
|
+
$[25] = t12;
|
|
155
|
+
} else t12 = $[25];
|
|
152
156
|
return t12;
|
|
153
157
|
};
|
|
154
158
|
function _temp(e) {
|
|
@@ -30,104 +30,108 @@ const getSchemaFieldsInOrder = (schema) => {
|
|
|
30
30
|
});
|
|
31
31
|
};
|
|
32
32
|
const ItemFieldsEditor = (t0) => {
|
|
33
|
-
const $ = c(
|
|
33
|
+
const $ = c(47);
|
|
34
|
+
if ($[0] !== "acaac456b163fd6884fa646041c6f9cfec109be9c842da24d68ef06c17989036") {
|
|
35
|
+
for (let $i = 0; $i < 47; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
36
|
+
$[0] = "acaac456b163fd6884fa646041c6f9cfec109be9c842da24d68ef06c17989036";
|
|
37
|
+
}
|
|
34
38
|
const { schema, data, blockId, itemId, onFieldChange, postToIframe, filesMap, itemsMap, fieldIdPrefix, autoFocusFieldName } = t0;
|
|
35
39
|
let t1;
|
|
36
|
-
if ($[
|
|
40
|
+
if ($[1] !== schema) {
|
|
37
41
|
t1 = getSchemaFieldsInOrder(schema);
|
|
38
|
-
$[
|
|
39
|
-
$[
|
|
40
|
-
} else t1 = $[
|
|
42
|
+
$[1] = schema;
|
|
43
|
+
$[2] = t1;
|
|
44
|
+
} else t1 = $[2];
|
|
41
45
|
const fields = t1;
|
|
42
46
|
const timerRef = React.useRef(null);
|
|
43
47
|
const focusedFieldIdRef = React.useRef(null);
|
|
44
48
|
let t2;
|
|
45
|
-
if ($[
|
|
49
|
+
if ($[3] !== blockId || $[4] !== itemId) {
|
|
46
50
|
t2 = (fieldName) => {
|
|
47
51
|
if (itemId != null) return `${blockId}__${itemId}__${fieldName}`;
|
|
48
52
|
return `${blockId}__${fieldName}`;
|
|
49
53
|
};
|
|
50
|
-
$[
|
|
51
|
-
$[
|
|
52
|
-
$[
|
|
53
|
-
} else t2 = $[
|
|
54
|
+
$[3] = blockId;
|
|
55
|
+
$[4] = itemId;
|
|
56
|
+
$[5] = t2;
|
|
57
|
+
} else t2 = $[5];
|
|
54
58
|
const getFieldId = t2;
|
|
55
59
|
let t3;
|
|
56
|
-
if ($[
|
|
60
|
+
if ($[6] !== fieldIdPrefix) {
|
|
57
61
|
t3 = (fieldName_0) => `${fieldIdPrefix}-${fieldName_0}`;
|
|
58
|
-
$[
|
|
59
|
-
$[
|
|
60
|
-
} else t3 = $[
|
|
62
|
+
$[6] = fieldIdPrefix;
|
|
63
|
+
$[7] = t3;
|
|
64
|
+
} else t3 = $[7];
|
|
61
65
|
const getFieldElementId = t3;
|
|
62
66
|
let t4;
|
|
63
|
-
if ($[
|
|
67
|
+
if ($[8] !== autoFocusFieldName || $[9] !== fieldIdPrefix) {
|
|
64
68
|
t4 = {
|
|
65
69
|
fieldName: autoFocusFieldName,
|
|
66
70
|
prefix: fieldIdPrefix
|
|
67
71
|
};
|
|
68
|
-
$[
|
|
69
|
-
$[
|
|
70
|
-
$[
|
|
71
|
-
} else t4 = $[
|
|
72
|
+
$[8] = autoFocusFieldName;
|
|
73
|
+
$[9] = fieldIdPrefix;
|
|
74
|
+
$[10] = t4;
|
|
75
|
+
} else t4 = $[10];
|
|
72
76
|
const initialAutoFocusRef = React.useRef(t4);
|
|
73
77
|
let t5;
|
|
74
78
|
let t6;
|
|
75
|
-
if ($[
|
|
79
|
+
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
76
80
|
t5 = () => {
|
|
77
81
|
const { fieldName: fieldName_1, prefix } = initialAutoFocusRef.current;
|
|
78
82
|
if (!fieldName_1) return;
|
|
79
83
|
document.getElementById(`${prefix}-${fieldName_1}`)?.focus();
|
|
80
84
|
};
|
|
81
85
|
t6 = [];
|
|
82
|
-
$[
|
|
83
|
-
$[
|
|
86
|
+
$[11] = t5;
|
|
87
|
+
$[12] = t6;
|
|
84
88
|
} else {
|
|
85
|
-
t5 = $[
|
|
86
|
-
t6 = $[
|
|
89
|
+
t5 = $[11];
|
|
90
|
+
t6 = $[12];
|
|
87
91
|
}
|
|
88
92
|
React.useLayoutEffect(t5, t6);
|
|
89
93
|
let t7;
|
|
90
|
-
if ($[
|
|
94
|
+
if ($[13] !== fields) {
|
|
91
95
|
t7 = fields.filter(_temp).map(_temp2);
|
|
92
|
-
$[
|
|
93
|
-
$[
|
|
94
|
-
} else t7 = $[
|
|
96
|
+
$[13] = fields;
|
|
97
|
+
$[14] = t7;
|
|
98
|
+
} else t7 = $[14];
|
|
95
99
|
const scalarFields = t7;
|
|
96
100
|
let values;
|
|
97
|
-
if ($[
|
|
101
|
+
if ($[15] !== data || $[16] !== scalarFields) {
|
|
98
102
|
values = {};
|
|
99
103
|
for (const fieldName_2 of scalarFields) values[fieldName_2] = data[fieldName_2] ?? "";
|
|
100
|
-
$[
|
|
101
|
-
$[
|
|
102
|
-
$[
|
|
103
|
-
} else values = $[
|
|
104
|
+
$[15] = data;
|
|
105
|
+
$[16] = scalarFields;
|
|
106
|
+
$[17] = values;
|
|
107
|
+
} else values = $[17];
|
|
104
108
|
const defaultValues = values;
|
|
105
109
|
let t8;
|
|
106
|
-
if ($[
|
|
110
|
+
if ($[18] !== defaultValues) {
|
|
107
111
|
t8 = { defaultValues };
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
110
|
-
} else t8 = $[
|
|
112
|
+
$[18] = defaultValues;
|
|
113
|
+
$[19] = t8;
|
|
114
|
+
} else t8 = $[19];
|
|
111
115
|
const form = useForm(t8);
|
|
112
116
|
let t10;
|
|
113
117
|
let t9;
|
|
114
|
-
if ($[
|
|
118
|
+
if ($[20] !== defaultValues || $[21] !== form) {
|
|
115
119
|
t9 = () => {
|
|
116
120
|
form.update({ defaultValues });
|
|
117
121
|
};
|
|
118
122
|
t10 = [defaultValues, form];
|
|
119
|
-
$[
|
|
120
|
-
$[
|
|
121
|
-
$[
|
|
122
|
-
$[
|
|
123
|
+
$[20] = defaultValues;
|
|
124
|
+
$[21] = form;
|
|
125
|
+
$[22] = t10;
|
|
126
|
+
$[23] = t9;
|
|
123
127
|
} else {
|
|
124
|
-
t10 = $[
|
|
125
|
-
t9 = $[
|
|
128
|
+
t10 = $[22];
|
|
129
|
+
t9 = $[23];
|
|
126
130
|
}
|
|
127
131
|
React.useEffect(t9, t10);
|
|
128
132
|
let t11;
|
|
129
133
|
let t12;
|
|
130
|
-
if ($[
|
|
134
|
+
if ($[24] !== postToIframe) {
|
|
131
135
|
t11 = () => () => {
|
|
132
136
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
133
137
|
if (focusedFieldIdRef.current) postToIframe({
|
|
@@ -136,17 +140,17 @@ const ItemFieldsEditor = (t0) => {
|
|
|
136
140
|
});
|
|
137
141
|
};
|
|
138
142
|
t12 = [postToIframe];
|
|
139
|
-
$[
|
|
140
|
-
$[
|
|
141
|
-
$[
|
|
143
|
+
$[24] = postToIframe;
|
|
144
|
+
$[25] = t11;
|
|
145
|
+
$[26] = t12;
|
|
142
146
|
} else {
|
|
143
|
-
t11 = $[
|
|
144
|
-
t12 = $[
|
|
147
|
+
t11 = $[25];
|
|
148
|
+
t12 = $[26];
|
|
145
149
|
}
|
|
146
150
|
React.useEffect(t11, t12);
|
|
147
151
|
let t13;
|
|
148
152
|
let t14;
|
|
149
|
-
if ($[
|
|
153
|
+
if ($[27] !== blockId || $[28] !== data || $[29] !== fields || $[30] !== filesMap || $[31] !== form || $[32] !== getFieldElementId || $[33] !== getFieldId || $[34] !== itemId || $[35] !== itemsMap || $[36] !== onFieldChange || $[37] !== postToIframe || $[38] !== schema) {
|
|
150
154
|
const handleScalarChange = (fieldName_3, value, fieldApi) => {
|
|
151
155
|
fieldApi.handleChange(value);
|
|
152
156
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
@@ -187,7 +191,7 @@ const ItemFieldsEditor = (t0) => {
|
|
|
187
191
|
});
|
|
188
192
|
};
|
|
189
193
|
let t15;
|
|
190
|
-
if ($[
|
|
194
|
+
if ($[41] !== blockId || $[42] !== itemId) {
|
|
191
195
|
t15 = (fieldName_6, fieldType_0) => {
|
|
192
196
|
if (itemId != null) previewStore.send({
|
|
193
197
|
type: "selectItemField",
|
|
@@ -203,10 +207,10 @@ const ItemFieldsEditor = (t0) => {
|
|
|
203
207
|
fieldType: fieldType_0
|
|
204
208
|
});
|
|
205
209
|
};
|
|
206
|
-
$[
|
|
207
|
-
$[
|
|
208
|
-
$[
|
|
209
|
-
} else t15 = $[
|
|
210
|
+
$[41] = blockId;
|
|
211
|
+
$[42] = itemId;
|
|
212
|
+
$[43] = t15;
|
|
213
|
+
} else t15 = $[43];
|
|
210
214
|
const drillIntoField = t15;
|
|
211
215
|
t13 = "space-y-4 px-4 py-4";
|
|
212
216
|
t14 = fields.map((field) => {
|
|
@@ -403,42 +407,40 @@ const ItemFieldsEditor = (t0) => {
|
|
|
403
407
|
items: items_1,
|
|
404
408
|
blockId,
|
|
405
409
|
fieldName: field.name,
|
|
406
|
-
minItems: field.minItems,
|
|
407
|
-
maxItems: field.maxItems,
|
|
408
410
|
schema: fieldSchema
|
|
409
411
|
})]
|
|
410
412
|
}, field.name);
|
|
411
413
|
}
|
|
412
414
|
return null;
|
|
413
415
|
});
|
|
414
|
-
$[
|
|
415
|
-
$[
|
|
416
|
-
$[
|
|
417
|
-
$[
|
|
418
|
-
$[
|
|
419
|
-
$[
|
|
420
|
-
$[
|
|
421
|
-
$[
|
|
422
|
-
$[
|
|
423
|
-
$[
|
|
424
|
-
$[
|
|
425
|
-
$[
|
|
426
|
-
$[
|
|
427
|
-
$[
|
|
416
|
+
$[27] = blockId;
|
|
417
|
+
$[28] = data;
|
|
418
|
+
$[29] = fields;
|
|
419
|
+
$[30] = filesMap;
|
|
420
|
+
$[31] = form;
|
|
421
|
+
$[32] = getFieldElementId;
|
|
422
|
+
$[33] = getFieldId;
|
|
423
|
+
$[34] = itemId;
|
|
424
|
+
$[35] = itemsMap;
|
|
425
|
+
$[36] = onFieldChange;
|
|
426
|
+
$[37] = postToIframe;
|
|
427
|
+
$[38] = schema;
|
|
428
|
+
$[39] = t13;
|
|
429
|
+
$[40] = t14;
|
|
428
430
|
} else {
|
|
429
|
-
t13 = $[
|
|
430
|
-
t14 = $[
|
|
431
|
+
t13 = $[39];
|
|
432
|
+
t14 = $[40];
|
|
431
433
|
}
|
|
432
434
|
let t15;
|
|
433
|
-
if ($[
|
|
435
|
+
if ($[44] !== t13 || $[45] !== t14) {
|
|
434
436
|
t15 = /* @__PURE__ */ jsx("form", {
|
|
435
437
|
className: t13,
|
|
436
438
|
children: t14
|
|
437
439
|
});
|
|
438
|
-
$[
|
|
439
|
-
$[
|
|
440
|
-
$[
|
|
441
|
-
} else t15 = $[
|
|
440
|
+
$[44] = t13;
|
|
441
|
+
$[45] = t14;
|
|
442
|
+
$[46] = t15;
|
|
443
|
+
} else t15 = $[46];
|
|
442
444
|
return t15;
|
|
443
445
|
};
|
|
444
446
|
function _temp(f) {
|