camox 0.43.0 → 0.45.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 (412) hide show
  1. package/bin/camox.mjs +9 -1
  2. package/dist/components/AuthGate.js +0 -6
  3. package/dist/components/DeviceSelector.js +96 -0
  4. package/dist/components/PlatformLabel.js +20 -24
  5. package/dist/core/components/lexical/HighlightNode.js +1 -1
  6. package/dist/core/components/lexical/InlineContentEditable.js +15 -19
  7. package/dist/core/components/lexical/InlineLexicalEditor.js +54 -74
  8. package/dist/core/components/lexical/InlineStylesPlugin.js +57 -41
  9. package/dist/core/components/lexical/MaxLengthPlugin.js +59 -0
  10. package/dist/core/components/lexical/SelectionBroadcaster.js +55 -56
  11. package/dist/core/components/lexical/SidebarLexicalEditor.js +327 -234
  12. package/dist/core/components/lexical/SummaryToggleGuard.js +42 -0
  13. package/dist/core/components/lexical/TextLinkPopover.js +169 -180
  14. package/dist/core/createApp.d.ts +254 -299
  15. package/dist/core/createApp.js +123 -29
  16. package/dist/core/createBlock.d.ts +5 -5
  17. package/dist/core/createBlock.js +399 -152
  18. package/dist/core/createCollection.d.ts +55 -0
  19. package/dist/core/createCollection.js +93 -0
  20. package/dist/core/createLayout.d.ts +197 -61
  21. package/dist/core/createLayout.js +114 -56
  22. package/dist/core/defineDocument.d.ts +3 -5
  23. package/dist/core/derivedRoutes.js +49 -1
  24. package/dist/core/dom.d.ts +13 -4
  25. package/dist/core/dom.js +44 -1
  26. package/dist/core/editing/BlockEditingRuntime.d.ts +16 -0
  27. package/dist/core/editing/BlockEditingRuntime.js +6 -15
  28. package/dist/core/editing/CompleteBlockEditingRuntime.js +28 -23
  29. package/dist/core/editing/createEditableBlock.d.ts +820 -565
  30. package/dist/core/editing/createEditableBlock.js +2153 -971
  31. package/dist/core/editing/referenceWrites.js +51 -0
  32. package/dist/core/editing/useLatestRecord.js +90 -0
  33. package/dist/core/hooks/useArtifactHost.js +139 -0
  34. package/dist/core/hooks/useFieldSelection.js +43 -18
  35. package/dist/core/hooks/useIsEditable.js +12 -10
  36. package/dist/core/hooks/useOverlayMessage.js +15 -19
  37. package/dist/core/lib/artifact.d.ts +21 -0
  38. package/dist/core/lib/artifact.js +154 -0
  39. package/dist/core/lib/artifactColors.js +123 -0
  40. package/dist/core/lib/artifactData.d.ts +1 -0
  41. package/dist/core/lib/artifactData.js +131 -0
  42. package/dist/core/lib/artifactHost.js +205 -0
  43. package/dist/core/lib/artifactRuntime.js +36 -0
  44. package/dist/core/lib/artifactTheme.js +57 -0
  45. package/dist/core/lib/contentType.d.ts +304 -103
  46. package/dist/core/lib/contentType.js +207 -168
  47. package/dist/core/lib/fieldTypes.js +4 -0
  48. package/dist/core/lib/iconTypes.d.ts +13 -0
  49. package/dist/core/lib/icons.d.ts +6 -0
  50. package/dist/core/lib/icons.js +126 -0
  51. package/dist/core/lib/imagePlaceholder.js +177 -0
  52. package/dist/core/lib/imageTransform.js +1 -1
  53. package/dist/core/lib/lexicalReact.d.ts +3 -1
  54. package/dist/core/lib/lexicalState.js +7 -7
  55. package/dist/core/lib/modifierFormats.js +1 -1
  56. package/dist/core/lib/previewPaused.js +9 -0
  57. package/dist/core/lib/recordScope.js +316 -0
  58. package/dist/core/lib/reference.d.ts +81 -0
  59. package/dist/core/lib/reference.js +29 -0
  60. package/dist/core/lib/textLinks.js +7 -5
  61. package/dist/core/lib/textStyles.d.ts +6 -8
  62. package/dist/core/lib/textStyles.js +5 -5
  63. package/dist/core/notFound.d.ts +7 -0
  64. package/dist/core/notFound.js +11 -0
  65. package/dist/core/pageDestinations.js +6 -3
  66. package/dist/core/recordItem.js +34 -0
  67. package/dist/core/requestContext.d.ts +26 -0
  68. package/dist/core/requestContext.js +20 -0
  69. package/dist/features/canvas/CamoxCanvas.js +1734 -0
  70. package/dist/features/canvas/CanvasBlockFrame.js +353 -0
  71. package/dist/features/canvas/CanvasBlockHeader.js +55 -0
  72. package/dist/features/canvas/CanvasLoadingScreen.js +35 -0
  73. package/dist/features/canvas/CanvasOverlays.js +254 -0
  74. package/dist/features/canvas/CanvasPageEdge.js +87 -0
  75. package/dist/features/canvas/CanvasPageFrame.js +335 -0
  76. package/dist/features/canvas/CanvasPageHeader.js +125 -0
  77. package/dist/features/canvas/CanvasPreviewPageSlot.js +103 -0
  78. package/dist/features/canvas/CanvasShelfMarker.js +255 -0
  79. package/dist/features/canvas/DerivedPagePathInput.js +238 -0
  80. package/dist/features/canvas/canvasCamera.js +229 -0
  81. package/dist/features/canvas/canvasFlight.js +104 -0
  82. package/dist/features/canvas/canvasFrameCapture.js +364 -0
  83. package/dist/features/canvas/canvasFrameDocument.js +317 -0
  84. package/dist/features/canvas/canvasFrameMode.js +53 -0
  85. package/dist/features/canvas/canvasInsertionSeams.js +44 -0
  86. package/dist/features/canvas/canvasItems.js +120 -0
  87. package/dist/features/canvas/canvasOverlayGeometry.js +240 -0
  88. package/dist/features/canvas/canvasPages.js +79 -0
  89. package/dist/features/canvas/canvasScreenSpace.js +26 -0
  90. package/dist/features/canvas/canvasSelection.js +18 -0
  91. package/dist/features/canvas/canvasStore.js +149 -0
  92. package/dist/features/canvas/canvasThumbnails.js +304 -0
  93. package/dist/features/canvas/canvasZoom.js +10 -0
  94. package/dist/features/canvas/sidebar/CanvasInspector.js +202 -0
  95. package/dist/features/canvas/sidebar/CanvasNavigator.js +226 -0
  96. package/dist/features/canvas/sidebar/CanvasSidebar.js +60 -0
  97. package/dist/features/canvas/sidebar/CanvasSidebarFrame.js +48 -0
  98. package/dist/features/canvas/sidebar/CanvasSidebarSkeleton.js +39 -0
  99. package/dist/features/canvas/sidebar/CatalogBlockInspector.js +189 -0
  100. package/dist/features/canvas/sidebar/CuratedPageInspector.js +69 -0
  101. package/dist/features/canvas/sidebar/DerivedPageInspector.js +37 -0
  102. package/dist/features/canvas/sidebar/LayoutPageBlocks.js +78 -0
  103. package/dist/features/canvas/sidebar/LayoutPageOverview.js +71 -0
  104. package/dist/features/canvas/sidebar/PageInspector.js +157 -0
  105. package/dist/features/canvas/sidebar/PageInspectorSkeleton.js +90 -0
  106. package/dist/features/canvas/sidebar/PageOverview.js +27 -0
  107. package/dist/features/canvas/sidebar/SingletonPageInspector.js +31 -0
  108. package/dist/features/canvas/useCanvasCamera.js +803 -0
  109. package/dist/features/canvas/useCanvasFrame.js +149 -0
  110. package/dist/features/canvas/useCanvasFrameInput.js +97 -0
  111. package/dist/features/canvas/useCanvasNearness.js +57 -0
  112. package/dist/features/canvas/useDiscoveredPreviewPaths.js +62 -0
  113. package/dist/features/content/CamoxContent.d.ts +2 -5
  114. package/dist/features/content/CamoxContent.js +174 -271
  115. package/dist/features/content/CollectionItemSheetContext.js +106 -0
  116. package/dist/features/content/ContentAssets.js +315 -0
  117. package/dist/features/content/ContentCollection.js +663 -0
  118. package/dist/features/content/collection-form.js +58 -0
  119. package/dist/features/content/components/AssetCard.js +101 -69
  120. package/dist/features/content/components/AssetCardSkeleton.js +4 -8
  121. package/dist/features/content/components/ContentSidebar.js +129 -18
  122. package/dist/features/content/components/ContentSidebarGroup.js +37 -0
  123. package/dist/features/content/components/DeleteCollectionItemButton.js +202 -0
  124. package/dist/features/content/components/MissingFromLocale.js +282 -0
  125. package/dist/features/content/components/UploadDropZone.js +27 -31
  126. package/dist/features/content/components/UploadProgressDrawer.js +90 -98
  127. package/dist/features/navigation/navigation.d.ts +66 -20
  128. package/dist/features/navigation/navigation.js +257 -90
  129. package/dist/features/og/defaultFonts.js +8 -8
  130. package/dist/features/og/geist-variable-ttf-base64.js +1 -1
  131. package/dist/features/og/imageResponse.d.ts +8 -0
  132. package/dist/features/og/imageResponse.js +26 -0
  133. package/dist/features/page/CuratedPageContent.js +167 -0
  134. package/dist/features/page/DerivedPageContent.js +26 -30
  135. package/dist/features/page/SharedLayoutContent.js +25 -27
  136. package/dist/features/preview/CamoxPreview.d.ts +23 -61
  137. package/dist/features/preview/CamoxPreview.js +811 -507
  138. package/dist/features/preview/EditablePageContent.js +1 -1
  139. package/dist/features/preview/EditablePageExperience.js +16 -22
  140. package/dist/features/preview/components/AddBlockDialog.js +270 -0
  141. package/dist/features/preview/components/AssetFieldEditor.js +173 -154
  142. package/dist/features/preview/components/AssetLightbox.js +194 -136
  143. package/dist/features/preview/components/AssetPickerModal.js +153 -170
  144. package/dist/features/preview/components/BlockActionsPopover.js +150 -149
  145. package/dist/features/preview/components/BlockErrorBoundary.js +8 -12
  146. package/dist/features/preview/components/BlockThumbnail.js +176 -100
  147. package/dist/features/preview/components/CanvasPreview.js +243 -0
  148. package/dist/features/preview/components/CreatePageModal.js +128 -137
  149. package/dist/features/preview/components/DebouncedFieldEditor.js +29 -33
  150. package/dist/features/preview/components/DerivedLayoutDialog.js +46 -29
  151. package/dist/features/preview/components/DrillRow.js +150 -0
  152. package/dist/features/preview/components/FieldOverlayStyles.js +33 -10
  153. package/dist/features/preview/components/FieldToolbar.js +166 -116
  154. package/dist/features/preview/components/Frame.js +108 -20
  155. package/dist/features/preview/components/IconFieldEditor.js +227 -0
  156. package/dist/features/preview/components/ItemFieldsEditor.js +238 -205
  157. package/dist/features/preview/components/LinkFieldEditor.js +135 -139
  158. package/dist/features/preview/components/Metadata.js +22 -30
  159. package/dist/features/preview/components/MobilePreviewDrawer.js +89 -108
  160. package/dist/features/preview/components/MultipleAssetFieldEditor.js +334 -246
  161. package/dist/features/preview/components/OverlayTracker.js +10 -42
  162. package/dist/features/preview/components/Overlays.js +81 -69
  163. package/dist/features/preview/components/PageInfo.js +1748 -0
  164. package/dist/features/preview/components/PageInfoSkeleton.js +51 -0
  165. package/dist/features/preview/components/PageLocationFieldset.js +112 -116
  166. package/dist/features/preview/components/PageNavigatorHeader.js +24 -0
  167. package/dist/features/preview/components/PageNicknameField.js +22 -26
  168. package/dist/features/preview/components/PagePicker.js +145 -147
  169. package/dist/features/preview/components/PageTree.js +525 -532
  170. package/dist/features/preview/components/PreviewActivation.js +28 -32
  171. package/dist/features/preview/components/PreviewPanel.js +620 -319
  172. package/dist/features/preview/components/PreviewToolbar.js +111 -340
  173. package/dist/features/preview/components/RecordCard.js +80 -0
  174. package/dist/features/preview/components/RecordCombobox.js +178 -0
  175. package/dist/features/preview/components/ReferenceFieldEditor.js +149 -0
  176. package/dist/features/preview/components/ReferenceListFieldEditor.js +432 -0
  177. package/dist/features/preview/components/RemovedBlockPlaceholder.js +95 -0
  178. package/dist/features/preview/components/RepeatableItemsList.js +125 -138
  179. package/dist/features/preview/components/SelectionEditor.js +993 -0
  180. package/dist/features/preview/components/ShikiMarkdown.js +14 -18
  181. package/dist/features/preview/components/SidebarSection.js +52 -64
  182. package/dist/features/preview/components/StudioEditingFallback.js +56 -0
  183. package/dist/features/preview/components/UnlinkAssetButton.js +104 -107
  184. package/dist/features/preview/components/blockGridNavigation.js +15 -0
  185. package/dist/features/preview/components/contentFieldSchema.js +8 -0
  186. package/dist/features/preview/components/useFieldWriter.js +200 -0
  187. package/dist/features/preview/components/useRecordView.js +383 -0
  188. package/dist/features/preview/components/useRepeatableItemActions.js +35 -37
  189. package/dist/features/preview/components/useUpdateBlockPosition.js +37 -37
  190. package/dist/features/preview/editingFrame.js +197 -0
  191. package/dist/features/preview/overlayHighlights.js +27 -0
  192. package/dist/features/preview/overlayMessages.js +72 -1
  193. package/dist/features/preview/pageRecord.js +189 -0
  194. package/dist/features/preview/previewConstants.js +6 -2
  195. package/dist/features/preview/previewPageFrame.js +95 -0
  196. package/dist/features/preview/previewPreparation.js +7 -0
  197. package/dist/features/preview/previewSelection.js +33 -59
  198. package/dist/features/preview/previewStore.js +225 -123
  199. package/dist/features/preview/referencePickerFocus.js +29 -0
  200. package/dist/features/preview/repeatableItemTargets.js +56 -0
  201. package/dist/features/preview/selectionReveal.js +21 -0
  202. package/dist/features/preview/usePreviewViewportActions.js +114 -0
  203. package/dist/features/preview/viewportContinuity.js +109 -0
  204. package/dist/features/provider/AuthenticatedCamoxProvider.js +69 -44
  205. package/dist/features/provider/CamoxProvider.d.ts +3 -6
  206. package/dist/features/provider/CamoxProvider.js +38 -50
  207. package/dist/features/provider/CoreCamoxProvider.js +71 -23
  208. package/dist/features/provider/LocalhostPreviewProvider.js +73 -73
  209. package/dist/features/provider/PreviewSignInPage.js +54 -0
  210. package/dist/features/provider/components/CamoxAppContext.js +11 -11
  211. package/dist/features/provider/components/CommandPalette.js +87 -143
  212. package/dist/features/provider/useAdminShortcuts.js +7 -11
  213. package/dist/features/routes/pageRuntime.d.ts +44 -4
  214. package/dist/features/routes/pageRuntime.js +244 -137
  215. package/dist/features/runtime/RuntimeChrome.js +117 -115
  216. package/dist/features/runtime/alternates.js +64 -0
  217. package/dist/features/runtime/analytics.d.ts +7 -0
  218. package/dist/features/runtime/analytics.js +66 -0
  219. package/dist/features/runtime/artifactSources.js +87 -0
  220. package/dist/features/runtime/editingFallback.js +20 -0
  221. package/dist/features/runtime/linkPrefetch.js +97 -0
  222. package/dist/features/runtime/livePages.js +62 -0
  223. package/dist/features/runtime/llmsTxt.js +40 -0
  224. package/dist/features/runtime/loopbackFetch.js +18 -0
  225. package/dist/features/runtime/navigationAccessibility.js +51 -0
  226. package/dist/features/runtime/navigationTarget.js +23 -2
  227. package/dist/features/runtime/pageApp.js +216 -141
  228. package/dist/features/runtime/pageBlockTypes.js +20 -0
  229. package/dist/features/runtime/pageClient.d.ts +2 -4
  230. package/dist/features/runtime/pageClient.js +18 -3
  231. package/dist/features/runtime/pageNavigation.js +254 -32
  232. package/dist/features/runtime/pageServer.d.ts +2 -4
  233. package/dist/features/runtime/pageServer.js +8 -1
  234. package/dist/features/runtime/pageViewport.js +7 -0
  235. package/dist/features/runtime/runtime.d.ts +60 -23
  236. package/dist/features/runtime/runtime.js +779 -166
  237. package/dist/features/runtime/runtimeChromeLoader.js +58 -0
  238. package/dist/features/runtime/runtimeRoutes.d.ts +19 -0
  239. package/dist/features/runtime/runtimeRoutes.js +25 -0
  240. package/dist/features/runtime/scrollRestoration.js +133 -0
  241. package/dist/features/runtime/studioApp.d.ts +4 -3
  242. package/dist/features/runtime/studioApp.js +5 -9
  243. package/dist/features/runtime/studioClient.d.ts +2 -4
  244. package/dist/features/runtime/studioClient.js +12 -3
  245. package/dist/features/runtime/studioServer.d.ts +2 -4
  246. package/dist/features/runtime/studioServer.js +6 -1
  247. package/dist/features/runtime/worker.d.ts +6 -0
  248. package/dist/features/runtime/worker.js +23 -0
  249. package/dist/features/runtime/workerRequest.js +44 -0
  250. package/dist/features/studio/CamoxStudio.d.ts +2 -6
  251. package/dist/features/studio/CamoxStudio.js +34 -49
  252. package/dist/features/studio/FollowAgentProvider.js +338 -0
  253. package/dist/features/studio/components/ChatSidebar.js +356 -0
  254. package/dist/features/studio/components/DraftsControl.js +676 -0
  255. package/dist/features/studio/components/FaviconDialog.js +318 -0
  256. package/dist/features/studio/components/LocalePicker.js +785 -0
  257. package/dist/features/studio/components/Navbar.js +123 -103
  258. package/dist/features/studio/components/ProjectMenu.js +239 -260
  259. package/dist/features/studio/components/RenameDraftDialog.js +206 -0
  260. package/dist/features/studio/components/ReviewDraftSheet.js +1472 -0
  261. package/dist/features/studio/components/ThreadComposer.js +157 -0
  262. package/dist/features/studio/components/ThreadMarkdown.js +113 -0
  263. package/dist/features/studio/components/ThreadMessages.js +270 -0
  264. package/dist/features/studio/components/UserButton.js +34 -23
  265. package/dist/features/studio/draftLabel.js +33 -0
  266. package/dist/features/studio/draftNotice.js +13 -0
  267. package/dist/features/studio/followAgent.js +250 -0
  268. package/dist/features/studio/followAgentContext.js +7 -0
  269. package/dist/features/studio/localeOptions.js +118 -0
  270. package/dist/features/studio/localeSwitch.js +19 -0
  271. package/dist/features/studio/routes.js +48 -1
  272. package/dist/features/studio/studioStore.js +64 -1
  273. package/dist/features/studio/useTheme.js +24 -27
  274. package/dist/features/vite/artifactRuntimeMinification.js +36 -0
  275. package/dist/features/vite/auth.js +1 -50
  276. package/dist/features/vite/blockBoilerplate.js +6 -5
  277. package/dist/features/vite/blockChunks.js +31 -0
  278. package/dist/features/vite/bundlerLogs.js +17 -0
  279. package/dist/features/vite/definitionsSync.js +158 -226
  280. package/dist/features/vite/devAuthentication.js +4 -16
  281. package/dist/features/vite/devSignIn.js +87 -0
  282. package/dist/features/vite/iconGeneration.js +16 -0
  283. package/dist/features/vite/layoutGeneration.js +11 -1
  284. package/dist/features/vite/publishSeededContent.js +30 -0
  285. package/dist/features/vite/routeGeneration.js +6 -7
  286. package/dist/features/vite/runtimeDev.js +80 -99
  287. package/dist/features/vite/vite.d.ts +53 -31
  288. package/dist/features/vite/vite.js +230 -116
  289. package/dist/features/vite/workerBuild.js +39 -0
  290. package/dist/hooks/use-debounced-field.js +116 -47
  291. package/dist/hooks/use-file-upload.js +114 -67
  292. package/dist/hooks/use-marquee-selection.js +32 -36
  293. package/dist/hooks/use-page-destinations.js +69 -37
  294. package/dist/lib/api-client-server.d.ts +5 -0
  295. package/dist/lib/api-client-server.js +10 -4
  296. package/dist/lib/api-client.d.ts +6 -0
  297. package/dist/lib/api-client.js +51 -16
  298. package/dist/lib/api-socket.js +17 -0
  299. package/dist/lib/auth-page-styles.js +39 -0
  300. package/dist/lib/auth.js +139 -60
  301. package/dist/lib/collection-cache.js +23 -0
  302. package/dist/lib/draft-scope.d.ts +4 -0
  303. package/dist/lib/draft-scope.js +222 -0
  304. package/dist/lib/html.js +12 -0
  305. package/dist/lib/link-pages.js +154 -0
  306. package/dist/lib/locale-path.d.ts +22 -0
  307. package/dist/lib/locale-path.js +57 -0
  308. package/dist/lib/normalized-data.js +252 -152
  309. package/dist/lib/preview-handoff.js +13 -0
  310. package/dist/lib/queries.d.ts +11 -0
  311. package/dist/lib/queries.js +71 -131
  312. package/dist/lib/studio-reads.d.ts +14 -0
  313. package/dist/lib/studio-reads.js +574 -0
  314. package/dist/lib/use-project-room.js +50 -47
  315. package/dist/lib/use-thread.js +310 -0
  316. package/dist/lib/utils.js +25 -29
  317. package/dist/lib/view-locale-context.js +22 -0
  318. package/dist/lib/view-locale.js +46 -0
  319. package/dist/package.js +5 -0
  320. package/dist/studio-overlays.css +41 -147
  321. package/dist/studio.css +2 -2
  322. package/package.json +70 -72
  323. package/skills/camox/SKILL.md +16 -5
  324. package/skills/camox/references/artifacts.md +179 -0
  325. package/skills/camox/references/block-definitions.md +98 -55
  326. package/skills/camox/references/cli-common.md +18 -6
  327. package/skills/camox/references/cli-content.md +92 -58
  328. package/skills/camox/references/cli-publishing.md +26 -0
  329. package/skills/camox/references/dom-integrations.md +27 -0
  330. package/skills/camox/references/field-styling.md +7 -7
  331. package/skills/camox/references/layout-definitions.md +16 -14
  332. package/skills/camox/references/localization.md +56 -0
  333. package/skills/camox/references/routed-layouts.md +133 -15
  334. package/skills/camox-expand/SKILL.md +69 -0
  335. package/skills/camox-expand/references/jobs.md +39 -0
  336. package/skills/camoxify/SKILL.md +38 -2
  337. package/dist/core/components/AddBlockControlBar.js +0 -78
  338. package/dist/core/hooks/useRequireDraftSource.js +0 -23
  339. package/dist/features/metadata/sitemap.d.ts +0 -8
  340. package/dist/features/metadata/sitemap.js +0 -17
  341. package/dist/features/og/imageResponse.node.d.ts +0 -12
  342. package/dist/features/og/imageResponse.node.js +0 -49
  343. package/dist/features/og/imageResponse.workerd.d.ts +0 -12
  344. package/dist/features/og/imageResponse.workerd.js +0 -40
  345. package/dist/features/page/PublishedPageContent.js +0 -205
  346. package/dist/features/page/PublishedPageExperience.js +0 -23
  347. package/dist/features/preview/DerivedPreview.js +0 -134
  348. package/dist/features/preview/commentsEnabled.js +0 -8
  349. package/dist/features/preview/components/AddBlockSidebar.js +0 -381
  350. package/dist/features/preview/components/AttachedComments.js +0 -194
  351. package/dist/features/preview/components/CommentHeader.js +0 -122
  352. package/dist/features/preview/components/CommentSidebar.js +0 -29
  353. package/dist/features/preview/components/CommentTargetQuote.js +0 -166
  354. package/dist/features/preview/components/DerivedLayoutSidebar.d.ts +0 -5
  355. package/dist/features/preview/components/DerivedLayoutSidebar.js +0 -179
  356. package/dist/features/preview/components/DerivedPageInfoSidebar.js +0 -69
  357. package/dist/features/preview/components/LeftSidebar.js +0 -68
  358. package/dist/features/preview/components/PageEditorSidebar.js +0 -563
  359. package/dist/features/preview/components/PageInfoSidebar.js +0 -1551
  360. package/dist/features/preview/components/PageNavigatorSidebar.js +0 -78
  361. package/dist/features/preview/components/PageStatusBadge.js +0 -97
  362. package/dist/features/preview/components/PeekedBlock.js +0 -217
  363. package/dist/features/preview/components/PreviewComments.js +0 -56
  364. package/dist/features/preview/components/PreviewToolbarSpacer.js +0 -43
  365. package/dist/features/preview/components/PublicationRow.js +0 -422
  366. package/dist/features/preview/components/PublishDialog.js +0 -194
  367. package/dist/features/preview/components/RightSidebar.js +0 -59
  368. package/dist/features/preview/previewCommentsStore.js +0 -115
  369. package/dist/features/preview/publication.js +0 -81
  370. package/dist/features/runtime/SharedChromeContext.js +0 -7
  371. package/dist/features/studio/components/EnvironmentMenu.js +0 -413
  372. package/dist/features/vite/appGeneration.js +0 -89
  373. package/dist/lib/view-queries.js +0 -28
  374. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/Matches.d.ts +0 -114
  375. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/RouterProvider.d.ts +0 -25
  376. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/config.d.ts +0 -1
  377. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/defer.d.ts +0 -1
  378. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/fileRoute.d.ts +0 -20
  379. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/global.d.ts +0 -8
  380. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/hash-scroll.d.ts +0 -1
  381. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/index.d.ts +0 -18
  382. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/link.d.ts +0 -161
  383. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/load-matches.d.ts +0 -6
  384. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/location.d.ts +0 -54
  385. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/lru-cache.d.ts +0 -8
  386. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/manifest.d.ts +0 -32
  387. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/new-process-route-tree.d.ts +0 -115
  388. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/not-found.d.ts +0 -1
  389. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/redirect.d.ts +0 -49
  390. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/rewrite.d.ts +0 -1
  391. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/root.d.ts +0 -6
  392. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/route.d.ts +0 -343
  393. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/routeInfo.d.ts +0 -48
  394. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/router.d.ts +0 -695
  395. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/scroll-restoration.d.ts +0 -1
  396. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/searchMiddleware.d.ts +0 -1
  397. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/searchParams.d.ts +0 -5
  398. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/ssr/serializer/RawStream.d.ts +0 -38
  399. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/ssr/serializer/seroval-plugins.d.ts +0 -1
  400. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/ssr/serializer/transformer.d.ts +0 -65
  401. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/stores.d.ts +0 -69
  402. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/structuralSharing.d.ts +0 -1
  403. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/typePrimitives.d.ts +0 -1
  404. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useLoaderData.d.ts +0 -1
  405. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useLoaderDeps.d.ts +0 -1
  406. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useNavigate.d.ts +0 -10
  407. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useParams.d.ts +0 -1
  408. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useRouteContext.d.ts +0 -1
  409. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useSearch.d.ts +0 -1
  410. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/utils.d.ts +0 -28
  411. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/validators.d.ts +0 -49
  412. package/skills/camox/references/cli-environments.md +0 -37
