camox 0.48.0 → 0.52.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.
Files changed (127) hide show
  1. package/dist/core/createApp.d.ts +1 -0
  2. package/dist/core/createApp.js +1 -0
  3. package/dist/core/editing/contentEdits.js +78 -0
  4. package/dist/core/editing/createEditableBlock.js +277 -311
  5. package/dist/core/layoutContext.d.ts +1 -0
  6. package/dist/core/lib/contentType.js +2 -2
  7. package/dist/core/recordItem.js +3 -3
  8. package/dist/features/canvas/CamoxCanvas.js +15 -15
  9. package/dist/features/canvas/CanvasLoadingScreen.js +15 -11
  10. package/dist/features/canvas/CanvasPageFrame.js +81 -87
  11. package/dist/features/canvas/CanvasPreviewPageSlot.js +1 -1
  12. package/dist/features/canvas/DerivedPagePathInput.js +12 -12
  13. package/dist/features/canvas/canvasOverlayGeometry.js +1 -1
  14. package/dist/features/canvas/canvasStore.js +2 -2
  15. package/dist/features/canvas/sidebar/CanvasInspector.js +1 -1
  16. package/dist/features/canvas/sidebar/CuratedPageInspector.js +1 -1
  17. package/dist/features/canvas/sidebar/LayoutPageBlocks.js +23 -31
  18. package/dist/features/canvas/useCanvasCamera.js +1 -1
  19. package/dist/features/canvas/useDiscoveredPreviewPaths.js +16 -9
  20. package/dist/features/content/ContentAssets.js +84 -88
  21. package/dist/features/page/CuratedPageContent.js +1 -1
  22. package/dist/features/preview/CamoxPreview.d.ts +8 -4
  23. package/dist/features/preview/CamoxPreview.js +258 -443
  24. package/dist/features/preview/EditablePageContent.js +244 -2
  25. package/dist/features/preview/EditablePageExperience.js +19 -13
  26. package/dist/features/preview/components/AddBlockSheet.js +55 -15
  27. package/dist/features/preview/components/BlockActionsPopover.js +23 -51
  28. package/dist/features/preview/components/BlockPeek.js +66 -0
  29. package/dist/features/preview/components/BlockThumbnail.js +134 -119
  30. package/dist/features/preview/components/CanvasPreview.js +1 -1
  31. package/dist/features/preview/components/CreatePageModal.js +150 -156
  32. package/dist/features/preview/components/FieldToolbar.js +1 -1
  33. package/dist/features/preview/components/Frame.js +27 -4
  34. package/dist/features/preview/components/MobilePreviewDrawer.js +6 -9
  35. package/dist/features/preview/components/PageInfo.js +161 -126
  36. package/dist/features/preview/components/PagePicker.js +2 -2
  37. package/dist/features/preview/components/PageTree.js +174 -190
  38. package/dist/features/preview/components/PreviewPanel.js +13 -67
  39. package/dist/features/preview/components/PreviewToolbar.js +1 -1
  40. package/dist/features/preview/components/ReferenceFieldEditor.js +4 -4
  41. package/dist/features/preview/components/ReferenceListFieldEditor.js +4 -4
  42. package/dist/features/preview/components/RemovedBlockPlaceholder.js +37 -70
  43. package/dist/features/preview/components/RepeatableItemsList.js +1 -1
  44. package/dist/features/preview/components/SelectionEditor.js +248 -256
  45. package/dist/features/preview/components/StudioEditingFallback.js +22 -26
  46. package/dist/features/preview/components/useFieldWriter.js +19 -19
  47. package/dist/features/preview/components/useRecordView.js +105 -147
  48. package/dist/features/preview/components/useRepeatableItemActions.js +0 -2
  49. package/dist/features/preview/pageRecord.js +30 -24
  50. package/dist/features/preview/previewConstants.js +2 -8
  51. package/dist/features/preview/previewStore.js +2 -0
  52. package/dist/features/preview/studioNotice.js +20 -0
  53. package/dist/features/preview/usePreviewViewportActions.js +1 -1
  54. package/dist/features/provider/AuthenticatedCamoxProvider.js +47 -31
  55. package/dist/features/provider/components/CommandPalette.js +2 -5
  56. package/dist/features/provider/signInShortcut.js +1 -2
  57. package/dist/features/provider/useAdminShortcuts.js +47 -53
  58. package/dist/features/renderer/RendererApp.js +542 -0
  59. package/dist/features/renderer/RendererFrames.js +450 -0
  60. package/dist/features/renderer/definitionAnswers.js +26 -0
  61. package/dist/features/renderer/protocol.js +35 -0
  62. package/dist/features/renderer/rendererHost.js +249 -0
  63. package/dist/features/renderer/studioConnection.js +186 -0
  64. package/dist/features/routes/pageRuntime.d.ts +2 -1
  65. package/dist/features/routes/pageRuntime.js +34 -22
  66. package/dist/features/runtime/RuntimeChrome.js +2 -5
  67. package/dist/features/runtime/assetPrefix.js +14 -0
  68. package/dist/features/runtime/breadcrumbs.js +1 -1
  69. package/dist/features/runtime/editingFallback.js +4 -8
  70. package/dist/features/runtime/livePages.js +1 -1
  71. package/dist/features/runtime/pageApp.js +57 -83
  72. package/dist/features/runtime/pageClient.js +1 -1
  73. package/dist/features/runtime/pageNavigation.js +3 -2
  74. package/dist/features/runtime/publicCache.js +95 -0
  75. package/dist/features/runtime/publishingDraft.js +23 -0
  76. package/dist/features/runtime/rendererClient.d.ts +8 -0
  77. package/dist/features/runtime/rendererClient.js +77 -0
  78. package/dist/features/runtime/runtime.d.ts +22 -3
  79. package/dist/features/runtime/runtime.js +209 -96
  80. package/dist/features/runtime/runtimeRoutes.d.ts +2 -0
  81. package/dist/features/runtime/runtimeRoutes.js +2 -0
  82. package/dist/features/runtime/worker.d.ts +14 -1
  83. package/dist/features/runtime/worker.js +34 -4
  84. package/dist/features/settings/AnalyticsSettings.js +622 -0
  85. package/dist/features/settings/CamoxSettings.js +95 -0
  86. package/dist/features/settings/FaviconSettings.js +254 -0
  87. package/dist/features/settings/ProjectNameSettings.js +145 -0
  88. package/dist/features/settings/SettingsPart.js +73 -0
  89. package/dist/features/settings/SocialProfilesSettings.js +245 -0
  90. package/dist/features/settings/useProjectMutation.js +61 -0
  91. package/dist/features/studio/FollowAgentProvider.js +10 -10
  92. package/dist/features/studio/components/DraftsControl.js +136 -131
  93. package/dist/features/studio/components/LocalePicker.js +178 -174
  94. package/dist/features/studio/components/Navbar.js +107 -66
  95. package/dist/features/studio/components/ProjectMenu.js +119 -171
  96. package/dist/features/studio/components/ReviewDraftSheet.js +1151 -991
  97. package/dist/features/studio/components/ThreadMessages.js +100 -65
  98. package/dist/features/studio/components/UserButton.js +2 -2
  99. package/dist/features/studio/routes.js +3 -1
  100. package/dist/features/studio/showInCanvas.js +129 -0
  101. package/dist/features/vite/definitionsSync.js +5 -6
  102. package/dist/features/vite/hostedChecks.js +127 -0
  103. package/dist/features/vite/runtimeDev.js +58 -17
  104. package/dist/features/vite/staticAssetHeaders.js +52 -0
  105. package/dist/features/vite/vite.d.ts +1 -1
  106. package/dist/features/vite/vite.js +49 -9
  107. package/dist/hooks/use-page-destinations.js +10 -10
  108. package/dist/lib/api-client-server.d.ts +1 -1
  109. package/dist/lib/api-client.d.ts +2 -1
  110. package/dist/lib/draft-scope.d.ts +1 -0
  111. package/dist/lib/locale-path.d.ts +3 -11
  112. package/dist/lib/locale-path.js +3 -27
  113. package/dist/lib/queries.js +7 -1
  114. package/dist/lib/revisions.js +20 -0
  115. package/dist/lib/shortcuts.js +29 -0
  116. package/dist/lib/studio-definitions.js +160 -0
  117. package/dist/lib/studio-reads.d.ts +1 -0
  118. package/dist/lib/studio-reads.js +65 -21
  119. package/dist/lib/use-project-room.js +16 -10
  120. package/dist/lib/utils.js +1 -104
  121. package/dist/package.js +1 -1
  122. package/dist/studio.css +1 -1
  123. package/package.json +9 -4
  124. package/skills/camox/SKILL.md +4 -0
  125. package/skills/camox/references/artifacts.md +1 -1
  126. package/dist/features/studio/components/FaviconDialog.js +0 -318
  127. package/dist/features/studio/components/SocialProfilesDialog.js +0 -342
