camox 0.46.0 → 0.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/createApp.d.ts +19 -6
- package/dist/core/createApp.js +7 -2
- package/dist/core/createBlock.js +54 -43
- package/dist/core/createCollection.d.ts +25 -7
- package/dist/core/createCollection.js +28 -9
- package/dist/core/createLayout.d.ts +98 -71
- package/dist/core/createLayout.js +10 -16
- package/dist/core/derivedRoutes.js +1 -1
- package/dist/core/editing/BlockEditingRuntime.d.ts +3 -2
- package/dist/core/editing/CompleteBlockEditingRuntime.js +2 -1
- package/dist/core/editing/createEditableBlock.d.ts +59 -19
- package/dist/core/editing/createEditableBlock.js +162 -151
- package/dist/core/editing/useLatestRecord.js +7 -7
- package/dist/core/layoutContext.d.ts +54 -0
- package/dist/core/layoutContext.js +66 -0
- package/dist/core/lib/contentType.d.ts +91 -4
- package/dist/core/lib/contentType.js +84 -7
- package/dist/core/lib/recordScope.js +19 -17
- package/dist/core/lib/reference.d.ts +6 -2
- package/dist/core/recordItem.js +55 -2
- package/dist/core/requestContext.d.ts +18 -0
- package/dist/core/structuredData.d.ts +126 -0
- package/dist/core/structuredData.js +40 -0
- package/dist/features/canvas/canvasCamera.js +21 -6
- package/dist/features/canvas/sidebar/CanvasSidebarFrame.js +1 -1
- package/dist/features/canvas/useCanvasCamera.js +16 -11
- package/dist/features/content/ContentCollection.js +13 -7
- package/dist/features/content/collection-form.js +6 -2
- package/dist/features/content/components/MissingFromLocale.js +1 -1
- package/dist/features/og/pageImage.js +89 -0
- package/dist/features/page/CuratedPageContent.js +45 -32
- package/dist/features/page/DerivedPageContent.js +49 -22
- package/dist/features/page/SharedLayoutContent.js +26 -22
- package/dist/features/preview/CamoxPreview.js +176 -145
- package/dist/features/preview/components/AddBlockSheet.js +1 -0
- package/dist/features/preview/components/BlockActionsPopover.js +8 -6
- package/dist/features/preview/components/PageInfo.js +244 -264
- package/dist/features/preview/components/PageTree.js +63 -53
- package/dist/features/preview/components/PreviewToolbar.js +74 -85
- package/dist/features/preview/components/RecordCard.js +50 -34
- package/dist/features/preview/components/RecordCombobox.js +12 -5
- package/dist/features/preview/components/ReferenceFieldEditor.js +4 -2
- package/dist/features/preview/components/ReferenceListFieldEditor.js +24 -19
- package/dist/features/preview/components/RepeatableItemsList.js +62 -46
- package/dist/features/preview/components/SelectionEditor.js +3 -2
- package/dist/features/preview/components/useFieldWriter.js +2 -4
- package/dist/features/preview/components/useRecordView.js +2 -2
- package/dist/features/preview/entityName.js +11 -0
- package/dist/features/preview/pageRecord.js +17 -18
- package/dist/features/provider/CamoxProvider.js +8 -16
- package/dist/features/provider/CoreCamoxProvider.js +1 -6
- package/dist/features/provider/signInShortcut.js +60 -0
- package/dist/features/routes/pageRuntime.d.ts +15 -1
- package/dist/features/routes/pageRuntime.js +35 -38
- package/dist/features/runtime/RuntimeChrome.js +2 -2
- package/dist/features/runtime/breadcrumbs.js +68 -0
- package/dist/features/runtime/livePages.js +3 -2
- package/dist/features/runtime/pageApp.js +11 -39
- package/dist/features/runtime/pageGraph.js +92 -0
- package/dist/features/runtime/projectLogo.js +110 -0
- package/dist/features/runtime/runtime.d.ts +11 -6
- package/dist/features/runtime/runtime.js +278 -55
- package/dist/features/runtime/runtimeRoutes.d.ts +1 -0
- package/dist/features/runtime/runtimeRoutes.js +1 -0
- package/dist/features/runtime/structuredData.js +213 -0
- package/dist/features/studio/components/ChatSidebar.js +5 -5
- package/dist/features/studio/components/ProjectMenu.js +127 -100
- package/dist/features/studio/components/SocialProfilesDialog.js +342 -0
- package/dist/features/studio/components/ThreadMessages.js +2 -2
- package/dist/features/vite/blockBoilerplate.js +3 -2
- package/dist/features/vite/layoutGeneration.js +3 -2
- package/dist/features/vite/vite.js +1 -0
- package/dist/lib/queries.d.ts +4 -0
- package/dist/lib/queries.js +1 -0
- package/dist/lib/studio-reads.js +3 -1
- package/dist/package.js +1 -1
- package/dist/studio.css +1 -1
- package/package.json +5 -4
- package/skills/camox/references/block-definitions.md +105 -25
- package/skills/camox/references/layout-definitions.md +53 -17
- package/skills/camox/references/routed-layouts.md +17 -14
- package/dist/features/provider/LocalhostPreviewProvider.js +0 -158
|
@@ -8,6 +8,7 @@ import { useCamoxApp } from "../provider/components/CamoxAppContext.js";
|
|
|
8
8
|
import { NormalizedDataProvider, usePageBlocks } from "../../lib/normalized-data.js";
|
|
9
9
|
import { reads, useRead, useStudioCache } from "../../lib/studio-reads.js";
|
|
10
10
|
import { BlockErrorBoundary } from "./components/BlockErrorBoundary.js";
|
|
11
|
+
import { curatedLayoutContext } from "../../core/layoutContext.js";
|
|
11
12
|
import { CollectionItemSheetProvider } from "../content/CollectionItemSheetContext.js";
|
|
12
13
|
import { cn } from "../../lib/utils.js";
|
|
13
14
|
import { ContentCollectionItemSheet } from "../content/ContentCollection.js";
|
|
@@ -17,6 +18,7 @@ import { canvasStore } from "../canvas/canvasStore.js";
|
|
|
17
18
|
import { SHOW_WHOLE_CANVAS_SHORTCUT, TOGGLE_CANVAS_SHORTCUT } from "./previewConstants.js";
|
|
18
19
|
import { CanvasSidebarSkeleton } from "../canvas/sidebar/CanvasSidebarSkeleton.js";
|
|
19
20
|
import { DerivedPageContent } from "../page/DerivedPageContent.js";
|
|
21
|
+
import { takeShowCanvasRequest } from "../provider/signInShortcut.js";
|
|
20
22
|
import { STUDIO_CANVAS_PATH } from "../studio/routes.js";
|
|
21
23
|
import { studioStore } from "../studio/studioStore.js";
|
|
22
24
|
import { previewStore, selectIsCanvasShown } from "./previewStore.js";
|
|
@@ -163,10 +165,11 @@ const BlockRenderer = (t0) => {
|
|
|
163
165
|
return t13;
|
|
164
166
|
};
|
|
165
167
|
const PageContent = () => {
|
|
166
|
-
const $ = c(
|
|
168
|
+
const $ = c(34);
|
|
167
169
|
const pageData = usePreviewedPage();
|
|
168
170
|
const { pageBlocks, beforeBlocks, afterBlocks, layoutFiles, layoutItems } = usePageBlocks(pageData);
|
|
169
171
|
const camoxApp = useCamoxApp();
|
|
172
|
+
const { locale } = useViewLocale();
|
|
170
173
|
let layout;
|
|
171
174
|
let layoutBlocksMap;
|
|
172
175
|
let t0;
|
|
@@ -227,7 +230,7 @@ const PageContent = () => {
|
|
|
227
230
|
} else t1 = $[12];
|
|
228
231
|
const pageBlocksContent = t1;
|
|
229
232
|
if (layout && layoutBlocksMap) {
|
|
230
|
-
const
|
|
233
|
+
const ToReact = layout._internal.toReact;
|
|
231
234
|
let t2;
|
|
232
235
|
if ($[13] !== afterBlocks || $[14] !== beforeBlocks) {
|
|
233
236
|
t2 = [...beforeBlocks, ...afterBlocks];
|
|
@@ -235,49 +238,61 @@ const PageContent = () => {
|
|
|
235
238
|
$[14] = beforeBlocks;
|
|
236
239
|
$[15] = t2;
|
|
237
240
|
} else t2 = $[15];
|
|
241
|
+
const T0 = layout._internal.Provider;
|
|
238
242
|
let t3;
|
|
239
|
-
if ($[16] !==
|
|
240
|
-
t3 =
|
|
241
|
-
$[16] =
|
|
242
|
-
$[17] =
|
|
243
|
+
if ($[16] !== locale || $[17] !== pageData) {
|
|
244
|
+
t3 = curatedLayoutContext(pageData, locale);
|
|
245
|
+
$[16] = locale;
|
|
246
|
+
$[17] = pageData;
|
|
243
247
|
$[18] = t3;
|
|
244
248
|
} else t3 = $[18];
|
|
245
249
|
let t4;
|
|
246
|
-
if ($[19] !==
|
|
247
|
-
t4 = /* @__PURE__ */ jsx(
|
|
248
|
-
|
|
249
|
-
children:
|
|
250
|
+
if ($[19] !== ToReact || $[20] !== pageBlocksContent || $[21] !== t3) {
|
|
251
|
+
t4 = /* @__PURE__ */ jsx(ToReact, {
|
|
252
|
+
...t3,
|
|
253
|
+
children: pageBlocksContent
|
|
250
254
|
});
|
|
251
|
-
$[19] =
|
|
252
|
-
$[20] =
|
|
255
|
+
$[19] = ToReact;
|
|
256
|
+
$[20] = pageBlocksContent;
|
|
253
257
|
$[21] = t3;
|
|
254
258
|
$[22] = t4;
|
|
255
259
|
} else t4 = $[22];
|
|
256
260
|
let t5;
|
|
257
|
-
if ($[23] !==
|
|
258
|
-
t5 = /* @__PURE__ */ jsx(
|
|
261
|
+
if ($[23] !== layout._internal.Provider || $[24] !== layoutBlocksMap || $[25] !== t4) {
|
|
262
|
+
t5 = /* @__PURE__ */ jsx(T0, {
|
|
263
|
+
layoutBlocks: layoutBlocksMap,
|
|
264
|
+
children: t4
|
|
265
|
+
});
|
|
266
|
+
$[23] = layout._internal.Provider;
|
|
267
|
+
$[24] = layoutBlocksMap;
|
|
268
|
+
$[25] = t4;
|
|
269
|
+
$[26] = t5;
|
|
270
|
+
} else t5 = $[26];
|
|
271
|
+
let t6;
|
|
272
|
+
if ($[27] !== layoutFiles || $[28] !== layoutItems || $[29] !== t2 || $[30] !== t5) {
|
|
273
|
+
t6 = /* @__PURE__ */ jsx(NormalizedDataProvider, {
|
|
259
274
|
files: layoutFiles,
|
|
260
275
|
repeatableItems: layoutItems,
|
|
261
276
|
blocks: t2,
|
|
262
|
-
children:
|
|
277
|
+
children: t5
|
|
263
278
|
});
|
|
264
|
-
$[
|
|
265
|
-
$[
|
|
266
|
-
$[
|
|
267
|
-
$[
|
|
268
|
-
$[
|
|
269
|
-
} else
|
|
270
|
-
return
|
|
279
|
+
$[27] = layoutFiles;
|
|
280
|
+
$[28] = layoutItems;
|
|
281
|
+
$[29] = t2;
|
|
282
|
+
$[30] = t5;
|
|
283
|
+
$[31] = t6;
|
|
284
|
+
} else t6 = $[31];
|
|
285
|
+
return t6;
|
|
271
286
|
}
|
|
272
287
|
let t2;
|
|
273
|
-
if ($[
|
|
288
|
+
if ($[32] !== pageBlocksContent) {
|
|
274
289
|
t2 = /* @__PURE__ */ jsx("main", {
|
|
275
290
|
className: "flex min-h-screen flex-col",
|
|
276
291
|
children: pageBlocksContent
|
|
277
292
|
});
|
|
278
|
-
$[
|
|
279
|
-
$[
|
|
280
|
-
} else t2 = $[
|
|
293
|
+
$[32] = pageBlocksContent;
|
|
294
|
+
$[33] = t2;
|
|
295
|
+
} else t2 = $[33];
|
|
281
296
|
return t2;
|
|
282
297
|
};
|
|
283
298
|
/**
|
|
@@ -617,7 +632,7 @@ function usePrefetchCanvas(enabled, projectUuid) {
|
|
|
617
632
|
}
|
|
618
633
|
/** Studio chrome is shared; only curated previews require a Camox page record. */
|
|
619
634
|
const PreviewShell = (t0) => {
|
|
620
|
-
const $ = c(
|
|
635
|
+
const $ = c(53);
|
|
621
636
|
const { children, pageData, derivedLayout, pageLocation, canvasOnly, runtimeBasePath: t1 } = t0;
|
|
622
637
|
const runtimeBasePath = t1 === void 0 ? "" : t1;
|
|
623
638
|
const isAuthenticated = useIsAuthenticated();
|
|
@@ -663,26 +678,42 @@ const PreviewShell = (t0) => {
|
|
|
663
678
|
const editingOwner = t2;
|
|
664
679
|
let t3;
|
|
665
680
|
let t4;
|
|
666
|
-
if ($[4] !== isMobileStudio) {
|
|
681
|
+
if ($[4] !== isAuthenticated || $[5] !== isMobileStudio) {
|
|
667
682
|
t3 = () => {
|
|
668
|
-
if (!isMobileStudio)
|
|
669
|
-
previewStore.send({ type: "hideCanvas" });
|
|
670
|
-
previewStore.send({ type: "closeAddBlockSheet" });
|
|
683
|
+
if (isAuthenticated && takeShowCanvasRequest() && !isMobileStudio) previewStore.send({ type: "showCanvas" });
|
|
671
684
|
};
|
|
672
|
-
t4 = [isMobileStudio];
|
|
673
|
-
$[4] =
|
|
674
|
-
$[5] =
|
|
675
|
-
$[6] =
|
|
685
|
+
t4 = [isAuthenticated, isMobileStudio];
|
|
686
|
+
$[4] = isAuthenticated;
|
|
687
|
+
$[5] = isMobileStudio;
|
|
688
|
+
$[6] = t3;
|
|
689
|
+
$[7] = t4;
|
|
676
690
|
} else {
|
|
677
|
-
t3 = $[
|
|
678
|
-
t4 = $[
|
|
691
|
+
t3 = $[6];
|
|
692
|
+
t4 = $[7];
|
|
679
693
|
}
|
|
680
694
|
React.useEffect(t3, t4);
|
|
681
|
-
useCanvasOnlyLocation(!!canvasOnly && isAuthenticated, isCanvasShown, isMobileStudio, pageLocation);
|
|
682
695
|
let t5;
|
|
683
696
|
let t6;
|
|
684
|
-
if ($[
|
|
697
|
+
if ($[8] !== isMobileStudio) {
|
|
685
698
|
t5 = () => {
|
|
699
|
+
if (!isMobileStudio) return;
|
|
700
|
+
previewStore.send({ type: "hideCanvas" });
|
|
701
|
+
previewStore.send({ type: "closeAddBlockSheet" });
|
|
702
|
+
};
|
|
703
|
+
t6 = [isMobileStudio];
|
|
704
|
+
$[8] = isMobileStudio;
|
|
705
|
+
$[9] = t5;
|
|
706
|
+
$[10] = t6;
|
|
707
|
+
} else {
|
|
708
|
+
t5 = $[9];
|
|
709
|
+
t6 = $[10];
|
|
710
|
+
}
|
|
711
|
+
React.useEffect(t5, t6);
|
|
712
|
+
useCanvasOnlyLocation(!!canvasOnly && isAuthenticated, isCanvasShown, isMobileStudio, pageLocation);
|
|
713
|
+
let t7;
|
|
714
|
+
let t8;
|
|
715
|
+
if ($[11] !== isAuthenticated || $[12] !== isCanvasShown || $[13] !== isMobileStudio) {
|
|
716
|
+
t7 = () => {
|
|
686
717
|
const actions = [
|
|
687
718
|
{
|
|
688
719
|
id: "hide-canvas",
|
|
@@ -732,140 +763,140 @@ const PreviewShell = (t0) => {
|
|
|
732
763
|
});
|
|
733
764
|
};
|
|
734
765
|
};
|
|
735
|
-
|
|
766
|
+
t8 = [
|
|
736
767
|
isCanvasShown,
|
|
737
768
|
isAuthenticated,
|
|
738
769
|
isMobileStudio
|
|
739
770
|
];
|
|
740
|
-
$[
|
|
741
|
-
$[
|
|
742
|
-
$[
|
|
743
|
-
$[
|
|
744
|
-
$[
|
|
771
|
+
$[11] = isAuthenticated;
|
|
772
|
+
$[12] = isCanvasShown;
|
|
773
|
+
$[13] = isMobileStudio;
|
|
774
|
+
$[14] = t7;
|
|
775
|
+
$[15] = t8;
|
|
745
776
|
} else {
|
|
746
|
-
|
|
747
|
-
|
|
777
|
+
t7 = $[14];
|
|
778
|
+
t8 = $[15];
|
|
748
779
|
}
|
|
749
|
-
React.useEffect(
|
|
780
|
+
React.useEffect(t7, t8);
|
|
750
781
|
if (!isAuthenticated) {
|
|
751
|
-
let
|
|
752
|
-
if ($[
|
|
753
|
-
|
|
754
|
-
$[
|
|
755
|
-
$[
|
|
756
|
-
} else
|
|
757
|
-
return
|
|
782
|
+
let t9;
|
|
783
|
+
if ($[16] !== children) {
|
|
784
|
+
t9 = /* @__PURE__ */ jsx(Fragment, { children });
|
|
785
|
+
$[16] = children;
|
|
786
|
+
$[17] = t9;
|
|
787
|
+
} else t9 = $[17];
|
|
788
|
+
return t9;
|
|
758
789
|
}
|
|
759
|
-
const
|
|
760
|
-
let
|
|
761
|
-
if ($[
|
|
762
|
-
|
|
763
|
-
$[
|
|
764
|
-
$[
|
|
765
|
-
} else
|
|
766
|
-
const
|
|
767
|
-
const
|
|
768
|
-
const
|
|
769
|
-
let
|
|
770
|
-
if ($[
|
|
771
|
-
|
|
772
|
-
page:
|
|
773
|
-
layoutPage:
|
|
790
|
+
const t9 = !isCanvasShown && "bg-black";
|
|
791
|
+
let t10;
|
|
792
|
+
if ($[18] !== t9) {
|
|
793
|
+
t10 = cn("bg-background relative flex h-full min-h-0 flex-1 flex-col overflow-hidden", t9);
|
|
794
|
+
$[18] = t9;
|
|
795
|
+
$[19] = t10;
|
|
796
|
+
} else t10 = $[19];
|
|
797
|
+
const t11 = pageLocation?.pathname;
|
|
798
|
+
const t12 = !canvasOnly;
|
|
799
|
+
const t13 = !!derivedLayout;
|
|
800
|
+
let t14;
|
|
801
|
+
if ($[20] !== t12 || $[21] !== t13) {
|
|
802
|
+
t14 = /* @__PURE__ */ jsx(CanvasSidebarSkeleton, {
|
|
803
|
+
page: t12,
|
|
804
|
+
layoutPage: t13
|
|
774
805
|
});
|
|
775
|
-
$[
|
|
776
|
-
$[
|
|
777
|
-
$[
|
|
778
|
-
} else
|
|
779
|
-
const
|
|
780
|
-
const
|
|
781
|
-
const
|
|
782
|
-
const
|
|
783
|
-
let
|
|
784
|
-
if ($[
|
|
785
|
-
|
|
806
|
+
$[20] = t12;
|
|
807
|
+
$[21] = t13;
|
|
808
|
+
$[22] = t14;
|
|
809
|
+
} else t14 = $[22];
|
|
810
|
+
const t15 = !isCanvasEnabled;
|
|
811
|
+
const t16 = pageData?.page;
|
|
812
|
+
const t17 = derivedLayout?.layoutId;
|
|
813
|
+
const t18 = pageData?.projectName;
|
|
814
|
+
let t19;
|
|
815
|
+
if ($[23] !== children || $[24] !== isMobileStudio || $[25] !== pageLocation || $[26] !== t15 || $[27] !== t16 || $[28] !== t17 || $[29] !== t18) {
|
|
816
|
+
t19 = /* @__PURE__ */ jsx("div", {
|
|
786
817
|
className: "flex min-h-0 flex-1 flex-row items-stretch",
|
|
787
818
|
children: /* @__PURE__ */ jsx(PreviewPanel, {
|
|
788
|
-
active:
|
|
819
|
+
active: t15,
|
|
789
820
|
isMobileExperience: isMobileStudio,
|
|
790
|
-
page:
|
|
791
|
-
layoutId:
|
|
821
|
+
page: t16,
|
|
822
|
+
layoutId: t17,
|
|
792
823
|
pageLocation,
|
|
793
|
-
projectName:
|
|
824
|
+
projectName: t18,
|
|
794
825
|
children
|
|
795
826
|
})
|
|
796
827
|
});
|
|
797
|
-
$[
|
|
798
|
-
$[
|
|
799
|
-
$[
|
|
800
|
-
$[
|
|
801
|
-
$[
|
|
802
|
-
$[
|
|
803
|
-
$[
|
|
804
|
-
$[
|
|
805
|
-
} else
|
|
806
|
-
let
|
|
807
|
-
if ($[
|
|
808
|
-
|
|
828
|
+
$[23] = children;
|
|
829
|
+
$[24] = isMobileStudio;
|
|
830
|
+
$[25] = pageLocation;
|
|
831
|
+
$[26] = t15;
|
|
832
|
+
$[27] = t16;
|
|
833
|
+
$[28] = t17;
|
|
834
|
+
$[29] = t18;
|
|
835
|
+
$[30] = t19;
|
|
836
|
+
} else t19 = $[30];
|
|
837
|
+
let t20;
|
|
838
|
+
if ($[31] !== isCanvasEnabled || $[32] !== pathname || $[33] !== runtimeBasePath || $[34] !== t11 || $[35] !== t14 || $[36] !== t19) {
|
|
839
|
+
t20 = /* @__PURE__ */ jsx(CanvasPreview, {
|
|
809
840
|
enabled: isCanvasEnabled,
|
|
810
841
|
pathname,
|
|
811
|
-
pagePathname:
|
|
842
|
+
pagePathname: t11,
|
|
812
843
|
runtimeBasePath,
|
|
813
|
-
placeholder:
|
|
814
|
-
children:
|
|
844
|
+
placeholder: t14,
|
|
845
|
+
children: t19
|
|
815
846
|
});
|
|
816
|
-
$[
|
|
817
|
-
$[
|
|
818
|
-
$[
|
|
819
|
-
$[
|
|
820
|
-
$[
|
|
821
|
-
$[32] = t9;
|
|
822
|
-
$[33] = t18;
|
|
823
|
-
} else t18 = $[33];
|
|
824
|
-
let t19;
|
|
825
|
-
if ($[34] !== isCanvasEnabled || $[35] !== pageId) {
|
|
826
|
-
t19 = !isCanvasEnabled && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(CreatePageModal, {}), pageId != null && /* @__PURE__ */ jsx(AddBlockSheet, {})] });
|
|
827
|
-
$[34] = isCanvasEnabled;
|
|
828
|
-
$[35] = pageId;
|
|
847
|
+
$[31] = isCanvasEnabled;
|
|
848
|
+
$[32] = pathname;
|
|
849
|
+
$[33] = runtimeBasePath;
|
|
850
|
+
$[34] = t11;
|
|
851
|
+
$[35] = t14;
|
|
829
852
|
$[36] = t19;
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
if ($[37] !== t18 || $[38] !== t19 || $[39] !== t8) {
|
|
833
|
-
t20 = /* @__PURE__ */ jsxs("div", {
|
|
834
|
-
className: t8,
|
|
835
|
-
children: [t18, t19]
|
|
836
|
-
});
|
|
837
|
-
$[37] = t18;
|
|
838
|
-
$[38] = t19;
|
|
839
|
-
$[39] = t8;
|
|
840
|
-
$[40] = t20;
|
|
841
|
-
} else t20 = $[40];
|
|
853
|
+
$[37] = t20;
|
|
854
|
+
} else t20 = $[37];
|
|
842
855
|
let t21;
|
|
843
|
-
if ($[
|
|
844
|
-
t21 = /* @__PURE__ */ jsx(
|
|
845
|
-
|
|
846
|
-
|
|
856
|
+
if ($[38] !== isCanvasEnabled || $[39] !== pageId) {
|
|
857
|
+
t21 = !isCanvasEnabled && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(CreatePageModal, {}), pageId != null && /* @__PURE__ */ jsx(AddBlockSheet, {})] });
|
|
858
|
+
$[38] = isCanvasEnabled;
|
|
859
|
+
$[39] = pageId;
|
|
860
|
+
$[40] = t21;
|
|
861
|
+
} else t21 = $[40];
|
|
862
|
+
let t22;
|
|
863
|
+
if ($[41] !== t10 || $[42] !== t20 || $[43] !== t21) {
|
|
864
|
+
t22 = /* @__PURE__ */ jsxs("div", {
|
|
865
|
+
className: t10,
|
|
866
|
+
children: [t20, t21]
|
|
847
867
|
});
|
|
848
|
-
$[41] =
|
|
868
|
+
$[41] = t10;
|
|
849
869
|
$[42] = t20;
|
|
850
870
|
$[43] = t21;
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
if ($[44] !== projectUuid) {
|
|
854
|
-
t22 = /* @__PURE__ */ jsx(ContentCollectionItemSheet, { projectUuid });
|
|
855
|
-
$[44] = projectUuid;
|
|
856
|
-
$[45] = t22;
|
|
857
|
-
} else t22 = $[45];
|
|
871
|
+
$[44] = t22;
|
|
872
|
+
} else t22 = $[44];
|
|
858
873
|
let t23;
|
|
859
|
-
if ($[
|
|
860
|
-
t23 = /* @__PURE__ */
|
|
874
|
+
if ($[45] !== editingOwner || $[46] !== t22) {
|
|
875
|
+
t23 = /* @__PURE__ */ jsx(PreviewEditingOwnerContext, {
|
|
876
|
+
value: editingOwner,
|
|
877
|
+
children: t22
|
|
878
|
+
});
|
|
879
|
+
$[45] = editingOwner;
|
|
880
|
+
$[46] = t22;
|
|
881
|
+
$[47] = t23;
|
|
882
|
+
} else t23 = $[47];
|
|
883
|
+
let t24;
|
|
884
|
+
if ($[48] !== projectUuid) {
|
|
885
|
+
t24 = /* @__PURE__ */ jsx(ContentCollectionItemSheet, { projectUuid });
|
|
886
|
+
$[48] = projectUuid;
|
|
887
|
+
$[49] = t24;
|
|
888
|
+
} else t24 = $[49];
|
|
889
|
+
let t25;
|
|
890
|
+
if ($[50] !== t23 || $[51] !== t24) {
|
|
891
|
+
t25 = /* @__PURE__ */ jsxs(CollectionItemSheetProvider, {
|
|
861
892
|
onRouteTargetClose: _temp9,
|
|
862
|
-
children: [
|
|
893
|
+
children: [t23, t24]
|
|
863
894
|
});
|
|
864
|
-
$[
|
|
865
|
-
$[
|
|
866
|
-
$[
|
|
867
|
-
} else
|
|
868
|
-
return
|
|
895
|
+
$[50] = t23;
|
|
896
|
+
$[51] = t24;
|
|
897
|
+
$[52] = t25;
|
|
898
|
+
} else t25 = $[52];
|
|
899
|
+
return t25;
|
|
869
900
|
};
|
|
870
901
|
/** Zooms out to the whole Canvas, from anywhere in the site or the Studio. */
|
|
871
902
|
function useShowCanvasAction() {
|
|
@@ -4,6 +4,7 @@ import { usePageBlocks } from "../../../lib/normalized-data.js";
|
|
|
4
4
|
import { formatShortcut } from "../../../lib/utils.js";
|
|
5
5
|
import { blockMutations, repeatableItemMutations } from "../../../lib/queries.js";
|
|
6
6
|
import { isBlockSelection, previewStore, selectionForPage, selectionItemId } from "../previewStore.js";
|
|
7
|
+
import { entityName } from "../entityName.js";
|
|
7
8
|
import { useUpdateBlockPosition } from "./useUpdateBlockPosition.js";
|
|
8
9
|
import { usePreviewedPage } from "../CamoxPreview.js";
|
|
9
10
|
import { c } from "react/compiler-runtime";
|
|
@@ -28,7 +29,7 @@ const BlockActionsPopover = ({ block, children, open, onOpenChange, align = "sta
|
|
|
28
29
|
const handleDeleteBlock = async (block) => {
|
|
29
30
|
try {
|
|
30
31
|
await deleteBlock.mutateAsync({ id: block.id });
|
|
31
|
-
toast.success(`Deleted "${block
|
|
32
|
+
toast.success(`Deleted "${entityName(block, block.type)}" block`);
|
|
32
33
|
} catch (error) {
|
|
33
34
|
console.error("Failed to delete block:", error);
|
|
34
35
|
toast.error("Could not delete block");
|
|
@@ -39,7 +40,7 @@ const BlockActionsPopover = ({ block, children, open, onOpenChange, align = "sta
|
|
|
39
40
|
const handleDuplicateBlock = async (block) => {
|
|
40
41
|
try {
|
|
41
42
|
await duplicateBlock.mutateAsync({ id: block.id });
|
|
42
|
-
toast.success(`Duplicated "${block.
|
|
43
|
+
toast.success(`Duplicated "${entityName(block, block.type)}" block`);
|
|
43
44
|
} catch (error) {
|
|
44
45
|
console.error("Failed to duplicate block:", error);
|
|
45
46
|
toast.error("Could not duplicate block");
|
|
@@ -209,8 +210,9 @@ const BlockActionsPopover = ({ block, children, open, onOpenChange, align = "sta
|
|
|
209
210
|
open: !!blockToDelete,
|
|
210
211
|
onOpenChange: (open) => !open && setBlockToDelete(null),
|
|
211
212
|
children: /* @__PURE__ */ jsxs(AlertDialogContent, { children: [/* @__PURE__ */ jsxs(AlertDialogHeader, { children: [/* @__PURE__ */ jsx(AlertDialogTitle, { children: "Delete block" }), /* @__PURE__ */ jsxs(AlertDialogDescription, { children: [
|
|
212
|
-
"Are you sure you want to delete
|
|
213
|
-
|
|
213
|
+
"Are you sure you want to delete",
|
|
214
|
+
" ",
|
|
215
|
+
/* @__PURE__ */ jsx("strong", { children: blockToDelete && entityName(blockToDelete, blockToDelete.type) }),
|
|
214
216
|
"? This action cannot be undone."
|
|
215
217
|
] })] }), /* @__PURE__ */ jsxs(AlertDialogFooter, { children: [/* @__PURE__ */ jsx(AlertDialogCancel, {
|
|
216
218
|
variant: "outline",
|
|
@@ -310,7 +312,7 @@ function useBlockActionsShortcuts() {
|
|
|
310
312
|
return;
|
|
311
313
|
}
|
|
312
314
|
const block_0 = pageBlocks.find((b_0) => b_0.id === sel_0.blockId);
|
|
313
|
-
deleteBlock({ id: sel_0.blockId }).then(() => toast.success(`Deleted "${block_0
|
|
315
|
+
deleteBlock({ id: sel_0.blockId }).then(() => toast.success(`Deleted "${block_0 ? entityName(block_0, block_0.type) : ""}" block`), _temp6);
|
|
314
316
|
previewStore.send({ type: "clearSelection" });
|
|
315
317
|
}
|
|
316
318
|
},
|
|
@@ -339,7 +341,7 @@ function useBlockActionsShortcuts() {
|
|
|
339
341
|
return;
|
|
340
342
|
}
|
|
341
343
|
const block_1 = pageBlocks.find((b_1) => b_1.id === sel_2.blockId);
|
|
342
|
-
duplicateBlock({ id: sel_2.blockId }).then(() => toast.success(`Duplicated "${block_1
|
|
344
|
+
duplicateBlock({ id: sel_2.blockId }).then(() => toast.success(`Duplicated "${block_1 ? entityName(block_1, block_1.type) : ""}" block`), _temp9);
|
|
343
345
|
}
|
|
344
346
|
},
|
|
345
347
|
{
|