camox 0.44.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 (411) hide show
  1. package/dist/components/AuthGate.js +0 -6
  2. package/dist/components/DeviceSelector.js +96 -0
  3. package/dist/components/PlatformLabel.js +20 -24
  4. package/dist/core/components/lexical/HighlightNode.js +1 -1
  5. package/dist/core/components/lexical/InlineContentEditable.js +15 -19
  6. package/dist/core/components/lexical/InlineLexicalEditor.js +54 -74
  7. package/dist/core/components/lexical/InlineStylesPlugin.js +53 -53
  8. package/dist/core/components/lexical/MaxLengthPlugin.js +59 -0
  9. package/dist/core/components/lexical/SelectionBroadcaster.js +53 -54
  10. package/dist/core/components/lexical/SidebarLexicalEditor.js +322 -229
  11. package/dist/core/components/lexical/SummaryToggleGuard.js +42 -0
  12. package/dist/core/components/lexical/TextLinkPopover.js +169 -180
  13. package/dist/core/createApp.d.ts +241 -312
  14. package/dist/core/createApp.js +123 -29
  15. package/dist/core/createBlock.d.ts +5 -5
  16. package/dist/core/createBlock.js +385 -152
  17. package/dist/core/createCollection.d.ts +55 -0
  18. package/dist/core/createCollection.js +93 -0
  19. package/dist/core/createLayout.d.ts +197 -61
  20. package/dist/core/createLayout.js +114 -56
  21. package/dist/core/defineDocument.d.ts +3 -5
  22. package/dist/core/derivedRoutes.js +49 -1
  23. package/dist/core/dom.d.ts +13 -4
  24. package/dist/core/dom.js +44 -1
  25. package/dist/core/editing/BlockEditingRuntime.d.ts +16 -0
  26. package/dist/core/editing/BlockEditingRuntime.js +6 -15
  27. package/dist/core/editing/CompleteBlockEditingRuntime.js +28 -23
  28. package/dist/core/editing/createEditableBlock.d.ts +754 -633
  29. package/dist/core/editing/createEditableBlock.js +2113 -1066
  30. package/dist/core/editing/referenceWrites.js +51 -0
  31. package/dist/core/editing/useLatestRecord.js +90 -0
  32. package/dist/core/hooks/useArtifactHost.js +139 -0
  33. package/dist/core/hooks/useFieldSelection.js +43 -18
  34. package/dist/core/hooks/useIsEditable.js +12 -10
  35. package/dist/core/hooks/useOverlayMessage.js +15 -19
  36. package/dist/core/lib/artifact.d.ts +21 -0
  37. package/dist/core/lib/artifact.js +154 -0
  38. package/dist/core/lib/artifactColors.js +123 -0
  39. package/dist/core/lib/artifactData.d.ts +1 -0
  40. package/dist/core/lib/artifactData.js +131 -0
  41. package/dist/core/lib/artifactHost.js +205 -0
  42. package/dist/core/lib/artifactRuntime.js +36 -0
  43. package/dist/core/lib/artifactTheme.js +57 -0
  44. package/dist/core/lib/contentType.d.ts +302 -106
  45. package/dist/core/lib/contentType.js +201 -173
  46. package/dist/core/lib/fieldTypes.js +3 -0
  47. package/dist/core/lib/iconTypes.d.ts +3 -3
  48. package/dist/core/lib/icons.d.ts +4 -4
  49. package/dist/core/lib/icons.js +40 -44
  50. package/dist/core/lib/imagePlaceholder.js +177 -0
  51. package/dist/core/lib/imageTransform.js +1 -1
  52. package/dist/core/lib/lexicalReact.d.ts +3 -1
  53. package/dist/core/lib/lexicalState.js +1 -1
  54. package/dist/core/lib/previewPaused.js +9 -0
  55. package/dist/core/lib/recordScope.js +316 -0
  56. package/dist/core/lib/reference.d.ts +81 -0
  57. package/dist/core/lib/reference.js +29 -0
  58. package/dist/core/lib/textLinks.js +7 -5
  59. package/dist/core/lib/textStyles.d.ts +5 -7
  60. package/dist/core/lib/textStyles.js +2 -2
  61. package/dist/core/notFound.d.ts +7 -0
  62. package/dist/core/notFound.js +11 -0
  63. package/dist/core/pageDestinations.js +6 -3
  64. package/dist/core/recordItem.js +34 -0
  65. package/dist/core/requestContext.d.ts +26 -0
  66. package/dist/core/requestContext.js +20 -0
  67. package/dist/features/canvas/CamoxCanvas.js +1734 -0
  68. package/dist/features/canvas/CanvasBlockFrame.js +353 -0
  69. package/dist/features/canvas/CanvasBlockHeader.js +55 -0
  70. package/dist/features/canvas/CanvasLoadingScreen.js +35 -0
  71. package/dist/features/canvas/CanvasOverlays.js +254 -0
  72. package/dist/features/canvas/CanvasPageEdge.js +87 -0
  73. package/dist/features/canvas/CanvasPageFrame.js +335 -0
  74. package/dist/features/canvas/CanvasPageHeader.js +125 -0
  75. package/dist/features/canvas/CanvasPreviewPageSlot.js +103 -0
  76. package/dist/features/canvas/CanvasShelfMarker.js +255 -0
  77. package/dist/features/canvas/DerivedPagePathInput.js +238 -0
  78. package/dist/features/canvas/canvasCamera.js +229 -0
  79. package/dist/features/canvas/canvasFlight.js +104 -0
  80. package/dist/features/canvas/canvasFrameCapture.js +364 -0
  81. package/dist/features/canvas/canvasFrameDocument.js +317 -0
  82. package/dist/features/canvas/canvasFrameMode.js +53 -0
  83. package/dist/features/canvas/canvasInsertionSeams.js +44 -0
  84. package/dist/features/canvas/canvasItems.js +120 -0
  85. package/dist/features/canvas/canvasOverlayGeometry.js +240 -0
  86. package/dist/features/canvas/canvasPages.js +79 -0
  87. package/dist/features/canvas/canvasScreenSpace.js +26 -0
  88. package/dist/features/canvas/canvasSelection.js +18 -0
  89. package/dist/features/canvas/canvasStore.js +149 -0
  90. package/dist/features/canvas/canvasThumbnails.js +304 -0
  91. package/dist/features/canvas/canvasZoom.js +10 -0
  92. package/dist/features/canvas/sidebar/CanvasInspector.js +202 -0
  93. package/dist/features/canvas/sidebar/CanvasNavigator.js +226 -0
  94. package/dist/features/canvas/sidebar/CanvasSidebar.js +60 -0
  95. package/dist/features/canvas/sidebar/CanvasSidebarFrame.js +48 -0
  96. package/dist/features/canvas/sidebar/CanvasSidebarSkeleton.js +39 -0
  97. package/dist/features/canvas/sidebar/CatalogBlockInspector.js +189 -0
  98. package/dist/features/canvas/sidebar/CuratedPageInspector.js +69 -0
  99. package/dist/features/canvas/sidebar/DerivedPageInspector.js +37 -0
  100. package/dist/features/canvas/sidebar/LayoutPageBlocks.js +78 -0
  101. package/dist/features/canvas/sidebar/LayoutPageOverview.js +71 -0
  102. package/dist/features/canvas/sidebar/PageInspector.js +157 -0
  103. package/dist/features/canvas/sidebar/PageInspectorSkeleton.js +90 -0
  104. package/dist/features/canvas/sidebar/PageOverview.js +27 -0
  105. package/dist/features/canvas/sidebar/SingletonPageInspector.js +31 -0
  106. package/dist/features/canvas/useCanvasCamera.js +803 -0
  107. package/dist/features/canvas/useCanvasFrame.js +149 -0
  108. package/dist/features/canvas/useCanvasFrameInput.js +97 -0
  109. package/dist/features/canvas/useCanvasNearness.js +57 -0
  110. package/dist/features/canvas/useDiscoveredPreviewPaths.js +62 -0
  111. package/dist/features/content/CamoxContent.d.ts +2 -5
  112. package/dist/features/content/CamoxContent.js +174 -271
  113. package/dist/features/content/CollectionItemSheetContext.js +106 -0
  114. package/dist/features/content/ContentAssets.js +315 -0
  115. package/dist/features/content/ContentCollection.js +663 -0
  116. package/dist/features/content/collection-form.js +58 -0
  117. package/dist/features/content/components/AssetCard.js +80 -84
  118. package/dist/features/content/components/AssetCardSkeleton.js +4 -8
  119. package/dist/features/content/components/ContentSidebar.js +129 -18
  120. package/dist/features/content/components/ContentSidebarGroup.js +37 -0
  121. package/dist/features/content/components/DeleteCollectionItemButton.js +202 -0
  122. package/dist/features/content/components/MissingFromLocale.js +282 -0
  123. package/dist/features/content/components/UploadDropZone.js +27 -31
  124. package/dist/features/content/components/UploadProgressDrawer.js +90 -98
  125. package/dist/features/navigation/navigation.d.ts +66 -20
  126. package/dist/features/navigation/navigation.js +257 -90
  127. package/dist/features/og/defaultFonts.js +8 -8
  128. package/dist/features/og/geist-variable-ttf-base64.js +1 -1
  129. package/dist/features/og/imageResponse.d.ts +8 -0
  130. package/dist/features/og/imageResponse.js +26 -0
  131. package/dist/features/page/CuratedPageContent.js +167 -0
  132. package/dist/features/page/DerivedPageContent.js +26 -30
  133. package/dist/features/page/SharedLayoutContent.js +25 -27
  134. package/dist/features/preview/CamoxPreview.d.ts +23 -61
  135. package/dist/features/preview/CamoxPreview.js +816 -537
  136. package/dist/features/preview/EditablePageContent.js +1 -1
  137. package/dist/features/preview/EditablePageExperience.js +16 -22
  138. package/dist/features/preview/components/AddBlockDialog.js +270 -0
  139. package/dist/features/preview/components/AssetFieldEditor.js +173 -154
  140. package/dist/features/preview/components/AssetLightbox.js +181 -134
  141. package/dist/features/preview/components/AssetPickerModal.js +153 -170
  142. package/dist/features/preview/components/BlockActionsPopover.js +150 -149
  143. package/dist/features/preview/components/BlockErrorBoundary.js +8 -12
  144. package/dist/features/preview/components/BlockThumbnail.js +176 -100
  145. package/dist/features/preview/components/CanvasPreview.js +243 -0
  146. package/dist/features/preview/components/CreatePageModal.js +128 -137
  147. package/dist/features/preview/components/DebouncedFieldEditor.js +29 -33
  148. package/dist/features/preview/components/DerivedLayoutDialog.js +21 -19
  149. package/dist/features/preview/components/DrillRow.js +150 -0
  150. package/dist/features/preview/components/FieldOverlayStyles.js +11 -8
  151. package/dist/features/preview/components/FieldToolbar.js +160 -110
  152. package/dist/features/preview/components/Frame.js +108 -20
  153. package/dist/features/preview/components/IconFieldEditor.js +62 -66
  154. package/dist/features/preview/components/ItemFieldsEditor.js +231 -205
  155. package/dist/features/preview/components/LinkFieldEditor.js +135 -139
  156. package/dist/features/preview/components/Metadata.js +22 -30
  157. package/dist/features/preview/components/MobilePreviewDrawer.js +89 -108
  158. package/dist/features/preview/components/MultipleAssetFieldEditor.js +334 -246
  159. package/dist/features/preview/components/OverlayTracker.js +9 -41
  160. package/dist/features/preview/components/Overlays.js +81 -69
  161. package/dist/features/preview/components/PageInfo.js +1748 -0
  162. package/dist/features/preview/components/PageInfoSkeleton.js +51 -0
  163. package/dist/features/preview/components/PageLocationFieldset.js +112 -116
  164. package/dist/features/preview/components/PageNavigatorHeader.js +24 -0
  165. package/dist/features/preview/components/PageNicknameField.js +22 -26
  166. package/dist/features/preview/components/PagePicker.js +128 -130
  167. package/dist/features/preview/components/PageTree.js +525 -532
  168. package/dist/features/preview/components/PreviewActivation.js +28 -32
  169. package/dist/features/preview/components/PreviewPanel.js +620 -319
  170. package/dist/features/preview/components/PreviewToolbar.js +105 -333
  171. package/dist/features/preview/components/RecordCard.js +80 -0
  172. package/dist/features/preview/components/RecordCombobox.js +178 -0
  173. package/dist/features/preview/components/ReferenceFieldEditor.js +149 -0
  174. package/dist/features/preview/components/ReferenceListFieldEditor.js +432 -0
  175. package/dist/features/preview/components/RemovedBlockPlaceholder.js +95 -0
  176. package/dist/features/preview/components/RepeatableItemsList.js +125 -138
  177. package/dist/features/preview/components/SelectionEditor.js +993 -0
  178. package/dist/features/preview/components/ShikiMarkdown.js +14 -18
  179. package/dist/features/preview/components/SidebarSection.js +52 -64
  180. package/dist/features/preview/components/StudioEditingFallback.js +56 -0
  181. package/dist/features/preview/components/UnlinkAssetButton.js +104 -107
  182. package/dist/features/preview/components/blockGridNavigation.js +15 -0
  183. package/dist/features/preview/components/contentFieldSchema.js +8 -0
  184. package/dist/features/preview/components/useFieldWriter.js +200 -0
  185. package/dist/features/preview/components/useRecordView.js +383 -0
  186. package/dist/features/preview/components/useRepeatableItemActions.js +35 -37
  187. package/dist/features/preview/components/useUpdateBlockPosition.js +37 -37
  188. package/dist/features/preview/editingFrame.js +197 -0
  189. package/dist/features/preview/overlayHighlights.js +17 -44
  190. package/dist/features/preview/overlayMessages.js +72 -1
  191. package/dist/features/preview/pageRecord.js +189 -0
  192. package/dist/features/preview/previewConstants.js +6 -2
  193. package/dist/features/preview/previewPageFrame.js +95 -0
  194. package/dist/features/preview/previewPreparation.js +7 -0
  195. package/dist/features/preview/previewSelection.js +32 -63
  196. package/dist/features/preview/previewStore.js +225 -123
  197. package/dist/features/preview/referencePickerFocus.js +29 -0
  198. package/dist/features/preview/repeatableItemTargets.js +56 -0
  199. package/dist/features/preview/selectionReveal.js +21 -0
  200. package/dist/features/preview/usePreviewViewportActions.js +114 -0
  201. package/dist/features/preview/viewportContinuity.js +109 -0
  202. package/dist/features/provider/AuthenticatedCamoxProvider.js +69 -44
  203. package/dist/features/provider/CamoxProvider.d.ts +3 -6
  204. package/dist/features/provider/CamoxProvider.js +38 -50
  205. package/dist/features/provider/CoreCamoxProvider.js +66 -50
  206. package/dist/features/provider/LocalhostPreviewProvider.js +78 -114
  207. package/dist/features/provider/PreviewSignInPage.js +54 -0
  208. package/dist/features/provider/components/CamoxAppContext.js +11 -11
  209. package/dist/features/provider/components/CommandPalette.js +75 -82
  210. package/dist/features/provider/useAdminShortcuts.js +7 -11
  211. package/dist/features/routes/pageRuntime.d.ts +44 -4
  212. package/dist/features/routes/pageRuntime.js +244 -137
  213. package/dist/features/runtime/RuntimeChrome.js +117 -115
  214. package/dist/features/runtime/alternates.js +64 -0
  215. package/dist/features/runtime/analytics.d.ts +7 -0
  216. package/dist/features/runtime/analytics.js +66 -0
  217. package/dist/features/runtime/artifactSources.js +87 -0
  218. package/dist/features/runtime/editingFallback.js +20 -0
  219. package/dist/features/runtime/linkPrefetch.js +97 -0
  220. package/dist/features/runtime/livePages.js +62 -0
  221. package/dist/features/runtime/llmsTxt.js +40 -0
  222. package/dist/features/runtime/loopbackFetch.js +18 -0
  223. package/dist/features/runtime/navigationAccessibility.js +51 -0
  224. package/dist/features/runtime/navigationTarget.js +23 -2
  225. package/dist/features/runtime/pageApp.js +229 -158
  226. package/dist/features/runtime/pageBlockTypes.js +20 -0
  227. package/dist/features/runtime/pageClient.d.ts +2 -4
  228. package/dist/features/runtime/pageClient.js +18 -3
  229. package/dist/features/runtime/pageNavigation.js +254 -32
  230. package/dist/features/runtime/pageServer.d.ts +2 -4
  231. package/dist/features/runtime/pageServer.js +6 -2
  232. package/dist/features/runtime/pageViewport.js +7 -0
  233. package/dist/features/runtime/runtime.d.ts +59 -24
  234. package/dist/features/runtime/runtime.js +779 -191
  235. package/dist/features/runtime/runtimeChromeLoader.js +58 -0
  236. package/dist/features/runtime/runtimeRoutes.d.ts +19 -0
  237. package/dist/features/runtime/runtimeRoutes.js +25 -0
  238. package/dist/features/runtime/scrollRestoration.js +133 -0
  239. package/dist/features/runtime/studioApp.d.ts +4 -3
  240. package/dist/features/runtime/studioApp.js +5 -9
  241. package/dist/features/runtime/studioClient.d.ts +2 -4
  242. package/dist/features/runtime/studioClient.js +12 -3
  243. package/dist/features/runtime/studioServer.d.ts +2 -4
  244. package/dist/features/runtime/studioServer.js +6 -1
  245. package/dist/features/runtime/worker.d.ts +6 -0
  246. package/dist/features/runtime/worker.js +23 -0
  247. package/dist/features/runtime/workerRequest.js +44 -0
  248. package/dist/features/studio/CamoxStudio.d.ts +2 -6
  249. package/dist/features/studio/CamoxStudio.js +34 -49
  250. package/dist/features/studio/FollowAgentProvider.js +338 -0
  251. package/dist/features/studio/components/ChatSidebar.js +356 -0
  252. package/dist/features/studio/components/DraftsControl.js +676 -0
  253. package/dist/features/studio/components/FaviconDialog.js +318 -0
  254. package/dist/features/studio/components/LocalePicker.js +785 -0
  255. package/dist/features/studio/components/Navbar.js +123 -103
  256. package/dist/features/studio/components/ProjectMenu.js +239 -260
  257. package/dist/features/studio/components/RenameDraftDialog.js +206 -0
  258. package/dist/features/studio/components/ReviewDraftSheet.js +1472 -0
  259. package/dist/features/studio/components/ThreadComposer.js +157 -0
  260. package/dist/features/studio/components/ThreadMarkdown.js +113 -0
  261. package/dist/features/studio/components/ThreadMessages.js +270 -0
  262. package/dist/features/studio/components/UserButton.js +34 -23
  263. package/dist/features/studio/draftLabel.js +33 -0
  264. package/dist/features/studio/draftNotice.js +13 -0
  265. package/dist/features/studio/followAgent.js +250 -0
  266. package/dist/features/studio/followAgentContext.js +7 -0
  267. package/dist/features/studio/localeOptions.js +118 -0
  268. package/dist/features/studio/localeSwitch.js +19 -0
  269. package/dist/features/studio/routes.js +48 -1
  270. package/dist/features/studio/studioStore.js +64 -1
  271. package/dist/features/studio/useTheme.js +24 -27
  272. package/dist/features/vite/artifactRuntimeMinification.js +36 -0
  273. package/dist/features/vite/blockBoilerplate.js +6 -5
  274. package/dist/features/vite/blockChunks.js +31 -0
  275. package/dist/features/vite/bundlerLogs.js +17 -0
  276. package/dist/features/vite/definitionsSync.js +158 -226
  277. package/dist/features/vite/devAuthentication.js +4 -16
  278. package/dist/features/vite/devSignIn.js +87 -0
  279. package/dist/features/vite/iconGeneration.js +1 -1
  280. package/dist/features/vite/layoutGeneration.js +11 -1
  281. package/dist/features/vite/publishSeededContent.js +30 -0
  282. package/dist/features/vite/routeGeneration.js +6 -7
  283. package/dist/features/vite/runtimeDev.js +80 -99
  284. package/dist/features/vite/vite.d.ts +51 -31
  285. package/dist/features/vite/vite.js +224 -127
  286. package/dist/features/vite/workerBuild.js +39 -0
  287. package/dist/hooks/use-debounced-field.js +116 -47
  288. package/dist/hooks/use-file-upload.js +114 -67
  289. package/dist/hooks/use-marquee-selection.js +32 -36
  290. package/dist/hooks/use-page-destinations.js +69 -37
  291. package/dist/lib/api-client-server.d.ts +5 -0
  292. package/dist/lib/api-client-server.js +10 -4
  293. package/dist/lib/api-client.d.ts +6 -0
  294. package/dist/lib/api-client.js +51 -16
  295. package/dist/lib/api-socket.js +17 -0
  296. package/dist/lib/auth-page-styles.js +39 -0
  297. package/dist/lib/auth.js +117 -61
  298. package/dist/lib/collection-cache.js +23 -0
  299. package/dist/lib/draft-scope.d.ts +4 -0
  300. package/dist/lib/draft-scope.js +222 -0
  301. package/dist/lib/html.js +12 -0
  302. package/dist/lib/link-pages.js +154 -0
  303. package/dist/lib/locale-path.d.ts +22 -0
  304. package/dist/lib/locale-path.js +57 -0
  305. package/dist/lib/normalized-data.js +252 -152
  306. package/dist/lib/preview-handoff.js +2 -2
  307. package/dist/lib/queries.d.ts +11 -0
  308. package/dist/lib/queries.js +70 -141
  309. package/dist/lib/studio-reads.d.ts +14 -0
  310. package/dist/lib/studio-reads.js +574 -0
  311. package/dist/lib/use-project-room.js +50 -50
  312. package/dist/lib/use-thread.js +310 -0
  313. package/dist/lib/utils.js +25 -29
  314. package/dist/lib/view-locale-context.js +22 -0
  315. package/dist/lib/view-locale.js +46 -0
  316. package/dist/package.js +5 -0
  317. package/dist/studio-overlays.css +41 -151
  318. package/dist/studio.css +2 -2
  319. package/package.json +70 -73
  320. package/skills/camox/SKILL.md +16 -11
  321. package/skills/camox/references/artifacts.md +179 -0
  322. package/skills/camox/references/block-definitions.md +75 -59
  323. package/skills/camox/references/cli-common.md +9 -11
  324. package/skills/camox/references/cli-content.md +92 -69
  325. package/skills/camox/references/cli-publishing.md +26 -0
  326. package/skills/camox/references/dom-integrations.md +27 -0
  327. package/skills/camox/references/field-styling.md +4 -4
  328. package/skills/camox/references/layout-definitions.md +16 -14
  329. package/skills/camox/references/localization.md +56 -0
  330. package/skills/camox/references/routed-layouts.md +133 -15
  331. package/skills/camox-expand/SKILL.md +69 -0
  332. package/skills/camox-expand/references/jobs.md +39 -0
  333. package/skills/camoxify/SKILL.md +29 -7
  334. package/dist/core/components/AddBlockControlBar.js +0 -78
  335. package/dist/core/hooks/useRequireDraftSource.js +0 -23
  336. package/dist/features/metadata/sitemap.d.ts +0 -8
  337. package/dist/features/metadata/sitemap.js +0 -17
  338. package/dist/features/og/imageResponse.node.d.ts +0 -12
  339. package/dist/features/og/imageResponse.node.js +0 -49
  340. package/dist/features/og/imageResponse.workerd.d.ts +0 -12
  341. package/dist/features/og/imageResponse.workerd.js +0 -40
  342. package/dist/features/page/PublishedPageContent.js +0 -205
  343. package/dist/features/page/PublishedPageExperience.js +0 -23
  344. package/dist/features/preview/DerivedPreview.js +0 -134
  345. package/dist/features/preview/commentsEnabled.js +0 -8
  346. package/dist/features/preview/components/AddBlockSidebar.js +0 -381
  347. package/dist/features/preview/components/AttachedComments.js +0 -331
  348. package/dist/features/preview/components/CommentHeader.js +0 -122
  349. package/dist/features/preview/components/CommentSidebar.js +0 -29
  350. package/dist/features/preview/components/CommentTargetQuote.js +0 -167
  351. package/dist/features/preview/components/DerivedLayoutSidebar.d.ts +0 -5
  352. package/dist/features/preview/components/DerivedLayoutSidebar.js +0 -179
  353. package/dist/features/preview/components/DerivedPageInfoSidebar.js +0 -69
  354. package/dist/features/preview/components/LeftSidebar.js +0 -68
  355. package/dist/features/preview/components/PageEditorSidebar.js +0 -563
  356. package/dist/features/preview/components/PageInfoSidebar.js +0 -1551
  357. package/dist/features/preview/components/PageNavigatorSidebar.js +0 -78
  358. package/dist/features/preview/components/PageStatusBadge.js +0 -97
  359. package/dist/features/preview/components/PeekedBlock.js +0 -217
  360. package/dist/features/preview/components/PreviewComments.js +0 -56
  361. package/dist/features/preview/components/PreviewToolbarSpacer.js +0 -43
  362. package/dist/features/preview/components/PublicationRow.js +0 -422
  363. package/dist/features/preview/components/PublishDialog.js +0 -194
  364. package/dist/features/preview/components/RightSidebar.js +0 -59
  365. package/dist/features/preview/components/SendFeedbackDialog.js +0 -83
  366. package/dist/features/preview/previewCommentsStore.js +0 -135
  367. package/dist/features/preview/publication.js +0 -81
  368. package/dist/features/preview/usePageComments.js +0 -39
  369. package/dist/features/runtime/SharedChromeContext.js +0 -7
  370. package/dist/features/studio/components/EnvironmentMenu.js +0 -425
  371. package/dist/features/vite/appGeneration.js +0 -89
  372. package/dist/lib/view-queries.js +0 -28
  373. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/Matches.d.ts +0 -114
  374. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/RouterProvider.d.ts +0 -25
  375. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/config.d.ts +0 -1
  376. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/defer.d.ts +0 -1
  377. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/fileRoute.d.ts +0 -20
  378. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/global.d.ts +0 -8
  379. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/hash-scroll.d.ts +0 -1
  380. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/index.d.ts +0 -18
  381. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/link.d.ts +0 -161
  382. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/load-matches.d.ts +0 -6
  383. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/location.d.ts +0 -54
  384. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/lru-cache.d.ts +0 -8
  385. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/manifest.d.ts +0 -32
  386. 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
  387. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/not-found.d.ts +0 -1
  388. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/redirect.d.ts +0 -49
  389. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/rewrite.d.ts +0 -1
  390. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/root.d.ts +0 -6
  391. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/route.d.ts +0 -343
  392. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/routeInfo.d.ts +0 -48
  393. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/router.d.ts +0 -695
  394. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/scroll-restoration.d.ts +0 -1
  395. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/searchMiddleware.d.ts +0 -1
  396. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/searchParams.d.ts +0 -5
  397. 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
  398. 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
  399. 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
  400. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/stores.d.ts +0 -69
  401. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/structuralSharing.d.ts +0 -1
  402. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/typePrimitives.d.ts +0 -1
  403. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useLoaderData.d.ts +0 -1
  404. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useLoaderDeps.d.ts +0 -1
  405. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useNavigate.d.ts +0 -10
  406. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useParams.d.ts +0 -1
  407. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useRouteContext.d.ts +0 -1
  408. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useSearch.d.ts +0 -1
  409. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/utils.d.ts +0 -28
  410. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/validators.d.ts +0 -49
  411. package/skills/camox/references/cli-environments.md +0 -37