@@ -4,31 +4,28 @@ import { parseLocalePath } from "../../lib/locale-path.js";
4
4
  import { useCurrentDraftId, withoutDraft } from "../../lib/draft-scope.js";
5
5
  import { useViewLocale } from "../../lib/view-locale-context.js";
6
6
  import { useLocation, useNavigate } from "../navigation/navigation.js";
7
- import { useCamoxApp } from "../provider/components/CamoxAppContext.js";
8
- import { NormalizedDataProvider, usePageBlocks } from "../../lib/normalized-data.js";
9
7
  import { reads, useRead, useStudioCache } from "../../lib/studio-reads.js";
10
- import { BlockErrorBoundary } from "./components/BlockErrorBoundary.js";
11
- import { curatedLayoutContext } from "../../core/layoutContext.js";
12
8
  import { CollectionItemSheetProvider } from "../content/CollectionItemSheetContext.js";
13
9
  import { cn } from "../../lib/utils.js";
14
10
  import { ContentCollectionItemSheet } from "../content/ContentCollection.js";
15
11
  import { usePageDestinations } from "../../hooks/use-page-destinations.js";
16
12
  import { useLocalePath, useLocalizedPath } from "../../lib/view-locale.js";
13
+ import { CanvasLoadingScreen } from "../canvas/CanvasLoadingScreen.js";
17
14
  import { canvasStore } from "../canvas/canvasStore.js";
18
15
  import { SHOW_WHOLE_CANVAS_SHORTCUT, TOGGLE_CANVAS_SHORTCUT } from "./previewConstants.js";
19
16
  import { CanvasSidebarSkeleton } from "../canvas/sidebar/CanvasSidebarSkeleton.js";
20
- import { DerivedPageContent } from "../page/DerivedPageContent.js";
21
17
  import { takeShowCanvasRequest } from "../provider/signInShortcut.js";
18
+ import { previewStore, selectIsCanvasShown } from "./previewStore.js";
19
+ import { PreviewEditingOwnerContext } from "./previewSelection.js";
20
+ import { RendererFramesProvider, RendererSlot, useRendererHost, useRendererStatus } from "../renderer/RendererFrames.js";
22
21
  import { STUDIO_CANVAS_PATH } from "../studio/routes.js";
23
22
  import { studioStore } from "../studio/studioStore.js";
24
- import { previewStore, selectIsCanvasShown } from "./previewStore.js";
25
23
  import { AddBlockSheet } from "./components/AddBlockSheet.js";
26
24
  import { CanvasPreview, prefetchCanvas } from "./components/CanvasPreview.js";
27
25
  import { CreatePageModal } from "./components/CreatePageModal.js";
28
- import { PreviewEditingOwnerContext } from "./previewSelection.js";
29
26
  import { PageRecordContext, getPageRecord, useDerivedPageResult, useFollowPageRecord } from "./pageRecord.js";
30
27
  import { PreviewPanel } from "./components/PreviewPanel.js";
