camox 0.14.2 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AuthGate.js +6 -0
- package/dist/core/components/AddBlockControlBar.js +30 -26
- package/dist/core/components/lexical/InlineContentEditable.js +19 -15
- package/dist/core/components/lexical/InlineLexicalEditor.js +62 -42
- package/dist/core/components/lexical/SelectionBroadcaster.js +25 -21
- package/dist/core/components/lexical/SidebarLexicalEditor.js +33 -21
- package/dist/core/createBlock.js +524 -488
- package/dist/core/createLayout.js +40 -28
- package/dist/core/hooks/useFieldSelection.js +12 -8
- package/dist/core/hooks/useIsEditable.js +6 -0
- package/dist/core/hooks/useOverlayMessage.js +19 -15
- package/dist/core/lib/contentType.d.ts +8 -8
- package/dist/core/lib/contentType.js +63 -0
- package/dist/features/content/CamoxContent.js +92 -88
- package/dist/features/content/components/AssetCard.js +46 -42
- package/dist/features/content/components/AssetCardSkeleton.js +8 -4
- package/dist/features/content/components/ContentSidebar.js +8 -4
- package/dist/features/content/components/UploadDropZone.js +31 -27
- package/dist/features/content/components/UploadProgressDrawer.js +98 -90
- package/dist/features/preview/CamoxPreview.js +162 -146
- package/dist/features/preview/components/AddBlockSheet.js +105 -101
- package/dist/features/preview/components/AgentChatSheet.js +74 -21
- package/dist/features/preview/components/AssetFieldEditor.js +98 -90
- package/dist/features/preview/components/AssetLightbox.js +21 -17
- package/dist/features/preview/components/AssetPickerGrid.js +84 -80
- package/dist/features/preview/components/BlockActionsPopover.js +35 -31
- package/dist/features/preview/components/BlockErrorBoundary.js +12 -8
- package/dist/features/preview/components/CreatePageModal.js +1 -1
- package/dist/features/preview/components/DebouncedFieldEditor.js +41 -37
- package/dist/features/preview/components/EditPageModal.js +114 -98
- package/dist/features/preview/components/FieldOverlayStyles.js +8 -4
- package/dist/features/preview/components/FieldToolbar.js +95 -54
- package/dist/features/preview/components/Frame.js +50 -46
- package/dist/features/preview/components/ItemFieldsEditor.js +81 -79
- package/dist/features/preview/components/LinkFieldEditor.js +138 -134
- package/dist/features/preview/components/MultipleAssetFieldEditor.js +105 -97
- package/dist/features/preview/components/OverlayTracker.js +19 -15
- package/dist/features/preview/components/Overlays.js +27 -23
- package/dist/features/preview/components/PageContentSheet.js +54 -4
- package/dist/features/preview/components/PageLocationFieldset.js +113 -109
- package/dist/features/preview/components/PagePicker.js +1 -1
- package/dist/features/preview/components/PageTree.js +443 -399
- package/dist/features/preview/components/PeekedBlock.js +69 -65
- package/dist/features/preview/components/PreviewPanel.js +64 -52
- package/dist/features/preview/components/PreviewSideSheet.js +25 -16
- package/dist/features/preview/components/PreviewToolbar.js +127 -123
- package/dist/features/preview/components/RepeatableItemsList.js +176 -171
- package/dist/features/preview/components/ShikiMarkdown.js +18 -14
- package/dist/features/preview/components/UnlinkAssetButton.js +74 -70
- package/dist/features/preview/components/useRepeatableItemActions.js +266 -0
- package/dist/features/preview/components/useUpdateBlockPosition.js +13 -9
- package/dist/features/provider/CamoxProvider.js +60 -52
- package/dist/features/provider/components/CamoxAppContext.js +10 -6
- package/dist/features/provider/components/CommandPalette.js +77 -69
- package/dist/features/provider/useAdminShortcuts.js +11 -7
- package/dist/features/routes/pageRoute.js +8 -4
- package/dist/features/studio/CamoxStudio.js +23 -19
- package/dist/features/studio/components/EnvironmentMenu.js +32 -28
- package/dist/features/studio/components/Navbar.js +62 -54
- package/dist/features/studio/components/ProjectMenu.js +131 -123
- package/dist/features/studio/components/UserButton.js +15 -11
- package/dist/features/studio/useTheme.js +82 -42
- package/dist/features/vite/definitionsSync.js +5 -5
- package/dist/features/vite/skillGeneration.js +43 -8
- package/dist/features/vite/vite.d.ts +1 -1
- package/dist/features/vite/vite.js +20 -2
- package/dist/hooks/use-marquee-selection.js +36 -32
- package/dist/lib/auth.js +49 -22
- package/dist/lib/normalized-data.js +55 -47
- package/dist/lib/use-project-room.js +22 -18
- package/dist/studio.css +1 -1
- package/package.json +10 -11
- package/skills/camox-block/SKILL.md +4 -0
- package/skills/camox-cli/SKILL.md +142 -0
- package/skills/camox-layout/SKILL.md +4 -0
package/dist/core/createBlock.js
CHANGED
|
@@ -274,7 +274,11 @@ function createBlock(options) {
|
|
|
274
274
|
}, fieldData) });
|
|
275
275
|
};
|
|
276
276
|
const Embed = (t0) => {
|
|
277
|
-
const $ = c(
|
|
277
|
+
const $ = c(59);
|
|
278
|
+
if ($[0] !== "8cc8be56750b20682f66c3aa201873fa6c45d7eaa41d36f57252a78bdb19fa7e") {
|
|
279
|
+
for (let $i = 0; $i < 59; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
280
|
+
$[0] = "8cc8be56750b20682f66c3aa201873fa6c45d7eaa41d36f57252a78bdb19fa7e";
|
|
281
|
+
}
|
|
278
282
|
const { name, children } = t0;
|
|
279
283
|
const blockContext = React.use(Context);
|
|
280
284
|
if (!blockContext) throw new Error("Embed must be used within a Block Component");
|
|
@@ -285,84 +289,84 @@ function createBlock(options) {
|
|
|
285
289
|
const fieldValue = repeaterContext ? repeaterContext.itemContent[name] : content[name];
|
|
286
290
|
const t1 = String(name);
|
|
287
291
|
let t2;
|
|
288
|
-
if ($[
|
|
292
|
+
if ($[1] !== blockId || $[2] !== repeaterContext || $[3] !== t1) {
|
|
289
293
|
t2 = getOverlayFieldId(blockId, repeaterContext, t1);
|
|
290
|
-
$[
|
|
291
|
-
$[
|
|
292
|
-
$[
|
|
293
|
-
$[
|
|
294
|
-
} else t2 = $[
|
|
294
|
+
$[1] = blockId;
|
|
295
|
+
$[2] = repeaterContext;
|
|
296
|
+
$[3] = t1;
|
|
297
|
+
$[4] = t2;
|
|
298
|
+
} else t2 = $[4];
|
|
295
299
|
const fieldId = t2;
|
|
296
300
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
297
301
|
const [urlValue, setUrlValue] = React.useState(fieldValue);
|
|
298
302
|
const [isHovered, setIsHovered] = React.useState(false);
|
|
299
303
|
const timerRef = React.useRef(null);
|
|
300
304
|
let t3;
|
|
301
|
-
if ($[
|
|
305
|
+
if ($[5] !== fieldId) {
|
|
302
306
|
t3 = { fieldId };
|
|
303
|
-
$[
|
|
304
|
-
$[
|
|
305
|
-
} else t3 = $[
|
|
307
|
+
$[5] = fieldId;
|
|
308
|
+
$[6] = t3;
|
|
309
|
+
} else t3 = $[6];
|
|
306
310
|
const isHoveredFromSidebar = useOverlayMessage(iframeWindow, isContentEditable, "CAMOX_HOVER_FIELD", "CAMOX_HOVER_FIELD_END", t3);
|
|
307
311
|
let t4;
|
|
308
312
|
let t5;
|
|
309
|
-
if ($[
|
|
313
|
+
if ($[7] !== isHoveredFromSidebar) {
|
|
310
314
|
t4 = () => {
|
|
311
315
|
setIsHovered(isHoveredFromSidebar);
|
|
312
316
|
};
|
|
313
317
|
t5 = [isHoveredFromSidebar];
|
|
314
|
-
$[
|
|
315
|
-
$[
|
|
316
|
-
$[
|
|
318
|
+
$[7] = isHoveredFromSidebar;
|
|
319
|
+
$[8] = t4;
|
|
320
|
+
$[9] = t5;
|
|
317
321
|
} else {
|
|
318
|
-
t4 = $[
|
|
319
|
-
t5 = $[
|
|
322
|
+
t4 = $[8];
|
|
323
|
+
t5 = $[9];
|
|
320
324
|
}
|
|
321
325
|
React.useEffect(t4, t5);
|
|
322
326
|
let t6;
|
|
323
|
-
if ($[
|
|
327
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
324
328
|
t6 = blockMutations.updateContent();
|
|
325
|
-
$[
|
|
326
|
-
} else t6 = $[
|
|
329
|
+
$[10] = t6;
|
|
330
|
+
} else t6 = $[10];
|
|
327
331
|
const updateBlockContent = useMutation(t6);
|
|
328
332
|
let t7;
|
|
329
|
-
if ($[
|
|
333
|
+
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
330
334
|
t7 = repeatableItemMutations.updateContent();
|
|
331
|
-
$[
|
|
332
|
-
} else t7 = $[
|
|
335
|
+
$[11] = t7;
|
|
336
|
+
} else t7 = $[11];
|
|
333
337
|
const updateRepeatableContent = useMutation(t7);
|
|
334
338
|
let t8;
|
|
335
339
|
let t9;
|
|
336
|
-
if ($[
|
|
340
|
+
if ($[12] !== fieldValue || $[13] !== isOpen) {
|
|
337
341
|
t8 = () => {
|
|
338
342
|
if (!isOpen) setUrlValue(fieldValue);
|
|
339
343
|
};
|
|
340
344
|
t9 = [fieldValue, isOpen];
|
|
341
|
-
$[
|
|
342
|
-
$[
|
|
343
|
-
$[
|
|
344
|
-
$[
|
|
345
|
+
$[12] = fieldValue;
|
|
346
|
+
$[13] = isOpen;
|
|
347
|
+
$[14] = t8;
|
|
348
|
+
$[15] = t9;
|
|
345
349
|
} else {
|
|
346
|
-
t8 = $[
|
|
347
|
-
t9 = $[
|
|
350
|
+
t8 = $[14];
|
|
351
|
+
t9 = $[15];
|
|
348
352
|
}
|
|
349
353
|
React.useEffect(t8, t9);
|
|
350
354
|
let t10;
|
|
351
355
|
let t11;
|
|
352
|
-
if ($[
|
|
356
|
+
if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
|
|
353
357
|
t10 = () => () => {
|
|
354
358
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
355
359
|
};
|
|
356
360
|
t11 = [];
|
|
357
|
-
$[
|
|
358
|
-
$[
|
|
361
|
+
$[16] = t10;
|
|
362
|
+
$[17] = t11;
|
|
359
363
|
} else {
|
|
360
|
-
t10 = $[
|
|
361
|
-
t11 = $[
|
|
364
|
+
t10 = $[16];
|
|
365
|
+
t11 = $[17];
|
|
362
366
|
}
|
|
363
367
|
React.useEffect(t10, t11);
|
|
364
368
|
let t12;
|
|
365
|
-
if ($[
|
|
369
|
+
if ($[18] !== blockId || $[19] !== name || $[20] !== repeaterContext || $[21] !== updateBlockContent || $[22] !== updateRepeatableContent) {
|
|
366
370
|
t12 = (e) => {
|
|
367
371
|
const newValue = e.target.value;
|
|
368
372
|
setUrlValue(newValue);
|
|
@@ -378,16 +382,16 @@ function createBlock(options) {
|
|
|
378
382
|
});
|
|
379
383
|
}, 500);
|
|
380
384
|
};
|
|
381
|
-
$[
|
|
382
|
-
$[
|
|
383
|
-
$[
|
|
384
|
-
$[
|
|
385
|
-
$[
|
|
386
|
-
$[
|
|
387
|
-
} else t12 = $[
|
|
385
|
+
$[18] = blockId;
|
|
386
|
+
$[19] = name;
|
|
387
|
+
$[20] = repeaterContext;
|
|
388
|
+
$[21] = updateBlockContent;
|
|
389
|
+
$[22] = updateRepeatableContent;
|
|
390
|
+
$[23] = t12;
|
|
391
|
+
} else t12 = $[23];
|
|
388
392
|
const handleUrlChange = t12;
|
|
389
393
|
let t13;
|
|
390
|
-
if ($[
|
|
394
|
+
if ($[24] !== blockId || $[25] !== name || $[26] !== repeaterContext) {
|
|
391
395
|
t13 = (open, _eventDetails) => {
|
|
392
396
|
setIsOpen(open);
|
|
393
397
|
if (open) if (repeaterContext?.itemId != null) previewStore.send({
|
|
@@ -404,11 +408,11 @@ function createBlock(options) {
|
|
|
404
408
|
fieldType: "Embed"
|
|
405
409
|
});
|
|
406
410
|
};
|
|
407
|
-
$[
|
|
408
|
-
$[
|
|
409
|
-
$[
|
|
410
|
-
$[
|
|
411
|
-
} else t13 = $[
|
|
411
|
+
$[24] = blockId;
|
|
412
|
+
$[25] = name;
|
|
413
|
+
$[26] = repeaterContext;
|
|
414
|
+
$[27] = t13;
|
|
415
|
+
} else t13 = $[27];
|
|
412
416
|
const handleOpenChange = t13;
|
|
413
417
|
const t14 = isContentEditable ? isOpen : false;
|
|
414
418
|
const t15 = isContentEditable ? handleOpenChange : void 0;
|
|
@@ -418,19 +422,19 @@ function createBlock(options) {
|
|
|
418
422
|
const t19 = isContentEditable && isOpen || void 0;
|
|
419
423
|
const t20 = mode === "layout" ? "layout" : void 0;
|
|
420
424
|
let t21;
|
|
421
|
-
if ($[
|
|
425
|
+
if ($[28] !== isContentEditable) {
|
|
422
426
|
t21 = isContentEditable ? () => setIsHovered(true) : void 0;
|
|
423
|
-
$[
|
|
424
|
-
$[
|
|
425
|
-
} else t21 = $[
|
|
427
|
+
$[28] = isContentEditable;
|
|
428
|
+
$[29] = t21;
|
|
429
|
+
} else t21 = $[29];
|
|
426
430
|
let t22;
|
|
427
|
-
if ($[
|
|
431
|
+
if ($[30] !== isContentEditable) {
|
|
428
432
|
t22 = isContentEditable ? () => setIsHovered(false) : void 0;
|
|
429
|
-
$[
|
|
430
|
-
$[
|
|
431
|
-
} else t22 = $[
|
|
433
|
+
$[30] = isContentEditable;
|
|
434
|
+
$[31] = t22;
|
|
435
|
+
} else t22 = $[31];
|
|
432
436
|
let t23;
|
|
433
|
-
if ($[
|
|
437
|
+
if ($[32] !== t16 || $[33] !== t17 || $[34] !== t18 || $[35] !== t19 || $[36] !== t20 || $[37] !== t21 || $[38] !== t22) {
|
|
434
438
|
t23 = /* @__PURE__ */ jsx("div", {
|
|
435
439
|
"data-camox-field-id": t16,
|
|
436
440
|
"data-camox-field-type": t17,
|
|
@@ -440,24 +444,24 @@ function createBlock(options) {
|
|
|
440
444
|
onMouseEnter: t21,
|
|
441
445
|
onMouseLeave: t22
|
|
442
446
|
});
|
|
443
|
-
$[
|
|
444
|
-
$[
|
|
445
|
-
$[
|
|
446
|
-
$[
|
|
447
|
-
$[
|
|
448
|
-
$[
|
|
449
|
-
$[
|
|
450
|
-
$[
|
|
451
|
-
} else t23 = $[
|
|
447
|
+
$[32] = t16;
|
|
448
|
+
$[33] = t17;
|
|
449
|
+
$[34] = t18;
|
|
450
|
+
$[35] = t19;
|
|
451
|
+
$[36] = t20;
|
|
452
|
+
$[37] = t21;
|
|
453
|
+
$[38] = t22;
|
|
454
|
+
$[39] = t23;
|
|
455
|
+
} else t23 = $[39];
|
|
452
456
|
let t24;
|
|
453
|
-
if ($[
|
|
457
|
+
if ($[40] !== children || $[41] !== fieldValue) {
|
|
454
458
|
t24 = children({ src: fieldValue }, { url: fieldValue });
|
|
455
|
-
$[
|
|
456
|
-
$[
|
|
457
|
-
$[
|
|
458
|
-
} else t24 = $[
|
|
459
|
+
$[40] = children;
|
|
460
|
+
$[41] = fieldValue;
|
|
461
|
+
$[42] = t24;
|
|
462
|
+
} else t24 = $[42];
|
|
459
463
|
let t25;
|
|
460
|
-
if ($[
|
|
464
|
+
if ($[43] !== isContentEditable) {
|
|
461
465
|
t25 = isContentEditable && /* @__PURE__ */ jsx("div", {
|
|
462
466
|
style: {
|
|
463
467
|
position: "absolute",
|
|
@@ -466,23 +470,23 @@ function createBlock(options) {
|
|
|
466
470
|
},
|
|
467
471
|
onClick: _temp
|
|
468
472
|
});
|
|
469
|
-
$[
|
|
470
|
-
$[
|
|
471
|
-
} else t25 = $[
|
|
473
|
+
$[43] = isContentEditable;
|
|
474
|
+
$[44] = t25;
|
|
475
|
+
} else t25 = $[44];
|
|
472
476
|
let t26;
|
|
473
|
-
if ($[
|
|
477
|
+
if ($[45] !== t23 || $[46] !== t24 || $[47] !== t25) {
|
|
474
478
|
t26 = /* @__PURE__ */ jsxs(PopoverTrigger, {
|
|
475
479
|
render: t23,
|
|
476
480
|
nativeButton: false,
|
|
477
481
|
children: [t24, t25]
|
|
478
482
|
});
|
|
479
|
-
$[
|
|
480
|
-
$[
|
|
481
|
-
$[
|
|
482
|
-
$[
|
|
483
|
-
} else t26 = $[
|
|
483
|
+
$[45] = t23;
|
|
484
|
+
$[46] = t24;
|
|
485
|
+
$[47] = t25;
|
|
486
|
+
$[48] = t26;
|
|
487
|
+
} else t26 = $[48];
|
|
484
488
|
let t27;
|
|
485
|
-
if ($[
|
|
489
|
+
if ($[49] !== handleUrlChange || $[50] !== isContentEditable || $[51] !== name || $[52] !== urlValue) {
|
|
486
490
|
t27 = isContentEditable && /* @__PURE__ */ jsx(PopoverContent, {
|
|
487
491
|
className: "w-96 gap-2",
|
|
488
492
|
children: /* @__PURE__ */ jsxs("form", {
|
|
@@ -498,29 +502,33 @@ function createBlock(options) {
|
|
|
498
502
|
})]
|
|
499
503
|
})
|
|
500
504
|
});
|
|
501
|
-
$[
|
|
502
|
-
$[
|
|
503
|
-
$[
|
|
504
|
-
$[
|
|
505
|
-
$[
|
|
506
|
-
} else t27 = $[
|
|
505
|
+
$[49] = handleUrlChange;
|
|
506
|
+
$[50] = isContentEditable;
|
|
507
|
+
$[51] = name;
|
|
508
|
+
$[52] = urlValue;
|
|
509
|
+
$[53] = t27;
|
|
510
|
+
} else t27 = $[53];
|
|
507
511
|
let t28;
|
|
508
|
-
if ($[
|
|
512
|
+
if ($[54] !== t14 || $[55] !== t15 || $[56] !== t26 || $[57] !== t27) {
|
|
509
513
|
t28 = /* @__PURE__ */ jsxs(Popover, {
|
|
510
514
|
open: t14,
|
|
511
515
|
onOpenChange: t15,
|
|
512
516
|
children: [t26, t27]
|
|
513
517
|
});
|
|
514
|
-
$[
|
|
515
|
-
$[
|
|
516
|
-
$[
|
|
517
|
-
$[
|
|
518
|
-
$[
|
|
519
|
-
} else t28 = $[
|
|
518
|
+
$[54] = t14;
|
|
519
|
+
$[55] = t15;
|
|
520
|
+
$[56] = t26;
|
|
521
|
+
$[57] = t27;
|
|
522
|
+
$[58] = t28;
|
|
523
|
+
} else t28 = $[58];
|
|
520
524
|
return t28;
|
|
521
525
|
};
|
|
522
526
|
const Link = (t0) => {
|
|
523
|
-
const $ = c(
|
|
527
|
+
const $ = c(38);
|
|
528
|
+
if ($[0] !== "8cc8be56750b20682f66c3aa201873fa6c45d7eaa41d36f57252a78bdb19fa7e") {
|
|
529
|
+
for (let $i = 0; $i < 38; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
530
|
+
$[0] = "8cc8be56750b20682f66c3aa201873fa6c45d7eaa41d36f57252a78bdb19fa7e";
|
|
531
|
+
}
|
|
524
532
|
const { name, children } = t0;
|
|
525
533
|
const blockContext = React.use(Context);
|
|
526
534
|
if (!blockContext) throw new Error("Link must be used within a Block Component");
|
|
@@ -531,48 +539,48 @@ function createBlock(options) {
|
|
|
531
539
|
const repeaterContext = React.use(RepeaterItemContext);
|
|
532
540
|
const fieldValue = normalizeLinkValue(repeaterContext ? repeaterContext.itemContent[name] : content[name]);
|
|
533
541
|
let t1;
|
|
534
|
-
if ($[
|
|
542
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
535
543
|
t1 = blockMutations.updateContent();
|
|
536
|
-
$[
|
|
537
|
-
} else t1 = $[
|
|
544
|
+
$[1] = t1;
|
|
545
|
+
} else t1 = $[1];
|
|
538
546
|
const updateBlockContent = useMutation(t1);
|
|
539
547
|
let t2;
|
|
540
|
-
if ($[
|
|
548
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
541
549
|
t2 = repeatableItemMutations.updateContent();
|
|
542
|
-
$[
|
|
543
|
-
} else t2 = $[
|
|
550
|
+
$[2] = t2;
|
|
551
|
+
} else t2 = $[2];
|
|
544
552
|
const updateRepeatableContent = useMutation(t2);
|
|
545
553
|
const projectSlug = useProjectSlug();
|
|
546
554
|
let t3;
|
|
547
|
-
if ($[
|
|
555
|
+
if ($[3] !== projectSlug) {
|
|
548
556
|
t3 = projectQueries.getBySlug(projectSlug);
|
|
549
|
-
$[
|
|
550
|
-
$[
|
|
551
|
-
} else t3 = $[
|
|
557
|
+
$[3] = projectSlug;
|
|
558
|
+
$[4] = t3;
|
|
559
|
+
} else t3 = $[4];
|
|
552
560
|
const { data: project } = useQuery(t3);
|
|
553
561
|
let t4;
|
|
554
|
-
if ($[
|
|
562
|
+
if ($[5] !== project?.id) {
|
|
555
563
|
t4 = pageQueries.list(project?.id ?? 0);
|
|
556
|
-
$[
|
|
557
|
-
$[
|
|
558
|
-
} else t4 = $[
|
|
564
|
+
$[5] = project?.id;
|
|
565
|
+
$[6] = t4;
|
|
566
|
+
} else t4 = $[6];
|
|
559
567
|
const t5 = !!project;
|
|
560
568
|
let t6;
|
|
561
|
-
if ($[
|
|
569
|
+
if ($[7] !== t4 || $[8] !== t5) {
|
|
562
570
|
t6 = {
|
|
563
571
|
...t4,
|
|
564
572
|
enabled: t5
|
|
565
573
|
};
|
|
566
|
-
$[
|
|
567
|
-
$[
|
|
568
|
-
$[
|
|
569
|
-
} else t6 = $[
|
|
574
|
+
$[7] = t4;
|
|
575
|
+
$[8] = t5;
|
|
576
|
+
$[9] = t6;
|
|
577
|
+
} else t6 = $[9];
|
|
570
578
|
const { data: pages } = useQuery(t6);
|
|
571
579
|
let t7;
|
|
572
|
-
if ($[
|
|
580
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
573
581
|
t7 = { select: _temp2 };
|
|
574
|
-
$[
|
|
575
|
-
} else t7 = $[
|
|
582
|
+
$[10] = t7;
|
|
583
|
+
} else t7 = $[10];
|
|
576
584
|
const resolvedHref = resolveLinkHref(fieldValue, pages, useLocation(t7));
|
|
577
585
|
const fieldId = getOverlayFieldId(blockId, repeaterContext, String(name));
|
|
578
586
|
const [isEditing, setIsEditing] = React.useState(false);
|
|
@@ -587,21 +595,21 @@ function createBlock(options) {
|
|
|
587
595
|
const isHoveredFromSidebar = useOverlayMessage(iframeWindow, isContentEditable, "CAMOX_HOVER_FIELD", "CAMOX_HOVER_FIELD_END", { fieldId });
|
|
588
596
|
let t8;
|
|
589
597
|
let t9;
|
|
590
|
-
if ($[
|
|
598
|
+
if ($[11] !== isHoveredFromSidebar) {
|
|
591
599
|
t8 = () => {
|
|
592
600
|
setIsHovered(isHoveredFromSidebar);
|
|
593
601
|
};
|
|
594
602
|
t9 = [isHoveredFromSidebar];
|
|
595
|
-
$[
|
|
596
|
-
$[
|
|
597
|
-
$[
|
|
603
|
+
$[11] = isHoveredFromSidebar;
|
|
604
|
+
$[12] = t8;
|
|
605
|
+
$[13] = t9;
|
|
598
606
|
} else {
|
|
599
|
-
t8 = $[
|
|
600
|
-
t9 = $[
|
|
607
|
+
t8 = $[12];
|
|
608
|
+
t9 = $[13];
|
|
601
609
|
}
|
|
602
610
|
React.useEffect(t8, t9);
|
|
603
611
|
let t10;
|
|
604
|
-
if ($[
|
|
612
|
+
if ($[14] !== blockId || $[15] !== name || $[16] !== repeaterContext || $[17] !== updateBlockContent || $[18] !== updateRepeatableContent) {
|
|
605
613
|
t10 = (newLinkValue) => {
|
|
606
614
|
if (repeaterContext?.itemId != null) updateRepeatableContent.mutate({
|
|
607
615
|
id: repeaterContext.itemId,
|
|
@@ -612,13 +620,13 @@ function createBlock(options) {
|
|
|
612
620
|
content: { [name]: newLinkValue }
|
|
613
621
|
});
|
|
614
622
|
};
|
|
615
|
-
$[
|
|
616
|
-
$[
|
|
617
|
-
$[
|
|
618
|
-
$[
|
|
619
|
-
$[
|
|
620
|
-
$[
|
|
621
|
-
} else t10 = $[
|
|
623
|
+
$[14] = blockId;
|
|
624
|
+
$[15] = name;
|
|
625
|
+
$[16] = repeaterContext;
|
|
626
|
+
$[17] = updateBlockContent;
|
|
627
|
+
$[18] = updateRepeatableContent;
|
|
628
|
+
$[19] = t10;
|
|
629
|
+
} else t10 = $[19];
|
|
622
630
|
const saveLinkValue = t10;
|
|
623
631
|
const handleInput = (e) => {
|
|
624
632
|
const newText = e.target.textContent || "";
|
|
@@ -628,7 +636,7 @@ function createBlock(options) {
|
|
|
628
636
|
});
|
|
629
637
|
};
|
|
630
638
|
let t11;
|
|
631
|
-
if ($[
|
|
639
|
+
if ($[20] !== blockId || $[21] !== name || $[22] !== repeaterContext) {
|
|
632
640
|
t11 = () => {
|
|
633
641
|
setIsEditing(true);
|
|
634
642
|
setIsEditorFocused(true);
|
|
@@ -646,31 +654,31 @@ function createBlock(options) {
|
|
|
646
654
|
fieldType: "Link"
|
|
647
655
|
});
|
|
648
656
|
};
|
|
649
|
-
$[
|
|
650
|
-
$[
|
|
651
|
-
$[
|
|
652
|
-
$[
|
|
653
|
-
} else t11 = $[
|
|
657
|
+
$[20] = blockId;
|
|
658
|
+
$[21] = name;
|
|
659
|
+
$[22] = repeaterContext;
|
|
660
|
+
$[23] = t11;
|
|
661
|
+
} else t11 = $[23];
|
|
654
662
|
const handleFocus = t11;
|
|
655
663
|
let t12;
|
|
656
|
-
if ($[
|
|
664
|
+
if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
|
|
657
665
|
t12 = () => {
|
|
658
666
|
setIsEditing(false);
|
|
659
667
|
setIsEditorFocused(false);
|
|
660
668
|
};
|
|
661
|
-
$[
|
|
662
|
-
} else t12 = $[
|
|
669
|
+
$[24] = t12;
|
|
670
|
+
} else t12 = $[24];
|
|
663
671
|
const handleBlur = t12;
|
|
664
672
|
let t13;
|
|
665
|
-
if ($[
|
|
673
|
+
if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
|
|
666
674
|
t13 = (e_0) => {
|
|
667
675
|
e_0.stopPropagation();
|
|
668
676
|
previewStore.send({ type: "toggleContentSheet" });
|
|
669
677
|
setIsEditorFocused(false);
|
|
670
678
|
setIsEditing(false);
|
|
671
679
|
};
|
|
672
|
-
$[
|
|
673
|
-
} else t13 = $[
|
|
680
|
+
$[25] = t13;
|
|
681
|
+
} else t13 = $[25];
|
|
674
682
|
const handleEditLink = t13;
|
|
675
683
|
const linkData = {
|
|
676
684
|
text: displayText,
|
|
@@ -685,14 +693,14 @@ function createBlock(options) {
|
|
|
685
693
|
}, linkData) });
|
|
686
694
|
let t14;
|
|
687
695
|
let t15;
|
|
688
|
-
if ($[
|
|
696
|
+
if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
|
|
689
697
|
t14 = () => setIsHovered(true);
|
|
690
698
|
t15 = () => setIsHovered(false);
|
|
691
|
-
$[
|
|
692
|
-
$[
|
|
699
|
+
$[26] = t14;
|
|
700
|
+
$[27] = t15;
|
|
693
701
|
} else {
|
|
694
|
-
t14 = $[
|
|
695
|
-
t15 = $[
|
|
702
|
+
t14 = $[26];
|
|
703
|
+
t15 = $[27];
|
|
696
704
|
}
|
|
697
705
|
const linkProps = {
|
|
698
706
|
ref: elementRef,
|
|
@@ -718,7 +726,7 @@ function createBlock(options) {
|
|
|
718
726
|
const T0 = Popover;
|
|
719
727
|
const t16 = children(linkProps, linkData);
|
|
720
728
|
let t17;
|
|
721
|
-
if ($[
|
|
729
|
+
if ($[28] !== handleEditLink) {
|
|
722
730
|
t17 = /* @__PURE__ */ jsx("button", {
|
|
723
731
|
type: "button",
|
|
724
732
|
className: "hover:bg-accent flex items-center gap-1.5 rounded-md px-2 py-1 text-sm transition-colors",
|
|
@@ -726,11 +734,11 @@ function createBlock(options) {
|
|
|
726
734
|
onClick: handleEditLink,
|
|
727
735
|
children: "Edit link"
|
|
728
736
|
});
|
|
729
|
-
$[
|
|
730
|
-
$[
|
|
731
|
-
} else t17 = $[
|
|
737
|
+
$[28] = handleEditLink;
|
|
738
|
+
$[29] = t17;
|
|
739
|
+
} else t17 = $[29];
|
|
732
740
|
let t18;
|
|
733
|
-
if ($[
|
|
741
|
+
if ($[30] !== elementRef || $[31] !== t17) {
|
|
734
742
|
t18 = /* @__PURE__ */ jsx(PopoverContent, {
|
|
735
743
|
className: "w-auto p-2",
|
|
736
744
|
initialFocus: false,
|
|
@@ -738,26 +746,30 @@ function createBlock(options) {
|
|
|
738
746
|
align: "end",
|
|
739
747
|
children: t17
|
|
740
748
|
});
|
|
741
|
-
$[
|
|
742
|
-
$[
|
|
743
|
-
$[
|
|
744
|
-
} else t18 = $[
|
|
749
|
+
$[30] = elementRef;
|
|
750
|
+
$[31] = t17;
|
|
751
|
+
$[32] = t18;
|
|
752
|
+
} else t18 = $[32];
|
|
745
753
|
let t19;
|
|
746
|
-
if ($[
|
|
754
|
+
if ($[33] !== T0 || $[34] !== isEditorFocused || $[35] !== t16 || $[36] !== t18) {
|
|
747
755
|
t19 = /* @__PURE__ */ jsxs(T0, {
|
|
748
756
|
open: isEditorFocused,
|
|
749
757
|
children: [t16, t18]
|
|
750
758
|
});
|
|
751
|
-
$[
|
|
752
|
-
$[
|
|
753
|
-
$[
|
|
754
|
-
$[
|
|
755
|
-
$[
|
|
756
|
-
} else t19 = $[
|
|
759
|
+
$[33] = T0;
|
|
760
|
+
$[34] = isEditorFocused;
|
|
761
|
+
$[35] = t16;
|
|
762
|
+
$[36] = t18;
|
|
763
|
+
$[37] = t19;
|
|
764
|
+
} else t19 = $[37];
|
|
757
765
|
return t19;
|
|
758
766
|
};
|
|
759
767
|
const Image = (t0) => {
|
|
760
|
-
const $ = c(
|
|
768
|
+
const $ = c(22);
|
|
769
|
+
if ($[0] !== "8cc8be56750b20682f66c3aa201873fa6c45d7eaa41d36f57252a78bdb19fa7e") {
|
|
770
|
+
for (let $i = 0; $i < 22; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
771
|
+
$[0] = "8cc8be56750b20682f66c3aa201873fa6c45d7eaa41d36f57252a78bdb19fa7e";
|
|
772
|
+
}
|
|
761
773
|
const { name, children } = t0;
|
|
762
774
|
const blockContext = React.use(Context);
|
|
763
775
|
if (!blockContext) throw new Error("Image must be used within a Block Component");
|
|
@@ -770,115 +782,112 @@ function createBlock(options) {
|
|
|
770
782
|
const rawValue = isFileMarker(rawSource) ? resolveFileMarker(rawSource, filesMap) : rawSource;
|
|
771
783
|
const defaultValue = repeaterContext ? repeatableItemDefaults[repeaterContext.arrayFieldName]?.[String(name)] : contentDefaults[String(name)];
|
|
772
784
|
const fieldValue = rawValue ?? defaultValue;
|
|
773
|
-
const
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
$[0] = blockId;
|
|
778
|
-
$[1] = repeaterContext;
|
|
779
|
-
$[2] = t1;
|
|
780
|
-
$[3] = t2;
|
|
781
|
-
} else t2 = $[3];
|
|
782
|
-
const fieldId = t2;
|
|
785
|
+
const isInlineArrayItem = repeaterContext != null && repeaterContext.itemId == null;
|
|
786
|
+
const overlayFieldName = isInlineArrayItem ? repeaterContext.arrayFieldName : String(name);
|
|
787
|
+
const overlayItemId = isInlineArrayItem ? repeaterContext.containerItemId : repeaterContext?.itemId;
|
|
788
|
+
const fieldId = overlayItemId != null ? `${blockId}__${overlayItemId}__${overlayFieldName}` : `${blockId}__${overlayFieldName}`;
|
|
783
789
|
const [isHovered, setIsHovered] = React.useState(false);
|
|
784
|
-
const isFocused = useFieldSelection(blockId,
|
|
790
|
+
const isFocused = useFieldSelection(blockId, overlayFieldName, "Image", overlayItemId);
|
|
791
|
+
let t1;
|
|
792
|
+
if ($[1] !== fieldId) {
|
|
793
|
+
t1 = { fieldId };
|
|
794
|
+
$[1] = fieldId;
|
|
795
|
+
$[2] = t1;
|
|
796
|
+
} else t1 = $[2];
|
|
797
|
+
const isHoveredFromSidebar = useOverlayMessage(iframeWindow, isContentEditable, "CAMOX_HOVER_FIELD", "CAMOX_HOVER_FIELD_END", t1);
|
|
798
|
+
let t2;
|
|
785
799
|
let t3;
|
|
786
|
-
if ($[
|
|
787
|
-
|
|
788
|
-
$[4] = fieldId;
|
|
789
|
-
$[5] = t3;
|
|
790
|
-
} else t3 = $[5];
|
|
791
|
-
const isHoveredFromSidebar = useOverlayMessage(iframeWindow, isContentEditable, "CAMOX_HOVER_FIELD", "CAMOX_HOVER_FIELD_END", t3);
|
|
792
|
-
let t4;
|
|
793
|
-
let t5;
|
|
794
|
-
if ($[6] !== isHoveredFromSidebar) {
|
|
795
|
-
t4 = () => {
|
|
800
|
+
if ($[3] !== isHoveredFromSidebar) {
|
|
801
|
+
t2 = () => {
|
|
796
802
|
setIsHovered(isHoveredFromSidebar);
|
|
797
803
|
};
|
|
798
|
-
|
|
799
|
-
$[
|
|
800
|
-
$[
|
|
801
|
-
$[
|
|
804
|
+
t3 = [isHoveredFromSidebar];
|
|
805
|
+
$[3] = isHoveredFromSidebar;
|
|
806
|
+
$[4] = t2;
|
|
807
|
+
$[5] = t3;
|
|
802
808
|
} else {
|
|
803
|
-
|
|
804
|
-
|
|
809
|
+
t2 = $[4];
|
|
810
|
+
t3 = $[5];
|
|
805
811
|
}
|
|
806
|
-
React.useEffect(
|
|
807
|
-
let
|
|
808
|
-
if ($[
|
|
809
|
-
|
|
812
|
+
React.useEffect(t2, t3);
|
|
813
|
+
let t4;
|
|
814
|
+
if ($[6] !== blockId || $[7] !== isContentEditable || $[8] !== overlayFieldName || $[9] !== overlayItemId) {
|
|
815
|
+
t4 = () => {
|
|
810
816
|
if (!isContentEditable) return;
|
|
811
|
-
|
|
812
|
-
if (repeaterContext?.itemId != null) previewStore.send({
|
|
817
|
+
if (overlayItemId != null) previewStore.send({
|
|
813
818
|
type: "selectItemField",
|
|
814
819
|
blockId,
|
|
815
|
-
itemId:
|
|
816
|
-
fieldName:
|
|
820
|
+
itemId: overlayItemId,
|
|
821
|
+
fieldName: overlayFieldName,
|
|
817
822
|
fieldType: "Image"
|
|
818
823
|
});
|
|
819
824
|
else previewStore.send({
|
|
820
825
|
type: "selectBlockField",
|
|
821
826
|
blockId,
|
|
822
|
-
fieldName:
|
|
827
|
+
fieldName: overlayFieldName,
|
|
823
828
|
fieldType: "Image"
|
|
824
829
|
});
|
|
825
830
|
previewStore.send({ type: "toggleContentSheet" });
|
|
826
831
|
};
|
|
827
|
-
$[
|
|
828
|
-
$[
|
|
829
|
-
$[
|
|
830
|
-
$[
|
|
831
|
-
$[
|
|
832
|
-
} else
|
|
833
|
-
const handleClick =
|
|
832
|
+
$[6] = blockId;
|
|
833
|
+
$[7] = isContentEditable;
|
|
834
|
+
$[8] = overlayFieldName;
|
|
835
|
+
$[9] = overlayItemId;
|
|
836
|
+
$[10] = t4;
|
|
837
|
+
} else t4 = $[10];
|
|
838
|
+
const handleClick = t4;
|
|
834
839
|
const imageProps = {
|
|
835
840
|
src: fieldValue.url,
|
|
836
841
|
alt: fieldValue.alt
|
|
837
842
|
};
|
|
838
843
|
if (!isContentEditable) return /* @__PURE__ */ jsx(Fragment, { children: children(imageProps, fieldValue) });
|
|
839
|
-
const
|
|
840
|
-
const
|
|
841
|
-
const
|
|
842
|
-
const
|
|
843
|
-
let
|
|
844
|
-
let
|
|
845
|
-
if ($[
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
$[
|
|
849
|
-
$[
|
|
844
|
+
const t5 = "image";
|
|
845
|
+
const t6 = isHovered || void 0;
|
|
846
|
+
const t7 = isFocused || void 0;
|
|
847
|
+
const t8 = mode === "layout" ? "layout" : void 0;
|
|
848
|
+
let t10;
|
|
849
|
+
let t9;
|
|
850
|
+
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
851
|
+
t9 = () => setIsHovered(true);
|
|
852
|
+
t10 = () => setIsHovered(false);
|
|
853
|
+
$[11] = t10;
|
|
854
|
+
$[12] = t9;
|
|
850
855
|
} else {
|
|
851
|
-
|
|
852
|
-
|
|
856
|
+
t10 = $[11];
|
|
857
|
+
t9 = $[12];
|
|
853
858
|
}
|
|
854
|
-
const
|
|
855
|
-
let
|
|
856
|
-
if ($[
|
|
857
|
-
|
|
859
|
+
const t11 = children(imageProps, fieldValue);
|
|
860
|
+
let t12;
|
|
861
|
+
if ($[13] !== fieldId || $[14] !== handleClick || $[15] !== t10 || $[16] !== t11 || $[17] !== t6 || $[18] !== t7 || $[19] !== t8 || $[20] !== t9) {
|
|
862
|
+
t12 = /* @__PURE__ */ jsx("div", {
|
|
858
863
|
"data-camox-field-id": fieldId,
|
|
859
|
-
"data-camox-field-type":
|
|
860
|
-
"data-camox-hovered":
|
|
861
|
-
"data-camox-focused":
|
|
862
|
-
"data-camox-overlay-mode":
|
|
863
|
-
onMouseEnter:
|
|
864
|
-
onMouseLeave:
|
|
864
|
+
"data-camox-field-type": t5,
|
|
865
|
+
"data-camox-hovered": t6,
|
|
866
|
+
"data-camox-focused": t7,
|
|
867
|
+
"data-camox-overlay-mode": t8,
|
|
868
|
+
onMouseEnter: t9,
|
|
869
|
+
onMouseLeave: t10,
|
|
865
870
|
onClick: handleClick,
|
|
866
|
-
children:
|
|
871
|
+
children: t11
|
|
867
872
|
});
|
|
868
|
-
$[
|
|
869
|
-
$[
|
|
870
|
-
$[
|
|
871
|
-
$[
|
|
872
|
-
$[
|
|
873
|
-
$[
|
|
874
|
-
$[
|
|
875
|
-
$[
|
|
876
|
-
$[
|
|
877
|
-
} else
|
|
878
|
-
return
|
|
873
|
+
$[13] = fieldId;
|
|
874
|
+
$[14] = handleClick;
|
|
875
|
+
$[15] = t10;
|
|
876
|
+
$[16] = t11;
|
|
877
|
+
$[17] = t6;
|
|
878
|
+
$[18] = t7;
|
|
879
|
+
$[19] = t8;
|
|
880
|
+
$[20] = t9;
|
|
881
|
+
$[21] = t12;
|
|
882
|
+
} else t12 = $[21];
|
|
883
|
+
return t12;
|
|
879
884
|
};
|
|
880
885
|
const File = (t0) => {
|
|
881
|
-
const $ = c(
|
|
886
|
+
const $ = c(9);
|
|
887
|
+
if ($[0] !== "8cc8be56750b20682f66c3aa201873fa6c45d7eaa41d36f57252a78bdb19fa7e") {
|
|
888
|
+
for (let $i = 0; $i < 9; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
889
|
+
$[0] = "8cc8be56750b20682f66c3aa201873fa6c45d7eaa41d36f57252a78bdb19fa7e";
|
|
890
|
+
}
|
|
882
891
|
const { name, children } = t0;
|
|
883
892
|
const blockContext = React.use(Context);
|
|
884
893
|
if (!blockContext) throw new Error("File must be used within a Block Component");
|
|
@@ -887,7 +896,7 @@ function createBlock(options) {
|
|
|
887
896
|
const { filesMap } = useNormalizedData();
|
|
888
897
|
const rawSource = repeaterContext ? repeaterContext.itemContent[name] : content[name];
|
|
889
898
|
let t1;
|
|
890
|
-
if ($[
|
|
899
|
+
if ($[1] !== children || $[2] !== filesMap || $[3] !== name || $[4] !== rawSource || $[5] !== repeaterContext) {
|
|
891
900
|
const rawValue = isFileMarker(rawSource) ? resolveFileMarker(rawSource, filesMap) : rawSource;
|
|
892
901
|
const defaultValue = repeaterContext ? repeatableItemDefaults[repeaterContext.arrayFieldName]?.[String(name)] : contentDefaults[String(name)];
|
|
893
902
|
const fieldValue = rawValue ?? defaultValue;
|
|
@@ -895,23 +904,27 @@ function createBlock(options) {
|
|
|
895
904
|
href: fieldValue.url,
|
|
896
905
|
download: fieldValue.filename
|
|
897
906
|
}, fieldValue);
|
|
898
|
-
$[
|
|
899
|
-
$[
|
|
900
|
-
$[
|
|
901
|
-
$[
|
|
902
|
-
$[
|
|
903
|
-
$[
|
|
904
|
-
} else t1 = $[
|
|
907
|
+
$[1] = children;
|
|
908
|
+
$[2] = filesMap;
|
|
909
|
+
$[3] = name;
|
|
910
|
+
$[4] = rawSource;
|
|
911
|
+
$[5] = repeaterContext;
|
|
912
|
+
$[6] = t1;
|
|
913
|
+
} else t1 = $[6];
|
|
905
914
|
let t2;
|
|
906
|
-
if ($[
|
|
915
|
+
if ($[7] !== t1) {
|
|
907
916
|
t2 = /* @__PURE__ */ jsx(Fragment, { children: t1 });
|
|
908
|
-
$[
|
|
909
|
-
$[
|
|
910
|
-
} else t2 = $[
|
|
917
|
+
$[7] = t1;
|
|
918
|
+
$[8] = t2;
|
|
919
|
+
} else t2 = $[8];
|
|
911
920
|
return t2;
|
|
912
921
|
};
|
|
913
922
|
const RepeaterItemWrapper = (t0) => {
|
|
914
|
-
const $ = c(
|
|
923
|
+
const $ = c(9);
|
|
924
|
+
if ($[0] !== "8cc8be56750b20682f66c3aa201873fa6c45d7eaa41d36f57252a78bdb19fa7e") {
|
|
925
|
+
for (let $i = 0; $i < 9; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
926
|
+
$[0] = "8cc8be56750b20682f66c3aa201873fa6c45d7eaa41d36f57252a78bdb19fa7e";
|
|
927
|
+
}
|
|
915
928
|
const { itemId, blockId, mode, children } = t0;
|
|
916
929
|
const isContentEditable = useIsEditable(mode);
|
|
917
930
|
const { window: iframeWindow } = useFrame();
|
|
@@ -919,67 +932,75 @@ function createBlock(options) {
|
|
|
919
932
|
const t1 = String(blockId);
|
|
920
933
|
const t2 = String(itemId);
|
|
921
934
|
let t3;
|
|
922
|
-
if ($[
|
|
935
|
+
if ($[1] !== t1 || $[2] !== t2) {
|
|
923
936
|
t3 = {
|
|
924
937
|
blockId: t1,
|
|
925
938
|
itemId: t2
|
|
926
939
|
};
|
|
927
|
-
$[
|
|
928
|
-
$[
|
|
929
|
-
$[
|
|
930
|
-
} else t3 = $[
|
|
940
|
+
$[1] = t1;
|
|
941
|
+
$[2] = t2;
|
|
942
|
+
$[3] = t3;
|
|
943
|
+
} else t3 = $[3];
|
|
931
944
|
const isHovered = useOverlayMessage(iframeWindow, isContentEditable, "CAMOX_HOVER_REPEATER_ITEM", "CAMOX_HOVER_REPEATER_ITEM_END", t3);
|
|
932
945
|
const showOverlay = isContentEditable && (isHovered || isRepeaterHovered);
|
|
933
946
|
const t4 = isContentEditable ? itemId : void 0;
|
|
934
947
|
const t5 = showOverlay || void 0;
|
|
935
948
|
const t6 = mode === "layout" ? "layout" : void 0;
|
|
936
949
|
let t7;
|
|
937
|
-
if ($[
|
|
950
|
+
if ($[4] !== children || $[5] !== t4 || $[6] !== t5 || $[7] !== t6) {
|
|
938
951
|
t7 = /* @__PURE__ */ jsx("div", {
|
|
939
952
|
"data-camox-repeater-item-id": t4,
|
|
940
953
|
"data-camox-hovered": t5,
|
|
941
954
|
"data-camox-overlay-mode": t6,
|
|
942
955
|
children
|
|
943
956
|
});
|
|
944
|
-
$[
|
|
945
|
-
$[
|
|
946
|
-
$[
|
|
947
|
-
$[
|
|
948
|
-
$[
|
|
949
|
-
} else t7 = $[
|
|
957
|
+
$[4] = children;
|
|
958
|
+
$[5] = t4;
|
|
959
|
+
$[6] = t5;
|
|
960
|
+
$[7] = t6;
|
|
961
|
+
$[8] = t7;
|
|
962
|
+
} else t7 = $[8];
|
|
950
963
|
return t7;
|
|
951
964
|
};
|
|
952
965
|
const RepeaterHoverProvider = (t0) => {
|
|
953
|
-
const $ = c(
|
|
966
|
+
const $ = c(7);
|
|
967
|
+
if ($[0] !== "8cc8be56750b20682f66c3aa201873fa6c45d7eaa41d36f57252a78bdb19fa7e") {
|
|
968
|
+
for (let $i = 0; $i < 7; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
969
|
+
$[0] = "8cc8be56750b20682f66c3aa201873fa6c45d7eaa41d36f57252a78bdb19fa7e";
|
|
970
|
+
}
|
|
954
971
|
const { blockId, fieldName, children } = t0;
|
|
955
972
|
const isContentEditable = useIsEditable("site");
|
|
956
973
|
const { window: iframeWindow } = useFrame();
|
|
957
974
|
const t1 = String(blockId);
|
|
958
975
|
let t2;
|
|
959
|
-
if ($[
|
|
976
|
+
if ($[1] !== fieldName || $[2] !== t1) {
|
|
960
977
|
t2 = {
|
|
961
978
|
blockId: t1,
|
|
962
979
|
fieldName
|
|
963
980
|
};
|
|
964
|
-
$[
|
|
965
|
-
$[
|
|
966
|
-
$[
|
|
967
|
-
} else t2 = $[
|
|
981
|
+
$[1] = fieldName;
|
|
982
|
+
$[2] = t1;
|
|
983
|
+
$[3] = t2;
|
|
984
|
+
} else t2 = $[3];
|
|
968
985
|
const isHovered = useOverlayMessage(iframeWindow, isContentEditable, "CAMOX_HOVER_REPEATER", "CAMOX_HOVER_REPEATER_END", t2);
|
|
969
986
|
let t3;
|
|
970
|
-
if ($[
|
|
987
|
+
if ($[4] !== children || $[5] !== isHovered) {
|
|
971
988
|
t3 = /* @__PURE__ */ jsx(RepeaterHoverContext.Provider, {
|
|
972
989
|
value: isHovered,
|
|
973
990
|
children
|
|
974
991
|
});
|
|
975
|
-
$[
|
|
976
|
-
$[
|
|
977
|
-
$[
|
|
978
|
-
} else t3 = $[
|
|
992
|
+
$[4] = children;
|
|
993
|
+
$[5] = isHovered;
|
|
994
|
+
$[6] = t3;
|
|
995
|
+
} else t3 = $[6];
|
|
979
996
|
return t3;
|
|
980
997
|
};
|
|
981
998
|
const Repeater = (t0) => {
|
|
982
|
-
const $ = c(
|
|
999
|
+
const $ = c(30);
|
|
1000
|
+
if ($[0] !== "8cc8be56750b20682f66c3aa201873fa6c45d7eaa41d36f57252a78bdb19fa7e") {
|
|
1001
|
+
for (let $i = 0; $i < 30; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
1002
|
+
$[0] = "8cc8be56750b20682f66c3aa201873fa6c45d7eaa41d36f57252a78bdb19fa7e";
|
|
1003
|
+
}
|
|
983
1004
|
const { name, children } = t0;
|
|
984
1005
|
const blockContext = React.use(Context);
|
|
985
1006
|
if (!blockContext) throw new Error("Repeater must be used within a Block Component");
|
|
@@ -998,18 +1019,18 @@ function createBlock(options) {
|
|
|
998
1019
|
let t1;
|
|
999
1020
|
let t2;
|
|
1000
1021
|
let t3;
|
|
1001
|
-
if ($[
|
|
1022
|
+
if ($[1] !== blockId || $[2] !== children || $[3] !== fieldName || $[4] !== itemsMap || $[5] !== mode || $[6] !== name || $[7] !== parentRepeaterContext || $[8] !== source) {
|
|
1002
1023
|
let arrayValue = source ?? [];
|
|
1003
1024
|
if (!Array.isArray(arrayValue)) throw new Error(`Field "${String(name)}" is not an array`);
|
|
1004
1025
|
let t4;
|
|
1005
|
-
if ($[
|
|
1026
|
+
if ($[13] !== itemsMap) {
|
|
1006
1027
|
t4 = (item) => {
|
|
1007
1028
|
if (isItemMarker(item)) return itemsMap.get(item._itemId) ?? null;
|
|
1008
1029
|
return item;
|
|
1009
1030
|
};
|
|
1010
|
-
$[
|
|
1011
|
-
$[
|
|
1012
|
-
} else t4 = $[
|
|
1031
|
+
$[13] = itemsMap;
|
|
1032
|
+
$[14] = t4;
|
|
1033
|
+
} else t4 = $[14];
|
|
1013
1034
|
arrayValue = arrayValue.map(t4).filter(Boolean);
|
|
1014
1035
|
if (arrayValue.length === 0) {
|
|
1015
1036
|
const fieldSchema = parentRepeaterContext ? typeboxSchema.properties[parentRepeaterContext.arrayFieldName]?.items?.properties?.[fieldName] : typeboxSchema.properties[fieldName];
|
|
@@ -1019,14 +1040,14 @@ function createBlock(options) {
|
|
|
1019
1040
|
const itemProps = fieldSchema.items?.properties;
|
|
1020
1041
|
if (defaultCount > 0 && itemProps) {
|
|
1021
1042
|
let t5;
|
|
1022
|
-
if ($[
|
|
1043
|
+
if ($[15] !== defaultCount || $[16] !== itemProps) {
|
|
1023
1044
|
const itemContent = {};
|
|
1024
1045
|
for (const [propName, propSchema] of Object.entries(itemProps)) if (propSchema && typeof propSchema === "object" && "default" in propSchema) itemContent[propName] = propSchema.default;
|
|
1025
1046
|
t5 = Array.from({ length: defaultCount }, () => ({ ...itemContent }));
|
|
1026
|
-
$[
|
|
1027
|
-
$[
|
|
1028
|
-
$[
|
|
1029
|
-
} else t5 = $[
|
|
1047
|
+
$[15] = defaultCount;
|
|
1048
|
+
$[16] = itemProps;
|
|
1049
|
+
$[17] = t5;
|
|
1050
|
+
} else t5 = $[17];
|
|
1030
1051
|
arrayValue = t5;
|
|
1031
1052
|
}
|
|
1032
1053
|
}
|
|
@@ -1036,7 +1057,7 @@ function createBlock(options) {
|
|
|
1036
1057
|
t1 = blockId;
|
|
1037
1058
|
t2 = fieldName;
|
|
1038
1059
|
let t5;
|
|
1039
|
-
if ($[
|
|
1060
|
+
if ($[18] !== blockId || $[19] !== children || $[20] !== fieldName || $[21] !== mode || $[22] !== parentRepeaterContext?.containerItemId || $[23] !== settingsDefaultsForField) {
|
|
1040
1061
|
t5 = (item_0, index) => {
|
|
1041
1062
|
const isDbItem = item_0.content !== void 0 && item_0.id != null;
|
|
1042
1063
|
const itemContent_0 = {
|
|
@@ -1045,7 +1066,7 @@ function createBlock(options) {
|
|
|
1045
1066
|
};
|
|
1046
1067
|
const itemSettings = {
|
|
1047
1068
|
...settingsDefaultsForField,
|
|
1048
|
-
...
|
|
1069
|
+
...isDbItem ? item_0.settings : null
|
|
1049
1070
|
};
|
|
1050
1071
|
const itemId = isDbItem ? item_0.id : void 0;
|
|
1051
1072
|
const useItemSetting = (settingName) => itemSettings[settingName];
|
|
@@ -1064,7 +1085,8 @@ function createBlock(options) {
|
|
|
1064
1085
|
itemIndex: index,
|
|
1065
1086
|
itemContent: itemContent_0,
|
|
1066
1087
|
itemSettings,
|
|
1067
|
-
itemId
|
|
1088
|
+
itemId,
|
|
1089
|
+
containerItemId: itemId ?? parentRepeaterContext?.containerItemId
|
|
1068
1090
|
},
|
|
1069
1091
|
children: /* @__PURE__ */ jsx(RepeaterItemWrapper, {
|
|
1070
1092
|
itemId,
|
|
@@ -1074,49 +1096,54 @@ function createBlock(options) {
|
|
|
1074
1096
|
})
|
|
1075
1097
|
}, itemId ?? index);
|
|
1076
1098
|
};
|
|
1077
|
-
$[
|
|
1078
|
-
$[
|
|
1079
|
-
$[
|
|
1080
|
-
$[
|
|
1081
|
-
$[
|
|
1082
|
-
$[
|
|
1083
|
-
|
|
1099
|
+
$[18] = blockId;
|
|
1100
|
+
$[19] = children;
|
|
1101
|
+
$[20] = fieldName;
|
|
1102
|
+
$[21] = mode;
|
|
1103
|
+
$[22] = parentRepeaterContext?.containerItemId;
|
|
1104
|
+
$[23] = settingsDefaultsForField;
|
|
1105
|
+
$[24] = t5;
|
|
1106
|
+
} else t5 = $[24];
|
|
1084
1107
|
t3 = arrayValue.map(t5);
|
|
1085
|
-
$[
|
|
1086
|
-
$[
|
|
1087
|
-
$[
|
|
1088
|
-
$[
|
|
1089
|
-
$[
|
|
1090
|
-
$[
|
|
1091
|
-
$[
|
|
1092
|
-
$[
|
|
1093
|
-
$[
|
|
1094
|
-
$[
|
|
1095
|
-
$[
|
|
1096
|
-
$[
|
|
1108
|
+
$[1] = blockId;
|
|
1109
|
+
$[2] = children;
|
|
1110
|
+
$[3] = fieldName;
|
|
1111
|
+
$[4] = itemsMap;
|
|
1112
|
+
$[5] = mode;
|
|
1113
|
+
$[6] = name;
|
|
1114
|
+
$[7] = parentRepeaterContext;
|
|
1115
|
+
$[8] = source;
|
|
1116
|
+
$[9] = T0;
|
|
1117
|
+
$[10] = t1;
|
|
1118
|
+
$[11] = t2;
|
|
1119
|
+
$[12] = t3;
|
|
1097
1120
|
} else {
|
|
1098
|
-
T0 = $[
|
|
1099
|
-
t1 = $[
|
|
1100
|
-
t2 = $[
|
|
1101
|
-
t3 = $[
|
|
1121
|
+
T0 = $[9];
|
|
1122
|
+
t1 = $[10];
|
|
1123
|
+
t2 = $[11];
|
|
1124
|
+
t3 = $[12];
|
|
1102
1125
|
}
|
|
1103
1126
|
let t4;
|
|
1104
|
-
if ($[
|
|
1127
|
+
if ($[25] !== T0 || $[26] !== t1 || $[27] !== t2 || $[28] !== t3) {
|
|
1105
1128
|
t4 = /* @__PURE__ */ jsx(T0, {
|
|
1106
1129
|
blockId: t1,
|
|
1107
1130
|
fieldName: t2,
|
|
1108
1131
|
children: t3
|
|
1109
1132
|
});
|
|
1110
|
-
$[
|
|
1111
|
-
$[
|
|
1112
|
-
$[
|
|
1113
|
-
$[
|
|
1114
|
-
$[
|
|
1115
|
-
} else t4 = $[
|
|
1133
|
+
$[25] = T0;
|
|
1134
|
+
$[26] = t1;
|
|
1135
|
+
$[27] = t2;
|
|
1136
|
+
$[28] = t3;
|
|
1137
|
+
$[29] = t4;
|
|
1138
|
+
} else t4 = $[29];
|
|
1116
1139
|
return t4;
|
|
1117
1140
|
};
|
|
1118
1141
|
const BlockComponent = (t0) => {
|
|
1119
|
-
const $ = c(
|
|
1142
|
+
const $ = c(70);
|
|
1143
|
+
if ($[0] !== "8cc8be56750b20682f66c3aa201873fa6c45d7eaa41d36f57252a78bdb19fa7e") {
|
|
1144
|
+
for (let $i = 0; $i < 70; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
1145
|
+
$[0] = "8cc8be56750b20682f66c3aa201873fa6c45d7eaa41d36f57252a78bdb19fa7e";
|
|
1146
|
+
}
|
|
1120
1147
|
const { blockData, mode, isFirstBlock, showAddBlockTop, showAddBlockBottom, addBlockAfterPosition } = t0;
|
|
1121
1148
|
const isContentEditable = useIsEditable(mode);
|
|
1122
1149
|
const { window: iframeWindow } = useFrame();
|
|
@@ -1130,80 +1157,80 @@ function createBlock(options) {
|
|
|
1130
1157
|
const [isFirstRender, setIsFirstRender] = React.useState(true);
|
|
1131
1158
|
let t1;
|
|
1132
1159
|
let t2;
|
|
1133
|
-
if ($[
|
|
1160
|
+
if ($[1] !== isFirstRender) {
|
|
1134
1161
|
t1 = () => {
|
|
1135
1162
|
if (isFirstRender) setIsFirstRender(false);
|
|
1136
1163
|
};
|
|
1137
1164
|
t2 = [isFirstRender];
|
|
1138
|
-
$[
|
|
1139
|
-
$[
|
|
1140
|
-
$[
|
|
1165
|
+
$[1] = isFirstRender;
|
|
1166
|
+
$[2] = t1;
|
|
1167
|
+
$[3] = t2;
|
|
1141
1168
|
} else {
|
|
1142
|
-
t1 = $[
|
|
1143
|
-
t2 = $[
|
|
1169
|
+
t1 = $[2];
|
|
1170
|
+
t2 = $[3];
|
|
1144
1171
|
}
|
|
1145
1172
|
React.useEffect(t1, t2);
|
|
1146
1173
|
let t3;
|
|
1147
|
-
if ($[
|
|
1174
|
+
if ($[4] !== isBlockSelected || $[5] !== isFirstRender) {
|
|
1148
1175
|
t3 = () => {
|
|
1149
1176
|
if (isBlockSelected && ref.current) ref.current.scrollIntoView({
|
|
1150
1177
|
behavior: isFirstRender ? "instant" : "smooth",
|
|
1151
1178
|
block: isFirstRender ? "start" : "nearest"
|
|
1152
1179
|
});
|
|
1153
1180
|
};
|
|
1154
|
-
$[
|
|
1155
|
-
$[
|
|
1156
|
-
$[
|
|
1157
|
-
} else t3 = $[
|
|
1181
|
+
$[4] = isBlockSelected;
|
|
1182
|
+
$[5] = isFirstRender;
|
|
1183
|
+
$[6] = t3;
|
|
1184
|
+
} else t3 = $[6];
|
|
1158
1185
|
let t4;
|
|
1159
|
-
if ($[
|
|
1186
|
+
if ($[7] !== isBlockSelected || $[8] !== isFirstRender || $[9] !== isPageContentSheetOpen) {
|
|
1160
1187
|
t4 = [
|
|
1161
1188
|
isBlockSelected,
|
|
1162
1189
|
isFirstRender,
|
|
1163
1190
|
isPageContentSheetOpen
|
|
1164
1191
|
];
|
|
1165
|
-
$[
|
|
1166
|
-
$[
|
|
1167
|
-
$[
|
|
1168
|
-
$[
|
|
1169
|
-
} else t4 = $[
|
|
1192
|
+
$[7] = isBlockSelected;
|
|
1193
|
+
$[8] = isFirstRender;
|
|
1194
|
+
$[9] = isPageContentSheetOpen;
|
|
1195
|
+
$[10] = t4;
|
|
1196
|
+
} else t4 = $[10];
|
|
1170
1197
|
React.useEffect(t3, t4);
|
|
1171
1198
|
const t5 = String(blockData._id);
|
|
1172
1199
|
let t6;
|
|
1173
|
-
if ($[
|
|
1200
|
+
if ($[11] !== t5) {
|
|
1174
1201
|
t6 = { blockId: t5 };
|
|
1175
|
-
$[
|
|
1176
|
-
$[
|
|
1177
|
-
} else t6 = $[
|
|
1202
|
+
$[11] = t5;
|
|
1203
|
+
$[12] = t6;
|
|
1204
|
+
} else t6 = $[12];
|
|
1178
1205
|
const isHoveredFromSidebar = useOverlayMessage(iframeWindow, isContentEditable, "CAMOX_HOVER_BLOCK", "CAMOX_HOVER_BLOCK_END", t6);
|
|
1179
1206
|
let t7;
|
|
1180
1207
|
let t8;
|
|
1181
|
-
if ($[
|
|
1208
|
+
if ($[13] !== isHoveredFromSidebar) {
|
|
1182
1209
|
t7 = () => {
|
|
1183
1210
|
setIsHovered(isHoveredFromSidebar);
|
|
1184
1211
|
};
|
|
1185
1212
|
t8 = [isHoveredFromSidebar];
|
|
1186
|
-
$[
|
|
1187
|
-
$[
|
|
1188
|
-
$[
|
|
1213
|
+
$[13] = isHoveredFromSidebar;
|
|
1214
|
+
$[14] = t7;
|
|
1215
|
+
$[15] = t8;
|
|
1189
1216
|
} else {
|
|
1190
|
-
t7 = $[
|
|
1191
|
-
t8 = $[
|
|
1217
|
+
t7 = $[14];
|
|
1218
|
+
t8 = $[15];
|
|
1192
1219
|
}
|
|
1193
1220
|
React.useEffect(t7, t8);
|
|
1194
1221
|
let result;
|
|
1195
|
-
if ($[
|
|
1222
|
+
if ($[16] !== blockData.content) {
|
|
1196
1223
|
result = { ...blockData.content };
|
|
1197
1224
|
for (const key in result) {
|
|
1198
1225
|
const value = result[key];
|
|
1199
1226
|
if (Array.isArray(value) && value.length > 0 && value[0]?.content !== void 0) result[key] = value.map(_temp9);
|
|
1200
1227
|
}
|
|
1201
|
-
$[
|
|
1202
|
-
$[
|
|
1203
|
-
} else result = $[
|
|
1228
|
+
$[16] = blockData.content;
|
|
1229
|
+
$[17] = result;
|
|
1230
|
+
} else result = $[17];
|
|
1204
1231
|
const normalizedContent = result;
|
|
1205
1232
|
let t9;
|
|
1206
|
-
if ($[
|
|
1233
|
+
if ($[18] !== blockData._id || $[19] !== isContentEditable) {
|
|
1207
1234
|
t9 = (e) => {
|
|
1208
1235
|
if (!isContentEditable) return;
|
|
1209
1236
|
if (e.target.closest("[data-camox-field-id]")) return;
|
|
@@ -1212,31 +1239,31 @@ function createBlock(options) {
|
|
|
1212
1239
|
blockId: blockData._id
|
|
1213
1240
|
});
|
|
1214
1241
|
};
|
|
1215
|
-
$[
|
|
1216
|
-
$[
|
|
1217
|
-
$[
|
|
1218
|
-
} else t9 = $[
|
|
1242
|
+
$[18] = blockData._id;
|
|
1243
|
+
$[19] = isContentEditable;
|
|
1244
|
+
$[20] = t9;
|
|
1245
|
+
} else t9 = $[20];
|
|
1219
1246
|
const handleClick = t9;
|
|
1220
1247
|
let t10;
|
|
1221
|
-
if ($[
|
|
1248
|
+
if ($[21] !== isContentEditable) {
|
|
1222
1249
|
t10 = () => {
|
|
1223
1250
|
if (isContentEditable) setIsHovered(true);
|
|
1224
1251
|
};
|
|
1225
|
-
$[
|
|
1226
|
-
$[
|
|
1227
|
-
} else t10 = $[
|
|
1252
|
+
$[21] = isContentEditable;
|
|
1253
|
+
$[22] = t10;
|
|
1254
|
+
} else t10 = $[22];
|
|
1228
1255
|
const handleMouseEnter = t10;
|
|
1229
1256
|
let t11;
|
|
1230
|
-
if ($[
|
|
1257
|
+
if ($[23] !== isContentEditable) {
|
|
1231
1258
|
t11 = () => {
|
|
1232
1259
|
if (isContentEditable) setIsHovered(false);
|
|
1233
1260
|
};
|
|
1234
|
-
$[
|
|
1235
|
-
$[
|
|
1236
|
-
} else t11 = $[
|
|
1261
|
+
$[23] = isContentEditable;
|
|
1262
|
+
$[24] = t11;
|
|
1263
|
+
} else t11 = $[24];
|
|
1237
1264
|
const handleMouseLeave = t11;
|
|
1238
1265
|
let t12;
|
|
1239
|
-
if ($[
|
|
1266
|
+
if ($[25] !== addBlockAfterPosition || $[26] !== blockData.position) {
|
|
1240
1267
|
t12 = (insertPosition) => {
|
|
1241
1268
|
postOverlayMessage({
|
|
1242
1269
|
type: "CAMOX_ADD_BLOCK_REQUEST",
|
|
@@ -1245,70 +1272,70 @@ function createBlock(options) {
|
|
|
1245
1272
|
...addBlockAfterPosition !== void 0 && { afterPosition: addBlockAfterPosition }
|
|
1246
1273
|
});
|
|
1247
1274
|
};
|
|
1248
|
-
$[
|
|
1249
|
-
$[
|
|
1250
|
-
$[
|
|
1251
|
-
} else t12 = $[
|
|
1275
|
+
$[25] = addBlockAfterPosition;
|
|
1276
|
+
$[26] = blockData.position;
|
|
1277
|
+
$[27] = t12;
|
|
1278
|
+
} else t12 = $[27];
|
|
1252
1279
|
const handleAddBlockClick = t12;
|
|
1253
1280
|
const shouldShowOverlay = isContentEditable && (isHovered || isBlockSelected) && !isAddBlockSheetOpen;
|
|
1254
1281
|
const shouldShowSheetOverlay = isAddBlockSheetOpen && mode !== "peek" || isPageContentSheetOpen && !isBlockSelected;
|
|
1255
1282
|
let t13;
|
|
1256
|
-
if ($[
|
|
1283
|
+
if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1257
1284
|
t13 = {
|
|
1258
1285
|
position: "relative",
|
|
1259
1286
|
scrollMargin: "5rem",
|
|
1260
1287
|
background: "var(--background)"
|
|
1261
1288
|
};
|
|
1262
|
-
$[
|
|
1263
|
-
} else t13 = $[
|
|
1289
|
+
$[28] = t13;
|
|
1290
|
+
} else t13 = $[28];
|
|
1264
1291
|
const t14 = isContentEditable ? blockData._id : void 0;
|
|
1265
1292
|
const t15 = shouldShowOverlay && !isBlockSelected || void 0;
|
|
1266
1293
|
const t16 = shouldShowOverlay && isBlockSelected || void 0;
|
|
1267
1294
|
const t17 = mode === "layout" ? "layout" : void 0;
|
|
1268
1295
|
const t18 = blockData._id;
|
|
1269
1296
|
let t19;
|
|
1270
|
-
if ($[
|
|
1297
|
+
if ($[29] !== blockData.content) {
|
|
1271
1298
|
t19 = {
|
|
1272
1299
|
...contentDefaults,
|
|
1273
1300
|
...blockData.content
|
|
1274
1301
|
};
|
|
1275
|
-
$[
|
|
1276
|
-
$[
|
|
1277
|
-
} else t19 = $[
|
|
1302
|
+
$[29] = blockData.content;
|
|
1303
|
+
$[30] = t19;
|
|
1304
|
+
} else t19 = $[30];
|
|
1278
1305
|
const merged = t19;
|
|
1279
1306
|
let overrides;
|
|
1280
|
-
if ($[
|
|
1307
|
+
if ($[31] !== merged) {
|
|
1281
1308
|
overrides = {};
|
|
1282
1309
|
for (const key_0 in merged) {
|
|
1283
1310
|
const val = merged[key_0];
|
|
1284
1311
|
if (val && typeof val === "object" && "url" in val && !val.url && contentDefaults[key_0]) overrides[key_0] = contentDefaults[key_0];
|
|
1285
1312
|
}
|
|
1286
|
-
$[
|
|
1287
|
-
$[
|
|
1288
|
-
} else overrides = $[
|
|
1313
|
+
$[31] = merged;
|
|
1314
|
+
$[32] = overrides;
|
|
1315
|
+
} else overrides = $[32];
|
|
1289
1316
|
let t20;
|
|
1290
|
-
if ($[
|
|
1317
|
+
if ($[33] !== merged || $[34] !== overrides) {
|
|
1291
1318
|
t20 = {
|
|
1292
1319
|
...merged,
|
|
1293
1320
|
...overrides
|
|
1294
1321
|
};
|
|
1295
|
-
$[
|
|
1296
|
-
$[
|
|
1297
|
-
$[
|
|
1298
|
-
} else t20 = $[
|
|
1322
|
+
$[33] = merged;
|
|
1323
|
+
$[34] = overrides;
|
|
1324
|
+
$[35] = t20;
|
|
1325
|
+
} else t20 = $[35];
|
|
1299
1326
|
const t21 = t20;
|
|
1300
1327
|
let t22;
|
|
1301
|
-
if ($[
|
|
1328
|
+
if ($[36] !== blockData.settings) {
|
|
1302
1329
|
t22 = {
|
|
1303
1330
|
...settingsDefaults,
|
|
1304
1331
|
...blockData.settings
|
|
1305
1332
|
};
|
|
1306
|
-
$[
|
|
1307
|
-
$[
|
|
1308
|
-
} else t22 = $[
|
|
1333
|
+
$[36] = blockData.settings;
|
|
1334
|
+
$[37] = t22;
|
|
1335
|
+
} else t22 = $[37];
|
|
1309
1336
|
const t23 = t22;
|
|
1310
1337
|
let t24;
|
|
1311
|
-
if ($[
|
|
1338
|
+
if ($[38] !== blockData._id || $[39] !== isHovered || $[40] !== mode || $[41] !== t21 || $[42] !== t23) {
|
|
1312
1339
|
t24 = {
|
|
1313
1340
|
blockId: t18,
|
|
1314
1341
|
content: t21,
|
|
@@ -1317,40 +1344,40 @@ function createBlock(options) {
|
|
|
1317
1344
|
isHovered,
|
|
1318
1345
|
setIsHovered
|
|
1319
1346
|
};
|
|
1320
|
-
$[
|
|
1321
|
-
$[
|
|
1322
|
-
$[
|
|
1323
|
-
$[
|
|
1324
|
-
$[
|
|
1325
|
-
$[
|
|
1326
|
-
} else t24 = $[
|
|
1347
|
+
$[38] = blockData._id;
|
|
1348
|
+
$[39] = isHovered;
|
|
1349
|
+
$[40] = mode;
|
|
1350
|
+
$[41] = t21;
|
|
1351
|
+
$[42] = t23;
|
|
1352
|
+
$[43] = t24;
|
|
1353
|
+
} else t24 = $[43];
|
|
1327
1354
|
let t25;
|
|
1328
|
-
if ($[
|
|
1355
|
+
if ($[44] !== normalizedContent) {
|
|
1329
1356
|
t25 = /* @__PURE__ */ jsx(options.component, { content: normalizedContent });
|
|
1330
|
-
$[
|
|
1331
|
-
$[
|
|
1332
|
-
} else t25 = $[
|
|
1357
|
+
$[44] = normalizedContent;
|
|
1358
|
+
$[45] = t25;
|
|
1359
|
+
} else t25 = $[45];
|
|
1333
1360
|
let t26;
|
|
1334
|
-
if ($[
|
|
1361
|
+
if ($[46] !== t24 || $[47] !== t25) {
|
|
1335
1362
|
t26 = /* @__PURE__ */ jsx(Context.Provider, {
|
|
1336
1363
|
value: t24,
|
|
1337
1364
|
children: t25
|
|
1338
1365
|
});
|
|
1339
|
-
$[
|
|
1340
|
-
$[
|
|
1341
|
-
$[
|
|
1342
|
-
} else t26 = $[
|
|
1366
|
+
$[46] = t24;
|
|
1367
|
+
$[47] = t25;
|
|
1368
|
+
$[48] = t26;
|
|
1369
|
+
} else t26 = $[48];
|
|
1343
1370
|
let t27;
|
|
1344
|
-
if ($[
|
|
1371
|
+
if ($[49] !== shouldShowSheetOverlay) {
|
|
1345
1372
|
t27 = /* @__PURE__ */ jsx("div", {
|
|
1346
1373
|
className: "camox-sheet-overlay",
|
|
1347
1374
|
...shouldShowSheetOverlay ? { "data-camox-visible": "" } : {}
|
|
1348
1375
|
});
|
|
1349
|
-
$[
|
|
1350
|
-
$[
|
|
1351
|
-
} else t27 = $[
|
|
1376
|
+
$[49] = shouldShowSheetOverlay;
|
|
1377
|
+
$[50] = t27;
|
|
1378
|
+
} else t27 = $[50];
|
|
1352
1379
|
let t28;
|
|
1353
|
-
if ($[
|
|
1380
|
+
if ($[51] !== handleAddBlockClick || $[52] !== isAnySideSheetOpen || $[53] !== isFirstBlock || $[54] !== mode || $[55] !== shouldShowOverlay || $[56] !== showAddBlockBottom || $[57] !== showAddBlockTop) {
|
|
1354
1381
|
t28 = shouldShowOverlay && /* @__PURE__ */ jsxs(Fragment, { children: [(showAddBlockTop ?? (mode !== "layout" && !isFirstBlock)) && /* @__PURE__ */ jsx(AddBlockControlBar, {
|
|
1355
1382
|
position: "top",
|
|
1356
1383
|
hidden: isAnySideSheetOpen,
|
|
@@ -1362,17 +1389,17 @@ function createBlock(options) {
|
|
|
1362
1389
|
onMouseLeave: () => setIsHovered(false),
|
|
1363
1390
|
onClick: () => handleAddBlockClick("after")
|
|
1364
1391
|
})] });
|
|
1365
|
-
$[
|
|
1366
|
-
$[
|
|
1367
|
-
$[
|
|
1368
|
-
$[
|
|
1369
|
-
$[
|
|
1370
|
-
$[
|
|
1371
|
-
$[
|
|
1372
|
-
$[
|
|
1373
|
-
} else t28 = $[
|
|
1392
|
+
$[51] = handleAddBlockClick;
|
|
1393
|
+
$[52] = isAnySideSheetOpen;
|
|
1394
|
+
$[53] = isFirstBlock;
|
|
1395
|
+
$[54] = mode;
|
|
1396
|
+
$[55] = shouldShowOverlay;
|
|
1397
|
+
$[56] = showAddBlockBottom;
|
|
1398
|
+
$[57] = showAddBlockTop;
|
|
1399
|
+
$[58] = t28;
|
|
1400
|
+
} else t28 = $[58];
|
|
1374
1401
|
let t29;
|
|
1375
|
-
if ($[
|
|
1402
|
+
if ($[59] !== handleClick || $[60] !== handleMouseEnter || $[61] !== handleMouseLeave || $[62] !== t14 || $[63] !== t15 || $[64] !== t16 || $[65] !== t17 || $[66] !== t26 || $[67] !== t27 || $[68] !== t28) {
|
|
1376
1403
|
t29 = /* @__PURE__ */ jsxs("div", {
|
|
1377
1404
|
className: "group visual-editing-block",
|
|
1378
1405
|
ref,
|
|
@@ -1390,18 +1417,18 @@ function createBlock(options) {
|
|
|
1390
1417
|
t28
|
|
1391
1418
|
]
|
|
1392
1419
|
});
|
|
1393
|
-
$[
|
|
1394
|
-
$[
|
|
1395
|
-
$[
|
|
1396
|
-
$[
|
|
1397
|
-
$[
|
|
1398
|
-
$[
|
|
1399
|
-
$[
|
|
1400
|
-
$[
|
|
1401
|
-
$[
|
|
1402
|
-
$[
|
|
1403
|
-
$[
|
|
1404
|
-
} else t29 = $[
|
|
1420
|
+
$[59] = handleClick;
|
|
1421
|
+
$[60] = handleMouseEnter;
|
|
1422
|
+
$[61] = handleMouseLeave;
|
|
1423
|
+
$[62] = t14;
|
|
1424
|
+
$[63] = t15;
|
|
1425
|
+
$[64] = t16;
|
|
1426
|
+
$[65] = t17;
|
|
1427
|
+
$[66] = t26;
|
|
1428
|
+
$[67] = t27;
|
|
1429
|
+
$[68] = t28;
|
|
1430
|
+
$[69] = t29;
|
|
1431
|
+
} else t29 = $[69];
|
|
1405
1432
|
return t29;
|
|
1406
1433
|
};
|
|
1407
1434
|
const useSetting = (name) => {
|
|
@@ -1414,7 +1441,11 @@ function createBlock(options) {
|
|
|
1414
1441
|
* Provides the same hover, selection, and sheet overlays as the main BlockComponent.
|
|
1415
1442
|
*/
|
|
1416
1443
|
const Detached = (t0) => {
|
|
1417
|
-
const $ = c(
|
|
1444
|
+
const $ = c(31);
|
|
1445
|
+
if ($[0] !== "8cc8be56750b20682f66c3aa201873fa6c45d7eaa41d36f57252a78bdb19fa7e") {
|
|
1446
|
+
for (let $i = 0; $i < 31; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
1447
|
+
$[0] = "8cc8be56750b20682f66c3aa201873fa6c45d7eaa41d36f57252a78bdb19fa7e";
|
|
1448
|
+
}
|
|
1418
1449
|
const { children } = t0;
|
|
1419
1450
|
const ctx = React.use(Context);
|
|
1420
1451
|
if (!ctx) throw new Error("Detached must be used within a Block Component");
|
|
@@ -1427,32 +1458,32 @@ function createBlock(options) {
|
|
|
1427
1458
|
const isBlockSelected = selection?.blockId === blockId;
|
|
1428
1459
|
const t1 = String(blockId);
|
|
1429
1460
|
let t2;
|
|
1430
|
-
if ($[
|
|
1461
|
+
if ($[1] !== t1) {
|
|
1431
1462
|
t2 = { blockId: t1 };
|
|
1432
|
-
$[
|
|
1433
|
-
$[
|
|
1434
|
-
} else t2 = $[
|
|
1463
|
+
$[1] = t1;
|
|
1464
|
+
$[2] = t2;
|
|
1465
|
+
} else t2 = $[2];
|
|
1435
1466
|
const isHoveredFromSidebar = useOverlayMessage(iframeWindow, isContentEditable, "CAMOX_HOVER_BLOCK", "CAMOX_HOVER_BLOCK_END", t2);
|
|
1436
1467
|
let t3;
|
|
1437
1468
|
let t4;
|
|
1438
|
-
if ($[
|
|
1469
|
+
if ($[3] !== isHoveredFromSidebar || $[4] !== setIsHovered) {
|
|
1439
1470
|
t3 = () => {
|
|
1440
1471
|
setIsHovered(isHoveredFromSidebar);
|
|
1441
1472
|
};
|
|
1442
1473
|
t4 = [isHoveredFromSidebar, setIsHovered];
|
|
1443
|
-
$[
|
|
1444
|
-
$[
|
|
1445
|
-
$[
|
|
1446
|
-
$[
|
|
1474
|
+
$[3] = isHoveredFromSidebar;
|
|
1475
|
+
$[4] = setIsHovered;
|
|
1476
|
+
$[5] = t3;
|
|
1477
|
+
$[6] = t4;
|
|
1447
1478
|
} else {
|
|
1448
|
-
t3 = $[
|
|
1449
|
-
t4 = $[
|
|
1479
|
+
t3 = $[5];
|
|
1480
|
+
t4 = $[6];
|
|
1450
1481
|
}
|
|
1451
1482
|
React.useEffect(t3, t4);
|
|
1452
1483
|
const shouldShowOverlay = isContentEditable && (isHovered || isBlockSelected) && !isAddBlockSheetOpen;
|
|
1453
1484
|
const shouldShowSheetOverlay = isAddBlockSheetOpen && mode !== "peek" || isPageContentSheetOpen && !isBlockSelected;
|
|
1454
1485
|
let t5;
|
|
1455
|
-
if ($[
|
|
1486
|
+
if ($[7] !== blockId || $[8] !== isContentEditable) {
|
|
1456
1487
|
t5 = (e) => {
|
|
1457
1488
|
if (!isContentEditable) return;
|
|
1458
1489
|
e.stopPropagation();
|
|
@@ -1461,35 +1492,35 @@ function createBlock(options) {
|
|
|
1461
1492
|
blockId
|
|
1462
1493
|
});
|
|
1463
1494
|
};
|
|
1464
|
-
$[
|
|
1465
|
-
$[
|
|
1466
|
-
$[
|
|
1467
|
-
} else t5 = $[
|
|
1495
|
+
$[7] = blockId;
|
|
1496
|
+
$[8] = isContentEditable;
|
|
1497
|
+
$[9] = t5;
|
|
1498
|
+
} else t5 = $[9];
|
|
1468
1499
|
const handleClick = t5;
|
|
1469
1500
|
let t6;
|
|
1470
|
-
if ($[
|
|
1501
|
+
if ($[10] !== isContentEditable || $[11] !== setIsHovered) {
|
|
1471
1502
|
t6 = () => {
|
|
1472
1503
|
if (isContentEditable) setIsHovered(true);
|
|
1473
1504
|
};
|
|
1474
|
-
$[
|
|
1475
|
-
$[
|
|
1476
|
-
$[
|
|
1477
|
-
} else t6 = $[
|
|
1505
|
+
$[10] = isContentEditable;
|
|
1506
|
+
$[11] = setIsHovered;
|
|
1507
|
+
$[12] = t6;
|
|
1508
|
+
} else t6 = $[12];
|
|
1478
1509
|
const handleMouseEnter = t6;
|
|
1479
1510
|
let t7;
|
|
1480
|
-
if ($[
|
|
1511
|
+
if ($[13] !== isContentEditable || $[14] !== setIsHovered) {
|
|
1481
1512
|
t7 = () => {
|
|
1482
1513
|
if (isContentEditable) setIsHovered(false);
|
|
1483
1514
|
};
|
|
1484
|
-
$[
|
|
1485
|
-
$[
|
|
1486
|
-
$[
|
|
1487
|
-
} else t7 = $[
|
|
1515
|
+
$[13] = isContentEditable;
|
|
1516
|
+
$[14] = setIsHovered;
|
|
1517
|
+
$[15] = t7;
|
|
1518
|
+
} else t7 = $[15];
|
|
1488
1519
|
const handleMouseLeave = t7;
|
|
1489
1520
|
const [container, setContainer] = React.useState(null);
|
|
1490
1521
|
const t8 = shouldShowSheetOverlay ? 0 : 1;
|
|
1491
1522
|
let t9;
|
|
1492
|
-
if ($[
|
|
1523
|
+
if ($[16] !== children || $[17] !== handleClick || $[18] !== handleMouseEnter || $[19] !== handleMouseLeave || $[20] !== t8) {
|
|
1493
1524
|
t9 = children({
|
|
1494
1525
|
ref: setContainer,
|
|
1495
1526
|
style: { opacity: t8 },
|
|
@@ -1497,15 +1528,15 @@ function createBlock(options) {
|
|
|
1497
1528
|
onMouseEnter: handleMouseEnter,
|
|
1498
1529
|
onMouseLeave: handleMouseLeave
|
|
1499
1530
|
});
|
|
1500
|
-
$[
|
|
1501
|
-
$[
|
|
1502
|
-
$[
|
|
1503
|
-
$[
|
|
1504
|
-
$[
|
|
1505
|
-
$[
|
|
1506
|
-
} else t9 = $[
|
|
1531
|
+
$[16] = children;
|
|
1532
|
+
$[17] = handleClick;
|
|
1533
|
+
$[18] = handleMouseEnter;
|
|
1534
|
+
$[19] = handleMouseLeave;
|
|
1535
|
+
$[20] = t8;
|
|
1536
|
+
$[21] = t9;
|
|
1537
|
+
} else t9 = $[21];
|
|
1507
1538
|
let t10;
|
|
1508
|
-
if ($[
|
|
1539
|
+
if ($[22] !== blockId || $[23] !== container || $[24] !== isBlockSelected || $[25] !== mode || $[26] !== shouldShowOverlay) {
|
|
1509
1540
|
t10 = container && createPortal(/* @__PURE__ */ jsx(Fragment, { children: shouldShowOverlay && /* @__PURE__ */ jsx("div", {
|
|
1510
1541
|
"data-camox-block-id": blockId,
|
|
1511
1542
|
"data-camox-detached": true,
|
|
@@ -1518,20 +1549,20 @@ function createBlock(options) {
|
|
|
1518
1549
|
zIndex: 10
|
|
1519
1550
|
}
|
|
1520
1551
|
}) }), container);
|
|
1521
|
-
$[
|
|
1522
|
-
$[
|
|
1523
|
-
$[
|
|
1524
|
-
$[
|
|
1525
|
-
$[
|
|
1526
|
-
$[
|
|
1527
|
-
} else t10 = $[
|
|
1552
|
+
$[22] = blockId;
|
|
1553
|
+
$[23] = container;
|
|
1554
|
+
$[24] = isBlockSelected;
|
|
1555
|
+
$[25] = mode;
|
|
1556
|
+
$[26] = shouldShowOverlay;
|
|
1557
|
+
$[27] = t10;
|
|
1558
|
+
} else t10 = $[27];
|
|
1528
1559
|
let t11;
|
|
1529
|
-
if ($[
|
|
1560
|
+
if ($[28] !== t10 || $[29] !== t9) {
|
|
1530
1561
|
t11 = /* @__PURE__ */ jsxs(Fragment, { children: [t9, t10] });
|
|
1531
|
-
$[
|
|
1532
|
-
$[
|
|
1533
|
-
$[
|
|
1534
|
-
} else t11 = $[
|
|
1562
|
+
$[28] = t10;
|
|
1563
|
+
$[29] = t9;
|
|
1564
|
+
$[30] = t11;
|
|
1565
|
+
} else t11 = $[30];
|
|
1535
1566
|
return t11;
|
|
1536
1567
|
};
|
|
1537
1568
|
return {
|
|
@@ -1544,6 +1575,11 @@ function createBlock(options) {
|
|
|
1544
1575
|
Repeater,
|
|
1545
1576
|
useSetting,
|
|
1546
1577
|
_internal: {
|
|
1578
|
+
/**
|
|
1579
|
+
* The react component to be used at the page level when mapping on blocks content.
|
|
1580
|
+
* It exposes context that will be consumed by the Field component, and provides visual editing
|
|
1581
|
+
* capabilities (e.g. delete and reorder blocks).
|
|
1582
|
+
*/
|
|
1547
1583
|
Component: BlockComponent,
|
|
1548
1584
|
id: options.id,
|
|
1549
1585
|
title: options.title,
|