camox 0.69.0 → 0.72.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.
Files changed (89) hide show
  1. package/dist/core/createApp.d.ts +4 -103
  2. package/dist/core/createApp.js +3 -24
  3. package/dist/core/createBlock.d.ts +2 -2
  4. package/dist/core/createBlock.js +55 -192
  5. package/dist/core/createLayout.d.ts +6 -77
  6. package/dist/core/createLayout.js +12 -50
  7. package/dist/core/editing/createEditableBlock.d.ts +9 -75
  8. package/dist/core/editing/createEditableBlock.js +258 -640
  9. package/dist/core/hooks/useArtifactHost.js +56 -46
  10. package/dist/core/hooks/useIsEditable.js +2 -2
  11. package/dist/core/lib/artifact.d.ts +4 -0
  12. package/dist/core/lib/artifactData.js +8 -3
  13. package/dist/core/lib/artifactHost.js +40 -0
  14. package/dist/core/lib/artifactRuntime.js +20 -1
  15. package/dist/core/lib/contentType.d.ts +23 -38
  16. package/dist/core/lib/contentType.js +34 -62
  17. package/dist/core/lib/iconTypes.d.ts +0 -3
  18. package/dist/core/lib/icons.js +63 -51
  19. package/dist/core/lib/recordScope.js +1 -1
  20. package/dist/features/canvas/CanvasOverlays.js +94 -176
  21. package/dist/features/canvas/CanvasPageFrame.js +62 -68
  22. package/dist/features/canvas/CanvasPreviewPageSlot.js +1 -3
  23. package/dist/features/canvas/canvasOverlayGeometry.js +1 -7
  24. package/dist/features/canvas/sidebar/CuratedPageInspector.js +3 -21
  25. package/dist/features/canvas/sidebar/LayoutPageBlocks.js +1 -2
  26. package/dist/features/canvas/useCanvasCamera.js +1 -1
  27. package/dist/features/canvas/useCanvasFrame.js +1 -1
  28. package/dist/features/content/ContentCollection.js +2 -2
  29. package/dist/features/content/collection-form.js +6 -7
  30. package/dist/features/page/CuratedPageContent.js +15 -24
  31. package/dist/features/page/UnplacedBlockContent.js +1 -6
  32. package/dist/features/preview/CamoxPreview.js +30 -33
  33. package/dist/features/preview/EditablePageContent.js +131 -151
  34. package/dist/features/preview/components/BlockActionsPopover.js +43 -152
  35. package/dist/features/preview/components/CanvasPreview.js +2 -2
  36. package/dist/features/preview/components/Frame.js +3 -3
  37. package/dist/features/preview/components/IconFieldEditor.js +1 -1
  38. package/dist/features/preview/components/ItemFieldsEditor.js +1 -3
  39. package/dist/features/preview/components/Overlays.js +18 -84
  40. package/dist/features/preview/components/PageTree.js +57 -103
  41. package/dist/features/preview/components/PreviewPanel.js +8 -11
  42. package/dist/features/preview/components/RecordCombobox.js +65 -78
  43. package/dist/features/preview/components/ReferenceFieldEditor.js +1 -19
  44. package/dist/features/preview/components/ReferenceListFieldEditor.js +1 -19
  45. package/dist/features/preview/components/RemovedBlockPlaceholder.js +2 -2
  46. package/dist/features/preview/components/SelectionEditor.js +5 -4
  47. package/dist/features/preview/components/useRepeatableItemActions.js +18 -24
  48. package/dist/features/preview/components/useUpdateBlockPosition.js +1 -1
  49. package/dist/features/preview/overlayMessages.js +1 -4
  50. package/dist/features/preview/previewStore.js +3 -23
  51. package/dist/features/renderer/RendererApp.js +17 -141
  52. package/dist/features/renderer/definitionAnswers.js +1 -8
  53. package/dist/features/renderer/rendererHost.js +1 -31
  54. package/dist/features/renderer/studioConnection.js +1 -25
  55. package/dist/features/runtime/pageApp.js +8 -4
  56. package/dist/features/runtime/runtime.js +3 -3
  57. package/dist/features/studio/agentRunToast.js +71 -0
  58. package/dist/features/studio/components/ChatWidget.js +2 -0
  59. package/dist/features/studio/components/DraftBar.js +2 -3
  60. package/dist/features/studio/components/DraftsControl.js +150 -176
  61. package/dist/features/studio/components/ReviewDraftSheet.js +344 -548
  62. package/dist/features/studio/components/ThreadMessages.js +89 -22
  63. package/dist/features/studio/draftLabel.js +1 -1
  64. package/dist/features/studio/studioStore.js +5 -17
  65. package/dist/features/studio/viewSwitch.js +2 -4
  66. package/dist/features/vite/blockBoilerplate.js +1 -1
  67. package/dist/features/vite/definitionsSync.js +1 -8
  68. package/dist/lib/queries.js +0 -1
  69. package/dist/lib/studio-definitions.js +0 -2
  70. package/dist/lib/studio-reads.js +0 -5
  71. package/dist/lib/use-thread.js +196 -138
  72. package/dist/package.js +1 -1
  73. package/dist/studio-overlays.css +0 -29
  74. package/dist/studio.css +1 -1
  75. package/package.json +6 -4
  76. package/skills/camox/SKILL.md +1 -1
  77. package/skills/camox/references/artifacts.md +89 -5
  78. package/skills/camox/references/block-definitions.md +21 -25
  79. package/skills/camox/references/dom-integrations.md +1 -1
  80. package/skills/camox/references/layout-definitions.md +3 -12
  81. package/skills/camox/references/routed-layouts.md +2 -2
  82. package/skills/camox-expand/SKILL.md +5 -5
  83. package/skills/camoxify/SKILL.md +4 -4
  84. package/dist/features/canvas/canvasInsertionSeams.js +0 -44
  85. package/dist/features/preview/components/AddBlockSheet.js +0 -314
  86. package/dist/features/preview/components/BlockPeek.js +0 -66
  87. package/dist/features/preview/components/BlockThumbnail.js +0 -281
  88. package/dist/features/preview/components/blockGridNavigation.js +0 -15
  89. package/dist/features/preview/referencePickerFocus.js +0 -29