@@ -1,29 +1,38 @@
1
- import { useLocation, useNavigate } from "../navigation/navigation.js";
2
1
  import { actionsStore } from "../provider/actionsStore.js";
3
- import { useIsAuthenticated, useProjectSlug } from "../../lib/auth.js";
4
- import { getApiClient } from "../../lib/api-client.js";
5
- import { NormalizedDataProvider, seedBlockCaches, usePageBlocks } from "../../lib/normalized-data.js";
6
- import { BlockErrorBoundary } from "./components/BlockErrorBoundary.js";
2
+ import { useIsAuthenticated, useProjectUuid } from "../../lib/auth.js";
3
+ import { parseLocalePath } from "../../lib/locale-path.js";
4
+ import { useCurrentDraftId, withoutDraft } from "../../lib/draft-scope.js";
5
+ import { useViewLocale } from "../../lib/view-locale-context.js";
6
+ import { useLocation, useNavigate } from "../navigation/navigation.js";
7
7
  import { useCamoxApp } from "../provider/components/CamoxAppContext.js";
8
- import { blockQueries } from "../../lib/queries.js";
9
- import { usePageDestinations } from "../../hooks/use-page-destinations.js";
8
+ import { NormalizedDataProvider, usePageBlocks } from "../../lib/normalized-data.js";
9
+ import { reads, useRead, useStudioCache } from "../../lib/studio-reads.js";
10
+ import { BlockErrorBoundary } from "./components/BlockErrorBoundary.js";
11
+ import { CollectionItemSheetProvider } from "../content/CollectionItemSheetContext.js";
10
12
  import { cn } from "../../lib/utils.js";
