camox 0.3.0 → 0.3.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/components/AuthGate.js +2 -1
- package/dist/core/components/AddBlockControlBar.js +117 -44
- package/dist/core/components/lexical/InlineContentEditable.js +37 -17
- package/dist/core/components/lexical/InlineLexicalEditor.js +84 -25
- package/dist/core/components/lexical/SelectionBroadcaster.js +84 -47
- package/dist/core/components/lexical/SidebarLexicalEditor.js +54 -19
- package/dist/core/createBlock.js +1172 -414
- package/dist/core/createLayout.js +48 -16
- package/dist/core/hooks/useFieldSelection.js +24 -13
- package/dist/core/hooks/useIsEditable.js +8 -2
- package/dist/core/hooks/useOverlayMessage.js +51 -20
- package/dist/features/content/CamoxContent.js +239 -107
- package/dist/features/content/components/AssetCard.js +78 -16
- package/dist/features/content/components/AssetCardSkeleton.js +11 -4
- package/dist/features/content/components/ContentSidebar.js +15 -8
- package/dist/features/content/components/UploadDropZone.js +77 -34
- package/dist/features/content/components/UploadProgressDrawer.js +201 -58
- package/dist/features/metadata/sitemap.js +15 -0
- package/dist/features/preview/CamoxPreview.js +447 -179
- package/dist/features/preview/components/AddBlockSheet.js +344 -167
- package/dist/features/preview/components/AgentChatSheet.js +32 -10
- package/dist/features/preview/components/AssetFieldEditor.js +185 -50
- package/dist/features/preview/components/AssetLightbox.js +60 -33
- package/dist/features/preview/components/AssetPickerGrid.js +203 -71
- package/dist/features/preview/components/BlockActionsPopover.js +295 -218
- package/dist/features/preview/components/CreatePageSheet.js +3 -3
- package/dist/features/preview/components/DebouncedFieldEditor.js +80 -23
- package/dist/features/preview/components/EditPageSheet.js +241 -86
- package/dist/features/preview/components/ItemFieldsEditor.js +209 -115
- package/dist/features/preview/components/LinkFieldEditor.js +351 -153
- package/dist/features/preview/components/MultipleAssetFieldEditor.js +245 -92
- package/dist/features/preview/components/OverlayTracker.js +58 -23
- package/dist/features/preview/components/Overlays.js +85 -43
- package/dist/features/preview/components/PageContentSheet.js +18 -18
- package/dist/features/preview/components/PageLocationFieldset.js +229 -63
- package/dist/features/preview/components/PagePicker.js +27 -27
- package/dist/features/preview/components/PageTree.js +921 -319
- package/dist/features/preview/components/PeekedBlock.js +173 -63
- package/dist/features/preview/components/PreviewPanel.js +271 -148
- package/dist/features/preview/components/PreviewSideSheet.js +44 -11
- package/dist/features/preview/components/PreviewToolbar.js +262 -59
- package/dist/features/preview/components/RepeatableItemsList.js +187 -78
- package/dist/features/preview/components/ShikiMarkdown.js +46 -20
- package/dist/features/preview/components/TextFormatToolbar.js +81 -23
- package/dist/features/preview/components/UnlinkAssetButton.js +161 -40
- package/dist/features/preview/components/useUpdateBlockPosition.js +64 -47
- package/dist/features/preview/previewStore.d.ts +2 -2
- package/dist/features/provider/CamoxProvider.js +69 -21
- package/dist/features/provider/actionsStore.d.ts +2 -2
- package/dist/features/provider/components/CamoxAppContext.js +15 -5
- package/dist/features/provider/components/CommandPalette.js +199 -92
- package/dist/features/provider/useAdminShortcuts.js +80 -64
- package/dist/features/routes/pageRoute.js +8 -1
- package/dist/features/studio/CamoxStudio.js +45 -9
- package/dist/features/studio/components/EnvironmentMenu.js +47 -12
- package/dist/features/studio/components/Navbar.js +163 -65
- package/dist/features/studio/components/ProjectMenu.js +263 -82
- package/dist/features/studio/components/UserButton.js +21 -6
- package/dist/features/studio/studioStore.d.ts +2 -2
- package/dist/features/studio/useTheme.js +128 -74
- package/dist/hooks/use-file-upload.js +11 -11
- package/dist/hooks/use-marquee-selection.js +121 -74
- package/dist/lib/auth.js +95 -51
- package/dist/lib/normalized-data.js +103 -30
- package/dist/lib/use-project-room.js +55 -22
- package/dist/studio.css +2 -2
- package/package.json +29 -26
- package/dist/lib/auth.d.ts +0 -2130
- package/dist/lib/auth.d.ts.map +0 -1
|
@@ -2,6 +2,7 @@ import { previewStore } from "../previewStore.js";
|
|
|
2
2
|
import { isFileMarker, isItemMarker, resolveFileMarker } from "../../../lib/normalized-data.js";
|
|
3
3
|
import { SidebarLexicalEditor } from "../../../core/components/lexical/SidebarLexicalEditor.js";
|
|
4
4
|
import { RepeatableItemsList } from "./RepeatableItemsList.js";
|
|
5
|
+
import { c } from "react/compiler-runtime";
|
|
5
6
|
import { Input } from "@camox/ui/input";
|
|
6
7
|
import { Label } from "@camox/ui/label";
|
|
7
8
|
import * as React from "react";
|
|
@@ -27,113 +28,173 @@ var getSchemaFieldsInOrder = (schema) => {
|
|
|
27
28
|
};
|
|
28
29
|
});
|
|
29
30
|
};
|
|
30
|
-
var ItemFieldsEditor = (
|
|
31
|
-
const
|
|
31
|
+
var ItemFieldsEditor = (t0) => {
|
|
32
|
+
const $ = c(38);
|
|
33
|
+
const { schema, data, blockId, itemId, onFieldChange, postToIframe, filesMap, itemsMap } = t0;
|
|
34
|
+
let t1;
|
|
35
|
+
if ($[0] !== schema) {
|
|
36
|
+
t1 = getSchemaFieldsInOrder(schema);
|
|
37
|
+
$[0] = schema;
|
|
38
|
+
$[1] = t1;
|
|
39
|
+
} else t1 = $[1];
|
|
40
|
+
const fields = t1;
|
|
32
41
|
const timerRef = React.useRef(null);
|
|
33
42
|
const focusedFieldIdRef = React.useRef(null);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
43
|
+
let t2;
|
|
44
|
+
if ($[2] !== blockId || $[3] !== itemId) {
|
|
45
|
+
t2 = (fieldName) => {
|
|
46
|
+
if (itemId) return `${blockId}__${itemId}__${fieldName}`;
|
|
47
|
+
return `${blockId}__${fieldName}`;
|
|
48
|
+
};
|
|
49
|
+
$[2] = blockId;
|
|
50
|
+
$[3] = itemId;
|
|
51
|
+
$[4] = t2;
|
|
52
|
+
} else t2 = $[4];
|
|
53
|
+
const getFieldId = t2;
|
|
54
|
+
let t3;
|
|
55
|
+
if ($[5] !== fields) {
|
|
56
|
+
t3 = fields.filter(_temp).map(_temp2);
|
|
57
|
+
$[5] = fields;
|
|
58
|
+
$[6] = t3;
|
|
59
|
+
} else t3 = $[6];
|
|
60
|
+
const scalarFields = t3;
|
|
61
|
+
let values;
|
|
62
|
+
if ($[7] !== data || $[8] !== scalarFields) {
|
|
63
|
+
values = {};
|
|
64
|
+
for (const fieldName_0 of scalarFields) values[fieldName_0] = data[fieldName_0] ?? "";
|
|
65
|
+
$[7] = data;
|
|
66
|
+
$[8] = scalarFields;
|
|
67
|
+
$[9] = values;
|
|
68
|
+
} else values = $[9];
|
|
69
|
+
const defaultValues = values;
|
|
70
|
+
let t4;
|
|
71
|
+
if ($[10] !== defaultValues) {
|
|
72
|
+
t4 = { defaultValues };
|
|
73
|
+
$[10] = defaultValues;
|
|
74
|
+
$[11] = t4;
|
|
75
|
+
} else t4 = $[11];
|
|
76
|
+
const form = useForm(t4);
|
|
77
|
+
let t5;
|
|
78
|
+
let t6;
|
|
79
|
+
if ($[12] !== defaultValues || $[13] !== form) {
|
|
80
|
+
t5 = () => {
|
|
81
|
+
form.update({ defaultValues });
|
|
82
|
+
};
|
|
83
|
+
t6 = [defaultValues, form];
|
|
84
|
+
$[12] = defaultValues;
|
|
85
|
+
$[13] = form;
|
|
86
|
+
$[14] = t5;
|
|
87
|
+
$[15] = t6;
|
|
88
|
+
} else {
|
|
89
|
+
t5 = $[14];
|
|
90
|
+
t6 = $[15];
|
|
91
|
+
}
|
|
92
|
+
React.useEffect(t5, t6);
|
|
93
|
+
let t7;
|
|
94
|
+
let t8;
|
|
95
|
+
if ($[16] !== postToIframe) {
|
|
96
|
+
t7 = () => () => {
|
|
52
97
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
53
98
|
if (focusedFieldIdRef.current) postToIframe({
|
|
54
99
|
type: "CAMOX_FOCUS_FIELD_END",
|
|
55
100
|
fieldId: focusedFieldIdRef.current
|
|
56
101
|
});
|
|
57
102
|
};
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
103
|
+
t8 = [postToIframe];
|
|
104
|
+
$[16] = postToIframe;
|
|
105
|
+
$[17] = t7;
|
|
106
|
+
$[18] = t8;
|
|
107
|
+
} else {
|
|
108
|
+
t7 = $[17];
|
|
109
|
+
t8 = $[18];
|
|
110
|
+
}
|
|
111
|
+
React.useEffect(t7, t8);
|
|
112
|
+
let t10;
|
|
113
|
+
let t9;
|
|
114
|
+
if ($[19] !== blockId || $[20] !== data || $[21] !== fields || $[22] !== filesMap || $[23] !== form || $[24] !== getFieldId || $[25] !== itemId || $[26] !== itemsMap || $[27] !== onFieldChange || $[28] !== postToIframe || $[29] !== schema) {
|
|
115
|
+
const handleScalarChange = (fieldName_1, value, fieldApi) => {
|
|
116
|
+
fieldApi.handleChange(value);
|
|
117
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
118
|
+
timerRef.current = window.setTimeout(() => {
|
|
119
|
+
onFieldChange(fieldName_1, value);
|
|
120
|
+
}, 500);
|
|
121
|
+
};
|
|
122
|
+
const handleFieldFocus = (fieldName_2, fieldType) => {
|
|
123
|
+
const fieldId = getFieldId(fieldName_2);
|
|
124
|
+
focusedFieldIdRef.current = fieldId;
|
|
125
|
+
postToIframe({
|
|
126
|
+
type: "CAMOX_FOCUS_FIELD",
|
|
127
|
+
fieldId
|
|
128
|
+
});
|
|
129
|
+
if (itemId) previewStore.send({
|
|
130
|
+
type: "selectItemField",
|
|
131
|
+
blockId,
|
|
132
|
+
itemId,
|
|
133
|
+
fieldName: fieldName_2,
|
|
134
|
+
fieldType
|
|
135
|
+
});
|
|
136
|
+
else previewStore.send({
|
|
137
|
+
type: "selectBlockField",
|
|
138
|
+
blockId,
|
|
139
|
+
fieldName: fieldName_2,
|
|
140
|
+
fieldType
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
const handleFieldBlur = (fieldName_3) => {
|
|
144
|
+
const fieldId_0 = getFieldId(fieldName_3);
|
|
145
|
+
focusedFieldIdRef.current = null;
|
|
146
|
+
postToIframe({
|
|
147
|
+
type: "CAMOX_FOCUS_FIELD_END",
|
|
148
|
+
fieldId: fieldId_0
|
|
149
|
+
});
|
|
150
|
+
requestAnimationFrame(() => {
|
|
151
|
+
if (!focusedFieldIdRef.current) previewStore.send({ type: "selectParent" });
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
let t11;
|
|
155
|
+
if ($[32] !== blockId || $[33] !== itemId) {
|
|
156
|
+
t11 = (fieldName_4, fieldType_0) => {
|
|
157
|
+
if (itemId) previewStore.send({
|
|
158
|
+
type: "selectItemField",
|
|
159
|
+
blockId,
|
|
160
|
+
itemId,
|
|
161
|
+
fieldName: fieldName_4,
|
|
162
|
+
fieldType: fieldType_0
|
|
163
|
+
});
|
|
164
|
+
else previewStore.send({
|
|
165
|
+
type: "selectBlockField",
|
|
166
|
+
blockId,
|
|
167
|
+
fieldName: fieldName_4,
|
|
168
|
+
fieldType: fieldType_0
|
|
169
|
+
});
|
|
170
|
+
};
|
|
171
|
+
$[32] = blockId;
|
|
172
|
+
$[33] = itemId;
|
|
173
|
+
$[34] = t11;
|
|
174
|
+
} else t11 = $[34];
|
|
175
|
+
const drillIntoField = t11;
|
|
176
|
+
t9 = "space-y-4 px-4 py-4";
|
|
177
|
+
t10 = fields.map((field) => {
|
|
117
178
|
const label = field.label ?? formatFieldName(field.name);
|
|
118
|
-
const
|
|
179
|
+
const fieldId_1 = getFieldId(field.name);
|
|
119
180
|
if (field.fieldType === "String") return /* @__PURE__ */ jsx(form.Field, {
|
|
120
181
|
name: field.name,
|
|
121
|
-
children: (
|
|
182
|
+
children: (fieldApi_0) => /* @__PURE__ */ jsxs("div", {
|
|
122
183
|
className: "space-y-2",
|
|
123
184
|
onMouseEnter: () => postToIframe({
|
|
124
185
|
type: "CAMOX_HOVER_FIELD",
|
|
125
|
-
fieldId
|
|
186
|
+
fieldId: fieldId_1
|
|
126
187
|
}),
|
|
127
188
|
onMouseLeave: () => postToIframe({
|
|
128
189
|
type: "CAMOX_HOVER_FIELD_END",
|
|
129
|
-
fieldId
|
|
190
|
+
fieldId: fieldId_1
|
|
130
191
|
}),
|
|
131
192
|
children: [/* @__PURE__ */ jsx(Label, {
|
|
132
193
|
htmlFor: field.name,
|
|
133
194
|
children: label
|
|
134
195
|
}), /* @__PURE__ */ jsx(SidebarLexicalEditor, {
|
|
135
|
-
value:
|
|
136
|
-
onChange: (
|
|
196
|
+
value: fieldApi_0.state.value,
|
|
197
|
+
onChange: (value_0) => handleScalarChange(field.name, value_0, fieldApi_0),
|
|
137
198
|
onFocus: () => handleFieldFocus(field.name, field.fieldType),
|
|
138
199
|
onBlur: () => handleFieldBlur(field.name)
|
|
139
200
|
})]
|
|
@@ -141,15 +202,15 @@ var ItemFieldsEditor = ({ schema, data, blockId, itemId, onFieldChange, postToIf
|
|
|
141
202
|
}, field.name);
|
|
142
203
|
if (field.fieldType === "Embed") return /* @__PURE__ */ jsx(form.Field, {
|
|
143
204
|
name: field.name,
|
|
144
|
-
children: (
|
|
205
|
+
children: (fieldApi_1) => /* @__PURE__ */ jsxs("div", {
|
|
145
206
|
className: "space-y-2",
|
|
146
207
|
onMouseEnter: () => postToIframe({
|
|
147
208
|
type: "CAMOX_HOVER_FIELD",
|
|
148
|
-
fieldId
|
|
209
|
+
fieldId: fieldId_1
|
|
149
210
|
}),
|
|
150
211
|
onMouseLeave: () => postToIframe({
|
|
151
212
|
type: "CAMOX_HOVER_FIELD_END",
|
|
152
|
-
fieldId
|
|
213
|
+
fieldId: fieldId_1
|
|
153
214
|
}),
|
|
154
215
|
children: [/* @__PURE__ */ jsx(Label, {
|
|
155
216
|
htmlFor: field.name,
|
|
@@ -157,8 +218,8 @@ var ItemFieldsEditor = ({ schema, data, blockId, itemId, onFieldChange, postToIf
|
|
|
157
218
|
}), /* @__PURE__ */ jsx(Input, {
|
|
158
219
|
id: field.name,
|
|
159
220
|
type: "url",
|
|
160
|
-
value:
|
|
161
|
-
onChange: (e) => handleScalarChange(field.name, e.target.value,
|
|
221
|
+
value: fieldApi_1.state.value,
|
|
222
|
+
onChange: (e) => handleScalarChange(field.name, e.target.value, fieldApi_1),
|
|
162
223
|
onFocus: () => handleFieldFocus(field.name, field.fieldType),
|
|
163
224
|
onBlur: () => handleFieldBlur(field.name)
|
|
164
225
|
})]
|
|
@@ -171,11 +232,11 @@ var ItemFieldsEditor = ({ schema, data, blockId, itemId, onFieldChange, postToIf
|
|
|
171
232
|
className: "space-y-2",
|
|
172
233
|
onMouseEnter: () => postToIframe({
|
|
173
234
|
type: "CAMOX_HOVER_FIELD",
|
|
174
|
-
fieldId
|
|
235
|
+
fieldId: fieldId_1
|
|
175
236
|
}),
|
|
176
237
|
onMouseLeave: () => postToIframe({
|
|
177
238
|
type: "CAMOX_HOVER_FIELD_END",
|
|
178
|
-
fieldId
|
|
239
|
+
fieldId: fieldId_1
|
|
179
240
|
}),
|
|
180
241
|
children: [/* @__PURE__ */ jsx(Label, { children: label }), /* @__PURE__ */ jsxs("button", {
|
|
181
242
|
type: "button",
|
|
@@ -190,10 +251,10 @@ var ItemFieldsEditor = ({ schema, data, blockId, itemId, onFieldChange, postToIf
|
|
|
190
251
|
}
|
|
191
252
|
if (field.fieldType === "RepeatableItem" && field.arrayItemType === "Image") {
|
|
192
253
|
const count = (data[field.name] ?? []).length;
|
|
193
|
-
let
|
|
194
|
-
if (count === 0)
|
|
195
|
-
else if (count === 1)
|
|
196
|
-
else
|
|
254
|
+
let preview_0;
|
|
255
|
+
if (count === 0) preview_0 = "No images";
|
|
256
|
+
else if (count === 1) preview_0 = "1 image";
|
|
257
|
+
else preview_0 = `${count} images`;
|
|
197
258
|
return /* @__PURE__ */ jsxs("div", {
|
|
198
259
|
className: "space-y-2",
|
|
199
260
|
onMouseEnter: () => postToIframe({
|
|
@@ -212,17 +273,17 @@ var ItemFieldsEditor = ({ schema, data, blockId, itemId, onFieldChange, postToIf
|
|
|
212
273
|
onClick: () => drillIntoField(field.name, "Image"),
|
|
213
274
|
children: [/* @__PURE__ */ jsx(Images, { className: "text-muted-foreground h-4 w-4 shrink-0" }), /* @__PURE__ */ jsx("span", {
|
|
214
275
|
className: "truncate",
|
|
215
|
-
children:
|
|
276
|
+
children: preview_0
|
|
216
277
|
})]
|
|
217
278
|
})]
|
|
218
279
|
}, field.name);
|
|
219
280
|
}
|
|
220
281
|
if (field.fieldType === "RepeatableItem" && field.arrayItemType === "File") {
|
|
221
|
-
const
|
|
222
|
-
let
|
|
223
|
-
if (
|
|
224
|
-
else if (
|
|
225
|
-
else
|
|
282
|
+
const count_0 = (data[field.name] ?? []).length;
|
|
283
|
+
let preview_1;
|
|
284
|
+
if (count_0 === 0) preview_1 = "No files";
|
|
285
|
+
else if (count_0 === 1) preview_1 = "1 file";
|
|
286
|
+
else preview_1 = `${count_0} files`;
|
|
226
287
|
return /* @__PURE__ */ jsxs("div", {
|
|
227
288
|
className: "space-y-2",
|
|
228
289
|
onMouseEnter: () => postToIframe({
|
|
@@ -241,23 +302,23 @@ var ItemFieldsEditor = ({ schema, data, blockId, itemId, onFieldChange, postToIf
|
|
|
241
302
|
onClick: () => drillIntoField(field.name, "File"),
|
|
242
303
|
children: [/* @__PURE__ */ jsx(FileIcon, { className: "text-muted-foreground h-4 w-4 shrink-0" }), /* @__PURE__ */ jsx("span", {
|
|
243
304
|
className: "truncate",
|
|
244
|
-
children:
|
|
305
|
+
children: preview_1
|
|
245
306
|
})]
|
|
246
307
|
})]
|
|
247
308
|
}, field.name);
|
|
248
309
|
}
|
|
249
310
|
if (field.fieldType === "Image") {
|
|
250
311
|
const rawImage = data[field.name];
|
|
251
|
-
const
|
|
312
|
+
const preview_2 = (isFileMarker(rawImage) ? resolveFileMarker(rawImage, filesMap) : rawImage)?.filename || "No image";
|
|
252
313
|
return /* @__PURE__ */ jsxs("div", {
|
|
253
314
|
className: "space-y-2",
|
|
254
315
|
onMouseEnter: () => postToIframe({
|
|
255
316
|
type: "CAMOX_HOVER_FIELD",
|
|
256
|
-
fieldId
|
|
317
|
+
fieldId: fieldId_1
|
|
257
318
|
}),
|
|
258
319
|
onMouseLeave: () => postToIframe({
|
|
259
320
|
type: "CAMOX_HOVER_FIELD_END",
|
|
260
|
-
fieldId
|
|
321
|
+
fieldId: fieldId_1
|
|
261
322
|
}),
|
|
262
323
|
children: [/* @__PURE__ */ jsx(Label, { children: label }), /* @__PURE__ */ jsxs("button", {
|
|
263
324
|
type: "button",
|
|
@@ -265,23 +326,23 @@ var ItemFieldsEditor = ({ schema, data, blockId, itemId, onFieldChange, postToIf
|
|
|
265
326
|
onClick: () => drillIntoField(field.name, "Image"),
|
|
266
327
|
children: [/* @__PURE__ */ jsx(ImageIcon, { className: "text-muted-foreground h-4 w-4 shrink-0" }), /* @__PURE__ */ jsx("span", {
|
|
267
328
|
className: "truncate",
|
|
268
|
-
children:
|
|
329
|
+
children: preview_2
|
|
269
330
|
})]
|
|
270
331
|
})]
|
|
271
332
|
}, field.name);
|
|
272
333
|
}
|
|
273
334
|
if (field.fieldType === "File") {
|
|
274
335
|
const rawFile = data[field.name];
|
|
275
|
-
const
|
|
336
|
+
const preview_3 = (isFileMarker(rawFile) ? resolveFileMarker(rawFile, filesMap) : rawFile)?.filename || "No file";
|
|
276
337
|
return /* @__PURE__ */ jsxs("div", {
|
|
277
338
|
className: "space-y-2",
|
|
278
339
|
onMouseEnter: () => postToIframe({
|
|
279
340
|
type: "CAMOX_HOVER_FIELD",
|
|
280
|
-
fieldId
|
|
341
|
+
fieldId: fieldId_1
|
|
281
342
|
}),
|
|
282
343
|
onMouseLeave: () => postToIframe({
|
|
283
344
|
type: "CAMOX_HOVER_FIELD_END",
|
|
284
|
-
fieldId
|
|
345
|
+
fieldId: fieldId_1
|
|
285
346
|
}),
|
|
286
347
|
children: [/* @__PURE__ */ jsx(Label, { children: label }), /* @__PURE__ */ jsxs("button", {
|
|
287
348
|
type: "button",
|
|
@@ -289,13 +350,13 @@ var ItemFieldsEditor = ({ schema, data, blockId, itemId, onFieldChange, postToIf
|
|
|
289
350
|
onClick: () => drillIntoField(field.name, "File"),
|
|
290
351
|
children: [/* @__PURE__ */ jsx(FileIcon, { className: "text-muted-foreground h-4 w-4 shrink-0" }), /* @__PURE__ */ jsx("span", {
|
|
291
352
|
className: "truncate",
|
|
292
|
-
children:
|
|
353
|
+
children: preview_3
|
|
293
354
|
})]
|
|
294
355
|
})]
|
|
295
356
|
}, field.name);
|
|
296
357
|
}
|
|
297
358
|
if (field.fieldType === "RepeatableItem") {
|
|
298
|
-
const
|
|
359
|
+
const items_1 = (data[field.name] ?? []).map((item) => {
|
|
299
360
|
if (isItemMarker(item)) return itemsMap.get(item._itemId) ?? null;
|
|
300
361
|
return item;
|
|
301
362
|
}).filter(Boolean);
|
|
@@ -303,7 +364,7 @@ var ItemFieldsEditor = ({ schema, data, blockId, itemId, onFieldChange, postToIf
|
|
|
303
364
|
return /* @__PURE__ */ jsxs("div", {
|
|
304
365
|
className: "space-y-2",
|
|
305
366
|
children: [/* @__PURE__ */ jsx(Label, { children: label }), /* @__PURE__ */ jsx(RepeatableItemsList, {
|
|
306
|
-
items,
|
|
367
|
+
items: items_1,
|
|
307
368
|
blockId,
|
|
308
369
|
fieldName: field.name,
|
|
309
370
|
minItems: field.minItems,
|
|
@@ -313,8 +374,41 @@ var ItemFieldsEditor = ({ schema, data, blockId, itemId, onFieldChange, postToIf
|
|
|
313
374
|
}, field.name);
|
|
314
375
|
}
|
|
315
376
|
return null;
|
|
316
|
-
})
|
|
317
|
-
|
|
377
|
+
});
|
|
378
|
+
$[19] = blockId;
|
|
379
|
+
$[20] = data;
|
|
380
|
+
$[21] = fields;
|
|
381
|
+
$[22] = filesMap;
|
|
382
|
+
$[23] = form;
|
|
383
|
+
$[24] = getFieldId;
|
|
384
|
+
$[25] = itemId;
|
|
385
|
+
$[26] = itemsMap;
|
|
386
|
+
$[27] = onFieldChange;
|
|
387
|
+
$[28] = postToIframe;
|
|
388
|
+
$[29] = schema;
|
|
389
|
+
$[30] = t10;
|
|
390
|
+
$[31] = t9;
|
|
391
|
+
} else {
|
|
392
|
+
t10 = $[30];
|
|
393
|
+
t9 = $[31];
|
|
394
|
+
}
|
|
395
|
+
let t11;
|
|
396
|
+
if ($[35] !== t10 || $[36] !== t9) {
|
|
397
|
+
t11 = /* @__PURE__ */ jsx("form", {
|
|
398
|
+
className: t9,
|
|
399
|
+
children: t10
|
|
400
|
+
});
|
|
401
|
+
$[35] = t10;
|
|
402
|
+
$[36] = t9;
|
|
403
|
+
$[37] = t11;
|
|
404
|
+
} else t11 = $[37];
|
|
405
|
+
return t11;
|
|
318
406
|
};
|
|
407
|
+
function _temp(f) {
|
|
408
|
+
return f.fieldType === "String" || f.fieldType === "Embed";
|
|
409
|
+
}
|
|
410
|
+
function _temp2(f_0) {
|
|
411
|
+
return f_0.name;
|
|
412
|
+
}
|
|
319
413
|
//#endregion
|
|
320
414
|
export { ItemFieldsEditor, formatFieldName };
|