@@ -1,5 +1,6 @@
1
1
  import { isLexicalState, lexicalStateToPlainText } from "../../core/lib/lexicalState.js";
2
2
  import { titleField } from "../../core/recordItem.js";
3
+ import { emptyFieldValue } from "@camox/api-contract";
3
4
 
4
5
  //#region src/features/content/collection-form.ts
5
6
  /** The form's fields, the one the record's title starts with first. */
@@ -8,7 +9,8 @@ function collectionFormFields(contentSchema, toTitle) {
8
9
  const first = titleField(toTitle);
9
10
  return Object.entries(schema.properties).sort(([a], [b]) => Number(b === first) - Number(a === first));
10
11
  }
11
- function collectionFormDefaults(fields, content = {}) {
12
+ /** The form's values: the record's content, and the empty value of each field it lacks. */
13
+ function collectionFormValues(fields, content = {}) {
12
14
  return Object.fromEntries(fields.map(([name, schema]) => {
13
15
  if (schema.fieldType === "Reference") return [name, content[name] ?? null];
14
16
  if (schema.fieldType === "ReferenceList") {
@@ -20,12 +22,9 @@ function collectionFormDefaults(fields, content = {}) {
20
22
  const assets = content[name];
21
23
  return [name, Array.isArray(assets) ? assets.map(editorAsset) : []];
22
24
  }
23
- const value = content[name] ?? schema.default;
25
+ const value = content[name] ?? emptyFieldValue(schema);
24
26
  if (schema.fieldType === "String" && isLexicalState(value)) return [name, lexicalStateToPlainText(value)];
25
- if (value !== void 0) return [name, value];
26
- if (schema.fieldType === "Boolean") return [name, false];
27
- if (schema.fieldType === "Enum") return [name, schema.enum?.[0] ?? ""];
28
- return [name, ""];
27
+ return [name, value];
29
28
  }));
30
29
  }
31
30
  const isAssetFieldType = (fieldType) => fieldType === "Image" || fieldType === "File" || fieldType === "ImageList" || fieldType === "FileList";
@@ -59,4 +58,4 @@ function collectionFormContent(fields, values, original = {}) {
59
58
  }
60
59
 
61
60
  //#endregion
62
- export { collectionFormContent, collectionFormDefaults, collectionFormFields, editorAssetField, serializeAssetField };
61
+ export { collectionFormContent, collectionFormFields, collectionFormValues, editorAssetField, serializeAssetField };
@@ -14,8 +14,8 @@ import { jsx } from "react/jsx-runtime";
14
14
  //#region src/features/page/CuratedPageContent.tsx
15
15
  /** A block read with its bundle, rendered by its definition's code as a page shows it. */
16
16
  function PageBlock(t0) {
17
- const $ = c(19);
18
- const { blockId, mode } = t0;
17
+ const $ = c(18);
18
+ const { blockId } = t0;
19
19
  let t1;
20
20
  if ($[0] !== blockId) {
21
21
  t1 = reads.blockBundle(blockId);
@@ -57,32 +57,26 @@ function PageBlock(t0) {
57
57
  $[9] = t10;
58
58
  } else t10 = $[9];
59
59
  let t11;
60
- if ($[10] !== blockDef._internal.Component || $[11] !== mode || $[12] !== t10) {
61
- t11 = /* @__PURE__ */ jsx(T0, {
62
- blockData: t10,
63
- mode,
64
- showAddBlockTop: false,
65
- showAddBlockBottom: false
66
- });
60
+ if ($[10] !== blockDef._internal.Component || $[11] !== t10) {
61
+ t11 = /* @__PURE__ */ jsx(T0, { blockData: t10 });
67
62
  $[10] = blockDef._internal.Component;
68
- $[11] = mode;
69
- $[12] = t10;
70
- $[13] = t11;
71
- } else t11 = $[13];
63
+ $[11] = t10;
64
+ $[12] = t11;
65
+ } else t11 = $[12];
72
66
  let t12;
73
- if ($[14] !== data.files || $[15] !== data.repeatableItems || $[16] !== t11 || $[17] !== t4) {
67
+ if ($[13] !== data.files || $[14] !== data.repeatableItems || $[15] !== t11 || $[16] !== t4) {
74
68
  t12 = /* @__PURE__ */ jsx(NormalizedDataProvider, {
75
69
  files: t2,
76
70
  repeatableItems: t3,
77
71
  blocks: t4,
78
72
  children: t11
79
73
  });
80
- $[14] = data.files;
81
- $[15] = data.repeatableItems;
82
- $[16] = t11;
83
- $[17] = t4;
84
- $[18] = t12;
85
- } else t12 = $[18];
74
+ $[13] = data.files;
75
+ $[14] = data.repeatableItems;
76
+ $[15] = t11;
77
+ $[16] = t4;
78
+ $[17] = t12;
79
+ } else t12 = $[17];
86
80
  return t12;
87
81
  }
88
82
  /** A curated page as visitors see it, without editing. */
@@ -170,10 +164,7 @@ function _temp(block) {
170
164
  return /* @__PURE__ */ jsx(BlockErrorBoundary, {
171
165
  blockId: block.id,
172
166
  blockType: block.type,
173
- children: /* @__PURE__ */ jsx(PageBlock, {
174
- blockId: block.id,
175
- mode: "site"
176
- })
167
+ children: /* @__PURE__ */ jsx(PageBlock, { blockId: block.id })
177
168
  }, block.id);
178
169
  }
179
170
 
@@ -8,8 +8,6 @@ import { jsx } from "react/jsx-runtime";
8
8
  /**
9
9
  * A block placed nowhere, alone, as a page would show it: the look document's Block Definition
10
10
  * mode (ADR 0032). Its bundle is read like a page's block, so it renders and hydrates as one.
11
- * Thumbnails render a Block Definition their own way (`BlockPeek`); only the block render is
12
- * shared.
13
11
  */
14
12
  function UnplacedBlockContent(t0) {
15
13
  const $ = c(8);
@@ -23,10 +21,7 @@ function UnplacedBlockContent(t0) {
23
21
  const { block } = useRead(t1);
24
22
  let t2;
25
23
  if ($[2] !== blockId) {
26
- t2 = /* @__PURE__ */ jsx(PageBlock, {
27
- blockId,
28
- mode: "site"
29
- });
24
+ t2 = /* @__PURE__ */ jsx(PageBlock, { blockId });
30
25
  $[2] = blockId;
31
26
  $[3] = t2;
32
27
  } else t2 = $[3];
@@ -20,7 +20,6 @@ import { PreviewEditingOwnerContext } from "./previewSelection.js";
20
20
  import { RendererFramesProvider, RendererSlot, useRendererHost, useRendererStatus } from "../renderer/RendererFrames.js";
21
21
  import { STUDIO_CANVAS_PATH } from "../studio/routes.js";
22
22
  import { studioStore } from "../studio/studioStore.js";
23
- import { AddBlockSheet } from "./components/AddBlockSheet.js";
24
23
  import { CanvasPreview, prefetchCanvas } from "./components/CanvasPreview.js";
25
24
  import { CreatePageModal } from "./components/CreatePageModal.js";
26
25
  import { PageRecordContext, getPageRecord, useDerivedPageResult, useFollowPageRecord } from "./pageRecord.js";
@@ -409,7 +408,7 @@ function usePrefetchCanvas(enabled, projectUuid) {
409
408
  }
410
409
  /** Studio chrome is shared; only curated previews require a Camox page record. */
411
410
  const PreviewShell = (t0) => {
412
- const $ = c(62);
411
+ const $ = c(61);
413
412
  const { children, pageData, derivedLayout, pageLocation, canvasOnly, runtimeBasePath: t1, pageShown: t2 } = t0;
414
413
  const runtimeBasePath = t1 === void 0 ? "" : t1;
415
414
  const pageShown = t2 === void 0 ? true : t2;
@@ -476,7 +475,6 @@ const PreviewShell = (t0) => {
476
475
  t6 = () => {
477
476
  if (!isMobileStudio) return;
478
477
  previewStore.send({ type: "hideCanvas" });
479
- previewStore.send({ type: "closeAddBlockSheet" });
480
478
  };
481
479
  t7 = [isMobileStudio];
482
480
  $[8] = isMobileStudio;
@@ -645,60 +643,59 @@ const PreviewShell = (t0) => {
645
643
  $[43] = t23;
646
644
  } else t23 = $[43];
647
645
  let t24;
648
- if ($[44] !== isCanvasEnabled || $[45] !== pageId) {
649
- t24 = !isCanvasEnabled && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(CreatePageModal, {}), pageId != null && /* @__PURE__ */ jsx(AddBlockSheet, {})] });
646
+ if ($[44] !== isCanvasEnabled) {
647
+ t24 = !isCanvasEnabled && /* @__PURE__ */ jsx(CreatePageModal, {});
650
648
  $[44] = isCanvasEnabled;
651
- $[45] = pageId;
652
- $[46] = t24;
653
- } else t24 = $[46];
649
+ $[45] = t24;
650
+ } else t24 = $[45];
654
651
  let t25;
655
- if ($[47] !== t11 || $[48] !== t23 || $[49] !== t24) {
652
+ if ($[46] !== t11 || $[47] !== t23 || $[48] !== t24) {
656
653
  t25 = /* @__PURE__ */ jsxs("div", {
657
654
  className: t11,
658
655
  children: [t23, t24]
659
656
  });
660
- $[47] = t11;
661
- $[48] = t23;
662
- $[49] = t24;
663
- $[50] = t25;
664
- } else t25 = $[50];
657
+ $[46] = t11;
658
+ $[47] = t23;
659
+ $[48] = t24;
660
+ $[49] = t25;
661
+ } else t25 = $[49];
665
662
  let t26;
666
- if ($[51] !== editingOwner || $[52] !== t25) {
663
+ if ($[50] !== editingOwner || $[51] !== t25) {
667
664
  t26 = /* @__PURE__ */ jsx(PreviewEditingOwnerContext, {
668
665
  value: editingOwner,
669
666
  children: t25
670
667
  });
671
- $[51] = editingOwner;
672
- $[52] = t25;
673
- $[53] = t26;
674
- } else t26 = $[53];
668
+ $[50] = editingOwner;
669
+ $[51] = t25;
670
+ $[52] = t26;
671
+ } else t26 = $[52];
675
672
  let t27;
676
- if ($[54] !== projectUuid) {
673
+ if ($[53] !== projectUuid) {
677
674
  t27 = /* @__PURE__ */ jsx(ContentCollectionItemSheet, { projectUuid });
678
- $[54] = projectUuid;
679
- $[55] = t27;
680
- } else t27 = $[55];
675
+ $[53] = projectUuid;
676
+ $[54] = t27;
677
+ } else t27 = $[54];
681
678
  let t28;
682
- if ($[56] !== t26 || $[57] !== t27) {
679
+ if ($[55] !== t26 || $[56] !== t27) {
683
680
  t28 = /* @__PURE__ */ jsxs(CollectionItemSheetProvider, {
684
681
  onRouteTargetClose: _temp8,
685
682
  children: [t26, t27]
686
683
  });
687
- $[56] = t26;
688
- $[57] = t27;
689
- $[58] = t28;
690
- } else t28 = $[58];
684
+ $[55] = t26;
685
+ $[56] = t27;
686
+ $[57] = t28;
687
+ } else t28 = $[57];
691
688
  const website = t28;
692
689
  let t29;
693
- if ($[59] !== runtimeBasePath || $[60] !== website) {
690
+ if ($[58] !== runtimeBasePath || $[59] !== website) {
694
691
  t29 = /* @__PURE__ */ jsx(RendererFramesProvider, {
695
692
  runtimeBasePath,
696
693
  children: website
697
694
  });
698
- $[59] = runtimeBasePath;
699
- $[60] = website;
700
- $[61] = t29;
701
- } else t29 = $[61];
695
+ $[58] = runtimeBasePath;
696
+ $[59] = website;
697
+ $[60] = t29;
698
+ } else t29 = $[60];
702
699
  return t29;
703
700
  };
704
701
  /**
@@ -12,8 +12,8 @@ import { Fragment, jsx } from "react/jsx-runtime";
12
12
 
13
13
  //#region src/features/preview/EditablePageContent.tsx
14
14
  const BlockRenderer = (t0) => {
15
- const $ = c(28);
16
- const { blockId, mode, showAddBlockTop, showAddBlockBottom } = t0;
15
+ const $ = c(24);
16
+ const { blockId } = t0;
17
17
  let t1;
18
18
  if ($[0] !== blockId) {
19
19
  t1 = reads.blockBundle(blockId);
@@ -32,27 +32,25 @@ const BlockRenderer = (t0) => {
32
32
  const blockDef = t2;
33
33
  if (!blockDef) {
34
34
  let t3;
35
- if ($[5] !== blockId || $[6] !== data.block.type || $[7] !== mode) {
35
+ if ($[5] !== blockId || $[6] !== data.block.type) {
36
36
  t3 = /* @__PURE__ */ jsx(RemovedBlockPlaceholder, {
37
37
  blockId,
38
- type: data.block.type,
39
- mode
38
+ type: data.block.type
40
39
  });
41
40
  $[5] = blockId;
42
41
  $[6] = data.block.type;
43
- $[7] = mode;
44
- $[8] = t3;
45
- } else t3 = $[8];
42
+ $[7] = t3;
43
+ } else t3 = $[7];
46
44
  return t3;
47
45
  }