11
- import { SharedChromeContext } from "../runtime/SharedChromeContext.js";
12
- import { previewStore, selectIsEditMode, selectPreviewSource } from "./previewStore.js";
13
- import { Navbar } from "../studio/components/Navbar.js";
13
+ import { ContentCollectionItemSheet } from "../content/ContentCollection.js";
14
+ import { usePageDestinations } from "../../hooks/use-page-destinations.js";
15
+ import { useLocalePath, useLocalizedPath } from "../../lib/view-locale.js";
16
+ import { canvasStore } from "../canvas/canvasStore.js";
17
+ import { SHOW_WHOLE_CANVAS_SHORTCUT, TOGGLE_CANVAS_SHORTCUT } from "./previewConstants.js";
18
+ import { CanvasSidebarSkeleton } from "../canvas/sidebar/CanvasSidebarSkeleton.js";
19
+ import { DerivedPageContent } from "../page/DerivedPageContent.js";
20
+ import { STUDIO_CANVAS_PATH } from "../studio/routes.js";
21
+ import { studioStore } from "../studio/studioStore.js";
22
+ import { previewStore, selectIsCanvasShown } from "./previewStore.js";
23
+ import { AddBlockDialog } from "./components/AddBlockDialog.js";
24
+ import { CanvasPreview, prefetchCanvas } from "./components/CanvasPreview.js";
14
25
  import { CreatePageModal } from "./components/CreatePageModal.js";
15
- import { EDIT_MODE_SHORTCUT } from "./previewConstants.js";
16
- import { LeftSidebar } from "./components/LeftSidebar.js";
17
- import { PeekedBlock } from "./components/PeekedBlock.js";
26
+ import { PreviewEditingOwnerContext } from "./previewSelection.js";
27
+ import { PageRecordContext, getPageRecord, useDerivedPageResult, useFollowPageRecord } from "./pageRecord.js";
18
28
  import { PreviewPanel } from "./components/PreviewPanel.js";
19
- import { PreviewToolbarSpacer } from "./components/PreviewToolbarSpacer.js";
20
- import { RightSidebar } from "./components/RightSidebar.js";
29
+ import { RemovedBlockPlaceholder } from "./components/RemovedBlockPlaceholder.js";
30
+ import { usePreviewViewportActions } from "./usePreviewViewportActions.js";
21
31
  import { c } from "react/compiler-runtime";
22
- import { useQueryClient, useSuspenseQuery } from "@tanstack/react-query";
23
32
  import * as React from "react";
24
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
25
33
  import { useSelector } from "@xstate/store-react";
26
- import { queryKeys } from "@camox/api-contract/query-keys";
34
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
35
+ import { useQueryClient } from "@tanstack/react-query";
27
36
 
28
37
  //#region src/features/preview/CamoxPreview.tsx
29
38
  const MOBILE_STUDIO_QUERY = "(max-width: 767px)";
@@ -36,402 +45,679 @@ function getMobileStudioSnapshot() {
36
45
  return window.matchMedia(MOBILE_STUDIO_QUERY).matches;
37
46
  }
38
47
  function useIsMobileStudio() {
39
- const $ = c(1);
40
- if ($[0] !== "2d1a4df08feec350ec60cc84fec5c50c421655f0e335816baf3bbe36ccd11082") {
41
- for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
42
- $[0] = "2d1a4df08feec350ec60cc84fec5c50c421655f0e335816baf3bbe36ccd11082";
43
- }
44
48
  return React.useSyncExternalStore(subscribeToMobileStudio, getMobileStudioSnapshot, _temp);
45
49
  }
46
- /**
47
- * Fetches the current page being previewed, with live updates for authenticated users.
48
- *
49
- * Data for the current route is guaranteed in queryClient cache from the loader's
50
- * ensureQueryData. Live updates are gated by useProjectRoom only running in
51
- * AuthenticatedCamoxProvider — unauthenticated users get SSR data that never refetches.
52
- */
53
- /**
54
- * Lightweight queryFn for client-side refetches — only fetches structural data.
55
- * Used after initial SSR load when block caches are already populated.
56
- *
57
- * Source is threaded from the studio's source select (previewStore). Each
58
- * source has its own cache slot, so toggling Draft↔Live is instant once both
59
- * have been seeded. Public visitors never invalidate (no project room) so
60
- * this query function doesn't run for them — they stay on the SSR-seeded
61
- * 'live' data.
62
- */
63
50
  function _temp() {
64
51
  return false;
65
52
  }
