camox 0.44.0 → 0.46.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 (407) 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 +1401 -0
  68. package/dist/features/canvas/CanvasLoadingScreen.js +35 -0
  69. package/dist/features/canvas/CanvasOverlays.js +254 -0
  70. package/dist/features/canvas/CanvasPageEdge.js +87 -0
  71. package/dist/features/canvas/CanvasPageFrame.js +333 -0
  72. package/dist/features/canvas/CanvasPageHeader.js +125 -0
  73. package/dist/features/canvas/CanvasPreviewPageSlot.js +123 -0
  74. package/dist/features/canvas/DerivedPagePathInput.js +238 -0
  75. package/dist/features/canvas/canvasCamera.js +229 -0
  76. package/dist/features/canvas/canvasFlight.js +104 -0
  77. package/dist/features/canvas/canvasFrameCapture.js +364 -0
  78. package/dist/features/canvas/canvasFrameDocument.js +302 -0
  79. package/dist/features/canvas/canvasFrameMode.js +53 -0
  80. package/dist/features/canvas/canvasInsertionSeams.js +44 -0
  81. package/dist/features/canvas/canvasItems.js +30 -0
  82. package/dist/features/canvas/canvasOverlayGeometry.js +240 -0
  83. package/dist/features/canvas/canvasPages.js +79 -0
  84. package/dist/features/canvas/canvasScreenSpace.js +26 -0
  85. package/dist/features/canvas/canvasSelection.js +18 -0
  86. package/dist/features/canvas/canvasStore.js +60 -0
  87. package/dist/features/canvas/canvasThumbnails.js +304 -0
  88. package/dist/features/canvas/canvasZoom.js +10 -0
  89. package/dist/features/canvas/sidebar/CanvasInspector.js +202 -0
  90. package/dist/features/canvas/sidebar/CanvasNavigator.js +124 -0
  91. package/dist/features/canvas/sidebar/CanvasSidebar.js +54 -0
  92. package/dist/features/canvas/sidebar/CanvasSidebarFrame.js +48 -0
  93. package/dist/features/canvas/sidebar/CanvasSidebarSkeleton.js +39 -0
  94. package/dist/features/canvas/sidebar/CuratedPageInspector.js +69 -0
  95. package/dist/features/canvas/sidebar/DerivedPageInspector.js +37 -0
  96. package/dist/features/canvas/sidebar/LayoutPageBlocks.js +78 -0
  97. package/dist/features/canvas/sidebar/LayoutPageOverview.js +71 -0
  98. package/dist/features/canvas/sidebar/PageInspector.js +157 -0
  99. package/dist/features/canvas/sidebar/PageInspectorSkeleton.js +90 -0
  100. package/dist/features/canvas/sidebar/PageOverview.js +27 -0
  101. package/dist/features/canvas/sidebar/SingletonPageInspector.js +31 -0
  102. package/dist/features/canvas/useCanvasCamera.js +783 -0
  103. package/dist/features/canvas/useCanvasFrame.js +148 -0
  104. package/dist/features/canvas/useCanvasFrameInput.js +97 -0
  105. package/dist/features/canvas/useCanvasNearness.js +57 -0
  106. package/dist/features/canvas/useDiscoveredPreviewPaths.js +62 -0
  107. package/dist/features/content/CamoxContent.d.ts +2 -5
  108. package/dist/features/content/CamoxContent.js +174 -271
  109. package/dist/features/content/CollectionItemSheetContext.js +106 -0
  110. package/dist/features/content/ContentAssets.js +315 -0
  111. package/dist/features/content/ContentCollection.js +663 -0
  112. package/dist/features/content/collection-form.js +58 -0
  113. package/dist/features/content/components/AssetCard.js +80 -84
  114. package/dist/features/content/components/AssetCardSkeleton.js +4 -8
  115. package/dist/features/content/components/ContentSidebar.js +129 -18
  116. package/dist/features/content/components/ContentSidebarGroup.js +37 -0
  117. package/dist/features/content/components/DeleteCollectionItemButton.js +202 -0
  118. package/dist/features/content/components/MissingFromLocale.js +282 -0
  119. package/dist/features/content/components/UploadDropZone.js +27 -31
  120. package/dist/features/content/components/UploadProgressDrawer.js +90 -98
  121. package/dist/features/navigation/navigation.d.ts +66 -20
  122. package/dist/features/navigation/navigation.js +257 -90
  123. package/dist/features/og/defaultFonts.js +8 -8
  124. package/dist/features/og/geist-variable-ttf-base64.js +1 -1
  125. package/dist/features/og/imageResponse.d.ts +8 -0
  126. package/dist/features/og/imageResponse.js +26 -0
  127. package/dist/features/page/CuratedPageContent.js +167 -0
  128. package/dist/features/page/DerivedPageContent.js +26 -30
  129. package/dist/features/page/SharedLayoutContent.js +25 -27
  130. package/dist/features/preview/CamoxPreview.d.ts +23 -61
  131. package/dist/features/preview/CamoxPreview.js +816 -537
  132. package/dist/features/preview/EditablePageContent.js +1 -1
  133. package/dist/features/preview/EditablePageExperience.js +16 -22
  134. package/dist/features/preview/components/AddBlockSheet.js +273 -0
  135. package/dist/features/preview/components/AssetFieldEditor.js +173 -154
  136. package/dist/features/preview/components/AssetLightbox.js +181 -134
  137. package/dist/features/preview/components/AssetPickerModal.js +153 -170
  138. package/dist/features/preview/components/BlockActionsPopover.js +150 -149
  139. package/dist/features/preview/components/BlockErrorBoundary.js +8 -12
  140. package/dist/features/preview/components/BlockThumbnail.js +172 -98
  141. package/dist/features/preview/components/CanvasPreview.js +243 -0
  142. package/dist/features/preview/components/CreatePageModal.js +128 -137
  143. package/dist/features/preview/components/DebouncedFieldEditor.js +29 -33
  144. package/dist/features/preview/components/DerivedLayoutDialog.js +21 -19
  145. package/dist/features/preview/components/DrillRow.js +150 -0
  146. package/dist/features/preview/components/FieldOverlayStyles.js +11 -8
  147. package/dist/features/preview/components/FieldToolbar.js +160 -110
  148. package/dist/features/preview/components/Frame.js +108 -20
  149. package/dist/features/preview/components/IconFieldEditor.js +62 -66
  150. package/dist/features/preview/components/ItemFieldsEditor.js +231 -205
  151. package/dist/features/preview/components/LinkFieldEditor.js +135 -139
  152. package/dist/features/preview/components/Metadata.js +22 -30
  153. package/dist/features/preview/components/MobilePreviewDrawer.js +89 -108
  154. package/dist/features/preview/components/MultipleAssetFieldEditor.js +334 -246
  155. package/dist/features/preview/components/OverlayTracker.js +9 -41
  156. package/dist/features/preview/components/Overlays.js +81 -69
  157. package/dist/features/preview/components/PageInfo.js +1748 -0
  158. package/dist/features/preview/components/PageInfoSkeleton.js +51 -0
  159. package/dist/features/preview/components/PageLocationFieldset.js +112 -116
  160. package/dist/features/preview/components/PageNavigatorHeader.js +24 -0
  161. package/dist/features/preview/components/PageNicknameField.js +22 -26
  162. package/dist/features/preview/components/PagePicker.js +128 -130
  163. package/dist/features/preview/components/PageTree.js +525 -532
  164. package/dist/features/preview/components/PreviewActivation.js +28 -32
  165. package/dist/features/preview/components/PreviewPanel.js +620 -319
  166. package/dist/features/preview/components/PreviewToolbar.js +105 -333
  167. package/dist/features/preview/components/RecordCard.js +80 -0
  168. package/dist/features/preview/components/RecordCombobox.js +178 -0
  169. package/dist/features/preview/components/ReferenceFieldEditor.js +149 -0
  170. package/dist/features/preview/components/ReferenceListFieldEditor.js +432 -0
  171. package/dist/features/preview/components/RemovedBlockPlaceholder.js +95 -0
  172. package/dist/features/preview/components/RepeatableItemsList.js +125 -138
  173. package/dist/features/preview/components/SelectionEditor.js +993 -0
  174. package/dist/features/preview/components/ShikiMarkdown.js +14 -18
  175. package/dist/features/preview/components/SidebarSection.js +52 -64
  176. package/dist/features/preview/components/StudioEditingFallback.js +56 -0
  177. package/dist/features/preview/components/UnlinkAssetButton.js +104 -107
  178. package/dist/features/preview/components/blockGridNavigation.js +15 -0
  179. package/dist/features/preview/components/contentFieldSchema.js +8 -0
  180. package/dist/features/preview/components/useFieldWriter.js +200 -0
  181. package/dist/features/preview/components/useRecordView.js +383 -0
  182. package/dist/features/preview/components/useRepeatableItemActions.js +35 -37
  183. package/dist/features/preview/components/useUpdateBlockPosition.js +37 -37
  184. package/dist/features/preview/editingFrame.js +197 -0
  185. package/dist/features/preview/overlayHighlights.js +17 -44
  186. package/dist/features/preview/overlayMessages.js +72 -1
  187. package/dist/features/preview/pageRecord.js +189 -0
  188. package/dist/features/preview/previewConstants.js +6 -2
  189. package/dist/features/preview/previewPageFrame.js +95 -0
  190. package/dist/features/preview/previewPreparation.js +7 -0
  191. package/dist/features/preview/previewSelection.js +32 -63
  192. package/dist/features/preview/previewStore.js +225 -123
  193. package/dist/features/preview/referencePickerFocus.js +29 -0
  194. package/dist/features/preview/repeatableItemTargets.js +56 -0
  195. package/dist/features/preview/selectionReveal.js +21 -0
  196. package/dist/features/preview/usePreviewViewportActions.js +114 -0
  197. package/dist/features/preview/viewportContinuity.js +109 -0
  198. package/dist/features/provider/AuthenticatedCamoxProvider.js +69 -44
  199. package/dist/features/provider/CamoxProvider.d.ts +3 -6
  200. package/dist/features/provider/CamoxProvider.js +38 -50
  201. package/dist/features/provider/CoreCamoxProvider.js +69 -50
  202. package/dist/features/provider/LocalhostPreviewProvider.js +78 -114
  203. package/dist/features/provider/PreviewSignInPage.js +54 -0
  204. package/dist/features/provider/components/CamoxAppContext.js +11 -11
  205. package/dist/features/provider/components/CommandPalette.js +75 -82
  206. package/dist/features/provider/useAdminShortcuts.js +7 -11
  207. package/dist/features/routes/pageRuntime.d.ts +44 -4
  208. package/dist/features/routes/pageRuntime.js +244 -137
  209. package/dist/features/runtime/RuntimeChrome.js +117 -115
  210. package/dist/features/runtime/alternates.js +64 -0
  211. package/dist/features/runtime/analytics.d.ts +7 -0
  212. package/dist/features/runtime/analytics.js +66 -0
  213. package/dist/features/runtime/artifactSources.js +87 -0
  214. package/dist/features/runtime/editingFallback.js +20 -0
  215. package/dist/features/runtime/linkPrefetch.js +97 -0
  216. package/dist/features/runtime/livePages.js +62 -0
  217. package/dist/features/runtime/llmsTxt.js +40 -0
  218. package/dist/features/runtime/loopbackFetch.js +18 -0
  219. package/dist/features/runtime/navigationAccessibility.js +51 -0
  220. package/dist/features/runtime/navigationTarget.js +23 -2
  221. package/dist/features/runtime/pageApp.js +229 -158
  222. package/dist/features/runtime/pageBlockTypes.js +20 -0
  223. package/dist/features/runtime/pageClient.d.ts +2 -4
  224. package/dist/features/runtime/pageClient.js +18 -3
  225. package/dist/features/runtime/pageNavigation.js +254 -32
  226. package/dist/features/runtime/pageServer.d.ts +2 -4
  227. package/dist/features/runtime/pageServer.js +6 -2
  228. package/dist/features/runtime/pageViewport.js +7 -0
  229. package/dist/features/runtime/runtime.d.ts +54 -24
  230. package/dist/features/runtime/runtime.js +766 -191
  231. package/dist/features/runtime/runtimeChromeLoader.js +58 -0
  232. package/dist/features/runtime/runtimeRoutes.d.ts +19 -0
  233. package/dist/features/runtime/runtimeRoutes.js +25 -0
  234. package/dist/features/runtime/scrollRestoration.js +133 -0
  235. package/dist/features/runtime/studioApp.d.ts +4 -3
  236. package/dist/features/runtime/studioApp.js +5 -9
  237. package/dist/features/runtime/studioClient.d.ts +2 -4
  238. package/dist/features/runtime/studioClient.js +12 -3
  239. package/dist/features/runtime/studioServer.d.ts +2 -4
  240. package/dist/features/runtime/studioServer.js +6 -1
  241. package/dist/features/runtime/worker.d.ts +6 -0
  242. package/dist/features/runtime/worker.js +23 -0
  243. package/dist/features/runtime/workerRequest.js +44 -0
  244. package/dist/features/studio/CamoxStudio.d.ts +2 -6
  245. package/dist/features/studio/CamoxStudio.js +34 -49
  246. package/dist/features/studio/FollowAgentProvider.js +327 -0
  247. package/dist/features/studio/components/ChatSidebar.js +356 -0
  248. package/dist/features/studio/components/DraftsControl.js +676 -0
  249. package/dist/features/studio/components/FaviconDialog.js +318 -0
  250. package/dist/features/studio/components/LocalePicker.js +785 -0
  251. package/dist/features/studio/components/Navbar.js +123 -103
  252. package/dist/features/studio/components/ProjectMenu.js +239 -260
  253. package/dist/features/studio/components/RenameDraftDialog.js +206 -0
  254. package/dist/features/studio/components/ReviewDraftSheet.js +1472 -0
  255. package/dist/features/studio/components/ThreadComposer.js +157 -0
  256. package/dist/features/studio/components/ThreadMarkdown.js +113 -0
  257. package/dist/features/studio/components/ThreadMessages.js +270 -0
  258. package/dist/features/studio/components/UserButton.js +34 -23
  259. package/dist/features/studio/draftLabel.js +33 -0
  260. package/dist/features/studio/draftNotice.js +13 -0
  261. package/dist/features/studio/followAgent.js +241 -0
  262. package/dist/features/studio/followAgentContext.js +7 -0
  263. package/dist/features/studio/localeOptions.js +118 -0
  264. package/dist/features/studio/localeSwitch.js +19 -0
  265. package/dist/features/studio/routes.js +26 -1
  266. package/dist/features/studio/studioStore.js +64 -1
  267. package/dist/features/studio/useTheme.js +24 -27
  268. package/dist/features/vite/artifactRuntimeMinification.js +36 -0
  269. package/dist/features/vite/blockBoilerplate.js +6 -5
  270. package/dist/features/vite/blockChunks.js +31 -0
  271. package/dist/features/vite/bundlerLogs.js +17 -0
  272. package/dist/features/vite/definitionsSync.js +158 -226
  273. package/dist/features/vite/devAuthentication.js +4 -16
  274. package/dist/features/vite/devSignIn.js +87 -0
  275. package/dist/features/vite/iconGeneration.js +1 -1
  276. package/dist/features/vite/layoutGeneration.js +11 -1
  277. package/dist/features/vite/publishSeededContent.js +30 -0
  278. package/dist/features/vite/routeGeneration.js +6 -7
  279. package/dist/features/vite/runtimeDev.js +80 -99
  280. package/dist/features/vite/vite.d.ts +51 -31
  281. package/dist/features/vite/vite.js +224 -127
  282. package/dist/features/vite/workerBuild.js +39 -0
  283. package/dist/hooks/use-debounced-field.js +116 -47
  284. package/dist/hooks/use-file-upload.js +114 -67
  285. package/dist/hooks/use-marquee-selection.js +32 -36
  286. package/dist/hooks/use-page-destinations.js +69 -37
  287. package/dist/lib/api-client-server.d.ts +5 -0
  288. package/dist/lib/api-client-server.js +10 -4
  289. package/dist/lib/api-client.d.ts +6 -0
  290. package/dist/lib/api-client.js +51 -16
  291. package/dist/lib/api-socket.js +17 -0
  292. package/dist/lib/auth-page-styles.js +39 -0
  293. package/dist/lib/auth.js +129 -61
  294. package/dist/lib/collection-cache.js +23 -0
  295. package/dist/lib/draft-scope.d.ts +4 -0
  296. package/dist/lib/draft-scope.js +222 -0
  297. package/dist/lib/html.js +12 -0
  298. package/dist/lib/link-pages.js +154 -0
  299. package/dist/lib/locale-path.d.ts +22 -0
  300. package/dist/lib/locale-path.js +57 -0
  301. package/dist/lib/normalized-data.js +252 -152
  302. package/dist/lib/preview-handoff.js +2 -2
  303. package/dist/lib/queries.d.ts +11 -0
  304. package/dist/lib/queries.js +70 -141
  305. package/dist/lib/studio-reads.d.ts +14 -0
  306. package/dist/lib/studio-reads.js +554 -0
  307. package/dist/lib/use-project-room.js +50 -50
  308. package/dist/lib/use-thread.js +310 -0
  309. package/dist/lib/utils.js +25 -29
  310. package/dist/lib/view-locale-context.js +22 -0
  311. package/dist/lib/view-locale.js +46 -0
  312. package/dist/package.js +5 -0
  313. package/dist/studio-overlays.css +41 -151
  314. package/dist/studio.css +2 -2
  315. package/package.json +70 -73
  316. package/skills/camox/SKILL.md +16 -11
  317. package/skills/camox/references/artifacts.md +179 -0
  318. package/skills/camox/references/block-definitions.md +75 -59
  319. package/skills/camox/references/cli-common.md +9 -11
  320. package/skills/camox/references/cli-content.md +92 -69
  321. package/skills/camox/references/cli-publishing.md +26 -0
  322. package/skills/camox/references/dom-integrations.md +27 -0
  323. package/skills/camox/references/field-styling.md +4 -4
  324. package/skills/camox/references/layout-definitions.md +16 -14
  325. package/skills/camox/references/localization.md +56 -0
  326. package/skills/camox/references/routed-layouts.md +133 -15
  327. package/skills/camox-expand/SKILL.md +70 -0
  328. package/skills/camox-expand/references/jobs.md +39 -0
  329. package/skills/camoxify/SKILL.md +29 -7
  330. package/dist/core/components/AddBlockControlBar.js +0 -78
  331. package/dist/core/hooks/useRequireDraftSource.js +0 -23
  332. package/dist/features/metadata/sitemap.d.ts +0 -8
  333. package/dist/features/metadata/sitemap.js +0 -17
  334. package/dist/features/og/imageResponse.node.d.ts +0 -12
  335. package/dist/features/og/imageResponse.node.js +0 -49
  336. package/dist/features/og/imageResponse.workerd.d.ts +0 -12
  337. package/dist/features/og/imageResponse.workerd.js +0 -40
  338. package/dist/features/page/PublishedPageContent.js +0 -205
  339. package/dist/features/page/PublishedPageExperience.js +0 -23
  340. package/dist/features/preview/DerivedPreview.js +0 -134
  341. package/dist/features/preview/commentsEnabled.js +0 -8
  342. package/dist/features/preview/components/AddBlockSidebar.js +0 -381
  343. package/dist/features/preview/components/AttachedComments.js +0 -331
  344. package/dist/features/preview/components/CommentHeader.js +0 -122
  345. package/dist/features/preview/components/CommentSidebar.js +0 -29
  346. package/dist/features/preview/components/CommentTargetQuote.js +0 -167
  347. package/dist/features/preview/components/DerivedLayoutSidebar.d.ts +0 -5
  348. package/dist/features/preview/components/DerivedLayoutSidebar.js +0 -179
  349. package/dist/features/preview/components/DerivedPageInfoSidebar.js +0 -69
  350. package/dist/features/preview/components/LeftSidebar.js +0 -68
  351. package/dist/features/preview/components/PageEditorSidebar.js +0 -563
  352. package/dist/features/preview/components/PageInfoSidebar.js +0 -1551
  353. package/dist/features/preview/components/PageNavigatorSidebar.js +0 -78
  354. package/dist/features/preview/components/PageStatusBadge.js +0 -97
  355. package/dist/features/preview/components/PeekedBlock.js +0 -217
  356. package/dist/features/preview/components/PreviewComments.js +0 -56
  357. package/dist/features/preview/components/PreviewToolbarSpacer.js +0 -43
  358. package/dist/features/preview/components/PublicationRow.js +0 -422
  359. package/dist/features/preview/components/PublishDialog.js +0 -194
  360. package/dist/features/preview/components/RightSidebar.js +0 -59
  361. package/dist/features/preview/components/SendFeedbackDialog.js +0 -83
  362. package/dist/features/preview/previewCommentsStore.js +0 -135
  363. package/dist/features/preview/publication.js +0 -81
  364. package/dist/features/preview/usePageComments.js +0 -39
  365. package/dist/features/runtime/SharedChromeContext.js +0 -7
  366. package/dist/features/studio/components/EnvironmentMenu.js +0 -425
  367. package/dist/features/vite/appGeneration.js +0 -89
  368. package/dist/lib/view-queries.js +0 -28
  369. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/Matches.d.ts +0 -114
  370. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/RouterProvider.d.ts +0 -25
  371. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/config.d.ts +0 -1
  372. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/defer.d.ts +0 -1
  373. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/fileRoute.d.ts +0 -20
  374. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/global.d.ts +0 -8
  375. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/hash-scroll.d.ts +0 -1
  376. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/index.d.ts +0 -18
  377. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/link.d.ts +0 -161
  378. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/load-matches.d.ts +0 -6
  379. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/location.d.ts +0 -54
  380. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/lru-cache.d.ts +0 -8
  381. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/manifest.d.ts +0 -32
  382. 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
  383. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/not-found.d.ts +0 -1
  384. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/redirect.d.ts +0 -49
  385. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/rewrite.d.ts +0 -1
  386. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/root.d.ts +0 -6
  387. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/route.d.ts +0 -343
  388. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/routeInfo.d.ts +0 -48
  389. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/router.d.ts +0 -695
  390. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/scroll-restoration.d.ts +0 -1
  391. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/searchMiddleware.d.ts +0 -1
  392. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/searchParams.d.ts +0 -5
  393. 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
  394. 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
  395. 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
  396. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/stores.d.ts +0 -69
  397. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/structuralSharing.d.ts +0 -1
  398. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/typePrimitives.d.ts +0 -1
  399. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useLoaderData.d.ts +0 -1
  400. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useLoaderDeps.d.ts +0 -1
  401. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useNavigate.d.ts +0 -10
  402. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useParams.d.ts +0 -1
  403. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useRouteContext.d.ts +0 -1
  404. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useSearch.d.ts +0 -1
  405. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/utils.d.ts +0 -28
  406. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/validators.d.ts +0 -49
  407. package/skills/camox/references/cli-environments.md +0 -37
