camox 0.14.0 → 0.14.2
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.js +15 -10
- package/dist/features/preview/components/AgentChatSheet.js +1 -1
- package/dist/features/preview/components/PageContentSheet.js +1 -1
- package/dist/features/preview/components/PageTree.js +42 -23
- package/dist/features/preview/components/RepeatableItemsList.js +7 -1
- package/dist/studio-overlays.css +2 -0
- package/package.json +4 -4
package/dist/core/createBlock.js
CHANGED
|
@@ -767,7 +767,9 @@ function createBlock(options) {
|
|
|
767
767
|
const repeaterContext = React.use(RepeaterItemContext);
|
|
768
768
|
const { filesMap } = useNormalizedData();
|
|
769
769
|
const rawSource = repeaterContext ? repeaterContext.itemContent[name] : content[name];
|
|
770
|
-
const
|
|
770
|
+
const rawValue = isFileMarker(rawSource) ? resolveFileMarker(rawSource, filesMap) : rawSource;
|
|
771
|
+
const defaultValue = repeaterContext ? repeatableItemDefaults[repeaterContext.arrayFieldName]?.[String(name)] : contentDefaults[String(name)];
|
|
772
|
+
const fieldValue = rawValue ?? defaultValue;
|
|
771
773
|
const t1 = String(name);
|
|
772
774
|
let t2;
|
|
773
775
|
if ($[0] !== blockId || $[1] !== repeaterContext || $[2] !== t1) {
|
|
@@ -876,7 +878,7 @@ function createBlock(options) {
|
|
|
876
878
|
return t14;
|
|
877
879
|
};
|
|
878
880
|
const File = (t0) => {
|
|
879
|
-
const $ = c(
|
|
881
|
+
const $ = c(8);
|
|
880
882
|
const { name, children } = t0;
|
|
881
883
|
const blockContext = React.use(Context);
|
|
882
884
|
if (!blockContext) throw new Error("File must be used within a Block Component");
|
|
@@ -885,8 +887,10 @@ function createBlock(options) {
|
|
|
885
887
|
const { filesMap } = useNormalizedData();
|
|
886
888
|
const rawSource = repeaterContext ? repeaterContext.itemContent[name] : content[name];
|
|
887
889
|
let t1;
|
|
888
|
-
if ($[0] !== children || $[1] !== filesMap || $[2] !== name || $[3] !== rawSource) {
|
|
889
|
-
const
|
|
890
|
+
if ($[0] !== children || $[1] !== filesMap || $[2] !== name || $[3] !== rawSource || $[4] !== repeaterContext) {
|
|
891
|
+
const rawValue = isFileMarker(rawSource) ? resolveFileMarker(rawSource, filesMap) : rawSource;
|
|
892
|
+
const defaultValue = repeaterContext ? repeatableItemDefaults[repeaterContext.arrayFieldName]?.[String(name)] : contentDefaults[String(name)];
|
|
893
|
+
const fieldValue = rawValue ?? defaultValue;
|
|
890
894
|
t1 = children({
|
|
891
895
|
href: fieldValue.url,
|
|
892
896
|
download: fieldValue.filename
|
|
@@ -895,14 +899,15 @@ function createBlock(options) {
|
|
|
895
899
|
$[1] = filesMap;
|
|
896
900
|
$[2] = name;
|
|
897
901
|
$[3] = rawSource;
|
|
898
|
-
$[4] =
|
|
899
|
-
|
|
902
|
+
$[4] = repeaterContext;
|
|
903
|
+
$[5] = t1;
|
|
904
|
+
} else t1 = $[5];
|
|
900
905
|
let t2;
|
|
901
|
-
if ($[
|
|
906
|
+
if ($[6] !== t1) {
|
|
902
907
|
t2 = /* @__PURE__ */ jsx(Fragment, { children: t1 });
|
|
903
|
-
$[
|
|
904
|
-
$[
|
|
905
|
-
} else t2 = $[
|
|
908
|
+
$[6] = t1;
|
|
909
|
+
$[7] = t2;
|
|
910
|
+
} else t2 = $[7];
|
|
906
911
|
return t2;
|
|
907
912
|
};
|
|
908
913
|
const RepeaterItemWrapper = (t0) => {
|
|
@@ -20,7 +20,7 @@ const AgentChatSheet = () => {
|
|
|
20
20
|
className: "flex flex-1 items-center justify-center p-6",
|
|
21
21
|
children: /* @__PURE__ */ jsx("p", {
|
|
22
22
|
className: "text-muted-foreground text-center text-sm",
|
|
23
|
-
children: "Coming soon"
|
|
23
|
+
children: "Coming soon: MCP server and integrated chat"
|
|
24
24
|
})
|
|
25
25
|
});
|
|
26
26
|
$[1] = t1;
|
|
@@ -494,7 +494,7 @@ const PageContentSheet = () => {
|
|
|
494
494
|
}
|
|
495
495
|
})
|
|
496
496
|
}),
|
|
497
|
-
!isViewingAsset && !isViewingLink && /* @__PURE__ */ jsx(ItemFieldsEditor, {
|
|
497
|
+
!isViewingAsset && !isViewingLink && (currentItemId == null || currentItem) && /* @__PURE__ */ jsx(ItemFieldsEditor, {
|
|
498
498
|
schema: currentSchema,
|
|
499
499
|
data: currentData,
|
|
500
500
|
blockId: block.id,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { previewStore } from "../previewStore.js";
|
|
2
|
+
import { blockQueries } from "../../../lib/queries.js";
|
|
2
3
|
import { cn } from "../../../lib/utils.js";
|
|
3
4
|
import { usePageBlocks } from "../../../lib/normalized-data.js";
|
|
4
5
|
import { useCamoxApp } from "../../provider/components/CamoxAppContext.js";
|
|
@@ -7,6 +8,7 @@ import { useUpdateBlockPosition } from "./useUpdateBlockPosition.js";
|
|
|
7
8
|
import { BlockActionsPopover } from "./BlockActionsPopover.js";
|
|
8
9
|
import { usePreviewedPage } from "../CamoxPreview.js";
|
|
9
10
|
import { c } from "react/compiler-runtime";
|
|
11
|
+
import { useQuery } from "@tanstack/react-query";
|
|
10
12
|
import { useSelector } from "@xstate/store/react";
|
|
11
13
|
import * as React from "react";
|
|
12
14
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -137,12 +139,26 @@ const FieldItem = (t0) => {
|
|
|
137
139
|
return t9;
|
|
138
140
|
};
|
|
139
141
|
const BlockFields = (t0) => {
|
|
140
|
-
const $ = c(
|
|
142
|
+
const $ = c(4);
|
|
141
143
|
const { block } = t0;
|
|
142
144
|
const schemaProperties = useCamoxApp().getBlockById(block.type)?._internal.contentSchema.properties;
|
|
143
145
|
const selection = useSelector(previewStore, _temp3);
|
|
144
146
|
const iframeElement = useSelector(previewStore, _temp4);
|
|
145
|
-
|
|
147
|
+
let t1;
|
|
148
|
+
if ($[0] !== block.id) {
|
|
149
|
+
t1 = blockQueries.get(block.id);
|
|
150
|
+
$[0] = block.id;
|
|
151
|
+
$[1] = t1;
|
|
152
|
+
} else t1 = $[1];
|
|
153
|
+
const { data: blockBundle } = useQuery(t1);
|
|
154
|
+
let selectedFieldName = null;
|
|
155
|
+
if (selection?.type === "block-field" && selection.blockId === block.id) selectedFieldName = selection.fieldName;
|
|
156
|
+
else if ((selection?.type === "item" || selection?.type === "item-field") && selection.blockId === block.id && blockBundle) {
|
|
157
|
+
const itemsById = new Map(blockBundle.repeatableItems.map(_temp5));
|
|
158
|
+
let current = itemsById.get(selection.itemId);
|
|
159
|
+
while (current?.parentItemId != null) current = itemsById.get(current.parentItemId);
|
|
160
|
+
selectedFieldName = current?.fieldName ?? null;
|
|
161
|
+
}
|
|
146
162
|
const handleFieldClick = (fieldName, fieldType) => {
|
|
147
163
|
previewStore.send({
|
|
148
164
|
type: "selectBlockField",
|
|
@@ -191,8 +207,8 @@ const BlockFields = (t0) => {
|
|
|
191
207
|
iframeElement.contentWindow.postMessage(message_2, "*");
|
|
192
208
|
}
|
|
193
209
|
};
|
|
194
|
-
const
|
|
195
|
-
const
|
|
210
|
+
const t2 = "my-1 space-y-1 pl-7";
|
|
211
|
+
const t3 = Object.keys(schemaProperties ?? {}).map((fieldName_3) => {
|
|
196
212
|
const value = block.content[fieldName_3];
|
|
197
213
|
const fieldSchema = schemaProperties?.[fieldName_3];
|
|
198
214
|
if (!fieldSchema) return null;
|
|
@@ -211,23 +227,23 @@ const BlockFields = (t0) => {
|
|
|
211
227
|
onMouseLeave: () => handleFieldMouseLeave(fieldName_3, isRepeatable_1)
|
|
212
228
|
}, fieldName_3);
|
|
213
229
|
});
|
|
214
|
-
let
|
|
215
|
-
if ($[
|
|
216
|
-
|
|
217
|
-
className:
|
|
218
|
-
children:
|
|
230
|
+
let t4;
|
|
231
|
+
if ($[2] !== t3) {
|
|
232
|
+
t4 = /* @__PURE__ */ jsx("ul", {
|
|
233
|
+
className: t2,
|
|
234
|
+
children: t3
|
|
219
235
|
});
|
|
220
|
-
$[
|
|
221
|
-
$[
|
|
222
|
-
} else
|
|
223
|
-
return
|
|
236
|
+
$[2] = t3;
|
|
237
|
+
$[3] = t4;
|
|
238
|
+
} else t4 = $[3];
|
|
239
|
+
return t4;
|
|
224
240
|
};
|
|
225
241
|
function useBlockTreeItem(block, t0) {
|
|
226
242
|
const $ = c(16);
|
|
227
243
|
const isDragging = t0 === void 0 ? false : t0;
|
|
228
244
|
const [ellipsisPopoverOpen, setEllipsisPopoverOpen] = React.useState(false);
|
|
229
|
-
const selection = useSelector(previewStore,
|
|
230
|
-
const iframeElement = useSelector(previewStore,
|
|
245
|
+
const selection = useSelector(previewStore, _temp6);
|
|
246
|
+
const iframeElement = useSelector(previewStore, _temp7);
|
|
231
247
|
const isBlockSelected = selection?.type === "block" && selection.blockId === block.id;
|
|
232
248
|
const shouldShowHover = !isDragging && !isBlockSelected;
|
|
233
249
|
const shouldShowActive = isDragging || isBlockSelected;
|
|
@@ -296,10 +312,10 @@ function useBlockTreeItem(block, t0) {
|
|
|
296
312
|
} else t4 = $[15];
|
|
297
313
|
return t4;
|
|
298
314
|
}
|
|
299
|
-
function
|
|
315
|
+
function _temp7(state_0) {
|
|
300
316
|
return state_0.context.iframeElement;
|
|
301
317
|
}
|
|
302
|
-
function
|
|
318
|
+
function _temp6(state) {
|
|
303
319
|
return state.context.selection;
|
|
304
320
|
}
|
|
305
321
|
const BlockTreeItemHeader = (t0) => {
|
|
@@ -891,13 +907,13 @@ const PageTree = () => {
|
|
|
891
907
|
} else t7 = $[16];
|
|
892
908
|
let t8;
|
|
893
909
|
if ($[17] !== pageBlocks) {
|
|
894
|
-
t8 = pageBlocks.map(
|
|
910
|
+
t8 = pageBlocks.map(_temp8);
|
|
895
911
|
$[17] = pageBlocks;
|
|
896
912
|
$[18] = t8;
|
|
897
913
|
} else t8 = $[18];
|
|
898
914
|
let t9;
|
|
899
915
|
if ($[19] !== pageBlocks) {
|
|
900
|
-
t9 = pageBlocks.map(
|
|
916
|
+
t9 = pageBlocks.map(_temp9);
|
|
901
917
|
$[19] = pageBlocks;
|
|
902
918
|
$[20] = t9;
|
|
903
919
|
} else t9 = $[20];
|
|
@@ -993,7 +1009,7 @@ const PageTree = () => {
|
|
|
993
1009
|
if ($[43] === Symbol.for("react.memo_cache_sentinel")) {
|
|
994
1010
|
t16 = /* @__PURE__ */ jsxs(Button, {
|
|
995
1011
|
variant: "secondary",
|
|
996
|
-
onClick:
|
|
1012
|
+
onClick: _temp0,
|
|
997
1013
|
children: [/* @__PURE__ */ jsx(Plus, {}), "Add block"]
|
|
998
1014
|
});
|
|
999
1015
|
$[43] = t16;
|
|
@@ -1012,13 +1028,16 @@ function _temp3(state) {
|
|
|
1012
1028
|
function _temp4(state_0) {
|
|
1013
1029
|
return state_0.context.iframeElement;
|
|
1014
1030
|
}
|
|
1015
|
-
function
|
|
1031
|
+
function _temp5(i) {
|
|
1032
|
+
return [i.id, i];
|
|
1033
|
+
}
|
|
1034
|
+
function _temp8(block_2) {
|
|
1016
1035
|
return String(block_2.id);
|
|
1017
1036
|
}
|
|
1018
|
-
function
|
|
1037
|
+
function _temp9(block_3) {
|
|
1019
1038
|
return /* @__PURE__ */ jsx(SortableBlock, { block: block_3 }, String(block_3.id));
|
|
1020
1039
|
}
|
|
1021
|
-
function
|
|
1040
|
+
function _temp0() {
|
|
1022
1041
|
return previewStore.send({ type: "openAddBlockSheet" });
|
|
1023
1042
|
}
|
|
1024
1043
|
|
|
@@ -257,7 +257,13 @@ const RepeatableItemsList = ({ items, blockId, fieldName, minItems, maxItems, sc
|
|
|
257
257
|
content: defaultContent,
|
|
258
258
|
settings: defaultSettings ? { ...defaultSettings } : void 0,
|
|
259
259
|
nestedItems: nestedItems.length > 0 ? nestedItems : void 0
|
|
260
|
-
})
|
|
260
|
+
}, { onSuccess: (created) => {
|
|
261
|
+
previewStore.send({
|
|
262
|
+
type: "selectItem",
|
|
263
|
+
blockId,
|
|
264
|
+
itemId: created.id
|
|
265
|
+
});
|
|
266
|
+
} });
|
|
261
267
|
};
|
|
262
268
|
const handleRemoveItem = (itemId) => {
|
|
263
269
|
deleteRepeatableItem.mutate({ id: itemId });
|
package/dist/studio-overlays.css
CHANGED
|
@@ -100,12 +100,14 @@
|
|
|
100
100
|
[data-camox-field-type]
|
|
101
101
|
)[data-camox-overlay-mode="layout"][data-camox-hovered] {
|
|
102
102
|
box-shadow: 0 0 0 var(--camox-overlay-width-hover) var(--camox-overlay-layout-color-hover) !important;
|
|
103
|
+
border-radius: 0 !important;
|
|
103
104
|
}
|
|
104
105
|
|
|
105
106
|
[data-camox-field-id]:not(
|
|
106
107
|
[data-camox-field-type]
|
|
107
108
|
)[data-camox-overlay-mode="layout"][data-camox-focused] {
|
|
108
109
|
box-shadow: 0 0 0 var(--camox-overlay-width-selected) var(--camox-overlay-layout-color-selected) !important;
|
|
110
|
+
border-radius: 0 !important;
|
|
109
111
|
}
|
|
110
112
|
|
|
111
113
|
/* ---- Embed: z-index above click-interceptor ---- */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "camox",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.2",
|
|
4
4
|
"bin": {
|
|
5
5
|
"camox": "./bin/camox.mjs"
|
|
6
6
|
},
|
|
@@ -98,9 +98,9 @@
|
|
|
98
98
|
"react-og-preview": "^0.2.0",
|
|
99
99
|
"shiki": "^4.0.2",
|
|
100
100
|
"zod": "^4.3.6",
|
|
101
|
-
"@camox/api-contract": "0.14.
|
|
102
|
-
"@camox/ui": "0.14.
|
|
103
|
-
"@camox/cli": "0.14.
|
|
101
|
+
"@camox/api-contract": "0.14.2",
|
|
102
|
+
"@camox/ui": "0.14.2",
|
|
103
|
+
"@camox/cli": "0.14.2"
|
|
104
104
|
},
|
|
105
105
|
"devDependencies": {
|
|
106
106
|
"@babel/core": "^7.29.0",
|