66
- function pageStructureQueryFn(path, projectSlug, source) {
67
- return () => getApiClient().pages.getStructure({
68
- path,
69
- projectSlug,
70
- source
71
- });
72
- }
53
+ /** The page the Preview shows: as the server rendered it, then following edits. */
73
54
  function usePreviewedPage() {
74
- const $ = c(11);
75
- if ($[0] !== "2d1a4df08feec350ec60cc84fec5c50c421655f0e335816baf3bbe36ccd11082") {
76
- for (let $i = 0; $i < 11; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
77
- $[0] = "2d1a4df08feec350ec60cc84fec5c50c421655f0e335816baf3bbe36ccd11082";
78
- }
79
- const { pathname } = useLocation();
80
- const projectSlug = useProjectSlug();
81
- const previewSource = useSelector(previewStore, selectPreviewSource);
55
+ const $ = c(3);
56
+ const pathname = useLocalePath();
57
+ const projectUuid = useProjectUuid();
82
58
  let t0;
83
- if ($[1] !== pathname || $[2] !== previewSource) {
84
- t0 = queryKeys.pages.getByPath(pathname, previewSource);
85
- $[1] = pathname;
86
- $[2] = previewSource;
87
- $[3] = t0;
88
- } else t0 = $[3];
89
- let t1;
90
- if ($[4] !== pathname || $[5] !== previewSource || $[6] !== projectSlug) {
91
- t1 = pageStructureQueryFn(pathname, projectSlug, previewSource);
92
- $[4] = pathname;
93
- $[5] = previewSource;
94
- $[6] = projectSlug;
95
- $[7] = t1;
96
- } else t1 = $[7];
97
- let t2;
98
- if ($[8] !== t0 || $[9] !== t1) {
99
- t2 = {
100
- queryKey: t0,
101
- queryFn: t1,
102
- staleTime: Infinity
103
- };
104
- $[8] = t0;
105
- $[9] = t1;
106
- $[10] = t2;
107
- } else t2 = $[10];
108
- const { data: currentPage } = useSuspenseQuery(t2);
109
- return currentPage;
59
+ if ($[0] !== pathname || $[1] !== projectUuid) {
60
+ t0 = reads.pageStructure({
61
+ path: pathname,
62
+ projectUuid
63
+ });
64
+ $[0] = pathname;
65
+ $[1] = projectUuid;
66
+ $[2] = t0;
67
+ } else t0 = $[2];
68
+ return useRead(t0);
110
69
  }
111
70
  const BlockRenderer = (t0) => {
112
- const $ = c(23);
113
- if ($[0] !== "2d1a4df08feec350ec60cc84fec5c50c421655f0e335816baf3bbe36ccd11082") {
114
- for (let $i = 0; $i < 23; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
115
- $[0] = "2d1a4df08feec350ec60cc84fec5c50c421655f0e335816baf3bbe36ccd11082";
116
- }
71
+ const $ = c(28);
117
72
  const { blockId, mode, showAddBlockTop, showAddBlockBottom } = t0;
118
- const previewSource = useSelector(previewStore, selectPreviewSource);
119
73
  let t1;
120
- if ($[1] !== blockId || $[2] !== previewSource) {
121
- t1 = blockQueries.get(blockId, previewSource);
122
- $[1] = blockId;
123
- $[2] = previewSource;
124
- $[3] = t1;
125
- } else t1 = $[3];
126
- const { data } = useSuspenseQuery(t1);
74
+ if ($[0] !== blockId) {
75
+ t1 = reads.blockBundle(blockId);
76
+ $[0] = blockId;
77
+ $[1] = t1;
78
+ } else t1 = $[1];
79
+ const data = useRead(t1);
127
80
  const camoxApp = useCamoxApp();
128
81
  let t2;
129
- if ($[4] !== camoxApp || $[5] !== data.block.type) {
82
+ if ($[2] !== camoxApp || $[3] !== data.block.type) {
130
83
  t2 = camoxApp.getBlockById(data.block.type);
131
- $[4] = camoxApp;
132
- $[5] = data.block.type;
133
- $[6] = t2;
134
- } else t2 = $[6];
84
+ $[2] = camoxApp;
85
+ $[3] = data.block.type;
86
+ $[4] = t2;
87
+ } else t2 = $[4];
135
88
  const blockDef = t2;
136
- if (!blockDef) return null;
89
+ if (!blockDef) {
90
+ let t3;
91
+ if ($[5] !== blockId || $[6] !== data.block.type || $[7] !== mode) {
92
+ t3 = /* @__PURE__ */ jsx(RemovedBlockPlaceholder, {
93
+ blockId,
94
+ type: data.block.type,
95
+ mode
96
+ });
97
+ $[5] = blockId;
98
+ $[6] = data.block.type;
99
+ $[7] = mode;
100
+ $[8] = t3;
101
+ } else t3 = $[8];
102
+ return t3;
103
+ }
137
104
  const t3 = data.files;
138
105
  const t4 = data.repeatableItems;
106
+ let t5;
107
+ if ($[9] !== data.block) {
108
+ t5 = [data.block];
109
+ $[9] = data.block;
110
+ $[10] = t5;
111
+ } else t5 = $[10];
139
112
  const T0 = blockDef._internal.Component;
140
- const t5 = data.block.id;
141
- const t6 = data.block.type;
142
- const t7 = data.block.content;
143
- const t8 = data.block.settings;
144
- const t9 = String(data.block.position);
145
- let t10;
146
- if ($[7] !== data.block.id || $[8] !== data.block.type || $[9] !== t7 || $[10] !== t8 || $[11] !== t9) {
147
- t10 = {
148
- _id: t5,
149
- type: t6,
150
- content: t7,
151
- settings: t8,
152
- position: t9
153
- };
154
- $[7] = data.block.id;
155
- $[8] = data.block.type;
156
- $[9] = t7;
157
- $[10] = t8;
158
- $[11] = t9;
159
- $[12] = t10;
160
- } else t10 = $[12];
113
+ const t6 = data.block.id;
114
+ const t7 = data.block.type;
115
+ const t8 = data.block.content;
116
+ const t9 = data.block.settings;
117
+ const t10 = String(data.block.position);
161
118
  let t11;
162
- if ($[13] !== blockDef._internal.Component || $[14] !== mode || $[15] !== showAddBlockBottom || $[16] !== showAddBlockTop || $[17] !== t10) {
163
- t11 = /* @__PURE__ */ jsx(T0, {
164
- blockData: t10,
119
+ if ($[11] !== data.block.id || $[12] !== data.block.type || $[13] !== t10 || $[14] !== t8 || $[15] !== t9) {
120
+ t11 = {
121
+ _id: t6,
122
+ type: t7,
123
+ content: t8,
124
+ settings: t9,
125
+ position: t10
126
+ };
127
+ $[11] = data.block.id;
128
+ $[12] = data.block.type;
129
+ $[13] = t10;
130
+ $[14] = t8;
131
+ $[15] = t9;
132
+ $[16] = t11;
133
+ } else t11 = $[16];
134
+ let t12;
135
+ if ($[17] !== blockDef._internal.Component || $[18] !== mode || $[19] !== showAddBlockBottom || $[20] !== showAddBlockTop || $[21] !== t11) {
136
+ t12 = /* @__PURE__ */ jsx(T0, {
137
+ blockData: t11,
165
138
  mode,
166
139
  showAddBlockTop,
167
140
  showAddBlockBottom
168
141
  });
169
- $[13] = blockDef._internal.Component;
170
- $[14] = mode;
171
- $[15] = showAddBlockBottom;
172
- $[16] = showAddBlockTop;
173
- $[17] = t10;
174
- $[18] = t11;
175
- } else t11 = $[18];
176
- let t12;
177
- if ($[19] !== data.files || $[20] !== data.repeatableItems || $[21] !== t11) {
178
- t12 = /* @__PURE__ */ jsx(NormalizedDataProvider, {
179
- files: t3,
180
- repeatableItems: t4,
181
- children: t11
182
- });
183
- $[19] = data.files;
184
- $[20] = data.repeatableItems;
142
+ $[17] = blockDef._internal.Component;
143
+ $[18] = mode;
144
+ $[19] = showAddBlockBottom;
145
+ $[20] = showAddBlockTop;
185
146
  $[21] = t11;
186
147
  $[22] = t12;
187
148
  } else t12 = $[22];
188
- return t12;
149
+ let t13;
150
+ if ($[23] !== data.files || $[24] !== data.repeatableItems || $[25] !== t12 || $[26] !== t5) {
151
+ t13 = /* @__PURE__ */ jsx(NormalizedDataProvider, {
152
+ files: t3,
153
+ repeatableItems: t4,
154
+ blocks: t5,
155
+ children: t12
156
+ });
157
+ $[23] = data.files;
158
+ $[24] = data.repeatableItems;
159
+ $[25] = t12;
160
+ $[26] = t5;
161
+ $[27] = t13;
162
+ } else t13 = $[27];
163
+ return t13;
189
164
  };
190
165
  const PageContent = () => {
166
+ const $ = c(30);
191
167
  const pageData = usePreviewedPage();
192
- const { pageBlocks, beforeBlocks, afterBlocks, layoutFiles, layoutItems } = usePageBlocks(pageData, useSelector(previewStore, selectPreviewSource));
193
- const peekedBlockPosition = useSelector(previewStore, (state) => state.context.peekedBlockPosition);
194
- const displayedPositionRef = React.useRef(null);
195
- if (peekedBlockPosition !== null) displayedPositionRef.current = peekedBlockPosition;
196
- const effectivePosition = peekedBlockPosition ?? displayedPositionRef.current;
197
- const onExitComplete = React.useCallback(() => {
198
- displayedPositionRef.current = null;
199
- }, []);
168
+ const { pageBlocks, beforeBlocks, afterBlocks, layoutFiles, layoutItems } = usePageBlocks(pageData);
200
169
  const camoxApp = useCamoxApp();
201
- const peekedBlockIndex = React.useMemo(() => {
202
- if (effectivePosition === "") return 0;
203
- if (effectivePosition === null) return pageBlocks.length;
204
- const afterBlockIndex = pageBlocks.findIndex((block) => String(block.position) === effectivePosition);
205
- if (afterBlockIndex === -1) return pageBlocks.length;
206
- return afterBlockIndex + 1;
207
- }, [pageBlocks, effectivePosition]);
208
- const layout = pageData.layout ? camoxApp.getLayoutById(pageData.layout.layoutId) : void 0;
209
- const layoutBlocksMap = React.useMemo(() => {
210
- if (!pageData.layout) return null;
211
- const allLayoutBlocks = [...beforeBlocks, ...afterBlocks];
212
- const blocks = {};
213
- for (const block_0 of allLayoutBlocks) blocks[block_0.type] = {
214
- _id: block_0.id,
215
- type: block_0.type,
216
- content: block_0.content,
217
- settings: block_0.settings,
218
- position: String(block_0.position)
219
- };
220
- return blocks;
221
- }, [
222
- pageData.layout,
223
- beforeBlocks,
224
- afterBlocks
225
- ]);
226
- const pageBlocksContent = /* @__PURE__ */ jsxs(Fragment, { children: [
227
- peekedBlockIndex === 0 && pageBlocks.length > 0 && /* @__PURE__ */ jsx(PeekedBlock, { onExitComplete }),
228
- pageBlocks.map((blockData, index) => /* @__PURE__ */ jsxs(React.Fragment, { children: [/* @__PURE__ */ jsx(BlockErrorBoundary, {
170
+ let layout;
171
+ let layoutBlocksMap;
172
+ let t0;
173
+ if ($[0] !== afterBlocks || $[1] !== beforeBlocks || $[2] !== camoxApp || $[3] !== pageBlocks || $[4] !== pageData) {
174
+ layout = pageData.layout ? camoxApp.getLayoutById(pageData.layout.layoutId) : void 0;
175
+ let t1;
176
+ bb0: {
177
+ if (!pageData.layout) {
178
+ t1 = null;
179
+ break bb0;
180
+ }
181
+ let blocks;
182
+ if ($[8] !== afterBlocks || $[9] !== beforeBlocks) {
183
+ const allLayoutBlocks = [...beforeBlocks, ...afterBlocks];
184
+ blocks = {};
185
+ for (const block of allLayoutBlocks) blocks[block.type] = {
186
+ _id: block.id,
187
+ type: block.type,
188
+ content: block.content,
189
+ settings: block.settings,
190
+ position: String(block.position)
191
+ };
192
+ $[8] = afterBlocks;
193
+ $[9] = beforeBlocks;
194
+ $[10] = blocks;
195
+ } else blocks = $[10];
196
+ t1 = blocks;
197
+ }
198
+ layoutBlocksMap = t1;
199
+ t0 = pageBlocks.map((blockData, index) => /* @__PURE__ */ jsx(BlockErrorBoundary, {
229
200
  blockId: blockData.id,
230
201
  blockType: blockData.type,
231
202
  children: /* @__PURE__ */ jsx(BlockRenderer, {
232
203
  blockId: blockData.id,
233
204
  mode: "site",
234
- showAddBlockTop: index === 0 ? layout?._internal.blockDefinitions.some((b) => b.placement === "before") ?? false : true,
205
+ showAddBlockTop: index === 0 ? layout?._internal.blockDefinitions.some(_temp2) ?? false : true,
235
206
  showAddBlockBottom: true
236
207
  })
237
- }), index === peekedBlockIndex - 1 && /* @__PURE__ */ jsx(PeekedBlock, { onExitComplete })] }, blockData.id)),
238
- pageBlocks.length === 0 && /* @__PURE__ */ jsx(PeekedBlock, { onExitComplete })
239
- ] });
208
+ }, blockData.id));
209
+ $[0] = afterBlocks;
210
+ $[1] = beforeBlocks;
211
+ $[2] = camoxApp;
212
+ $[3] = pageBlocks;
213
+ $[4] = pageData;
214
+ $[5] = layout;
215
+ $[6] = layoutBlocksMap;
216
+ $[7] = t0;
217
+ } else {
218
+ layout = $[5];
219
+ layoutBlocksMap = $[6];
220
+ t0 = $[7];
221
+ }
222
+ let t1;
223
+ if ($[11] !== t0) {
224
+ t1 = /* @__PURE__ */ jsx(Fragment, { children: t0 });
225
+ $[11] = t0;
226
+ $[12] = t1;
227
+ } else t1 = $[12];
228
+ const pageBlocksContent = t1;
240
229
  if (layout && layoutBlocksMap) {
241
230
  const LayoutComponent = layout._internal.component;
242
- return /* @__PURE__ */ jsx(NormalizedDataProvider, {
243
- files: layoutFiles,
244
- repeatableItems: layoutItems,
245
- children: /* @__PURE__ */ jsx(layout._internal.Provider, {
231
+ let t2;
232
+ if ($[13] !== afterBlocks || $[14] !== beforeBlocks) {
233
+ t2 = [...beforeBlocks, ...afterBlocks];
234
+ $[13] = afterBlocks;
235
+ $[14] = beforeBlocks;
236
+ $[15] = t2;
237
+ } else t2 = $[15];
238
+ let t3;
239
+ if ($[16] !== LayoutComponent || $[17] !== pageBlocksContent) {
240
+ t3 = /* @__PURE__ */ jsx(LayoutComponent, { children: pageBlocksContent });
241
+ $[16] = LayoutComponent;
242
+ $[17] = pageBlocksContent;
243
+ $[18] = t3;
244
+ } else t3 = $[18];
245
+ let t4;
246
+ if ($[19] !== layout._internal.Provider || $[20] !== layoutBlocksMap || $[21] !== t3) {
247
+ t4 = /* @__PURE__ */ jsx(layout._internal.Provider, {
246
248
  layoutBlocks: layoutBlocksMap,
247
- children: /* @__PURE__ */ jsx(LayoutComponent, { children: pageBlocksContent })
248
- })
249
- });
249
+ children: t3
250
+ });
251
+ $[19] = layout._internal.Provider;
252
+ $[20] = layoutBlocksMap;
253
+ $[21] = t3;
254
+ $[22] = t4;
255
+ } else t4 = $[22];
256
+ let t5;
257
+ if ($[23] !== layoutFiles || $[24] !== layoutItems || $[25] !== t2 || $[26] !== t4) {
258
+ t5 = /* @__PURE__ */ jsx(NormalizedDataProvider, {
259
+ files: layoutFiles,
260
+ repeatableItems: layoutItems,
261
+ blocks: t2,
262
+ children: t4
263
+ });
264
+ $[23] = layoutFiles;
265
+ $[24] = layoutItems;
266
+ $[25] = t2;
267
+ $[26] = t4;
268
+ $[27] = t5;
269
+ } else t5 = $[27];
270
+ return t5;
250
271
  }
251
- return /* @__PURE__ */ jsx("main", {
252
- className: "flex min-h-screen flex-col",
253
- children: pageBlocksContent
254
- });
272
+ let t2;
273
+ if ($[28] !== pageBlocksContent) {
274
+ t2 = /* @__PURE__ */ jsx("main", {
275
+ className: "flex min-h-screen flex-col",
276
+ children: pageBlocksContent
277
+ });
278
+ $[28] = pageBlocksContent;
279
+ $[29] = t2;
280
+ } else t2 = $[29];
281
+ return t2;
255
282
  };
256
- function useHydrateDraftCache() {
257
- const $ = c(7);
258
- if ($[0] !== "2d1a4df08feec350ec60cc84fec5c50c421655f0e335816baf3bbe36ccd11082") {
259
- for (let $i = 0; $i < 7; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
260
- $[0] = "2d1a4df08feec350ec60cc84fec5c50c421655f0e335816baf3bbe36ccd11082";
261
- }
283
+ /**
284
+ * The read of the page the Preview shows: a curated page's structure, or a layout page's layout. A
285
+ * Canvas-only location, opened first, has no page to show.
286
+ */
287
+ function pageRead(projectUuid, pathname, derived) {
288
+ if (pathname === void 0) return null;
289
+ if (derived) return reads.layoutStructure({
290
+ projectUuid,
291
+ layoutId: derived.layoutId
292
+ });
293
+ return reads.pageStructure({
294
+ path: pathname,
295
+ projectUuid
296
+ });
297
+ }
298
+ function useRefreshMemberRead(read) {
299
+ const $ = c(13);
262
300
  const isAuthenticated = useIsAuthenticated();
263
- const queryClient = useQueryClient();
264
- const projectSlug = useProjectSlug();
265
- const { pathname } = useLocation();
301
+ const studioCache = useStudioCache();
302
+ const draftId = useCurrentDraftId();
303
+ let t0;
304
+ if ($[0] !== draftId || $[1] !== read || $[2] !== studioCache) {
305
+ t0 = read ? JSON.stringify(studioCache.options(read, { in: draftId }).queryKey) : null;
306
+ $[0] = draftId;
307
+ $[1] = read;
308
+ $[2] = studioCache;
309
+ $[3] = t0;
310
+ } else t0 = $[3];
311
+ const identity = t0;
312
+ let t1;
313
+ if ($[4] !== isAuthenticated || $[5] !== read || $[6] !== studioCache) {
314
+ t1 = () => {
315
+ if (!isAuthenticated || !read) return;
316
+ studioCache.reload(read).catch(_temp3);
317
+ };
318
+ $[4] = isAuthenticated;
319
+ $[5] = read;
320
+ $[6] = studioCache;
321
+ $[7] = t1;
322
+ } else t1 = $[7];
323
+ const reload = React.useEffectEvent(t1);
324
+ let t2;
325
+ if ($[8] !== reload) {
326
+ t2 = () => reload();
327
+ $[8] = reload;
328
+ $[9] = t2;
329
+ } else t2 = $[9];
330
+ let t3;
331
+ if ($[10] !== identity || $[11] !== isAuthenticated) {
332
+ t3 = [identity, isAuthenticated];
333
+ $[10] = identity;
334
+ $[11] = isAuthenticated;
335
+ $[12] = t3;
336
+ } else t3 = $[12];
337
+ React.useEffect(t2, t3);
338
+ }
339
+ function _temp3() {}
340
+ /**
341
+ * The page the Preview shows: the current one, or on a Canvas-only location,
342
+ * which has none, the last one. The Canvas keeps showing that page in its slot
343
+ * when nothing is selected, so it stays mounted rather than flash as it remounts.
344
+ */
345
+ function useShownPage(location, derived, canvasOnly) {
346
+ const $ = c(3);
347
+ const [last, setLast] = React.useState(null);
348
+ if (canvasOnly) return last;
349
+ if (!!last && last.location.href === location.href && last.location.pathname === location.pathname && last.derived === derived) return last;
350
+ let t0;
351
+ if ($[0] !== derived || $[1] !== location) {
352
+ t0 = {
353
+ location,
354
+ derived
355
+ };
356
+ $[0] = derived;
357
+ $[1] = location;
358
+ $[2] = t0;
359
+ } else t0 = $[2];
360
+ const current = t0;
361
+ setLast(current);
362
+ return current;
363
+ }
364
+ /** Remembers where the Website Section is, so that going back to it from the Studio lands there. */
365
+ function useRememberWebsiteLocation(location) {
366
+ const $ = c(5);
367
+ const { locale, locales } = useViewLocale();
266
368
  let t0;
267
369
  let t1;
268
- if ($[1] !== isAuthenticated || $[2] !== pathname || $[3] !== projectSlug || $[4] !== queryClient) {
370
+ if ($[0] !== locale.tag || $[1] !== locales || $[2] !== location) {
269
371
  t0 = () => {
270
- if (!isAuthenticated) return;
271
- let cancelled = false;
272
- getApiClient().pages.getByPath({
273
- path: pathname,
274
- projectSlug,
275
- source: "draft"
276
- }).then((data) => {
277
- if (cancelled) return;
278
- seedBlockCaches(queryClient, data, "draft");
279
- queryClient.setQueryData(queryKeys.pages.getByPath(pathname, "draft"), {
280
- page: data.page,
281
- layout: data.layout,
282
- projectName: data.projectName,
283
- project: data.project
284
- });
285
- }).catch(_temp2);
286
- return () => {
287
- cancelled = true;
288
- };
372
+ const { pathname, search, hash } = location;
373
+ const url = new URL(withoutDraft(new URL(`${pathname}${search}`, "http://camox.local").href));
374
+ studioStore.send({
375
+ type: "rememberWebsiteLocation",
376
+ location: {
377
+ locale: locale.tag,
378
+ path: parseLocalePath(pathname, locales).path,
379
+ search: url.search,
380
+ hash
381
+ }
382
+ });
289
383
  };
290
384
  t1 = [
291
- isAuthenticated,
292
- pathname,
293
- projectSlug,
294
- queryClient
385
+ location,
386
+ locale.tag,
387
+ locales
295
388
  ];
296
- $[1] = isAuthenticated;
297
- $[2] = pathname;
298
- $[3] = projectSlug;
299
- $[4] = queryClient;
300
- $[5] = t0;
301
- $[6] = t1;
389
+ $[0] = locale.tag;
390
+ $[1] = locales;
391
+ $[2] = location;
392
+ $[3] = t0;
393
+ $[4] = t1;
302
394
  } else {
303
- t0 = $[5];
304
- t1 = $[6];
395
+ t0 = $[3];
396
+ t1 = $[4];
305
397
  }
306
398
  React.useEffect(t0, t1);
307
399
  }
308
- function _temp2() {}
309
400
  const CamoxPreview = (t0) => {
310
- const $ = c(4);
311
- if ($[0] !== "2d1a4df08feec350ec60cc84fec5c50c421655f0e335816baf3bbe36ccd11082") {
312
- for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
313
- $[0] = "2d1a4df08feec350ec60cc84fec5c50c421655f0e335816baf3bbe36ccd11082";
314
- }
315
- const { children } = t0;
316
- const pageData = usePreviewedPage();
317
- useHydrateDraftCache();
401
+ const $ = c(36);
402
+ const { children, runtimeBasePath, derived, canvasOnly } = t0;
403
+ const camoxApp = useCamoxApp();
404
+ const location = useLocation();
405
+ useRememberWebsiteLocation(location);
406
+ const shown = useShownPage(location, derived, !!canvasOnly);
407
+ const pathname = shown?.location.pathname;
408
+ const shownDerived = shown?.derived;
409
+ const projectUuid = useProjectUuid();
410
+ const { locales } = useViewLocale();
318
411
  let t1;
319
- if ($[1] !== children || $[2] !== pageData) {
320
- t1 = /* @__PURE__ */ jsx(PreviewShell, {
412
+ if ($[0] !== locales || $[1] !== pathname || $[2] !== projectUuid || $[3] !== shownDerived) {
413
+ t1 = pageRead(projectUuid, pathname === void 0 ? void 0 : parseLocalePath(pathname, locales).path, shownDerived);
414
+ $[0] = locales;
415
+ $[1] = pathname;
416
+ $[2] = projectUuid;
417
+ $[3] = shownDerived;
418
+ $[4] = t1;
419
+ } else t1 = $[4];
420
+ const shownRead = t1;
421
+ const data = useRead(shownRead);
422
+ useRefreshMemberRead(shownRead);
423
+ const t2 = runtimeBasePath ?? "";
424
+ const t3 = pathname ?? location.pathname;
425
+ let t4;
426
+ if ($[5] !== shownDerived) {
427
+ t4 = shownDerived ? { result: shownDerived.result } : void 0;
428
+ $[5] = shownDerived;
429
+ $[6] = t4;
430
+ } else t4 = $[6];
431
+ let t5;
432
+ if ($[7] !== projectUuid || $[8] !== t2 || $[9] !== t3 || $[10] !== t4) {
433
+ t5 = {
434
+ projectUuid,
435
+ runtimeBasePath: t2,
436
+ pathname: t3,
437
+ loaded: t4
438
+ };
439
+ $[7] = projectUuid;
440
+ $[8] = t2;
441
+ $[9] = t3;
442
+ $[10] = t4;
443
+ $[11] = t5;
444
+ } else t5 = $[11];
445
+ const derivedResult = useDerivedPageResult(t5);
446
+ let t6;
447
+ if ($[12] !== derivedResult) {
448
+ t6 = getPageRecord(derivedResult);
449
+ $[12] = derivedResult;
450
+ $[13] = t6;
451
+ } else t6 = $[13];
452
+ const pageRecord = t6;
453
+ const t7 = runtimeBasePath ?? "";
454
+ const t8 = shownDerived?.layoutId;
455
+ let t9;
456
+ if ($[14] !== pageRecord || $[15] !== projectUuid || $[16] !== t7 || $[17] !== t8) {
457
+ t9 = {
458
+ projectUuid,
459
+ runtimeBasePath: t7,
460
+ layoutId: t8,
461
+ record: pageRecord
462
+ };
463
+ $[14] = pageRecord;
464
+ $[15] = projectUuid;
465
+ $[16] = t7;
466
+ $[17] = t8;
467
+ $[18] = t9;
468
+ } else t9 = $[18];
469
+ useFollowPageRecord(t9);
470
+ const pageData = data && "page" in data ? data : void 0;
471
+ const layout = data && !("page" in data) ? data : void 0;
472
+ const t10 = shown?.location;
473
+ let t11;
474
+ if ($[19] !== camoxApp || $[20] !== children || $[21] !== derivedResult || $[22] !== layout || $[23] !== shown || $[24] !== shownDerived) {
475
+ t11 = shownDerived && layout ? /* @__PURE__ */ jsx(DerivedPageContent, {
476
+ camoxApp,
477
+ derived: {
478
+ ...shownDerived,
479
+ layout,
480
+ result: derivedResult
481
+ }
482
+ }) : shown ? children : null;
483
+ $[19] = camoxApp;
484
+ $[20] = children;
485
+ $[21] = derivedResult;
486
+ $[22] = layout;
487
+ $[23] = shown;
488
+ $[24] = shownDerived;
489
+ $[25] = t11;
490
+ } else t11 = $[25];
491
+ let t12;
492
+ if ($[26] !== canvasOnly || $[27] !== layout || $[28] !== pageData || $[29] !== runtimeBasePath || $[30] !== t10 || $[31] !== t11) {
493
+ t12 = /* @__PURE__ */ jsx(PreviewShell, {
321
494
  pageData,
322
- children
495
+ derivedLayout: layout,
496
+ pageLocation: t10,
497
+ canvasOnly,
498
+ runtimeBasePath,
499
+ children: t11
500
+ });
501
+ $[26] = canvasOnly;
502
+ $[27] = layout;
503
+ $[28] = pageData;
504
+ $[29] = runtimeBasePath;
505
+ $[30] = t10;
506
+ $[31] = t11;
507
+ $[32] = t12;
508
+ } else t12 = $[32];
509
+ let t13;
510
+ if ($[33] !== derivedResult || $[34] !== t12) {
511
+ t13 = /* @__PURE__ */ jsx(PageRecordContext, {
512
+ value: derivedResult,
513
+ children: t12
323
514
  });
324
- $[1] = children;
325
- $[2] = pageData;
326
- $[3] = t1;
327
- } else t1 = $[3];
328
- return t1;
515
+ $[33] = derivedResult;
516
+ $[34] = t12;
517
+ $[35] = t13;
518
+ } else t13 = $[35];
519
+ return t13;
329
520
  };
521
+ /**
522
+ * A Canvas-only location only exists on the Canvas. Opening one
523
+ * shows the Canvas, while hiding the Canvas, or a Studio without the Canvas,
524
+ * goes back to the last page shown, or home without one, so Preview always shows a real Page.
525
+ */
526
+ function useCanvasOnlyLocation(canvasOnly, isCanvasShown, isMobileStudio, lastPage) {
527
+ const $ = c(10);
528
+ const navigate = useNavigate();
529
+ const wasCanvasShown = React.useRef(isCanvasShown);
530
+ const localized = useLocalizedPath();
531
+ let t0;
532
+ if ($[0] !== lastPage || $[1] !== localized) {
533
+ t0 = lastPage ? `${lastPage.pathname}${lastPage.search}${lastPage.hash}` : localized("/");
534
+ $[0] = lastPage;
535
+ $[1] = localized;
536
+ $[2] = t0;
537
+ } else t0 = $[2];
538
+ const lastPageHref = t0;
539
+ let t1;
540
+ let t2;
541
+ if ($[3] !== canvasOnly || $[4] !== isCanvasShown || $[5] !== isMobileStudio || $[6] !== lastPageHref || $[7] !== navigate) {
542
+ t1 = () => {
543
+ const left = wasCanvasShown.current && !isCanvasShown;
544
+ wasCanvasShown.current = isCanvasShown;
545
+ if (!canvasOnly || isCanvasShown) return;
546
+ if (isMobileStudio || left) {
547
+ navigate({
548
+ to: lastPageHref,
549
+ replace: true
550
+ });
551
+ return;
552
+ }
553
+ previewStore.send({ type: "showCanvas" });
554
+ };
555
+ t2 = [
556
+ canvasOnly,
557
+ isCanvasShown,
558
+ isMobileStudio,
559
+ navigate,
560
+ lastPageHref
561
+ ];
562
+ $[3] = canvasOnly;
563
+ $[4] = isCanvasShown;
564
+ $[5] = isMobileStudio;
565
+ $[6] = lastPageHref;
566
+ $[7] = navigate;
567
+ $[8] = t1;
568
+ $[9] = t2;
569
+ } else {
570
+ t1 = $[8];
571
+ t2 = $[9];
572
+ }
573
+ React.useEffect(t1, t2);
574
+ }
575
+ /**
576
+ * Once the signed-in Studio is idle, loads what showing the Canvas waits for: its code, and
577
+ * the project and page list it lays out. The first show then skips most of its loading.
578
+ */
579
+ function usePrefetchCanvas(enabled, projectUuid) {
580
+ const $ = c(6);
581
+ const queryClient = useQueryClient();
582
+ const studioCache = useStudioCache();
583
+ let t0;
584
+ let t1;
585
+ if ($[0] !== enabled || $[1] !== projectUuid || $[2] !== queryClient || $[3] !== studioCache) {
586
+ t0 = () => {
587
+ if (!enabled) return;
588
+ const prefetch = async () => {
589
+ prefetchCanvas();
590
+ await queryClient.prefetchQuery(studioCache.options(reads.project({ projectUuid })));
591
+ await queryClient.prefetchQuery(studioCache.options(reads.pageList({ projectUuid })));
592
+ };
593
+ if (typeof window.requestIdleCallback === "function") {
594
+ const id = window.requestIdleCallback(() => void prefetch(), { timeout: 5e3 });
595
+ return () => window.cancelIdleCallback(id);
596
+ }
597
+ const id_0 = window.setTimeout(() => void prefetch(), 2e3);
598
+ return () => window.clearTimeout(id_0);
599
+ };
600
+ t1 = [
601
+ enabled,
602
+ projectUuid,
603
+ queryClient,
604
+ studioCache
605
+ ];
606
+ $[0] = enabled;
607
+ $[1] = projectUuid;
608
+ $[2] = queryClient;
609
+ $[3] = studioCache;
610
+ $[4] = t0;
611
+ $[5] = t1;
612
+ } else {
613
+ t0 = $[4];
614
+ t1 = $[5];
615
+ }
616
+ React.useEffect(t0, t1);
617
+ }
330
618
  /** Studio chrome is shared; only curated previews require a Camox page record. */
331
619
  const PreviewShell = (t0) => {
332
- const $ = c(59);
333
- if ($[0] !== "2d1a4df08feec350ec60cc84fec5c50c421655f0e335816baf3bbe36ccd11082") {
334
- for (let $i = 0; $i < 59; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
335
- $[0] = "2d1a4df08feec350ec60cc84fec5c50c421655f0e335816baf3bbe36ccd11082";
336
- }
337
- const { children, pageData, hasLiveVersion: t1, derivedLayoutId, derivedLayout } = t0;
338
- const hasLiveVersion = t1 === void 0 ? false : t1;
620
+ const $ = c(49);
621
+ const { children, pageData, derivedLayout, pageLocation, canvasOnly, runtimeBasePath: t1 } = t0;
622
+ const runtimeBasePath = t1 === void 0 ? "" : t1;
339
623
  const isAuthenticated = useIsAuthenticated();
624
+ const projectUuid = useProjectUuid();
340
625
  const isMobileStudio = useIsMobileStudio();
341
- const sharedChrome = React.useContext(SharedChromeContext);
342
- const isEditMode = useSelector(previewStore, selectIsEditMode);
343
- const isToolbarHidden = useSelector(previewStore, _temp3);
344
- const isAddBlockSidebarOpen = useSelector(previewStore, _temp4);
345
- const previewSource = useSelector(previewStore, selectPreviewSource);
346
- const hasLiveCheckpoint = pageData ? pageData.page.livePublishedCheckpointId != null : hasLiveVersion;
626
+ const isCanvasShown = useSelector(previewStore, selectIsCanvasShown);
627
+ usePreviewViewportActions();
628
+ const isCanvasEnabled = !isMobileStudio && isCanvasShown;
629
+ usePrefetchCanvas(isAuthenticated && !isMobileStudio, projectUuid);
630
+ const { pathname } = useLocation();
631
+ const pageId = canvasOnly ? void 0 : pageData?.page.id;
632
+ const layoutId = canvasOnly ? void 0 : derivedLayout?.layoutId;
347
633
  let t2;
634
+ bb0: {
635
+ if (pageId != null) {
636
+ let t3;
637
+ if ($[0] !== pageId) {
638
+ t3 = {
639
+ kind: "page",
640
+ pageId
641
+ };
642
+ $[0] = pageId;
643
+ $[1] = t3;
644
+ } else t3 = $[1];
645
+ t2 = t3;
646
+ break bb0;
647
+ }
648
+ if (layoutId != null) {
649
+ let t3;
650
+ if ($[2] !== layoutId) {
651
+ t3 = {
652
+ kind: "layout",
653
+ layoutId
654
+ };
655
+ $[2] = layoutId;
656
+ $[3] = t3;
657
+ } else t3 = $[3];
658
+ t2 = t3;
659
+ break bb0;
660
+ }
661
+ t2 = null;
662
+ }
663
+ const editingOwner = t2;
348
664
  let t3;
349
- if ($[1] !== isMobileStudio) {
350
- t2 = () => {
665
+ let t4;
666
+ if ($[4] !== isMobileStudio) {
667
+ t3 = () => {
351
668
  if (!isMobileStudio) return;
352
- previewStore.send({ type: "exitEditMode" });
353
- previewStore.send({ type: "closeAddBlockSidebar" });
669
+ previewStore.send({ type: "hideCanvas" });
670
+ previewStore.send({ type: "closeAddBlockDialog" });
354
671
  };
355
- t3 = [isMobileStudio];
356
- $[1] = isMobileStudio;
357
- $[2] = t2;
358
- $[3] = t3;
672
+ t4 = [isMobileStudio];
673
+ $[4] = isMobileStudio;
674
+ $[5] = t3;
675
+ $[6] = t4;
359
676
  } else {
360
- t2 = $[2];
361
- t3 = $[3];
677
+ t3 = $[5];
678
+ t4 = $[6];
362
679
  }
363
- React.useEffect(t2, t3);
364
- let t4;
680
+ React.useEffect(t3, t4);
681
+ useCanvasOnlyLocation(!!canvasOnly && isAuthenticated, isCanvasShown, isMobileStudio, pageLocation);
365
682
  let t5;
366
- if ($[4] !== hasLiveCheckpoint || $[5] !== isAuthenticated || $[6] !== isEditMode || $[7] !== isMobileStudio || $[8] !== previewSource) {
367
- t4 = () => {
683
+ let t6;
684
+ if ($[7] !== isAuthenticated || $[8] !== isCanvasShown || $[9] !== isMobileStudio) {
685
+ t5 = () => {
368
686
  const actions = [
369
687
  {
370
- id: "exit-edit-mode",
371
- label: "Exit edit mode",
688
+ id: "hide-canvas",
689
+ label: "Hide canvas",
372
690
  aliases: [
691
+ "Preview",
692
+ "Exit edit mode",
373
693
  "Hide Camox Studio",
374
- "Hide studio",
375
- "Preview only",
376
- "View mode"
694
+ "Hide studio"
377
695
  ],
378
- groupLabel: "Preview",
379
- checkIfAvailable: () => isAuthenticated && isEditMode,
380
- execute: _temp5,
381
- shortcut: EDIT_MODE_SHORTCUT
696
+ groupLabel: "Website",
697
+ checkIfAvailable: () => isAuthenticated && isCanvasShown,
698
+ execute: _temp4,
699
+ shortcut: TOGGLE_CANVAS_SHORTCUT
382
700
  },
383
701
  {
384
- id: "enter-edit-mode",
385
- label: "Enter edit mode",
702
+ id: "show-canvas",
703
+ label: "Show canvas",
386
704
  aliases: [
705
+ "Edit mode",
387
706
  "Show Camox Studio",
388
- "Show studio",
389
- "Edit mode"
390
- ],
391
- groupLabel: "Preview",
392
- checkIfAvailable: () => isAuthenticated && !isEditMode && !isMobileStudio,
393
- execute: _temp6,
394
- shortcut: EDIT_MODE_SHORTCUT
395
- },
396
- {
397
- id: "preview-live-content",
398
- label: "Preview live content",
399
- aliases: [
400
- "Live",
401
- "View live",
402
- "Published content"
403
- ],
404
- groupLabel: "Preview",
405
- checkIfAvailable: () => isAuthenticated && previewSource === "draft" && hasLiveCheckpoint,
406
- execute: _temp7,
407
- shortcut: {
408
- key: "d",
409
- withAlt: true
410
- }
411
- },
412
- {
413
- id: "preview-draft-content",
414
- label: "Preview draft content",
415
- aliases: [
416
- "Draft",
417
- "View draft",
418
- "Unpublished content"
707
+ "Show studio"
419
708
  ],
420
- groupLabel: "Preview",
421
- checkIfAvailable: () => isAuthenticated && previewSource === "live",
422
- execute: _temp8,
423
- shortcut: {
424
- key: "d",
425
- withAlt: true
426
- }
709
+ groupLabel: "Website",
710
+ checkIfAvailable: () => isAuthenticated && !isCanvasShown && !isMobileStudio,
711
+ execute: _temp5,
712
+ shortcut: TOGGLE_CANVAS_SHORTCUT
427
713
  },
428
714
  {
429
715
  id: "clear-selection",
430
716
  label: "Clear selection",
431
717
  aliases: ["Deselect", "Unselect"],
432
- groupLabel: "Preview",
433
- checkIfAvailable: _temp9,
434
- execute: _temp0,
718
+ groupLabel: "Website",
719
+ checkIfAvailable: _temp6,
720
+ execute: _temp7,
435
721
  shortcut: { key: "Escape" }
436
722
  }
437
723
  ];
@@ -442,184 +728,215 @@ const PreviewShell = (t0) => {
442
728
  return () => {
443
729
  actionsStore.send({
444
730
  type: "unregisterManyActions",
445
- ids: actions.map(_temp1)
731
+ ids: actions.map(_temp8)
446
732
  });
447
733
  };
448
734
  };
449
- t5 = [
450
- isEditMode,
735
+ t6 = [
736
+ isCanvasShown,
451
737
  isAuthenticated,
452
- isMobileStudio,
453
- previewSource,
454
- hasLiveCheckpoint
738
+ isMobileStudio
455
739
  ];
456
- $[4] = hasLiveCheckpoint;
457
- $[5] = isAuthenticated;
458
- $[6] = isEditMode;
459
- $[7] = isMobileStudio;
460
- $[8] = previewSource;
461
- $[9] = t4;
740
+ $[7] = isAuthenticated;
741
+ $[8] = isCanvasShown;
742
+ $[9] = isMobileStudio;
462
743
  $[10] = t5;
744
+ $[11] = t6;
463
745
  } else {
464
- t4 = $[9];
465
746
  t5 = $[10];
747
+ t6 = $[11];
466
748
  }
467
- React.useEffect(t4, t5);
749
+ React.useEffect(t5, t6);
468
750
  if (!isAuthenticated) {
469
- let t6;
470
- if ($[11] !== children) {
471
- t6 = /* @__PURE__ */ jsx(Fragment, { children });
472
- $[11] = children;
473
- $[12] = t6;
474
- } else t6 = $[12];
475
- return t6;
751
+ let t7;
752
+ if ($[12] !== children) {
753
+ t7 = /* @__PURE__ */ jsx(Fragment, { children });
754
+ $[12] = children;
755
+ $[13] = t7;
756
+ } else t7 = $[13];
757
+ return t7;
476
758
  }
477
- const t6 = sharedChrome ? "h-full" : "h-screen";
478
- const t7 = !isEditMode && "bg-black";
759
+ const t7 = !isCanvasShown && "bg-black";
479
760
  let t8;
480
- if ($[13] !== t6 || $[14] !== t7) {
481
- t8 = cn("bg-background flex flex-col overflow-hidden", t6, t7);
482
- $[13] = t6;
761
+ if ($[14] !== t7) {
762
+ t8 = cn("bg-background relative flex h-full min-h-0 flex-1 flex-col overflow-hidden", t7);
483
763
  $[14] = t7;
484
764
  $[15] = t8;
485
765
  } else t8 = $[15];
486
- let t9;
487
- if ($[16] !== isAddBlockSidebarOpen || $[17] !== isMobileStudio || $[18] !== isToolbarHidden || $[19] !== pageData || $[20] !== sharedChrome) {
488
- t9 = !sharedChrome && !isMobileStudio && !isToolbarHidden && /* @__PURE__ */ jsxs("div", {
489
- className: "relative",
490
- children: [/* @__PURE__ */ jsx(Navbar, { isPreview: true }), pageData && isAddBlockSidebarOpen && /* @__PURE__ */ jsx("div", {
491
- className: "absolute inset-0 z-20",
492
- style: { background: "rgba(0, 0, 0, 0.66)" },
493
- onClick: _temp10
494
- })]
495
- });
496
- $[16] = isAddBlockSidebarOpen;
497
- $[17] = isMobileStudio;
498
- $[18] = isToolbarHidden;
499
- $[19] = pageData;
500
- $[20] = sharedChrome;
501
- $[21] = t9;
502
- } else t9 = $[21];
503
- let t10;
504
- if ($[22] !== derivedLayout || $[23] !== derivedLayoutId || $[24] !== isEditMode || $[25] !== isMobileStudio || $[26] !== pageData) {
505
- t10 = !isMobileStudio && (pageData || derivedLayoutId) && /* @__PURE__ */ jsx("div", {
506
- className: isEditMode ? "contents" : "hidden",
507
- children: /* @__PURE__ */ jsx(LeftSidebar, {
508
- page: pageData?.page,
509
- derivedLayout
510
- })
766
+ const t9 = pageLocation?.pathname;
767
+ const t10 = !canvasOnly;
768
+ const t11 = !!derivedLayout;
769
+ let t12;
770
+ if ($[16] !== t10 || $[17] !== t11) {
771
+ t12 = /* @__PURE__ */ jsx(CanvasSidebarSkeleton, {
772
+ page: t10,
773
+ layoutPage: t11
511
774
  });
512
- $[22] = derivedLayout;
513
- $[23] = derivedLayoutId;
514
- $[24] = isEditMode;
515
- $[25] = isMobileStudio;
516
- $[26] = pageData;
517
- $[27] = t10;
518
- } else t10 = $[27];
519
- const t11 = pageData?.page;
520
- const t12 = pageData?.projectName;
521
- const t13 = pageData?.page.id;
522
- const t14 = pageData?.page.status;
523
- let t15;
524
- if ($[28] !== hasLiveCheckpoint || $[29] !== t13 || $[30] !== t14) {
525
- t15 = {
526
- pageId: t13,
527
- pageStatus: t14,
528
- hasLiveVersion: hasLiveCheckpoint
529
- };
530
- $[28] = hasLiveCheckpoint;
531
- $[29] = t13;
532
- $[30] = t14;
533
- $[31] = t15;
534
- } else t15 = $[31];
535
- let t16;
536
- if ($[32] !== isEditMode || $[33] !== isMobileStudio) {
537
- t16 = !isMobileStudio && isEditMode && /* @__PURE__ */ jsx(PreviewToolbarSpacer, {});
538
- $[32] = isEditMode;
539
- $[33] = isMobileStudio;
540
- $[34] = t16;
541
- } else t16 = $[34];
775
+ $[16] = t10;
776
+ $[17] = t11;
777
+ $[18] = t12;
778
+ } else t12 = $[18];
779
+ const t13 = !isCanvasEnabled;
780
+ const t14 = pageData?.page;
781
+ const t15 = derivedLayout?.layoutId;
782
+ const t16 = pageData?.projectName;
542
783
  let t17;
543
- if ($[35] !== children || $[36] !== isMobileStudio || $[37] !== t11 || $[38] !== t12 || $[39] !== t15 || $[40] !== t16) {
544
- t17 = /* @__PURE__ */ jsxs(PreviewPanel, {
545
- isMobileExperience: isMobileStudio,
546
- page: t11,
547
- projectName: t12,
548
- toolbarProps: t15,
549
- children: [children, t16]
784
+ if ($[19] !== children || $[20] !== isMobileStudio || $[21] !== pageLocation || $[22] !== t13 || $[23] !== t14 || $[24] !== t15 || $[25] !== t16) {
785
+ t17 = /* @__PURE__ */ jsx("div", {
786
+ className: "flex min-h-0 flex-1 flex-row items-stretch",
787
+ children: /* @__PURE__ */ jsx(PreviewPanel, {
788
+ active: t13,
789
+ isMobileExperience: isMobileStudio,
790
+ page: t14,
791
+ layoutId: t15,
792
+ pageLocation,
793
+ projectName: t16,
794
+ children
795
+ })
550
796
  });
551
- $[35] = children;
552
- $[36] = isMobileStudio;
553
- $[37] = t11;
554
- $[38] = t12;
555
- $[39] = t15;
556
- $[40] = t16;
557
- $[41] = t17;
558
- } else t17 = $[41];
797
+ $[19] = children;
798
+ $[20] = isMobileStudio;
799
+ $[21] = pageLocation;
800
+ $[22] = t13;
801
+ $[23] = t14;
802
+ $[24] = t15;
803
+ $[25] = t16;
804
+ $[26] = t17;
805
+ } else t17 = $[26];
559
806
  let t18;
560
- if ($[42] !== derivedLayoutId || $[43] !== isEditMode || $[44] !== isMobileStudio || $[45] !== pageData?.page) {
561
- t18 = !isMobileStudio && isEditMode && /* @__PURE__ */ jsx(RightSidebar, {
562
- pageId: pageData?.page.id,
563
- derivedLayoutId
807
+ if ($[27] !== isCanvasEnabled || $[28] !== pathname || $[29] !== runtimeBasePath || $[30] !== t12 || $[31] !== t17 || $[32] !== t9) {
808
+ t18 = /* @__PURE__ */ jsx(CanvasPreview, {
809
+ enabled: isCanvasEnabled,
810
+ pathname,
811
+ pagePathname: t9,
812
+ runtimeBasePath,
813
+ placeholder: t12,
814
+ children: t17
564
815
  });
565
- $[42] = derivedLayoutId;
566
- $[43] = isEditMode;
567
- $[44] = isMobileStudio;
568
- $[45] = pageData?.page;
569
- $[46] = t18;
570
- } else t18 = $[46];
816
+ $[27] = isCanvasEnabled;
817
+ $[28] = pathname;
818
+ $[29] = runtimeBasePath;
819
+ $[30] = t12;
820
+ $[31] = t17;
821
+ $[32] = t9;
822
+ $[33] = t18;
823
+ } else t18 = $[33];
571
824
  let t19;
572
- if ($[47] !== t10 || $[48] !== t17 || $[49] !== t18) {
573
- t19 = /* @__PURE__ */ jsxs("div", {
574
- className: "flex h-full flex-row items-stretch",
575
- children: [
576
- t10,
577
- t17,
578
- t18
579
- ]
580
- });
581
- $[47] = t10;
582
- $[48] = t17;
583
- $[49] = t18;
584
- $[50] = t19;
585
- } else t19 = $[50];
825
+ if ($[34] !== isCanvasEnabled || $[35] !== pageId) {
826
+ t19 = !isCanvasEnabled && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(CreatePageModal, {}), pageId != null && /* @__PURE__ */ jsx(AddBlockDialog, {})] });
827
+ $[34] = isCanvasEnabled;
828
+ $[35] = pageId;
829
+ $[36] = t19;
830
+ } else t19 = $[36];
586
831
  let t20;
587
- if ($[51] !== isEditMode || $[52] !== isMobileStudio) {
588
- t20 = (isMobileStudio || isEditMode) && /* @__PURE__ */ jsx(CreatePageModal, {});
589
- $[51] = isEditMode;
590
- $[52] = isMobileStudio;
591
- $[53] = t20;
592
- } else t20 = $[53];
593
- let t21;
594
- if ($[54] !== t19 || $[55] !== t20 || $[56] !== t8 || $[57] !== t9) {
595
- t21 = /* @__PURE__ */ jsxs("div", {
832
+ if ($[37] !== t18 || $[38] !== t19 || $[39] !== t8) {
833
+ t20 = /* @__PURE__ */ jsxs("div", {
596
834
  className: t8,
597
- children: [
598
- t9,
599
- t19,
600
- t20
601
- ]
835
+ children: [t18, t19]
836
+ });
837
+ $[37] = t18;
838
+ $[38] = t19;
839
+ $[39] = t8;
840
+ $[40] = t20;
841
+ } else t20 = $[40];
842
+ let t21;
843
+ if ($[41] !== editingOwner || $[42] !== t20) {
844
+ t21 = /* @__PURE__ */ jsx(PreviewEditingOwnerContext, {
845
+ value: editingOwner,
846
+ children: t20
602
847
  });
603
- $[54] = t19;
604
- $[55] = t20;
605
- $[56] = t8;
606
- $[57] = t9;
607
- $[58] = t21;
608
- } else t21 = $[58];
609
- return t21;
848
+ $[41] = editingOwner;
849
+ $[42] = t20;
850
+ $[43] = t21;
851
+ } else t21 = $[43];
852
+ let t22;
853
+ if ($[44] !== projectUuid) {
854
+ t22 = /* @__PURE__ */ jsx(ContentCollectionItemSheet, { projectUuid });
855
+ $[44] = projectUuid;
856
+ $[45] = t22;
857
+ } else t22 = $[45];
858
+ let t23;
859
+ if ($[46] !== t21 || $[47] !== t22) {
860
+ t23 = /* @__PURE__ */ jsxs(CollectionItemSheetProvider, {
861
+ onRouteTargetClose: _temp9,
862
+ children: [t21, t22]
863
+ });
864
+ $[46] = t21;
865
+ $[47] = t22;
866
+ $[48] = t23;
867
+ } else t23 = $[48];
868
+ return t23;
610
869
  };
611
- function usePreviewPagesActions() {
870
+ /** Zooms out to the whole Canvas, from anywhere in the site or the Studio. */
871
+ function useShowCanvasAction() {
612
872
  const $ = c(6);
613
- if ($[0] !== "2d1a4df08feec350ec60cc84fec5c50c421655f0e335816baf3bbe36ccd11082") {
614
- for (let $i = 0; $i < 6; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
615
- $[0] = "2d1a4df08feec350ec60cc84fec5c50c421655f0e335816baf3bbe36ccd11082";
873
+ const navigate = useNavigate();
874
+ const pathname = useLocalePath();
875
+ const localized = useLocalizedPath();
876
+ const isMobileStudio = useIsMobileStudio();
877
+ let t0;
878
+ let t1;
879
+ if ($[0] !== isMobileStudio || $[1] !== localized || $[2] !== navigate || $[3] !== pathname) {
880
+ t0 = () => {
881
+ const actions = [{
882
+ id: "show-whole-canvas",
883
+ label: "Show whole canvas",
884
+ aliases: [
885
+ "Canvas",
886
+ "Zoom out",
887
+ "Canvas overview",
888
+ "Back to the canvas"
889
+ ],
890
+ groupLabel: "Navigation",
891
+ checkIfAvailable: () => !isMobileStudio,
892
+ execute: () => {
893
+ previewStore.send({ type: "showCanvas" });
894
+ if (pathname !== "/camox/canvas") navigate({ to: localized(STUDIO_CANVAS_PATH) });
895
+ canvasStore.send({ type: "requestOverview" });
896
+ },
897
+ shortcut: SHOW_WHOLE_CANVAS_SHORTCUT
898
+ }];
899
+ actionsStore.send({
900
+ type: "registerManyActions",
901
+ actions
902
+ });
903
+ return () => {
904
+ actionsStore.send({
905
+ type: "unregisterManyActions",
906
+ ids: actions.map(_temp10)
907
+ });
908
+ };
909
+ };
910
+ t1 = [
911
+ localized,
912
+ navigate,
913
+ pathname,
914
+ isMobileStudio
915
+ ];
916
+ $[0] = isMobileStudio;
917
+ $[1] = localized;
918
+ $[2] = navigate;
919
+ $[3] = pathname;
920
+ $[4] = t0;
921
+ $[5] = t1;
922
+ } else {
923
+ t0 = $[4];
924
+ t1 = $[5];
616
925
  }
926
+ React.useEffect(t0, t1);
927
+ }
928
+ function _temp10(a) {
929
+ return a.id;
930
+ }
931
+ function usePreviewPagesActions() {
932
+ const $ = c(6);
617
933
  const navigate = useNavigate();
618
- const { pathname } = useLocation();
934
+ const pathname = useLocalePath();
935
+ const localized = useLocalizedPath();
619
936
  const pages = usePageDestinations();
620
937
  let t0;
621
938
  let t1;
622
- if ($[1] !== navigate || $[2] !== pages || $[3] !== pathname) {
939
+ if ($[0] !== localized || $[1] !== navigate || $[2] !== pages || $[3] !== pathname) {
623
940
  t0 = () => {
624
941
  const currentPage = pages.find((p) => p.kind === "curated" && p.fullPath === pathname);
625
942
  const actions = [
@@ -627,7 +944,7 @@ function usePreviewPagesActions() {
627
944
  id: "create-page",
628
945
  label: "Create page",
629
946
  aliases: ["New page", "Add page"],
630
- groupLabel: "Preview",
947
+ groupLabel: "Website",
631
948
  checkIfAvailable: _temp11,
632
949
  execute: _temp12
633
950
  },
@@ -639,7 +956,7 @@ function usePreviewPagesActions() {
639
956
  "Edit page settings",
640
957
  "Page metadata"
641
958
  ],
642
- groupLabel: "Preview",
959
+ groupLabel: "Website",
643
960
  checkIfAvailable: () => currentPage?.kind === "curated",
644
961
  execute: () => {
645
962
  if (currentPage?.kind !== "curated") return;
@@ -657,7 +974,7 @@ function usePreviewPagesActions() {
657
974
  "Navigate page",
658
975
  "Switch page"
659
976
  ],
660
- groupLabel: "Preview",
977
+ groupLabel: "Website",
661
978
  checkIfAvailable: () => pages.length > 0,
662
979
  hasChildren: true,
663
980
  execute: _temp13
@@ -667,9 +984,9 @@ function usePreviewPagesActions() {
667
984
  parentActionId: "go-to-page",
668
985
  label: `Go to "${page.title}"`,
669
986
  aliases: [page.fullPath],
670
- groupLabel: "Preview",
987
+ groupLabel: "Website",
671
988
  checkIfAvailable: _temp14,
672
- execute: () => navigate({ to: page.fullPath })
989
+ execute: () => navigate({ to: localized(page.fullPath) })
673
990
  }))
674
991
  ];
675
992
  actionsStore.send({
@@ -684,10 +1001,12 @@ function usePreviewPagesActions() {
684
1001
  };
685
1002
  };
686
1003
  t1 = [
1004
+ localized,
687
1005
  navigate,
688
1006
  pages,
689
1007
  pathname
690
1008
  ];
1009
+ $[0] = localized;
691
1010
  $[1] = navigate;
692
1011
  $[2] = pages;
693
1012
  $[3] = pathname;
@@ -712,40 +1031,25 @@ function _temp12() {
712
1031
  function _temp11() {
713
1032
  return true;
714
1033
  }
715
- function _temp3(state) {
716
- return state.context.isToolbarHidden;
1034
+ function _temp2(b) {
1035
+ return b.slot === "before";
717
1036
  }
718
- function _temp4(state_0) {
719
- return state_0.context.isAddBlockSidebarOpen;
1037
+ function _temp4() {
1038
+ return previewStore.send({ type: "hideCanvas" });
720
1039
  }
721
1040
  function _temp5() {
722
- return previewStore.send({ type: "exitEditMode" });
1041
+ return previewStore.send({ type: "showCanvas" });
723
1042
  }
724
1043
  function _temp6() {
725
- return previewStore.send({ type: "enterEditMode" });
726
- }
727
- function _temp7() {
728
- return previewStore.send({ type: "viewLivePage" });
729
- }
730
- function _temp8() {
731
- return previewStore.send({ type: "viewDraftPage" });
732
- }
733
- function _temp9() {
734
1044
  return true;
735
1045
  }
736
- function _temp0() {
737
- previewStore.send({
738
- type: "setCommentMode",
739
- enabled: false
740
- });
741
- previewStore.send({ type: "clearSelection" });
1046
+ function _temp7() {
1047
+ return previewStore.send({ type: "clearSelection" });
742
1048
  }
743
- function _temp1(a) {
1049
+ function _temp8(a) {
744
1050
  return a.id;
745
1051
  }
746
- function _temp10() {
747
- return previewStore.send({ type: "closeAddBlockSidebar" });
748
- }
1052
+ function _temp9() {}
749
1053
 
750
1054
  //#endregion
751
- export { CamoxPreview, PageContent, PreviewShell, usePreviewPagesActions, usePreviewedPage };
1055
+ export { CamoxPreview, PageContent, PreviewShell, usePreviewPagesActions, usePreviewedPage, useShowCanvasAction };