@@ -1,17 +1,19 @@
1
- import { usePageBlocks } from "../../../lib/normalized-data.js";
2
1
  import { useCamoxApp } from "../../provider/components/CamoxAppContext.js";
2
+ import { usePageBlocks } from "../../../lib/normalized-data.js";
3
3
  import { cn } from "../../../lib/utils.js";
4
- import { previewStore, selectPreviewSource } from "../previewStore.js";
5
- import { useRequireDraftSource } from "../../../core/hooks/useRequireDraftSource.js";
4
+ import { previewStore, selectionBlockId, selectionForOwner } from "../previewStore.js";
5
+ import { useEditingFrame } from "../editingFrame.js";
6
+ import { PreviewEditingOwnerContext } from "../previewSelection.js";
6
7
  import { useUpdateBlockPosition } from "./useUpdateBlockPosition.js";
7
8
  import { BlockActionsPopover } from "./BlockActionsPopover.js";
8
9
  import { usePreviewedPage } from "../CamoxPreview.js";
9
10
  import { c } from "react/compiler-runtime";
10
11
  import * as React from "react";
11
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
12
12
  import { useSelector } from "@xstate/store-react";
13
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
13
14
  import { Button } from "@camox/ui/button";
14
- import { Ellipsis, GripVertical, LayoutTemplate, Plus } from "lucide-react";
15
+ import { Label } from "@camox/ui/label";
16
+ import { ChevronsUpDown, Ellipsis, GripVertical, LayoutTemplate, Plus } from "lucide-react";
15
17
  import { Tooltip, TooltipContent, TooltipTrigger } from "@camox/ui/tooltip";
