camox 0.9.1 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/components/lexical/SidebarLexicalEditor.js +2 -1
- package/dist/core/createApp.d.ts +231 -209
- package/dist/core/createApp.js +17 -17
- package/dist/core/createBlock.d.ts +74 -72
- package/dist/core/createBlock.js +386 -363
- package/dist/core/createLayout.d.ts +100 -80
- package/dist/core/createLayout.js +93 -65
- package/dist/features/preview/CamoxPreview.js +76 -54
- package/dist/features/preview/components/AddBlockSheet.js +13 -13
- package/dist/features/preview/components/AssetFieldEditor.js +1 -1
- package/dist/features/preview/components/AssetLightbox.js +1 -1
- package/dist/features/preview/components/AssetPickerGrid.js +1 -1
- package/dist/features/preview/components/BlockActionsPopover.js +26 -26
- package/dist/features/preview/components/BlockErrorBoundary.js +59 -0
- package/dist/features/preview/components/{CreatePageSheet.js → CreatePageModal.js} +17 -19
- package/dist/features/preview/components/{EditPageSheet.js → EditPageModal.js} +27 -24
- package/dist/features/preview/components/Frame.js +1 -1
- package/dist/features/preview/components/ItemFieldsEditor.js +134 -98
- package/dist/features/preview/components/LinkFieldEditor.js +166 -146
- package/dist/features/preview/components/PageContentSheet.js +42 -37
- package/dist/features/preview/components/PageLocationFieldset.js +28 -26
- package/dist/features/preview/components/PagePicker.js +4 -4
- package/dist/features/preview/components/PageTree.js +337 -351
- package/dist/features/preview/components/PeekedBlock.js +38 -26
- package/dist/features/preview/components/PreviewPanel.js +16 -2
- package/dist/features/preview/components/PreviewSideSheet.js +26 -42
- package/dist/features/preview/components/RepeatableItemsList.js +7 -7
- package/dist/features/preview/components/useUpdateBlockPosition.js +1 -1
- package/dist/features/preview/previewStore.js +7 -7
- package/dist/features/provider/CamoxProvider.js +1 -1
- package/dist/features/routes/ogRoute.js +2 -2
- package/dist/features/routes/pageRoute.js +5 -4
- package/dist/features/studio/CamoxStudio.js +1 -1
- package/dist/features/studio/components/Navbar.js +1 -1
- package/dist/features/studio/components/ProjectMenu.js +1 -1
- package/dist/features/studio/components/UserButton.js +46 -30
- package/dist/features/vite/definitionsSync.js +20 -20
- package/dist/features/vite/routeGeneration.js +1 -0
- package/dist/features/vite/vite.js +51 -7
- package/dist/studio-overlays.css +34 -0
- package/dist/studio.css +1 -1
- package/package.json +4 -4
- package/skills/camox-layout/SKILL.md +34 -30
|
@@ -72,7 +72,7 @@ function ExternalStateSync(t0) {
|
|
|
72
72
|
React.useEffect(t3, t4);
|
|
73
73
|
return null;
|
|
74
74
|
}
|
|
75
|
-
function SidebarLexicalEditor({ value, onChange, onFocus, onBlur }) {
|
|
75
|
+
function SidebarLexicalEditor({ id, value, onChange, onFocus, onBlur }) {
|
|
76
76
|
const timerRef = React.useRef(null);
|
|
77
77
|
const onChangeRef = React.useRef(onChange);
|
|
78
78
|
onChangeRef.current = onChange;
|
|
@@ -98,6 +98,7 @@ function SidebarLexicalEditor({ value, onChange, onFocus, onBlur }) {
|
|
|
98
98
|
children: [
|
|
99
99
|
/* @__PURE__ */ jsx(RichTextPlugin, {
|
|
100
100
|
contentEditable: /* @__PURE__ */ jsx(ContentEditable, {
|
|
101
|
+
id,
|
|
101
102
|
className: cn(INPUT_BASE_STYLES, INPUT_FOCUS_STYLES, "flex min-h-[80px] w-full px-3 py-2"),
|
|
102
103
|
onFocus,
|
|
103
104
|
onBlur
|
package/dist/core/createApp.d.ts
CHANGED
|
@@ -15,16 +15,6 @@ declare function createApp({
|
|
|
15
15
|
layouts
|
|
16
16
|
}: CreateAppOptions): {
|
|
17
17
|
getBlocks(): {
|
|
18
|
-
Component: ({
|
|
19
|
-
blockData,
|
|
20
|
-
mode,
|
|
21
|
-
isFirstBlock,
|
|
22
|
-
showAddBlockTop,
|
|
23
|
-
showAddBlockBottom,
|
|
24
|
-
addBlockAfterPosition
|
|
25
|
-
}: BlockComponentProps<{
|
|
26
|
-
[x: string]: unknown;
|
|
27
|
-
}>) => _$react_jsx_runtime0.JSX.Element;
|
|
28
18
|
Detached: ({
|
|
29
19
|
children
|
|
30
20
|
}: {
|
|
@@ -286,65 +276,67 @@ declare function createApp({
|
|
|
286
276
|
}, index: number) => React.ReactNode;
|
|
287
277
|
}) => _$react_jsx_runtime0.JSX.Element;
|
|
288
278
|
useSetting: <K extends string>(name: K) => unknown;
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
279
|
+
_internal: {
|
|
280
|
+
Component: ({
|
|
281
|
+
blockData,
|
|
282
|
+
mode,
|
|
283
|
+
isFirstBlock,
|
|
284
|
+
showAddBlockTop,
|
|
285
|
+
showAddBlockBottom,
|
|
286
|
+
addBlockAfterPosition
|
|
287
|
+
}: BlockComponentProps<{
|
|
288
|
+
[x: string]: unknown;
|
|
289
|
+
}>) => _$react_jsx_runtime0.JSX.Element;
|
|
290
|
+
id: string;
|
|
294
291
|
title: string;
|
|
295
292
|
description: string;
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
required: string[];
|
|
304
|
-
} | undefined;
|
|
305
|
-
getInitialBundle: () => {
|
|
306
|
-
content: Record<string, unknown>;
|
|
307
|
-
settings: {
|
|
308
|
-
[x: string]: unknown;
|
|
293
|
+
contentSchema: {
|
|
294
|
+
type: "object";
|
|
295
|
+
title: string;
|
|
296
|
+
description: string;
|
|
297
|
+
properties: Record<string, _$_sinclair_typebox0.TSchema>;
|
|
298
|
+
required: string[];
|
|
299
|
+
toMarkdown: readonly string[];
|
|
309
300
|
};
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
};
|
|
318
|
-
getPeekBundle: () => {
|
|
319
|
-
block: {
|
|
320
|
-
id: number;
|
|
321
|
-
pageId: null;
|
|
322
|
-
layoutId: null;
|
|
323
|
-
type: string;
|
|
301
|
+
settingsSchema: {
|
|
302
|
+
type: "object";
|
|
303
|
+
properties: Record<string, _$_sinclair_typebox0.TSchema>;
|
|
304
|
+
required: string[];
|
|
305
|
+
} | undefined;
|
|
306
|
+
layoutOnly: boolean;
|
|
307
|
+
getInitialBundle: () => {
|
|
324
308
|
content: Record<string, unknown>;
|
|
325
|
-
settings:
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
309
|
+
settings: {
|
|
310
|
+
[x: string]: unknown;
|
|
311
|
+
};
|
|
312
|
+
repeatableItems: RepeatableItemSeed[];
|
|
313
|
+
};
|
|
314
|
+
getInitialContent: () => {
|
|
315
|
+
[x: string]: unknown;
|
|
316
|
+
};
|
|
317
|
+
getInitialSettings: () => {
|
|
318
|
+
[x: string]: unknown;
|
|
319
|
+
};
|
|
320
|
+
getPeekBundle: () => {
|
|
321
|
+
block: {
|
|
322
|
+
id: number;
|
|
323
|
+
pageId: null;
|
|
324
|
+
layoutId: null;
|
|
325
|
+
type: string;
|
|
326
|
+
content: Record<string, unknown>;
|
|
327
|
+
settings: Record<string, unknown>;
|
|
328
|
+
placement: null;
|
|
329
|
+
summary: string;
|
|
330
|
+
position: string;
|
|
331
|
+
createdAt: number;
|
|
332
|
+
updatedAt: number;
|
|
333
|
+
};
|
|
334
|
+
repeatableItems: PeekItem[];
|
|
335
|
+
files: never[];
|
|
331
336
|
};
|
|
332
|
-
repeatableItems: PeekItem[];
|
|
333
|
-
files: never[];
|
|
334
337
|
};
|
|
335
|
-
layoutOnly: boolean;
|
|
336
338
|
}[];
|
|
337
339
|
getBlockById(id: string): {
|
|
338
|
-
Component: ({
|
|
339
|
-
blockData,
|
|
340
|
-
mode,
|
|
341
|
-
isFirstBlock,
|
|
342
|
-
showAddBlockTop,
|
|
343
|
-
showAddBlockBottom,
|
|
344
|
-
addBlockAfterPosition
|
|
345
|
-
}: BlockComponentProps<{
|
|
346
|
-
[x: string]: unknown;
|
|
347
|
-
}>) => _$react_jsx_runtime0.JSX.Element;
|
|
348
340
|
Detached: ({
|
|
349
341
|
children
|
|
350
342
|
}: {
|
|
@@ -606,171 +598,201 @@ declare function createApp({
|
|
|
606
598
|
}, index: number) => React.ReactNode;
|
|
607
599
|
}) => _$react_jsx_runtime0.JSX.Element;
|
|
608
600
|
useSetting: <K extends string>(name: K) => unknown;
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
601
|
+
_internal: {
|
|
602
|
+
Component: ({
|
|
603
|
+
blockData,
|
|
604
|
+
mode,
|
|
605
|
+
isFirstBlock,
|
|
606
|
+
showAddBlockTop,
|
|
607
|
+
showAddBlockBottom,
|
|
608
|
+
addBlockAfterPosition
|
|
609
|
+
}: BlockComponentProps<{
|
|
610
|
+
[x: string]: unknown;
|
|
611
|
+
}>) => _$react_jsx_runtime0.JSX.Element;
|
|
612
|
+
id: string;
|
|
614
613
|
title: string;
|
|
615
614
|
description: string;
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
615
|
+
contentSchema: {
|
|
616
|
+
type: "object";
|
|
617
|
+
title: string;
|
|
618
|
+
description: string;
|
|
619
|
+
properties: Record<string, _$_sinclair_typebox0.TSchema>;
|
|
620
|
+
required: string[];
|
|
621
|
+
toMarkdown: readonly string[];
|
|
622
|
+
};
|
|
623
|
+
settingsSchema: {
|
|
624
|
+
type: "object";
|
|
625
|
+
properties: Record<string, _$_sinclair_typebox0.TSchema>;
|
|
626
|
+
required: string[];
|
|
627
|
+
} | undefined;
|
|
628
|
+
layoutOnly: boolean;
|
|
629
|
+
getInitialBundle: () => {
|
|
630
|
+
content: Record<string, unknown>;
|
|
631
|
+
settings: {
|
|
632
|
+
[x: string]: unknown;
|
|
633
|
+
};
|
|
634
|
+
repeatableItems: RepeatableItemSeed[];
|
|
635
|
+
};
|
|
636
|
+
getInitialContent: () => {
|
|
628
637
|
[x: string]: unknown;
|
|
629
638
|
};
|
|
630
|
-
|
|
639
|
+
getInitialSettings: () => {
|
|
640
|
+
[x: string]: unknown;
|
|
641
|
+
};
|
|
642
|
+
getPeekBundle: () => {
|
|
643
|
+
block: {
|
|
644
|
+
id: number;
|
|
645
|
+
pageId: null;
|
|
646
|
+
layoutId: null;
|
|
647
|
+
type: string;
|
|
648
|
+
content: Record<string, unknown>;
|
|
649
|
+
settings: Record<string, unknown>;
|
|
650
|
+
placement: null;
|
|
651
|
+
summary: string;
|
|
652
|
+
position: string;
|
|
653
|
+
createdAt: number;
|
|
654
|
+
updatedAt: number;
|
|
655
|
+
};
|
|
656
|
+
repeatableItems: PeekItem[];
|
|
657
|
+
files: never[];
|
|
658
|
+
};
|
|
631
659
|
};
|
|
632
|
-
|
|
633
|
-
|
|
660
|
+
} | undefined;
|
|
661
|
+
getLayouts(): {
|
|
662
|
+
BeforeBlocks: {
|
|
663
|
+
(): _$react_jsx_runtime0.JSX.Element;
|
|
664
|
+
displayName: string;
|
|
634
665
|
};
|
|
635
|
-
|
|
636
|
-
|
|
666
|
+
AfterBlocks: {
|
|
667
|
+
(): _$react_jsx_runtime0.JSX.Element;
|
|
668
|
+
displayName: string;
|
|
637
669
|
};
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
670
|
+
_internal: {
|
|
671
|
+
id: string;
|
|
672
|
+
title: string;
|
|
673
|
+
description: string;
|
|
674
|
+
buildMetaTitle: (params: {
|
|
675
|
+
pageMetaTitle: string;
|
|
676
|
+
projectName: string;
|
|
677
|
+
pageFullPath: string;
|
|
678
|
+
}) => string;
|
|
679
|
+
buildOgImage: ((params: OgImageParams) => Promise<Response>) | undefined;
|
|
680
|
+
blockDefinitions: ({
|
|
643
681
|
type: string;
|
|
644
682
|
content: Record<string, unknown>;
|
|
645
683
|
settings: Record<string, unknown>;
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
} | undefined;
|
|
657
|
-
getLayouts(): {
|
|
658
|
-
id: string;
|
|
659
|
-
title: string;
|
|
660
|
-
description: string;
|
|
661
|
-
buildMetaTitle: (params: {
|
|
662
|
-
pageMetaTitle: string;
|
|
663
|
-
projectName: string;
|
|
664
|
-
pageFullPath: string;
|
|
665
|
-
}) => string;
|
|
666
|
-
buildOgImage: ((params: OgImageParams) => Promise<Response>) | undefined;
|
|
667
|
-
blockDefinitions: ({
|
|
668
|
-
type: string;
|
|
669
|
-
content: Record<string, unknown>;
|
|
670
|
-
settings: Record<string, unknown>;
|
|
671
|
-
repeatableItems: {
|
|
672
|
-
tempId: string;
|
|
673
|
-
parentTempId: string | null;
|
|
674
|
-
fieldName: string;
|
|
675
|
-
content: Record<string, unknown>;
|
|
676
|
-
position: string;
|
|
677
|
-
}[];
|
|
678
|
-
placement: "before";
|
|
679
|
-
} | {
|
|
680
|
-
type: string;
|
|
681
|
-
content: Record<string, unknown>;
|
|
682
|
-
settings: Record<string, unknown>;
|
|
683
|
-
repeatableItems: {
|
|
684
|
-
tempId: string;
|
|
685
|
-
parentTempId: string | null;
|
|
686
|
-
fieldName: string;
|
|
684
|
+
repeatableItems: {
|
|
685
|
+
tempId: string;
|
|
686
|
+
parentTempId: string | null;
|
|
687
|
+
fieldName: string;
|
|
688
|
+
content: Record<string, unknown>;
|
|
689
|
+
position: string;
|
|
690
|
+
}[];
|
|
691
|
+
placement: "before";
|
|
692
|
+
} | {
|
|
693
|
+
type: string;
|
|
687
694
|
content: Record<string, unknown>;
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
695
|
+
settings: Record<string, unknown>;
|
|
696
|
+
repeatableItems: {
|
|
697
|
+
tempId: string;
|
|
698
|
+
parentTempId: string | null;
|
|
699
|
+
fieldName: string;
|
|
700
|
+
content: Record<string, unknown>;
|
|
701
|
+
position: string;
|
|
702
|
+
}[];
|
|
703
|
+
placement: "after";
|
|
704
|
+
})[];
|
|
705
|
+
initialBlockBundles: {
|
|
706
|
+
type: string;
|
|
700
707
|
content: Record<string, unknown>;
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
708
|
+
settings: Record<string, unknown>;
|
|
709
|
+
repeatableItems: {
|
|
710
|
+
tempId: string;
|
|
711
|
+
parentTempId: string | null;
|
|
712
|
+
fieldName: string;
|
|
713
|
+
content: Record<string, unknown>;
|
|
714
|
+
position: string;
|
|
715
|
+
}[];
|
|
716
|
+
}[] | undefined;
|
|
717
|
+
component: _$react.ComponentType<{
|
|
718
|
+
children: React.ReactNode;
|
|
719
|
+
}>;
|
|
720
|
+
Provider: ({
|
|
721
|
+
layoutBlocks,
|
|
722
|
+
children
|
|
723
|
+
}: {
|
|
724
|
+
layoutBlocks: Record<string, LayoutBlockData>;
|
|
725
|
+
children: React.ReactNode;
|
|
726
|
+
}) => _$react_jsx_runtime0.JSX.Element;
|
|
727
|
+
};
|
|
715
728
|
}[];
|
|
716
729
|
getLayoutById(id: string): {
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
730
|
+
BeforeBlocks: {
|
|
731
|
+
(): _$react_jsx_runtime0.JSX.Element;
|
|
732
|
+
displayName: string;
|
|
733
|
+
};
|
|
734
|
+
AfterBlocks: {
|
|
735
|
+
(): _$react_jsx_runtime0.JSX.Element;
|
|
736
|
+
displayName: string;
|
|
737
|
+
};
|
|
738
|
+
_internal: {
|
|
739
|
+
id: string;
|
|
740
|
+
title: string;
|
|
741
|
+
description: string;
|
|
742
|
+
buildMetaTitle: (params: {
|
|
743
|
+
pageMetaTitle: string;
|
|
744
|
+
projectName: string;
|
|
745
|
+
pageFullPath: string;
|
|
746
|
+
}) => string;
|
|
747
|
+
buildOgImage: ((params: OgImageParams) => Promise<Response>) | undefined;
|
|
748
|
+
blockDefinitions: ({
|
|
749
|
+
type: string;
|
|
734
750
|
content: Record<string, unknown>;
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
751
|
+
settings: Record<string, unknown>;
|
|
752
|
+
repeatableItems: {
|
|
753
|
+
tempId: string;
|
|
754
|
+
parentTempId: string | null;
|
|
755
|
+
fieldName: string;
|
|
756
|
+
content: Record<string, unknown>;
|
|
757
|
+
position: string;
|
|
758
|
+
}[];
|
|
759
|
+
placement: "before";
|
|
760
|
+
} | {
|
|
761
|
+
type: string;
|
|
746
762
|
content: Record<string, unknown>;
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
763
|
+
settings: Record<string, unknown>;
|
|
764
|
+
repeatableItems: {
|
|
765
|
+
tempId: string;
|
|
766
|
+
parentTempId: string | null;
|
|
767
|
+
fieldName: string;
|
|
768
|
+
content: Record<string, unknown>;
|
|
769
|
+
position: string;
|
|
770
|
+
}[];
|
|
771
|
+
placement: "after";
|
|
772
|
+
})[];
|
|
773
|
+
initialBlockBundles: {
|
|
774
|
+
type: string;
|
|
759
775
|
content: Record<string, unknown>;
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
776
|
+
settings: Record<string, unknown>;
|
|
777
|
+
repeatableItems: {
|
|
778
|
+
tempId: string;
|
|
779
|
+
parentTempId: string | null;
|
|
780
|
+
fieldName: string;
|
|
781
|
+
content: Record<string, unknown>;
|
|
782
|
+
position: string;
|
|
783
|
+
}[];
|
|
784
|
+
}[] | undefined;
|
|
785
|
+
component: _$react.ComponentType<{
|
|
786
|
+
children: React.ReactNode;
|
|
787
|
+
}>;
|
|
788
|
+
Provider: ({
|
|
789
|
+
layoutBlocks,
|
|
790
|
+
children
|
|
791
|
+
}: {
|
|
792
|
+
layoutBlocks: Record<string, LayoutBlockData>;
|
|
793
|
+
children: React.ReactNode;
|
|
794
|
+
}) => _$react_jsx_runtime0.JSX.Element;
|
|
795
|
+
};
|
|
774
796
|
} | undefined;
|
|
775
797
|
getSerializableDefinitions(): {
|
|
776
798
|
blockId: string;
|
package/dist/core/createApp.js
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
function createApp({ blocks, layouts = [] }) {
|
|
3
3
|
const blocksMap = /* @__PURE__ */ new Map();
|
|
4
4
|
const layoutsMap = /* @__PURE__ */ new Map();
|
|
5
|
-
for (const block of blocks) blocksMap.set(block.id, block);
|
|
6
|
-
for (const layout of layouts) layoutsMap.set(layout.id, layout);
|
|
7
|
-
const layoutsWithInitialBlocks = layouts.filter((l) => l.initialBlockBundles);
|
|
5
|
+
for (const block of blocks) blocksMap.set(block._internal.id, block);
|
|
6
|
+
for (const layout of layouts) layoutsMap.set(layout._internal.id, layout);
|
|
7
|
+
const layoutsWithInitialBlocks = layouts.filter((l) => l._internal.initialBlockBundles);
|
|
8
8
|
if (layoutsWithInitialBlocks.length > 1) {
|
|
9
|
-
const ids = layoutsWithInitialBlocks.map((l) => `"${l.id}"`).join(", ");
|
|
10
|
-
throw new Error(`[camox] Only one layout can define
|
|
9
|
+
const ids = layoutsWithInitialBlocks.map((l) => `"${l._internal.id}"`).join(", ");
|
|
10
|
+
throw new Error(`[camox] Only one layout can define blocks.initial, but found ${layoutsWithInitialBlocks.length}: ${ids}`);
|
|
11
11
|
}
|
|
12
12
|
return {
|
|
13
13
|
getBlocks() {
|
|
@@ -24,32 +24,32 @@ function createApp({ blocks, layouts = [] }) {
|
|
|
24
24
|
},
|
|
25
25
|
getSerializableDefinitions() {
|
|
26
26
|
return Array.from(blocksMap.values()).map((block) => ({
|
|
27
|
-
blockId: block.id,
|
|
28
|
-
title: block.title,
|
|
29
|
-
description: block.description,
|
|
30
|
-
contentSchema: block.contentSchema,
|
|
31
|
-
settingsSchema: block.settingsSchema,
|
|
32
|
-
layoutOnly: block.layoutOnly || void 0
|
|
27
|
+
blockId: block._internal.id,
|
|
28
|
+
title: block._internal.title,
|
|
29
|
+
description: block._internal.description,
|
|
30
|
+
contentSchema: block._internal.contentSchema,
|
|
31
|
+
settingsSchema: block._internal.settingsSchema,
|
|
32
|
+
layoutOnly: block._internal.layoutOnly || void 0
|
|
33
33
|
}));
|
|
34
34
|
},
|
|
35
35
|
getSerializableLayoutDefinitions() {
|
|
36
36
|
return Array.from(layoutsMap.values()).map((layout) => ({
|
|
37
|
-
layoutId: layout.id,
|
|
38
|
-
description: layout.description,
|
|
39
|
-
blocks: layout.blockDefinitions
|
|
37
|
+
layoutId: layout._internal.id,
|
|
38
|
+
description: layout._internal.description,
|
|
39
|
+
blocks: layout._internal.blockDefinitions
|
|
40
40
|
}));
|
|
41
41
|
},
|
|
42
42
|
getInitialPageBundles() {
|
|
43
43
|
const layout = layoutsWithInitialBlocks[0];
|
|
44
44
|
if (layout) return {
|
|
45
|
-
layoutId: layout.id,
|
|
46
|
-
blocks: layout.initialBlockBundles,
|
|
45
|
+
layoutId: layout._internal.id,
|
|
46
|
+
blocks: layout._internal.initialBlockBundles,
|
|
47
47
|
hasInitialBlocks: true
|
|
48
48
|
};
|
|
49
49
|
const fallback = layouts[0];
|
|
50
50
|
if (!fallback) return null;
|
|
51
51
|
return {
|
|
52
|
-
layoutId: fallback.id,
|
|
52
|
+
layoutId: fallback._internal.id,
|
|
53
53
|
blocks: [],
|
|
54
54
|
hasInitialBlocks: false
|
|
55
55
|
};
|