camox 0.76.0 → 0.77.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/editing/createEditableBlock.js +1077 -1681
- package/dist/core/editing/fieldSlot.js +251 -0
- package/dist/core/editing/useFieldSlot.js +159 -0
- package/dist/core/layoutContext.d.ts +2 -0
- package/dist/core/layoutContext.js +27 -1
- package/dist/core/lib/artifactTheme.js +43 -6
- package/dist/features/canvas/CanvasPageFrame.js +2 -2
- package/dist/features/canvas/CanvasPreviewPageSlot.js +1 -1
- package/dist/features/canvas/canvasCameraController.js +595 -0
- package/dist/features/canvas/useCanvasCamera.js +141 -587
- package/dist/features/canvas/useCanvasFrame.js +1 -1
- package/dist/features/page/DerivedPageContent.js +4 -8
- package/dist/features/preview/components/AssetLightbox.js +6 -65
- package/dist/features/preview/components/CanvasPreview.js +2 -2
- package/dist/features/preview/components/Frame.js +3 -3
- package/dist/features/preview/components/ItemFieldsEditor.js +376 -460
- package/dist/features/preview/components/Overlays.js +4 -9
- package/dist/features/preview/components/PreviewPanel.js +3 -3
- package/dist/features/preview/components/RemovedBlockPlaceholder.js +2 -2
- package/dist/features/preview/components/SelectionEditor.js +285 -339
- package/dist/features/preview/components/ZoomableImage.js +105 -0
- package/dist/features/preview/components/contentFieldSchema.js +3 -1
- package/dist/features/preview/components/useFieldWriter.js +30 -51
- package/dist/features/preview/components/useRecordView.js +3 -3
- package/dist/features/preview/overlayMessages.js +20 -58
- package/dist/features/preview/previewStore.js +6 -123
- package/dist/features/preview/repeatableItemPath.js +47 -0
- package/dist/features/renderer/RendererApp.js +6 -6
- package/dist/features/renderer/RendererFrames.js +2 -2
- package/dist/features/renderer/rendererHost.js +1 -1
- package/dist/features/routes/pageRuntime.d.ts +2 -8
- package/dist/features/routes/pageRuntime.js +21 -105
- package/dist/features/runtime/pageApp.js +1 -1
- package/dist/features/runtime/pageRead.js +105 -0
- package/dist/features/runtime/reader.d.ts +25 -0
- package/dist/features/runtime/reader.js +142 -0
- package/dist/features/runtime/runtime.d.ts +9 -3
- package/dist/features/runtime/runtime.js +608 -776
- package/dist/features/sdkBundle/buildSdkBundle.d.ts +5 -0
- package/dist/features/sdkBundle/buildSdkBundle.js +9 -3
- package/dist/features/studio/components/DraftsSheet.js +124 -65
- package/dist/features/studio/components/LocalePicker.js +518 -134
- package/dist/features/studio/components/ThreadMessages.js +5 -9
- package/dist/features/studio/showInCanvas.js +9 -19
- package/dist/features/studio/useEditorSelection.js +8 -19
- package/dist/lib/locale-path.js +2 -2
- package/dist/lib/queries.js +5 -1
- package/dist/package.js +1 -1
- package/dist/studio.css +1 -1
- package/package.json +4 -4
- package/skills/camox/references/artifacts.md +7 -0
- package/dist/core/hooks/useFieldSelection.js +0 -67
- package/dist/core/hooks/useIsEditable.js +0 -21
- package/dist/core/hooks/useOverlayMessage.js +0 -70
|
@@ -12,19 +12,16 @@ import { renderImagePlaceholder } from "../lib/imagePlaceholder.js";
|
|
|
12
12
|
import { buildImageSrcSet, getDefaultImageSizes, getDefaultImageWidth, transformImageUrl } from "../lib/imageTransform.js";
|
|
13
13
|
import { markdownToReactNodes } from "../lib/lexicalReact.js";
|
|
14
14
|
import { resolveReference, resolveReferenceList } from "../lib/reference.js";
|
|
15
|
+
import { placementId, placementThrough, sameTarget, slotSelection } from "./fieldSlot.js";
|
|
15
16
|
import { selectionBlockId } from "../../features/preview/previewStore.js";
|
|
16
|
-
import { overlayFieldId, recordPlacementId } from "../../features/preview/overlayMessages.js";
|
|
17
|
-
import { useIsEditable } from "../hooks/useIsEditable.js";
|
|
18
|
-
import { CanvasWorkspaceContext } from "../../features/canvas/canvasZoom.js";
|
|
19
|
-
import { PreviewEditingOwnerContext, usePreviewSelection, usePreviewTargetSelection } from "../../features/preview/previewSelection.js";
|
|
20
|
-
import { useApplyContentEdit } from "./contentEdits.js";
|
|
21
17
|
import { useFrame } from "../../features/preview/components/Frame.js";
|
|
18
|
+
import { PreviewEditingOwnerContext } from "../../features/preview/previewSelection.js";
|
|
19
|
+
import { FieldScopeContext, useEditingSelection, useFieldScope, useFieldSlot, useIsEditable, useSelectTarget, useSidebarHover } from "./useFieldSlot.js";
|
|
20
|
+
import { CanvasWorkspaceContext } from "../../features/canvas/canvasZoom.js";
|
|
22
21
|
import { useLatestRecord } from "./useLatestRecord.js";
|
|
23
22
|
import { registerRepeatableItem } from "../../features/preview/repeatableItemTargets.js";
|
|
24
23
|
import { revealScrollDelta } from "../../features/preview/selectionReveal.js";
|
|
25
24
|
import { InlineLexicalEditor } from "../components/lexical/InlineLexicalEditor.js";
|
|
26
|
-
import { useFieldSelection, useRecordSelection } from "../hooks/useFieldSelection.js";
|
|
27
|
-
import { useOverlayMessage } from "../hooks/useOverlayMessage.js";
|
|
28
25
|
import { useOverlayState } from "../hooks/useOverlayState.js";
|
|
29
26
|
import { c } from "react/compiler-runtime";
|
|
30
27
|
import * as React from "react";
|
|
@@ -33,8 +30,6 @@ import { Type } from "@sinclair/typebox";
|
|
|
33
30
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
34
31
|
|
|
35
32
|
//#region src/core/editing/createEditableBlock.tsx
|
|
36
|
-
/** Inline field writes report no failure: the field keeps what was typed. */
|
|
37
|
-
const ignore = () => {};
|
|
38
33
|
/** The pages links lead to in the locale viewed, for the studio's editors, who read the project. */
|
|
39
34
|
function useEditorLinkPages() {
|
|
40
35
|
const $ = c(1);
|
|
@@ -88,203 +83,98 @@ function createEditableBlock(options) {
|
|
|
88
83
|
const emptySettings = emptyFieldValues(settingsTypeboxSchema);
|
|
89
84
|
const ToReact = options.toReact;
|
|
90
85
|
const Context = React.createContext(null);
|
|
91
|
-
const
|
|
92
|
-
const ReferenceContext = React.createContext(null);
|
|
86
|
+
const ItemNestingContext = React.createContext(null);
|
|
93
87
|
const RepeaterHoverContext = React.createContext(null);
|
|
94
|
-
const
|
|
88
|
+
const useScope = (primitive) => {
|
|
89
|
+
const scope = useFieldScope();
|
|
90
|
+
if (!scope) throw new Error(`${primitive} must be used within a Block Component`);
|
|
91
|
+
return scope;
|
|
92
|
+
};
|
|
95
93
|
const Field = (t0) => {
|
|
96
|
-
const $ = c(
|
|
94
|
+
const $ = c(17);
|
|
97
95
|
const { name, textStyle, linkStyle, children } = t0;
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
96
|
+
useScope("Field");
|
|
97
|
+
const [isEditorFocused, setIsEditorFocused] = React.useState(false);
|
|
98
|
+
let t1;
|
|
99
|
+
if ($[0] !== isEditorFocused) {
|
|
100
|
+
t1 = { editing: isEditorFocused };
|
|
101
|
+
$[0] = isEditorFocused;
|
|
102
|
+
$[1] = t1;
|
|
103
|
+
} else t1 = $[1];
|
|
104
|
+
const field = useFieldSlot(String(name), "String", t1);
|
|
103
105
|
const elementRef = React.useRef(null);
|
|
104
|
-
const { window: iframeWindow } = useFrame();
|
|
105
106
|
const pages = useEditorLinkPages();
|
|
106
|
-
let t1;
|
|
107
|
-
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
108
|
-
t1 = { select: _temp };
|
|
109
|
-
$[0] = t1;
|
|
110
|
-
} else t1 = $[0];
|
|
111
|
-
const currentPathname = useLocation(t1);
|
|
112
|
-
const repeaterContext = React.use(RepeatableItemContext);
|
|
113
|
-
const reference = React.use(ReferenceContext);
|
|
114
|
-
const fieldId = getOverlayFieldId(blockId, String(name), {
|
|
115
|
-
itemId: repeaterContext?.itemId,
|
|
116
|
-
reference
|
|
117
|
-
});
|
|
118
|
-
const fieldValue = repeaterContext ? repeaterContext.itemContent[name] : content[name];
|
|
119
|
-
const [isHovered, setIsHovered] = React.useState(false);
|
|
120
|
-
const [isEditorFocused, setIsEditorFocused] = React.useState(false);
|
|
121
|
-
const isBlockFieldSelected = useFieldSelection(blockId, String(name), "String", repeaterContext?.itemId);
|
|
122
|
-
const isRecordFieldSelected = useRecordSelection(reference?.placement ?? null, String(name));
|
|
123
|
-
const overlayState = useOverlayState(isHovered, isEditorFocused || (reference ? isRecordFieldSelected : isBlockFieldSelected));
|
|
124
|
-
const isHoveredFromSidebar = useOverlayMessage(iframeWindow, isContentEditable, "CAMOX_HOVER_FIELD", "CAMOX_HOVER_FIELD_END", { fieldId });
|
|
125
|
-
const [prevSidebarHover, setPrevSidebarHover] = React.useState(isHoveredFromSidebar);
|
|
126
|
-
if (prevSidebarHover !== isHoveredFromSidebar) {
|
|
127
|
-
setPrevSidebarHover(isHoveredFromSidebar);
|
|
128
|
-
setIsHovered(isHoveredFromSidebar);
|
|
129
|
-
}
|
|
130
|
-
const applyEdit = useApplyContentEdit();
|
|
131
107
|
let t2;
|
|
132
|
-
if ($[
|
|
133
|
-
t2 =
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
const content_0 = { [name]: newValue };
|
|
139
|
-
if (repeaterContext) {
|
|
140
|
-
const { itemId } = repeaterContext;
|
|
141
|
-
if (itemId != null) applyEdit({
|
|
142
|
-
type: "itemContent",
|
|
143
|
-
itemId,
|
|
144
|
-
content: content_0
|
|
145
|
-
}).catch(ignore);
|
|
146
|
-
} else applyEdit({
|
|
147
|
-
type: "blockContent",
|
|
148
|
-
blockId,
|
|
149
|
-
content: content_0
|
|
150
|
-
}).catch(ignore);
|
|
151
|
-
};
|
|
152
|
-
$[1] = applyEdit;
|
|
153
|
-
$[2] = blockId;
|
|
154
|
-
$[3] = name;
|
|
155
|
-
$[4] = reference;
|
|
156
|
-
$[5] = repeaterContext;
|
|
157
|
-
$[6] = t2;
|
|
158
|
-
} else t2 = $[6];
|
|
159
|
-
const handleChange = t2;
|
|
160
|
-
let t3;
|
|
161
|
-
if ($[7] !== blockId || $[8] !== name || $[9] !== reference || $[10] !== repeaterContext || $[11] !== selectTarget) {
|
|
162
|
-
t3 = () => {
|
|
163
|
-
if (reference) {
|
|
164
|
-
reference.selectRecordField(String(name), "String");
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
selectTarget(repeaterContext?.itemId != null ? {
|
|
168
|
-
type: "item-field",
|
|
169
|
-
blockId,
|
|
170
|
-
itemId: repeaterContext.itemId,
|
|
171
|
-
fieldName: String(name),
|
|
172
|
-
fieldType: "String"
|
|
173
|
-
} : {
|
|
174
|
-
type: "block-field",
|
|
175
|
-
blockId,
|
|
176
|
-
fieldName: String(name),
|
|
177
|
-
fieldType: "String"
|
|
178
|
-
});
|
|
179
|
-
};
|
|
180
|
-
$[7] = blockId;
|
|
181
|
-
$[8] = name;
|
|
182
|
-
$[9] = reference;
|
|
183
|
-
$[10] = repeaterContext;
|
|
184
|
-
$[11] = selectTarget;
|
|
185
|
-
$[12] = t3;
|
|
186
|
-
} else t3 = $[12];
|
|
187
|
-
const selectField = t3;
|
|
188
|
-
let t4;
|
|
189
|
-
if ($[13] !== selectField) {
|
|
190
|
-
t4 = () => {
|
|
191
|
-
setIsEditorFocused(true);
|
|
192
|
-
selectField();
|
|
193
|
-
};
|
|
194
|
-
$[13] = selectField;
|
|
195
|
-
$[14] = t4;
|
|
196
|
-
} else t4 = $[14];
|
|
197
|
-
const handleFocus = t4;
|
|
198
|
-
let t5;
|
|
199
|
-
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
|
200
|
-
t5 = () => {
|
|
201
|
-
setIsEditorFocused(false);
|
|
202
|
-
};
|
|
203
|
-
$[15] = t5;
|
|
204
|
-
} else t5 = $[15];
|
|
205
|
-
const handleBlur = t5;
|
|
206
|
-
let t6;
|
|
207
|
-
if ($[16] !== isContentEditable) {
|
|
208
|
-
t6 = () => {
|
|
209
|
-
if (isContentEditable) setIsHovered(true);
|
|
210
|
-
};
|
|
211
|
-
$[16] = isContentEditable;
|
|
212
|
-
$[17] = t6;
|
|
213
|
-
} else t6 = $[17];
|
|
214
|
-
const handleMouseEnter = t6;
|
|
215
|
-
let t7;
|
|
216
|
-
if ($[18] !== isContentEditable) {
|
|
217
|
-
t7 = () => {
|
|
218
|
-
if (isContentEditable) setIsHovered(false);
|
|
219
|
-
};
|
|
220
|
-
$[18] = isContentEditable;
|
|
221
|
-
$[19] = t7;
|
|
222
|
-
} else t7 = $[19];
|
|
223
|
-
const handleMouseLeave = t7;
|
|
108
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
109
|
+
t2 = { select: _temp };
|
|
110
|
+
$[2] = t2;
|
|
111
|
+
} else t2 = $[2];
|
|
112
|
+
const currentPathname = useLocation(t2);
|
|
113
|
+
const fieldValue = field.value;
|
|
224
114
|
const fieldData = { text: fieldValue };
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
if ($[20] !== currentPathname || $[21] !== fieldValue || $[22] !== linkStyle || $[23] !== pages || $[24] !== textStyle) {
|
|
228
|
-
t8 = () => markdownToReactNodes(fieldValue, {
|
|
115
|
+
if (!field.editable) {
|
|
116
|
+
const text = markdownToReactNodes(fieldValue, {
|
|
229
117
|
pages,
|
|
230
118
|
fallbackHref: currentPathname,
|
|
231
119
|
textStyle,
|
|
232
120
|
linkStyle
|
|
233
121
|
});
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
122
|
+
return /* @__PURE__ */ jsx(Fragment, { children: children({ children: text }, fieldData) });
|
|
123
|
+
}
|
|
124
|
+
const t3 = field.schema?.maxLength;
|
|
125
|
+
let t4;
|
|
126
|
+
if ($[3] !== field) {
|
|
127
|
+
t4 = () => {
|
|
128
|
+
setIsEditorFocused(true);
|
|
129
|
+
field.select();
|
|
130
|
+
};
|
|
131
|
+
$[3] = field;
|
|
132
|
+
$[4] = t4;
|
|
133
|
+
} else t4 = $[4];
|
|
134
|
+
let t5;
|
|
135
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
136
|
+
t5 = () => setIsEditorFocused(false);
|
|
137
|
+
$[5] = t5;
|
|
138
|
+
} else t5 = $[5];
|
|
139
|
+
let t6;
|
|
140
|
+
if ($[6] !== currentPathname || $[7] !== field.write || $[8] !== fieldValue || $[9] !== linkStyle || $[10] !== pages || $[11] !== t3 || $[12] !== t4 || $[13] !== textStyle) {
|
|
141
|
+
t6 = /* @__PURE__ */ jsx(InlineLexicalEditor, {
|
|
247
142
|
textStyle,
|
|
248
143
|
linkStyle,
|
|
249
144
|
pages,
|
|
250
145
|
fallbackHref: currentPathname,
|
|
251
146
|
initialState: fieldValue,
|
|
252
147
|
externalState: fieldValue,
|
|
253
|
-
maxLength:
|
|
254
|
-
onChange:
|
|
255
|
-
onFocus:
|
|
256
|
-
onBlur:
|
|
148
|
+
maxLength: t3,
|
|
149
|
+
onChange: field.write,
|
|
150
|
+
onFocus: t4,
|
|
151
|
+
onBlur: t5
|
|
257
152
|
});
|
|
258
|
-
$[
|
|
259
|
-
$[
|
|
260
|
-
$[
|
|
261
|
-
$[
|
|
262
|
-
$[
|
|
263
|
-
$[
|
|
264
|
-
$[
|
|
265
|
-
$[
|
|
266
|
-
$[
|
|
267
|
-
} else
|
|
268
|
-
const
|
|
153
|
+
$[6] = currentPathname;
|
|
154
|
+
$[7] = field.write;
|
|
155
|
+
$[8] = fieldValue;
|
|
156
|
+
$[9] = linkStyle;
|
|
157
|
+
$[10] = pages;
|
|
158
|
+
$[11] = t3;
|
|
159
|
+
$[12] = t4;
|
|
160
|
+
$[13] = textStyle;
|
|
161
|
+
$[14] = t6;
|
|
162
|
+
} else t6 = $[14];
|
|
163
|
+
const t7 = children({
|
|
269
164
|
ref: elementRef,
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
"data-camox-overlay-mode": reference ? "reference" : options.synced ? "synced" : void 0,
|
|
273
|
-
onMouseEnter: handleMouseEnter,
|
|
274
|
-
onMouseLeave: handleMouseLeave,
|
|
275
|
-
onClickCapture: selectField,
|
|
276
|
-
children: t10
|
|
165
|
+
...field.overlayProps,
|
|
166
|
+
children: t6
|
|
277
167
|
}, fieldData);
|
|
278
|
-
let
|
|
279
|
-
if ($[
|
|
280
|
-
|
|
281
|
-
$[
|
|
282
|
-
$[
|
|
283
|
-
} else
|
|
284
|
-
return
|
|
168
|
+
let t8;
|
|
169
|
+
if ($[15] !== t7) {
|
|
170
|
+
t8 = /* @__PURE__ */ jsx(Fragment, { children: t7 });
|
|
171
|
+
$[15] = t7;
|
|
172
|
+
$[16] = t8;
|
|
173
|
+
} else t8 = $[16];
|
|
174
|
+
return t8;
|
|
285
175
|
};
|
|
286
176
|
const Icon = (t0) => {
|
|
287
|
-
const $ = c(
|
|
177
|
+
const $ = c(18);
|
|
288
178
|
let name;
|
|
289
179
|
let props;
|
|
290
180
|
if ($[0] !== t0) {
|
|
@@ -296,178 +186,75 @@ function createEditableBlock(options) {
|
|
|
296
186
|
name = $[1];
|
|
297
187
|
props = $[2];
|
|
298
188
|
}
|
|
299
|
-
|
|
300
|
-
const
|
|
301
|
-
const
|
|
302
|
-
|
|
303
|
-
const editable = useIsEditable();
|
|
304
|
-
const fieldName = String(name);
|
|
305
|
-
const value = item ? item.itemContent[name] : block.content[name];
|
|
306
|
-
const t1 = item?.itemId;
|
|
189
|
+
useScope("Icon");
|
|
190
|
+
const field = useFieldSlot(String(name), "Icon");
|
|
191
|
+
const { overlayProps } = field;
|
|
192
|
+
const t1 = field.value;
|
|
307
193
|
let t2;
|
|
308
|
-
if ($[3] !==
|
|
309
|
-
t2 =
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
$[
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
const [isHovered, setIsHovered] = React.useState(false);
|
|
318
|
-
const isFocused = useFieldSelection(block.blockId, fieldName, "Icon", item?.itemId);
|
|
194
|
+
if ($[3] !== field.editable || $[4] !== overlayProps) {
|
|
195
|
+
t2 = field.editable ? {
|
|
196
|
+
...overlayProps,
|
|
197
|
+
"data-camox-field-type": "icon"
|
|
198
|
+
} : {};
|
|
199
|
+
$[3] = field.editable;
|
|
200
|
+
$[4] = overlayProps;
|
|
201
|
+
$[5] = t2;
|
|
202
|
+
} else t2 = $[5];
|
|
319
203
|
let t3;
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
} else t3 = $[8];
|
|
325
|
-
const isHoveredFromSidebar = useOverlayMessage(iframeWindow, editable, "CAMOX_HOVER_FIELD", "CAMOX_HOVER_FIELD_END", t3);
|
|
326
|
-
const overlayState = useOverlayState(isHovered || isHoveredFromSidebar, isFocused);
|
|
327
|
-
const t4 = editable ? fieldId : void 0;
|
|
328
|
-
const t5 = editable ? "icon" : void 0;
|
|
329
|
-
let t6;
|
|
330
|
-
if ($[9] !== editable || $[10] !== overlayState) {
|
|
331
|
-
t6 = editable ? overlayState : {};
|
|
332
|
-
$[9] = editable;
|
|
333
|
-
$[10] = overlayState;
|
|
334
|
-
$[11] = t6;
|
|
335
|
-
} else t6 = $[11];
|
|
336
|
-
const t7 = editable && options.synced ? "synced" : void 0;
|
|
337
|
-
let t8;
|
|
338
|
-
let t9;
|
|
339
|
-
if ($[12] !== editable || $[13] !== props) {
|
|
340
|
-
t8 = (event) => {
|
|
341
|
-
if (editable) setIsHovered(true);
|
|
204
|
+
let t4;
|
|
205
|
+
if ($[6] !== field.editable || $[7] !== overlayProps || $[8] !== props) {
|
|
206
|
+
t3 = (event) => {
|
|
207
|
+
if (field.editable) overlayProps.onMouseEnter();
|
|
342
208
|
props.onMouseEnter?.(event);
|
|
343
209
|
};
|
|
344
|
-
|
|
345
|
-
if (editable)
|
|
210
|
+
t4 = (event_0) => {
|
|
211
|
+
if (field.editable) overlayProps.onMouseLeave();
|
|
346
212
|
props.onMouseLeave?.(event_0);
|
|
347
213
|
};
|
|
348
|
-
$[
|
|
349
|
-
$[
|
|
350
|
-
$[
|
|
351
|
-
$[
|
|
214
|
+
$[6] = field.editable;
|
|
215
|
+
$[7] = overlayProps;
|
|
216
|
+
$[8] = props;
|
|
217
|
+
$[9] = t3;
|
|
218
|
+
$[10] = t4;
|
|
352
219
|
} else {
|
|
353
|
-
|
|
354
|
-
|
|
220
|
+
t3 = $[9];
|
|
221
|
+
t4 = $[10];
|
|
355
222
|
}
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
blockId: block.blockId,
|
|
361
|
-
itemId: item.itemId,
|
|
362
|
-
fieldName,
|
|
363
|
-
fieldType: "Icon"
|
|
364
|
-
} : {
|
|
365
|
-
type: "block-field",
|
|
366
|
-
blockId: block.blockId,
|
|
367
|
-
fieldName,
|
|
368
|
-
fieldType: "Icon"
|
|
369
|
-
}) : props.onClickCapture;
|
|
370
|
-
$[16] = block.blockId;
|
|
371
|
-
$[17] = editable;
|
|
372
|
-
$[18] = fieldName;
|
|
373
|
-
$[19] = item;
|
|
374
|
-
$[20] = props.onClickCapture;
|
|
375
|
-
$[21] = selectTarget;
|
|
376
|
-
$[22] = t10;
|
|
377
|
-
} else t10 = $[22];
|
|
378
|
-
let t11;
|
|
379
|
-
if ($[23] !== props || $[24] !== t10 || $[25] !== t4 || $[26] !== t5 || $[27] !== t6 || $[28] !== t7 || $[29] !== t8 || $[30] !== t9 || $[31] !== value) {
|
|
380
|
-
t11 = /* @__PURE__ */ jsx(IconSvg, {
|
|
223
|
+
const t5 = field.editable ? overlayProps.onClickCapture : props.onClickCapture;
|
|
224
|
+
let t6;
|
|
225
|
+
if ($[11] !== props || $[12] !== t1 || $[13] !== t2 || $[14] !== t3 || $[15] !== t4 || $[16] !== t5) {
|
|
226
|
+
t6 = /* @__PURE__ */ jsx(IconSvg, {
|
|
381
227
|
...props,
|
|
382
|
-
iconId:
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
onMouseEnter: t8,
|
|
388
|
-
onMouseLeave: t9,
|
|
389
|
-
onClickCapture: t10
|
|
228
|
+
iconId: t1,
|
|
229
|
+
...t2,
|
|
230
|
+
onMouseEnter: t3,
|
|
231
|
+
onMouseLeave: t4,
|
|
232
|
+
onClickCapture: t5
|
|
390
233
|
});
|
|
391
|
-
$[
|
|
392
|
-
$[
|
|
393
|
-
$[
|
|
394
|
-
$[
|
|
395
|
-
$[
|
|
396
|
-
$[
|
|
397
|
-
$[
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
$[32] = t11;
|
|
401
|
-
} else t11 = $[32];
|
|
402
|
-
return t11;
|
|
234
|
+
$[11] = props;
|
|
235
|
+
$[12] = t1;
|
|
236
|
+
$[13] = t2;
|
|
237
|
+
$[14] = t3;
|
|
238
|
+
$[15] = t4;
|
|
239
|
+
$[16] = t5;
|
|
240
|
+
$[17] = t6;
|
|
241
|
+
} else t6 = $[17];
|
|
242
|
+
return t6;
|
|
403
243
|
};
|
|
404
244
|
const Embed = (t0) => {
|
|
405
|
-
const $ = c(
|
|
245
|
+
const $ = c(14);
|
|
406
246
|
const { name, children } = t0;
|
|
407
|
-
|
|
408
|
-
const
|
|
409
|
-
|
|
410
|
-
const { blockId, content } = blockContext;
|
|
411
|
-
const isContentEditable = useIsEditable();
|
|
247
|
+
useScope("Embed");
|
|
248
|
+
const field = useFieldSlot(String(name), "Embed");
|
|
249
|
+
const { editable, select } = field;
|
|
412
250
|
const { window: iframeWindow } = useFrame();
|
|
413
|
-
const
|
|
414
|
-
const fieldValue = repeaterContext ? repeaterContext.itemContent[name] : content[name];
|
|
415
|
-
const reference = React.use(ReferenceContext);
|
|
416
|
-
const t1 = String(name);
|
|
417
|
-
const t2 = repeaterContext?.itemId;
|
|
418
|
-
let t3;
|
|
419
|
-
if ($[0] !== blockId || $[1] !== reference || $[2] !== t1 || $[3] !== t2) {
|
|
420
|
-
t3 = getOverlayFieldId(blockId, t1, {
|
|
421
|
-
itemId: t2,
|
|
422
|
-
reference
|
|
423
|
-
});
|
|
424
|
-
$[0] = blockId;
|
|
425
|
-
$[1] = reference;
|
|
426
|
-
$[2] = t1;
|
|
427
|
-
$[3] = t2;
|
|
428
|
-
$[4] = t3;
|
|
429
|
-
} else t3 = $[4];
|
|
430
|
-
const fieldId = t3;
|
|
431
|
-
const [isHovered, setIsHovered] = React.useState(false);
|
|
432
|
-
const isRecordFieldSelected = useRecordSelection(reference?.placement ?? null, String(name));
|
|
433
|
-
const overlayState = useOverlayState(isHovered, reference != null && isRecordFieldSelected);
|
|
251
|
+
const fieldValue = field.value;
|
|
434
252
|
const embedRef = React.useRef(null);
|
|
435
|
-
|
|
436
|
-
let
|
|
437
|
-
if ($[
|
|
438
|
-
|
|
439
|
-
if (!
|
|
440
|
-
if (reference) {
|
|
441
|
-
reference.selectRecordField(String(name), "Embed");
|
|
442
|
-
return;
|
|
443
|
-
}
|
|
444
|
-
selectTarget(itemId != null ? {
|
|
445
|
-
type: "item-field",
|
|
446
|
-
blockId,
|
|
447
|
-
itemId,
|
|
448
|
-
fieldName: String(name),
|
|
449
|
-
fieldType: "Embed"
|
|
450
|
-
} : {
|
|
451
|
-
type: "block-field",
|
|
452
|
-
blockId,
|
|
453
|
-
fieldName: String(name),
|
|
454
|
-
fieldType: "Embed"
|
|
455
|
-
});
|
|
456
|
-
};
|
|
457
|
-
$[5] = blockId;
|
|
458
|
-
$[6] = isContentEditable;
|
|
459
|
-
$[7] = itemId;
|
|
460
|
-
$[8] = name;
|
|
461
|
-
$[9] = reference;
|
|
462
|
-
$[10] = selectTarget;
|
|
463
|
-
$[11] = t4;
|
|
464
|
-
} else t4 = $[11];
|
|
465
|
-
const selectField = t4;
|
|
466
|
-
let t5;
|
|
467
|
-
let t6;
|
|
468
|
-
if ($[12] !== iframeWindow || $[13] !== isContentEditable || $[14] !== selectField) {
|
|
469
|
-
t5 = () => {
|
|
470
|
-
if (!isContentEditable || !iframeWindow) return;
|
|
253
|
+
let t1;
|
|
254
|
+
let t2;
|
|
255
|
+
if ($[0] !== editable || $[1] !== iframeWindow || $[2] !== select) {
|
|
256
|
+
t1 = () => {
|
|
257
|
+
if (!editable || !iframeWindow) return;
|
|
471
258
|
let timer;
|
|
472
259
|
const handleBlur = () => {
|
|
473
260
|
iframeWindow.clearTimeout(timer);
|
|
@@ -475,7 +262,7 @@ function createEditableBlock(options) {
|
|
|
475
262
|
const activeElement = iframeWindow.document.activeElement;
|
|
476
263
|
if (activeElement?.tagName !== "IFRAME") return;
|
|
477
264
|
if (!embedRef.current?.contains(activeElement)) return;
|
|
478
|
-
|
|
265
|
+
select();
|
|
479
266
|
}, 0);
|
|
480
267
|
};
|
|
481
268
|
iframeWindow.addEventListener("blur", handleBlur);
|
|
@@ -484,219 +271,125 @@ function createEditableBlock(options) {
|
|
|
484
271
|
iframeWindow.removeEventListener("blur", handleBlur);
|
|
485
272
|
};
|
|
486
273
|
};
|
|
487
|
-
|
|
488
|
-
|
|
274
|
+
t2 = [
|
|
275
|
+
editable,
|
|
489
276
|
iframeWindow,
|
|
490
|
-
|
|
277
|
+
select
|
|
491
278
|
];
|
|
492
|
-
$[
|
|
493
|
-
$[
|
|
494
|
-
$[
|
|
495
|
-
$[
|
|
496
|
-
$[
|
|
279
|
+
$[0] = editable;
|
|
280
|
+
$[1] = iframeWindow;
|
|
281
|
+
$[2] = select;
|
|
282
|
+
$[3] = t1;
|
|
283
|
+
$[4] = t2;
|
|
497
284
|
} else {
|
|
498
|
-
|
|
499
|
-
|
|
285
|
+
t1 = $[3];
|
|
286
|
+
t2 = $[4];
|
|
500
287
|
}
|
|
501
|
-
React.useEffect(
|
|
502
|
-
let
|
|
503
|
-
if ($[
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
} else t10 = $[21];
|
|
523
|
-
let t11;
|
|
524
|
-
if ($[22] !== reference) {
|
|
525
|
-
t11 = assetOverlayMode(reference);
|
|
526
|
-
$[22] = reference;
|
|
527
|
-
$[23] = t11;
|
|
528
|
-
} else t11 = $[23];
|
|
529
|
-
let t12;
|
|
530
|
-
if ($[24] !== isContentEditable) {
|
|
531
|
-
t12 = isContentEditable ? () => setIsHovered(true) : void 0;
|
|
532
|
-
$[24] = isContentEditable;
|
|
533
|
-
$[25] = t12;
|
|
534
|
-
} else t12 = $[25];
|
|
535
|
-
let t13;
|
|
536
|
-
if ($[26] !== isContentEditable) {
|
|
537
|
-
t13 = isContentEditable ? () => setIsHovered(false) : void 0;
|
|
538
|
-
$[26] = isContentEditable;
|
|
539
|
-
$[27] = t13;
|
|
540
|
-
} else t13 = $[27];
|
|
541
|
-
let t14;
|
|
542
|
-
if ($[28] !== children || $[29] !== fieldValue) {
|
|
543
|
-
t14 = children({ src: fieldValue }, { url: fieldValue });
|
|
544
|
-
$[28] = children;
|
|
545
|
-
$[29] = fieldValue;
|
|
546
|
-
$[30] = t14;
|
|
547
|
-
} else t14 = $[30];
|
|
548
|
-
let t15;
|
|
549
|
-
if ($[31] !== selectField || $[32] !== t10 || $[33] !== t11 || $[34] !== t12 || $[35] !== t13 || $[36] !== t14 || $[37] !== t8 || $[38] !== t9) {
|
|
550
|
-
t15 = /* @__PURE__ */ jsx("div", {
|
|
288
|
+
React.useEffect(t1, t2);
|
|
289
|
+
let t3;
|
|
290
|
+
if ($[5] !== editable || $[6] !== field.overlayProps) {
|
|
291
|
+
t3 = editable ? {
|
|
292
|
+
...field.overlayProps,
|
|
293
|
+
"data-camox-field-type": "embed"
|
|
294
|
+
} : {};
|
|
295
|
+
$[5] = editable;
|
|
296
|
+
$[6] = field.overlayProps;
|
|
297
|
+
$[7] = t3;
|
|
298
|
+
} else t3 = $[7];
|
|
299
|
+
let t4;
|
|
300
|
+
if ($[8] !== children || $[9] !== fieldValue) {
|
|
301
|
+
t4 = children({ src: fieldValue }, { url: fieldValue });
|
|
302
|
+
$[8] = children;
|
|
303
|
+
$[9] = fieldValue;
|
|
304
|
+
$[10] = t4;
|
|
305
|
+
} else t4 = $[10];
|
|
306
|
+
let t5;
|
|
307
|
+
if ($[11] !== t3 || $[12] !== t4) {
|
|
308
|
+
t5 = /* @__PURE__ */ jsx("div", {
|
|
551
309
|
ref: embedRef,
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
"data-camox-field-type": t9,
|
|
555
|
-
...t10,
|
|
556
|
-
"data-camox-overlay-mode": t11,
|
|
557
|
-
onMouseEnter: t12,
|
|
558
|
-
onMouseLeave: t13,
|
|
559
|
-
children: t14
|
|
310
|
+
...t3,
|
|
311
|
+
children: t4
|
|
560
312
|
});
|
|
561
|
-
$[
|
|
562
|
-
$[
|
|
563
|
-
$[
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
$[36] = t14;
|
|
567
|
-
$[37] = t8;
|
|
568
|
-
$[38] = t9;
|
|
569
|
-
$[39] = t15;
|
|
570
|
-
} else t15 = $[39];
|
|
571
|
-
return t15;
|
|
313
|
+
$[11] = t3;
|
|
314
|
+
$[12] = t4;
|
|
315
|
+
$[13] = t5;
|
|
316
|
+
} else t5 = $[13];
|
|
317
|
+
return t5;
|
|
572
318
|
};
|
|
573
319
|
const Artifact = (t0) => {
|
|
574
|
-
const $ = c(
|
|
320
|
+
const $ = c(31);
|
|
575
321
|
const { name, children } = t0;
|
|
576
|
-
const
|
|
577
|
-
const
|
|
578
|
-
|
|
579
|
-
const
|
|
580
|
-
const isContentEditable = useIsEditable();
|
|
581
|
-
const { window: iframeWindow } = useFrame();
|
|
582
|
-
const repeaterContext = React.use(RepeatableItemContext);
|
|
583
|
-
const value = repeaterContext ? repeaterContext.itemContent[name] : content[name];
|
|
584
|
-
const itemId = repeaterContext?.itemId;
|
|
585
|
-
const fieldName = String(name);
|
|
586
|
-
let t1;
|
|
587
|
-
if ($[0] !== blockId || $[1] !== fieldName || $[2] !== itemId) {
|
|
588
|
-
t1 = getOverlayFieldId(blockId, fieldName, { itemId });
|
|
589
|
-
$[0] = blockId;
|
|
590
|
-
$[1] = fieldName;
|
|
591
|
-
$[2] = itemId;
|
|
592
|
-
$[3] = t1;
|
|
593
|
-
} else t1 = $[3];
|
|
594
|
-
const fieldId = t1;
|
|
595
|
-
const [isHovered, setIsHovered] = React.useState(false);
|
|
596
|
-
let t2;
|
|
597
|
-
if ($[4] !== fieldId) {
|
|
598
|
-
t2 = { fieldId };
|
|
599
|
-
$[4] = fieldId;
|
|
600
|
-
$[5] = t2;
|
|
601
|
-
} else t2 = $[5];
|
|
602
|
-
const isHoveredFromSidebar = useOverlayMessage(iframeWindow, isContentEditable, "CAMOX_HOVER_FIELD", "CAMOX_HOVER_FIELD_END", t2);
|
|
603
|
-
const isFocused = useFieldSelection(blockId, fieldName, "Artifact", itemId);
|
|
604
|
-
const overlayState = useOverlayState(isHovered || isHoveredFromSidebar, isFocused);
|
|
605
|
-
let t3;
|
|
606
|
-
if ($[6] !== blockId || $[7] !== fieldName || $[8] !== itemId || $[9] !== selectTarget) {
|
|
607
|
-
t3 = () => {
|
|
608
|
-
selectTarget(itemId != null ? {
|
|
609
|
-
type: "item-field",
|
|
610
|
-
blockId,
|
|
611
|
-
itemId,
|
|
612
|
-
fieldName,
|
|
613
|
-
fieldType: "Artifact"
|
|
614
|
-
} : {
|
|
615
|
-
type: "block-field",
|
|
616
|
-
blockId,
|
|
617
|
-
fieldName,
|
|
618
|
-
fieldType: "Artifact"
|
|
619
|
-
});
|
|
620
|
-
};
|
|
621
|
-
$[6] = blockId;
|
|
622
|
-
$[7] = fieldName;
|
|
623
|
-
$[8] = itemId;
|
|
624
|
-
$[9] = selectTarget;
|
|
625
|
-
$[10] = t3;
|
|
626
|
-
} else t3 = $[10];
|
|
627
|
-
const selectField = t3;
|
|
322
|
+
const scope = useScope("Artifact");
|
|
323
|
+
const field = useFieldSlot(String(name), "Artifact");
|
|
324
|
+
const { editable } = field;
|
|
325
|
+
const value = field.value;
|
|
628
326
|
const { filesMap } = useNormalizedData();
|
|
629
327
|
const pages = useEditorLinkPages();
|
|
630
|
-
let
|
|
631
|
-
if ($[
|
|
632
|
-
|
|
633
|
-
$[
|
|
634
|
-
} else
|
|
635
|
-
const currentPathname = useLocation(
|
|
636
|
-
let
|
|
637
|
-
if ($[
|
|
638
|
-
let
|
|
639
|
-
if ($[
|
|
640
|
-
|
|
641
|
-
$[
|
|
642
|
-
$[
|
|
643
|
-
$[
|
|
644
|
-
} else
|
|
645
|
-
let
|
|
646
|
-
if ($[
|
|
647
|
-
|
|
648
|
-
$[
|
|
649
|
-
$[
|
|
650
|
-
} else
|
|
651
|
-
|
|
652
|
-
content:
|
|
653
|
-
settings:
|
|
654
|
-
} : {
|
|
655
|
-
content,
|
|
656
|
-
settings: blockContext.settings
|
|
328
|
+
let t1;
|
|
329
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
330
|
+
t1 = { select: _temp2 };
|
|
331
|
+
$[0] = t1;
|
|
332
|
+
} else t1 = $[0];
|
|
333
|
+
const currentPathname = useLocation(t1);
|
|
334
|
+
let t2;
|
|
335
|
+
if ($[1] !== currentPathname || $[2] !== field.schema || $[3] !== filesMap || $[4] !== pages || $[5] !== scope.content || $[6] !== scope.settings) {
|
|
336
|
+
let t3;
|
|
337
|
+
if ($[8] !== currentPathname || $[9] !== pages) {
|
|
338
|
+
t3 = (link) => resolveLinkHref(normalizeLinkValue(link), pages, currentPathname);
|
|
339
|
+
$[8] = currentPathname;
|
|
340
|
+
$[9] = pages;
|
|
341
|
+
$[10] = t3;
|
|
342
|
+
} else t3 = $[10];
|
|
343
|
+
let t4;
|
|
344
|
+
if ($[11] !== filesMap) {
|
|
345
|
+
t4 = (asset) => resolveAssetValue(asset, filesMap);
|
|
346
|
+
$[11] = filesMap;
|
|
347
|
+
$[12] = t4;
|
|
348
|
+
} else t4 = $[12];
|
|
349
|
+
t2 = artifactData(field.schema, {
|
|
350
|
+
content: scope.content,
|
|
351
|
+
settings: scope.settings
|
|
657
352
|
}, {
|
|
658
|
-
linkHref:
|
|
659
|
-
asset:
|
|
353
|
+
linkHref: t3,
|
|
354
|
+
asset: t4
|
|
660
355
|
});
|
|
661
|
-
$[
|
|
662
|
-
$[
|
|
663
|
-
$[
|
|
664
|
-
$[
|
|
665
|
-
$[
|
|
666
|
-
$[
|
|
667
|
-
$[
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
const data = t5;
|
|
356
|
+
$[1] = currentPathname;
|
|
357
|
+
$[2] = field.schema;
|
|
358
|
+
$[3] = filesMap;
|
|
359
|
+
$[4] = pages;
|
|
360
|
+
$[5] = scope.content;
|
|
361
|
+
$[6] = scope.settings;
|
|
362
|
+
$[7] = t2;
|
|
363
|
+
} else t2 = $[7];
|
|
364
|
+
const data = t2;
|
|
671
365
|
const canvas = React.use(CanvasWorkspaceContext) !== null;
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
editing: isContentEditable,
|
|
366
|
+
let t3;
|
|
367
|
+
if ($[13] !== canvas || $[14] !== editable) {
|
|
368
|
+
t3 = {
|
|
369
|
+
editing: editable,
|
|
677
370
|
canvas
|
|
678
371
|
};
|
|
679
|
-
$[
|
|
680
|
-
$[
|
|
681
|
-
$[
|
|
682
|
-
} else
|
|
683
|
-
const
|
|
684
|
-
const
|
|
685
|
-
let
|
|
686
|
-
if ($[
|
|
687
|
-
|
|
688
|
-
studio:
|
|
372
|
+
$[13] = canvas;
|
|
373
|
+
$[14] = editable;
|
|
374
|
+
$[15] = t3;
|
|
375
|
+
} else t3 = $[15];
|
|
376
|
+
const t4 = field.schema?.size;
|
|
377
|
+
const t5 = useNavigate();
|
|
378
|
+
let t6;
|
|
379
|
+
if ($[16] !== data || $[17] !== t3 || $[18] !== t4 || $[19] !== t5) {
|
|
380
|
+
t6 = {
|
|
381
|
+
studio: t3,
|
|
689
382
|
data,
|
|
690
|
-
size:
|
|
691
|
-
navigate:
|
|
383
|
+
size: t4,
|
|
384
|
+
navigate: t5
|
|
692
385
|
};
|
|
693
|
-
$[
|
|
694
|
-
$[
|
|
695
|
-
$[
|
|
696
|
-
$[
|
|
697
|
-
$[
|
|
698
|
-
} else
|
|
699
|
-
const hostProps = useArtifactHost(
|
|
386
|
+
$[16] = data;
|
|
387
|
+
$[17] = t3;
|
|
388
|
+
$[18] = t4;
|
|
389
|
+
$[19] = t5;
|
|
390
|
+
$[20] = t6;
|
|
391
|
+
} else t6 = $[20];
|
|
392
|
+
const hostProps = useArtifactHost(t6);
|
|
700
393
|
const initialData = useInitialArtifactData(value, data);
|
|
701
394
|
const fontLinks = useOptionalCamoxApp()?.getArtifactFontLinks();
|
|
702
395
|
const runs = React.use(ArtifactsRunContext);
|
|
@@ -707,44 +400,27 @@ function createEditableBlock(options) {
|
|
|
707
400
|
}) : artifactStandInProps(value),
|
|
708
401
|
...hostProps
|
|
709
402
|
});
|
|
710
|
-
let
|
|
711
|
-
if ($[
|
|
712
|
-
|
|
403
|
+
let t7;
|
|
404
|
+
if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
|
|
405
|
+
t7 = {
|
|
713
406
|
position: "relative",
|
|
714
407
|
height: "100%"
|
|
715
408
|
};
|
|
716
|
-
$[
|
|
717
|
-
} else
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
$[
|
|
725
|
-
$[
|
|
726
|
-
$[
|
|
727
|
-
} else
|
|
728
|
-
let
|
|
729
|
-
if ($[
|
|
730
|
-
|
|
731
|
-
$[37] = t15;
|
|
732
|
-
} else t15 = $[37];
|
|
733
|
-
let t16;
|
|
734
|
-
if ($[38] !== isContentEditable) {
|
|
735
|
-
t16 = isContentEditable ? () => setIsHovered(true) : void 0;
|
|
736
|
-
$[38] = isContentEditable;
|
|
737
|
-
$[39] = t16;
|
|
738
|
-
} else t16 = $[39];
|
|
739
|
-
let t17;
|
|
740
|
-
if ($[40] !== isContentEditable) {
|
|
741
|
-
t17 = isContentEditable ? () => setIsHovered(false) : void 0;
|
|
742
|
-
$[40] = isContentEditable;
|
|
743
|
-
$[41] = t17;
|
|
744
|
-
} else t17 = $[41];
|
|
745
|
-
let t18;
|
|
746
|
-
if ($[42] !== isContentEditable) {
|
|
747
|
-
t18 = isContentEditable && /* @__PURE__ */ jsx("div", {
|
|
409
|
+
$[21] = t7;
|
|
410
|
+
} else t7 = $[21];
|
|
411
|
+
let t8;
|
|
412
|
+
if ($[22] !== editable || $[23] !== field.overlayProps) {
|
|
413
|
+
t8 = editable ? {
|
|
414
|
+
...field.overlayProps,
|
|
415
|
+
"data-camox-field-type": "artifact"
|
|
416
|
+
} : {};
|
|
417
|
+
$[22] = editable;
|
|
418
|
+
$[23] = field.overlayProps;
|
|
419
|
+
$[24] = t8;
|
|
420
|
+
} else t8 = $[24];
|
|
421
|
+
let t9;
|
|
422
|
+
if ($[25] !== editable) {
|
|
423
|
+
t9 = editable && /* @__PURE__ */ jsx("div", {
|
|
748
424
|
"aria-hidden": true,
|
|
749
425
|
"data-camox-artifact-layer": "",
|
|
750
426
|
style: {
|
|
@@ -753,63 +429,46 @@ function createEditableBlock(options) {
|
|
|
753
429
|
cursor: "default"
|
|
754
430
|
}
|
|
755
431
|
});
|
|
756
|
-
$[
|
|
757
|
-
$[
|
|
758
|
-
} else
|
|
759
|
-
let
|
|
760
|
-
if ($[
|
|
761
|
-
|
|
762
|
-
style:
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
"data-camox-field-type": t13,
|
|
766
|
-
...t14,
|
|
767
|
-
"data-camox-overlay-mode": t15,
|
|
768
|
-
onMouseEnter: t16,
|
|
769
|
-
onMouseLeave: t17,
|
|
770
|
-
children: [frame, t18]
|
|
432
|
+
$[25] = editable;
|
|
433
|
+
$[26] = t9;
|
|
434
|
+
} else t9 = $[26];
|
|
435
|
+
let t10;
|
|
436
|
+
if ($[27] !== frame || $[28] !== t8 || $[29] !== t9) {
|
|
437
|
+
t10 = /* @__PURE__ */ jsxs("div", {
|
|
438
|
+
style: t7,
|
|
439
|
+
...t8,
|
|
440
|
+
children: [frame, t9]
|
|
771
441
|
});
|
|
772
|
-
$[
|
|
773
|
-
$[
|
|
774
|
-
$[
|
|
775
|
-
$[
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
$[50] = t17;
|
|
779
|
-
$[51] = t18;
|
|
780
|
-
$[52] = t19;
|
|
781
|
-
} else t19 = $[52];
|
|
782
|
-
return t19;
|
|
442
|
+
$[27] = frame;
|
|
443
|
+
$[28] = t8;
|
|
444
|
+
$[29] = t9;
|
|
445
|
+
$[30] = t10;
|
|
446
|
+
} else t10 = $[30];
|
|
447
|
+
return t10;
|
|
783
448
|
};
|
|
784
449
|
const Link = (t0) => {
|
|
785
|
-
const $ = c(
|
|
450
|
+
const $ = c(8);
|
|
786
451
|
const { name, children } = t0;
|
|
787
|
-
|
|
788
|
-
const
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
452
|
+
useScope("Link");
|
|
453
|
+
const [isEditing, setIsEditing] = React.useState(false);
|
|
454
|
+
let t1;
|
|
455
|
+
if ($[0] !== isEditing) {
|
|
456
|
+
t1 = { editing: isEditing };
|
|
457
|
+
$[0] = isEditing;
|
|
458
|
+
$[1] = t1;
|
|
459
|
+
} else t1 = $[1];
|
|
460
|
+
const field = useFieldSlot(String(name), "Link", t1);
|
|
792
461
|
const elementRef = React.useRef(null);
|
|
793
|
-
const
|
|
794
|
-
const repeaterContext = React.use(RepeatableItemContext);
|
|
795
|
-
const rawFieldValue = repeaterContext ? repeaterContext.itemContent[name] : content[name];
|
|
796
|
-
const fieldValue = normalizeLinkValue(rawFieldValue);
|
|
797
|
-
const applyEdit = useApplyContentEdit();
|
|
462
|
+
const fieldValue = normalizeLinkValue(field.value);
|
|
798
463
|
const pages = useEditorLinkPages();
|
|
799
|
-
let
|
|
800
|
-
if ($[
|
|
801
|
-
|
|
802
|
-
$[
|
|
803
|
-
} else
|
|
804
|
-
const currentPathname = useLocation(
|
|
464
|
+
let t2;
|
|
465
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
466
|
+
t2 = { select: _temp3 };
|
|
467
|
+
$[2] = t2;
|
|
468
|
+
} else t2 = $[2];
|
|
469
|
+
const currentPathname = useLocation(t2);
|
|
805
470
|
const resolvedHref = resolveLinkHref(fieldValue, pages, currentPathname);
|
|
806
|
-
const fieldId = getOverlayFieldId(blockId, String(name), { itemId: repeaterContext?.itemId });
|
|
807
|
-
const [isEditing, setIsEditing] = React.useState(false);
|
|
808
471
|
const [displayText, setDisplayText] = React.useState(fieldValue.text);
|
|
809
|
-
const [isHovered, setIsHovered] = React.useState(false);
|
|
810
|
-
const [isEditorFocused, setIsEditorFocused] = React.useState(false);
|
|
811
|
-
const isSelectedFromSelection = useFieldSelection(blockId, String(name), "Link", repeaterContext?.itemId);
|
|
812
|
-
const overlayState = useOverlayState(isHovered, isEditorFocused || isSelectedFromSelection);
|
|
813
472
|
const [syncedText, setSyncedText] = React.useState({
|
|
814
473
|
text: fieldValue.text,
|
|
815
474
|
isEditing
|
|
@@ -821,355 +480,188 @@ function createEditableBlock(options) {
|
|
|
821
480
|
});
|
|
822
481
|
if (!isEditing) setDisplayText(fieldValue.text);
|
|
823
482
|
}
|
|
824
|
-
const isHoveredFromSidebar = useOverlayMessage(iframeWindow, isContentEditable, "CAMOX_HOVER_FIELD", "CAMOX_HOVER_FIELD_END", { fieldId });
|
|
825
|
-
const [prevSidebarHover, setPrevSidebarHover] = React.useState(isHoveredFromSidebar);
|
|
826
|
-
if (prevSidebarHover !== isHoveredFromSidebar) {
|
|
827
|
-
setPrevSidebarHover(isHoveredFromSidebar);
|
|
828
|
-
setIsHovered(isHoveredFromSidebar);
|
|
829
|
-
}
|
|
830
|
-
let t2;
|
|
831
|
-
if ($[1] !== applyEdit || $[2] !== blockId || $[3] !== name || $[4] !== repeaterContext?.itemId) {
|
|
832
|
-
t2 = (newLinkValue) => {
|
|
833
|
-
const content_0 = { [name]: newLinkValue };
|
|
834
|
-
const itemId = repeaterContext?.itemId;
|
|
835
|
-
applyEdit(itemId != null ? {
|
|
836
|
-
type: "itemContent",
|
|
837
|
-
itemId,
|
|
838
|
-
content: content_0
|
|
839
|
-
} : {
|
|
840
|
-
type: "blockContent",
|
|
841
|
-
blockId,
|
|
842
|
-
content: content_0
|
|
843
|
-
}).catch(ignore);
|
|
844
|
-
};
|
|
845
|
-
$[1] = applyEdit;
|
|
846
|
-
$[2] = blockId;
|
|
847
|
-
$[3] = name;
|
|
848
|
-
$[4] = repeaterContext?.itemId;
|
|
849
|
-
$[5] = t2;
|
|
850
|
-
} else t2 = $[5];
|
|
851
|
-
const saveLinkValue = t2;
|
|
852
483
|
const handleInput = (e) => {
|
|
853
484
|
const newText = e.target.textContent || "";
|
|
854
|
-
|
|
485
|
+
field.write({
|
|
855
486
|
...fieldValue,
|
|
856
487
|
text: newText
|
|
857
488
|
});
|
|
858
489
|
};
|
|
859
|
-
let t3;
|
|
860
|
-
if ($[6] !== blockId || $[7] !== name || $[8] !== repeaterContext || $[9] !== selectTarget) {
|
|
861
|
-
t3 = () => {
|
|
862
|
-
selectTarget(repeaterContext?.itemId != null ? {
|
|
863
|
-
type: "item-field",
|
|
864
|
-
blockId,
|
|
865
|
-
itemId: repeaterContext.itemId,
|
|
866
|
-
fieldName: String(name),
|
|
867
|
-
fieldType: "Link"
|
|
868
|
-
} : {
|
|
869
|
-
type: "block-field",
|
|
870
|
-
blockId,
|
|
871
|
-
fieldName: String(name),
|
|
872
|
-
fieldType: "Link"
|
|
873
|
-
});
|
|
874
|
-
};
|
|
875
|
-
$[6] = blockId;
|
|
876
|
-
$[7] = name;
|
|
877
|
-
$[8] = repeaterContext;
|
|
878
|
-
$[9] = selectTarget;
|
|
879
|
-
$[10] = t3;
|
|
880
|
-
} else t3 = $[10];
|
|
881
|
-
const selectField = t3;
|
|
882
|
-
let t4;
|
|
883
|
-
if ($[11] !== selectField) {
|
|
884
|
-
t4 = () => {
|
|
885
|
-
setIsEditing(true);
|
|
886
|
-
setIsEditorFocused(true);
|
|
887
|
-
selectField();
|
|
888
|
-
};
|
|
889
|
-
$[11] = selectField;
|
|
890
|
-
$[12] = t4;
|
|
891
|
-
} else t4 = $[12];
|
|
892
|
-
const handleFocus = t4;
|
|
893
|
-
let t5;
|
|
894
|
-
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
895
|
-
t5 = () => {
|
|
896
|
-
setIsEditing(false);
|
|
897
|
-
setIsEditorFocused(false);
|
|
898
|
-
};
|
|
899
|
-
$[13] = t5;
|
|
900
|
-
} else t5 = $[13];
|
|
901
|
-
const handleBlur = t5;
|
|
902
490
|
const linkData = {
|
|
903
491
|
text: displayText,
|
|
904
492
|
href: resolvedHref,
|
|
905
493
|
newTab: fieldValue.newTab
|
|
906
494
|
};
|
|
907
|
-
if (!
|
|
495
|
+
if (!field.editable) return /* @__PURE__ */ jsx(Fragment, { children: children({
|
|
908
496
|
to: resolvedHref,
|
|
909
497
|
target: fieldValue.newTab ? "_blank" : void 0,
|
|
910
498
|
rel: fieldValue.newTab ? "noreferrer" : void 0,
|
|
911
499
|
children: fieldValue.text
|
|
912
500
|
}, linkData) });
|
|
913
|
-
let
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
$[
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
501
|
+
let t3;
|
|
502
|
+
if ($[3] !== field) {
|
|
503
|
+
t3 = () => {
|
|
504
|
+
setIsEditing(true);
|
|
505
|
+
field.select();
|
|
506
|
+
};
|
|
507
|
+
$[3] = field;
|
|
508
|
+
$[4] = t3;
|
|
509
|
+
} else t3 = $[4];
|
|
510
|
+
let t4;
|
|
511
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
512
|
+
t4 = () => setIsEditing(false);
|
|
513
|
+
$[5] = t4;
|
|
514
|
+
} else t4 = $[5];
|
|
515
|
+
const t5 = children({
|
|
925
516
|
ref: elementRef,
|
|
926
517
|
to: resolvedHref,
|
|
927
518
|
target: fieldValue.newTab ? "_blank" : void 0,
|
|
928
519
|
rel: fieldValue.newTab ? "noreferrer" : void 0,
|
|
929
520
|
children: displayText,
|
|
930
|
-
|
|
931
|
-
...overlayState,
|
|
932
|
-
"data-camox-overlay-mode": options.synced ? "synced" : void 0,
|
|
521
|
+
...field.overlayProps,
|
|
933
522
|
contentEditable: true,
|
|
934
|
-
onClickCapture: selectField,
|
|
935
523
|
onClick: _temp4,
|
|
936
524
|
onInput: handleInput,
|
|
937
|
-
onFocus:
|
|
938
|
-
onBlur:
|
|
939
|
-
onMouseEnter: t6,
|
|
940
|
-
onMouseLeave: t7,
|
|
525
|
+
onFocus: t3,
|
|
526
|
+
onBlur: t4,
|
|
941
527
|
onKeyDown: _temp5,
|
|
942
528
|
spellCheck: false,
|
|
943
529
|
suppressContentEditableWarning: true
|
|
944
530
|
}, linkData);
|
|
945
|
-
let
|
|
946
|
-
if ($[
|
|
947
|
-
|
|
948
|
-
$[
|
|
949
|
-
$[
|
|
950
|
-
} else
|
|
951
|
-
return
|
|
952
|
-
};
|
|
953
|
-
const assetOverlayMode = (reference) => {
|
|
954
|
-
if (reference) return "reference";
|
|
955
|
-
return options.synced ? "synced" : void 0;
|
|
531
|
+
let t6;
|
|
532
|
+
if ($[6] !== t5) {
|
|
533
|
+
t6 = /* @__PURE__ */ jsx(Fragment, { children: t5 });
|
|
534
|
+
$[6] = t5;
|
|
535
|
+
$[7] = t6;
|
|
536
|
+
} else t6 = $[7];
|
|
537
|
+
return t6;
|
|
956
538
|
};
|
|
957
539
|
const Image = (t0) => {
|
|
958
|
-
const $ = c(
|
|
540
|
+
const $ = c(10);
|
|
959
541
|
const { name, children } = t0;
|
|
960
|
-
|
|
961
|
-
const
|
|
962
|
-
if (!blockContext) throw new Error("Image must be used within a Block Component");
|
|
963
|
-
const { blockId, content } = blockContext;
|
|
964
|
-
const isContentEditable = useIsEditable();
|
|
965
|
-
const { window: iframeWindow } = useFrame();
|
|
966
|
-
const repeaterContext = React.use(RepeatableItemContext);
|
|
542
|
+
useScope("Image");
|
|
543
|
+
const field = useFieldSlot(String(name), "Image");
|
|
967
544
|
const { filesMap } = useNormalizedData();
|
|
968
|
-
const rawSource = repeaterContext ? repeaterContext.itemContent[name] : content[name];
|
|
969
|
-
const rawValue = resolveAssetValue(rawSource, filesMap);
|
|
970
|
-
const fieldSchema = repeaterContext ? repeaterContext.itemSchema?.[name] : (blockContext.sourceSchema ?? typeboxSchema.properties)[name];
|
|
971
|
-
const fieldValue = rawValue?.url ? rawValue : placeholderImage(fieldSchema?.title);
|
|
972
|
-
const isInlineArrayItem = repeaterContext != null && repeaterContext.itemId == null;
|
|
973
|
-
const overlayFieldName = isInlineArrayItem ? repeaterContext.arrayFieldName : String(name);
|
|
974
|
-
const overlayItemId = isInlineArrayItem ? repeaterContext.containerItemId : repeaterContext?.itemId;
|
|
975
|
-
const reference = React.use(ReferenceContext);
|
|
976
545
|
let t1;
|
|
977
|
-
if ($[0] !==
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
546
|
+
if ($[0] !== children || $[1] !== field.schema?.title || $[2] !== field.value || $[3] !== filesMap) {
|
|
547
|
+
const rawValue = resolveAssetValue(field.value, filesMap);
|
|
548
|
+
const fieldValue = rawValue?.url ? rawValue : placeholderImage(field.schema?.title);
|
|
549
|
+
const imageProps = {
|
|
550
|
+
src: transformImageUrl(fieldValue.url, {
|
|
551
|
+
width: getDefaultImageWidth(),
|
|
552
|
+
mimeType: fieldValue.mimeType,
|
|
553
|
+
size: fieldValue.size
|
|
554
|
+
}),
|
|
555
|
+
srcSet: buildImageSrcSet(fieldValue.url, fieldValue.mimeType, fieldValue.size),
|
|
556
|
+
sizes: getDefaultImageSizes(),
|
|
557
|
+
alt: fieldValue.alt
|
|
558
|
+
};
|
|
559
|
+
t1 = renderImagePlaceholder(fieldValue, children(imageProps, fieldValue));
|
|
560
|
+
$[0] = children;
|
|
561
|
+
$[1] = field.schema?.title;
|
|
562
|
+
$[2] = field.value;
|
|
563
|
+
$[3] = filesMap;
|
|
986
564
|
$[4] = t1;
|
|
987
565
|
} else t1 = $[4];
|
|
988
|
-
const
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
t2 =
|
|
996
|
-
|
|
997
|
-
$[6] = t2;
|
|
998
|
-
} else t2 = $[6];
|
|
999
|
-
const isHoveredFromSidebar = useOverlayMessage(iframeWindow, isContentEditable, "CAMOX_HOVER_FIELD", "CAMOX_HOVER_FIELD_END", t2);
|
|
1000
|
-
const [prevSidebarHover, setPrevSidebarHover] = React.useState(isHoveredFromSidebar);
|
|
1001
|
-
if (prevSidebarHover !== isHoveredFromSidebar) {
|
|
1002
|
-
setPrevSidebarHover(isHoveredFromSidebar);
|
|
1003
|
-
setIsHovered(isHoveredFromSidebar);
|
|
566
|
+
const renderedImage = t1;
|
|
567
|
+
if (!field.editable) {
|
|
568
|
+
let t2;
|
|
569
|
+
if ($[5] !== renderedImage) {
|
|
570
|
+
t2 = /* @__PURE__ */ jsx(Fragment, { children: renderedImage });
|
|
571
|
+
$[5] = renderedImage;
|
|
572
|
+
$[6] = t2;
|
|
573
|
+
} else t2 = $[6];
|
|
574
|
+
return t2;
|
|
1004
575
|
}
|
|
1005
|
-
let
|
|
1006
|
-
if ($[7] !==
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
if (reference) {
|
|
1010
|
-
reference.selectRecordField(overlayFieldName, isInlineArrayItem ? "ImageList" : "Image");
|
|
1011
|
-
return;
|
|
1012
|
-
}
|
|
1013
|
-
selectTarget(overlayItemId != null ? {
|
|
1014
|
-
type: "item-field",
|
|
1015
|
-
blockId,
|
|
1016
|
-
itemId: overlayItemId,
|
|
1017
|
-
fieldName: overlayFieldName,
|
|
1018
|
-
fieldType: "Image"
|
|
1019
|
-
} : {
|
|
1020
|
-
type: "block-field",
|
|
1021
|
-
blockId,
|
|
1022
|
-
fieldName: overlayFieldName,
|
|
1023
|
-
fieldType: "Image"
|
|
1024
|
-
});
|
|
1025
|
-
};
|
|
1026
|
-
$[7] = blockId;
|
|
1027
|
-
$[8] = isContentEditable;
|
|
1028
|
-
$[9] = isInlineArrayItem;
|
|
1029
|
-
$[10] = overlayFieldName;
|
|
1030
|
-
$[11] = overlayItemId;
|
|
1031
|
-
$[12] = reference;
|
|
1032
|
-
$[13] = selectTarget;
|
|
1033
|
-
$[14] = t3;
|
|
1034
|
-
} else t3 = $[14];
|
|
1035
|
-
const handleClick = t3;
|
|
1036
|
-
const imageProps = {
|
|
1037
|
-
src: transformImageUrl(fieldValue.url, {
|
|
1038
|
-
width: getDefaultImageWidth(),
|
|
1039
|
-
mimeType: fieldValue.mimeType,
|
|
1040
|
-
size: fieldValue.size
|
|
1041
|
-
}),
|
|
1042
|
-
srcSet: buildImageSrcSet(fieldValue.url, fieldValue.mimeType, fieldValue.size),
|
|
1043
|
-
sizes: getDefaultImageSizes(),
|
|
1044
|
-
alt: fieldValue.alt
|
|
1045
|
-
};
|
|
1046
|
-
const renderedImage = renderImagePlaceholder(fieldValue, children(imageProps, fieldValue));
|
|
1047
|
-
if (!isContentEditable) {
|
|
1048
|
-
let t4;
|
|
1049
|
-
if ($[15] !== renderedImage) {
|
|
1050
|
-
t4 = /* @__PURE__ */ jsx(Fragment, { children: renderedImage });
|
|
1051
|
-
$[15] = renderedImage;
|
|
1052
|
-
$[16] = t4;
|
|
1053
|
-
} else t4 = $[16];
|
|
1054
|
-
return t4;
|
|
1055
|
-
}
|
|
1056
|
-
let t4;
|
|
1057
|
-
if ($[17] !== reference) {
|
|
1058
|
-
t4 = assetOverlayMode(reference);
|
|
1059
|
-
$[17] = reference;
|
|
1060
|
-
$[18] = t4;
|
|
1061
|
-
} else t4 = $[18];
|
|
1062
|
-
let t5;
|
|
1063
|
-
let t6;
|
|
1064
|
-
if ($[19] !== setIsHovered) {
|
|
1065
|
-
t5 = () => setIsHovered(true);
|
|
1066
|
-
t6 = () => setIsHovered(false);
|
|
1067
|
-
$[19] = setIsHovered;
|
|
1068
|
-
$[20] = t5;
|
|
1069
|
-
$[21] = t6;
|
|
1070
|
-
} else {
|
|
1071
|
-
t5 = $[20];
|
|
1072
|
-
t6 = $[21];
|
|
1073
|
-
}
|
|
1074
|
-
let t7;
|
|
1075
|
-
if ($[22] !== fieldId || $[23] !== handleClick || $[24] !== overlayState || $[25] !== renderedImage || $[26] !== t4 || $[27] !== t5 || $[28] !== t6) {
|
|
1076
|
-
t7 = /* @__PURE__ */ jsx("div", {
|
|
1077
|
-
"data-camox-field-id": fieldId,
|
|
576
|
+
let t2;
|
|
577
|
+
if ($[7] !== field.overlayProps || $[8] !== renderedImage) {
|
|
578
|
+
t2 = /* @__PURE__ */ jsx("div", {
|
|
579
|
+
...field.overlayProps,
|
|
1078
580
|
"data-camox-field-type": "image",
|
|
1079
|
-
...overlayState,
|
|
1080
|
-
"data-camox-overlay-mode": t4,
|
|
1081
|
-
onMouseEnter: t5,
|
|
1082
|
-
onMouseLeave: t6,
|
|
1083
|
-
onClickCapture: handleClick,
|
|
1084
581
|
children: renderedImage
|
|
1085
582
|
});
|
|
1086
|
-
$[
|
|
1087
|
-
$[
|
|
1088
|
-
$[
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
$[27] = t5;
|
|
1092
|
-
$[28] = t6;
|
|
1093
|
-
$[29] = t7;
|
|
1094
|
-
} else t7 = $[29];
|
|
1095
|
-
return t7;
|
|
583
|
+
$[7] = field.overlayProps;
|
|
584
|
+
$[8] = renderedImage;
|
|
585
|
+
$[9] = t2;
|
|
586
|
+
} else t2 = $[9];
|
|
587
|
+
return t2;
|
|
1096
588
|
};
|
|
1097
589
|
const File = (t0) => {
|
|
1098
|
-
const $ = c(
|
|
590
|
+
const $ = c(11);
|
|
1099
591
|
const { name, children } = t0;
|
|
1100
|
-
const
|
|
1101
|
-
if (!blockContext) throw new Error("File must be used within a Block Component");
|
|
1102
|
-
const { blockId, content } = blockContext;
|
|
1103
|
-
const isContentEditable = useIsEditable();
|
|
1104
|
-
const { window: iframeWindow } = useFrame();
|
|
1105
|
-
const repeaterContext = React.use(RepeatableItemContext);
|
|
1106
|
-
const reference = React.use(ReferenceContext);
|
|
1107
|
-
const { filesMap } = useNormalizedData();
|
|
1108
|
-
const rawSource = repeaterContext ? repeaterContext.itemContent[name] : content[name];
|
|
1109
|
-
const fieldValue = resolveAssetValue(rawSource, filesMap);
|
|
1110
|
-
const isInlineArrayItem = repeaterContext != null && repeaterContext.itemId == null;
|
|
1111
|
-
const overlayFieldName = isInlineArrayItem ? repeaterContext.arrayFieldName : String(name);
|
|
1112
|
-
const fieldId = getOverlayFieldId(blockId, overlayFieldName, { reference });
|
|
1113
|
-
const selectable = reference != null && isContentEditable;
|
|
1114
|
-
const [isHovered, setIsHovered] = React.useState(false);
|
|
1115
|
-
const isFocused = useRecordSelection(reference?.placement ?? null, overlayFieldName);
|
|
1116
|
-
const overlayState = useOverlayState(isHovered, isFocused);
|
|
1117
|
-
const isHoveredFromSidebar = useOverlayMessage(iframeWindow, selectable, "CAMOX_HOVER_FIELD", "CAMOX_HOVER_FIELD_END", { fieldId });
|
|
1118
|
-
const [prevSidebarHover, setPrevSidebarHover] = React.useState(isHoveredFromSidebar);
|
|
1119
|
-
if (prevSidebarHover !== isHoveredFromSidebar) {
|
|
1120
|
-
setPrevSidebarHover(isHoveredFromSidebar);
|
|
1121
|
-
setIsHovered(isHoveredFromSidebar);
|
|
1122
|
-
}
|
|
1123
|
-
if (!fieldValue?.url) return null;
|
|
1124
|
-
const linkProps = {
|
|
1125
|
-
href: fieldValue.url,
|
|
1126
|
-
download: fieldValue.filename
|
|
1127
|
-
};
|
|
1128
|
-
const editableLinkProps = selectable ? {
|
|
1129
|
-
"data-camox-field-id": fieldId,
|
|
1130
|
-
"data-camox-field-type": "file",
|
|
1131
|
-
...overlayState,
|
|
1132
|
-
"data-camox-overlay-mode": assetOverlayMode(reference),
|
|
1133
|
-
onMouseEnter: () => setIsHovered(true),
|
|
1134
|
-
onMouseLeave: () => setIsHovered(false),
|
|
1135
|
-
onClickCapture: () => reference.selectRecordField(overlayFieldName, isInlineArrayItem ? "FileList" : "File"),
|
|
1136
|
-
onClick: _temp6
|
|
1137
|
-
} : null;
|
|
1138
|
-
const t1 = children({
|
|
1139
|
-
...linkProps,
|
|
1140
|
-
...editableLinkProps
|
|
1141
|
-
}, fieldValue);
|
|
592
|
+
const t1 = useScope("File").owner.kind === "record";
|
|
1142
593
|
let t2;
|
|
1143
594
|
if ($[0] !== t1) {
|
|
1144
|
-
t2 =
|
|
595
|
+
t2 = { enabled: t1 };
|
|
1145
596
|
$[0] = t1;
|
|
1146
597
|
$[1] = t2;
|
|
1147
598
|
} else t2 = $[1];
|
|
1148
|
-
|
|
599
|
+
const field = useFieldSlot(String(name), "File", t2);
|
|
600
|
+
const { filesMap } = useNormalizedData();
|
|
601
|
+
let t3;
|
|
602
|
+
let t4;
|
|
603
|
+
if ($[2] !== children || $[3] !== field.editable || $[4] !== field.overlayProps || $[5] !== field.value || $[6] !== filesMap) {
|
|
604
|
+
t4 = Symbol.for("react.early_return_sentinel");
|
|
605
|
+
bb0: {
|
|
606
|
+
const fieldValue = resolveAssetValue(field.value, filesMap);
|
|
607
|
+
if (!fieldValue?.url) {
|
|
608
|
+
t4 = null;
|
|
609
|
+
break bb0;
|
|
610
|
+
}
|
|
611
|
+
const linkProps = {
|
|
612
|
+
href: fieldValue.url,
|
|
613
|
+
download: fieldValue.filename
|
|
614
|
+
};
|
|
615
|
+
const editableLinkProps = field.editable ? {
|
|
616
|
+
...field.overlayProps,
|
|
617
|
+
"data-camox-field-type": "file",
|
|
618
|
+
onClick: _temp6
|
|
619
|
+
} : null;
|
|
620
|
+
t3 = children({
|
|
621
|
+
...linkProps,
|
|
622
|
+
...editableLinkProps
|
|
623
|
+
}, fieldValue);
|
|
624
|
+
}
|
|
625
|
+
$[2] = children;
|
|
626
|
+
$[3] = field.editable;
|
|
627
|
+
$[4] = field.overlayProps;
|
|
628
|
+
$[5] = field.value;
|
|
629
|
+
$[6] = filesMap;
|
|
630
|
+
$[7] = t3;
|
|
631
|
+
$[8] = t4;
|
|
632
|
+
} else {
|
|
633
|
+
t3 = $[7];
|
|
634
|
+
t4 = $[8];
|
|
635
|
+
}
|
|
636
|
+
if (t4 !== Symbol.for("react.early_return_sentinel")) return t4;
|
|
637
|
+
let t5;
|
|
638
|
+
if ($[9] !== t3) {
|
|
639
|
+
t5 = /* @__PURE__ */ jsx(Fragment, { children: t3 });
|
|
640
|
+
$[9] = t3;
|
|
641
|
+
$[10] = t5;
|
|
642
|
+
} else t5 = $[10];
|
|
643
|
+
return t5;
|
|
1149
644
|
};
|
|
1150
645
|
const ASSET_LIST_SELF_KEY = "__camox_asset_self__";
|
|
1151
646
|
const _AssetList = ({ name, children }) => {
|
|
1152
|
-
const
|
|
1153
|
-
if (!blockContext) throw new Error("ImageList/FileList must be used within a Block Component");
|
|
1154
|
-
const parentRepeaterContext = React.use(RepeatableItemContext);
|
|
647
|
+
const scope = useScope("ImageList/FileList");
|
|
1155
648
|
const { filesMap } = useNormalizedData();
|
|
1156
649
|
const fieldName = String(name);
|
|
1157
|
-
const ft =
|
|
650
|
+
const ft = scope.schema?.[fieldName]?.fieldType;
|
|
1158
651
|
if (ft !== "ImageList" && ft !== "FileList") throw new Error(`"${fieldName}" is not an imageList or fileList field`);
|
|
1159
|
-
const source =
|
|
652
|
+
const source = scope.content[fieldName];
|
|
1160
653
|
const resolved = (Array.isArray(source) ? source : []).map((v) => resolveAssetValue(v, filesMap)).filter((v) => v != null && typeof v === "object" && "url" in v);
|
|
1161
654
|
const Single = ft === "ImageList" ? Image : File;
|
|
1162
655
|
return /* @__PURE__ */ jsx(RepeaterHoverProvider, {
|
|
1163
|
-
blockId: blockContext.blockId,
|
|
1164
656
|
fieldName,
|
|
1165
|
-
children: resolved.map((value, index) => /* @__PURE__ */ jsx(
|
|
657
|
+
children: resolved.map((value, index) => /* @__PURE__ */ jsx(FieldScopeContext, {
|
|
1166
658
|
value: {
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
659
|
+
...scope,
|
|
660
|
+
content: { [ASSET_LIST_SELF_KEY]: value },
|
|
661
|
+
list: {
|
|
662
|
+
name: fieldName,
|
|
663
|
+
type: ft
|
|
664
|
+
}
|
|
1173
665
|
},
|
|
1174
666
|
children: /* @__PURE__ */ jsx(Single, {
|
|
1175
667
|
name: ASSET_LIST_SELF_KEY,
|
|
@@ -1181,7 +673,7 @@ function createEditableBlock(options) {
|
|
|
1181
673
|
const ImageList = _AssetList;
|
|
1182
674
|
const FileList = _AssetList;
|
|
1183
675
|
const RepeatableItemWrapper = (t0) => {
|
|
1184
|
-
const $ = c(
|
|
676
|
+
const $ = c(18);
|
|
1185
677
|
const { itemId, blockId, nesting, children } = t0;
|
|
1186
678
|
const isContentEditable = useIsEditable();
|
|
1187
679
|
const { window: iframeWindow } = useFrame();
|
|
@@ -1189,40 +681,32 @@ function createEditableBlock(options) {
|
|
|
1189
681
|
const registrationRef = React.useRef(null);
|
|
1190
682
|
const [isLocallyHovered, setIsLocallyHovered] = React.useState(false);
|
|
1191
683
|
const hoveredRepeaterGroup = React.useContext(RepeaterHoverContext);
|
|
1192
|
-
const
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
$[1] = t2;
|
|
1204
|
-
$[2] = t3;
|
|
1205
|
-
} else t3 = $[2];
|
|
1206
|
-
const t4 = useOverlayMessage(iframeWindow, isContentEditable, "CAMOX_HOVER_REPEATABLE_ITEM", "CAMOX_HOVER_REPEATABLE_ITEM_END", t3) || hoveredRepeaterGroup !== null || isLocallyHovered;
|
|
1207
|
-
let t5;
|
|
1208
|
-
if ($[3] !== hoveredRepeaterGroup || $[4] !== isSelected || $[5] !== t4) {
|
|
1209
|
-
t5 = {
|
|
1210
|
-
hovered: t4,
|
|
684
|
+
const target = itemId == null ? null : {
|
|
685
|
+
type: "item",
|
|
686
|
+
blockId,
|
|
687
|
+
itemId
|
|
688
|
+
};
|
|
689
|
+
const isSelected = sameTarget(useEditingSelection(), target);
|
|
690
|
+
const t1 = useSidebarHover(target, isContentEditable) || hoveredRepeaterGroup !== null || isLocallyHovered;
|
|
691
|
+
let t2;
|
|
692
|
+
if ($[0] !== hoveredRepeaterGroup || $[1] !== isSelected || $[2] !== t1) {
|
|
693
|
+
t2 = {
|
|
694
|
+
hovered: t1,
|
|
1211
695
|
focused: isSelected,
|
|
1212
696
|
hoverGroup: hoveredRepeaterGroup,
|
|
1213
697
|
synced: !!options.synced
|
|
1214
698
|
};
|
|
1215
|
-
$[
|
|
1216
|
-
$[
|
|
1217
|
-
$[
|
|
1218
|
-
$[
|
|
1219
|
-
} else
|
|
1220
|
-
const overlayState =
|
|
699
|
+
$[0] = hoveredRepeaterGroup;
|
|
700
|
+
$[1] = isSelected;
|
|
701
|
+
$[2] = t1;
|
|
702
|
+
$[3] = t2;
|
|
703
|
+
} else t2 = $[3];
|
|
704
|
+
const overlayState = t2;
|
|
1221
705
|
const document = iframeWindow?.document;
|
|
1222
|
-
let
|
|
1223
|
-
let
|
|
1224
|
-
if ($[
|
|
1225
|
-
|
|
706
|
+
let t3;
|
|
707
|
+
let t4;
|
|
708
|
+
if ($[4] !== blockId || $[5] !== document || $[6] !== isContentEditable || $[7] !== itemId || $[8] !== nesting) {
|
|
709
|
+
t3 = () => {
|
|
1226
710
|
const fragment = fragmentRef.current;
|
|
1227
711
|
if (!isContentEditable || itemId == null || !document || !fragment) return;
|
|
1228
712
|
const registration = registerRepeatableItem(document, {
|
|
@@ -1241,38 +725,38 @@ function createEditableBlock(options) {
|
|
|
1241
725
|
registration.unregister();
|
|
1242
726
|
};
|
|
1243
727
|
};
|
|
1244
|
-
|
|
728
|
+
t4 = [
|
|
1245
729
|
isContentEditable,
|
|
1246
730
|
document,
|
|
1247
731
|
blockId,
|
|
1248
732
|
itemId,
|
|
1249
733
|
nesting
|
|
1250
734
|
];
|
|
1251
|
-
$[
|
|
1252
|
-
$[
|
|
1253
|
-
$[
|
|
1254
|
-
$[
|
|
1255
|
-
$[
|
|
1256
|
-
$[
|
|
1257
|
-
$[
|
|
735
|
+
$[4] = blockId;
|
|
736
|
+
$[5] = document;
|
|
737
|
+
$[6] = isContentEditable;
|
|
738
|
+
$[7] = itemId;
|
|
739
|
+
$[8] = nesting;
|
|
740
|
+
$[9] = t3;
|
|
741
|
+
$[10] = t4;
|
|
1258
742
|
} else {
|
|
1259
|
-
|
|
1260
|
-
|
|
743
|
+
t3 = $[9];
|
|
744
|
+
t4 = $[10];
|
|
1261
745
|
}
|
|
1262
|
-
React.useLayoutEffect(
|
|
1263
|
-
let
|
|
1264
|
-
if ($[
|
|
1265
|
-
|
|
746
|
+
React.useLayoutEffect(t3, t4);
|
|
747
|
+
let t5;
|
|
748
|
+
if ($[11] !== overlayState) {
|
|
749
|
+
t5 = () => {
|
|
1266
750
|
registrationRef.current?.update(overlayState);
|
|
1267
751
|
};
|
|
1268
|
-
$[
|
|
1269
|
-
$[
|
|
1270
|
-
} else
|
|
1271
|
-
React.useLayoutEffect(
|
|
1272
|
-
let
|
|
1273
|
-
let
|
|
1274
|
-
if ($[
|
|
1275
|
-
|
|
752
|
+
$[11] = overlayState;
|
|
753
|
+
$[12] = t5;
|
|
754
|
+
} else t5 = $[12];
|
|
755
|
+
React.useLayoutEffect(t5);
|
|
756
|
+
let t6;
|
|
757
|
+
let t7;
|
|
758
|
+
if ($[13] !== isContentEditable) {
|
|
759
|
+
t6 = () => {
|
|
1276
760
|
const fragment_0 = fragmentRef.current;
|
|
1277
761
|
if (!isContentEditable || !fragment_0) return;
|
|
1278
762
|
const enter = () => setIsLocallyHovered(true);
|
|
@@ -1284,65 +768,66 @@ function createEditableBlock(options) {
|
|
|
1284
768
|
fragment_0.removeEventListener("mouseleave", leave);
|
|
1285
769
|
};
|
|
1286
770
|
};
|
|
1287
|
-
|
|
1288
|
-
$[
|
|
1289
|
-
$[
|
|
1290
|
-
$[
|
|
771
|
+
t7 = [isContentEditable];
|
|
772
|
+
$[13] = isContentEditable;
|
|
773
|
+
$[14] = t6;
|
|
774
|
+
$[15] = t7;
|
|
1291
775
|
} else {
|
|
1292
|
-
|
|
1293
|
-
|
|
776
|
+
t6 = $[14];
|
|
777
|
+
t7 = $[15];
|
|
1294
778
|
}
|
|
1295
|
-
React.useEffect(
|
|
1296
|
-
let
|
|
1297
|
-
if ($[
|
|
1298
|
-
|
|
779
|
+
React.useEffect(t6, t7);
|
|
780
|
+
let t8;
|
|
781
|
+
if ($[16] !== children) {
|
|
782
|
+
t8 = /* @__PURE__ */ jsx(React.Fragment, {
|
|
1299
783
|
ref: fragmentRef,
|
|
1300
784
|
children
|
|
1301
785
|
});
|
|
1302
|
-
$[
|
|
1303
|
-
$[
|
|
1304
|
-
} else
|
|
1305
|
-
return
|
|
786
|
+
$[16] = children;
|
|
787
|
+
$[17] = t8;
|
|
788
|
+
} else t8 = $[17];
|
|
789
|
+
return t8;
|
|
1306
790
|
};
|
|
1307
791
|
const RepeaterHoverProvider = (t0) => {
|
|
1308
792
|
const $ = c(6);
|
|
1309
|
-
const {
|
|
793
|
+
const { fieldName, children } = t0;
|
|
794
|
+
const scope = useScope("Repeater");
|
|
1310
795
|
const isContentEditable = useIsEditable();
|
|
1311
|
-
const { window: iframeWindow } = useFrame();
|
|
1312
796
|
const hoverGroup = React.useId();
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
};
|
|
797
|
+
let t1;
|
|
798
|
+
if ($[0] !== fieldName || $[1] !== scope.owner) {
|
|
799
|
+
t1 = slotSelection({
|
|
800
|
+
owner: scope.owner,
|
|
801
|
+
name: fieldName,
|
|
802
|
+
type: "Repeater"
|
|
803
|
+
});
|
|
1320
804
|
$[0] = fieldName;
|
|
1321
|
-
$[1] =
|
|
1322
|
-
$[2] =
|
|
1323
|
-
} else
|
|
1324
|
-
const
|
|
1325
|
-
let
|
|
1326
|
-
if ($[3] !== children || $[4] !==
|
|
1327
|
-
|
|
1328
|
-
value:
|
|
805
|
+
$[1] = scope.owner;
|
|
806
|
+
$[2] = t1;
|
|
807
|
+
} else t1 = $[2];
|
|
808
|
+
const t2 = useSidebarHover(t1, isContentEditable) ? hoverGroup : null;
|
|
809
|
+
let t3;
|
|
810
|
+
if ($[3] !== children || $[4] !== t2) {
|
|
811
|
+
t3 = /* @__PURE__ */ jsx(RepeaterHoverContext.Provider, {
|
|
812
|
+
value: t2,
|
|
1329
813
|
children
|
|
1330
814
|
});
|
|
1331
815
|
$[3] = children;
|
|
1332
|
-
$[4] =
|
|
1333
|
-
$[5] =
|
|
1334
|
-
} else
|
|
1335
|
-
return
|
|
816
|
+
$[4] = t2;
|
|
817
|
+
$[5] = t3;
|
|
818
|
+
} else t3 = $[5];
|
|
819
|
+
return t3;
|
|
1336
820
|
};
|
|
1337
821
|
const RepeaterImpl = (t0) => {
|
|
1338
|
-
const $ = c(
|
|
822
|
+
const $ = c(20);
|
|
1339
823
|
const { name, children } = t0;
|
|
1340
824
|
const blockContext = React.use(Context);
|
|
1341
825
|
if (!blockContext) throw new Error("Repeater must be used within a Block Component");
|
|
1342
|
-
const
|
|
1343
|
-
const
|
|
826
|
+
const scope = useScope("Repeater");
|
|
827
|
+
const { blockId } = blockContext;
|
|
828
|
+
const parentNesting = React.use(ItemNestingContext);
|
|
1344
829
|
const fieldName = String(name);
|
|
1345
|
-
const source =
|
|
830
|
+
const source = scope.content[fieldName];
|
|
1346
831
|
const { itemsMap } = useNormalizedData();
|
|
1347
832
|
let t1;
|
|
1348
833
|
if ($[0] !== source) {
|
|
@@ -1355,27 +840,25 @@ function createEditableBlock(options) {
|
|
|
1355
840
|
let T0;
|
|
1356
841
|
let t2;
|
|
1357
842
|
let t3;
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
t5 = (item) => {
|
|
843
|
+
if ($[2] !== blockId || $[3] !== children || $[4] !== fieldName || $[5] !== itemsMap || $[6] !== parentNesting || $[7] !== scope.owner || $[8] !== scope.schema || $[9] !== scope.synced || $[10] !== storedValue) {
|
|
844
|
+
let t4;
|
|
845
|
+
if ($[14] !== itemsMap) {
|
|
846
|
+
t4 = (item) => {
|
|
1363
847
|
if (isItemMarker(item)) return itemsMap.get(item._itemId) ?? null;
|
|
1364
848
|
return item;
|
|
1365
849
|
};
|
|
1366
|
-
$[
|
|
1367
|
-
$[
|
|
1368
|
-
} else
|
|
1369
|
-
const arrayValue = storedValue.map(
|
|
1370
|
-
const fieldSchema =
|
|
850
|
+
$[14] = itemsMap;
|
|
851
|
+
$[15] = t4;
|
|
852
|
+
} else t4 = $[15];
|
|
853
|
+
const arrayValue = storedValue.map(t4).filter(Boolean);
|
|
854
|
+
const fieldSchema = scope.schema?.[fieldName];
|
|
1371
855
|
const itemSchema = fieldSchema?.items?.properties;
|
|
1372
856
|
const emptyItem = emptyFieldValues(fieldSchema?.items);
|
|
1373
857
|
const emptyItemSettings = emptyFieldValues(fieldSchema?.itemSettingsSchema);
|
|
1374
|
-
const nesting =
|
|
858
|
+
const nesting = parentNesting == null ? 0 : parentNesting + 1;
|
|
1375
859
|
T0 = RepeaterHoverProvider;
|
|
1376
|
-
t2 =
|
|
1377
|
-
t3 =
|
|
1378
|
-
t4 = arrayValue.map((item_0, index) => {
|
|
860
|
+
t2 = fieldName;
|
|
861
|
+
t3 = arrayValue.map((item_0, index) => {
|
|
1379
862
|
const isDbItem = item_0.content !== void 0 && item_0.id != null;
|
|
1380
863
|
const itemContent = {
|
|
1381
864
|
...emptyItem,
|
|
@@ -1387,37 +870,43 @@ function createEditableBlock(options) {
|
|
|
1387
870
|
};
|
|
1388
871
|
const itemId = isDbItem ? item_0.id : void 0;
|
|
1389
872
|
const useItemSetting = (settingName) => itemSettings[settingName];
|
|
1390
|
-
const
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
Embed,
|
|
1395
|
-
Artifact,
|
|
1396
|
-
Image,
|
|
1397
|
-
File,
|
|
1398
|
-
ImageList: _AssetList,
|
|
1399
|
-
FileList: _AssetList,
|
|
1400
|
-
Repeater: RepeaterImpl,
|
|
1401
|
-
Reference: ReferenceImpl,
|
|
1402
|
-
ReferenceList: ReferenceListImpl,
|
|
1403
|
-
useSetting: useItemSetting
|
|
873
|
+
const owner = itemId == null ? scope.owner : {
|
|
874
|
+
kind: "item",
|
|
875
|
+
blockId,
|
|
876
|
+
itemId
|
|
1404
877
|
};
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
878
|
+
const itemScope = {
|
|
879
|
+
owner,
|
|
880
|
+
target: owner.kind === "item" ? owner : null,
|
|
881
|
+
content: itemContent,
|
|
882
|
+
settings: itemSettings,
|
|
883
|
+
schema: itemSchema,
|
|
884
|
+
synced: scope.synced
|
|
885
|
+
};
|
|
886
|
+
return /* @__PURE__ */ jsx(FieldScopeContext, {
|
|
887
|
+
value: itemScope,
|
|
888
|
+
children: /* @__PURE__ */ jsx(ItemNestingContext, {
|
|
889
|
+
value: nesting,
|
|
890
|
+
children: /* @__PURE__ */ jsx(RepeatableItemWrapper, {
|
|
891
|
+
itemId,
|
|
892
|
+
blockId,
|
|
893
|
+
nesting,
|
|
894
|
+
children: children({
|
|
895
|
+
Field,
|
|
896
|
+
Link,
|
|
897
|
+
Icon,
|
|
898
|
+
Embed,
|
|
899
|
+
Artifact,
|
|
900
|
+
Image,
|
|
901
|
+
File,
|
|
902
|
+
ImageList: _AssetList,
|
|
903
|
+
FileList: _AssetList,
|
|
904
|
+
Repeater: RepeaterImpl,
|
|
905
|
+
Reference: ReferenceImpl,
|
|
906
|
+
ReferenceList: ReferenceListImpl,
|
|
907
|
+
useSetting: useItemSetting
|
|
908
|
+
}, index)
|
|
909
|
+
})
|
|
1421
910
|
})
|
|
1422
911
|
}, itemId ?? index);
|
|
1423
912
|
});
|
|
@@ -1425,42 +914,40 @@ function createEditableBlock(options) {
|
|
|
1425
914
|
$[3] = children;
|
|
1426
915
|
$[4] = fieldName;
|
|
1427
916
|
$[5] = itemsMap;
|
|
1428
|
-
$[6] =
|
|
1429
|
-
$[7] =
|
|
1430
|
-
$[8] =
|
|
1431
|
-
$[9] =
|
|
1432
|
-
$[10] =
|
|
1433
|
-
$[11] =
|
|
917
|
+
$[6] = parentNesting;
|
|
918
|
+
$[7] = scope.owner;
|
|
919
|
+
$[8] = scope.schema;
|
|
920
|
+
$[9] = scope.synced;
|
|
921
|
+
$[10] = storedValue;
|
|
922
|
+
$[11] = T0;
|
|
923
|
+
$[12] = t2;
|
|
924
|
+
$[13] = t3;
|
|
1434
925
|
} else {
|
|
1435
|
-
T0 = $[
|
|
1436
|
-
t2 = $[
|
|
1437
|
-
t3 = $[
|
|
1438
|
-
t4 = $[11];
|
|
926
|
+
T0 = $[11];
|
|
927
|
+
t2 = $[12];
|
|
928
|
+
t3 = $[13];
|
|
1439
929
|
}
|
|
1440
|
-
let
|
|
1441
|
-
if ($[
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
children: t4
|
|
930
|
+
let t4;
|
|
931
|
+
if ($[16] !== T0 || $[17] !== t2 || $[18] !== t3) {
|
|
932
|
+
t4 = /* @__PURE__ */ jsx(T0, {
|
|
933
|
+
fieldName: t2,
|
|
934
|
+
children: t3
|
|
1446
935
|
});
|
|
1447
|
-
$[
|
|
1448
|
-
$[
|
|
1449
|
-
$[
|
|
1450
|
-
$[
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
return t5;
|
|
936
|
+
$[16] = T0;
|
|
937
|
+
$[17] = t2;
|
|
938
|
+
$[18] = t3;
|
|
939
|
+
$[19] = t4;
|
|
940
|
+
} else t4 = $[19];
|
|
941
|
+
return t4;
|
|
1454
942
|
};
|
|
1455
943
|
const Repeater = RepeaterImpl;
|
|
1456
944
|
const BlockComponent = (t0) => {
|
|
1457
|
-
const $ = c(
|
|
945
|
+
const $ = c(56);
|
|
1458
946
|
const { blockData } = t0;
|
|
1459
947
|
const isContentEditable = useIsEditable();
|
|
1460
|
-
const { window: iframeWindow } = useFrame();
|
|
1461
948
|
const [isHovered, setIsHovered] = React.useState(false);
|
|
1462
|
-
const selection =
|
|
1463
|
-
const selectTarget =
|
|
949
|
+
const selection = useEditingSelection();
|
|
950
|
+
const selectTarget = useSelectTarget();
|
|
1464
951
|
let t1;
|
|
1465
952
|
if ($[0] !== selection) {
|
|
1466
953
|
t1 = selectionBlockId(selection);
|
|
@@ -1468,7 +955,6 @@ function createEditableBlock(options) {
|
|
|
1468
955
|
$[1] = t1;
|
|
1469
956
|
} else t1 = $[1];
|
|
1470
957
|
const isBlockSelected = t1 === blockData._id;
|
|
1471
|
-
const overlayState = useOverlayState(isHovered, isBlockSelected);
|
|
1472
958
|
const ref = React.useRef(null);
|
|
1473
959
|
const canvasWorkspace = React.use(CanvasWorkspaceContext);
|
|
1474
960
|
const mounted = React.useRef(false);
|
|
@@ -1512,29 +998,27 @@ function createEditableBlock(options) {
|
|
|
1512
998
|
$[8] = t3;
|
|
1513
999
|
} else t3 = $[8];
|
|
1514
1000
|
React.useEffect(t2, t3);
|
|
1515
|
-
|
|
1001
|
+
let t4;
|
|
1002
|
+
if ($[9] !== blockData._id) {
|
|
1003
|
+
t4 = {
|
|
1004
|
+
type: "block",
|
|
1005
|
+
blockId: blockData._id
|
|
1006
|
+
};
|
|
1007
|
+
$[9] = blockData._id;
|
|
1008
|
+
$[10] = t4;
|
|
1009
|
+
} else t4 = $[10];
|
|
1010
|
+
const isHoveredFromSidebar = useSidebarHover(t4, isContentEditable);
|
|
1011
|
+
const overlayState = useOverlayState(isHovered || isHoveredFromSidebar, isBlockSelected);
|
|
1516
1012
|
let t5;
|
|
1517
|
-
if ($[9] !== t4) {
|
|
1518
|
-
t5 = { blockId: t4 };
|
|
1519
|
-
$[9] = t4;
|
|
1520
|
-
$[10] = t5;
|
|
1521
|
-
} else t5 = $[10];
|
|
1522
|
-
const isHoveredFromSidebar = useOverlayMessage(iframeWindow, isContentEditable, "CAMOX_HOVER_BLOCK", "CAMOX_HOVER_BLOCK_END", t5);
|
|
1523
|
-
const [prevSidebarHover, setPrevSidebarHover] = React.useState(isHoveredFromSidebar);
|
|
1524
|
-
if (prevSidebarHover !== isHoveredFromSidebar) {
|
|
1525
|
-
setPrevSidebarHover(isHoveredFromSidebar);
|
|
1526
|
-
setIsHovered(isHoveredFromSidebar);
|
|
1527
|
-
}
|
|
1528
|
-
let t6;
|
|
1529
1013
|
if ($[11] !== blockData.settings) {
|
|
1530
|
-
|
|
1014
|
+
t5 = {
|
|
1531
1015
|
...emptySettings,
|
|
1532
1016
|
...blockData.settings
|
|
1533
1017
|
};
|
|
1534
1018
|
$[11] = blockData.settings;
|
|
1535
|
-
$[12] =
|
|
1536
|
-
} else
|
|
1537
|
-
const blockSettings =
|
|
1019
|
+
$[12] = t5;
|
|
1020
|
+
} else t5 = $[12];
|
|
1021
|
+
const blockSettings = t5;
|
|
1538
1022
|
let result;
|
|
1539
1023
|
if ($[13] !== blockData.content) {
|
|
1540
1024
|
result = {
|
|
@@ -1549,9 +1033,9 @@ function createEditableBlock(options) {
|
|
|
1549
1033
|
$[14] = result;
|
|
1550
1034
|
} else result = $[14];
|
|
1551
1035
|
const normalizedContent = result;
|
|
1552
|
-
let
|
|
1036
|
+
let t6;
|
|
1553
1037
|
if ($[15] !== blockData._id || $[16] !== isContentEditable || $[17] !== selectTarget) {
|
|
1554
|
-
|
|
1038
|
+
t6 = (e) => {
|
|
1555
1039
|
if (!isContentEditable) return;
|
|
1556
1040
|
const target = e.target;
|
|
1557
1041
|
if (target.closest("[data-camox-field-id]")) return;
|
|
@@ -1564,94 +1048,127 @@ function createEditableBlock(options) {
|
|
|
1564
1048
|
$[15] = blockData._id;
|
|
1565
1049
|
$[16] = isContentEditable;
|
|
1566
1050
|
$[17] = selectTarget;
|
|
1567
|
-
$[18] =
|
|
1568
|
-
} else
|
|
1569
|
-
const handleClick =
|
|
1570
|
-
let
|
|
1051
|
+
$[18] = t6;
|
|
1052
|
+
} else t6 = $[18];
|
|
1053
|
+
const handleClick = t6;
|
|
1054
|
+
let t7;
|
|
1571
1055
|
if ($[19] !== isContentEditable) {
|
|
1572
|
-
|
|
1056
|
+
t7 = () => {
|
|
1573
1057
|
if (!isContentEditable) return;
|
|
1574
1058
|
setIsHovered(true);
|
|
1575
1059
|
};
|
|
1576
1060
|
$[19] = isContentEditable;
|
|
1577
|
-
$[20] =
|
|
1578
|
-
} else
|
|
1579
|
-
const handleMouseEnter =
|
|
1580
|
-
let
|
|
1061
|
+
$[20] = t7;
|
|
1062
|
+
} else t7 = $[20];
|
|
1063
|
+
const handleMouseEnter = t7;
|
|
1064
|
+
let t8;
|
|
1581
1065
|
if ($[21] !== isContentEditable) {
|
|
1582
|
-
|
|
1066
|
+
t8 = () => {
|
|
1583
1067
|
if (!isContentEditable) return;
|
|
1584
1068
|
setIsHovered(false);
|
|
1585
1069
|
};
|
|
1586
1070
|
$[21] = isContentEditable;
|
|
1587
|
-
$[22] =
|
|
1588
|
-
} else
|
|
1589
|
-
const handleMouseLeave =
|
|
1071
|
+
$[22] = t8;
|
|
1072
|
+
} else t8 = $[22];
|
|
1073
|
+
const handleMouseLeave = t8;
|
|
1590
1074
|
const shouldShowOverlay = isContentEditable && (overlayState["data-camox-hovered"] || overlayState["data-camox-focused"]);
|
|
1075
|
+
let t9;
|
|
1076
|
+
if ($[23] !== blockData._id) {
|
|
1077
|
+
t9 = {
|
|
1078
|
+
kind: "block",
|
|
1079
|
+
blockId: blockData._id
|
|
1080
|
+
};
|
|
1081
|
+
$[23] = blockData._id;
|
|
1082
|
+
$[24] = t9;
|
|
1083
|
+
} else t9 = $[24];
|
|
1084
|
+
const owner = t9;
|
|
1591
1085
|
let t10;
|
|
1592
|
-
if ($[
|
|
1086
|
+
if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1593
1087
|
t10 = {
|
|
1594
1088
|
position: "relative",
|
|
1595
1089
|
scrollMargin: "5rem"
|
|
1596
1090
|
};
|
|
1597
|
-
$[
|
|
1598
|
-
} else t10 = $[
|
|
1091
|
+
$[25] = t10;
|
|
1092
|
+
} else t10 = $[25];
|
|
1599
1093
|
const t11 = isContentEditable ? blockData._id : void 0;
|
|
1600
1094
|
let t12;
|
|
1601
|
-
if ($[
|
|
1095
|
+
if ($[26] !== overlayState || $[27] !== shouldShowOverlay) {
|
|
1602
1096
|
t12 = shouldShowOverlay ? overlayState : {};
|
|
1603
|
-
$[
|
|
1604
|
-
$[
|
|
1605
|
-
$[
|
|
1606
|
-
} else t12 = $[
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
...blockData.content
|
|
1612
|
-
};
|
|
1613
|
-
$[27] = blockData.content;
|
|
1614
|
-
$[28] = t13;
|
|
1615
|
-
} else t13 = $[28];
|
|
1616
|
-
const t14 = t13;
|
|
1617
|
-
let t15;
|
|
1618
|
-
if ($[29] !== blockData._id || $[30] !== blockSettings || $[31] !== isHovered || $[32] !== t14) {
|
|
1619
|
-
t15 = {
|
|
1097
|
+
$[26] = overlayState;
|
|
1098
|
+
$[27] = shouldShowOverlay;
|
|
1099
|
+
$[28] = t12;
|
|
1100
|
+
} else t12 = $[28];
|
|
1101
|
+
const t13 = isHovered || isHoveredFromSidebar;
|
|
1102
|
+
let t14;
|
|
1103
|
+
if ($[29] !== blockData._id || $[30] !== blockSettings || $[31] !== t13) {
|
|
1104
|
+
t14 = {
|
|
1620
1105
|
blockId: blockData._id,
|
|
1621
|
-
content: t14,
|
|
1622
1106
|
settings: blockSettings,
|
|
1623
|
-
isHovered,
|
|
1107
|
+
isHovered: t13,
|
|
1624
1108
|
setIsHovered
|
|
1625
1109
|
};
|
|
1626
1110
|
$[29] = blockData._id;
|
|
1627
1111
|
$[30] = blockSettings;
|
|
1628
|
-
$[31] =
|
|
1112
|
+
$[31] = t13;
|
|
1629
1113
|
$[32] = t14;
|
|
1630
|
-
|
|
1631
|
-
|
|
1114
|
+
} else t14 = $[32];
|
|
1115
|
+
let t15;
|
|
1116
|
+
if ($[33] !== blockData.content) {
|
|
1117
|
+
t15 = {
|
|
1118
|
+
...emptyContent,
|
|
1119
|
+
...blockData.content
|
|
1120
|
+
};
|
|
1121
|
+
$[33] = blockData.content;
|
|
1122
|
+
$[34] = t15;
|
|
1123
|
+
} else t15 = $[34];
|
|
1632
1124
|
let t16;
|
|
1633
|
-
if ($[
|
|
1634
|
-
t16 =
|
|
1125
|
+
if ($[35] !== blockSettings || $[36] !== owner || $[37] !== t15) {
|
|
1126
|
+
t16 = {
|
|
1127
|
+
owner,
|
|
1128
|
+
target: owner,
|
|
1129
|
+
content: t15,
|
|
1130
|
+
settings: blockSettings,
|
|
1131
|
+
schema: typeboxSchema.properties,
|
|
1132
|
+
synced: !!options.synced
|
|
1133
|
+
};
|
|
1134
|
+
$[35] = blockSettings;
|
|
1135
|
+
$[36] = owner;
|
|
1136
|
+
$[37] = t15;
|
|
1137
|
+
$[38] = t16;
|
|
1138
|
+
} else t16 = $[38];
|
|
1139
|
+
let t17;
|
|
1140
|
+
if ($[39] !== blockSettings || $[40] !== normalizedContent) {
|
|
1141
|
+
t17 = /* @__PURE__ */ jsx(ToReact, {
|
|
1635
1142
|
content: normalizedContent,
|
|
1636
1143
|
settings: blockSettings
|
|
1637
1144
|
});
|
|
1638
|
-
$[
|
|
1639
|
-
$[
|
|
1640
|
-
$[
|
|
1641
|
-
} else
|
|
1642
|
-
let t17;
|
|
1643
|
-
if ($[37] !== t15 || $[38] !== t16) {
|
|
1644
|
-
t17 = /* @__PURE__ */ jsx(Context.Provider, {
|
|
1645
|
-
value: t15,
|
|
1646
|
-
children: t16
|
|
1647
|
-
});
|
|
1648
|
-
$[37] = t15;
|
|
1649
|
-
$[38] = t16;
|
|
1650
|
-
$[39] = t17;
|
|
1651
|
-
} else t17 = $[39];
|
|
1145
|
+
$[39] = blockSettings;
|
|
1146
|
+
$[40] = normalizedContent;
|
|
1147
|
+
$[41] = t17;
|
|
1148
|
+
} else t17 = $[41];
|
|
1652
1149
|
let t18;
|
|
1653
|
-
if ($[
|
|
1654
|
-
t18 = /* @__PURE__ */ jsx(
|
|
1150
|
+
if ($[42] !== t16 || $[43] !== t17) {
|
|
1151
|
+
t18 = /* @__PURE__ */ jsx(FieldScopeContext, {
|
|
1152
|
+
value: t16,
|
|
1153
|
+
children: t17
|
|
1154
|
+
});
|
|
1155
|
+
$[42] = t16;
|
|
1156
|
+
$[43] = t17;
|
|
1157
|
+
$[44] = t18;
|
|
1158
|
+
} else t18 = $[44];
|
|
1159
|
+
let t19;
|
|
1160
|
+
if ($[45] !== t14 || $[46] !== t18) {
|
|
1161
|
+
t19 = /* @__PURE__ */ jsx(Context.Provider, {
|
|
1162
|
+
value: t14,
|
|
1163
|
+
children: t18
|
|
1164
|
+
});
|
|
1165
|
+
$[45] = t14;
|
|
1166
|
+
$[46] = t18;
|
|
1167
|
+
$[47] = t19;
|
|
1168
|
+
} else t19 = $[47];
|
|
1169
|
+
let t20;
|
|
1170
|
+
if ($[48] !== blockData._id || $[49] !== handleClick || $[50] !== handleMouseEnter || $[51] !== handleMouseLeave || $[52] !== t11 || $[53] !== t12 || $[54] !== t19) {
|
|
1171
|
+
t20 = /* @__PURE__ */ jsx("div", {
|
|
1655
1172
|
className: "group visual-editing-block",
|
|
1656
1173
|
"data-camox-viewport-block": blockData._id,
|
|
1657
1174
|
ref,
|
|
@@ -1662,18 +1179,18 @@ function createEditableBlock(options) {
|
|
|
1662
1179
|
onClickCapture: handleClick,
|
|
1663
1180
|
onMouseEnter: handleMouseEnter,
|
|
1664
1181
|
onMouseLeave: handleMouseLeave,
|
|
1665
|
-
children:
|
|
1182
|
+
children: t19
|
|
1666
1183
|
});
|
|
1667
|
-
$[
|
|
1668
|
-
$[
|
|
1669
|
-
$[
|
|
1670
|
-
$[
|
|
1671
|
-
$[
|
|
1672
|
-
$[
|
|
1673
|
-
$[
|
|
1674
|
-
$[
|
|
1675
|
-
} else
|
|
1676
|
-
return
|
|
1184
|
+
$[48] = blockData._id;
|
|
1185
|
+
$[49] = handleClick;
|
|
1186
|
+
$[50] = handleMouseEnter;
|
|
1187
|
+
$[51] = handleMouseLeave;
|
|
1188
|
+
$[52] = t11;
|
|
1189
|
+
$[53] = t12;
|
|
1190
|
+
$[54] = t19;
|
|
1191
|
+
$[55] = t20;
|
|
1192
|
+
} else t20 = $[55];
|
|
1193
|
+
return t20;
|
|
1677
1194
|
};
|
|
1678
1195
|
const useSetting = (name) => {
|
|
1679
1196
|
const ctx = React.use(Context);
|
|
@@ -1693,7 +1210,7 @@ function createEditableBlock(options) {
|
|
|
1693
1210
|
Primitive = $[1];
|
|
1694
1211
|
props = $[2];
|
|
1695
1212
|
}
|
|
1696
|
-
if (
|
|
1213
|
+
if (useScope("Reference").content[props.name] == null) return null;
|
|
1697
1214
|
let t1;
|
|
1698
1215
|
if ($[3] !== Primitive || $[4] !== props) {
|
|
1699
1216
|
t1 = /* @__PURE__ */ jsx(Primitive, { ...props });
|
|
@@ -1768,186 +1285,134 @@ function createEditableBlock(options) {
|
|
|
1768
1285
|
} else t0 = $[1];
|
|
1769
1286
|
return t0;
|
|
1770
1287
|
};
|
|
1771
|
-
const
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
};
|
|
1776
|
-
if (owner.outer) return {
|
|
1777
|
-
...owner.outer,
|
|
1778
|
-
nested: {
|
|
1779
|
-
fieldName,
|
|
1780
|
-
recordId
|
|
1781
|
-
}
|
|
1782
|
-
};
|
|
1783
|
-
return {
|
|
1784
|
-
blockId: block.blockId,
|
|
1785
|
-
...owner.itemId == null ? {} : { itemId: owner.itemId },
|
|
1786
|
-
fieldName,
|
|
1787
|
-
recordId
|
|
1788
|
-
};
|
|
1789
|
-
};
|
|
1790
|
-
const usePlacedRecord = (block, owner, fieldName, record) => {
|
|
1791
|
-
const $ = c(37);
|
|
1792
|
-
const selectTarget = usePreviewSelection();
|
|
1793
|
-
const projectUuid = useProjectUuid();
|
|
1794
|
-
const applyEdit = useApplyContentEdit();
|
|
1288
|
+
const usePlacedRecord = (placement) => {
|
|
1289
|
+
const $ = c(15);
|
|
1290
|
+
const editable = useIsEditable();
|
|
1291
|
+
const selectTarget = useSelectTarget();
|
|
1795
1292
|
const [error, setError] = React.useState(null);
|
|
1796
1293
|
const [pointerHovered, setPointerHovered] = React.useState(false);
|
|
1797
|
-
const
|
|
1294
|
+
const target = placement ? {
|
|
1295
|
+
type: "record",
|
|
1296
|
+
...placement
|
|
1297
|
+
} : null;
|
|
1298
|
+
const selected = sameTarget(useEditingSelection(), target);
|
|
1299
|
+
const sidebarHovered = useSidebarHover(target, editable);
|
|
1798
1300
|
let t0;
|
|
1799
|
-
if ($[0] !==
|
|
1800
|
-
t0 =
|
|
1801
|
-
|
|
1802
|
-
$[1] = fieldName;
|
|
1803
|
-
$[2] = owner;
|
|
1804
|
-
$[3] = record;
|
|
1805
|
-
$[4] = t0;
|
|
1806
|
-
} else t0 = $[4];
|
|
1807
|
-
const placement = t0;
|
|
1808
|
-
const selected = useRecordSelection(placement);
|
|
1809
|
-
const { window: iframeWindow } = useFrame();
|
|
1810
|
-
let t1;
|
|
1811
|
-
if ($[5] !== placement) {
|
|
1812
|
-
t1 = placement ? recordPlacementId(placement) : void 0;
|
|
1813
|
-
$[5] = placement;
|
|
1814
|
-
$[6] = t1;
|
|
1815
|
-
} else t1 = $[6];
|
|
1816
|
-
let t2;
|
|
1817
|
-
if ($[7] !== t1) {
|
|
1818
|
-
t2 = { fieldId: t1 };
|
|
1819
|
-
$[7] = t1;
|
|
1820
|
-
$[8] = t2;
|
|
1821
|
-
} else t2 = $[8];
|
|
1822
|
-
const sidebarHovered = useOverlayMessage(iframeWindow, editable, "CAMOX_HOVER_FIELD", "CAMOX_HOVER_FIELD_END", t2);
|
|
1823
|
-
let t3;
|
|
1824
|
-
if ($[9] !== editable || $[10] !== placement || $[11] !== selectTarget) {
|
|
1825
|
-
t3 = (event) => {
|
|
1826
|
-
if (!editable || !placement) return;
|
|
1301
|
+
if ($[0] !== editable || $[1] !== selectTarget || $[2] !== target) {
|
|
1302
|
+
t0 = (event) => {
|
|
1303
|
+
if (!editable || !target) return;
|
|
1827
1304
|
if (event.target.closest("[data-camox-field-id]") !== event.currentTarget) return;
|
|
1828
|
-
selectTarget(
|
|
1829
|
-
type: "record",
|
|
1830
|
-
...placement
|
|
1831
|
-
});
|
|
1305
|
+
selectTarget(target);
|
|
1832
1306
|
};
|
|
1833
|
-
$[
|
|
1834
|
-
$[
|
|
1835
|
-
$[
|
|
1836
|
-
$[
|
|
1837
|
-
} else
|
|
1838
|
-
const selectRecord =
|
|
1839
|
-
let
|
|
1840
|
-
if ($[
|
|
1841
|
-
|
|
1842
|
-
if (!editable || !placement) return;
|
|
1843
|
-
selectTarget({
|
|
1844
|
-
type: "record-field",
|
|
1845
|
-
...placement,
|
|
1846
|
-
recordFieldName,
|
|
1847
|
-
recordFieldType
|
|
1848
|
-
});
|
|
1849
|
-
};
|
|
1850
|
-
$[13] = editable;
|
|
1851
|
-
$[14] = placement;
|
|
1852
|
-
$[15] = selectTarget;
|
|
1853
|
-
$[16] = t4;
|
|
1854
|
-
} else t4 = $[16];
|
|
1855
|
-
const selectRecordField = t4;
|
|
1856
|
-
let t5;
|
|
1857
|
-
if ($[17] !== applyEdit || $[18] !== editable || $[19] !== projectUuid || $[20] !== record) {
|
|
1858
|
-
t5 = (field, value) => {
|
|
1859
|
-
if (!record || !editable) return;
|
|
1307
|
+
$[0] = editable;
|
|
1308
|
+
$[1] = selectTarget;
|
|
1309
|
+
$[2] = target;
|
|
1310
|
+
$[3] = t0;
|
|
1311
|
+
} else t0 = $[3];
|
|
1312
|
+
const selectRecord = t0;
|
|
1313
|
+
let t1;
|
|
1314
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1315
|
+
t1 = (writing) => {
|
|
1860
1316
|
setError(null);
|
|
1861
|
-
|
|
1862
|
-
type: "recordField",
|
|
1863
|
-
projectUuid,
|
|
1864
|
-
record,
|
|
1865
|
-
field,
|
|
1866
|
-
value
|
|
1867
|
-
}).catch((cause) => {
|
|
1317
|
+
writing.catch((cause) => {
|
|
1868
1318
|
setError(cause instanceof Error ? cause.message : "Could not save item");
|
|
1869
1319
|
});
|
|
1870
1320
|
};
|
|
1871
|
-
$[
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
placement,
|
|
1883
|
-
selectRecordField,
|
|
1884
|
-
update
|
|
1885
|
-
} : null;
|
|
1886
|
-
$[22] = placement;
|
|
1887
|
-
$[23] = selectRecordField;
|
|
1888
|
-
$[24] = update;
|
|
1889
|
-
$[25] = t7;
|
|
1890
|
-
} else t7 = $[25];
|
|
1891
|
-
let t8;
|
|
1892
|
-
let t9;
|
|
1893
|
-
if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1894
|
-
t8 = () => setPointerHovered(true);
|
|
1895
|
-
t9 = () => setPointerHovered(false);
|
|
1896
|
-
$[26] = t8;
|
|
1897
|
-
$[27] = t9;
|
|
1321
|
+
$[4] = t1;
|
|
1322
|
+
} else t1 = $[4];
|
|
1323
|
+
const onWrite = t1;
|
|
1324
|
+
const t2 = pointerHovered || sidebarHovered;
|
|
1325
|
+
let t3;
|
|
1326
|
+
let t4;
|
|
1327
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1328
|
+
t3 = () => setPointerHovered(true);
|
|
1329
|
+
t4 = () => setPointerHovered(false);
|
|
1330
|
+
$[5] = t3;
|
|
1331
|
+
$[6] = t4;
|
|
1898
1332
|
} else {
|
|
1899
|
-
|
|
1900
|
-
|
|
1333
|
+
t3 = $[5];
|
|
1334
|
+
t4 = $[6];
|
|
1901
1335
|
}
|
|
1902
|
-
let
|
|
1903
|
-
if ($[
|
|
1904
|
-
|
|
1336
|
+
let t5;
|
|
1337
|
+
if ($[7] !== selectRecord) {
|
|
1338
|
+
t5 = {
|
|
1905
1339
|
onClickCapture: selectRecord,
|
|
1906
|
-
onMouseEnter:
|
|
1907
|
-
onMouseLeave:
|
|
1340
|
+
onMouseEnter: t3,
|
|
1341
|
+
onMouseLeave: t4
|
|
1908
1342
|
};
|
|
1909
|
-
$[
|
|
1910
|
-
$[
|
|
1911
|
-
} else
|
|
1912
|
-
let
|
|
1913
|
-
if ($[
|
|
1914
|
-
|
|
1343
|
+
$[7] = selectRecord;
|
|
1344
|
+
$[8] = t5;
|
|
1345
|
+
} else t5 = $[8];
|
|
1346
|
+
let t6;
|
|
1347
|
+
if ($[9] !== editable || $[10] !== error || $[11] !== selected || $[12] !== t2 || $[13] !== t5) {
|
|
1348
|
+
t6 = {
|
|
1915
1349
|
editable,
|
|
1916
1350
|
error,
|
|
1917
1351
|
selected,
|
|
1918
|
-
hovered:
|
|
1919
|
-
|
|
1920
|
-
wrapperProps:
|
|
1352
|
+
hovered: t2,
|
|
1353
|
+
onWrite,
|
|
1354
|
+
wrapperProps: t5
|
|
1921
1355
|
};
|
|
1922
|
-
$[
|
|
1923
|
-
$[
|
|
1924
|
-
$[
|
|
1925
|
-
$[
|
|
1926
|
-
$[
|
|
1927
|
-
$[
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
return t11;
|
|
1356
|
+
$[9] = editable;
|
|
1357
|
+
$[10] = error;
|
|
1358
|
+
$[11] = selected;
|
|
1359
|
+
$[12] = t2;
|
|
1360
|
+
$[13] = t5;
|
|
1361
|
+
$[14] = t6;
|
|
1362
|
+
} else t6 = $[14];
|
|
1363
|
+
return t6;
|
|
1931
1364
|
};
|
|
1932
1365
|
const RecordScope = (t0) => {
|
|
1933
|
-
const $ = c(
|
|
1934
|
-
const {
|
|
1935
|
-
const
|
|
1366
|
+
const $ = c(21);
|
|
1367
|
+
const { schema, record, placement, placedRecord, children } = t0;
|
|
1368
|
+
const projectUuid = useProjectUuid();
|
|
1369
|
+
let t1;
|
|
1370
|
+
if ($[0] !== placement) {
|
|
1371
|
+
t1 = {
|
|
1372
|
+
kind: "record",
|
|
1373
|
+
placement
|
|
1374
|
+
};
|
|
1375
|
+
$[0] = placement;
|
|
1376
|
+
$[1] = t1;
|
|
1377
|
+
} else t1 = $[1];
|
|
1936
1378
|
let t2;
|
|
1937
|
-
if ($[
|
|
1379
|
+
if ($[2] !== projectUuid || $[3] !== record) {
|
|
1938
1380
|
t2 = {
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1381
|
+
kind: "record",
|
|
1382
|
+
record,
|
|
1383
|
+
projectUuid
|
|
1942
1384
|
};
|
|
1943
|
-
$[
|
|
1944
|
-
$[
|
|
1945
|
-
$[
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
let
|
|
1949
|
-
if ($[
|
|
1950
|
-
|
|
1385
|
+
$[2] = projectUuid;
|
|
1386
|
+
$[3] = record;
|
|
1387
|
+
$[4] = t2;
|
|
1388
|
+
} else t2 = $[4];
|
|
1389
|
+
const t3 = record.content;
|
|
1390
|
+
let t4;
|
|
1391
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1392
|
+
t4 = {};
|
|
1393
|
+
$[5] = t4;
|
|
1394
|
+
} else t4 = $[5];
|
|
1395
|
+
let t5;
|
|
1396
|
+
if ($[6] !== placedRecord.onWrite || $[7] !== schema || $[8] !== t1 || $[9] !== t2 || $[10] !== t3) {
|
|
1397
|
+
t5 = {
|
|
1398
|
+
owner: t1,
|
|
1399
|
+
target: t2,
|
|
1400
|
+
content: t3,
|
|
1401
|
+
settings: t4,
|
|
1402
|
+
schema,
|
|
1403
|
+
synced: false,
|
|
1404
|
+
onWrite: placedRecord.onWrite
|
|
1405
|
+
};
|
|
1406
|
+
$[6] = placedRecord.onWrite;
|
|
1407
|
+
$[7] = schema;
|
|
1408
|
+
$[8] = t1;
|
|
1409
|
+
$[9] = t2;
|
|
1410
|
+
$[10] = t3;
|
|
1411
|
+
$[11] = t5;
|
|
1412
|
+
} else t5 = $[11];
|
|
1413
|
+
let t6;
|
|
1414
|
+
if ($[12] !== children || $[13] !== placement.nested || $[14] !== record.description || $[15] !== record.id || $[16] !== record.title) {
|
|
1415
|
+
t6 = children({
|
|
1951
1416
|
id: record.id,
|
|
1952
1417
|
title: record.title,
|
|
1953
1418
|
description: record.description,
|
|
@@ -1957,303 +1422,268 @@ function createEditableBlock(options) {
|
|
|
1957
1422
|
Embed: ReferenceEmbed,
|
|
1958
1423
|
ImageList: ReferenceImageList,
|
|
1959
1424
|
FileList: ReferenceFileList,
|
|
1960
|
-
...
|
|
1425
|
+
...placement.nested ? {} : {
|
|
1961
1426
|
Reference,
|
|
1962
1427
|
ReferenceList
|
|
1963
1428
|
}
|
|
1964
1429
|
});
|
|
1965
|
-
$[
|
|
1966
|
-
$[
|
|
1967
|
-
$[
|
|
1968
|
-
$[
|
|
1969
|
-
$[
|
|
1970
|
-
$[
|
|
1971
|
-
} else
|
|
1972
|
-
let
|
|
1973
|
-
if ($[
|
|
1974
|
-
|
|
1975
|
-
value:
|
|
1976
|
-
children:
|
|
1977
|
-
value: t2,
|
|
1978
|
-
children: t3
|
|
1979
|
-
})
|
|
1980
|
-
});
|
|
1981
|
-
$[10] = t2;
|
|
1982
|
-
$[11] = t3;
|
|
1983
|
-
$[12] = t4;
|
|
1984
|
-
} else t4 = $[12];
|
|
1985
|
-
let t5;
|
|
1986
|
-
if ($[13] !== reference || $[14] !== t4) {
|
|
1987
|
-
t5 = /* @__PURE__ */ jsx(ReferenceContext.Provider, {
|
|
1988
|
-
value: reference,
|
|
1989
|
-
children: t4
|
|
1430
|
+
$[12] = children;
|
|
1431
|
+
$[13] = placement.nested;
|
|
1432
|
+
$[14] = record.description;
|
|
1433
|
+
$[15] = record.id;
|
|
1434
|
+
$[16] = record.title;
|
|
1435
|
+
$[17] = t6;
|
|
1436
|
+
} else t6 = $[17];
|
|
1437
|
+
let t7;
|
|
1438
|
+
if ($[18] !== t5 || $[19] !== t6) {
|
|
1439
|
+
t7 = /* @__PURE__ */ jsx(FieldScopeContext, {
|
|
1440
|
+
value: t5,
|
|
1441
|
+
children: t6
|
|
1990
1442
|
});
|
|
1991
|
-
$[
|
|
1992
|
-
$[
|
|
1993
|
-
$[
|
|
1994
|
-
} else
|
|
1995
|
-
return
|
|
1996
|
-
};
|
|
1997
|
-
const useReferenceField = (block, fieldName) => {
|
|
1998
|
-
const item = React.use(RepeatableItemContext);
|
|
1999
|
-
const outer = React.use(ReferenceContext)?.placement ?? null;
|
|
2000
|
-
const owner = {
|
|
2001
|
-
itemId: item?.itemId,
|
|
2002
|
-
outer
|
|
2003
|
-
};
|
|
2004
|
-
const fieldType = "Reference";
|
|
2005
|
-
const recordFieldSelected = useRecordSelection(outer, fieldName);
|
|
2006
|
-
const blockFieldSelected = useFieldSelection(block.blockId, fieldName, fieldType, owner.itemId);
|
|
2007
|
-
return {
|
|
2008
|
-
owner,
|
|
2009
|
-
field: item ? item.itemSchema?.[fieldName] : (block.sourceSchema ?? typeboxSchema.properties)[fieldName],
|
|
2010
|
-
stored: item ? item.itemContent[fieldName] : block.content[fieldName],
|
|
2011
|
-
fieldId: outer ? overlayFieldId(block.blockId, fieldName, { placement: outer }) : overlayFieldId(block.blockId, fieldName, { itemId: owner.itemId }),
|
|
2012
|
-
fieldSelected: outer ? recordFieldSelected : blockFieldSelected
|
|
2013
|
-
};
|
|
1443
|
+
$[18] = t5;
|
|
1444
|
+
$[19] = t6;
|
|
1445
|
+
$[20] = t7;
|
|
1446
|
+
} else t7 = $[20];
|
|
1447
|
+
return t7;
|
|
2014
1448
|
};
|
|
2015
1449
|
const PlacedRecordWrapper = (t0) => {
|
|
2016
|
-
const $ = c(
|
|
2017
|
-
const { fieldId, record, placedRecord,
|
|
2018
|
-
|
|
1450
|
+
const $ = c(11);
|
|
1451
|
+
const { fieldId, record, placedRecord, hovered, focused, children } = t0;
|
|
1452
|
+
const t1 = hovered || void 0;
|
|
1453
|
+
const t2 = focused || void 0;
|
|
1454
|
+
let t3;
|
|
2019
1455
|
if ($[0] !== placedRecord.error) {
|
|
2020
|
-
|
|
1456
|
+
t3 = placedRecord.error && /* @__PURE__ */ jsxs("p", {
|
|
2021
1457
|
role: "alert",
|
|
2022
1458
|
children: ["Could not save item. ", placedRecord.error]
|
|
2023
1459
|
});
|
|
2024
1460
|
$[0] = placedRecord.error;
|
|
2025
|
-
$[1] =
|
|
2026
|
-
} else
|
|
2027
|
-
let
|
|
2028
|
-
if ($[2] !== children || $[3] !== fieldId || $[4] !==
|
|
2029
|
-
|
|
1461
|
+
$[1] = t3;
|
|
1462
|
+
} else t3 = $[1];
|
|
1463
|
+
let t4;
|
|
1464
|
+
if ($[2] !== children || $[3] !== fieldId || $[4] !== placedRecord.wrapperProps || $[5] !== record.id || $[6] !== record.title || $[7] !== t1 || $[8] !== t2 || $[9] !== t3) {
|
|
1465
|
+
t4 = /* @__PURE__ */ jsxs("div", {
|
|
2030
1466
|
"data-camox-field-id": fieldId,
|
|
2031
1467
|
"data-camox-collection-record-id": record.id,
|
|
2032
1468
|
"data-camox-reference-label": record.title,
|
|
2033
1469
|
"data-camox-overlay-mode": "reference",
|
|
2034
|
-
|
|
1470
|
+
"data-camox-hovered": t1,
|
|
1471
|
+
"data-camox-focused": t2,
|
|
2035
1472
|
...placedRecord.wrapperProps,
|
|
2036
|
-
children: [children,
|
|
1473
|
+
children: [children, t3]
|
|
2037
1474
|
});
|
|
2038
1475
|
$[2] = children;
|
|
2039
1476
|
$[3] = fieldId;
|
|
2040
|
-
$[4] =
|
|
2041
|
-
$[5] =
|
|
2042
|
-
$[6] = record.
|
|
2043
|
-
$[7] =
|
|
2044
|
-
$[8] =
|
|
2045
|
-
$[9] =
|
|
2046
|
-
|
|
2047
|
-
|
|
1477
|
+
$[4] = placedRecord.wrapperProps;
|
|
1478
|
+
$[5] = record.id;
|
|
1479
|
+
$[6] = record.title;
|
|
1480
|
+
$[7] = t1;
|
|
1481
|
+
$[8] = t2;
|
|
1482
|
+
$[9] = t3;
|
|
1483
|
+
$[10] = t4;
|
|
1484
|
+
} else t4 = $[10];
|
|
1485
|
+
return t4;
|
|
2048
1486
|
};
|
|
2049
1487
|
const ReferenceImpl = (t0) => {
|
|
2050
|
-
const $ = c(
|
|
1488
|
+
const $ = c(20);
|
|
2051
1489
|
const { name, children } = t0;
|
|
2052
|
-
const
|
|
1490
|
+
const scope = useScope("Reference");
|
|
2053
1491
|
const { recordsMap } = useNormalizedData();
|
|
2054
|
-
const { window: iframeWindow } = useFrame();
|
|
2055
|
-
if (!block) throw new Error("Reference must be used within a Block Component");
|
|
2056
1492
|
const fieldName = String(name);
|
|
2057
|
-
const
|
|
1493
|
+
const field = useFieldSlot(fieldName, "Reference");
|
|
1494
|
+
let record;
|
|
2058
1495
|
let t1;
|
|
2059
|
-
if ($[0] !== field.collectionId || $[1] !==
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
$[
|
|
2063
|
-
$[
|
|
2064
|
-
$[
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
1496
|
+
if ($[0] !== field.schema.collectionId || $[1] !== field.value || $[2] !== fieldName || $[3] !== recordsMap || $[4] !== scope) {
|
|
1497
|
+
record = resolveReference(field.value, field.schema.collectionId, recordsMap);
|
|
1498
|
+
t1 = record ? placementThrough(scope.owner, fieldName, record.id) : null;
|
|
1499
|
+
$[0] = field.schema.collectionId;
|
|
1500
|
+
$[1] = field.value;
|
|
1501
|
+
$[2] = fieldName;
|
|
1502
|
+
$[3] = recordsMap;
|
|
1503
|
+
$[4] = scope;
|
|
1504
|
+
$[5] = record;
|
|
1505
|
+
$[6] = t1;
|
|
1506
|
+
} else {
|
|
1507
|
+
record = $[5];
|
|
1508
|
+
t1 = $[6];
|
|
1509
|
+
}
|
|
1510
|
+
const placement = t1;
|
|
1511
|
+
const placedRecord = usePlacedRecord(placement);
|
|
1512
|
+
if (!record || !placement) return null;
|
|
2069
1513
|
let t2;
|
|
2070
|
-
if ($[
|
|
2071
|
-
t2 =
|
|
2072
|
-
|
|
2073
|
-
$[5] = t2;
|
|
2074
|
-
} else t2 = $[5];
|
|
2075
|
-
const fieldHovered = useOverlayMessage(iframeWindow, editable, "CAMOX_HOVER_FIELD", "CAMOX_HOVER_FIELD_END", t2);
|
|
2076
|
-
const overlay = useOverlayState(placedRecord.hovered || fieldHovered, fieldSelected || placedRecord.selected);
|
|
2077
|
-
if (!record || !placedRecord.reference) return null;
|
|
2078
|
-
let t3;
|
|
2079
|
-
if ($[6] !== block || $[7] !== children || $[8] !== field || $[9] !== placedRecord.reference || $[10] !== record) {
|
|
2080
|
-
t3 = /* @__PURE__ */ jsx(RecordScope, {
|
|
2081
|
-
block,
|
|
2082
|
-
field,
|
|
1514
|
+
if ($[7] !== children || $[8] !== field.schema.referenceSchema.properties || $[9] !== placedRecord || $[10] !== placement || $[11] !== record) {
|
|
1515
|
+
t2 = /* @__PURE__ */ jsx(RecordScope, {
|
|
1516
|
+
schema: field.schema.referenceSchema.properties,
|
|
2083
1517
|
record,
|
|
2084
|
-
|
|
1518
|
+
placement,
|
|
1519
|
+
placedRecord,
|
|
2085
1520
|
children
|
|
2086
1521
|
});
|
|
2087
|
-
$[6] = block;
|
|
2088
1522
|
$[7] = children;
|
|
2089
|
-
$[8] = field;
|
|
2090
|
-
$[9] = placedRecord
|
|
2091
|
-
$[10] =
|
|
2092
|
-
$[11] =
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
1523
|
+
$[8] = field.schema.referenceSchema.properties;
|
|
1524
|
+
$[9] = placedRecord;
|
|
1525
|
+
$[10] = placement;
|
|
1526
|
+
$[11] = record;
|
|
1527
|
+
$[12] = t2;
|
|
1528
|
+
} else t2 = $[12];
|
|
1529
|
+
const rendered = t2;
|
|
1530
|
+
if (!field.editable) return rendered;
|
|
1531
|
+
const t3 = placedRecord.hovered || field.hovered;
|
|
1532
|
+
const t4 = field.selected || placedRecord.selected;
|
|
1533
|
+
let t5;
|
|
1534
|
+
if ($[13] !== field.id || $[14] !== placedRecord || $[15] !== record || $[16] !== rendered || $[17] !== t3 || $[18] !== t4) {
|
|
1535
|
+
t5 = /* @__PURE__ */ jsx(PlacedRecordWrapper, {
|
|
1536
|
+
fieldId: field.id,
|
|
2100
1537
|
record,
|
|
2101
1538
|
placedRecord,
|
|
2102
|
-
|
|
1539
|
+
hovered: t3,
|
|
1540
|
+
focused: t4,
|
|
2103
1541
|
children: rendered
|
|
2104
1542
|
});
|
|
2105
|
-
$[
|
|
2106
|
-
$[13] = overlay;
|
|
1543
|
+
$[13] = field.id;
|
|
2107
1544
|
$[14] = placedRecord;
|
|
2108
1545
|
$[15] = record;
|
|
2109
1546
|
$[16] = rendered;
|
|
2110
|
-
$[17] =
|
|
2111
|
-
|
|
2112
|
-
|
|
1547
|
+
$[17] = t3;
|
|
1548
|
+
$[18] = t4;
|
|
1549
|
+
$[19] = t5;
|
|
1550
|
+
} else t5 = $[19];
|
|
1551
|
+
return t5;
|
|
2113
1552
|
};
|
|
2114
1553
|
const Reference = ReferenceImpl;
|
|
2115
1554
|
const ListedRecord = (t0) => {
|
|
2116
1555
|
const $ = c(14);
|
|
2117
|
-
const {
|
|
2118
|
-
const placedRecord = usePlacedRecord(
|
|
2119
|
-
const overlay = useOverlayState(placedRecord.hovered || listHovered, placedRecord.selected);
|
|
2120
|
-
if (!placedRecord.reference) return null;
|
|
1556
|
+
const { placement, schema, record, listHovered, children } = t0;
|
|
1557
|
+
const placedRecord = usePlacedRecord(placement);
|
|
2121
1558
|
let t1;
|
|
2122
|
-
if ($[0] !==
|
|
1559
|
+
if ($[0] !== children || $[1] !== placedRecord || $[2] !== placement || $[3] !== record || $[4] !== schema) {
|
|
2123
1560
|
t1 = /* @__PURE__ */ jsx(RecordScope, {
|
|
2124
|
-
|
|
2125
|
-
field,
|
|
1561
|
+
schema,
|
|
2126
1562
|
record,
|
|
2127
|
-
|
|
1563
|
+
placement,
|
|
1564
|
+
placedRecord,
|
|
2128
1565
|
children
|
|
2129
1566
|
});
|
|
2130
|
-
$[0] =
|
|
2131
|
-
$[1] =
|
|
2132
|
-
$[2] =
|
|
2133
|
-
$[3] =
|
|
2134
|
-
$[4] =
|
|
1567
|
+
$[0] = children;
|
|
1568
|
+
$[1] = placedRecord;
|
|
1569
|
+
$[2] = placement;
|
|
1570
|
+
$[3] = record;
|
|
1571
|
+
$[4] = schema;
|
|
2135
1572
|
$[5] = t1;
|
|
2136
1573
|
} else t1 = $[5];
|
|
2137
1574
|
const rendered = t1;
|
|
2138
1575
|
if (!placedRecord.editable) return rendered;
|
|
2139
1576
|
let t2;
|
|
2140
|
-
if ($[6] !==
|
|
2141
|
-
t2 =
|
|
2142
|
-
$[6] =
|
|
1577
|
+
if ($[6] !== placement) {
|
|
1578
|
+
t2 = placementId(placement);
|
|
1579
|
+
$[6] = placement;
|
|
2143
1580
|
$[7] = t2;
|
|
2144
1581
|
} else t2 = $[7];
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
1582
|
+
const t3 = placedRecord.hovered || listHovered;
|
|
1583
|
+
let t4;
|
|
1584
|
+
if ($[8] !== placedRecord || $[9] !== record || $[10] !== rendered || $[11] !== t2 || $[12] !== t3) {
|
|
1585
|
+
t4 = /* @__PURE__ */ jsx(PlacedRecordWrapper, {
|
|
2148
1586
|
fieldId: t2,
|
|
2149
1587
|
record,
|
|
2150
1588
|
placedRecord,
|
|
2151
|
-
|
|
1589
|
+
hovered: t3,
|
|
1590
|
+
focused: placedRecord.selected,
|
|
2152
1591
|
children: rendered
|
|
2153
1592
|
});
|
|
2154
|
-
$[8] =
|
|
2155
|
-
$[9] =
|
|
2156
|
-
$[10] =
|
|
2157
|
-
$[11] =
|
|
2158
|
-
$[12] =
|
|
2159
|
-
$[13] =
|
|
2160
|
-
} else
|
|
2161
|
-
return
|
|
1593
|
+
$[8] = placedRecord;
|
|
1594
|
+
$[9] = record;
|
|
1595
|
+
$[10] = rendered;
|
|
1596
|
+
$[11] = t2;
|
|
1597
|
+
$[12] = t3;
|
|
1598
|
+
$[13] = t4;
|
|
1599
|
+
} else t4 = $[13];
|
|
1600
|
+
return t4;
|
|
2162
1601
|
};
|
|
2163
1602
|
const LayoutRecord = (t0) => {
|
|
2164
|
-
const $ = c(
|
|
1603
|
+
const $ = c(21);
|
|
2165
1604
|
const { layoutId, record, properties, children } = t0;
|
|
2166
|
-
|
|
2167
|
-
let t2;
|
|
1605
|
+
let t1;
|
|
2168
1606
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
2169
|
-
|
|
2170
|
-
$[0] =
|
|
2171
|
-
} else
|
|
2172
|
-
let
|
|
2173
|
-
if ($[1]
|
|
2174
|
-
|
|
1607
|
+
t1 = {};
|
|
1608
|
+
$[0] = t1;
|
|
1609
|
+
} else t1 = $[0];
|
|
1610
|
+
let t2;
|
|
1611
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1612
|
+
t2 = {
|
|
2175
1613
|
blockId: "",
|
|
2176
|
-
|
|
2177
|
-
sourceSchema: properties,
|
|
2178
|
-
settings: t2,
|
|
1614
|
+
settings: t1,
|
|
2179
1615
|
isHovered: false,
|
|
2180
1616
|
setIsHovered: _temp8
|
|
2181
1617
|
};
|
|
2182
|
-
$[1] =
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
itemId: void 0,
|
|
2191
|
-
outer: null,
|
|
2192
|
-
layoutId
|
|
1618
|
+
$[1] = t2;
|
|
1619
|
+
} else t2 = $[1];
|
|
1620
|
+
const block = t2;
|
|
1621
|
+
let t3;
|
|
1622
|
+
if ($[2] !== layoutId || $[3] !== record.id) {
|
|
1623
|
+
t3 = {
|
|
1624
|
+
layoutId,
|
|
1625
|
+
recordId: record.id
|
|
2193
1626
|
};
|
|
2194
|
-
$[
|
|
2195
|
-
$[
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
const
|
|
2199
|
-
|
|
2200
|
-
let
|
|
2201
|
-
if ($[6] !== properties) {
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
$[7] = t5;
|
|
2205
|
-
} else t5 = $[7];
|
|
2206
|
-
let t6;
|
|
2207
|
-
if ($[8] !== block || $[9] !== children || $[10] !== placedRecord.reference || $[11] !== record || $[12] !== t5) {
|
|
2208
|
-
t6 = /* @__PURE__ */ jsx(RecordScope, {
|
|
2209
|
-
block,
|
|
2210
|
-
field: t5,
|
|
1627
|
+
$[2] = layoutId;
|
|
1628
|
+
$[3] = record.id;
|
|
1629
|
+
$[4] = t3;
|
|
1630
|
+
} else t3 = $[4];
|
|
1631
|
+
const placement = t3;
|
|
1632
|
+
const placedRecord = usePlacedRecord(placement);
|
|
1633
|
+
let t4;
|
|
1634
|
+
if ($[5] !== children || $[6] !== placedRecord || $[7] !== placement || $[8] !== properties || $[9] !== record) {
|
|
1635
|
+
t4 = /* @__PURE__ */ jsx(RecordScope, {
|
|
1636
|
+
schema: properties,
|
|
2211
1637
|
record,
|
|
2212
|
-
|
|
1638
|
+
placement,
|
|
1639
|
+
placedRecord,
|
|
2213
1640
|
children
|
|
2214
1641
|
});
|
|
2215
|
-
$[
|
|
2216
|
-
$[
|
|
2217
|
-
$[
|
|
2218
|
-
$[
|
|
2219
|
-
$[
|
|
2220
|
-
$[
|
|
2221
|
-
} else
|
|
2222
|
-
let
|
|
2223
|
-
if ($[
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
children:
|
|
1642
|
+
$[5] = children;
|
|
1643
|
+
$[6] = placedRecord;
|
|
1644
|
+
$[7] = placement;
|
|
1645
|
+
$[8] = properties;
|
|
1646
|
+
$[9] = record;
|
|
1647
|
+
$[10] = t4;
|
|
1648
|
+
} else t4 = $[10];
|
|
1649
|
+
let t5;
|
|
1650
|
+
if ($[11] !== record.references || $[12] !== t4) {
|
|
1651
|
+
t5 = /* @__PURE__ */ jsx(Context.Provider, {
|
|
1652
|
+
value: block,
|
|
1653
|
+
children: /* @__PURE__ */ jsx(LinkedRecordsProvider, {
|
|
1654
|
+
references: record.references,
|
|
1655
|
+
children: t4
|
|
1656
|
+
})
|
|
2227
1657
|
});
|
|
2228
|
-
$[
|
|
2229
|
-
$[
|
|
2230
|
-
$[
|
|
2231
|
-
} else
|
|
2232
|
-
const rendered =
|
|
1658
|
+
$[11] = record.references;
|
|
1659
|
+
$[12] = t4;
|
|
1660
|
+
$[13] = t5;
|
|
1661
|
+
} else t5 = $[13];
|
|
1662
|
+
const rendered = t5;
|
|
2233
1663
|
if (!placedRecord.editable) return rendered;
|
|
2234
|
-
let
|
|
2235
|
-
if ($[
|
|
2236
|
-
|
|
2237
|
-
$[
|
|
2238
|
-
$[
|
|
2239
|
-
} else
|
|
2240
|
-
let
|
|
2241
|
-
if ($[
|
|
2242
|
-
|
|
2243
|
-
fieldId:
|
|
1664
|
+
let t6;
|
|
1665
|
+
if ($[14] !== placement) {
|
|
1666
|
+
t6 = placementId(placement);
|
|
1667
|
+
$[14] = placement;
|
|
1668
|
+
$[15] = t6;
|
|
1669
|
+
} else t6 = $[15];
|
|
1670
|
+
let t7;
|
|
1671
|
+
if ($[16] !== placedRecord || $[17] !== record || $[18] !== rendered || $[19] !== t6) {
|
|
1672
|
+
t7 = /* @__PURE__ */ jsx(PlacedRecordWrapper, {
|
|
1673
|
+
fieldId: t6,
|
|
2244
1674
|
record,
|
|
2245
1675
|
placedRecord,
|
|
2246
|
-
|
|
1676
|
+
hovered: placedRecord.hovered,
|
|
1677
|
+
focused: placedRecord.selected,
|
|
2247
1678
|
children: rendered
|
|
2248
1679
|
});
|
|
2249
|
-
$[
|
|
2250
|
-
$[
|
|
2251
|
-
$[
|
|
2252
|
-
$[
|
|
2253
|
-
$[
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
return t9;
|
|
1680
|
+
$[16] = placedRecord;
|
|
1681
|
+
$[17] = record;
|
|
1682
|
+
$[18] = rendered;
|
|
1683
|
+
$[19] = t6;
|
|
1684
|
+
$[20] = t7;
|
|
1685
|
+
} else t7 = $[20];
|
|
1686
|
+
return t7;
|
|
2257
1687
|
};
|
|
2258
1688
|
const LayoutItem = (t0) => {
|
|
2259
1689
|
const $ = c(9);
|
|
@@ -2291,119 +1721,85 @@ function createEditableBlock(options) {
|
|
|
2291
1721
|
return t3;
|
|
2292
1722
|
};
|
|
2293
1723
|
const ReferenceListImpl = (t0) => {
|
|
2294
|
-
const $ = c(
|
|
1724
|
+
const $ = c(22);
|
|
2295
1725
|
const { name, children } = t0;
|
|
2296
1726
|
const block = React.use(Context);
|
|
1727
|
+
const scope = useScope("ReferenceList");
|
|
2297
1728
|
const normalizedData = useNormalizedData();
|
|
2298
1729
|
const { recordsMap } = normalizedData;
|
|
2299
|
-
const { window: iframeWindow } = useFrame();
|
|
2300
1730
|
if (!block) throw new Error("ReferenceList must be used within a Block Component");
|
|
2301
|
-
const editable = useIsEditable();
|
|
2302
1731
|
const fieldName = String(name);
|
|
2303
|
-
const
|
|
1732
|
+
const field = useFieldSlot(fieldName, "ReferenceList");
|
|
1733
|
+
const itemId = scope.owner.kind === "item" ? scope.owner.itemId : void 0;
|
|
2304
1734
|
let t1;
|
|
2305
|
-
if ($[0] !==
|
|
2306
|
-
t1 =
|
|
2307
|
-
$[0] = fieldId;
|
|
2308
|
-
$[1] = t1;
|
|
2309
|
-
} else t1 = $[1];
|
|
2310
|
-
const listHovered = useOverlayMessage(iframeWindow, editable, "CAMOX_HOVER_FIELD", "CAMOX_HOVER_FIELD_END", t1);
|
|
2311
|
-
let t2;
|
|
2312
|
-
if ($[2] !== block || $[3] !== field || $[4] !== fieldName || $[5] !== normalizedData || $[6] !== owner || $[7] !== stored) {
|
|
2313
|
-
t2 = isQueryBacked(field) ? queryResultIds(normalizedData, {
|
|
1735
|
+
if ($[0] !== block || $[1] !== field.schema || $[2] !== field.value || $[3] !== fieldName || $[4] !== itemId || $[5] !== normalizedData) {
|
|
1736
|
+
t1 = isQueryBacked(field.schema) ? queryResultIds(normalizedData, {
|
|
2314
1737
|
blockId: block.blockId,
|
|
2315
|
-
itemId
|
|
2316
|
-
}, fieldName) :
|
|
2317
|
-
$[
|
|
2318
|
-
$[
|
|
2319
|
-
$[
|
|
1738
|
+
itemId
|
|
1739
|
+
}, fieldName) : field.value;
|
|
1740
|
+
$[0] = block;
|
|
1741
|
+
$[1] = field.schema;
|
|
1742
|
+
$[2] = field.value;
|
|
1743
|
+
$[3] = fieldName;
|
|
1744
|
+
$[4] = itemId;
|
|
2320
1745
|
$[5] = normalizedData;
|
|
2321
|
-
$[6] =
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
owner,
|
|
2334
|
-
field,
|
|
2335
|
-
fieldName,
|
|
1746
|
+
$[6] = t1;
|
|
1747
|
+
} else t1 = $[6];
|
|
1748
|
+
const ids = t1;
|
|
1749
|
+
let t2;
|
|
1750
|
+
if ($[7] !== children || $[8] !== field.hovered || $[9] !== field.schema.collectionId || $[10] !== field.schema.referenceSchema.properties || $[11] !== fieldName || $[12] !== ids || $[13] !== recordsMap || $[14] !== scope.owner) {
|
|
1751
|
+
const records = resolveReferenceList(ids, field.schema.collectionId, recordsMap);
|
|
1752
|
+
const schema = field.schema.referenceSchema.properties;
|
|
1753
|
+
let t3;
|
|
1754
|
+
if ($[16] !== children || $[17] !== field.hovered || $[18] !== fieldName || $[19] !== schema || $[20] !== scope.owner) {
|
|
1755
|
+
t3 = (record) => /* @__PURE__ */ jsx(ListedRecord, {
|
|
1756
|
+
placement: placementThrough(scope.owner, fieldName, record.id),
|
|
1757
|
+
schema,
|
|
2336
1758
|
record,
|
|
2337
|
-
listHovered,
|
|
1759
|
+
listHovered: field.hovered,
|
|
2338
1760
|
children
|
|
2339
1761
|
}, record.id);
|
|
2340
|
-
$[
|
|
2341
|
-
$[
|
|
2342
|
-
$[
|
|
2343
|
-
$[
|
|
2344
|
-
$[
|
|
2345
|
-
$[
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
$[
|
|
2350
|
-
$[
|
|
2351
|
-
$[
|
|
2352
|
-
$[
|
|
2353
|
-
$[
|
|
2354
|
-
$[
|
|
2355
|
-
$[
|
|
2356
|
-
$[
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
return t3;
|
|
1762
|
+
$[16] = children;
|
|
1763
|
+
$[17] = field.hovered;
|
|
1764
|
+
$[18] = fieldName;
|
|
1765
|
+
$[19] = schema;
|
|
1766
|
+
$[20] = scope.owner;
|
|
1767
|
+
$[21] = t3;
|
|
1768
|
+
} else t3 = $[21];
|
|
1769
|
+
t2 = records.map(t3);
|
|
1770
|
+
$[7] = children;
|
|
1771
|
+
$[8] = field.hovered;
|
|
1772
|
+
$[9] = field.schema.collectionId;
|
|
1773
|
+
$[10] = field.schema.referenceSchema.properties;
|
|
1774
|
+
$[11] = fieldName;
|
|
1775
|
+
$[12] = ids;
|
|
1776
|
+
$[13] = recordsMap;
|
|
1777
|
+
$[14] = scope.owner;
|
|
1778
|
+
$[15] = t2;
|
|
1779
|
+
} else t2 = $[15];
|
|
1780
|
+
return t2;
|
|
2360
1781
|
};
|
|
2361
1782
|
const ReferenceList = ReferenceListImpl;
|
|
2362
1783
|
const Detached = (t0) => {
|
|
2363
|
-
const $ = c(
|
|
1784
|
+
const $ = c(24);
|
|
2364
1785
|
const { children } = t0;
|
|
2365
1786
|
const ctx = React.use(Context);
|
|
2366
1787
|
if (!ctx) throw new Error("Detached must be used within a Block Component");
|
|
2367
1788
|
const { blockId, isHovered, setIsHovered } = ctx;
|
|
2368
1789
|
const isContentEditable = useIsEditable();
|
|
2369
|
-
const
|
|
2370
|
-
const
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
$[
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
const overlayState = useOverlayState(isHovered, t1 === blockId);
|
|
2379
|
-
const t2 = String(blockId);
|
|
2380
|
-
let t3;
|
|
2381
|
-
if ($[2] !== t2) {
|
|
2382
|
-
t3 = { blockId: t2 };
|
|
2383
|
-
$[2] = t2;
|
|
2384
|
-
$[3] = t3;
|
|
2385
|
-
} else t3 = $[3];
|
|
2386
|
-
const isHoveredFromSidebar = useOverlayMessage(iframeWindow, isContentEditable, "CAMOX_HOVER_BLOCK", "CAMOX_HOVER_BLOCK_END", t3);
|
|
2387
|
-
let t4;
|
|
2388
|
-
let t5;
|
|
2389
|
-
if ($[4] !== isHoveredFromSidebar || $[5] !== setIsHovered) {
|
|
2390
|
-
t4 = () => {
|
|
2391
|
-
setIsHovered(isHoveredFromSidebar);
|
|
2392
|
-
};
|
|
2393
|
-
t5 = [isHoveredFromSidebar, setIsHovered];
|
|
2394
|
-
$[4] = isHoveredFromSidebar;
|
|
2395
|
-
$[5] = setIsHovered;
|
|
2396
|
-
$[6] = t4;
|
|
2397
|
-
$[7] = t5;
|
|
2398
|
-
} else {
|
|
2399
|
-
t4 = $[6];
|
|
2400
|
-
t5 = $[7];
|
|
2401
|
-
}
|
|
2402
|
-
React.useEffect(t4, t5);
|
|
1790
|
+
const selectTarget = useSelectTarget();
|
|
1791
|
+
const t1 = useEditingSelection();
|
|
1792
|
+
let t2;
|
|
1793
|
+
if ($[0] !== t1) {
|
|
1794
|
+
t2 = selectionBlockId(t1);
|
|
1795
|
+
$[0] = t1;
|
|
1796
|
+
$[1] = t2;
|
|
1797
|
+
} else t2 = $[1];
|
|
1798
|
+
const overlayState = useOverlayState(isHovered, t2 === blockId);
|
|
2403
1799
|
const shouldShowOverlay = isContentEditable && (overlayState["data-camox-hovered"] || overlayState["data-camox-focused"]);
|
|
2404
|
-
let
|
|
2405
|
-
if ($[
|
|
2406
|
-
|
|
1800
|
+
let t3;
|
|
1801
|
+
if ($[2] !== blockId || $[3] !== isContentEditable || $[4] !== selectTarget) {
|
|
1802
|
+
t3 = (e) => {
|
|
2407
1803
|
if (!isContentEditable) return;
|
|
2408
1804
|
const target = e.target;
|
|
2409
1805
|
if (target.closest("[data-camox-field-id]")) return;
|
|
@@ -2413,65 +1809,65 @@ function createEditableBlock(options) {
|
|
|
2413
1809
|
blockId
|
|
2414
1810
|
});
|
|
2415
1811
|
};
|
|
2416
|
-
$[
|
|
2417
|
-
$[
|
|
2418
|
-
$[
|
|
2419
|
-
$[
|
|
2420
|
-
} else
|
|
2421
|
-
const handleClick =
|
|
2422
|
-
let
|
|
2423
|
-
if ($[
|
|
2424
|
-
|
|
1812
|
+
$[2] = blockId;
|
|
1813
|
+
$[3] = isContentEditable;
|
|
1814
|
+
$[4] = selectTarget;
|
|
1815
|
+
$[5] = t3;
|
|
1816
|
+
} else t3 = $[5];
|
|
1817
|
+
const handleClick = t3;
|
|
1818
|
+
let t4;
|
|
1819
|
+
if ($[6] !== isContentEditable || $[7] !== setIsHovered) {
|
|
1820
|
+
t4 = () => {
|
|
2425
1821
|
if (isContentEditable) setIsHovered(true);
|
|
2426
1822
|
};
|
|
2427
|
-
$[
|
|
2428
|
-
$[
|
|
1823
|
+
$[6] = isContentEditable;
|
|
1824
|
+
$[7] = setIsHovered;
|
|
1825
|
+
$[8] = t4;
|
|
1826
|
+
} else t4 = $[8];
|
|
1827
|
+
const handleMouseEnter = t4;
|
|
1828
|
+
let t5;
|
|
1829
|
+
if ($[9] !== isContentEditable || $[10] !== setIsHovered) {
|
|
1830
|
+
t5 = () => {
|
|
1831
|
+
if (isContentEditable) setIsHovered(false);
|
|
1832
|
+
};
|
|
1833
|
+
$[9] = isContentEditable;
|
|
1834
|
+
$[10] = setIsHovered;
|
|
1835
|
+
$[11] = t5;
|
|
1836
|
+
} else t5 = $[11];
|
|
1837
|
+
const handleMouseLeave = t5;
|
|
1838
|
+
const t6 = isContentEditable ? blockId : void 0;
|
|
1839
|
+
let t7;
|
|
1840
|
+
if ($[12] !== overlayState || $[13] !== shouldShowOverlay) {
|
|
1841
|
+
t7 = shouldShowOverlay ? overlayState : {};
|
|
1842
|
+
$[12] = overlayState;
|
|
1843
|
+
$[13] = shouldShowOverlay;
|
|
2429
1844
|
$[14] = t7;
|
|
2430
1845
|
} else t7 = $[14];
|
|
2431
|
-
const handleMouseEnter = t7;
|
|
2432
1846
|
let t8;
|
|
2433
|
-
if ($[15] !==
|
|
2434
|
-
t8 = (
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
$[15] = isContentEditable;
|
|
2438
|
-
$[16] = setIsHovered;
|
|
2439
|
-
$[17] = t8;
|
|
2440
|
-
} else t8 = $[17];
|
|
2441
|
-
const handleMouseLeave = t8;
|
|
2442
|
-
const t9 = isContentEditable ? blockId : void 0;
|
|
2443
|
-
let t10;
|
|
2444
|
-
if ($[18] !== overlayState || $[19] !== shouldShowOverlay) {
|
|
2445
|
-
t10 = shouldShowOverlay ? overlayState : {};
|
|
2446
|
-
$[18] = overlayState;
|
|
2447
|
-
$[19] = shouldShowOverlay;
|
|
2448
|
-
$[20] = t10;
|
|
2449
|
-
} else t10 = $[20];
|
|
2450
|
-
let t11;
|
|
2451
|
-
if ($[21] !== children || $[22] !== handleClick || $[23] !== handleMouseEnter || $[24] !== handleMouseLeave || $[25] !== t10 || $[26] !== t9) {
|
|
2452
|
-
t11 = children({
|
|
2453
|
-
"data-camox-block-id": t9,
|
|
2454
|
-
...t10,
|
|
1847
|
+
if ($[15] !== children || $[16] !== handleClick || $[17] !== handleMouseEnter || $[18] !== handleMouseLeave || $[19] !== t6 || $[20] !== t7) {
|
|
1848
|
+
t8 = children({
|
|
1849
|
+
"data-camox-block-id": t6,
|
|
1850
|
+
...t7,
|
|
2455
1851
|
"data-camox-overlay-mode": options.synced ? "synced" : void 0,
|
|
2456
1852
|
onClickCapture: handleClick,
|
|
2457
1853
|
onMouseEnter: handleMouseEnter,
|
|
2458
1854
|
onMouseLeave: handleMouseLeave
|
|
2459
1855
|
});
|
|
2460
|
-
$[
|
|
2461
|
-
$[
|
|
2462
|
-
$[
|
|
2463
|
-
$[
|
|
2464
|
-
$[
|
|
2465
|
-
$[
|
|
2466
|
-
$[
|
|
2467
|
-
} else
|
|
2468
|
-
let
|
|
2469
|
-
if ($[
|
|
2470
|
-
|
|
2471
|
-
$[
|
|
2472
|
-
$[
|
|
2473
|
-
} else
|
|
2474
|
-
return
|
|
1856
|
+
$[15] = children;
|
|
1857
|
+
$[16] = handleClick;
|
|
1858
|
+
$[17] = handleMouseEnter;
|
|
1859
|
+
$[18] = handleMouseLeave;
|
|
1860
|
+
$[19] = t6;
|
|
1861
|
+
$[20] = t7;
|
|
1862
|
+
$[21] = t8;
|
|
1863
|
+
} else t8 = $[21];
|
|
1864
|
+
let t9;
|
|
1865
|
+
if ($[22] !== t8) {
|
|
1866
|
+
t9 = /* @__PURE__ */ jsx(Fragment, { children: t8 });
|
|
1867
|
+
$[22] = t8;
|
|
1868
|
+
$[23] = t9;
|
|
1869
|
+
} else t9 = $[23];
|
|
1870
|
+
return t9;
|
|
2475
1871
|
};
|
|
2476
1872
|
return {
|
|
2477
1873
|
Detached,
|