16
18
  import { DndContext, DragOverlay, KeyboardSensor, PointerSensor, closestCenter, useSensor, useSensors } from "@dnd-kit/core";
17
19
  import { restrictToVerticalAxis } from "@dnd-kit/modifiers";
@@ -19,75 +21,71 @@ import { SortableContext, defaultAnimateLayoutChanges, sortableKeyboardCoordinat
19
21
  import { CSS } from "@dnd-kit/utilities";
20
22
 
21
23
  //#region src/features/preview/components/PageTree.tsx
22
- const usePreviewSource = () => {
23
- const $ = c(1);
24
- if ($[0] !== "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a") {
25
- for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
26
- $[0] = "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a";
27
- }
28
- return useSelector(previewStore, selectPreviewSource);
29
- };
30
24
  function useBlockTreeItem(block, t0) {
31
- const $ = c(17);
32
- if ($[0] !== "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a") {
33
- for (let $i = 0; $i < 17; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
34
- $[0] = "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a";
35
- }
25
+ const $ = c(21);
36
26
  const isDragging = t0 === void 0 ? false : t0;
27
+ const owner = React.useContext(PreviewEditingOwnerContext);
37
28
  const [ellipsisPopoverOpen, setEllipsisPopoverOpen] = React.useState(false);
38
- const selection = useSelector(previewStore, _temp);
39
- const iframeElement = useSelector(previewStore, _temp2);
40
- const isBlockActive = selection?.blockId === block.id;
29
+ let t1;
30
+ if ($[0] !== owner) {
31
+ t1 = (state) => selectionForOwner(state.context, owner);
32
+ $[0] = owner;
33
+ $[1] = t1;
34
+ } else t1 = $[1];
35
+ const selection = useSelector(previewStore, t1);
36
+ const { send } = useEditingFrame();
37
+ let t2;
38
+ if ($[2] !== selection) {
39
+ t2 = selectionBlockId(selection);
40
+ $[2] = selection;
41
+ $[3] = t2;
42
+ } else t2 = $[3];
43
+ const isBlockActive = t2 === block.id;
41
44
  const isBlockSelected = selection?.type === "block" && selection.blockId === block.id;
42
45
  const shouldShowHover = !isDragging && !isBlockActive;
43
46
  const shouldShowActive = isDragging || isBlockActive;
44
- let t1;
45
- if ($[1] !== block.id || $[2] !== iframeElement) {
46
- t1 = () => {
47
- if (!iframeElement?.contentWindow) return;
48
- const message = {
49
- type: "CAMOX_HOVER_BLOCK",
50
- blockId: String(block.id)
51
- };
52
- iframeElement.contentWindow.postMessage(message, "*");
53
- };
54
- $[1] = block.id;
55
- $[2] = iframeElement;
56
- $[3] = t1;
57
- } else t1 = $[3];
58
- const handleBlockMouseEnter = t1;
59
- let t2;
60
- if ($[4] !== block.id || $[5] !== iframeElement) {
61
- t2 = () => {
62
- if (!iframeElement?.contentWindow) return;
63
- const message_0 = {
64
- type: "CAMOX_HOVER_BLOCK_END",
65
- blockId: String(block.id)
66
- };
67
- iframeElement.contentWindow.postMessage(message_0, "*");
68
- };
69
- $[4] = block.id;
70
- $[5] = iframeElement;
71
- $[6] = t2;
72
- } else t2 = $[6];
73
- const handleBlockMouseLeave = t2;
74
47
  let t3;
75
- if ($[7] !== block.id || $[8] !== isBlockSelected) {
76
- t3 = () => {
48
+ if ($[4] !== block.id || $[5] !== send) {
49
+ t3 = () => send({
50
+ type: "CAMOX_HOVER_BLOCK",
51
+ blockId: block.id
52
+ });
53
+ $[4] = block.id;
54
+ $[5] = send;
55
+ $[6] = t3;
56
+ } else t3 = $[6];
57
+ const handleBlockMouseEnter = t3;
58
+ let t4;
59
+ if ($[7] !== block.id || $[8] !== send) {
60
+ t4 = () => send({
61
+ type: "CAMOX_HOVER_BLOCK_END",
62
+ blockId: block.id
63
+ });
64
+ $[7] = block.id;
65
+ $[8] = send;
66
+ $[9] = t4;
67
+ } else t4 = $[9];
68
+ const handleBlockMouseLeave = t4;
69
+ let t5;
70
+ if ($[10] !== block.id || $[11] !== isBlockSelected || $[12] !== owner) {
71
+ t5 = () => {
72
+ if (!owner) return;
77
73
  if (isBlockSelected) previewStore.send({ type: "clearSelection" });
78
74
  else previewStore.send({
79
75
  type: "setFocusedBlock",
76
+ ...owner,
80
77
  blockId: block.id
81
78
  });
82
79
  };
83
- $[7] = block.id;
84
- $[8] = isBlockSelected;
85
- $[9] = t3;
86
- } else t3 = $[9];
87
- const toggleSelection = t3;
88
- let t4;
89
- if ($[10] !== ellipsisPopoverOpen || $[11] !== handleBlockMouseEnter || $[12] !== handleBlockMouseLeave || $[13] !== shouldShowActive || $[14] !== shouldShowHover || $[15] !== toggleSelection) {
90
- t4 = {
80
+ $[10] = block.id;
81
+ $[11] = isBlockSelected;
82
+ $[12] = owner;
83
+ $[13] = t5;
84
+ } else t5 = $[13];
85
+ const toggleSelection = t5;
86
+ let t6;
87
+ if ($[14] !== ellipsisPopoverOpen || $[15] !== handleBlockMouseEnter || $[16] !== handleBlockMouseLeave || $[17] !== shouldShowActive || $[18] !== shouldShowHover || $[19] !== toggleSelection) {
88
+ t6 = {
91
89
  ellipsisPopoverOpen,
92
90
  setEllipsisPopoverOpen,
93
91
  shouldShowHover,
@@ -96,91 +94,77 @@ function useBlockTreeItem(block, t0) {
96
94
  handleBlockMouseLeave,
97
95
  toggleSelection
98
96
  };
99
- $[10] = ellipsisPopoverOpen;
100
- $[11] = handleBlockMouseEnter;
101
- $[12] = handleBlockMouseLeave;
102
- $[13] = shouldShowActive;
103
- $[14] = shouldShowHover;
104
- $[15] = toggleSelection;
105
- $[16] = t4;
106
- } else t4 = $[16];
107
- return t4;
108
- }
109
- function _temp2(state_0) {
110
- return state_0.context.iframeElement;
111
- }
112
- function _temp(state) {
113
- return state.context.selection;
97
+ $[14] = ellipsisPopoverOpen;
98
+ $[15] = handleBlockMouseEnter;
99
+ $[16] = handleBlockMouseLeave;
100
+ $[17] = shouldShowActive;
101
+ $[18] = shouldShowHover;
102
+ $[19] = toggleSelection;
103
+ $[20] = t6;
104
+ } else t6 = $[20];
105
+ return t6;
114
106
  }
115
107
  const BlockTreeItemHeader = (t0) => {
116
- const $ = c(17);
117
- if ($[0] !== "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a") {
118
- for (let $i = 0; $i < 17; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
119
- $[0] = "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a";
120
- }
108
+ const $ = c(16);
121
109
  let children;
122
110
  let className;
123
111
  let props;
124
112
  let ref;
125
113
  let shouldShowActive;
126
114
  let shouldShowHover;
127
- if ($[1] !== t0) {
115
+ if ($[0] !== t0) {
128
116
  ({children, shouldShowHover, shouldShowActive, className, ref, ...props} = t0);
129
- $[1] = t0;
130
- $[2] = children;
131
- $[3] = className;
132
- $[4] = props;
133
- $[5] = ref;
134
- $[6] = shouldShowActive;
135
- $[7] = shouldShowHover;
117
+ $[0] = t0;
118
+ $[1] = children;
119
+ $[2] = className;
120
+ $[3] = props;
121
+ $[4] = ref;
122
+ $[5] = shouldShowActive;
123
+ $[6] = shouldShowHover;
136
124
  } else {
137
- children = $[2];
138
- className = $[3];
139
- props = $[4];
140
- ref = $[5];
141
- shouldShowActive = $[6];
142
- shouldShowHover = $[7];
125
+ children = $[1];
126
+ className = $[2];
127
+ props = $[3];
128
+ ref = $[4];
129
+ shouldShowActive = $[5];
130
+ shouldShowHover = $[6];
143
131
  }
144
132
  const t1 = shouldShowHover && "hover:bg-accent/75";
145
133
  const t2 = shouldShowActive && "bg-accent text-accent-foreground";
146
134
  let t3;
147
- if ($[8] !== className || $[9] !== t1 || $[10] !== t2) {
135
+ if ($[7] !== className || $[8] !== t1 || $[9] !== t2) {
148
136
  t3 = cn("flex flex-row justify-between items-center gap-1 px-1 max-w-full rounded-lg text-foreground transition-all hover:transition-none", t1, t2, className);
149
- $[8] = className;
150
- $[9] = t1;
151
- $[10] = t2;
152
- $[11] = t3;
153
- } else t3 = $[11];
137
+ $[7] = className;
138
+ $[8] = t1;
139
+ $[9] = t2;
140
+ $[10] = t3;
141
+ } else t3 = $[10];
154
142
  let t4;
155
- if ($[12] !== children || $[13] !== props || $[14] !== ref || $[15] !== t3) {
143
+ if ($[11] !== children || $[12] !== props || $[13] !== ref || $[14] !== t3) {
156
144
  t4 = /* @__PURE__ */ jsx("div", {
157
145
  ref,
158
146
  className: t3,
159
147
  ...props,
160
148
  children
161
149
  });
162
- $[12] = children;
163
- $[13] = props;
164
- $[14] = ref;
165
- $[15] = t3;
166
- $[16] = t4;
167
- } else t4 = $[16];
150
+ $[11] = children;
151
+ $[12] = props;
152
+ $[13] = ref;
153
+ $[14] = t3;
154
+ $[15] = t4;
155
+ } else t4 = $[15];
168
156
  return t4;
169
157
  };
170
158
  const BlockTreeItemTrigger = (t0) => {
171
- const $ = c(5);
172
- if ($[0] !== "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a") {
173
- for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
174
- $[0] = "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a";
175
- }
159
+ const $ = c(4);
176
160
  const { displayText, onClick } = t0;
177
161
  let t1;
178
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
162
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
179
163
  t1 = cn("cursor-default flex-1 truncate py-2 text-sm text-left rounded-sm min-w-0", "focus-visible:underline outline-none focus-visible:decoration-ring/50 focus-visible:decoration-4");
180
- $[1] = t1;
181
- } else t1 = $[1];
164
+ $[0] = t1;
165
+ } else t1 = $[0];
182
166
  let t2;
183
- if ($[2] !== displayText || $[3] !== onClick) {
167
+ if ($[1] !== displayText || $[2] !== onClick) {
184
168
  t2 = /* @__PURE__ */ jsx("button", {
185
169
  type: "button",
186
170
  className: t1,
@@ -188,47 +172,43 @@ const BlockTreeItemTrigger = (t0) => {
188
172
  onClick,
189
173
  children: displayText
190
174
  });
191
- $[2] = displayText;
192
- $[3] = onClick;
193
- $[4] = t2;
194
- } else t2 = $[4];
175
+ $[1] = displayText;
176
+ $[2] = onClick;
177
+ $[3] = t2;
178
+ } else t2 = $[3];
195
179
  return t2;
196
180
  };
197
181
  const BlockTreeItemEllipsis = (t0) => {
198
- const $ = c(12);
199
- if ($[0] !== "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a") {
200
- for (let $i = 0; $i < 12; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
201
- $[0] = "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a";
202
- }
182
+ const $ = c(11);
203
183
  let className;
204
184
  let open;
205
185
  let props;
206
- if ($[1] !== t0) {
186
+ if ($[0] !== t0) {
207
187
  ({open, className, ...props} = t0);
208
- $[1] = t0;
209
- $[2] = className;
210
- $[3] = open;
211
- $[4] = props;
188
+ $[0] = t0;
189
+ $[1] = className;
190
+ $[2] = open;
191
+ $[3] = props;
212
192
  } else {
213
- className = $[2];
214
- open = $[3];
215
- props = $[4];
193
+ className = $[1];
194
+ open = $[2];
195
+ props = $[3];
216
196
  }
217
197
  const t1 = open ? "flex" : "hidden group-hover:flex group-focus-within:flex";
218
198
  let t2;
219
- if ($[5] !== className || $[6] !== t1) {
199
+ if ($[4] !== className || $[5] !== t1) {
220
200
  t2 = cn("text-muted-foreground hover:text-foreground", t1, className);
221
- $[5] = className;
222
- $[6] = t1;
223
- $[7] = t2;
224
- } else t2 = $[7];
201
+ $[4] = className;
202
+ $[5] = t1;
203
+ $[6] = t2;
204
+ } else t2 = $[6];
225
205
  let t3;
226
- if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
206
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
227
207
  t3 = /* @__PURE__ */ jsx(Ellipsis, { className: "size-4" });
228
- $[8] = t3;
229
- } else t3 = $[8];
208
+ $[7] = t3;
209
+ } else t3 = $[7];
230
210
  let t4;
231
- if ($[9] !== props || $[10] !== t2) {
211
+ if ($[8] !== props || $[9] !== t2) {
232
212
  t4 = /* @__PURE__ */ jsx(Button, {
233
213
  variant: "ghost",
234
214
  size: "icon-sm",
@@ -236,10 +216,10 @@ const BlockTreeItemEllipsis = (t0) => {
236
216
  ...props,
237
217
  children: t3
238
218
  });
239
- $[9] = props;
240
- $[10] = t2;
241
- $[11] = t4;
242
- } else t4 = $[11];
219
+ $[8] = props;
220
+ $[9] = t2;
221
+ $[10] = t4;
222
+ } else t4 = $[10];
243
223
  return t4;
244
224
  };
245
225
  const animateLayoutChanges = (args) => {
@@ -248,121 +228,116 @@ const animateLayoutChanges = (args) => {
248
228
  return defaultAnimateLayoutChanges(args);
249
229
  };
250
230
  const SortableBlock = (t0) => {
251
- const $ = c(38);
252
- if ($[0] !== "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a") {
253
- for (let $i = 0; $i < 38; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
254
- $[0] = "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a";
255
- }
231
+ const $ = c(37);
256
232
  const { block } = t0;
257
233
  const [gripPopoverOpen, setGripPopoverOpen] = React.useState(false);
258
- const t1 = String(block.id);
259
- let t2;
260
- if ($[1] !== t1) {
261
- t2 = {
262
- id: t1,
234
+ let t1;
235
+ if ($[0] !== block.id) {
236
+ t1 = {
237
+ id: block.id,
263
238
  animateLayoutChanges
264
239
  };
240
+ $[0] = block.id;
265
241
  $[1] = t1;
266
- $[2] = t2;
267
- } else t2 = $[2];
268
- const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable(t2);
269
- let t3;
270
- if ($[3] !== transform) {
271
- t3 = CSS.Transform.toString(transform);
272
- $[3] = transform;
273
- $[4] = t3;
274
- } else t3 = $[4];
275
- const t4 = isDragging ? 0 : 1;
276
- let t5;
277
- if ($[5] !== t3 || $[6] !== t4 || $[7] !== transition) {
278
- t5 = {
279
- transform: t3,
242
+ } else t1 = $[1];
243
+ const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable(t1);
244
+ let t2;
245
+ if ($[2] !== transform) {
246
+ t2 = CSS.Transform.toString(transform);
247
+ $[2] = transform;
248
+ $[3] = t2;
249
+ } else t2 = $[3];
250
+ const t3 = isDragging ? 0 : 1;
251
+ let t4;
252
+ if ($[4] !== t2 || $[5] !== t3 || $[6] !== transition) {
253
+ t4 = {
254
+ transform: t2,
280
255
  transition,
281
- opacity: t4
256
+ opacity: t3
282
257
  };
258
+ $[4] = t2;
283
259
  $[5] = t3;
284
- $[6] = t4;
285
- $[7] = transition;
286
- $[8] = t5;
287
- } else t5 = $[8];
288
- const style = t5;
260
+ $[6] = transition;
261
+ $[7] = t4;
262
+ } else t4 = $[7];
263
+ const style = t4;
289
264
  const ctx = useBlockTreeItem(block, isDragging);
265
+ let t5;
290
266
  let t6;
291
- let t7;
292
- if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
293
- t6 = /* @__PURE__ */ jsx("span", {
267
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
268
+ t5 = /* @__PURE__ */ jsx("span", {
294
269
  className: "sr-only",
295
270
  children: "Click and use arrow keys to reorder"
296
271
  });
297
- t7 = /* @__PURE__ */ jsx(GripVertical, { className: "h-4 w-4" });
272
+ t6 = /* @__PURE__ */ jsx(GripVertical, { className: "h-4 w-4" });
273
+ $[8] = t5;
298
274
  $[9] = t6;
299
- $[10] = t7;
300
275
  } else {
276
+ t5 = $[8];
301
277
  t6 = $[9];
302
- t7 = $[10];
303
278
  }
304
- let t8;
305
- if ($[11] !== attributes || $[12] !== listeners) {
306
- t8 = /* @__PURE__ */ jsxs(Button, {
279
+ let t7;
280
+ if ($[10] !== attributes || $[11] !== listeners) {
281
+ t7 = /* @__PURE__ */ jsxs(Button, {
307
282
  variant: "ghost",
308
283
  size: "icon-sm",
309
284
  className: "text-muted-foreground hover:text-foreground flex cursor-grab active:cursor-grabbing",
310
285
  ...attributes,
311
286
  ...listeners,
312
- children: [t6, t7]
287
+ children: [t5, t6]
313
288
  });
314
- $[11] = attributes;
315
- $[12] = listeners;
316
- $[13] = t8;
317
- } else t8 = $[13];
318
- const gripButton = t8;
319
- let t9;
320
- if ($[14] !== block || $[15] !== gripButton || $[16] !== gripPopoverOpen) {
321
- t9 = /* @__PURE__ */ jsx(BlockActionsPopover, {
289
+ $[10] = attributes;
290
+ $[11] = listeners;
291
+ $[12] = t7;
292
+ } else t7 = $[12];
293
+ const gripButton = t7;
294
+ let t8;
295
+ if ($[13] !== block || $[14] !== gripButton || $[15] !== gripPopoverOpen) {
296
+ t8 = /* @__PURE__ */ jsx(BlockActionsPopover, {
322
297
  block,
323
298
  open: gripPopoverOpen,
324
299
  onOpenChange: setGripPopoverOpen,
325
300
  children: gripButton
326
301
  });
327
- $[14] = block;
328
- $[15] = gripButton;
329
- $[16] = gripPopoverOpen;
330
- $[17] = t9;
331
- } else t9 = $[17];
332
- const t10 = block.summary || block.type;
333
- let t11;
334
- if ($[18] !== ctx.toggleSelection || $[19] !== t10) {
335
- t11 = /* @__PURE__ */ jsx(BlockTreeItemTrigger, {
336
- displayText: t10,
302
+ $[13] = block;
303
+ $[14] = gripButton;
304
+ $[15] = gripPopoverOpen;
305
+ $[16] = t8;
306
+ } else t8 = $[16];
307
+ const t9 = block.summary || block.type;
308
+ let t10;
309
+ if ($[17] !== ctx.toggleSelection || $[18] !== t9) {
310
+ t10 = /* @__PURE__ */ jsx(BlockTreeItemTrigger, {
311
+ displayText: t9,
337
312
  onClick: ctx.toggleSelection
338
313
  });
339
- $[18] = ctx.toggleSelection;
314
+ $[17] = ctx.toggleSelection;
315
+ $[18] = t9;
340
316
  $[19] = t10;
341
- $[20] = t11;
342
- } else t11 = $[20];
317
+ } else t10 = $[19];
318
+ let t11;
319
+ if ($[20] !== ctx.ellipsisPopoverOpen) {
320
+ t11 = /* @__PURE__ */ jsx(BlockTreeItemEllipsis, { open: ctx.ellipsisPopoverOpen });
321
+ $[20] = ctx.ellipsisPopoverOpen;
322
+ $[21] = t11;
323
+ } else t11 = $[21];
343
324
  let t12;
344
- if ($[21] !== ctx.ellipsisPopoverOpen) {
345
- t12 = /* @__PURE__ */ jsx(BlockTreeItemEllipsis, { open: ctx.ellipsisPopoverOpen });
346
- $[21] = ctx.ellipsisPopoverOpen;
347
- $[22] = t12;
348
- } else t12 = $[22];
349
- let t13;
350
- if ($[23] !== block || $[24] !== ctx.ellipsisPopoverOpen || $[25] !== ctx.setEllipsisPopoverOpen || $[26] !== t12) {
351
- t13 = /* @__PURE__ */ jsx(BlockActionsPopover, {
325
+ if ($[22] !== block || $[23] !== ctx.ellipsisPopoverOpen || $[24] !== ctx.setEllipsisPopoverOpen || $[25] !== t11) {
326
+ t12 = /* @__PURE__ */ jsx(BlockActionsPopover, {
352
327
  block,
353
328
  open: ctx.ellipsisPopoverOpen,
354
329
  onOpenChange: ctx.setEllipsisPopoverOpen,
355
- children: t12
330
+ children: t11
356
331
  });
357
- $[23] = block;
358
- $[24] = ctx.ellipsisPopoverOpen;
359
- $[25] = ctx.setEllipsisPopoverOpen;
332
+ $[22] = block;
333
+ $[23] = ctx.ellipsisPopoverOpen;
334
+ $[24] = ctx.setEllipsisPopoverOpen;
335
+ $[25] = t11;
360
336
  $[26] = t12;
361
- $[27] = t13;
362
- } else t13 = $[27];
363
- let t14;
364
- if ($[28] !== ctx.handleBlockMouseEnter || $[29] !== ctx.handleBlockMouseLeave || $[30] !== ctx.shouldShowActive || $[31] !== ctx.shouldShowHover || $[32] !== setNodeRef || $[33] !== style || $[34] !== t11 || $[35] !== t13 || $[36] !== t9) {
365
- t14 = /* @__PURE__ */ jsxs(BlockTreeItemHeader, {
337
+ } else t12 = $[26];
338
+ let t13;
339
+ if ($[27] !== ctx.handleBlockMouseEnter || $[28] !== ctx.handleBlockMouseLeave || $[29] !== ctx.shouldShowActive || $[30] !== ctx.shouldShowHover || $[31] !== setNodeRef || $[32] !== style || $[33] !== t10 || $[34] !== t12 || $[35] !== t8) {
340
+ t13 = /* @__PURE__ */ jsxs(BlockTreeItemHeader, {
366
341
  ref: setNodeRef,
367
342
  style,
368
343
  className: "group",
@@ -371,65 +346,61 @@ const SortableBlock = (t0) => {
371
346
  onMouseEnter: ctx.handleBlockMouseEnter,
372
347
  onMouseLeave: ctx.handleBlockMouseLeave,
373
348
  children: [
374
- t9,
375
- t11,
376
- t13
349
+ t8,
350
+ t10,
351
+ t12
377
352
  ]
378
353
  });
379
- $[28] = ctx.handleBlockMouseEnter;
380
- $[29] = ctx.handleBlockMouseLeave;
381
- $[30] = ctx.shouldShowActive;
382
- $[31] = ctx.shouldShowHover;
383
- $[32] = setNodeRef;
384
- $[33] = style;
385
- $[34] = t11;
386
- $[35] = t13;
387
- $[36] = t9;
388
- $[37] = t14;
389
- } else t14 = $[37];
390
- return t14;
354
+ $[27] = ctx.handleBlockMouseEnter;
355
+ $[28] = ctx.handleBlockMouseLeave;
356
+ $[29] = ctx.shouldShowActive;
357
+ $[30] = ctx.shouldShowHover;
358
+ $[31] = setNodeRef;
359
+ $[32] = style;
360
+ $[33] = t10;
361
+ $[34] = t12;
362
+ $[35] = t8;
363
+ $[36] = t13;
364
+ } else t13 = $[36];
365
+ return t13;
391
366
  };
392
367
  const LayoutBlockItem = (t0) => {
393
- const $ = c(27);
394
- if ($[0] !== "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a") {
395
- for (let $i = 0; $i < 27; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
396
- $[0] = "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a";
397
- }
398
- const { block, layoutName, derived: t1 } = t0;
399
- const derived = t1 === void 0 ? false : t1;
368
+ const $ = c(26);
369
+ const { block, layoutName, withActions: t1 } = t0;
370
+ const withActions = t1 === void 0 ? true : t1;
400
371
  const camoxApp = useCamoxApp();
401
372
  let t2;
402
- if ($[1] !== block.type || $[2] !== camoxApp) {
373
+ if ($[0] !== block.type || $[1] !== camoxApp) {
403
374
  t2 = camoxApp.getBlockById(block.type);
404
- $[1] = block.type;
405
- $[2] = camoxApp;
406
- $[3] = t2;
407
- } else t2 = $[3];
375
+ $[0] = block.type;
376
+ $[1] = camoxApp;
377
+ $[2] = t2;
378
+ } else t2 = $[2];
408
379
  const blockDef = t2;
409
380
  const ctx = useBlockTreeItem(block);
410
381
  const displayText = blockDef?._internal.title ?? block.type;
411
382
  let t3;
412
- if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
383
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
413
384
  t3 = /* @__PURE__ */ jsx(TooltipTrigger, { children: /* @__PURE__ */ jsx(LayoutTemplate, { className: "h-4 w-4" }) });
414
- $[4] = t3;
415
- } else t3 = $[4];
385
+ $[3] = t3;
386
+ } else t3 = $[3];
416
387
  let t4;
417
- if ($[5] !== layoutName) {
388
+ if ($[4] !== layoutName) {
418
389
  t4 = /* @__PURE__ */ jsx("span", {
419
390
  className: "font-semibold",
420
391
  children: layoutName
421
392
  });
422
- $[5] = layoutName;
423
- $[6] = t4;
424
- } else t4 = $[6];
393
+ $[4] = layoutName;
394
+ $[5] = t4;
395
+ } else t4 = $[5];
425
396
  let t5;
426
- if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
397
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
427
398
  t5 = /* @__PURE__ */ jsx("br", {});
428
- $[7] = t5;
429
- } else t5 = $[7];
399
+ $[6] = t5;
400
+ } else t5 = $[6];
430
401
  const t6 = blockDef?._internal.synced ? "Synced: editing this block updates it across all layouts and pages" : "Changing the content may affect other pages";
431
402
  let t7;
432
- if ($[8] !== t4 || $[9] !== t6) {
403
+ if ($[7] !== t4 || $[8] !== t6) {
433
404
  t7 = /* @__PURE__ */ jsx("div", {
434
405
  className: "text-muted-foreground flex size-8 shrink-0 items-center justify-center",
435
406
  children: /* @__PURE__ */ jsxs(Tooltip, { children: [t3, /* @__PURE__ */ jsxs(TooltipContent, { children: [
@@ -440,38 +411,38 @@ const LayoutBlockItem = (t0) => {
440
411
  t6
441
412
  ] })] })
442
413
  });
443
- $[8] = t4;
444
- $[9] = t6;
445
- $[10] = t7;
446
- } else t7 = $[10];
414
+ $[7] = t4;
415
+ $[8] = t6;
416
+ $[9] = t7;
417
+ } else t7 = $[9];
447
418
  let t8;
448
- if ($[11] !== ctx.toggleSelection || $[12] !== displayText) {
419
+ if ($[10] !== ctx.toggleSelection || $[11] !== displayText) {
449
420
  t8 = /* @__PURE__ */ jsx(BlockTreeItemTrigger, {
450
421
  displayText,
451
422
  onClick: ctx.toggleSelection
452
423
  });
453
- $[11] = ctx.toggleSelection;
454
- $[12] = displayText;
455
- $[13] = t8;
456
- } else t8 = $[13];
424
+ $[10] = ctx.toggleSelection;
425
+ $[11] = displayText;
426
+ $[12] = t8;
427
+ } else t8 = $[12];
457
428
  let t9;
458
- if ($[14] !== block || $[15] !== ctx.ellipsisPopoverOpen || $[16] !== ctx.setEllipsisPopoverOpen || $[17] !== derived) {
459
- t9 = !derived && /* @__PURE__ */ jsx(BlockActionsPopover, {
429
+ if ($[13] !== block || $[14] !== ctx.ellipsisPopoverOpen || $[15] !== ctx.setEllipsisPopoverOpen || $[16] !== withActions) {
430
+ t9 = withActions && /* @__PURE__ */ jsx(BlockActionsPopover, {
460
431
  block,
461
432
  open: ctx.ellipsisPopoverOpen,
462
433
  onOpenChange: ctx.setEllipsisPopoverOpen,
463
434
  isLayoutBlock: true,
464
- layoutPlacement: block.placement,
435
+ layoutSlot: block.slot,
465
436
  children: /* @__PURE__ */ jsx(BlockTreeItemEllipsis, { open: ctx.ellipsisPopoverOpen })
466
437
  });
467
- $[14] = block;
468
- $[15] = ctx.ellipsisPopoverOpen;
469
- $[16] = ctx.setEllipsisPopoverOpen;
470
- $[17] = derived;
471
- $[18] = t9;
472
- } else t9 = $[18];
438
+ $[13] = block;
439
+ $[14] = ctx.ellipsisPopoverOpen;
440
+ $[15] = ctx.setEllipsisPopoverOpen;
441
+ $[16] = withActions;
442
+ $[17] = t9;
443
+ } else t9 = $[17];
473
444
  let t10;
474
- if ($[19] !== ctx.handleBlockMouseEnter || $[20] !== ctx.handleBlockMouseLeave || $[21] !== ctx.shouldShowActive || $[22] !== ctx.shouldShowHover || $[23] !== t7 || $[24] !== t8 || $[25] !== t9) {
445
+ if ($[18] !== ctx.handleBlockMouseEnter || $[19] !== ctx.handleBlockMouseLeave || $[20] !== ctx.shouldShowActive || $[21] !== ctx.shouldShowHover || $[22] !== t7 || $[23] !== t8 || $[24] !== t9) {
475
446
  t10 = /* @__PURE__ */ jsxs(BlockTreeItemHeader, {
476
447
  className: "group",
477
448
  shouldShowHover: ctx.shouldShowHover,
@@ -484,114 +455,167 @@ const LayoutBlockItem = (t0) => {
484
455
  t9
485
456
  ]
486
457
  });
487
- $[19] = ctx.handleBlockMouseEnter;
488
- $[20] = ctx.handleBlockMouseLeave;
489
- $[21] = ctx.shouldShowActive;
490
- $[22] = ctx.shouldShowHover;
491
- $[23] = t7;
492
- $[24] = t8;
493
- $[25] = t9;
494
- $[26] = t10;
495
- } else t10 = $[26];
458
+ $[18] = ctx.handleBlockMouseEnter;
459
+ $[19] = ctx.handleBlockMouseLeave;
460
+ $[20] = ctx.shouldShowActive;
461
+ $[21] = ctx.shouldShowHover;
462
+ $[22] = t7;
463
+ $[23] = t8;
464
+ $[24] = t9;
465
+ $[25] = t10;
466
+ } else t10 = $[25];
496
467
  return t10;
497
468
  };
498
- const BlockInsertionIndicator = (t0) => {
469
+ /** A sidebar field labelled "Blocks", holding a page's blocks and what acts on them. */
470
+ const BlocksGroup = (t0) => {
499
471
  const $ = c(6);
500
- if ($[0] !== "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a") {
501
- for (let $i = 0; $i < 6; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
502
- $[0] = "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a";
503
- }
504
- const { atEnd: t1 } = t0;
505
- const atEnd = t1 === void 0 ? false : t1;
506
- const ref = React.useRef(null);
472
+ const { children } = t0;
473
+ const labelId = React.useId();
474
+ let t1;
475
+ if ($[0] !== labelId) {
476
+ t1 = /* @__PURE__ */ jsx(Label, {
477
+ id: labelId,
478
+ children: "Blocks"
479
+ });
480
+ $[0] = labelId;
481
+ $[1] = t1;
482
+ } else t1 = $[1];
507
483
  let t2;
508
- let t3;
509
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
510
- t2 = () => {
511
- ref.current?.scrollIntoView({ block: "nearest" });
512
- };
513
- t3 = [];
484
+ if ($[2] !== children || $[3] !== labelId || $[4] !== t1) {
485
+ t2 = /* @__PURE__ */ jsxs("section", {
486
+ "aria-labelledby": labelId,
487
+ className: "flex flex-col gap-2",
488
+ children: [t1, children]
489
+ });
490
+ $[2] = children;
491
+ $[3] = labelId;
492
+ $[4] = t1;
493
+ $[5] = t2;
494
+ } else t2 = $[5];
495
+ return t2;
496
+ };
497
+ /** A page's blocks, collapsed by default behind a bordered toggle showing their count. */
498
+ const CollapsedPageTree = (t0) => {
499
+ const $ = c(15);
500
+ const { blockCount, children } = t0;
501
+ const [expanded, setExpanded] = React.useState(false);
502
+ let t1;
503
+ let t2;
504
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
505
+ t1 = cn("cursor-default flex flex-1 items-center gap-1 text-sm text-left rounded-sm min-w-0", "focus-visible:underline outline-none focus-visible:decoration-ring/50 focus-visible:decoration-4");
506
+ t2 = () => setExpanded(_temp);
507
+ $[0] = t1;
514
508
  $[1] = t2;
515
- $[2] = t3;
516
509
  } else {
510
+ t1 = $[0];
517
511
  t2 = $[1];
518
- t3 = $[2];
519
512
  }
520
- React.useEffect(t2, t3);
521
- const t4 = `pointer-events-none absolute inset-x-0 z-30 h-0 ${atEnd ? "bottom-0" : "top-0"}`;
513
+ let t3;
514
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
515
+ t3 = /* @__PURE__ */ jsx("span", {
516
+ className: "text-muted-foreground flex size-8 shrink-0 items-center justify-center",
517
+ children: /* @__PURE__ */ jsx(ChevronsUpDown, { className: "h-4 w-4" })
518
+ });
519
+ $[2] = t3;
520
+ } else t3 = $[2];
521
+ const t4 = blockCount === 1 ? "block" : "blocks";
522
522
  let t5;
523
- if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
524
- t5 = /* @__PURE__ */ jsx("div", {
525
- className: "bg-primary absolute inset-x-1 top-1/2 h-0.5 -translate-y-1/2 rounded-full motion-safe:animate-pulse",
526
- children: /* @__PURE__ */ jsx("div", { className: "bg-primary absolute -top-0.5 -left-0.5 size-1.5 rounded-full" })
523
+ if ($[3] !== blockCount || $[4] !== t4) {
524
+ t5 = /* @__PURE__ */ jsxs("span", {
525
+ className: "truncate py-2",
526
+ children: [
527
+ blockCount,
528
+ " page ",
529
+ t4
530
+ ]
527
531
  });
528
- $[3] = t5;
529
- } else t5 = $[3];
532
+ $[3] = blockCount;
533
+ $[4] = t4;
534
+ $[5] = t5;
535
+ } else t5 = $[5];
530
536
  let t6;
531
- if ($[4] !== t4) {
532
- t6 = /* @__PURE__ */ jsx("div", {
533
- ref,
534
- className: t4,
535
- "aria-hidden": "true",
536
- children: t5
537
+ if ($[6] !== expanded || $[7] !== t5) {
538
+ t6 = /* @__PURE__ */ jsx(BlockTreeItemHeader, {
539
+ shouldShowHover: true,
540
+ shouldShowActive: false,
541
+ className: "rounded-none px-2",
542
+ children: /* @__PURE__ */ jsxs("button", {
543
+ type: "button",
544
+ "aria-expanded": expanded,
545
+ className: t1,
546
+ onClick: t2,
547
+ children: [t3, t5]
548
+ })
537
549
  });
538
- $[4] = t4;
539
- $[5] = t6;
540
- } else t6 = $[5];
541
- return t6;
550
+ $[6] = expanded;
551
+ $[7] = t5;
552
+ $[8] = t6;
553
+ } else t6 = $[8];
554
+ let t7;
555
+ if ($[9] !== children || $[10] !== expanded) {
556
+ t7 = expanded && /* @__PURE__ */ jsx("div", {
557
+ className: "border-input flex flex-col gap-2 border-t p-1",
558
+ children
559
+ });
560
+ $[9] = children;
561
+ $[10] = expanded;
562
+ $[11] = t7;
563
+ } else t7 = $[11];
564
+ let t8;
565
+ if ($[12] !== t6 || $[13] !== t7) {
566
+ t8 = /* @__PURE__ */ jsxs("div", {
567
+ className: "border-input flex flex-col overflow-hidden rounded-lg border shadow-xs",
568
+ children: [t6, t7]
569
+ });
570
+ $[12] = t6;
571
+ $[13] = t7;
572
+ $[14] = t8;
573
+ } else t8 = $[14];
574
+ return t8;
542
575
  };
543
- const PageTree = () => {
544
- const $ = c(70);
545
- if ($[0] !== "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a") {
546
- for (let $i = 0; $i < 70; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
547
- $[0] = "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a";
548
- }
576
+ /** A page's blocks. When `collapsible`, they start collapsed behind a toggle showing their count. */
577
+ const PageTree = (t0) => {
578
+ const $ = c(51);
579
+ const { collapsible: t1 } = t0;
580
+ const collapsible = t1 === void 0 ? false : t1;
549
581
  const page = usePreviewedPage();
550
- const isAddBlockSidebarOpen = useSelector(previewStore, _temp3);
551
- const peekedBlockPosition = useSelector(previewStore, _temp4);
552
- const previewSource = usePreviewSource();
553
- const requireDraft = useRequireDraftSource();
554
- const { pageBlocks, beforeBlocks: layoutBeforeBlocks, afterBlocks: layoutAfterBlocks } = usePageBlocks(page, previewSource);
582
+ const { pageBlocks, beforeBlocks: layoutBeforeBlocks, afterBlocks: layoutAfterBlocks } = usePageBlocks(page);
555
583
  const camoxApp = useCamoxApp();
556
584
  const updatePosition = useUpdateBlockPosition();
557
585
  const [activeId, setActiveId] = React.useState(null);
558
- let t0;
559
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
560
- t0 = { activationConstraint: {
586
+ let t2;
587
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
588
+ t2 = { activationConstraint: {
561
589
  distance: 8,
562
590
  delay: 150,
563
591
  tolerance: 5
564
592
  } };
565
- $[1] = t0;
566
- } else t0 = $[1];
567
- let t1;
593
+ $[0] = t2;
594
+ } else t2 = $[0];
595
+ let t3;
596
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
597
+ t3 = { coordinateGetter: sortableKeyboardCoordinates };
598
+ $[1] = t3;
599
+ } else t3 = $[1];
600
+ const sensors = useSensors(useSensor(PointerSensor, t2), useSensor(KeyboardSensor, t3));
601
+ let t4;
568
602
  if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
569
- t1 = { coordinateGetter: sortableKeyboardCoordinates };
570
- $[2] = t1;
571
- } else t1 = $[2];
572
- const sensors = useSensors(useSensor(PointerSensor, t0), useSensor(KeyboardSensor, t1));
573
- let t2;
574
- if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
575
- t2 = (event) => {
603
+ t4 = (event) => {
576
604
  setActiveId(String(event.active.id));
577
605
  };
578
- $[3] = t2;
579
- } else t2 = $[3];
580
- const handleDragStart = t2;
581
- let t3;
582
- if ($[4] !== page || $[5] !== pageBlocks || $[6] !== requireDraft || $[7] !== updatePosition) {
583
- t3 = (event_0) => {
606
+ $[2] = t4;
607
+ } else t4 = $[2];
608
+ const handleDragStart = t4;
609
+ let t5;
610
+ if ($[3] !== page || $[4] !== pageBlocks || $[5] !== updatePosition) {
611
+ t5 = (event_0) => {
584
612
  const { active, over } = event_0;
585
613
  if (!over || active.id === over.id || !page) {
586
614
  setActiveId(null);
587
615
  return;
588
616
  }
589
- if (!requireDraft()) {
590
- setActiveId(null);
591
- return;
592
- }
593
- const oldIndex = pageBlocks.findIndex((block) => String(block.id) === active.id);
594
- const newIndex = pageBlocks.findIndex((block_0) => String(block_0.id) === over.id);
617
+ const oldIndex = pageBlocks.findIndex((block) => block.id === active.id);
618
+ const newIndex = pageBlocks.findIndex((block_0) => block_0.id === over.id);
595
619
  if (oldIndex === -1 || newIndex === -1) {
596
620
  setActiveId(null);
597
621
  return;
@@ -606,129 +630,92 @@ const PageTree = () => {
606
630
  beforePosition = pageBlocks[newIndex].position;
607
631
  }
608
632
  updatePosition.mutate({
609
- id: Number(active.id),
633
+ id: String(active.id),
610
634
  afterPosition,
611
635
  beforePosition
612
636
  });
613
637
  setActiveId(null);
614
638
  };
615
- $[4] = page;
616
- $[5] = pageBlocks;
617
- $[6] = requireDraft;
618
- $[7] = updatePosition;
619
- $[8] = t3;
620
- } else t3 = $[8];
621
- const handleDragEnd = t3;
622
- let t4;
623
- if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
624
- t4 = () => {
639
+ $[3] = page;
640
+ $[4] = pageBlocks;
641
+ $[5] = updatePosition;
642
+ $[6] = t5;
643
+ } else t5 = $[6];
644
+ const handleDragEnd = t5;
645
+ let t6;
646
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
647
+ t6 = () => {
625
648
  setActiveId(null);
626
649
  };
627
- $[9] = t4;
628
- } else t4 = $[9];
629
- const handleDragCancel = t4;
650
+ $[7] = t6;
651
+ } else t6 = $[7];
652
+ const handleDragCancel = t6;
630
653
  if (!page) return null;
631
- let t5;
632
- if ($[10] !== camoxApp || $[11] !== page.layout) {
633
- t5 = page.layout ? camoxApp.getLayoutById(page.layout.layoutId) : void 0;
634
- $[10] = camoxApp;
635
- $[11] = page.layout;
636
- $[12] = t5;
637
- } else t5 = $[12];
638
- const layout = t5;
639
- let t6;
640
- if ($[13] !== pageBlocks || $[14] !== peekedBlockPosition) {
641
- let t7;
642
- if ($[16] !== peekedBlockPosition) {
643
- t7 = (block_1) => peekedBlockPosition != null && block_1.position > peekedBlockPosition;
644
- $[16] = peekedBlockPosition;
645
- $[17] = t7;
646
- } else t7 = $[17];
647
- t6 = pageBlocks.findIndex(t7);
648
- $[13] = pageBlocks;
649
- $[14] = peekedBlockPosition;
650
- $[15] = t6;
651
- } else t6 = $[15];
652
- const nextBlockIndex = t6;
653
- const insertionIndex = peekedBlockPosition === "" ? 0 : nextBlockIndex === -1 ? pageBlocks.length : nextBlockIndex;
654
654
  let t7;
655
- if ($[18] !== layout?._internal || $[19] !== layoutBeforeBlocks) {
656
- let t8;
657
- if ($[21] !== layout?._internal) {
658
- t8 = (block_2) => /* @__PURE__ */ jsx(LayoutBlockItem, {
659
- block: block_2,
660
- layoutName: layout?._internal.title ?? "Unknown"
661
- }, String(block_2.id));
662
- $[21] = layout?._internal;
663
- $[22] = t8;
664
- } else t8 = $[22];
665
- t7 = layoutBeforeBlocks.map(t8);
666
- $[18] = layout?._internal;
667
- $[19] = layoutBeforeBlocks;
668
- $[20] = t7;
669
- } else t7 = $[20];
655
+ if ($[8] !== camoxApp || $[9] !== page.layout) {
656
+ t7 = page.layout ? camoxApp.getLayoutById(page.layout.layoutId) : void 0;
657
+ $[8] = camoxApp;
658
+ $[9] = page.layout;
659
+ $[10] = t7;
660
+ } else t7 = $[10];
661
+ const layout = t7;
670
662
  let t8;
671
- if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
672
- t8 = [restrictToVerticalAxis];
673
- $[23] = t8;
674
- } else t8 = $[23];
663
+ if ($[11] !== layout?._internal || $[12] !== layoutBeforeBlocks) {
664
+ let t9;
665
+ if ($[14] !== layout?._internal) {
666
+ t9 = (block_1) => /* @__PURE__ */ jsx(LayoutBlockItem, {
667
+ block: block_1,
668
+ layoutName: layout?._internal.title ?? "Unknown"
669
+ }, block_1.id);
670
+ $[14] = layout?._internal;
671
+ $[15] = t9;
672
+ } else t9 = $[15];
673
+ t8 = layoutBeforeBlocks.map(t9);
674
+ $[11] = layout?._internal;
675
+ $[12] = layoutBeforeBlocks;
676
+ $[13] = t8;
677
+ } else t8 = $[13];
675
678
  let t9;
676
- if ($[24] !== pageBlocks) {
677
- t9 = pageBlocks.map(_temp5);
678
- $[24] = pageBlocks;
679
- $[25] = t9;
680
- } else t9 = $[25];
679
+ if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
680
+ t9 = [restrictToVerticalAxis];
681
+ $[16] = t9;
682
+ } else t9 = $[16];
681
683
  let t10;
682
- if ($[26] !== insertionIndex || $[27] !== isAddBlockSidebarOpen || $[28] !== pageBlocks) {
683
- let t11;
684
- if ($[30] !== insertionIndex || $[31] !== isAddBlockSidebarOpen) {
685
- t11 = (block_4, index) => /* @__PURE__ */ jsxs("div", {
686
- className: "relative",
687
- children: [isAddBlockSidebarOpen && index === insertionIndex && /* @__PURE__ */ jsx(BlockInsertionIndicator, {}), /* @__PURE__ */ jsx(SortableBlock, { block: block_4 })]
688
- }, String(block_4.id));
689
- $[30] = insertionIndex;
690
- $[31] = isAddBlockSidebarOpen;
691
- $[32] = t11;
692
- } else t11 = $[32];
693
- t10 = pageBlocks.map(t11);
694
- $[26] = insertionIndex;
695
- $[27] = isAddBlockSidebarOpen;
696
- $[28] = pageBlocks;
697
- $[29] = t10;
698
- } else t10 = $[29];
684
+ if ($[17] !== pageBlocks) {
685
+ t10 = pageBlocks.map(_temp2);
686
+ $[17] = pageBlocks;
687
+ $[18] = t10;
688
+ } else t10 = $[18];
699
689
  let t11;
700
- if ($[33] !== insertionIndex || $[34] !== isAddBlockSidebarOpen || $[35] !== pageBlocks.length) {
701
- t11 = isAddBlockSidebarOpen && insertionIndex === pageBlocks.length && /* @__PURE__ */ jsx(BlockInsertionIndicator, { atEnd: true });
702
- $[33] = insertionIndex;
703
- $[34] = isAddBlockSidebarOpen;
704
- $[35] = pageBlocks.length;
705
- $[36] = t11;
706
- } else t11 = $[36];
690
+ if ($[19] !== pageBlocks) {
691
+ t11 = pageBlocks.map(_temp3);
692
+ $[19] = pageBlocks;
693
+ $[20] = t11;
694
+ } else t11 = $[20];
707
695
  let t12;
708
- if ($[37] !== t10 || $[38] !== t11) {
709
- t12 = /* @__PURE__ */ jsxs("div", {
696
+ if ($[21] !== t11) {
697
+ t12 = /* @__PURE__ */ jsx("div", {
710
698
  className: "relative flex flex-col gap-0.5",
711
- children: [t10, t11]
699
+ children: t11
712
700
  });
713
- $[37] = t10;
714
- $[38] = t11;
715
- $[39] = t12;
716
- } else t12 = $[39];
701
+ $[21] = t11;
702
+ $[22] = t12;
703
+ } else t12 = $[22];
717
704
  let t13;
718
- if ($[40] !== t12 || $[41] !== t9) {
705
+ if ($[23] !== t10 || $[24] !== t12) {
719
706
  t13 = /* @__PURE__ */ jsx(SortableContext, {
720
- items: t9,
707
+ items: t10,
721
708
  strategy: verticalListSortingStrategy,
722
709
  children: t12
723
710
  });
724
- $[40] = t12;
725
- $[41] = t9;
726
- $[42] = t13;
727
- } else t13 = $[42];
711
+ $[23] = t10;
712
+ $[24] = t12;
713
+ $[25] = t13;
714
+ } else t13 = $[25];
728
715
  let t14;
729
- if ($[43] !== activeId || $[44] !== pageBlocks) {
716
+ if ($[26] !== activeId || $[27] !== pageBlocks) {
730
717
  t14 = activeId ? (() => {
731
- const activeBlock = pageBlocks.find((b) => String(b.id) === activeId);
718
+ const activeBlock = pageBlocks.find((b) => b.id === activeId);
732
719
  if (!activeBlock) return null;
733
720
  return /* @__PURE__ */ jsx("div", {
734
721
  className: "bg-accent text-accent-foreground rounded-lg shadow-md",
@@ -741,109 +728,115 @@ const PageTree = () => {
741
728
  })
742
729
  });
743
730
  })() : null;
744
- $[43] = activeId;
745
- $[44] = pageBlocks;
746
- $[45] = t14;
747
- } else t14 = $[45];
731
+ $[26] = activeId;
732
+ $[27] = pageBlocks;
733
+ $[28] = t14;
734
+ } else t14 = $[28];
748
735
  let t15;
749
- if ($[46] !== t14) {
736
+ if ($[29] !== t14) {
750
737
  t15 = /* @__PURE__ */ jsx(DragOverlay, {
751
738
  dropAnimation: null,
752
739
  children: t14
753
740
  });
754
- $[46] = t14;
755
- $[47] = t15;
756
- } else t15 = $[47];
741
+ $[29] = t14;
742
+ $[30] = t15;
743
+ } else t15 = $[30];
757
744
  let t16;
758
- if ($[48] !== handleDragEnd || $[49] !== sensors || $[50] !== t13 || $[51] !== t15) {
745
+ if ($[31] !== handleDragEnd || $[32] !== sensors || $[33] !== t13 || $[34] !== t15) {
759
746
  t16 = /* @__PURE__ */ jsxs(DndContext, {
760
747
  sensors,
761
748
  collisionDetection: closestCenter,
762
749
  onDragStart: handleDragStart,
763
750
  onDragEnd: handleDragEnd,
764
751
  onDragCancel: handleDragCancel,
765
- modifiers: t8,
752
+ modifiers: t9,
766
753
  children: [t13, t15]
767
754
  });
768
- $[48] = handleDragEnd;
769
- $[49] = sensors;
770
- $[50] = t13;
771
- $[51] = t15;
772
- $[52] = t16;
773
- } else t16 = $[52];
755
+ $[31] = handleDragEnd;
756
+ $[32] = sensors;
757
+ $[33] = t13;
758
+ $[34] = t15;
759
+ $[35] = t16;
760
+ } else t16 = $[35];
774
761
  let t17;
775
- if ($[53] !== layout?._internal || $[54] !== layoutAfterBlocks) {
762
+ if ($[36] !== layout?._internal || $[37] !== layoutAfterBlocks) {
776
763
  let t18;
777
- if ($[56] !== layout?._internal) {
778
- t18 = (block_5) => /* @__PURE__ */ jsx(LayoutBlockItem, {
779
- block: block_5,
764
+ if ($[39] !== layout?._internal) {
765
+ t18 = (block_4) => /* @__PURE__ */ jsx(LayoutBlockItem, {
766
+ block: block_4,
780
767
  layoutName: layout?._internal.title ?? "Unknown"
781
- }, String(block_5.id));
782
- $[56] = layout?._internal;
783
- $[57] = t18;
784
- } else t18 = $[57];
768
+ }, block_4.id);
769
+ $[39] = layout?._internal;
770
+ $[40] = t18;
771
+ } else t18 = $[40];
785
772
  t17 = layoutAfterBlocks.map(t18);
786
- $[53] = layout?._internal;
787
- $[54] = layoutAfterBlocks;
788
- $[55] = t17;
789
- } else t17 = $[55];
773
+ $[36] = layout?._internal;
774
+ $[37] = layoutAfterBlocks;
775
+ $[38] = t17;
776
+ } else t17 = $[38];
790
777
  let t18;
791
- if ($[58] !== t16 || $[59] !== t17 || $[60] !== t7) {
778
+ if ($[41] !== t16 || $[42] !== t17 || $[43] !== t8) {
792
779
  t18 = /* @__PURE__ */ jsxs("div", {
793
780
  className: "flex flex-col gap-0.5",
794
781
  children: [
795
- t7,
782
+ t8,
796
783
  t16,
797
784
  t17
798
785
  ]
799
786
  });
800
- $[58] = t16;
801
- $[59] = t17;
802
- $[60] = t7;
803
- $[61] = t18;
804
- } else t18 = $[61];
787
+ $[41] = t16;
788
+ $[42] = t17;
789
+ $[43] = t8;
790
+ $[44] = t18;
791
+ } else t18 = $[44];
792
+ const list = t18;
805
793
  let t19;
806
- if ($[62] !== requireDraft) {
807
- t19 = () => {
808
- if (!requireDraft()) return;
809
- previewStore.send({ type: "openAddBlockSidebar" });
810
- };
811
- $[62] = requireDraft;
812
- $[63] = t19;
813
- } else t19 = $[63];
814
- let t20;
815
- if ($[64] === Symbol.for("react.memo_cache_sentinel")) {
816
- t20 = /* @__PURE__ */ jsx(Plus, {});
817
- $[64] = t20;
818
- } else t20 = $[64];
819
- let t21;
820
- if ($[65] !== t19) {
821
- t21 = /* @__PURE__ */ jsxs(Button, {
794
+ if ($[45] === Symbol.for("react.memo_cache_sentinel")) {
795
+ t19 = /* @__PURE__ */ jsxs(Button, {
822
796
  variant: "secondary",
823
- onClick: t19,
824
- children: [t20, "Add block"]
797
+ onClick: _temp4,
798
+ children: [/* @__PURE__ */ jsx(Plus, {}), "Add block"]
825
799
  });
826
- $[65] = t19;
827
- $[66] = t21;
828
- } else t21 = $[66];
829
- let t22;
830
- if ($[67] !== t18 || $[68] !== t21) {
831
- t22 = /* @__PURE__ */ jsxs(Fragment, { children: [t18, t21] });
832
- $[67] = t18;
833
- $[68] = t21;
834
- $[69] = t22;
835
- } else t22 = $[69];
836
- return t22;
800
+ $[45] = t19;
801
+ } else t19 = $[45];
802
+ const addBlockButton = t19;
803
+ if (!collapsible) {
804
+ let t20;
805
+ if ($[46] !== list) {
806
+ t20 = /* @__PURE__ */ jsxs(Fragment, { children: [list, addBlockButton] });
807
+ $[46] = list;
808
+ $[47] = t20;
809
+ } else t20 = $[47];
810
+ return t20;
811
+ }
812
+ const blockCount = layoutBeforeBlocks.length + pageBlocks.length + layoutAfterBlocks.length;
813
+ let t20;
814
+ if ($[48] !== blockCount || $[49] !== list) {
815
+ t20 = /* @__PURE__ */ jsx(BlocksGroup, { children: /* @__PURE__ */ jsxs("div", {
816
+ className: "flex flex-col gap-1",
817
+ children: [/* @__PURE__ */ jsx(CollapsedPageTree, {
818
+ blockCount,
819
+ children: list
820
+ }), addBlockButton]
821
+ }) });
822
+ $[48] = blockCount;
823
+ $[49] = list;
824
+ $[50] = t20;
825
+ } else t20 = $[50];
826
+ return t20;
837
827
  };
838
- function _temp3(state) {
839
- return state.context.isAddBlockSidebarOpen;
828
+ function _temp(value) {
829
+ return !value;
830
+ }
831
+ function _temp2(block_2) {
832
+ return block_2.id;
840
833
  }
841
- function _temp4(state_0) {
842
- return state_0.context.peekedBlockPosition;
834
+ function _temp3(block_3) {
835
+ return /* @__PURE__ */ jsx(SortableBlock, { block: block_3 }, block_3.id);
843
836
  }
844
- function _temp5(block_3) {
845
- return String(block_3.id);
837
+ function _temp4() {
838
+ previewStore.send({ type: "openAddBlockDialog" });
846
839
  }
847
840
 
848
841
  //#endregion
849
- export { LayoutBlockItem, PageTree };
842
+ export { BlocksGroup, CollapsedPageTree, LayoutBlockItem, PageTree };