31
- import { RemovedBlockPlaceholder } from "./components/RemovedBlockPlaceholder.js";
28
+ import { PAGE_LOADING_LABEL } from "./components/StudioEditingFallback.js";
32
29
  import { usePreviewViewportActions } from "./usePreviewViewportActions.js";
33
30
  import { c } from "react/compiler-runtime";
34
31
  import * as React from "react";
@@ -69,232 +66,6 @@ function usePreviewedPage() {
69
66
  } else t0 = $[2];
70
67
  return useRead(t0);
71
68
  }
72
- const BlockRenderer = (t0) => {
73
- const $ = c(28);
74
- const { blockId, mode, showAddBlockTop, showAddBlockBottom } = t0;
75
- let t1;
76
- if ($[0] !== blockId) {
77
- t1 = reads.blockBundle(blockId);
78
- $[0] = blockId;
79
- $[1] = t1;
80
- } else t1 = $[1];
81
- const data = useRead(t1);
82
- const camoxApp = useCamoxApp();
83
- let t2;
84
- if ($[2] !== camoxApp || $[3] !== data.block.type) {
85
- t2 = camoxApp.getBlockById(data.block.type);
86
- $[2] = camoxApp;
87
- $[3] = data.block.type;
88
- $[4] = t2;
89
- } else t2 = $[4];
90
- const blockDef = t2;
91
- if (!blockDef) {
92
- let t3;
93
- if ($[5] !== blockId || $[6] !== data.block.type || $[7] !== mode) {
94
- t3 = /* @__PURE__ */ jsx(RemovedBlockPlaceholder, {
95
- blockId,
96
- type: data.block.type,
97
- mode
98
- });
99
- $[5] = blockId;
100
- $[6] = data.block.type;
101
- $[7] = mode;
102
- $[8] = t3;
103
- } else t3 = $[8];
104
- return t3;
105
- }
106
- const t3 = data.files;
107
- const t4 = data.repeatableItems;
108
- let t5;
109
- if ($[9] !== data.block) {
110
- t5 = [data.block];
111
- $[9] = data.block;
112
- $[10] = t5;
113
- } else t5 = $[10];
114
- const T0 = blockDef._internal.Component;
115
- const t6 = data.block.id;
116
- const t7 = data.block.type;
117
- const t8 = data.block.content;
118
- const t9 = data.block.settings;
119
- const t10 = String(data.block.position);
120
- let t11;
121
- if ($[11] !== data.block.id || $[12] !== data.block.type || $[13] !== t10 || $[14] !== t8 || $[15] !== t9) {
122
- t11 = {
123
- _id: t6,
124
- type: t7,
125
- content: t8,
126
- settings: t9,
127
- position: t10
128
- };
129
- $[11] = data.block.id;
130
- $[12] = data.block.type;
131
- $[13] = t10;
132
- $[14] = t8;
133
- $[15] = t9;
134
- $[16] = t11;
135
- } else t11 = $[16];
136
- let t12;
137
- if ($[17] !== blockDef._internal.Component || $[18] !== mode || $[19] !== showAddBlockBottom || $[20] !== showAddBlockTop || $[21] !== t11) {
138
- t12 = /* @__PURE__ */ jsx(T0, {
139
- blockData: t11,
140
- mode,
141
- showAddBlockTop,
142
- showAddBlockBottom
143
- });
144
- $[17] = blockDef._internal.Component;
145
- $[18] = mode;
146
- $[19] = showAddBlockBottom;
147
- $[20] = showAddBlockTop;
148
- $[21] = t11;
149
- $[22] = t12;
150
- } else t12 = $[22];
151
- let t13;
152
- if ($[23] !== data.files || $[24] !== data.repeatableItems || $[25] !== t12 || $[26] !== t5) {
153
- t13 = /* @__PURE__ */ jsx(NormalizedDataProvider, {
154
- files: t3,
155
- repeatableItems: t4,
156
- blocks: t5,
157
- children: t12
158
- });
159
- $[23] = data.files;
160
- $[24] = data.repeatableItems;
161
- $[25] = t12;
162
- $[26] = t5;
163
- $[27] = t13;
164
- } else t13 = $[27];
165
- return t13;
166
- };
167
- const PageContent = () => {
168
- const $ = c(34);
169
- const pageData = usePreviewedPage();
170
- const { pageBlocks, beforeBlocks, afterBlocks, layoutFiles, layoutItems } = usePageBlocks(pageData);
171
- const camoxApp = useCamoxApp();
172
- const { locale } = useViewLocale();
173
- let layout;
174
- let layoutBlocksMap;
175
- let t0;
176
- if ($[0] !== afterBlocks || $[1] !== beforeBlocks || $[2] !== camoxApp || $[3] !== pageBlocks || $[4] !== pageData) {
177
- layout = pageData.layout ? camoxApp.getLayoutById(pageData.layout.layoutId) : void 0;
178
- let t1;
179
- bb0: {
180
- if (!pageData.layout) {
181
- t1 = null;
182
- break bb0;
183
- }
184
- let blocks;
185
- if ($[8] !== afterBlocks || $[9] !== beforeBlocks) {
186
- const allLayoutBlocks = [...beforeBlocks, ...afterBlocks];
187
- blocks = {};
188
- for (const block of allLayoutBlocks) blocks[block.type] = {
189
- _id: block.id,
190
- type: block.type,
191
- content: block.content,
192
- settings: block.settings,
193
- position: String(block.position)
194
- };
195
- $[8] = afterBlocks;
196
- $[9] = beforeBlocks;
197
- $[10] = blocks;
198
- } else blocks = $[10];
199
- t1 = blocks;
200
- }
201
- layoutBlocksMap = t1;
202
- t0 = pageBlocks.map((blockData, index) => /* @__PURE__ */ jsx(BlockErrorBoundary, {
203
- blockId: blockData.id,
204
- blockType: blockData.type,
205
- children: /* @__PURE__ */ jsx(BlockRenderer, {
206
- blockId: blockData.id,
207
- mode: "site",
208
- showAddBlockTop: index === 0 ? layout?._internal.blockDefinitions.some(_temp2) ?? false : true,
209
- showAddBlockBottom: true
210
- })
211
- }, blockData.id));
212
- $[0] = afterBlocks;
213
- $[1] = beforeBlocks;
214
- $[2] = camoxApp;
215
- $[3] = pageBlocks;
216
- $[4] = pageData;
217
- $[5] = layout;
218
- $[6] = layoutBlocksMap;
219
- $[7] = t0;
220
- } else {
221
- layout = $[5];
222
- layoutBlocksMap = $[6];
223
- t0 = $[7];
224
- }
225
- let t1;
226
- if ($[11] !== t0) {
227
- t1 = /* @__PURE__ */ jsx(Fragment, { children: t0 });
228
- $[11] = t0;
229
- $[12] = t1;
230
- } else t1 = $[12];
231
- const pageBlocksContent = t1;
232
- if (layout && layoutBlocksMap) {
233
- const ToReact = layout._internal.toReact;
234
- let t2;
235
- if ($[13] !== afterBlocks || $[14] !== beforeBlocks) {
236
- t2 = [...beforeBlocks, ...afterBlocks];
237
- $[13] = afterBlocks;
238
- $[14] = beforeBlocks;
239
- $[15] = t2;
240
- } else t2 = $[15];
241
- const T0 = layout._internal.Provider;
242
- let t3;
243
- if ($[16] !== locale || $[17] !== pageData) {
244
- t3 = curatedLayoutContext(pageData, locale);
245
- $[16] = locale;
246
- $[17] = pageData;
247
- $[18] = t3;
248
- } else t3 = $[18];
249
- let t4;
250
- if ($[19] !== ToReact || $[20] !== pageBlocksContent || $[21] !== t3) {
251
- t4 = /* @__PURE__ */ jsx(ToReact, {
252
- ...t3,
253
- children: pageBlocksContent
254
- });
255
- $[19] = ToReact;
256
- $[20] = pageBlocksContent;
257
- $[21] = t3;
258
- $[22] = t4;
259
- } else t4 = $[22];
260
- let t5;
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, {
274
- files: layoutFiles,
275
- repeatableItems: layoutItems,
276
- blocks: t2,
277
- children: t5
278
- });
279
- $[27] = layoutFiles;
280
- $[28] = layoutItems;
281
- $[29] = t2;
282
- $[30] = t5;
283
- $[31] = t6;
284
- } else t6 = $[31];
285
- return t6;
286
- }
287
- let t2;
288
- if ($[32] !== pageBlocksContent) {
289
- t2 = /* @__PURE__ */ jsx("main", {
290
- className: "flex min-h-screen flex-col",
291
- children: pageBlocksContent
292
- });
293
- $[32] = pageBlocksContent;
294
- $[33] = t2;
295
- } else t2 = $[33];
296
- return t2;
297
- };
298
69
  /**
299
70
  * The read of the page the Preview shows: a curated page's structure, or a layout page's layout. A
300
71
  * Canvas-only location, opened first, has no page to show.
@@ -328,7 +99,7 @@ function useRefreshMemberRead(read) {
328
99
  if ($[4] !== isAuthenticated || $[5] !== read || $[6] !== studioCache) {
329
100
  t1 = () => {
330
101
  if (!isAuthenticated || !read) return;
331
- studioCache.reload(read).catch(_temp3);
102
+ studioCache.reload(read).catch(_temp2);
332
103
  };
333
104
  $[4] = isAuthenticated;
334
105
  $[5] = read;
@@ -351,7 +122,7 @@ function useRefreshMemberRead(read) {
351
122
  } else t3 = $[12];
352
123
  React.useEffect(t2, t3);
353
124
  }
354
- function _temp3() {}
125
+ function _temp2() {}
355
126
  /**
356
127
  * The page the Preview shows: the current one, or on a Canvas-only location,
357
128
  * which has none, the last one. The Canvas keeps showing that page in its slot
@@ -412,10 +183,13 @@ function useRememberWebsiteLocation(location) {
412
183
  }
413
184
  React.useEffect(t0, t1);
414
185
  }
186
+ /**
187
+ * The signed-in Website Section. The studio never renders the page itself: the renderer frame,
188
+ * which runs the shown draft's code, renders it into the Preview's slot.
189
+ */
415
190
  const CamoxPreview = (t0) => {
416
- const $ = c(36);
417
- const { children, runtimeBasePath, derived, canvasOnly } = t0;
418
- const camoxApp = useCamoxApp();
191
+ const $ = c(34);
192
+ const { runtimeBasePath, derived, canvasOnly } = t0;
419
193
  const location = useLocation();
420
194
  useRememberWebsiteLocation(location);
421
195
  const shown = useShownPage(location, derived, !!canvasOnly);
@@ -484,54 +258,57 @@ const CamoxPreview = (t0) => {
484
258
  useFollowPageRecord(t9);
485
259
  const pageData = data && "page" in data ? data : void 0;
486
260
  const layout = data && !("page" in data) ? data : void 0;
487
- const t10 = shown?.location;
488
- let t11;
489
- if ($[19] !== camoxApp || $[20] !== children || $[21] !== derivedResult || $[22] !== layout || $[23] !== shown || $[24] !== shownDerived) {
490
- t11 = shownDerived && layout ? /* @__PURE__ */ jsx(DerivedPageContent, {
491
- camoxApp,
492
- derived: {
493
- ...shownDerived,
494
- layout,
495
- result: derivedResult
496
- }
497
- }) : shown ? children : null;
498
- $[19] = camoxApp;
499
- $[20] = children;
500
- $[21] = derivedResult;
501
- $[22] = layout;
502
- $[23] = shown;
503
- $[24] = shownDerived;
504
- $[25] = t11;
505
- } else t11 = $[25];
261
+ const [pageShown, setPageShown] = React.useState(false);
262
+ let t10;
263
+ if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
264
+ t10 = () => setPageShown(true);
265
+ $[19] = t10;
266
+ } else t10 = $[19];
267
+ const showPage = t10;
268
+ const t11 = shown?.location;
506
269
  let t12;
507
- if ($[26] !== canvasOnly || $[27] !== layout || $[28] !== pageData || $[29] !== runtimeBasePath || $[30] !== t10 || $[31] !== t11) {
508
- t12 = /* @__PURE__ */ jsx(PreviewShell, {
270
+ if ($[20] !== pathname || $[21] !== shownDerived?.layoutId) {
271
+ t12 = pathname !== void 0 && /* @__PURE__ */ jsx(RendererSlot, {
272
+ pathname,
273
+ derivedLayoutId: shownDerived?.layoutId,
274
+ onRendered: showPage,
275
+ onFailed: showPage
276
+ });
277
+ $[20] = pathname;
278
+ $[21] = shownDerived?.layoutId;
279
+ $[22] = t12;
280
+ } else t12 = $[22];
281
+ let t13;
282
+ if ($[23] !== canvasOnly || $[24] !== layout || $[25] !== pageData || $[26] !== pageShown || $[27] !== runtimeBasePath || $[28] !== t11 || $[29] !== t12) {
283
+ t13 = /* @__PURE__ */ jsx(PreviewShell, {
509
284
  pageData,
510
285
  derivedLayout: layout,
511
- pageLocation: t10,
286
+ pageLocation: t11,
512
287
  canvasOnly,
513
288
  runtimeBasePath,
514
- children: t11
289
+ pageShown,
290
+ children: t12
515
291
  });
516
- $[26] = canvasOnly;
517
- $[27] = layout;
518
- $[28] = pageData;
519
- $[29] = runtimeBasePath;
520
- $[30] = t10;
521
- $[31] = t11;
522
- $[32] = t12;
523
- } else t12 = $[32];
524
- let t13;
525
- if ($[33] !== derivedResult || $[34] !== t12) {
526
- t13 = /* @__PURE__ */ jsx(PageRecordContext, {
292
+ $[23] = canvasOnly;
293
+ $[24] = layout;
294
+ $[25] = pageData;
295
+ $[26] = pageShown;
296
+ $[27] = runtimeBasePath;
297
+ $[28] = t11;
298
+ $[29] = t12;
299
+ $[30] = t13;
300
+ } else t13 = $[30];
301
+ let t14;
302
+ if ($[31] !== derivedResult || $[32] !== t13) {
303
+ t14 = /* @__PURE__ */ jsx(PageRecordContext, {
527
304
  value: derivedResult,
528
- children: t12
305
+ children: t13
529
306
  });
530
- $[33] = derivedResult;
531
- $[34] = t12;
532
- $[35] = t13;
533
- } else t13 = $[35];
534
- return t13;
307
+ $[31] = derivedResult;
308
+ $[32] = t13;
309
+ $[33] = t14;
310
+ } else t14 = $[33];
311
+ return t14;
535
312
  };
536
313
  /**
537
314
  * A Canvas-only location only exists on the Canvas. Opening one
@@ -632,9 +409,10 @@ function usePrefetchCanvas(enabled, projectUuid) {
632
409
  }
633
410
  /** Studio chrome is shared; only curated previews require a Camox page record. */
634
411
  const PreviewShell = (t0) => {
635
- const $ = c(53);
636
- const { children, pageData, derivedLayout, pageLocation, canvasOnly, runtimeBasePath: t1 } = t0;
412
+ const $ = c(62);
413
+ const { children, pageData, derivedLayout, pageLocation, canvasOnly, runtimeBasePath: t1, pageShown: t2 } = t0;
637
414
  const runtimeBasePath = t1 === void 0 ? "" : t1;
415
+ const pageShown = t2 === void 0 ? true : t2;
638
416
  const isAuthenticated = useIsAuthenticated();
639
417
  const projectUuid = useProjectUuid();
640
418
  const isMobileStudio = useIsMobileStudio();
@@ -645,75 +423,75 @@ const PreviewShell = (t0) => {
645
423
  const { pathname } = useLocation();
646
424
  const pageId = canvasOnly ? void 0 : pageData?.page.id;
647
425
  const layoutId = canvasOnly ? void 0 : derivedLayout?.layoutId;
648
- let t2;
426
+ let t3;
649
427
  bb0: {
650
428
  if (pageId != null) {
651
- let t3;
429
+ let t4;
652
430
  if ($[0] !== pageId) {
653
- t3 = {
431
+ t4 = {
654
432
  kind: "page",
655
433
  pageId
656
434
  };
657
435
  $[0] = pageId;
658
- $[1] = t3;
659
- } else t3 = $[1];
660
- t2 = t3;
436
+ $[1] = t4;
437
+ } else t4 = $[1];
438
+ t3 = t4;
661
439
  break bb0;
662
440
  }
663
441
  if (layoutId != null) {
664
- let t3;
442
+ let t4;
665
443
  if ($[2] !== layoutId) {
666
- t3 = {
444
+ t4 = {
667
445
  kind: "layout",
668
446
  layoutId
669
447
  };
670
448
  $[2] = layoutId;
671
- $[3] = t3;
672
- } else t3 = $[3];
673
- t2 = t3;
449
+ $[3] = t4;
450
+ } else t4 = $[3];
451
+ t3 = t4;
674
452
  break bb0;
675
453
  }
676
- t2 = null;
454
+ t3 = null;
677
455
  }
678
- const editingOwner = t2;
679
- let t3;
456
+ const editingOwner = t3;
680
457
  let t4;
458
+ let t5;
681
459
  if ($[4] !== isAuthenticated || $[5] !== isMobileStudio) {
682
- t3 = () => {
460
+ t4 = () => {
683
461
  if (isAuthenticated && takeShowCanvasRequest() && !isMobileStudio) previewStore.send({ type: "showCanvas" });
684
462
  };
685
- t4 = [isAuthenticated, isMobileStudio];
463
+ t5 = [isAuthenticated, isMobileStudio];
686
464
  $[4] = isAuthenticated;
687
465
  $[5] = isMobileStudio;
688
- $[6] = t3;
689
- $[7] = t4;
466
+ $[6] = t4;
467
+ $[7] = t5;
690
468
  } else {
691
- t3 = $[6];
692
- t4 = $[7];
469
+ t4 = $[6];
470
+ t5 = $[7];
693
471
  }
694
- React.useEffect(t3, t4);
695
- let t5;
472
+ React.useEffect(t4, t5);
696
473
  let t6;
474
+ let t7;
697
475
  if ($[8] !== isMobileStudio) {
698
- t5 = () => {
476
+ t6 = () => {
699
477
  if (!isMobileStudio) return;
700
478
  previewStore.send({ type: "hideCanvas" });
701
479
  previewStore.send({ type: "closeAddBlockSheet" });
702
480
  };
703
- t6 = [isMobileStudio];
481
+ t7 = [isMobileStudio];
704
482
  $[8] = isMobileStudio;
705
- $[9] = t5;
706
- $[10] = t6;
483
+ $[9] = t6;
484
+ $[10] = t7;
707
485
  } else {
708
- t5 = $[9];
709
- t6 = $[10];
486
+ t6 = $[9];
487
+ t7 = $[10];
710
488
  }
711
- React.useEffect(t5, t6);
489
+ React.useEffect(t6, t7);
712
490
  useCanvasOnlyLocation(!!canvasOnly && isAuthenticated, isCanvasShown, isMobileStudio, pageLocation);
713
- let t7;
714
491
  let t8;
492
+ let t9;
715
493
  if ($[11] !== isAuthenticated || $[12] !== isCanvasShown || $[13] !== isMobileStudio) {
716
- t7 = () => {
494
+ t8 = () => {
717
495
  const actions = [
718
496
  {
719
497
  id: "hide-canvas",
@@ -726,7 +504,7 @@ const PreviewShell = (t0) => {
726
504
  ],
727
505
  groupLabel: "Website",
728
506
  checkIfAvailable: () => isAuthenticated && isCanvasShown,
729
- execute: _temp4,
507
+ execute: _temp3,
730
508
  shortcut: TOGGLE_CANVAS_SHORTCUT
731
509
  },
732
510
  {
@@ -739,7 +517,7 @@ const PreviewShell = (t0) => {
739
517
  ],
740
518
  groupLabel: "Website",
741
519
  checkIfAvailable: () => isAuthenticated && !isCanvasShown && !isMobileStudio,
742
- execute: _temp5,
520
+ execute: _temp4,
743
521
  shortcut: TOGGLE_CANVAS_SHORTCUT
744
522
  },
745
523
  {
@@ -747,9 +525,9 @@ const PreviewShell = (t0) => {
747
525
  label: "Clear selection",
748
526
  aliases: ["Deselect", "Unselect"],
749
527
  groupLabel: "Website",
750
- checkIfAvailable: _temp6,
751
- execute: _temp7,
752
- shortcut: { key: "Escape" }
528
+ checkIfAvailable: _temp5,
529
+ execute: _temp6,
530
+ shortcut: "Escape"
753
531
  }
754
532
  ];
755
533
  actionsStore.send({
@@ -759,11 +537,11 @@ const PreviewShell = (t0) => {
759
537
  return () => {
760
538
  actionsStore.send({
761
539
  type: "unregisterManyActions",
762
- ids: actions.map(_temp8)
540
+ ids: actions.map(_temp7)
763
541
  });
764
542
  };
765
543
  };
766
- t8 = [
544
+ t9 = [
767
545
  isCanvasShown,
768
546
  isAuthenticated,
769
547
  isMobileStudio
@@ -771,133 +549,173 @@ const PreviewShell = (t0) => {
771
549
  $[11] = isAuthenticated;
772
550
  $[12] = isCanvasShown;
773
551
  $[13] = isMobileStudio;
774
- $[14] = t7;
775
- $[15] = t8;
552
+ $[14] = t8;
553
+ $[15] = t9;
776
554
  } else {
777
- t7 = $[14];
778
- t8 = $[15];
555
+ t8 = $[14];
556
+ t9 = $[15];
779
557
  }
780
- React.useEffect(t7, t8);
558
+ React.useEffect(t8, t9);
781
559
  if (!isAuthenticated) {
782
- let t9;
560
+ let t10;
783
561
  if ($[16] !== children) {
784
- t9 = /* @__PURE__ */ jsx(Fragment, { children });
562
+ t10 = /* @__PURE__ */ jsx(Fragment, { children });
785
563
  $[16] = children;
786
- $[17] = t9;
787
- } else t9 = $[17];
788
- return t9;
564
+ $[17] = t10;
565
+ } else t10 = $[17];
566
+ return t10;
789
567
  }
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
568
+ const t10 = !isCanvasShown && "bg-black";
569
+ let t11;
570
+ if ($[18] !== t10) {
571
+ t11 = cn("bg-background relative flex h-full min-h-0 flex-1 flex-col overflow-hidden", t10);
572
+ $[18] = t10;
573
+ $[19] = t11;
574
+ } else t11 = $[19];
575
+ const t12 = pageLocation?.pathname;
576
+ const t13 = !canvasOnly;
577
+ const t14 = !!derivedLayout;
578
+ let t15;
579
+ if ($[20] !== t13 || $[21] !== t14) {
580
+ t15 = /* @__PURE__ */ jsx(CanvasSidebarSkeleton, {
581
+ page: t13,
582
+ layoutPage: t14
805
583
  });
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", {
817
- className: "flex min-h-0 flex-1 flex-row items-stretch",
818
- children: /* @__PURE__ */ jsx(PreviewPanel, {
819
- active: t15,
820
- isMobileExperience: isMobileStudio,
821
- page: t16,
822
- layoutId: t17,
823
- pageLocation,
824
- projectName: t18,
825
- children
826
- })
584
+ $[20] = t13;
585
+ $[21] = t14;
586
+ $[22] = t15;
587
+ } else t15 = $[22];
588
+ const t16 = !isCanvasEnabled;
589
+ const t17 = pageData?.page;
590
+ const t18 = derivedLayout?.layoutId;
591
+ const t19 = pageData?.projectName;
592
+ let t20;
593
+ if ($[23] !== children || $[24] !== isMobileStudio || $[25] !== pageLocation || $[26] !== t16 || $[27] !== t17 || $[28] !== t18 || $[29] !== t19) {
594
+ t20 = /* @__PURE__ */ jsx(PreviewPanel, {
595
+ active: t16,
596
+ isMobileExperience: isMobileStudio,
597
+ page: t17,
598
+ layoutId: t18,
599
+ pageLocation,
600
+ projectName: t19,
601
+ children
827
602
  });
828
603
  $[23] = children;
829
604
  $[24] = isMobileStudio;
830
605
  $[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, {
840
- enabled: isCanvasEnabled,
841
- pathname,
842
- pagePathname: t11,
843
- runtimeBasePath,
844
- placeholder: t14,
845
- children: t19
846
- });
847
- $[31] = isCanvasEnabled;
848
- $[32] = pathname;
849
- $[33] = runtimeBasePath;
850
- $[34] = t11;
851
- $[35] = t14;
852
- $[36] = t19;
853
- $[37] = t20;
854
- } else t20 = $[37];
606
+ $[26] = t16;
607
+ $[27] = t17;
608
+ $[28] = t18;
609
+ $[29] = t19;
610
+ $[30] = t20;
611
+ } else t20 = $[30];
855
612
  let t21;
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];
613
+ if ($[31] !== isCanvasEnabled || $[32] !== pageShown) {
614
+ t21 = !pageShown && !isCanvasEnabled && /* @__PURE__ */ jsx(PreviewPageLoading, {});
615
+ $[31] = isCanvasEnabled;
616
+ $[32] = pageShown;
617
+ $[33] = t21;
618
+ } else t21 = $[33];
862
619
  let t22;
863
- if ($[41] !== t10 || $[42] !== t20 || $[43] !== t21) {
620
+ if ($[34] !== t20 || $[35] !== t21) {
864
621
  t22 = /* @__PURE__ */ jsxs("div", {
865
- className: t10,
622
+ className: "relative flex min-h-0 flex-1 flex-row items-stretch",
866
623
  children: [t20, t21]
867
624
  });
868
- $[41] = t10;
869
- $[42] = t20;
870
- $[43] = t21;
871
- $[44] = t22;
872
- } else t22 = $[44];
625
+ $[34] = t20;
626
+ $[35] = t21;
627
+ $[36] = t22;
628
+ } else t22 = $[36];
873
629
  let t23;
874
- if ($[45] !== editingOwner || $[46] !== t22) {
875
- t23 = /* @__PURE__ */ jsx(PreviewEditingOwnerContext, {
876
- value: editingOwner,
630
+ if ($[37] !== isCanvasEnabled || $[38] !== pathname || $[39] !== runtimeBasePath || $[40] !== t12 || $[41] !== t15 || $[42] !== t22) {
631
+ t23 = /* @__PURE__ */ jsx(CanvasPreview, {
632
+ enabled: isCanvasEnabled,
633
+ pathname,
634
+ pagePathname: t12,
635
+ runtimeBasePath,
636
+ placeholder: t15,
877
637
  children: t22
878
638
  });
879
- $[45] = editingOwner;
880
- $[46] = t22;
881
- $[47] = t23;
882
- } else t23 = $[47];
639
+ $[37] = isCanvasEnabled;
640
+ $[38] = pathname;
641
+ $[39] = runtimeBasePath;
642
+ $[40] = t12;
643
+ $[41] = t15;
644
+ $[42] = t22;
645
+ $[43] = t23;
646
+ } else t23 = $[43];
883
647
  let t24;
884
- if ($[48] !== projectUuid) {
885
- t24 = /* @__PURE__ */ jsx(ContentCollectionItemSheet, { projectUuid });
886
- $[48] = projectUuid;
887
- $[49] = t24;
888
- } else t24 = $[49];
648
+ if ($[44] !== isCanvasEnabled || $[45] !== pageId) {
649
+ t24 = !isCanvasEnabled && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(CreatePageModal, {}), pageId != null && /* @__PURE__ */ jsx(AddBlockSheet, {})] });
650
+ $[44] = isCanvasEnabled;
651
+ $[45] = pageId;
652
+ $[46] = t24;
653
+ } else t24 = $[46];
889
654
  let t25;
890
- if ($[50] !== t23 || $[51] !== t24) {
891
- t25 = /* @__PURE__ */ jsxs(CollectionItemSheetProvider, {
892
- onRouteTargetClose: _temp9,
655
+ if ($[47] !== t11 || $[48] !== t23 || $[49] !== t24) {
656
+ t25 = /* @__PURE__ */ jsxs("div", {
657
+ className: t11,
893
658
  children: [t23, t24]
894
659
  });
895
- $[50] = t23;
896
- $[51] = t24;
660
+ $[47] = t11;
661
+ $[48] = t23;
662
+ $[49] = t24;
663
+ $[50] = t25;
664
+ } else t25 = $[50];
665
+ let t26;
666
+ if ($[51] !== editingOwner || $[52] !== t25) {
667
+ t26 = /* @__PURE__ */ jsx(PreviewEditingOwnerContext, {
668
+ value: editingOwner,
669
+ children: t25
670
+ });
671
+ $[51] = editingOwner;
897
672
  $[52] = t25;
898
- } else t25 = $[52];
899
- return t25;
673
+ $[53] = t26;
674
+ } else t26 = $[53];
675
+ let t27;
676
+ if ($[54] !== projectUuid) {
677
+ t27 = /* @__PURE__ */ jsx(ContentCollectionItemSheet, { projectUuid });
678
+ $[54] = projectUuid;
679
+ $[55] = t27;
680
+ } else t27 = $[55];
681
+ let t28;
682
+ if ($[56] !== t26 || $[57] !== t27) {
683
+ t28 = /* @__PURE__ */ jsxs(CollectionItemSheetProvider, {
684
+ onRouteTargetClose: _temp8,
685
+ children: [t26, t27]
686
+ });
687
+ $[56] = t26;
688
+ $[57] = t27;
689
+ $[58] = t28;
690
+ } else t28 = $[58];
691
+ const website = t28;
692
+ let t29;
693
+ if ($[59] !== runtimeBasePath || $[60] !== website) {
694
+ t29 = /* @__PURE__ */ jsx(RendererFramesProvider, {
695
+ runtimeBasePath,
696
+ children: website
697
+ });
698
+ $[59] = runtimeBasePath;
699
+ $[60] = website;
700
+ $[61] = t29;
701
+ } else t29 = $[61];
702
+ return t29;
900
703
  };
704
+ /**
705
+ * Covers the Preview until the renderer frame shows its page, as the studio does before the
706
+ * editor loads: the studio never shows a page of its own. A renderer of another SDK version
707
+ * says, in the frame, that the preview updates.
708
+ */
709
+ function PreviewPageLoading() {
710
+ const $ = c(1);
711
+ if (useRendererStatus(useRendererHost()) === "updating") return null;
712
+ let t0;
713
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
714
+ t0 = /* @__PURE__ */ jsx(CanvasLoadingScreen, { label: PAGE_LOADING_LABEL });
715
+ $[0] = t0;
716
+ } else t0 = $[0];
717
+ return t0;
718
+ }
901
719
  /** Zooms out to the whole Canvas, from anywhere in the site or the Studio. */
902
720
  function useShowCanvasAction() {
903
721
  const $ = c(6);
@@ -934,7 +752,7 @@ function useShowCanvasAction() {
934
752
  return () => {
935
753
  actionsStore.send({
936
754
  type: "unregisterManyActions",
937
- ids: actions.map(_temp10)
755
+ ids: actions.map(_temp9)
938
756
  });
939
757
  };
940
758
  };
@@ -956,7 +774,7 @@ function useShowCanvasAction() {
956
774
  }
957
775
  React.useEffect(t0, t1);
958
776
  }
959
- function _temp10(a) {
777
+ function _temp9(a) {
960
778
  return a.id;
961
779
  }
962
780
  function usePreviewPagesActions() {
@@ -976,8 +794,8 @@ function usePreviewPagesActions() {
976
794
  label: "Create page",
977
795
  aliases: ["New page", "Add page"],
978
796
  groupLabel: "Website",
979
- checkIfAvailable: _temp11,
980
- execute: _temp12
797
+ checkIfAvailable: _temp10,
798
+ execute: _temp11
981
799
  },
982
800
  {
983
801
  id: "edit-current-page",
@@ -1008,7 +826,7 @@ function usePreviewPagesActions() {
1008
826
  groupLabel: "Website",
1009
827
  checkIfAvailable: () => pages.length > 0,
1010
828
  hasChildren: true,
1011
- execute: _temp13
829
+ execute: _temp12
1012
830
  },
1013
831
  ...pages.map((page) => ({
1014
832
  id: `go-to-page-${page.key}`,
@@ -1016,7 +834,7 @@ function usePreviewPagesActions() {
1016
834
  label: `Go to "${page.title}"`,
1017
835
  aliases: [page.fullPath],
1018
836
  groupLabel: "Website",
1019
- checkIfAvailable: _temp14,
837
+ checkIfAvailable: _temp13,
1020
838
  execute: () => navigate({ to: localized(page.fullPath) })
1021
839
  }))
1022
840
  ];
@@ -1027,7 +845,7 @@ function usePreviewPagesActions() {
1027
845
  return () => {
1028
846
  actionsStore.send({
1029
847
  type: "unregisterManyActions",
1030
- ids: actions.map(_temp15)
848
+ ids: actions.map(_temp14)
1031
849
  });
1032
850
  };
1033
851
  };
@@ -1049,38 +867,35 @@ function usePreviewPagesActions() {
1049
867
  }
1050
868
  React.useEffect(t0, t1);
1051
869
  }
1052
- function _temp15(a) {
870
+ function _temp14(a) {
1053
871
  return a.id;
1054
872
  }
1055
- function _temp14() {
873
+ function _temp13() {
1056
874
  return true;
1057
875
  }
1058
- function _temp13() {}
1059
- function _temp12() {
876
+ function _temp12() {}
877
+ function _temp11() {
1060
878
  return previewStore.send({ type: "openCreatePageModal" });
1061
879
  }
1062
- function _temp11() {
880
+ function _temp10() {
1063
881
  return true;
1064
882
  }
1065
- function _temp2(b) {
1066
- return b.slot === "before";
1067
- }
1068
- function _temp4() {
883
+ function _temp3() {
1069
884
  return previewStore.send({ type: "hideCanvas" });
1070
885
  }
1071
- function _temp5() {
886
+ function _temp4() {
1072
887
  return previewStore.send({ type: "showCanvas" });
1073
888
  }
1074
- function _temp6() {
889
+ function _temp5() {
1075
890
  return true;
1076
891
  }
1077
- function _temp7() {
892
+ function _temp6() {
1078
893
  return previewStore.send({ type: "clearSelection" });
1079
894
  }
1080
- function _temp8(a) {
895
+ function _temp7(a) {
1081
896
  return a.id;
1082
897
  }
1083
- function _temp9() {}
898
+ function _temp8() {}
1084
899
 
1085
900
  //#endregion
1086
- export { CamoxPreview, PageContent, PreviewShell, usePreviewPagesActions, usePreviewedPage, useShowCanvasAction };
901
+ export { CamoxPreview, PreviewShell, usePreviewPagesActions, usePreviewedPage, useShowCanvasAction };