@@ -0,0 +1,785 @@
1
+ import { useProjectUuid } from "../../../lib/auth.js";
2
+ import { localizedPath } from "../../../lib/locale-path.js";
3
+ import { useCurrentDraftId } from "../../../lib/draft-scope.js";
4
+ import { useViewLocale } from "../../../lib/view-locale-context.js";
5
+ import { useLocation, useNavigate } from "../../navigation/navigation.js";
6
+ import { reads, useReadQuery, useStudioCache } from "../../../lib/studio-reads.js";
7
+ import { localeMutations } from "../../../lib/queries.js";
8
+ import { usePageDestinations } from "../../../hooks/use-page-destinations.js";
9
+ import { useLocalePath } from "../../../lib/view-locale.js";
10
+ import { studioStore } from "../studioStore.js";
11
+ import { localeLabel, localeOptions } from "../localeOptions.js";
12
+ import { pathInLocale } from "../localeSwitch.js";
13
+ import { c } from "react/compiler-runtime";
14
+ import * as React from "react";
15
+ import { useSelector } from "@xstate/store-react";
16
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
17
+ import { useMutation } from "@tanstack/react-query";
18
+ import { Button } from "@camox/ui/button";
19
+ import { Input } from "@camox/ui/input";
20
+ import { Label } from "@camox/ui/label";
21
+ import { ChevronsUpDown, Languages, Plus, Trash2 } from "lucide-react";
22
+ import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@camox/ui/dialog";
23
+ import { toast } from "@camox/ui/toaster";
24
+ import { Tooltip, TooltipContent, TooltipTrigger } from "@camox/ui/tooltip";
25
+ import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@camox/ui/alert-dialog";
26
+ import { Combobox } from "@base-ui/react/combobox";
27
+ import { Spinner } from "@camox/ui/spinner";
28
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuTrigger } from "@camox/ui/dropdown-menu";
29
+
30
+ //#region src/features/studio/components/LocalePicker.tsx
31
+ /**
32
+ * The studio's languages (GLOSSARY: Locale): the one viewed, the others to switch to, and adding
33
+ * and removing them. Switching keeps the page shown when the other language has it, and goes to
34
+ * that language's home otherwise; the URL names the language by its prefix. Adding and removing
35
+ * languages are content writes, so on Live they start a draft. While Camox translates the draft
36
+ * into its languages, the picker shows a spinner, and nothing else does.
37
+ */
38
+ function LocalePicker(t0) {
39
+ const $ = c(69);
40
+ const { recordPage } = t0;
41
+ const projectUuid = useProjectUuid();
42
+ const view = useViewLocale();
43
+ const dialog = useSelector(studioStore, _temp);
44
+ let t1;
45
+ if ($[0] !== projectUuid) {
46
+ t1 = reads.project({ projectUuid });
47
+ $[0] = projectUuid;
48
+ $[1] = t1;
49
+ } else t1 = $[1];
50
+ const t2 = !!projectUuid;
51
+ let t3;
52
+ if ($[2] !== t2) {
53
+ t3 = { enabled: t2 };
54
+ $[2] = t2;
55
+ $[3] = t3;
56
+ } else t3 = $[3];
57
+ const projectId = useReadQuery(t1, t3).data?.id;
58
+ let t4;
59
+ if ($[4] !== projectId) {
60
+ t4 = reads.localeList({ projectId: projectId ?? 0 });
61
+ $[4] = projectId;
62
+ $[5] = t4;
63
+ } else t4 = $[5];
64
+ const t5 = !!projectId;
65
+ let t6;
66
+ if ($[6] !== t5) {
67
+ t6 = { enabled: t5 };
68
+ $[6] = t5;
69
+ $[7] = t6;
70
+ } else t6 = $[7];
71
+ const locales = useReadQuery(t4, t6).data ?? view.locales;
72
+ let t7;
73
+ if ($[8] !== locales || $[9] !== view) {
74
+ t7 = locales.find((locale) => view.locale.isDefault ? locale.isDefault : locale.tag === view.locale.tag) ?? view.locale;
75
+ $[8] = locales;
76
+ $[9] = view;
77
+ $[10] = t7;
78
+ } else t7 = $[10];
79
+ const viewed = t7;
80
+ const switchTo = useSwitchLocale(recordPage);
81
+ const draftId = useCurrentDraftId();
82
+ let t8;
83
+ if ($[11] !== draftId || $[12] !== projectId) {
84
+ t8 = reads.draft({
85
+ projectId: projectId ?? 0,
86
+ draftId: draftId ?? ""
87
+ });
88
+ $[11] = draftId;
89
+ $[12] = projectId;
90
+ $[13] = t8;
91
+ } else t8 = $[13];
92
+ const t9 = !!projectId && !!draftId;
93
+ let t10;
94
+ if ($[14] !== t9) {
95
+ t10 = { enabled: t9 };
96
+ $[14] = t9;
97
+ $[15] = t10;
98
+ } else t10 = $[15];
99
+ const draft = useReadQuery(t8, t10);
100
+ let t11;
101
+ if ($[16] !== draft.data?.translatingLocales) {
102
+ t11 = draft.data?.translatingLocales ?? [];
103
+ $[16] = draft.data?.translatingLocales;
104
+ $[17] = t11;
105
+ } else t11 = $[17];
106
+ const translatingLocales = t11;
107
+ let t12;
108
+ if ($[18] !== viewed.tag) {
109
+ t12 = [viewed.tag];
110
+ $[18] = viewed.tag;
111
+ $[19] = t12;
112
+ } else t12 = $[19];
113
+ React.useEffect(_temp2, t12);
114
+ let t13;
115
+ if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
116
+ t13 = /* @__PURE__ */ jsx(Button, {
117
+ type: "button",
118
+ variant: "ghost"
119
+ });
120
+ $[20] = t13;
121
+ } else t13 = $[20];
122
+ let t14;
123
+ if ($[21] !== translatingLocales) {
124
+ t14 = translatingLocales.length > 0 ? /* @__PURE__ */ jsx(TranslatingSpinner, { tags: translatingLocales }) : /* @__PURE__ */ jsx(Languages, {
125
+ "aria-hidden": true,
126
+ className: "text-muted-foreground size-4"
127
+ });
128
+ $[21] = translatingLocales;
129
+ $[22] = t14;
130
+ } else t14 = $[22];
131
+ let t15;
132
+ if ($[23] !== viewed.tag) {
133
+ t15 = localeLabel(viewed.tag);
134
+ $[23] = viewed.tag;
135
+ $[24] = t15;
136
+ } else t15 = $[24];
137
+ let t16;
138
+ if ($[25] !== t15) {
139
+ t16 = /* @__PURE__ */ jsx("span", {
140
+ className: "max-w-40 truncate",
141
+ children: t15
142
+ });
143
+ $[25] = t15;
144
+ $[26] = t16;
145
+ } else t16 = $[26];
146
+ let t17;
147
+ if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
148
+ t17 = /* @__PURE__ */ jsx(ChevronsUpDown, {
149
+ "aria-hidden": true,
150
+ className: "size-4 opacity-50"
151
+ });
152
+ $[27] = t17;
153
+ } else t17 = $[27];
154
+ let t18;
155
+ if ($[28] !== t14 || $[29] !== t16) {
156
+ t18 = /* @__PURE__ */ jsxs(DropdownMenuTrigger, {
157
+ render: t13,
158
+ children: [
159
+ t14,
160
+ t16,
161
+ t17
162
+ ]
163
+ });
164
+ $[28] = t14;
165
+ $[29] = t16;
166
+ $[30] = t18;
167
+ } else t18 = $[30];
168
+ const t19 = viewed.tag;
169
+ let t20;
170
+ if ($[31] !== locales || $[32] !== switchTo) {
171
+ t20 = (tag) => {
172
+ const next = locales.find((locale_0) => locale_0.tag === tag);
173
+ if (next) switchTo(next);
174
+ };
175
+ $[31] = locales;
176
+ $[32] = switchTo;
177
+ $[33] = t20;
178
+ } else t20 = $[33];
179
+ let t21;
180
+ if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
181
+ t21 = /* @__PURE__ */ jsx(DropdownMenuLabel, { children: "Languages" });
182
+ $[34] = t21;
183
+ } else t21 = $[34];
184
+ let t22;
185
+ if ($[35] !== locales) {
186
+ t22 = locales.map(_temp3);
187
+ $[35] = locales;
188
+ $[36] = t22;
189
+ } else t22 = $[36];
190
+ let t23;
191
+ if ($[37] !== t22) {
192
+ t23 = /* @__PURE__ */ jsxs(DropdownMenuGroup, { children: [t21, t22] });
193
+ $[37] = t22;
194
+ $[38] = t23;
195
+ } else t23 = $[38];
196
+ let t24;
197
+ if ($[39] !== t20 || $[40] !== t23 || $[41] !== viewed.tag) {
198
+ t24 = /* @__PURE__ */ jsx(DropdownMenuRadioGroup, {
199
+ value: t19,
200
+ onValueChange: t20,
201
+ children: t23
202
+ });
203
+ $[39] = t20;
204
+ $[40] = t23;
205
+ $[41] = viewed.tag;
206
+ $[42] = t24;
207
+ } else t24 = $[42];
208
+ let t25;
209
+ if ($[43] === Symbol.for("react.memo_cache_sentinel")) {
210
+ t25 = /* @__PURE__ */ jsx(DropdownMenuSeparator, {});
211
+ $[43] = t25;
212
+ } else t25 = $[43];
213
+ const t26 = !projectId;
214
+ let t27;
215
+ if ($[44] === Symbol.for("react.memo_cache_sentinel")) {
216
+ t27 = /* @__PURE__ */ jsx(Plus, {});
217
+ $[44] = t27;
218
+ } else t27 = $[44];
219
+ let t28;
220
+ if ($[45] !== t26) {
221
+ t28 = /* @__PURE__ */ jsxs(DropdownMenuItem, {
222
+ disabled: t26,
223
+ onClick: _temp4,
224
+ children: [t27, "Add language…"]
225
+ });
226
+ $[45] = t26;
227
+ $[46] = t28;
228
+ } else t28 = $[46];
229
+ let t29;
230
+ if ($[47] !== projectId || $[48] !== viewed.isDefault || $[49] !== viewed.tag) {
231
+ t29 = !viewed.isDefault && /* @__PURE__ */ jsxs(DropdownMenuItem, {
232
+ variant: "destructive",
233
+ disabled: !projectId,
234
+ onClick: _temp5,
235
+ children: [
236
+ /* @__PURE__ */ jsx(Trash2, {}),
237
+ "Remove ",
238
+ localeLabel(viewed.tag),
239
+ "…"
240
+ ]
241
+ });
242
+ $[47] = projectId;
243
+ $[48] = viewed.isDefault;
244
+ $[49] = viewed.tag;
245
+ $[50] = t29;
246
+ } else t29 = $[50];
247
+ let t30;
248
+ if ($[51] !== t28 || $[52] !== t29) {
249
+ t30 = /* @__PURE__ */ jsxs(DropdownMenuGroup, { children: [t28, t29] });
250
+ $[51] = t28;
251
+ $[52] = t29;
252
+ $[53] = t30;
253
+ } else t30 = $[53];
254
+ let t31;
255
+ if ($[54] !== t24 || $[55] !== t30) {
256
+ t31 = /* @__PURE__ */ jsxs(DropdownMenuContent, {
257
+ className: "w-64",
258
+ align: "start",
259
+ children: [
260
+ t24,
261
+ t25,
262
+ t30
263
+ ]
264
+ });
265
+ $[54] = t24;
266
+ $[55] = t30;
267
+ $[56] = t31;
268
+ } else t31 = $[56];
269
+ let t32;
270
+ if ($[57] !== t18 || $[58] !== t31) {
271
+ t32 = /* @__PURE__ */ jsxs(DropdownMenu, { children: [t18, t31] });
272
+ $[57] = t18;
273
+ $[58] = t31;
274
+ $[59] = t32;
275
+ } else t32 = $[59];
276
+ let t33;
277
+ if ($[60] !== dialog || $[61] !== locales || $[62] !== projectId || $[63] !== switchTo || $[64] !== viewed) {
278
+ t33 = projectId && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(AddLocaleDialog, {
279
+ projectId,
280
+ locales,
281
+ open: dialog === "add",
282
+ onAdded: (added) => void switchTo(added)
283
+ }), !viewed.isDefault && /* @__PURE__ */ jsx(RemoveLocaleDialog, {
284
+ projectId,
285
+ locale: viewed,
286
+ open: dialog === "remove",
287
+ onRemoved: () => {
288
+ const fallback = locales.find(_temp6);
289
+ if (fallback) switchTo(fallback);
290
+ }
291
+ })] });
292
+ $[60] = dialog;
293
+ $[61] = locales;
294
+ $[62] = projectId;
295
+ $[63] = switchTo;
296
+ $[64] = viewed;
297
+ $[65] = t33;
298
+ } else t33 = $[65];
299
+ let t34;
300
+ if ($[66] !== t32 || $[67] !== t33) {
301
+ t34 = /* @__PURE__ */ jsxs(Fragment, { children: [t32, t33] });
302
+ $[66] = t32;
303
+ $[67] = t33;
304
+ $[68] = t34;
305
+ } else t34 = $[68];
306
+ return t34;
307
+ }
308
+ function _temp6(locale_2) {
309
+ return locale_2.isDefault;
310
+ }
311
+ function _temp5() {
312
+ return studioStore.send({
313
+ type: "openLocaleDialog",
314
+ dialog: "remove"
315
+ });
316
+ }
317
+ function _temp4() {
318
+ return studioStore.send({
319
+ type: "openLocaleDialog",
320
+ dialog: "add"
321
+ });
322
+ }
323
+ function _temp3(locale_1) {
324
+ return /* @__PURE__ */ jsx(DropdownMenuRadioItem, {
325
+ value: locale_1.tag,
326
+ closeOnClick: true,
327
+ children: /* @__PURE__ */ jsxs("div", {
328
+ className: "flex min-w-0 flex-col",
329
+ children: [/* @__PURE__ */ jsx("span", {
330
+ className: "truncate",
331
+ children: localeLabel(locale_1.tag)
332
+ }), locale_1.isDefault && /* @__PURE__ */ jsx("span", {
333
+ className: "text-muted-foreground text-xs",
334
+ children: "Default language"
335
+ })]
336
+ })
337
+ }, locale_1.tag);
338
+ }
339
+ function _temp2() {
340
+ return closeLocaleDialog;
341
+ }
342
+ function _temp(state) {
343
+ return state.context.localeDialog;
344
+ }
345
+ /** Stands for the languages icon while Camox translates the draft, naming them on hover. */
346
+ function TranslatingSpinner(t0) {
347
+ const $ = c(5);
348
+ const { tags } = t0;
349
+ let t1;
350
+ if ($[0] !== tags) {
351
+ t1 = tags.map(localeLabel).join(", ");
352
+ $[0] = tags;
353
+ $[1] = t1;
354
+ } else t1 = $[1];
355
+ const label = `Translating into ${t1}…`;
356
+ let t2;
357
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
358
+ t2 = /* @__PURE__ */ jsx("span", { className: "flex" });
359
+ $[2] = t2;
360
+ } else t2 = $[2];
361
+ let t3;
362
+ if ($[3] !== label) {
363
+ t3 = /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
364
+ render: t2,
365
+ children: /* @__PURE__ */ jsx(Spinner, {
366
+ "aria-label": label,
367
+ className: "text-muted-foreground size-4"
368
+ })
369
+ }), /* @__PURE__ */ jsx(TooltipContent, {
370
+ side: "bottom",
371
+ children: label
372
+ })] });
373
+ $[3] = label;
374
+ $[4] = t3;
375
+ } else t3 = $[4];
376
+ return t3;
377
+ }
378
+ /**
379
+ * Switches the studio to another locale, on the same page when that locale has it (ADR 0015:
380
+ * localizations share their original's id) or the same record when it shows a record page, or on
381
+ * its home.
382
+ */
383
+ function useSwitchLocale(recordPage) {
384
+ const $ = c(10);
385
+ const navigate = useNavigate();
386
+ const cache = useStudioCache();
387
+ const projectUuid = useProjectUuid();
388
+ const view = useViewLocale();
389
+ const path = useLocalePath();
390
+ let t0;
391
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
392
+ t0 = { select: _temp7 };
393
+ $[0] = t0;
394
+ } else t0 = $[0];
395
+ const search = useLocation(t0);
396
+ const destinations = usePageDestinations();
397
+ let t1;
398
+ if ($[1] !== cache || $[2] !== destinations || $[3] !== navigate || $[4] !== path || $[5] !== projectUuid || $[6] !== recordPage || $[7] !== search || $[8] !== view.locale) {
399
+ t1 = async (target) => {
400
+ if (target.tag === view.locale.tag && target.isDefault === view.locale.isDefault) return;
401
+ const pagesIn = (locale) => cache.ensure(reads.pageList({ projectUuid }), { locale }).catch(_temp8);
402
+ const recordPath = recordPage ? cache.reload(reads.discoveredPath({
403
+ projectUuid,
404
+ ...recordPage
405
+ }), { locale: target }).catch(_temp9) : null;
406
+ const [shown, other] = await Promise.all([pagesIn(view.locale), pagesIn(target)]);
407
+ const next = pathInLocale(path, {
408
+ shown,
409
+ target: other,
410
+ singleton: (candidate) => destinations.some((destination) => destination.kind === "singleton" && destination.fullPath === candidate),
411
+ recordPath: await recordPath
412
+ });
413
+ await navigate({ to: `${localizedPath(next, target)}${search}` });
414
+ };
415
+ $[1] = cache;
416
+ $[2] = destinations;
417
+ $[3] = navigate;
418
+ $[4] = path;
419
+ $[5] = projectUuid;
420
+ $[6] = recordPage;
421
+ $[7] = search;
422
+ $[8] = view.locale;
423
+ $[9] = t1;
424
+ } else t1 = $[9];
425
+ return t1;
426
+ }
427
+ function _temp9() {
428
+ return null;
429
+ }
430
+ function _temp8() {
431
+ return [];
432
+ }
433
+ function _temp7(location) {
434
+ return location.search;
435
+ }
436
+ function closeLocaleDialog() {
437
+ studioStore.send({ type: "closeLocaleDialog" });
438
+ }
439
+ /** Asks which language to add, then adds the locale, which Camox translates the website into. */
440
+ function AddLocaleDialog(t0) {
441
+ const $ = c(38);
442
+ const { projectId, locales, open, onAdded } = t0;
443
+ const cache = useStudioCache();
444
+ let t1;
445
+ if ($[0] !== locales) {
446
+ t1 = localeOptions(locales);
447
+ $[0] = locales;
448
+ $[1] = t1;
449
+ } else t1 = $[1];
450
+ const options = t1;
451
+ const [picked, setPicked] = React.useState(null);
452
+ let t2;
453
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
454
+ t2 = localeMutations.add();
455
+ $[2] = t2;
456
+ } else t2 = $[2];
457
+ let t3;
458
+ if ($[3] !== cache || $[4] !== onAdded || $[5] !== projectId) {
459
+ t3 = {
460
+ ...t2,
461
+ onSuccess: (added) => {
462
+ closeLocaleDialog();
463
+ setPicked(null);
464
+ toast.success(`Added ${localeLabel(added.tag)}`);
465
+ cache.invalidate(reads.localeList({ projectId }));
466
+ onAdded(added);
467
+ },
468
+ onError: _temp10
469
+ };
470
+ $[3] = cache;
471
+ $[4] = onAdded;
472
+ $[5] = projectId;
473
+ $[6] = t3;
474
+ } else t3 = $[6];
475
+ const add = useMutation(t3);
476
+ let t4;
477
+ if ($[7] !== add.isPending) {
478
+ t4 = (next) => {
479
+ if (!next && !add.isPending) closeLocaleDialog();
480
+ };
481
+ $[7] = add.isPending;
482
+ $[8] = t4;
483
+ } else t4 = $[8];
484
+ let t5;
485
+ if ($[9] !== add || $[10] !== picked || $[11] !== projectId) {
486
+ t5 = (event) => {
487
+ event.preventDefault();
488
+ if (picked) add.mutate({
489
+ projectId,
490
+ tag: picked.tag
491
+ });
492
+ };
493
+ $[9] = add;
494
+ $[10] = picked;
495
+ $[11] = projectId;
496
+ $[12] = t5;
497
+ } else t5 = $[12];
498
+ let t6;
499
+ if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
500
+ t6 = /* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: "Add a language" }), /* @__PURE__ */ jsx(DialogDescription, { children: "Camox translates the whole website into the new language in a draft. It goes live when the draft is published." })] });
501
+ $[13] = t6;
502
+ } else t6 = $[13];
503
+ let t7;
504
+ if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
505
+ t7 = /* @__PURE__ */ jsx(Label, {
506
+ htmlFor: "camox-locale-tag",
507
+ children: "Language"
508
+ });
509
+ $[14] = t7;
510
+ } else t7 = $[14];
511
+ let t8;
512
+ if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
513
+ t8 = /* @__PURE__ */ jsx(Combobox.Input, {
514
+ render: /* @__PURE__ */ jsx(Input, { id: "camox-locale-tag" }),
515
+ placeholder: "Search languages…",
516
+ autoFocus: true
517
+ });
518
+ $[15] = t8;
519
+ } else t8 = $[15];
520
+ let t9;
521
+ if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
522
+ t9 = /* @__PURE__ */ jsx(Combobox.Portal, { children: /* @__PURE__ */ jsx(Combobox.Positioner, {
523
+ sideOffset: 4,
524
+ align: "start",
525
+ className: "isolate z-50",
526
+ children: /* @__PURE__ */ jsxs(Combobox.Popup, {
527
+ className: "bg-popover text-popover-foreground ring-foreground/10 flex max-h-(--available-height) w-(--anchor-width) flex-col rounded-md p-1 shadow-md ring-1",
528
+ children: [/* @__PURE__ */ jsx(Combobox.Empty, {
529
+ className: "text-muted-foreground text-sm",
530
+ children: /* @__PURE__ */ jsx("div", {
531
+ className: "p-2",
532
+ children: "No languages found."
533
+ })
534
+ }), /* @__PURE__ */ jsx(Combobox.List, {
535
+ className: "max-h-64 min-h-0 overflow-y-auto",
536
+ children: _temp14
537
+ })]
538
+ })
539
+ }) });
540
+ $[16] = t9;
541
+ } else t9 = $[16];
542
+ let t10;
543
+ if ($[17] !== options || $[18] !== picked) {
544
+ t10 = /* @__PURE__ */ jsxs("div", {
545
+ className: "flex flex-col gap-2",
546
+ children: [t7, /* @__PURE__ */ jsxs(Combobox.Root, {
547
+ items: options,
548
+ value: picked,
549
+ onValueChange: setPicked,
550
+ itemToStringLabel: _temp11,
551
+ itemToStringValue: _temp12,
552
+ isItemEqualToValue: _temp13,
553
+ autoHighlight: true,
554
+ children: [t8, t9]
555
+ })]
556
+ });
557
+ $[17] = options;
558
+ $[18] = picked;
559
+ $[19] = t10;
560
+ } else t10 = $[19];
561
+ let t11;
562
+ if ($[20] !== add.isPending) {
563
+ t11 = /* @__PURE__ */ jsx(Button, {
564
+ type: "button",
565
+ variant: "outline",
566
+ disabled: add.isPending,
567
+ onClick: closeLocaleDialog,
568
+ children: "Cancel"
569
+ });
570
+ $[20] = add.isPending;
571
+ $[21] = t11;
572
+ } else t11 = $[21];
573
+ const t12 = !picked || add.isPending;
574
+ let t13;
575
+ if ($[22] !== add.isPending) {
576
+ t13 = add.isPending ? /* @__PURE__ */ jsx(Spinner, {}) : null;
577
+ $[22] = add.isPending;
578
+ $[23] = t13;
579
+ } else t13 = $[23];
580
+ let t14;
581
+ if ($[24] !== t12 || $[25] !== t13) {
582
+ t14 = /* @__PURE__ */ jsxs(Button, {
583
+ type: "submit",
584
+ disabled: t12,
585
+ children: [t13, "Add language"]
586
+ });
587
+ $[24] = t12;
588
+ $[25] = t13;
589
+ $[26] = t14;
590
+ } else t14 = $[26];
591
+ let t15;
592
+ if ($[27] !== t11 || $[28] !== t14) {
593
+ t15 = /* @__PURE__ */ jsxs(DialogFooter, { children: [t11, t14] });
594
+ $[27] = t11;
595
+ $[28] = t14;
596
+ $[29] = t15;
597
+ } else t15 = $[29];
598
+ let t16;
599
+ if ($[30] !== t10 || $[31] !== t15 || $[32] !== t5) {
600
+ t16 = /* @__PURE__ */ jsx(DialogContent, {
601
+ className: "sm:max-w-md",
602
+ children: /* @__PURE__ */ jsxs("form", {
603
+ className: "flex flex-col gap-4",
604
+ onSubmit: t5,
605
+ children: [
606
+ t6,
607
+ t10,
608
+ t15
609
+ ]
610
+ })
611
+ });
612
+ $[30] = t10;
613
+ $[31] = t15;
614
+ $[32] = t5;
615
+ $[33] = t16;
616
+ } else t16 = $[33];
617
+ let t17;
618
+ if ($[34] !== open || $[35] !== t16 || $[36] !== t4) {
619
+ t17 = /* @__PURE__ */ jsx(Dialog, {
620
+ open,
621
+ onOpenChange: t4,
622
+ children: t16
623
+ });
624
+ $[34] = open;
625
+ $[35] = t16;
626
+ $[36] = t4;
627
+ $[37] = t17;
628
+ } else t17 = $[37];
629
+ return t17;
630
+ }
631
+ function _temp14(option_2) {
632
+ return /* @__PURE__ */ jsx(Combobox.Item, {
633
+ value: option_2,
634
+ className: "data-highlighted:bg-accent data-highlighted:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-none",
635
+ children: /* @__PURE__ */ jsx("span", {
636
+ className: "min-w-0 flex-1 truncate",
637
+ children: option_2.label
638
+ })
639
+ }, option_2.tag);
640
+ }
641
+ function _temp13(option_1, value) {
642
+ return option_1.tag === value.tag;
643
+ }
644
+ function _temp12(option_0) {
645
+ return option_0.tag;
646
+ }
647
+ function _temp11(option) {
648
+ return option.label;
649
+ }
650
+ function _temp10(error) {
651
+ return toast.error(error.message || "Could not add the language");
652
+ }
653
+ /** Asks before removing a locale with all its content, then removes it in the draft. */
654
+ function RemoveLocaleDialog(t0) {
655
+ const $ = c(34);
656
+ const { projectId, locale, open, onRemoved } = t0;
657
+ const cache = useStudioCache();
658
+ let t1;
659
+ if ($[0] !== locale.tag) {
660
+ t1 = localeLabel(locale.tag);
661
+ $[0] = locale.tag;
662
+ $[1] = t1;
663
+ } else t1 = $[1];
664
+ const label = t1;
665
+ let t2;
666
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
667
+ t2 = localeMutations.remove();
668
+ $[2] = t2;
669
+ } else t2 = $[2];
670
+ let t3;
671
+ if ($[3] !== cache || $[4] !== label || $[5] !== onRemoved || $[6] !== projectId) {
672
+ t3 = {
673
+ ...t2,
674
+ onSuccess: () => {
675
+ closeLocaleDialog();
676
+ toast.success(`Removed ${label}`);
677
+ cache.invalidate(reads.localeList({ projectId }));
678
+ onRemoved();
679
+ },
680
+ onError: _temp15
681
+ };
682
+ $[3] = cache;
683
+ $[4] = label;
684
+ $[5] = onRemoved;
685
+ $[6] = projectId;
686
+ $[7] = t3;
687
+ } else t3 = $[7];
688
+ const remove = useMutation(t3);
689
+ let t4;
690
+ if ($[8] !== remove.isPending) {
691
+ t4 = (next) => {
692
+ if (!next && !remove.isPending) closeLocaleDialog();
693
+ };
694
+ $[8] = remove.isPending;
695
+ $[9] = t4;
696
+ } else t4 = $[9];
697
+ let t5;
698
+ if ($[10] !== label) {
699
+ t5 = /* @__PURE__ */ jsxs(AlertDialogHeader, { children: [/* @__PURE__ */ jsxs(AlertDialogTitle, { children: [
700
+ "Remove ",
701
+ label,
702
+ "?"
703
+ ] }), /* @__PURE__ */ jsxs(AlertDialogDescription, { children: [
704
+ "Its pages and content in ",
705
+ label,
706
+ " are removed in this draft. Once the draft is published, its content will be gone for good."
707
+ ] })] });
708
+ $[10] = label;
709
+ $[11] = t5;
710
+ } else t5 = $[11];
711
+ let t6;
712
+ if ($[12] !== remove.isPending) {
713
+ t6 = /* @__PURE__ */ jsx(AlertDialogCancel, {
714
+ variant: "outline",
715
+ size: "default",
716
+ disabled: remove.isPending,
717
+ children: "Cancel"
718
+ });
719
+ $[12] = remove.isPending;
720
+ $[13] = t6;
721
+ } else t6 = $[13];
722
+ let t7;
723
+ if ($[14] !== locale.tag || $[15] !== projectId || $[16] !== remove) {
724
+ t7 = () => remove.mutate({
725
+ projectId,
726
+ tag: locale.tag
727
+ });
728
+ $[14] = locale.tag;
729
+ $[15] = projectId;
730
+ $[16] = remove;
731
+ $[17] = t7;
732
+ } else t7 = $[17];
733
+ let t8;
734
+ if ($[18] !== remove.isPending) {
735
+ t8 = remove.isPending ? /* @__PURE__ */ jsx(Spinner, {}) : null;
736
+ $[18] = remove.isPending;
737
+ $[19] = t8;
738
+ } else t8 = $[19];
739
+ let t9;
740
+ if ($[20] !== remove.isPending || $[21] !== t7 || $[22] !== t8) {
741
+ t9 = /* @__PURE__ */ jsxs(AlertDialogAction, {
742
+ variant: "destructive",
743
+ disabled: remove.isPending,
744
+ onClick: t7,
745
+ children: [t8, "Remove language"]
746
+ });
747
+ $[20] = remove.isPending;
748
+ $[21] = t7;
749
+ $[22] = t8;
750
+ $[23] = t9;
751
+ } else t9 = $[23];
752
+ let t10;
753
+ if ($[24] !== t6 || $[25] !== t9) {
754
+ t10 = /* @__PURE__ */ jsxs(AlertDialogFooter, { children: [t6, t9] });
755
+ $[24] = t6;
756
+ $[25] = t9;
757
+ $[26] = t10;
758
+ } else t10 = $[26];
759
+ let t11;
760
+ if ($[27] !== t10 || $[28] !== t5) {
761
+ t11 = /* @__PURE__ */ jsxs(AlertDialogContent, { children: [t5, t10] });
762
+ $[27] = t10;
763
+ $[28] = t5;
764
+ $[29] = t11;
765
+ } else t11 = $[29];
766
+ let t12;
767
+ if ($[30] !== open || $[31] !== t11 || $[32] !== t4) {
768
+ t12 = /* @__PURE__ */ jsx(AlertDialog, {
769
+ open,
770
+ onOpenChange: t4,
771
+ children: t11
772
+ });
773
+ $[30] = open;
774
+ $[31] = t11;
775
+ $[32] = t4;
776
+ $[33] = t12;
777
+ } else t12 = $[33];
778
+ return t12;
779
+ }
780
+ function _temp15(error) {
781
+ return toast.error(error.message || "Could not remove the language");
782
+ }
783
+
784
+ //#endregion
785
+ export { LocalePicker };