camox 0.32.0 → 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/createBlock.d.ts +1 -1
- package/dist/core/createBlock.js +88 -108
- package/dist/core/hooks/useIsEditable.js +6 -10
- package/dist/core/lib/fieldTypes.js +10 -219
- package/dist/features/agent-chat/components/AgentChatSidebar.js +172 -0
- package/dist/features/agent-chat/components/AgentChatThread.js +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 +64 -127
- package/dist/features/preview/components/ItemFieldsEditor.js +98 -125
- package/dist/features/preview/components/LeftSidebar.js +64 -0
- package/dist/features/preview/components/LinkFieldEditor.js +1 -1
- package/dist/features/preview/components/MultipleAssetFieldEditor.js +94 -56
- package/dist/features/preview/components/OverlayTracker.js +15 -15
- package/dist/features/preview/components/Overlays.js +12 -12
- package/dist/features/preview/components/PageEditorSidebar.js +563 -0
- package/dist/features/preview/components/PageInfoSidebar.js +1453 -0
- package/dist/features/preview/components/PageNavigatorSidebar.js +590 -0
- package/dist/features/preview/components/PagePicker.js +3 -3
- package/dist/features/preview/components/PageStatusBadge.js +1 -1
- package/dist/features/preview/components/PageTree.js +204 -564
- package/dist/features/preview/components/PreviewPanel.js +123 -158
- package/dist/features/preview/components/PreviewToolbar.js +260 -256
- package/dist/features/preview/components/PublishDialog.js +2 -2
- package/dist/features/preview/components/RepeatableItemsList.js +2 -2
- package/dist/features/preview/components/RightSidebar.js +109 -0
- package/dist/features/preview/components/UnlinkAssetButton.js +2 -2
- package/dist/features/preview/components/useRepeatableItemActions.js +3 -138
- package/dist/features/preview/components/useUpdateBlockPosition.js +1 -1
- package/dist/features/preview/previewQueryFns.js +23 -0
- package/dist/features/preview/previewStore.js +46 -63
- package/dist/features/provider/CamoxProvider.js +255 -70
- package/dist/features/provider/useAdminShortcuts.js +5 -48
- package/dist/features/routes/pageRoute.js +1 -1
- package/dist/features/studio/CamoxStudio.js +6 -5
- package/dist/features/studio/components/EnvironmentMenu.js +2 -2
- package/dist/features/studio/components/Navbar.js +53 -71
- package/dist/features/studio/components/ProjectMenu.js +1 -1
- package/dist/features/studio/components/UserButton.js +1 -1
- package/dist/features/studio/routes.js +7 -0
- package/dist/features/studio/useTheme.js +67 -33
- package/dist/features/vite/routeGeneration.js +68 -66
- package/dist/hooks/use-file-upload.js +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 +4 -4
- package/dist/features/agent-chat/components/AgentChatSheet.js +0 -207
- package/dist/features/preview/components/AssetPickerGrid.js +0 -236
- package/dist/features/preview/components/PageContentSheet.js +0 -608
- package/dist/features/preview/components/PageMetadataModal.js +0 -908
- package/dist/features/preview/components/PreviewSideSheet.js +0 -76
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useIsPreviewSheetOpen } from "./PreviewSideSheet.js";
|
|
3
|
-
import { cn, formatShortcut } from "../../../lib/utils.js";
|
|
1
|
+
import { cn } from "../../../lib/utils.js";
|
|
4
2
|
import { isOverlayMessage } from "../overlayMessages.js";
|
|
3
|
+
import { previewStore } from "../previewStore.js";
|
|
5
4
|
import { FORMAT_FLAGS } from "../../../core/lib/modifierFormats.js";
|
|
6
5
|
import { TextLinkPopover } from "../../../core/components/lexical/TextLinkPopover.js";
|
|
7
|
-
import { useCurrentItemActions } from "./useRepeatableItemActions.js";
|
|
8
|
-
import { formatFieldName } from "./ItemFieldsEditor.js";
|
|
9
6
|
import { c } from "react/compiler-runtime";
|
|
10
|
-
import { Kbd } from "@camox/ui/kbd";
|
|
11
7
|
import { useSelector } from "@xstate/store-react";
|
|
12
8
|
import * as React from "react";
|
|
9
|
+
import { Kbd } from "@camox/ui/kbd";
|
|
13
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
11
|
import { Button } from "@camox/ui/button";
|
|
12
|
+
import { Bold, Italic } from "lucide-react";
|
|
15
13
|
import { ButtonGroup } from "@camox/ui/button-group";
|
|
16
14
|
import * as Tooltip$1 from "@camox/ui/tooltip";
|
|
17
|
-
import { Bold, CircleMinus, CirclePlus, Italic } from "lucide-react";
|
|
18
15
|
import { FloatingToolbar } from "@camox/ui/floating-toolbar";
|
|
19
16
|
import { Toggle } from "@camox/ui/toggle";
|
|
20
17
|
|
|
@@ -33,14 +30,12 @@ const FORMAT_BUTTONS = [{
|
|
|
33
30
|
shortcut: "⌘ I"
|
|
34
31
|
}];
|
|
35
32
|
const FieldToolbar = () => {
|
|
36
|
-
const $ = c(
|
|
37
|
-
if ($[0] !== "
|
|
38
|
-
for (let $i = 0; $i <
|
|
39
|
-
$[0] = "
|
|
33
|
+
const $ = c(28);
|
|
34
|
+
if ($[0] !== "bee72c888eb7fec22d667ab73801a7ed4c0292a3149ebb46febb13e2bf2d9bc3") {
|
|
35
|
+
for (let $i = 0; $i < 28; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
36
|
+
$[0] = "bee72c888eb7fec22d667ab73801a7ed4c0292a3149ebb46febb13e2bf2d9bc3";
|
|
40
37
|
}
|
|
41
38
|
const iframeElement = useSelector(previewStore, _temp);
|
|
42
|
-
const selection = useSelector(previewStore, _temp2);
|
|
43
|
-
const isAnySideSheetOpen = useIsPreviewSheetOpen();
|
|
44
39
|
const [hasSelection, setHasSelection] = React.useState(false);
|
|
45
40
|
const [activeFormats, setActiveFormats] = React.useState(0);
|
|
46
41
|
const [linkTarget, setLinkTarget] = React.useState(null);
|
|
@@ -121,81 +116,19 @@ const FieldToolbar = () => {
|
|
|
121
116
|
$[9] = t5;
|
|
122
117
|
} else t5 = $[9];
|
|
123
118
|
const unlinkText = t5;
|
|
124
|
-
const
|
|
125
|
-
const
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
type: "openBlockContentSheet",
|
|
134
|
-
blockId: selection.blockId
|
|
135
|
-
});
|
|
136
|
-
};
|
|
137
|
-
$[10] = selection;
|
|
138
|
-
$[11] = t6;
|
|
139
|
-
} else t6 = $[11];
|
|
140
|
-
const handleEditInForm = t6;
|
|
141
|
-
const handleToolbarMouseDown = _temp3;
|
|
142
|
-
const t7 = isVisible ? "opacity-100 translate-y-0" : "opacity-0 pointer-events-none translate-y-2";
|
|
119
|
+
const isVisible = hasSelection || linkPopoverOpen;
|
|
120
|
+
const handleToolbarMouseDown = _temp2;
|
|
121
|
+
const t6 = isVisible ? "opacity-100 translate-y-0" : "opacity-0 pointer-events-none translate-y-2";
|
|
122
|
+
let t7;
|
|
123
|
+
if ($[10] !== t6) {
|
|
124
|
+
t7 = cn("bottom-17 gap-2", t6);
|
|
125
|
+
$[10] = t6;
|
|
126
|
+
$[11] = t7;
|
|
127
|
+
} else t7 = $[11];
|
|
143
128
|
let t8;
|
|
144
|
-
if ($[12] !==
|
|
145
|
-
t8 =
|
|
146
|
-
|
|
147
|
-
$[13] = t8;
|
|
148
|
-
} else t8 = $[13];
|
|
149
|
-
let t9;
|
|
150
|
-
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
|
151
|
-
t9 = formatShortcut({
|
|
152
|
-
key: "j",
|
|
153
|
-
withAlt: true
|
|
154
|
-
});
|
|
155
|
-
$[14] = t9;
|
|
156
|
-
} else t9 = $[14];
|
|
157
|
-
let t10;
|
|
158
|
-
if ($[15] !== handleEditInForm) {
|
|
159
|
-
t10 = /* @__PURE__ */ jsxs(Button, {
|
|
160
|
-
variant: "outline",
|
|
161
|
-
onClick: handleEditInForm,
|
|
162
|
-
children: ["Edit in form", t9]
|
|
163
|
-
});
|
|
164
|
-
$[15] = handleEditInForm;
|
|
165
|
-
$[16] = t10;
|
|
166
|
-
} else t10 = $[16];
|
|
167
|
-
let t11;
|
|
168
|
-
if ($[17] !== addItem || $[18] !== canAdd || $[19] !== canRemove || $[20] !== currentItem || $[21] !== isOnItemField || $[22] !== removeItem) {
|
|
169
|
-
t11 = isOnItemField && currentItem && (canAdd || canRemove) && /* @__PURE__ */ jsx(Tooltip$1.TooltipProvider, {
|
|
170
|
-
delay: 0,
|
|
171
|
-
children: /* @__PURE__ */ jsxs(ButtonGroup, { children: [canAdd && /* @__PURE__ */ jsxs(Tooltip$1.Tooltip, { children: [/* @__PURE__ */ jsx(Tooltip$1.TooltipTrigger, {
|
|
172
|
-
render: /* @__PURE__ */ jsx(Button, {
|
|
173
|
-
variant: "outline",
|
|
174
|
-
size: "icon",
|
|
175
|
-
onClick: () => addItem({ afterPosition: currentItem.position })
|
|
176
|
-
}),
|
|
177
|
-
children: /* @__PURE__ */ jsx(CirclePlus, {})
|
|
178
|
-
}), /* @__PURE__ */ jsxs(Tooltip$1.TooltipContent, { children: ["Add item to ", formatFieldName(currentItem.fieldName)] })] }), canRemove && /* @__PURE__ */ jsxs(Tooltip$1.Tooltip, { children: [/* @__PURE__ */ jsx(Tooltip$1.TooltipTrigger, {
|
|
179
|
-
render: /* @__PURE__ */ jsx(Button, {
|
|
180
|
-
variant: "outline",
|
|
181
|
-
size: "icon",
|
|
182
|
-
onClick: () => removeItem(currentItem.id, { onSuccess: _temp4 })
|
|
183
|
-
}),
|
|
184
|
-
children: /* @__PURE__ */ jsx(CircleMinus, {})
|
|
185
|
-
}), /* @__PURE__ */ jsxs(Tooltip$1.TooltipContent, { children: ["Remove item from ", formatFieldName(currentItem.fieldName)] })] })] })
|
|
186
|
-
});
|
|
187
|
-
$[17] = addItem;
|
|
188
|
-
$[18] = canAdd;
|
|
189
|
-
$[19] = canRemove;
|
|
190
|
-
$[20] = currentItem;
|
|
191
|
-
$[21] = isOnItemField;
|
|
192
|
-
$[22] = removeItem;
|
|
193
|
-
$[23] = t11;
|
|
194
|
-
} else t11 = $[23];
|
|
195
|
-
let t12;
|
|
196
|
-
if ($[24] !== activeFormats || $[25] !== hasSelection || $[26] !== linkPopoverOpen || $[27] !== linkTarget || $[28] !== selectedText || $[29] !== sendFormat || $[30] !== sendTextLink || $[31] !== unlinkText) {
|
|
197
|
-
t12 = hasSelection && /* @__PURE__ */ jsxs(ButtonGroup, { children: [FORMAT_BUTTONS.map((t13) => {
|
|
198
|
-
const { key, flag, icon: Icon, label, shortcut } = t13;
|
|
129
|
+
if ($[12] !== activeFormats || $[13] !== sendFormat) {
|
|
130
|
+
t8 = FORMAT_BUTTONS.map((t9) => {
|
|
131
|
+
const { key, flag, icon: Icon, label, shortcut } = t9;
|
|
199
132
|
const isActive = !!(activeFormats & flag);
|
|
200
133
|
return /* @__PURE__ */ jsxs(Tooltip$1.Tooltip, { children: [/* @__PURE__ */ jsx(Tooltip$1.TooltipTrigger, {
|
|
201
134
|
render: /* @__PURE__ */ jsx(Toggle, {
|
|
@@ -210,55 +143,62 @@ const FieldToolbar = () => {
|
|
|
210
143
|
" ",
|
|
211
144
|
/* @__PURE__ */ jsx(Kbd, { children: shortcut })
|
|
212
145
|
] })] }, key);
|
|
213
|
-
})
|
|
146
|
+
});
|
|
147
|
+
$[12] = activeFormats;
|
|
148
|
+
$[13] = sendFormat;
|
|
149
|
+
$[14] = t8;
|
|
150
|
+
} else t8 = $[14];
|
|
151
|
+
let t9;
|
|
152
|
+
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
|
153
|
+
t9 = /* @__PURE__ */ jsx(Button, {
|
|
154
|
+
variant: "outline",
|
|
155
|
+
size: "icon",
|
|
156
|
+
"aria-label": "Add link"
|
|
157
|
+
});
|
|
158
|
+
$[15] = t9;
|
|
159
|
+
} else t9 = $[15];
|
|
160
|
+
let t10;
|
|
161
|
+
if ($[16] !== linkPopoverOpen || $[17] !== linkTarget || $[18] !== selectedText || $[19] !== sendTextLink || $[20] !== unlinkText) {
|
|
162
|
+
t10 = /* @__PURE__ */ jsx(TextLinkPopover, {
|
|
214
163
|
open: linkPopoverOpen,
|
|
215
164
|
onOpenChange: handleLinkPopoverOpenChange,
|
|
216
|
-
trigger:
|
|
217
|
-
variant: "outline",
|
|
218
|
-
size: "icon",
|
|
219
|
-
"aria-label": "Add link"
|
|
220
|
-
}),
|
|
165
|
+
trigger: t9,
|
|
221
166
|
text: selectedText,
|
|
222
167
|
target: linkTarget,
|
|
223
168
|
onSave: sendTextLink,
|
|
224
169
|
onUnlink: unlinkText
|
|
225
|
-
})
|
|
226
|
-
$[
|
|
227
|
-
$[
|
|
228
|
-
$[
|
|
229
|
-
$[
|
|
230
|
-
$[
|
|
231
|
-
$[
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
170
|
+
});
|
|
171
|
+
$[16] = linkPopoverOpen;
|
|
172
|
+
$[17] = linkTarget;
|
|
173
|
+
$[18] = selectedText;
|
|
174
|
+
$[19] = sendTextLink;
|
|
175
|
+
$[20] = unlinkText;
|
|
176
|
+
$[21] = t10;
|
|
177
|
+
} else t10 = $[21];
|
|
178
|
+
let t11;
|
|
179
|
+
if ($[22] !== t10 || $[23] !== t8) {
|
|
180
|
+
t11 = /* @__PURE__ */ jsxs(ButtonGroup, { children: [t8, t10] });
|
|
181
|
+
$[22] = t10;
|
|
182
|
+
$[23] = t8;
|
|
183
|
+
$[24] = t11;
|
|
184
|
+
} else t11 = $[24];
|
|
185
|
+
let t12;
|
|
186
|
+
if ($[25] !== t11 || $[26] !== t7) {
|
|
187
|
+
t12 = /* @__PURE__ */ jsx(FloatingToolbar, {
|
|
239
188
|
onMouseDown: handleToolbarMouseDown,
|
|
240
|
-
className:
|
|
241
|
-
children:
|
|
242
|
-
t10,
|
|
243
|
-
t11,
|
|
244
|
-
t12
|
|
245
|
-
]
|
|
189
|
+
className: t7,
|
|
190
|
+
children: t11
|
|
246
191
|
});
|
|
247
|
-
$[
|
|
248
|
-
$[
|
|
249
|
-
$[
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
} else t13 = $[37];
|
|
253
|
-
return t13;
|
|
192
|
+
$[25] = t11;
|
|
193
|
+
$[26] = t7;
|
|
194
|
+
$[27] = t12;
|
|
195
|
+
} else t12 = $[27];
|
|
196
|
+
return t12;
|
|
254
197
|
};
|
|
255
198
|
function _temp(state) {
|
|
256
199
|
return state.context.iframeElement;
|
|
257
200
|
}
|
|
258
|
-
function _temp2(
|
|
259
|
-
return state_0.context.selection;
|
|
260
|
-
}
|
|
261
|
-
function _temp3(event_0) {
|
|
201
|
+
function _temp2(event_0) {
|
|
262
202
|
const target_0 = event_0.target;
|
|
263
203
|
if (!(target_0 instanceof HTMLElement)) {
|
|
264
204
|
event_0.preventDefault();
|
|
@@ -267,9 +207,6 @@ function _temp3(event_0) {
|
|
|
267
207
|
if (target_0.closest("input, select, textarea, button, [role='combobox']")) return;
|
|
268
208
|
event_0.preventDefault();
|
|
269
209
|
}
|
|
270
|
-
function _temp4() {
|
|
271
|
-
return previewStore.send({ type: "selectParent" });
|
|
272
|
-
}
|
|
273
210
|
|
|
274
211
|
//#endregion
|
|
275
212
|
export { FieldToolbar };
|
|
@@ -30,9 +30,9 @@ const getSchemaFieldsInOrder = (schema) => {
|
|
|
30
30
|
};
|
|
31
31
|
const DrillRow = (t0) => {
|
|
32
32
|
const $ = c(28);
|
|
33
|
-
if ($[0] !== "
|
|
33
|
+
if ($[0] !== "44742e36c00267829eb7bcad0f4d0df91633b9d7bdc99a829f13e3d1db5d9c2b") {
|
|
34
34
|
for (let $i = 0; $i < 28; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
35
|
-
$[0] = "
|
|
35
|
+
$[0] = "44742e36c00267829eb7bcad0f4d0df91633b9d7bdc99a829f13e3d1db5d9c2b";
|
|
36
36
|
}
|
|
37
37
|
const { label, preview, Icon, onClick, hover, postToIframe } = t0;
|
|
38
38
|
let t1;
|
|
@@ -134,12 +134,12 @@ const DrillRow = (t0) => {
|
|
|
134
134
|
return t7;
|
|
135
135
|
};
|
|
136
136
|
const ItemFieldsEditor = (t0) => {
|
|
137
|
-
const $ = c(
|
|
138
|
-
if ($[0] !== "
|
|
139
|
-
for (let $i = 0; $i <
|
|
140
|
-
$[0] = "
|
|
137
|
+
const $ = c(42);
|
|
138
|
+
if ($[0] !== "44742e36c00267829eb7bcad0f4d0df91633b9d7bdc99a829f13e3d1db5d9c2b") {
|
|
139
|
+
for (let $i = 0; $i < 42; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
140
|
+
$[0] = "44742e36c00267829eb7bcad0f4d0df91633b9d7bdc99a829f13e3d1db5d9c2b";
|
|
141
141
|
}
|
|
142
|
-
const { schema, data, blockId, itemId, onFieldChange, postToIframe, filesMap, itemsMap, fieldIdPrefix
|
|
142
|
+
const { schema, data, blockId, itemId, onFieldChange, postToIframe, filesMap, itemsMap, fieldIdPrefix } = t0;
|
|
143
143
|
let t1;
|
|
144
144
|
if ($[1] !== schema) {
|
|
145
145
|
t1 = getSchemaFieldsInOrder(schema);
|
|
@@ -168,102 +168,75 @@ const ItemFieldsEditor = (t0) => {
|
|
|
168
168
|
} else t3 = $[7];
|
|
169
169
|
const getFieldElementId = t3;
|
|
170
170
|
let t4;
|
|
171
|
-
if ($[8] !==
|
|
172
|
-
t4 =
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
$[9] = fieldIdPrefix;
|
|
178
|
-
$[10] = t4;
|
|
179
|
-
} else t4 = $[10];
|
|
180
|
-
const initialAutoFocusRef = React.useRef(t4);
|
|
181
|
-
let t5;
|
|
182
|
-
let t6;
|
|
183
|
-
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
184
|
-
t5 = () => {
|
|
185
|
-
const { fieldName: fieldName_1, prefix } = initialAutoFocusRef.current;
|
|
186
|
-
if (!fieldName_1) return;
|
|
187
|
-
document.getElementById(`${prefix}-${fieldName_1}`)?.focus();
|
|
188
|
-
};
|
|
189
|
-
t6 = [];
|
|
190
|
-
$[11] = t5;
|
|
191
|
-
$[12] = t6;
|
|
192
|
-
} else {
|
|
193
|
-
t5 = $[11];
|
|
194
|
-
t6 = $[12];
|
|
195
|
-
}
|
|
196
|
-
React.useLayoutEffect(t5, t6);
|
|
197
|
-
let t7;
|
|
198
|
-
if ($[13] !== fields) {
|
|
199
|
-
t7 = fields.filter(_temp).map(_temp2);
|
|
200
|
-
$[13] = fields;
|
|
201
|
-
$[14] = t7;
|
|
202
|
-
} else t7 = $[14];
|
|
203
|
-
const scalarFields = t7;
|
|
171
|
+
if ($[8] !== fields) {
|
|
172
|
+
t4 = fields.filter(_temp).map(_temp2);
|
|
173
|
+
$[8] = fields;
|
|
174
|
+
$[9] = t4;
|
|
175
|
+
} else t4 = $[9];
|
|
176
|
+
const scalarFields = t4;
|
|
204
177
|
let values;
|
|
205
|
-
if ($[
|
|
178
|
+
if ($[10] !== data || $[11] !== scalarFields) {
|
|
206
179
|
values = {};
|
|
207
|
-
for (const
|
|
208
|
-
$[
|
|
209
|
-
$[
|
|
210
|
-
$[
|
|
211
|
-
} else values = $[
|
|
180
|
+
for (const fieldName_1 of scalarFields) values[fieldName_1] = data[fieldName_1] ?? "";
|
|
181
|
+
$[10] = data;
|
|
182
|
+
$[11] = scalarFields;
|
|
183
|
+
$[12] = values;
|
|
184
|
+
} else values = $[12];
|
|
212
185
|
const defaultValues = values;
|
|
213
|
-
let
|
|
214
|
-
if ($[
|
|
215
|
-
|
|
216
|
-
$[
|
|
217
|
-
$[
|
|
218
|
-
} else
|
|
219
|
-
const form = useForm(
|
|
220
|
-
let
|
|
221
|
-
let
|
|
222
|
-
if ($[
|
|
223
|
-
|
|
186
|
+
let t5;
|
|
187
|
+
if ($[13] !== defaultValues) {
|
|
188
|
+
t5 = { defaultValues };
|
|
189
|
+
$[13] = defaultValues;
|
|
190
|
+
$[14] = t5;
|
|
191
|
+
} else t5 = $[14];
|
|
192
|
+
const form = useForm(t5);
|
|
193
|
+
let t6;
|
|
194
|
+
let t7;
|
|
195
|
+
if ($[15] !== defaultValues || $[16] !== form) {
|
|
196
|
+
t6 = () => {
|
|
224
197
|
form.update({ defaultValues });
|
|
225
198
|
};
|
|
226
|
-
|
|
227
|
-
$[
|
|
228
|
-
$[
|
|
229
|
-
$[
|
|
230
|
-
$[
|
|
199
|
+
t7 = [defaultValues, form];
|
|
200
|
+
$[15] = defaultValues;
|
|
201
|
+
$[16] = form;
|
|
202
|
+
$[17] = t6;
|
|
203
|
+
$[18] = t7;
|
|
231
204
|
} else {
|
|
232
|
-
|
|
233
|
-
|
|
205
|
+
t6 = $[17];
|
|
206
|
+
t7 = $[18];
|
|
234
207
|
}
|
|
235
|
-
React.useEffect(
|
|
236
|
-
let
|
|
237
|
-
let
|
|
238
|
-
if ($[
|
|
239
|
-
|
|
208
|
+
React.useEffect(t6, t7);
|
|
209
|
+
let t8;
|
|
210
|
+
let t9;
|
|
211
|
+
if ($[19] !== postToIframe) {
|
|
212
|
+
t8 = () => () => {
|
|
240
213
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
241
214
|
if (focusedFieldIdRef.current) postToIframe({
|
|
242
215
|
type: "CAMOX_FOCUS_FIELD_END",
|
|
243
216
|
fieldId: focusedFieldIdRef.current
|
|
244
217
|
});
|
|
245
218
|
};
|
|
246
|
-
|
|
247
|
-
$[
|
|
248
|
-
$[
|
|
249
|
-
$[
|
|
219
|
+
t9 = [postToIframe];
|
|
220
|
+
$[19] = postToIframe;
|
|
221
|
+
$[20] = t8;
|
|
222
|
+
$[21] = t9;
|
|
250
223
|
} else {
|
|
251
|
-
|
|
252
|
-
|
|
224
|
+
t8 = $[20];
|
|
225
|
+
t9 = $[21];
|
|
253
226
|
}
|
|
254
|
-
React.useEffect(
|
|
255
|
-
let
|
|
256
|
-
let
|
|
257
|
-
if ($[
|
|
258
|
-
const handleScalarChange = (
|
|
227
|
+
React.useEffect(t8, t9);
|
|
228
|
+
let t10;
|
|
229
|
+
let t11;
|
|
230
|
+
if ($[22] !== blockId || $[23] !== data || $[24] !== fields || $[25] !== filesMap || $[26] !== form || $[27] !== getFieldElementId || $[28] !== getFieldId || $[29] !== itemId || $[30] !== itemsMap || $[31] !== onFieldChange || $[32] !== postToIframe || $[33] !== schema) {
|
|
231
|
+
const handleScalarChange = (fieldName_2, value, fieldApi) => {
|
|
259
232
|
fieldApi.handleChange(value);
|
|
260
233
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
261
234
|
timerRef.current = window.setTimeout(() => {
|
|
262
|
-
onFieldChange(
|
|
235
|
+
onFieldChange(fieldName_2, value);
|
|
263
236
|
}, 500);
|
|
264
237
|
};
|
|
265
|
-
const handleFieldFocus = (
|
|
266
|
-
const fieldId = getFieldId(
|
|
238
|
+
const handleFieldFocus = (fieldName_3, fieldType) => {
|
|
239
|
+
const fieldId = getFieldId(fieldName_3);
|
|
267
240
|
focusedFieldIdRef.current = fieldId;
|
|
268
241
|
postToIframe({
|
|
269
242
|
type: "CAMOX_FOCUS_FIELD",
|
|
@@ -273,18 +246,18 @@ const ItemFieldsEditor = (t0) => {
|
|
|
273
246
|
type: "selectItemField",
|
|
274
247
|
blockId,
|
|
275
248
|
itemId,
|
|
276
|
-
fieldName:
|
|
249
|
+
fieldName: fieldName_3,
|
|
277
250
|
fieldType
|
|
278
251
|
});
|
|
279
252
|
else previewStore.send({
|
|
280
253
|
type: "selectBlockField",
|
|
281
254
|
blockId,
|
|
282
|
-
fieldName:
|
|
255
|
+
fieldName: fieldName_3,
|
|
283
256
|
fieldType
|
|
284
257
|
});
|
|
285
258
|
};
|
|
286
|
-
const handleFieldBlur = (
|
|
287
|
-
const fieldId_0 = getFieldId(
|
|
259
|
+
const handleFieldBlur = (fieldName_4) => {
|
|
260
|
+
const fieldId_0 = getFieldId(fieldName_4);
|
|
288
261
|
focusedFieldIdRef.current = null;
|
|
289
262
|
postToIframe({
|
|
290
263
|
type: "CAMOX_FOCUS_FIELD_END",
|
|
@@ -294,30 +267,30 @@ const ItemFieldsEditor = (t0) => {
|
|
|
294
267
|
if (!focusedFieldIdRef.current) previewStore.send({ type: "selectParent" });
|
|
295
268
|
});
|
|
296
269
|
};
|
|
297
|
-
let
|
|
298
|
-
if ($[
|
|
299
|
-
|
|
270
|
+
let t12;
|
|
271
|
+
if ($[36] !== blockId || $[37] !== itemId) {
|
|
272
|
+
t12 = (fieldName_5, fieldType_0) => {
|
|
300
273
|
if (itemId != null) previewStore.send({
|
|
301
274
|
type: "selectItemField",
|
|
302
275
|
blockId,
|
|
303
276
|
itemId,
|
|
304
|
-
fieldName:
|
|
277
|
+
fieldName: fieldName_5,
|
|
305
278
|
fieldType: fieldType_0
|
|
306
279
|
});
|
|
307
280
|
else previewStore.send({
|
|
308
281
|
type: "selectBlockField",
|
|
309
282
|
blockId,
|
|
310
|
-
fieldName:
|
|
283
|
+
fieldName: fieldName_5,
|
|
311
284
|
fieldType: fieldType_0
|
|
312
285
|
});
|
|
313
286
|
};
|
|
314
|
-
$[
|
|
315
|
-
$[
|
|
316
|
-
$[
|
|
317
|
-
} else
|
|
318
|
-
const drillIntoField =
|
|
319
|
-
|
|
320
|
-
|
|
287
|
+
$[36] = blockId;
|
|
288
|
+
$[37] = itemId;
|
|
289
|
+
$[38] = t12;
|
|
290
|
+
} else t12 = $[38];
|
|
291
|
+
const drillIntoField = t12;
|
|
292
|
+
t10 = "space-y-4 px-2 py-4";
|
|
293
|
+
t11 = fields.map((field) => {
|
|
321
294
|
const label = field.label ?? formatFieldName(field.name);
|
|
322
295
|
const fieldId_1 = getFieldId(field.name);
|
|
323
296
|
if (field.fieldType === "String") return /* @__PURE__ */ jsx(form.Field, {
|
|
@@ -451,35 +424,35 @@ const ItemFieldsEditor = (t0) => {
|
|
|
451
424
|
}
|
|
452
425
|
return null;
|
|
453
426
|
});
|
|
454
|
-
$[
|
|
455
|
-
$[
|
|
456
|
-
$[
|
|
457
|
-
$[
|
|
458
|
-
$[
|
|
459
|
-
$[
|
|
460
|
-
$[
|
|
461
|
-
$[
|
|
462
|
-
$[
|
|
463
|
-
$[
|
|
464
|
-
$[
|
|
465
|
-
$[
|
|
466
|
-
$[
|
|
467
|
-
$[
|
|
427
|
+
$[22] = blockId;
|
|
428
|
+
$[23] = data;
|
|
429
|
+
$[24] = fields;
|
|
430
|
+
$[25] = filesMap;
|
|
431
|
+
$[26] = form;
|
|
432
|
+
$[27] = getFieldElementId;
|
|
433
|
+
$[28] = getFieldId;
|
|
434
|
+
$[29] = itemId;
|
|
435
|
+
$[30] = itemsMap;
|
|
436
|
+
$[31] = onFieldChange;
|
|
437
|
+
$[32] = postToIframe;
|
|
438
|
+
$[33] = schema;
|
|
439
|
+
$[34] = t10;
|
|
440
|
+
$[35] = t11;
|
|
468
441
|
} else {
|
|
469
|
-
|
|
470
|
-
|
|
442
|
+
t10 = $[34];
|
|
443
|
+
t11 = $[35];
|
|
471
444
|
}
|
|
472
|
-
let
|
|
473
|
-
if ($[
|
|
474
|
-
|
|
475
|
-
className:
|
|
476
|
-
children:
|
|
445
|
+
let t12;
|
|
446
|
+
if ($[39] !== t10 || $[40] !== t11) {
|
|
447
|
+
t12 = /* @__PURE__ */ jsx("form", {
|
|
448
|
+
className: t10,
|
|
449
|
+
children: t11
|
|
477
450
|
});
|
|
478
|
-
$[
|
|
479
|
-
$[
|
|
480
|
-
$[
|
|
481
|
-
} else
|
|
482
|
-
return
|
|
451
|
+
$[39] = t10;
|
|
452
|
+
$[40] = t11;
|
|
453
|
+
$[41] = t12;
|
|
454
|
+
} else t12 = $[41];
|
|
455
|
+
return t12;
|
|
483
456
|
};
|
|
484
457
|
function _temp(f) {
|
|
485
458
|
return f.fieldType === "String" || f.fieldType === "Embed";
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { previewStore } from "../previewStore.js";
|
|
2
|
+
import { AddBlockSidebar } from "./AddBlockSidebar.js";
|
|
3
|
+
import { PageNavigatorSidebar } from "./PageNavigatorSidebar.js";
|
|
4
|
+
import { c } from "react/compiler-runtime";
|
|
5
|
+
import { useSelector } from "@xstate/store-react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
//#region src/features/preview/components/LeftSidebar.tsx
|
|
9
|
+
const getLeftSidebarRoute = ({ isAddBlockSidebarOpen }) => {
|
|
10
|
+
if (isAddBlockSidebarOpen) return { type: "add-block" };
|
|
11
|
+
return { type: "page-navigator" };
|
|
12
|
+
};
|
|
13
|
+
const LeftSidebar = (t0) => {
|
|
14
|
+
const $ = c(12);
|
|
15
|
+
if ($[0] !== "f683caf1e19043e2a8ec108ed89c22771f4e771637dbf0249087f015011f6726") {
|
|
16
|
+
for (let $i = 0; $i < 12; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
17
|
+
$[0] = "f683caf1e19043e2a8ec108ed89c22771f4e771637dbf0249087f015011f6726";
|
|
18
|
+
}
|
|
19
|
+
const { page } = t0;
|
|
20
|
+
const isAddBlockSidebarOpen = useSelector(previewStore, _temp);
|
|
21
|
+
let t1;
|
|
22
|
+
if ($[1] !== isAddBlockSidebarOpen) {
|
|
23
|
+
t1 = getLeftSidebarRoute({ isAddBlockSidebarOpen });
|
|
24
|
+
$[1] = isAddBlockSidebarOpen;
|
|
25
|
+
$[2] = t1;
|
|
26
|
+
} else t1 = $[2];
|
|
27
|
+
const route = t1;
|
|
28
|
+
let t2;
|
|
29
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
30
|
+
t2 = { width: 250 };
|
|
31
|
+
$[3] = t2;
|
|
32
|
+
} else t2 = $[3];
|
|
33
|
+
let t3;
|
|
34
|
+
if ($[4] !== route.type) {
|
|
35
|
+
t3 = route.type === "add-block" && /* @__PURE__ */ jsx(AddBlockSidebar, {});
|
|
36
|
+
$[4] = route.type;
|
|
37
|
+
$[5] = t3;
|
|
38
|
+
} else t3 = $[5];
|
|
39
|
+
let t4;
|
|
40
|
+
if ($[6] !== page || $[7] !== route.type) {
|
|
41
|
+
t4 = route.type === "page-navigator" && /* @__PURE__ */ jsx(PageNavigatorSidebar, { page });
|
|
42
|
+
$[6] = page;
|
|
43
|
+
$[7] = route.type;
|
|
44
|
+
$[8] = t4;
|
|
45
|
+
} else t4 = $[8];
|
|
46
|
+
let t5;
|
|
47
|
+
if ($[9] !== t3 || $[10] !== t4) {
|
|
48
|
+
t5 = /* @__PURE__ */ jsxs("aside", {
|
|
49
|
+
className: "flex shrink-0 flex-col border-r-2",
|
|
50
|
+
style: t2,
|
|
51
|
+
children: [t3, t4]
|
|
52
|
+
});
|
|
53
|
+
$[9] = t3;
|
|
54
|
+
$[10] = t4;
|
|
55
|
+
$[11] = t5;
|
|
56
|
+
} else t5 = $[11];
|
|
57
|
+
return t5;
|
|
58
|
+
};
|
|
59
|
+
function _temp(state) {
|
|
60
|
+
return state.context.isAddBlockSidebarOpen;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
//#endregion
|
|
64
|
+
export { LeftSidebar };
|
|
@@ -10,9 +10,9 @@ import { useQuery } from "@tanstack/react-query";
|
|
|
10
10
|
import * as React from "react";
|
|
11
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
import { Button } from "@camox/ui/button";
|
|
13
|
-
import { Switch } from "@camox/ui/switch";
|
|
14
13
|
import { Check, ChevronsUpDown } from "lucide-react";
|
|
15
14
|
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "@camox/ui/command";
|
|
15
|
+
import { Switch } from "@camox/ui/switch";
|
|
16
16
|
import { Tabs, TabsList, TabsTrigger } from "@camox/ui/tabs";
|
|
17
17
|
|
|
18
18
|
//#region src/features/preview/components/LinkFieldEditor.tsx
|