48
46
  const t3 = data.files;
49
47
  const t4 = data.repeatableItems;
50
48
  let t5;
51
- if ($[9] !== data.block) {
49
+ if ($[8] !== data.block) {
52
50
  t5 = [data.block];
53
- $[9] = data.block;
54
- $[10] = t5;
55
- } else t5 = $[10];
51
+ $[8] = data.block;
52
+ $[9] = t5;
53
+ } else t5 = $[9];
56
54
  const T0 = blockDef._internal.Component;
57
55
  const t6 = data.block.id;
58
56
  const t7 = data.block.type;
@@ -60,7 +58,7 @@ const BlockRenderer = (t0) => {
60
58
  const t9 = data.block.settings;
61
59
  const t10 = String(data.block.position);
62
60
  let t11;
63
- if ($[11] !== data.block.id || $[12] !== data.block.type || $[13] !== t10 || $[14] !== t8 || $[15] !== t9) {
61
+ if ($[10] !== data.block.id || $[11] !== data.block.type || $[12] !== t10 || $[13] !== t8 || $[14] !== t9) {
64
62
  t11 = {
65
63
  _id: t6,
66
64
  type: t7,
@@ -68,177 +66,159 @@ const BlockRenderer = (t0) => {
68
66
  settings: t9,
69
67
  position: t10
70
68
  };
71
- $[11] = data.block.id;
72
- $[12] = data.block.type;
73
- $[13] = t10;
74
- $[14] = t8;
75
- $[15] = t9;
76
- $[16] = t11;
77
- } else t11 = $[16];
69
+ $[10] = data.block.id;
70
+ $[11] = data.block.type;
71
+ $[12] = t10;
72
+ $[13] = t8;
73
+ $[14] = t9;
74
+ $[15] = t11;
75
+ } else t11 = $[15];
78
76
  let t12;
79
- if ($[17] !== blockDef._internal.Component || $[18] !== mode || $[19] !== showAddBlockBottom || $[20] !== showAddBlockTop || $[21] !== t11) {
80
- t12 = /* @__PURE__ */ jsx(T0, {
81
- blockData: t11,
82
- mode,
83
- showAddBlockTop,
84
- showAddBlockBottom
85
- });
86
- $[17] = blockDef._internal.Component;
87
- $[18] = mode;
88
- $[19] = showAddBlockBottom;
89
- $[20] = showAddBlockTop;
90
- $[21] = t11;
91
- $[22] = t12;
92
- } else t12 = $[22];
77
+ if ($[16] !== blockDef._internal.Component || $[17] !== t11) {
78
+ t12 = /* @__PURE__ */ jsx(T0, { blockData: t11 });
79
+ $[16] = blockDef._internal.Component;
80
+ $[17] = t11;
81
+ $[18] = t12;
82
+ } else t12 = $[18];
93
83
  let t13;
94
- if ($[23] !== data.files || $[24] !== data.repeatableItems || $[25] !== t12 || $[26] !== t5) {
84
+ if ($[19] !== data.files || $[20] !== data.repeatableItems || $[21] !== t12 || $[22] !== t5) {
95
85
  t13 = /* @__PURE__ */ jsx(NormalizedDataProvider, {
96
86
  files: t3,
97
87
  repeatableItems: t4,
98
88
  blocks: t5,
99
89
  children: t12
100
90
  });
101
- $[23] = data.files;
102
- $[24] = data.repeatableItems;
103
- $[25] = t12;
104
- $[26] = t5;
105
- $[27] = t13;
106
- } else t13 = $[27];
91
+ $[19] = data.files;
92
+ $[20] = data.repeatableItems;
93
+ $[21] = t12;
94
+ $[22] = t5;
95
+ $[23] = t13;
96
+ } else t13 = $[23];
107
97
  return t13;
108
98
  };
109
99
  const EditablePageContent = () => {
110
- const $ = c(34);
100
+ const $ = c(31);
111
101
  const pageData = usePreviewedPage();
112
102
  const { pageBlocks, beforeBlocks, afterBlocks, layoutFiles, layoutItems } = usePageBlocks(pageData);
113
103
  const camoxApp = useCamoxApp();
114
104
  const { locale } = useViewLocale();
115
- let layout;
116
- let layoutBlocksMap;
117
105
  let t0;
118
- if ($[0] !== afterBlocks || $[1] !== beforeBlocks || $[2] !== camoxApp || $[3] !== pageBlocks || $[4] !== pageData) {
119
- layout = pageData.layout ? camoxApp.getLayoutById(pageData.layout.layoutId) : void 0;
120
- let t1;
121
- bb0: {
122
- if (!pageData.layout) {
123
- t1 = null;
124
- break bb0;
125
- }
126
- let blocks;
127
- if ($[8] !== afterBlocks || $[9] !== beforeBlocks) {
128
- const allLayoutBlocks = [...beforeBlocks, ...afterBlocks];
129
- blocks = {};
130
- for (const block of allLayoutBlocks) blocks[block.type] = {
131
- _id: block.id,
132
- type: block.type,
133
- content: block.content,
134
- settings: block.settings,
135
- position: String(block.position)
136
- };
137
- $[8] = afterBlocks;
138
- $[9] = beforeBlocks;
139
- $[10] = blocks;
140
- } else blocks = $[10];
141
- t1 = blocks;
106
+ if ($[0] !== camoxApp || $[1] !== pageData.layout) {
107
+ t0 = pageData.layout ? camoxApp.getLayoutById(pageData.layout.layoutId) : void 0;
108
+ $[0] = camoxApp;
109
+ $[1] = pageData.layout;
110
+ $[2] = t0;
111
+ } else t0 = $[2];
112
+ const layout = t0;
113
+ let t1;
114
+ bb0: {
115
+ if (!pageData.layout) {
116
+ t1 = null;
117
+ break bb0;
142
118
  }
143
- layoutBlocksMap = t1;
144
- t0 = pageBlocks.map((blockData, index) => /* @__PURE__ */ jsx(BlockErrorBoundary, {
145
- blockId: blockData.id,
146
- blockType: blockData.type,
147
- children: /* @__PURE__ */ jsx(BlockRenderer, {
148
- blockId: blockData.id,
149
- mode: "site",
150
- showAddBlockTop: index === 0 ? layout?._internal.blockDefinitions.some(_temp) ?? false : true,
151
- showAddBlockBottom: true
152
- })
153
- }, blockData.id));
154
- $[0] = afterBlocks;
155
- $[1] = beforeBlocks;
156
- $[2] = camoxApp;
157
- $[3] = pageBlocks;
158
- $[4] = pageData;
159
- $[5] = layout;
160
- $[6] = layoutBlocksMap;
161
- $[7] = t0;
162
- } else {
163
- layout = $[5];
164
- layoutBlocksMap = $[6];
165
- t0 = $[7];
119
+ let blocks;
120
+ if ($[3] !== afterBlocks || $[4] !== beforeBlocks) {
121
+ const allLayoutBlocks = [...beforeBlocks, ...afterBlocks];
122
+ blocks = {};
123
+ for (const block of allLayoutBlocks) blocks[block.type] = {
124
+ _id: block.id,
125
+ type: block.type,
126
+ content: block.content,
127
+ settings: block.settings,
128
+ position: String(block.position)
129
+ };
130
+ $[3] = afterBlocks;
131
+ $[4] = beforeBlocks;
132
+ $[5] = blocks;
133
+ } else blocks = $[5];
134
+ t1 = blocks;
166
135
  }
167
- let t1;
168
- if ($[11] !== t0) {
169
- t1 = /* @__PURE__ */ jsx(Fragment, { children: t0 });
170
- $[11] = t0;
171
- $[12] = t1;
172
- } else t1 = $[12];
173
- const pageBlocksContent = t1;
136
+ const layoutBlocksMap = t1;
137
+ let t2;
138
+ if ($[6] !== pageBlocks) {
139
+ t2 = pageBlocks.map(_temp);
140
+ $[6] = pageBlocks;
141
+ $[7] = t2;
142
+ } else t2 = $[7];
143
+ let t3;
144
+ if ($[8] !== t2) {
145
+ t3 = /* @__PURE__ */ jsx(Fragment, { children: t2 });
146
+ $[8] = t2;
147
+ $[9] = t3;
148
+ } else t3 = $[9];
149
+ const pageBlocksContent = t3;
174
150
  if (layout && layoutBlocksMap) {
175
151
  const ToReact = layout._internal.toReact;
176
- let t2;
177
- if ($[13] !== afterBlocks || $[14] !== beforeBlocks) {
178
- t2 = [...beforeBlocks, ...afterBlocks];
179
- $[13] = afterBlocks;
180
- $[14] = beforeBlocks;
181
- $[15] = t2;
182
- } else t2 = $[15];
183
- const T0 = layout._internal.Provider;
184
- let t3;
185
- if ($[16] !== locale || $[17] !== pageData) {
186
- t3 = curatedLayoutContext(pageData, locale);
187
- $[16] = locale;
188
- $[17] = pageData;
189
- $[18] = t3;
190
- } else t3 = $[18];
191
152
  let t4;
192
- if ($[19] !== ToReact || $[20] !== pageBlocksContent || $[21] !== t3) {
193
- t4 = /* @__PURE__ */ jsx(ToReact, {
194
- ...t3,
153
+ if ($[10] !== afterBlocks || $[11] !== beforeBlocks) {
154
+ t4 = [...beforeBlocks, ...afterBlocks];
155
+ $[10] = afterBlocks;
156
+ $[11] = beforeBlocks;
157
+ $[12] = t4;
158
+ } else t4 = $[12];
159
+ const T0 = layout._internal.Provider;
160
+ let t5;
161
+ if ($[13] !== locale || $[14] !== pageData) {
162
+ t5 = curatedLayoutContext(pageData, locale);
163
+ $[13] = locale;
164
+ $[14] = pageData;
165
+ $[15] = t5;
166
+ } else t5 = $[15];
167
+ let t6;
168
+ if ($[16] !== ToReact || $[17] !== pageBlocksContent || $[18] !== t5) {
169
+ t6 = /* @__PURE__ */ jsx(ToReact, {
170
+ ...t5,
195
171
  children: pageBlocksContent
196
172
  });
197
- $[19] = ToReact;
198
- $[20] = pageBlocksContent;
199
- $[21] = t3;
200
- $[22] = t4;
201
- } else t4 = $[22];
202
- let t5;
203
- if ($[23] !== layout._internal.Provider || $[24] !== layoutBlocksMap || $[25] !== t4) {
204
- t5 = /* @__PURE__ */ jsx(T0, {
173
+ $[16] = ToReact;
174
+ $[17] = pageBlocksContent;
175
+ $[18] = t5;
176
+ $[19] = t6;
177
+ } else t6 = $[19];
178
+ let t7;
179
+ if ($[20] !== layout._internal.Provider || $[21] !== layoutBlocksMap || $[22] !== t6) {
180
+ t7 = /* @__PURE__ */ jsx(T0, {
205
181
  layoutBlocks: layoutBlocksMap,
206
- children: t4
182
+ children: t6
207
183
  });
208
- $[23] = layout._internal.Provider;
209
- $[24] = layoutBlocksMap;
210
- $[25] = t4;
211
- $[26] = t5;
212
- } else t5 = $[26];
213
- let t6;
214
- if ($[27] !== layoutFiles || $[28] !== layoutItems || $[29] !== t2 || $[30] !== t5) {
215
- t6 = /* @__PURE__ */ jsx(NormalizedDataProvider, {
184
+ $[20] = layout._internal.Provider;
185
+ $[21] = layoutBlocksMap;
186
+ $[22] = t6;
187
+ $[23] = t7;
188
+ } else t7 = $[23];
189
+ let t8;
190
+ if ($[24] !== layoutFiles || $[25] !== layoutItems || $[26] !== t4 || $[27] !== t7) {
191
+ t8 = /* @__PURE__ */ jsx(NormalizedDataProvider, {
216
192
  files: layoutFiles,
217
193
  repeatableItems: layoutItems,
218
- blocks: t2,
219
- children: t5
194
+ blocks: t4,
195
+ children: t7
220
196
  });
221
- $[27] = layoutFiles;
222
- $[28] = layoutItems;
223
- $[29] = t2;
224
- $[30] = t5;
225
- $[31] = t6;
226
- } else t6 = $[31];
227
- return t6;
197
+ $[24] = layoutFiles;
198
+ $[25] = layoutItems;
199
+ $[26] = t4;
200
+ $[27] = t7;
201
+ $[28] = t8;
202
+ } else t8 = $[28];
203
+ return t8;
228
204
  }
229
- let t2;
230
- if ($[32] !== pageBlocksContent) {
231
- t2 = /* @__PURE__ */ jsx("main", {
205
+ let t4;
206
+ if ($[29] !== pageBlocksContent) {
207
+ t4 = /* @__PURE__ */ jsx("main", {
232
208
  className: "flex min-h-screen flex-col",
233
209
  children: pageBlocksContent
234
210
  });
235
- $[32] = pageBlocksContent;
236
- $[33] = t2;
237
- } else t2 = $[33];
238
- return t2;
211
+ $[29] = pageBlocksContent;
212
+ $[30] = t4;
213
+ } else t4 = $[30];
214
+ return t4;
239
215
  };
240
- function _temp(b) {
241
- return b.slot === "before";
216
+ function _temp(blockData) {
217
+ return /* @__PURE__ */ jsx(BlockErrorBoundary, {
218
+ blockId: blockData.id,
219
+ blockType: blockData.type,
220
+ children: /* @__PURE__ */ jsx(BlockRenderer, { blockId: blockData.id })
221
+ }, blockData.id);
242
222
  }
243
223
 
244
224
  //#endregion