@conloca/cms-spa 0.2.5 → 0.3.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 (483) hide show
  1. package/dist/spa/main.css +262 -21
  2. package/dist/ts/.build-inputs.json +99 -57
  3. package/dist/ts/CmsSpaApp.d.ts +4 -6
  4. package/dist/ts/CmsSpaApp.d.ts.map +1 -1
  5. package/dist/ts/CmsSpaApp.js +19 -8
  6. package/dist/ts/CmsSpaApp.js.map +1 -1
  7. package/dist/ts/components/conflicts/EditorNoticeStrip.d.ts +44 -0
  8. package/dist/ts/components/conflicts/EditorNoticeStrip.d.ts.map +1 -0
  9. package/dist/ts/components/conflicts/EditorNoticeStrip.js +55 -0
  10. package/dist/ts/components/conflicts/EditorNoticeStrip.js.map +1 -0
  11. package/dist/ts/components/conflicts/FieldConflictList.d.ts +20 -0
  12. package/dist/ts/components/conflicts/FieldConflictList.d.ts.map +1 -0
  13. package/dist/ts/components/conflicts/FieldConflictList.js +14 -0
  14. package/dist/ts/components/conflicts/FieldConflictList.js.map +1 -0
  15. package/dist/ts/components/conflicts/FieldConflictPicker.d.ts +28 -0
  16. package/dist/ts/components/conflicts/FieldConflictPicker.d.ts.map +1 -0
  17. package/dist/ts/components/conflicts/FieldConflictPicker.js +52 -0
  18. package/dist/ts/components/conflicts/FieldConflictPicker.js.map +1 -0
  19. package/dist/ts/components/conflicts/OverwriteNotice.d.ts +11 -0
  20. package/dist/ts/components/conflicts/OverwriteNotice.d.ts.map +1 -0
  21. package/dist/ts/components/conflicts/OverwriteNotice.js +8 -0
  22. package/dist/ts/components/conflicts/OverwriteNotice.js.map +1 -0
  23. package/dist/ts/components/conflicts/PageDraftMenu.d.ts +11 -0
  24. package/dist/ts/components/conflicts/PageDraftMenu.d.ts.map +1 -0
  25. package/dist/ts/components/conflicts/PageDraftMenu.js +20 -0
  26. package/dist/ts/components/conflicts/PageDraftMenu.js.map +1 -0
  27. package/dist/ts/components/conflicts/PeerAvatars.d.ts +9 -0
  28. package/dist/ts/components/conflicts/PeerAvatars.d.ts.map +1 -0
  29. package/dist/ts/components/conflicts/PeerAvatars.js +29 -0
  30. package/dist/ts/components/conflicts/PeerAvatars.js.map +1 -0
  31. package/dist/ts/components/conflicts/PuckConflicts.d.ts +13 -0
  32. package/dist/ts/components/conflicts/PuckConflicts.d.ts.map +1 -0
  33. package/dist/ts/components/conflicts/PuckConflicts.js +59 -0
  34. package/dist/ts/components/conflicts/PuckConflicts.js.map +1 -0
  35. package/dist/ts/components/conflicts/RecentVersionsDialog.d.ts +15 -0
  36. package/dist/ts/components/conflicts/RecentVersionsDialog.d.ts.map +1 -0
  37. package/dist/ts/components/conflicts/RecentVersionsDialog.js +94 -0
  38. package/dist/ts/components/conflicts/RecentVersionsDialog.js.map +1 -0
  39. package/dist/ts/components/conflicts/conflict-label.d.ts +12 -0
  40. package/dist/ts/components/conflicts/conflict-label.d.ts.map +1 -0
  41. package/dist/ts/components/conflicts/conflict-label.js +120 -0
  42. package/dist/ts/components/conflicts/conflict-label.js.map +1 -0
  43. package/dist/ts/components/conflicts/use-page-conflicts.d.ts +26 -0
  44. package/dist/ts/components/conflicts/use-page-conflicts.d.ts.map +1 -0
  45. package/dist/ts/components/conflicts/use-page-conflicts.js +93 -0
  46. package/dist/ts/components/conflicts/use-page-conflicts.js.map +1 -0
  47. package/dist/ts/components/conflicts/version-copy.d.ts +7 -0
  48. package/dist/ts/components/conflicts/version-copy.d.ts.map +1 -0
  49. package/dist/ts/components/conflicts/version-copy.js +31 -0
  50. package/dist/ts/components/conflicts/version-copy.js.map +1 -0
  51. package/dist/ts/components/dashboard/RecentActivity.d.ts.map +1 -1
  52. package/dist/ts/components/dashboard/RecentActivity.js +2 -1
  53. package/dist/ts/components/dashboard/RecentActivity.js.map +1 -1
  54. package/dist/ts/components/dialogs/CreatePageDialog.js +1 -1
  55. package/dist/ts/components/dialogs/CreatePageDialog.js.map +1 -1
  56. package/dist/ts/components/dialogs/DataPropertiesDialog.d.ts +2 -1
  57. package/dist/ts/components/dialogs/DataPropertiesDialog.d.ts.map +1 -1
  58. package/dist/ts/components/dialogs/DataPropertiesDialog.js +15 -3
  59. package/dist/ts/components/dialogs/DataPropertiesDialog.js.map +1 -1
  60. package/dist/ts/components/dialogs/FragmentPropertiesDialog.d.ts +2 -1
  61. package/dist/ts/components/dialogs/FragmentPropertiesDialog.d.ts.map +1 -1
  62. package/dist/ts/components/dialogs/FragmentPropertiesDialog.js +16 -3
  63. package/dist/ts/components/dialogs/FragmentPropertiesDialog.js.map +1 -1
  64. package/dist/ts/components/dialogs/PageMetadataDialog.d.ts +9 -2
  65. package/dist/ts/components/dialogs/PageMetadataDialog.d.ts.map +1 -1
  66. package/dist/ts/components/dialogs/PageMetadataDialog.js +63 -16
  67. package/dist/ts/components/dialogs/PageMetadataDialog.js.map +1 -1
  68. package/dist/ts/components/dialogs/UnsavedChangesDialog.d.ts +16 -1
  69. package/dist/ts/components/dialogs/UnsavedChangesDialog.d.ts.map +1 -1
  70. package/dist/ts/components/dialogs/UnsavedChangesDialog.js +90 -2
  71. package/dist/ts/components/dialogs/UnsavedChangesDialog.js.map +1 -1
  72. package/dist/ts/components/dialogs/unsaved-guard.d.ts +9 -0
  73. package/dist/ts/components/dialogs/unsaved-guard.d.ts.map +1 -0
  74. package/dist/ts/components/dialogs/unsaved-guard.js +14 -0
  75. package/dist/ts/components/dialogs/unsaved-guard.js.map +1 -0
  76. package/dist/ts/components/editor/CMSMDXEditor.d.ts +6 -1
  77. package/dist/ts/components/editor/CMSMDXEditor.d.ts.map +1 -1
  78. package/dist/ts/components/editor/CMSMDXEditor.js +32 -15
  79. package/dist/ts/components/editor/CMSMDXEditor.js.map +1 -1
  80. package/dist/ts/components/editor/EditorFrame.d.ts +22 -0
  81. package/dist/ts/components/editor/EditorFrame.d.ts.map +1 -0
  82. package/dist/ts/components/editor/EditorFrame.js +72 -0
  83. package/dist/ts/components/editor/EditorFrame.js.map +1 -0
  84. package/dist/ts/components/editor/FragmentBlockTypeSelect.d.ts +10 -0
  85. package/dist/ts/components/editor/FragmentBlockTypeSelect.d.ts.map +1 -0
  86. package/dist/ts/components/editor/FragmentBlockTypeSelect.js +187 -0
  87. package/dist/ts/components/editor/FragmentBlockTypeSelect.js.map +1 -0
  88. package/dist/ts/components/editor/FragmentComponentBlock.d.ts +7 -0
  89. package/dist/ts/components/editor/FragmentComponentBlock.d.ts.map +1 -0
  90. package/dist/ts/components/editor/FragmentComponentBlock.js +180 -0
  91. package/dist/ts/components/editor/FragmentComponentBlock.js.map +1 -0
  92. package/dist/ts/components/editor/FragmentEditor.d.ts +3 -1
  93. package/dist/ts/components/editor/FragmentEditor.d.ts.map +1 -1
  94. package/dist/ts/components/editor/FragmentEditor.js +545 -130
  95. package/dist/ts/components/editor/FragmentEditor.js.map +1 -1
  96. package/dist/ts/components/editor/FragmentEditorHeaderActions.d.ts +20 -0
  97. package/dist/ts/components/editor/FragmentEditorHeaderActions.d.ts.map +1 -0
  98. package/dist/ts/components/editor/FragmentEditorHeaderActions.js +49 -0
  99. package/dist/ts/components/editor/FragmentEditorHeaderActions.js.map +1 -0
  100. package/dist/ts/components/editor/GenericBlock.d.ts.map +1 -1
  101. package/dist/ts/components/editor/GenericBlock.js +109 -12
  102. package/dist/ts/components/editor/GenericBlock.js.map +1 -1
  103. package/dist/ts/components/editor/InlinePreviewFrame.d.ts +19 -0
  104. package/dist/ts/components/editor/InlinePreviewFrame.d.ts.map +1 -0
  105. package/dist/ts/components/editor/InlinePreviewFrame.js +65 -0
  106. package/dist/ts/components/editor/InlinePreviewFrame.js.map +1 -0
  107. package/dist/ts/components/editor/JsxPropsPanel.d.ts.map +1 -1
  108. package/dist/ts/components/editor/JsxPropsPanel.js +62 -2
  109. package/dist/ts/components/editor/JsxPropsPanel.js.map +1 -1
  110. package/dist/ts/components/editor/LocaleSelector.d.ts +2 -1
  111. package/dist/ts/components/editor/LocaleSelector.d.ts.map +1 -1
  112. package/dist/ts/components/editor/LocaleSelector.js +2 -2
  113. package/dist/ts/components/editor/LocaleSelector.js.map +1 -1
  114. package/dist/ts/components/editor/MDXLivePreview.d.ts +2 -0
  115. package/dist/ts/components/editor/MDXLivePreview.d.ts.map +1 -1
  116. package/dist/ts/components/editor/MDXLivePreview.js +30 -38
  117. package/dist/ts/components/editor/MDXLivePreview.js.map +1 -1
  118. package/dist/ts/components/editor/MdxPageEditor.d.ts +7 -2
  119. package/dist/ts/components/editor/MdxPageEditor.d.ts.map +1 -1
  120. package/dist/ts/components/editor/MdxPageEditor.js +136 -10
  121. package/dist/ts/components/editor/MdxPageEditor.js.map +1 -1
  122. package/dist/ts/components/editor/PageEditor.d.ts +4 -1
  123. package/dist/ts/components/editor/PageEditor.d.ts.map +1 -1
  124. package/dist/ts/components/editor/PageEditor.js +78 -100
  125. package/dist/ts/components/editor/PageEditor.js.map +1 -1
  126. package/dist/ts/components/editor/PageEditorHeaderActions.d.ts +15 -4
  127. package/dist/ts/components/editor/PageEditorHeaderActions.d.ts.map +1 -1
  128. package/dist/ts/components/editor/PageEditorHeaderActions.js +13 -7
  129. package/dist/ts/components/editor/PageEditorHeaderActions.js.map +1 -1
  130. package/dist/ts/components/editor/PageEditorWrapper.d.ts +8 -2
  131. package/dist/ts/components/editor/PageEditorWrapper.d.ts.map +1 -1
  132. package/dist/ts/components/editor/PageEditorWrapper.js +99 -41
  133. package/dist/ts/components/editor/PageEditorWrapper.js.map +1 -1
  134. package/dist/ts/components/editor/body-sync-plugin.d.ts +2 -0
  135. package/dist/ts/components/editor/body-sync-plugin.d.ts.map +1 -0
  136. package/dist/ts/components/editor/body-sync-plugin.js +32 -0
  137. package/dist/ts/components/editor/body-sync-plugin.js.map +1 -0
  138. package/dist/ts/components/editor/draft-media-config.d.ts +6 -0
  139. package/dist/ts/components/editor/draft-media-config.d.ts.map +1 -1
  140. package/dist/ts/components/editor/draft-media-config.js +21 -0
  141. package/dist/ts/components/editor/draft-media-config.js.map +1 -1
  142. package/dist/ts/components/editor/fragment-save-check.d.ts +7 -0
  143. package/dist/ts/components/editor/fragment-save-check.d.ts.map +1 -0
  144. package/dist/ts/components/editor/fragment-save-check.js +13 -0
  145. package/dist/ts/components/editor/fragment-save-check.js.map +1 -0
  146. package/dist/ts/components/editor/fragment-save-lifetime.d.ts +18 -0
  147. package/dist/ts/components/editor/fragment-save-lifetime.d.ts.map +1 -0
  148. package/dist/ts/components/editor/fragment-save-lifetime.js +115 -0
  149. package/dist/ts/components/editor/fragment-save-lifetime.js.map +1 -0
  150. package/dist/ts/components/editor/host-wrapper-plugin.d.ts.map +1 -1
  151. package/dist/ts/components/editor/host-wrapper-plugin.js +20 -7
  152. package/dist/ts/components/editor/host-wrapper-plugin.js.map +1 -1
  153. package/dist/ts/components/editor/index.d.ts +0 -1
  154. package/dist/ts/components/editor/index.d.ts.map +1 -1
  155. package/dist/ts/components/editor/index.js +0 -1
  156. package/dist/ts/components/editor/index.js.map +1 -1
  157. package/dist/ts/components/editor/insert-menu/InsertMdxComponentButton.d.ts.map +1 -1
  158. package/dist/ts/components/editor/insert-menu/InsertMdxComponentButton.js +6 -11
  159. package/dist/ts/components/editor/insert-menu/InsertMdxComponentButton.js.map +1 -1
  160. package/dist/ts/components/editor/insert-menu/SlashMenuPlugin.d.ts.map +1 -1
  161. package/dist/ts/components/editor/insert-menu/SlashMenuPlugin.js +66 -12
  162. package/dist/ts/components/editor/insert-menu/SlashMenuPlugin.js.map +1 -1
  163. package/dist/ts/components/editor/insert-menu/insert-payload.d.ts +16 -21
  164. package/dist/ts/components/editor/insert-menu/insert-payload.d.ts.map +1 -1
  165. package/dist/ts/components/editor/insert-menu/insert-payload.js +75 -22
  166. package/dist/ts/components/editor/insert-menu/insert-payload.js.map +1 -1
  167. package/dist/ts/components/editor/insert-menu/mdx-components-plugin.d.ts +3 -1
  168. package/dist/ts/components/editor/insert-menu/mdx-components-plugin.d.ts.map +1 -1
  169. package/dist/ts/components/editor/insert-menu/mdx-components-plugin.js +5 -3
  170. package/dist/ts/components/editor/insert-menu/mdx-components-plugin.js.map +1 -1
  171. package/dist/ts/components/editor/jsx-layout-plugin.d.ts +25 -0
  172. package/dist/ts/components/editor/jsx-layout-plugin.d.ts.map +1 -0
  173. package/dist/ts/components/editor/jsx-layout-plugin.js +77 -0
  174. package/dist/ts/components/editor/jsx-layout-plugin.js.map +1 -0
  175. package/dist/ts/components/editor/offered-mdx-components.d.ts +11 -0
  176. package/dist/ts/components/editor/offered-mdx-components.d.ts.map +1 -0
  177. package/dist/ts/components/editor/offered-mdx-components.js +27 -0
  178. package/dist/ts/components/editor/offered-mdx-components.js.map +1 -0
  179. package/dist/ts/components/editor/page-setting-targets.d.ts.map +1 -1
  180. package/dist/ts/components/editor/page-setting-targets.js +2 -1
  181. package/dist/ts/components/editor/page-setting-targets.js.map +1 -1
  182. package/dist/ts/components/editor/preview-availability.d.ts +16 -1
  183. package/dist/ts/components/editor/preview-availability.d.ts.map +1 -1
  184. package/dist/ts/components/editor/preview-availability.js +16 -1
  185. package/dist/ts/components/editor/preview-availability.js.map +1 -1
  186. package/dist/ts/components/editor/prop-field-hint.d.ts +13 -0
  187. package/dist/ts/components/editor/prop-field-hint.d.ts.map +1 -0
  188. package/dist/ts/components/editor/prop-field-hint.js +70 -0
  189. package/dist/ts/components/editor/prop-field-hint.js.map +1 -0
  190. package/dist/ts/components/editor/soft-break-plugin.d.ts +21 -0
  191. package/dist/ts/components/editor/soft-break-plugin.d.ts.map +1 -0
  192. package/dist/ts/components/editor/soft-break-plugin.js +52 -0
  193. package/dist/ts/components/editor/soft-break-plugin.js.map +1 -0
  194. package/dist/ts/components/editor/use-live-page-settings.d.ts +13 -0
  195. package/dist/ts/components/editor/use-live-page-settings.d.ts.map +1 -0
  196. package/dist/ts/components/editor/use-live-page-settings.js +76 -0
  197. package/dist/ts/components/editor/use-live-page-settings.js.map +1 -0
  198. package/dist/ts/components/editor/usePagePreview.d.ts +32 -0
  199. package/dist/ts/components/editor/usePagePreview.d.ts.map +1 -0
  200. package/dist/ts/components/editor/usePagePreview.js +252 -0
  201. package/dist/ts/components/editor/usePagePreview.js.map +1 -0
  202. package/dist/ts/components/editors/DataEditor.d.ts +6 -3
  203. package/dist/ts/components/editors/DataEditor.d.ts.map +1 -1
  204. package/dist/ts/components/editors/DataEditor.js +153 -19
  205. package/dist/ts/components/editors/DataEditor.js.map +1 -1
  206. package/dist/ts/components/fields/MDXEditField.d.ts +1 -1
  207. package/dist/ts/components/fields/MDXEditField.js +2 -2
  208. package/dist/ts/components/fields/MDXEditField.js.map +1 -1
  209. package/dist/ts/components/forms/SchemaForm.d.ts.map +1 -1
  210. package/dist/ts/components/forms/SchemaForm.js +1 -9
  211. package/dist/ts/components/forms/SchemaForm.js.map +1 -1
  212. package/dist/ts/components/media/AssetDetailSidebar.d.ts.map +1 -1
  213. package/dist/ts/components/media/AssetDetailSidebar.js +43 -5
  214. package/dist/ts/components/media/AssetDetailSidebar.js.map +1 -1
  215. package/dist/ts/components/pages/DataList.d.ts.map +1 -1
  216. package/dist/ts/components/pages/DataList.js +16 -4
  217. package/dist/ts/components/pages/DataList.js.map +1 -1
  218. package/dist/ts/components/pages/FragmentList.d.ts.map +1 -1
  219. package/dist/ts/components/pages/FragmentList.js +10 -0
  220. package/dist/ts/components/pages/FragmentList.js.map +1 -1
  221. package/dist/ts/components/pages/PageList.d.ts.map +1 -1
  222. package/dist/ts/components/pages/PageList.js +54 -118
  223. package/dist/ts/components/pages/PageList.js.map +1 -1
  224. package/dist/ts/components/pages/PageRow.d.ts +21 -0
  225. package/dist/ts/components/pages/PageRow.d.ts.map +1 -0
  226. package/dist/ts/components/pages/PageRow.js +70 -0
  227. package/dist/ts/components/pages/PageRow.js.map +1 -0
  228. package/dist/ts/components/pages/PageTable.d.ts +21 -0
  229. package/dist/ts/components/pages/PageTable.d.ts.map +1 -0
  230. package/dist/ts/components/pages/PageTable.js +12 -0
  231. package/dist/ts/components/pages/PageTable.js.map +1 -0
  232. package/dist/ts/components/pages/page-list-model.d.ts +20 -0
  233. package/dist/ts/components/pages/page-list-model.d.ts.map +1 -0
  234. package/dist/ts/components/pages/page-list-model.js +78 -0
  235. package/dist/ts/components/pages/page-list-model.js.map +1 -0
  236. package/dist/ts/components/puck/MDXContent.d.ts +3 -3
  237. package/dist/ts/components/puck/MDXContent.d.ts.map +1 -1
  238. package/dist/ts/components/puck/MDXContent.js +24 -72
  239. package/dist/ts/components/puck/MDXContent.js.map +1 -1
  240. package/dist/ts/components/puck/csp-frame-harness.d.ts +14 -0
  241. package/dist/ts/components/puck/csp-frame-harness.d.ts.map +1 -0
  242. package/dist/ts/components/puck/csp-frame-harness.js +85 -0
  243. package/dist/ts/components/puck/csp-frame-harness.js.map +1 -0
  244. package/dist/ts/components/puck/use-fragment-render.d.ts +9 -0
  245. package/dist/ts/components/puck/use-fragment-render.d.ts.map +1 -0
  246. package/dist/ts/components/puck/use-fragment-render.js +70 -0
  247. package/dist/ts/components/puck/use-fragment-render.js.map +1 -0
  248. package/dist/ts/components/sandbox/ContentSandbox.d.ts +3 -5
  249. package/dist/ts/components/sandbox/ContentSandbox.d.ts.map +1 -1
  250. package/dist/ts/components/sandbox/ContentSandbox.js +6 -8
  251. package/dist/ts/components/sandbox/ContentSandbox.js.map +1 -1
  252. package/dist/ts/components/sandbox/frame-runtime.d.ts +1 -1
  253. package/dist/ts/components/sandbox/frame-runtime.d.ts.map +1 -1
  254. package/dist/ts/components/sandbox/frame-runtime.js +1 -1
  255. package/dist/ts/components/sandbox/frame-runtime.js.map +1 -1
  256. package/dist/ts/components/toast.d.ts +8 -4
  257. package/dist/ts/components/toast.d.ts.map +1 -1
  258. package/dist/ts/components/toast.js +6 -1
  259. package/dist/ts/components/toast.js.map +1 -1
  260. package/dist/ts/components/ui/Card.d.ts +3 -5
  261. package/dist/ts/components/ui/Card.d.ts.map +1 -1
  262. package/dist/ts/components/ui/Card.js +3 -5
  263. package/dist/ts/components/ui/Card.js.map +1 -1
  264. package/dist/ts/components/ui/Select.d.ts.map +1 -1
  265. package/dist/ts/components/ui/Select.js +12 -3
  266. package/dist/ts/components/ui/Select.js.map +1 -1
  267. package/dist/ts/draft-tools.d.ts +76 -0
  268. package/dist/ts/draft-tools.d.ts.map +1 -0
  269. package/dist/ts/draft-tools.js +2 -0
  270. package/dist/ts/draft-tools.js.map +1 -0
  271. package/dist/ts/frame/channel.d.ts +1 -1
  272. package/dist/ts/frame/channel.d.ts.map +1 -1
  273. package/dist/ts/frame/channel.js +3 -0
  274. package/dist/ts/frame/channel.js.map +1 -1
  275. package/dist/ts/frame/editor-frame.d.ts.map +1 -1
  276. package/dist/ts/frame/editor-frame.js +188 -30
  277. package/dist/ts/frame/editor-frame.js.map +1 -1
  278. package/dist/ts/frame/protocol.d.ts +73 -4
  279. package/dist/ts/frame/protocol.d.ts.map +1 -1
  280. package/dist/ts/frame/protocol.js +54 -16
  281. package/dist/ts/frame/protocol.js.map +1 -1
  282. package/dist/ts/hooks/useUnsavedChangesGuard.d.ts +5 -3
  283. package/dist/ts/hooks/useUnsavedChangesGuard.d.ts.map +1 -1
  284. package/dist/ts/hooks/useUnsavedChangesGuard.js +17 -7
  285. package/dist/ts/hooks/useUnsavedChangesGuard.js.map +1 -1
  286. package/dist/ts/host-style-probe.d.ts.map +1 -1
  287. package/dist/ts/host-style-probe.js +160 -40
  288. package/dist/ts/host-style-probe.js.map +1 -1
  289. package/dist/ts/index.d.ts +13 -0
  290. package/dist/ts/index.d.ts.map +1 -1
  291. package/dist/ts/index.js +14 -0
  292. package/dist/ts/index.js.map +1 -1
  293. package/dist/ts/live/data-binding.d.ts +67 -0
  294. package/dist/ts/live/data-binding.d.ts.map +1 -0
  295. package/dist/ts/live/data-binding.js +215 -0
  296. package/dist/ts/live/data-binding.js.map +1 -0
  297. package/dist/ts/live/doc-channel.d.ts +74 -0
  298. package/dist/ts/live/doc-channel.d.ts.map +1 -0
  299. package/dist/ts/live/doc-channel.js +293 -0
  300. package/dist/ts/live/doc-channel.js.map +1 -0
  301. package/dist/ts/live/held-fragment-edits.d.ts +15 -0
  302. package/dist/ts/live/held-fragment-edits.d.ts.map +1 -0
  303. package/dist/ts/live/held-fragment-edits.js +47 -0
  304. package/dist/ts/live/held-fragment-edits.js.map +1 -0
  305. package/dist/ts/live/markdown-binding.d.ts +54 -0
  306. package/dist/ts/live/markdown-binding.d.ts.map +1 -0
  307. package/dist/ts/live/markdown-binding.js +618 -0
  308. package/dist/ts/live/markdown-binding.js.map +1 -0
  309. package/dist/ts/live/markdown-live-plugin.d.ts +42 -0
  310. package/dist/ts/live/markdown-live-plugin.d.ts.map +1 -0
  311. package/dist/ts/live/markdown-live-plugin.js +918 -0
  312. package/dist/ts/live/markdown-live-plugin.js.map +1 -0
  313. package/dist/ts/live/messages.d.ts +142 -0
  314. package/dist/ts/live/messages.d.ts.map +1 -0
  315. package/dist/ts/live/messages.js +266 -0
  316. package/dist/ts/live/messages.js.map +1 -0
  317. package/dist/ts/live/puck-binding.d.ts +88 -0
  318. package/dist/ts/live/puck-binding.d.ts.map +1 -0
  319. package/dist/ts/live/puck-binding.js +467 -0
  320. package/dist/ts/live/puck-binding.js.map +1 -0
  321. package/dist/ts/live/undo.d.ts +29 -0
  322. package/dist/ts/live/undo.d.ts.map +1 -0
  323. package/dist/ts/live/undo.js +104 -0
  324. package/dist/ts/live/undo.js.map +1 -0
  325. package/dist/ts/live/use-live.d.ts +77 -0
  326. package/dist/ts/live/use-live.d.ts.map +1 -0
  327. package/dist/ts/live/use-live.js +207 -0
  328. package/dist/ts/live/use-live.js.map +1 -0
  329. package/dist/ts/mdx-components-define.d.ts +52 -15
  330. package/dist/ts/mdx-components-define.d.ts.map +1 -1
  331. package/dist/ts/mdx-components-define.js +136 -0
  332. package/dist/ts/mdx-components-define.js.map +1 -1
  333. package/dist/ts/mdx-components.d.ts +11 -19
  334. package/dist/ts/mdx-components.d.ts.map +1 -1
  335. package/dist/ts/mdx-components.js +23 -32
  336. package/dist/ts/mdx-components.js.map +1 -1
  337. package/dist/ts/media/AssetScopePill.d.ts.map +1 -1
  338. package/dist/ts/media/AssetScopePill.js +2 -1
  339. package/dist/ts/media/AssetScopePill.js.map +1 -1
  340. package/dist/ts/merge-default-props.d.ts.map +1 -1
  341. package/dist/ts/merge-default-props.js +3 -0
  342. package/dist/ts/merge-default-props.js.map +1 -1
  343. package/dist/ts/selected-block.d.ts +27 -2
  344. package/dist/ts/selected-block.d.ts.map +1 -1
  345. package/dist/ts/selected-block.js +43 -1
  346. package/dist/ts/selected-block.js.map +1 -1
  347. package/dist/ts/site-render.d.ts +60 -0
  348. package/dist/ts/site-render.d.ts.map +1 -0
  349. package/dist/ts/site-render.js +87 -0
  350. package/dist/ts/site-render.js.map +1 -0
  351. package/dist/ts/types.d.ts +3 -0
  352. package/dist/ts/types.d.ts.map +1 -1
  353. package/dist/ts/ui-config.d.ts +29 -13
  354. package/dist/ts/ui-config.d.ts.map +1 -1
  355. package/dist/ts/ui-config.js +14 -3
  356. package/dist/ts/ui-config.js.map +1 -1
  357. package/dist/ts/utils/apply-clash.d.ts +44 -0
  358. package/dist/ts/utils/apply-clash.d.ts.map +1 -0
  359. package/dist/ts/utils/apply-clash.js +102 -0
  360. package/dist/ts/utils/apply-clash.js.map +1 -0
  361. package/dist/ts/utils/mdast-tree.d.ts +5 -7
  362. package/dist/ts/utils/mdast-tree.d.ts.map +1 -1
  363. package/dist/ts/utils/mdast-tree.js +8 -13
  364. package/dist/ts/utils/mdast-tree.js.map +1 -1
  365. package/dist/ts/utils/pageMetadata.d.ts +6 -2
  366. package/dist/ts/utils/pageMetadata.d.ts.map +1 -1
  367. package/dist/ts/utils/pageMetadata.js +25 -7
  368. package/dist/ts/utils/pageMetadata.js.map +1 -1
  369. package/dist/ts/utils/schema-fields.d.ts +2 -0
  370. package/dist/ts/utils/schema-fields.d.ts.map +1 -1
  371. package/dist/ts/utils/schema-fields.js +8 -0
  372. package/dist/ts/utils/schema-fields.js.map +1 -1
  373. package/dist/ts/write-access.d.ts +2 -0
  374. package/dist/ts/write-access.d.ts.map +1 -1
  375. package/dist/ts/write-access.js +9 -4
  376. package/dist/ts/write-access.js.map +1 -1
  377. package/package.json +18 -7
  378. package/src/CmsSpaApp.tsx +20 -11
  379. package/src/components/conflicts/EditorNoticeStrip.tsx +135 -0
  380. package/src/components/conflicts/FieldConflictList.tsx +59 -0
  381. package/src/components/conflicts/FieldConflictPicker.tsx +158 -0
  382. package/src/components/conflicts/OverwriteNotice.tsx +30 -0
  383. package/src/components/conflicts/PageDraftMenu.tsx +51 -0
  384. package/src/components/conflicts/PeerAvatars.tsx +51 -0
  385. package/src/components/conflicts/PuckConflicts.tsx +92 -0
  386. package/src/components/conflicts/RecentVersionsDialog.tsx +154 -0
  387. package/src/components/conflicts/conflict-label.ts +124 -0
  388. package/src/components/conflicts/use-page-conflicts.ts +112 -0
  389. package/src/components/conflicts/version-copy.ts +33 -0
  390. package/src/components/dashboard/RecentActivity.tsx +3 -2
  391. package/src/components/dialogs/CreatePageDialog.tsx +1 -1
  392. package/src/components/dialogs/DataPropertiesDialog.tsx +22 -4
  393. package/src/components/dialogs/FragmentPropertiesDialog.tsx +23 -4
  394. package/src/components/dialogs/PageMetadataDialog.tsx +157 -65
  395. package/src/components/dialogs/UnsavedChangesDialog.tsx +171 -21
  396. package/src/components/dialogs/unsaved-guard.ts +15 -0
  397. package/src/components/editor/CMSMDXEditor.tsx +238 -198
  398. package/src/components/editor/EditorFrame.tsx +116 -0
  399. package/src/components/editor/FragmentBlockTypeSelect.tsx +245 -0
  400. package/src/components/editor/FragmentComponentBlock.tsx +257 -0
  401. package/src/components/editor/FragmentEditor.tsx +899 -213
  402. package/src/components/editor/FragmentEditorHeaderActions.tsx +77 -0
  403. package/src/components/editor/GenericBlock.tsx +127 -16
  404. package/src/components/editor/InlinePreviewFrame.tsx +78 -0
  405. package/src/components/editor/JsxPropsPanel.tsx +90 -6
  406. package/src/components/editor/LocaleSelector.tsx +4 -2
  407. package/src/components/editor/MDXLivePreview.tsx +44 -46
  408. package/src/components/editor/MdxPageEditor.tsx +247 -7
  409. package/src/components/editor/PageEditor.tsx +154 -121
  410. package/src/components/editor/PageEditorHeaderActions.tsx +65 -27
  411. package/src/components/editor/PageEditorWrapper.tsx +122 -45
  412. package/src/components/editor/body-sync-plugin.ts +44 -0
  413. package/src/components/editor/draft-media-config.ts +22 -0
  414. package/src/components/editor/fragment-save-check.ts +26 -0
  415. package/src/components/editor/fragment-save-lifetime.ts +142 -0
  416. package/src/components/editor/host-wrapper-plugin.ts +28 -7
  417. package/src/components/editor/index.ts +0 -1
  418. package/src/components/editor/insert-menu/InsertMdxComponentButton.tsx +7 -11
  419. package/src/components/editor/insert-menu/SlashMenuPlugin.tsx +95 -18
  420. package/src/components/editor/insert-menu/insert-payload.ts +79 -30
  421. package/src/components/editor/insert-menu/mdx-components-plugin.ts +5 -3
  422. package/src/components/editor/jsx-layout-plugin.ts +103 -0
  423. package/src/components/editor/offered-mdx-components.ts +35 -0
  424. package/src/components/editor/page-setting-targets.tsx +2 -0
  425. package/src/components/editor/preview-availability.ts +21 -1
  426. package/src/components/editor/prop-field-hint.ts +75 -0
  427. package/src/components/editor/soft-break-plugin.ts +55 -0
  428. package/src/components/editor/use-live-page-settings.ts +80 -0
  429. package/src/components/editor/usePagePreview.ts +291 -0
  430. package/src/components/editors/DataEditor.tsx +257 -22
  431. package/src/components/fields/MDXEditField.tsx +2 -2
  432. package/src/components/forms/SchemaForm.tsx +1 -10
  433. package/src/components/media/AssetDetailSidebar.tsx +47 -6
  434. package/src/components/pages/DataList.tsx +14 -4
  435. package/src/components/pages/FragmentList.tsx +8 -0
  436. package/src/components/pages/PageList.tsx +90 -337
  437. package/src/components/pages/PageRow.tsx +290 -0
  438. package/src/components/pages/PageTable.tsx +71 -0
  439. package/src/components/pages/page-list-model.ts +98 -0
  440. package/src/components/puck/MDXContent.tsx +37 -113
  441. package/src/components/puck/csp-frame-harness.tsx +99 -0
  442. package/src/components/puck/use-fragment-render.ts +82 -0
  443. package/src/components/sandbox/ContentSandbox.tsx +6 -11
  444. package/src/components/sandbox/frame-runtime.ts +0 -2
  445. package/src/components/toast.tsx +23 -5
  446. package/src/components/ui/Card.tsx +3 -5
  447. package/src/components/ui/Select.tsx +14 -6
  448. package/src/draft-tools.ts +77 -0
  449. package/src/frame/channel.ts +3 -1
  450. package/src/frame/editor-frame.ts +210 -30
  451. package/src/frame/protocol.ts +98 -15
  452. package/src/hooks/useUnsavedChangesGuard.ts +17 -6
  453. package/src/host-style-probe.ts +157 -37
  454. package/src/index.ts +90 -0
  455. package/src/live/data-binding.ts +252 -0
  456. package/src/live/doc-channel.ts +343 -0
  457. package/src/live/held-fragment-edits.ts +47 -0
  458. package/src/live/markdown-binding.ts +630 -0
  459. package/src/live/markdown-live-plugin.tsx +1037 -0
  460. package/src/live/messages.ts +370 -0
  461. package/src/live/puck-binding.tsx +579 -0
  462. package/src/live/undo.ts +112 -0
  463. package/src/live/use-live.ts +264 -0
  464. package/src/main.css +184 -4
  465. package/src/mdx-components-define.ts +170 -24
  466. package/src/mdx-components.ts +29 -30
  467. package/src/media/AssetScopePill.tsx +2 -1
  468. package/src/merge-default-props.ts +4 -0
  469. package/src/selected-block.ts +55 -3
  470. package/src/site-render.ts +146 -0
  471. package/src/types.ts +3 -0
  472. package/src/ui-config.ts +51 -15
  473. package/src/utils/apply-clash.ts +113 -0
  474. package/src/utils/mdast-tree.ts +8 -12
  475. package/src/utils/pageMetadata.ts +25 -7
  476. package/src/utils/schema-fields.ts +9 -0
  477. package/src/write-access.ts +10 -4
  478. package/styles/tailwind-theme.css +11 -0
  479. package/dist/ts/components/editor/ContentDiff.d.ts +0 -10
  480. package/dist/ts/components/editor/ContentDiff.d.ts.map +0 -1
  481. package/dist/ts/components/editor/ContentDiff.js +0 -52
  482. package/dist/ts/components/editor/ContentDiff.js.map +0 -1
  483. package/src/components/editor/ContentDiff.tsx +0 -251
@@ -4,7 +4,6 @@ import {
4
4
  metaString,
5
5
  pageReferenceOf,
6
6
  StaleWriteError,
7
- useCompileMDX,
8
7
  useContent,
9
8
  useDataContext,
10
9
  useFragments,
@@ -12,20 +11,26 @@ import {
12
11
  useSitesConfig,
13
12
  useUpdateLocalized,
14
13
  } from '@conloca/content-api-client';
14
+ import type { FragmentOutlineComponent } from '@conloca/mdx/render';
15
15
  import type { ComponentConfig, Config, Data, PuckComponent } from '@puckeditor/core';
16
16
  import { resolveAllData } from '@puckeditor/core';
17
17
  import { type ReactNode, useEffect, useMemo, useRef, useState } from 'react';
18
- import { useNavigate, useParams } from 'react-router-dom';
18
+ import { useNavigate, useParams, useSearchParams } from 'react-router-dom';
19
+ import { useDocChannel } from '../../live/doc-channel.js';
20
+ import { readPuckData } from '../../live/puck-binding.js';
21
+ import { useLiveDoc } from '../../live/use-live.js';
19
22
  import { mergeDefaultProps } from '../../merge-default-props.js';
20
23
  import type { PageMetadata } from '../../types.js';
21
24
  import { getUIConfig } from '../../ui-config.js';
22
- import { contentFailureMessage } from '../../utils/content-failure.js';
23
- import { buildMetadataUpdate, extractPageMetadata } from '../../utils/pageMetadata.js';
25
+ import { buildMetadataUpdate, extractPageMetadata, pageSettingsSaveError } from '../../utils/pageMetadata.js';
24
26
  import { PageMetadataDialog } from '../dialogs/PageMetadataDialog.js';
25
27
  import { type ContentFragmentOption, ContentFragmentSelectorField } from '../fields/ContentFragmentSelectorField.js';
28
+ import { useFragmentRender } from '../puck/use-fragment-render.js';
26
29
  import { FragmentContentWrapper, FragmentFieldWrapper } from './FragmentWrappers.js';
30
+ import { preventLinkNavigation } from './InlinePreviewFrame.js';
27
31
  import { MdxPageEditor } from './MdxPageEditor.js';
28
32
  import { PageEditor } from './PageEditor.js';
33
+ import { useLivePageSettings } from './use-live-page-settings.js';
29
34
 
30
35
  interface PageEditorWrapperProps {
31
36
  puckConfig: Config;
@@ -43,24 +48,31 @@ export interface ContentFragmentSectionProps {
43
48
  /**
44
49
  * The fragment's headings, in document order, carrying the ids its markup
45
50
  * puts on them. Supplied by the platform on both surfaces so a site can show
46
- * a contents list without reading the rendered page back — which the editor
47
- * cannot do anyway, since the body renders in a sandbox it cannot see into.
51
+ * a contents list without reading the rendered page back.
48
52
  */
49
53
  fragmentOutline?: readonly MDXHeading[];
54
+ /**
55
+ * The components the site's fragment vocabulary declares contents entries
56
+ * (`defineFragmentComponents`' `outline`), in document order, with the id and
57
+ * text their props carry. Supplied on both surfaces like `fragmentOutline`.
58
+ */
59
+ fragmentComponentOutline?: readonly FragmentOutlineComponent[];
50
60
  }
51
61
 
52
62
  /**
53
- * The selected fragment's headings, for a host block that shows a contents
54
- * list. The body renders in a sandbox this document cannot read, so the
55
- * outline comes off the compile instead — the same compile the preview
56
- * already requests, deduplicated by its query key, so this costs no second
57
- * round trip.
63
+ * The selected fragment's headings and outlined components, for a host block
64
+ * that shows a contents list: the outlines of the same inline render the
65
+ * preview shows, so this costs no second render. Empty while that render is pending.
58
66
  */
59
- function useFragmentOutline(fragmentId: string, locale: string): readonly MDXHeading[] {
67
+ function useFragmentOutlines(
68
+ fragmentId: string,
69
+ locale: string,
70
+ ): Required<Pick<ContentFragmentSectionProps, 'fragmentOutline' | 'fragmentComponentOutline'>> {
60
71
  const { data: entry } = useLocalizedContent(fragmentId, locale);
61
- const mdx = entry?.localized?.content?.mdx ?? null;
62
- const { data } = useCompileMDX({ mdxContent: mdx, cacheKey: entry?.localized?.etag });
63
- return data?.outline ?? [];
72
+ const rendered = useFragmentRender(entry?.localized?.content?.mdx ?? '');
73
+ return rendered.status === 'done'
74
+ ? { fragmentOutline: rendered.outline, fragmentComponentOutline: rendered.componentOutline ?? [] }
75
+ : { fragmentOutline: [], fragmentComponentOutline: [] };
64
76
  }
65
77
 
66
78
  /**
@@ -80,15 +92,21 @@ function withFragmentPreview(
80
92
  const HostBlock = hostRender;
81
93
 
82
94
  return (props) => {
83
- const fragmentOutline = useFragmentOutline(props.fragmentId, locale);
95
+ const outlines = useFragmentOutlines(props.fragmentId, locale);
84
96
 
85
97
  return (
86
98
  <HostBlock
87
99
  {...props}
88
- fragmentOutline={fragmentOutline}
100
+ {...outlines}
89
101
  fragment={
90
102
  resolvable.has(props.fragmentId) ? (
91
- <div className="mdx-content conloca-prose" data-conloca-content-root="">
103
+ <div
104
+ className="mdx-content conloca-prose"
105
+ data-conloca-content-root=""
106
+ onClickCapture={preventLinkNavigation}
107
+ onAuxClickCapture={preventLinkNavigation}
108
+ onSubmitCapture={preventLinkNavigation}
109
+ >
92
110
  <FragmentContentWrapper contentId={props.fragmentId} locale={locale} />
93
111
  </div>
94
112
  ) : undefined
@@ -147,7 +165,13 @@ export function enhancePuckConfigWithFragments(
147
165
  },
148
166
  defaultProps: { contentId: fragment.id },
149
167
  render: ({ contentId }: { contentId: string }) => (
150
- <div className="mdx-content conloca-prose" data-conloca-content-root="">
168
+ <div
169
+ className="mdx-content conloca-prose"
170
+ data-conloca-content-root=""
171
+ onClickCapture={preventLinkNavigation}
172
+ onAuxClickCapture={preventLinkNavigation}
173
+ onSubmitCapture={preventLinkNavigation}
174
+ >
151
175
  <FragmentContentWrapper contentId={contentId} locale={locale} />
152
176
  </div>
153
177
  ),
@@ -238,11 +262,47 @@ function PageLoadFailure({ message }: { message?: string }) {
238
262
 
239
263
  export function PageEditorWrapper({ puckConfig }: PageEditorWrapperProps) {
240
264
  const { id } = useParams();
265
+ const [searchParams] = useSearchParams();
241
266
  // Use the kind-level hook so dispatch works regardless of which locales
242
267
  // exist for the page (a previous `useLocalizedContent(id, 'en')` would
243
268
  // stall on the loading branch for any page that exists only in non-en
244
269
  // locales — the headline use case for `mdxPagesDefaultLocale`).
245
- const { data: content, isLoading, error } = useContent(id || '');
270
+ const { data: content, isLoading, isFetching, error, refetch } = useContent(id || '');
271
+ const requestedLocale = searchParams.get('locale');
272
+ const editorKey = `${id}:${requestedLocale ?? ''}`;
273
+ const [readyRoute, setReadyRoute] = useState<{ key: string; locale: string } | null>(null);
274
+ const readyRouteKey = readyRoute?.key;
275
+ const localeRefresh = useRef<{ key: string; request: ReturnType<typeof refetch> } | null>(null);
276
+ const [settledLocaleRefresh, setSettledLocaleRefresh] = useState<ReturnType<typeof refetch> | null>(null);
277
+
278
+ useEffect(() => {
279
+ if (readyRouteKey === editorKey || isLoading || !content || error) return undefined;
280
+ const requestedLocaleMissing =
281
+ requestedLocale &&
282
+ (!Object.prototype.hasOwnProperty.call(content.locales, requestedLocale) || !content.locales[requestedLocale]);
283
+ const refresh = localeRefresh.current;
284
+ const refreshSettled = refresh?.key === editorKey && settledLocaleRefresh === refresh.request;
285
+ if (!requestedLocaleMissing || (refreshSettled && !isFetching)) {
286
+ localeRefresh.current = null;
287
+ setReadyRoute({ key: editorKey, locale: initialPageLocale(content.locales, requestedLocale) });
288
+ return undefined;
289
+ }
290
+
291
+ // The cached manifest can still be fresh while the page list already knows a newer locale.
292
+ if (localeRefresh.current?.key !== editorKey) {
293
+ localeRefresh.current = { key: editorKey, request: refetch({ cancelRefetch: false }) };
294
+ }
295
+ const request = localeRefresh.current.request;
296
+ let active = true;
297
+ // A canceled request can settle while its replacement still fetches, or after the observer changes page.
298
+ // Use settlement only as a signal; the current query supplies the locale once fetching has finished.
299
+ void request.then(() => {
300
+ if (active) setSettledLocaleRefresh(request);
301
+ });
302
+ return () => {
303
+ active = false;
304
+ };
305
+ }, [content, editorKey, error, isFetching, isLoading, readyRouteKey, refetch, requestedLocale, settledLocaleRefresh]);
246
306
 
247
307
  // Failure first: a failed load never produces content, so checking
248
308
  // the loading state first would spin forever with no error and no
@@ -251,25 +311,24 @@ export function PageEditorWrapper({ puckConfig }: PageEditorWrapperProps) {
251
311
  return <PageLoadFailure message={error?.message} />;
252
312
  }
253
313
 
254
- if (isLoading || !content) {
314
+ if (isLoading || !content || readyRoute?.key !== editorKey) {
255
315
  return <div className="flex items-center justify-center h-full">Loading...</div>;
256
316
  }
257
317
 
258
318
  if (content.type === 'mdx') {
259
- return <MdxPageEditor />;
319
+ return <MdxPageEditor key={editorKey} initialLocale={readyRoute.locale} />;
260
320
  }
261
321
 
262
- // Keyed by page: the route element survives navigation between pages, and
263
- // the locale state must restart from the newly opened page's locales.
264
- return <PuckPageEditorInner key={id} puckConfig={puckConfig} initialLocale={initialPageLocale(content.locales)} />;
322
+ return <PuckPageEditorInner key={editorKey} puckConfig={puckConfig} initialLocale={readyRoute.locale} />;
265
323
  }
266
324
 
267
325
  /**
268
- * The locale the editor opens a page in: English when the page has it, as
269
- * before, otherwise a locale the page actually has — opening on a locale with
270
- * no variant fails the load with no way to reach the switcher.
326
+ * Open the requested locale when the page has it, otherwise English or its first
327
+ * available locale. A locale with no variant fails the load before the switcher.
271
328
  */
272
- function initialPageLocale(locales: Record<string, unknown>): string {
329
+ function initialPageLocale(locales: ContentManifest['locales'], requestedLocale: string | null): string {
330
+ if (requestedLocale && Object.prototype.hasOwnProperty.call(locales, requestedLocale) && locales[requestedLocale])
331
+ return requestedLocale;
273
332
  if (locales.en) return 'en';
274
333
  return Object.keys(locales).find((locale) => locales[locale]) ?? 'en';
275
334
  }
@@ -288,6 +347,7 @@ function PuckPageEditorInner({ puckConfig, initialLocale }: PageEditorWrapperPro
288
347
 
289
348
  // Load page content for the active locale.
290
349
  const { data: content, isLoading: isLoadingContent, error } = useLocalizedContent(id || '', currentLocale);
350
+ const liveSettings = useLivePageSettings(id || '', currentLocale);
291
351
 
292
352
  // Load user-created fragments for config enhancement
293
353
  const { data: fragmentsData } = useFragments();
@@ -327,7 +387,12 @@ function PuckPageEditorInner({ puckConfig, initialLocale }: PageEditorWrapperPro
327
387
  if (!puckConfig || !fragmentsData?.items) return puckConfig;
328
388
  return enhancePuckConfigWithFragments(puckConfig, fragmentsData.items, currentLocale);
329
389
  }, [puckConfig, fragmentsData, currentLocale]);
330
- const puckData = content?.localized?.content?.puckData;
390
+ // Live: the blocks come from the page's replica, read once per replica; Puck is then kept in step by the binding.
391
+ const channel = useDocChannel();
392
+ const liveDoc = useLiveDoc(channel && id ? { kind: 'puck', id, locale: currentLocale } : null);
393
+ const live = liveDoc.state === 'ready' ? liveDoc.live : undefined;
394
+ const livePuckData = useMemo(() => (live ? readPuckData(live.doc) : undefined), [live]);
395
+ const puckData = channel ? livePuckData : content?.localized?.content?.puckData;
331
396
 
332
397
  // Resolving again replaces the editor, unsaved block edits included, so it
333
398
  // runs when the blocks change other than by the editor's own save, or the
@@ -406,6 +471,9 @@ function PuckPageEditorInner({ puckConfig, initialLocale }: PageEditorWrapperPro
406
471
  if (error || (!isLoadingContent && !content?.localized)) {
407
472
  return <PageLoadFailure message={error?.message} />;
408
473
  }
474
+ if (liveDoc.state === 'failed') {
475
+ return <PageLoadFailure message={liveDoc.message} />;
476
+ }
409
477
 
410
478
  // Blocks resolved without the data their route binds would show a page
411
479
  // that differs from the published one without saying so.
@@ -437,6 +505,9 @@ function PuckPageEditorInner({ puckConfig, initialLocale }: PageEditorWrapperPro
437
505
  return (
438
506
  <>
439
507
  <PageEditor
508
+ // A handover to a new replica remounts Puck on its content.
509
+ key={live?.docKey}
510
+ live={live}
440
511
  entry={entryWithResolvedData}
441
512
  config={enhancedConfig}
442
513
  // The data context for Puck's internal resolveData (field changes, etc.)
@@ -494,8 +565,14 @@ function PuckPageEditorInner({ puckConfig, initialLocale }: PageEditorWrapperPro
494
565
  }}
495
566
  onBack={() => navigate('/pages')}
496
567
  onOpenMetadata={(field) => {
497
- setMetadataFocusField(field);
498
- setMetadataDialogOpen(true);
568
+ const open = () => {
569
+ setMetadataFocusField(field);
570
+ setMetadataDialogOpen(true);
571
+ };
572
+ // Live, a teammate's settings change reaches no open editor, so the dialog reads the page first. Not with
573
+ // the flag off: there the etag also guards the block Save, which a newer one would let overwrite unseen work.
574
+ if (live) liveSettings.openLatest(open);
575
+ else open();
499
576
  }}
500
577
  onReload={() => {
501
578
  window.location.reload();
@@ -507,7 +584,15 @@ function PuckPageEditorInner({ puckConfig, initialLocale }: PageEditorWrapperPro
507
584
  onOpenChange={setMetadataDialogOpen}
508
585
  focusField={metadataFocusField}
509
586
  page={pageMetadata!}
510
- onSave={async (metadata: PageMetadata) => {
587
+ etag={content.localized?.etag}
588
+ live={live !== undefined}
589
+ onSave={async (metadata: PageMetadata, formEtag: string | undefined) => {
590
+ if (live) {
591
+ // Live, the write merges from the version the form's values came from, not one a refetch moved to.
592
+ const etag = await liveSettings.save(metadata, formEtag ?? currentEtag);
593
+ if (etag) setCurrentEtag(etag);
594
+ return;
595
+ }
511
596
  const result = await updateContent.mutateAsync({
512
597
  id: content.id,
513
598
  locale: currentLocale,
@@ -520,19 +605,11 @@ function PuckPageEditorInner({ puckConfig, initialLocale }: PageEditorWrapperPro
520
605
  }
521
606
  if (!result.success) {
522
607
  // A failure must throw so the dialog stays open and shows what
523
- // happened; it used to stop at console.error while the dialog
524
- // closed. Some storage clients resolve failed writes as
608
+ // happened; some storage clients resolve failed writes as
525
609
  // { success: false } instead of throwing, so a resolved failure
526
- // must take the same exit as a thrown one — otherwise the dialog
527
- // closes and the lost change looks saved. Its message says why,
528
- // such as a new path another page already has; that message
529
- // arrives as plain text from a remote route, which the dialog
530
- // could only replace with a generic "try again".
531
- throw new Error(
532
- result.reason === 'stale_write'
533
- ? 'Someone else saved this page first. Close the dialog, reload to pick up their changes, then try again.'
534
- : contentFailureMessage(result, 'Saving the page settings failed.'),
535
- );
610
+ // takes the same exit. A same-field clash throws ApplyClashError,
611
+ // whose fields the dialog reloads.
612
+ throw pageSettingsSaveError(result);
536
613
  }
537
614
  }}
538
615
  />
@@ -0,0 +1,44 @@
1
+ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
2
+ import {
3
+ addNestedEditorChild$,
4
+ NESTED_EDITOR_UPDATED_COMMAND,
5
+ realmPlugin,
6
+ useNestedEditorContext,
7
+ } from '@mdxeditor/editor';
8
+ import { $addUpdateTag, HISTORIC_TAG, HISTORY_MERGE_TAG } from 'lexical';
9
+ import { useEffect } from 'react';
10
+
11
+ /**
12
+ * Writes a component's body back to the document on each edit. The library writes it back only when the body loses
13
+ * focus, so the document, and with it the unsaved-changes state, lagged behind typing until the author clicked away.
14
+ */
15
+ function BodySync() {
16
+ const [editor] = useLexicalComposerContext();
17
+ const { parentEditor } = useNestedEditorContext();
18
+ useEffect(
19
+ () =>
20
+ editor.registerUpdateListener(({ dirtyElements, dirtyLeaves, tags }) => {
21
+ // Loading the body (a history-merge update) or moving the caret edits nothing; text mid-composition is not
22
+ // final yet. Writing a loaded body back would rewrite the component on open.
23
+ const edited = !tags.has(HISTORY_MERGE_TAG) && (dirtyElements.size > 0 || dirtyLeaves.size > 0);
24
+ if (!edited || editor.isComposing()) return;
25
+ // The body's own history already holds the edit, merged by word; the copy in the document is kept out of it,
26
+ // or each keystroke would be an undo step of its own and undo would revert the copy, not the body.
27
+ parentEditor.update(
28
+ () => {
29
+ $addUpdateTag(HISTORIC_TAG);
30
+ editor.dispatchCommand(NESTED_EDITOR_UPDATED_COMMAND, undefined);
31
+ },
32
+ { discrete: true },
33
+ );
34
+ }),
35
+ [editor, parentEditor],
36
+ );
37
+ return null;
38
+ }
39
+
40
+ export const bodySyncPlugin = realmPlugin({
41
+ init(realm) {
42
+ realm.pubIn({ [addNestedEditorChild$]: BodySync });
43
+ },
44
+ });
@@ -1,6 +1,7 @@
1
1
  /** Resolve unpublished draft images for site renderers without changing Puck's persisted data. */
2
2
  /* oxlint-disable anti-slop/no-unsafe-dictionary-type, anti-slop/no-unknown-returns -- block props are whatever the site's components take; this walk only swaps image strings and passes every other value through as it came. */
3
3
  import { draftMediaRefPath, mediaRefPath } from '@conloca/content-api-client';
4
+ import type { FragmentVocabulary } from '@conloca/mdx/render';
4
5
  import type { Config, Field, Fields, PuckContext } from '@puckeditor/core';
5
6
  import { type ComponentType, createElement, isValidElement } from 'react';
6
7
  import { loadedMedia, mediaLoadState, useMediaCacheVersion } from '../../frame/media-cache.js';
@@ -251,3 +252,24 @@ export function withDraftMediaRendering(config: Config): Config {
251
252
  ),
252
253
  };
253
254
  }
255
+
256
+ const shownImageVocabularies = new WeakMap<FragmentVocabulary, FragmentVocabulary>();
257
+
258
+ /**
259
+ * `vocabulary` with its `img` (the site's override, or the plain element) showing each image as `shownImage`
260
+ * decides, re-rendering when a load lands; `vocabulary` itself without `UIConfig.loadMedia`.
261
+ */
262
+ export function withShownImages(vocabulary: FragmentVocabulary): FragmentVocabulary {
263
+ if (getUIConfig().loadMedia === undefined) return vocabulary;
264
+ const cached = shownImageVocabularies.get(vocabulary);
265
+ if (cached) return cached;
266
+ const Img = vocabulary.elements.img ?? 'img';
267
+ const ShownImg = (props: { src?: unknown }) => {
268
+ useMediaCacheVersion();
269
+ const source = typeof props.src === 'string' ? mediaSourceOf(props.src) : undefined;
270
+ return createElement(Img, source ? { ...props, src: shownImage(source) } : props);
271
+ };
272
+ const shown: FragmentVocabulary = { ...vocabulary, elements: { ...vocabulary.elements, img: ShownImg } };
273
+ shownImageVocabularies.set(vocabulary, shown);
274
+ return shown;
275
+ }
@@ -0,0 +1,26 @@
1
+ import {
2
+ checkFragmentMdx,
3
+ type FragmentMdxProblem,
4
+ type FragmentPropSpec,
5
+ type FragmentVocabulary,
6
+ fragmentPropSpec,
7
+ } from '@conloca/mdx/render';
8
+ import { isJsxDescriptor, type MdxComponents } from '../../mdx-components-define.js';
9
+
10
+ /** The prop specs the save check reads from the editor's JSX descriptors. */
11
+ export function fragmentPropSpecs(descriptors: MdxComponents): Record<string, Record<string, FragmentPropSpec>> {
12
+ return Object.fromEntries(
13
+ descriptors
14
+ .filter(isJsxDescriptor)
15
+ .map((d) => [d.name, Object.fromEntries((d.props ?? []).map((p) => [p.name, fragmentPropSpec(p)]))]),
16
+ );
17
+ }
18
+
19
+ /** Why the site's renderer would refuse `mdx`, or undefined when it may be saved. */
20
+ export function checkFragmentSave(
21
+ mdx: string,
22
+ vocabulary: FragmentVocabulary,
23
+ descriptors: MdxComponents,
24
+ ): FragmentMdxProblem | undefined {
25
+ return checkFragmentMdx(mdx, new Set(Object.keys(vocabulary.components)), fragmentPropSpecs(descriptors));
26
+ }
@@ -0,0 +1,142 @@
1
+ import { type ContentAPIClient, getContentAPIClient, useLocalizedContent } from '@conloca/content-api-client';
2
+ import { useQueryClient } from '@tanstack/react-query';
3
+ import { useEffect, useState } from 'react';
4
+ import { contentWriteOwner } from '../../write-access.js';
5
+
6
+ const pendingWrites = new WeakMap<ContentAPIClient, Map<string, Set<Promise<void>>>>();
7
+
8
+ /** A request can finish after its editor unmounts; keep its lifetime scoped to the same content client. */
9
+ export function trackFragmentSave<T>(
10
+ client: ContentAPIClient,
11
+ id: string,
12
+ locale: string,
13
+ request: Promise<T>,
14
+ ): Promise<T> {
15
+ const owner = contentWriteOwner(client);
16
+ const key = JSON.stringify([id, locale]);
17
+ const writes = pendingWrites.get(owner) ?? new Map<string, Set<Promise<void>>>();
18
+ const requests = writes.get(key) ?? new Set<Promise<void>>();
19
+ const settled = request.then(
20
+ () => undefined,
21
+ () => undefined,
22
+ );
23
+ requests.add(settled);
24
+ writes.set(key, requests);
25
+ pendingWrites.set(owner, writes);
26
+ void settled.then(() => {
27
+ requests.delete(settled);
28
+ if (requests.size === 0) writes.delete(key);
29
+ if (writes.size === 0) pendingWrites.delete(owner);
30
+ });
31
+ return request;
32
+ }
33
+
34
+ /** Wait for every write already sent for this document without retaining its text or treating a rejection as saved. */
35
+ export function pendingFragmentSave(client: ContentAPIClient, id: string, locale: string): Promise<void> | null {
36
+ const requests = pendingWrites.get(contentWriteOwner(client))?.get(JSON.stringify([id, locale]));
37
+ return requests?.size ? Promise.all(requests).then(() => undefined) : null;
38
+ }
39
+
40
+ const SAVE_WAIT_TIMEOUT_MS = 30_000;
41
+ const SAVE_WAIT_FAILURE = 'The previous save has not finished. Try again or go back.';
42
+
43
+ /** A deadline reports an unknown write outcome; it never forgets or releases that write. */
44
+ export function waitForFragmentSave(pending: Promise<void> | null): Promise<void> {
45
+ if (!pending) return Promise.resolve();
46
+ return new Promise((resolve, reject) => {
47
+ const timer = setTimeout(() => reject(new Error(SAVE_WAIT_FAILURE)), SAVE_WAIT_TIMEOUT_MS);
48
+ void pending.then(
49
+ () => {
50
+ clearTimeout(timer);
51
+ resolve();
52
+ },
53
+ (error: unknown) => {
54
+ clearTimeout(timer);
55
+ reject(error);
56
+ },
57
+ );
58
+ });
59
+ }
60
+
61
+ interface FragmentArrival {
62
+ client: ContentAPIClient;
63
+ id: string;
64
+ locale: string;
65
+ pending: Promise<void> | null;
66
+ refresh?: boolean;
67
+ }
68
+
69
+ interface FragmentArrivalResolution {
70
+ arrival: FragmentArrival;
71
+ settled: boolean;
72
+ waitError?: string;
73
+ }
74
+
75
+ /** A reopened editor must read after earlier writes settle, before MDX takes its one-time initial value. */
76
+ export function useFragmentContent(id: string, locale: string) {
77
+ const client = contentWriteOwner(getContentAPIClient());
78
+ const queryClient = useQueryClient();
79
+ const [snapshot, setSnapshot] = useState<FragmentArrival>(() => ({
80
+ client,
81
+ id,
82
+ locale,
83
+ pending: pendingFragmentSave(client, id, locale),
84
+ }));
85
+ let current = snapshot;
86
+ if (snapshot.client !== client || snapshot.id !== id || snapshot.locale !== locale) {
87
+ current = { client, id, locale, pending: pendingFragmentSave(client, id, locale) };
88
+ setSnapshot(current);
89
+ }
90
+ // This is the arrival snapshot, not a disposable memo: the editor's own later saves cannot unmount its surface.
91
+ const [resolution, setResolution] = useState<FragmentArrivalResolution | null>(null);
92
+ const isSettled = resolution?.arrival === current && resolution.settled;
93
+ const waitError = resolution?.arrival === current ? resolution.waitError : undefined;
94
+ const waitingForSave = !isSettled && (current.pending !== null || resolution?.arrival === current);
95
+ // Even an idle arrival must wait until passive cleanup has revoked the previous editor's flush handler.
96
+ const loaded = useLocalizedContent(isSettled ? id : '', locale);
97
+
98
+ useEffect(() => {
99
+ // The previous editor can start its first write or queue another after render, before passive cleanup.
100
+ const committedSave = pendingFragmentSave(current.client, current.id, current.locale);
101
+ if (!current.pending && !committedSave && !current.refresh) {
102
+ setResolution({ arrival: current, settled: true });
103
+ return undefined;
104
+ }
105
+ let active = true;
106
+ setResolution({ arrival: current, settled: false });
107
+ void waitForFragmentSave(Promise.all([current.pending, committedSave]).then(() => undefined))
108
+ .then(async () => {
109
+ if (!active) return;
110
+ // Cancel an older read and drop its cached snapshot before enabling the fresh read. A failed write may
111
+ // still have reached storage, and a successful reply alone cannot describe a later external write.
112
+ await queryClient.resetQueries({ queryKey: ['content', current.id, current.locale], exact: true });
113
+ if (active) setResolution({ arrival: current, settled: true });
114
+ })
115
+ .catch(() => {
116
+ if (active) setResolution({ arrival: current, settled: false, waitError: SAVE_WAIT_FAILURE });
117
+ });
118
+ return () => {
119
+ active = false;
120
+ };
121
+ }, [current, queryClient]);
122
+
123
+ const retrySaveWait = () => {
124
+ setSnapshot({ client, id, locale, pending: pendingFragmentSave(client, id, locale), refresh: true });
125
+ };
126
+ // Only the same editor's guarded locale handoff may call this, after awaiting old writes and reading the locale.
127
+ const markLocaleLoaded = (nextLocale: string) => {
128
+ const arrival = { client, id, locale: nextLocale, pending: null };
129
+ setSnapshot(arrival);
130
+ setResolution({ arrival, settled: true });
131
+ };
132
+
133
+ return {
134
+ data: loaded.data,
135
+ error: loaded.error,
136
+ isLoading: !isSettled || loaded.isLoading,
137
+ waitingForSave,
138
+ waitError,
139
+ retrySaveWait,
140
+ markLocaleLoaded,
141
+ };
142
+ }
@@ -1,5 +1,12 @@
1
1
  import { codeBlockWrapperInfo$ } from '@conloca/mdx';
2
- import { addEditorWrapper$, Cell, realmPlugin, useCellValue } from '@mdxeditor/editor';
2
+ import {
3
+ addEditorWrapper$,
4
+ Cell,
5
+ contentEditableClassName$,
6
+ type Realm,
7
+ realmPlugin,
8
+ useCellValue,
9
+ } from '@mdxeditor/editor';
3
10
  import { type ComponentType, createElement, Fragment, type ReactElement, type ReactNode } from 'react';
4
11
 
5
12
  /**
@@ -78,14 +85,28 @@ export interface HostWrapperPluginParams {
78
85
  codeBlockWrapper?: HostWrapperInfo[] | null;
79
86
  }
80
87
 
88
+ /**
89
+ * The wrapper's classes also go on the contenteditable itself: on the page the
90
+ * prose blocks are the wrapper's own children, so the site's flow rules
91
+ * (`.prose > * + *`, `.prose > p + p`) only reach the editor's blocks from
92
+ * their parent. The clone stays for tag-qualified and descendant selectors;
93
+ * main.css keeps the wrapper's box off the contenteditable so it paints once.
94
+ * Runs after the core plugin, which publishes the editor's own classes first on
95
+ * every init and update, so the wrapper's are added once.
96
+ */
97
+ function publishWrapper(realm: Realm, params: HostWrapperPluginParams | undefined): void {
98
+ const wrapper = params?.wrapper ?? null;
99
+ realm.pub(hostWrapperInfo$, wrapper);
100
+ realm.pub(codeBlockWrapperInfo$, params?.codeBlockWrapper ?? null);
101
+ if (wrapper?.className) {
102
+ realm.pub(contentEditableClassName$, `${realm.getValue(contentEditableClassName$)} ${wrapper.className}`);
103
+ }
104
+ }
105
+
81
106
  export const hostWrapperPlugin = realmPlugin<HostWrapperPluginParams>({
82
107
  init(realm, params) {
83
108
  realm.pub(addEditorWrapper$, HostWrapperRenderer);
84
- realm.pub(hostWrapperInfo$, params?.wrapper ?? null);
85
- realm.pub(codeBlockWrapperInfo$, params?.codeBlockWrapper ?? null);
86
- },
87
- update(realm, params) {
88
- realm.pub(hostWrapperInfo$, params?.wrapper ?? null);
89
- realm.pub(codeBlockWrapperInfo$, params?.codeBlockWrapper ?? null);
109
+ publishWrapper(realm, params);
90
110
  },
111
+ update: publishWrapper,
91
112
  });
@@ -1,6 +1,5 @@
1
1
  export type { CMSMDXEditorProps } from './CMSMDXEditor.js';
2
2
  export { CMSMDXEditor } from './CMSMDXEditor.js';
3
- export { ContentDiff } from './ContentDiff.js';
4
3
  export { CreateFragmentDialog } from './CreateFragmentDialog.js';
5
4
  export { ImagePickerDialog } from './ImagePickerDialog.js';
6
5
  export { LocaleSelector } from './LocaleSelector.js';
@@ -1,12 +1,9 @@
1
- // IMPORTANT: Import gurx hooks from @mdxeditor/editor, NOT from @mdxeditor/gurx directly.
2
- // @mdxeditor/editor re-exports gurx, and using that ensures we get the same module instance
3
- // as the editor internals, avoiding React context isolation issues.
4
- import { usePublisher } from '@mdxeditor/editor';
5
1
  import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
6
2
  import { Plus } from 'lucide-react';
7
3
  import { useMemo } from 'react';
8
- import { type MdxComponentDescriptor, useMdxComponents } from '../../../mdx-components.js';
9
- import { dispatchInsert, insertJsx$, insertMarkdown$ } from './insert-payload.js';
4
+ import type { MdxComponentDescriptor } from '../../../mdx-components.js';
5
+ import { useOfferedMdxComponents } from '../offered-mdx-components.js';
6
+ import { dispatchInsert, useInsertPublishers } from './insert-payload.js';
10
7
 
11
8
  interface DescriptorGroup {
12
9
  /** Section header label. Empty string for the ungrouped bucket. */
@@ -57,9 +54,8 @@ function groupByCategory(descriptors: MdxComponentDescriptor[]): DescriptorGroup
57
54
  * components and snippets sees them sectioned (e.g. "Components" / "Patterns").
58
55
  */
59
56
  export function InsertMdxComponentButton() {
60
- const allComponents = useMdxComponents();
61
- const publishJsx = usePublisher(insertJsx$);
62
- const publishMarkdown = usePublisher(insertMarkdown$);
57
+ const allComponents = useOfferedMdxComponents();
58
+ const publishers = useInsertPublishers();
63
59
 
64
60
  const groups = useMemo<DescriptorGroup[]>(() => {
65
61
  const visible = allComponents
@@ -91,7 +87,7 @@ export function InsertMdxComponentButton() {
91
87
  if (total === 0) return null;
92
88
 
93
89
  const onSelect = (descriptor: MdxComponentDescriptor) => {
94
- dispatchInsert(descriptor, { jsx: publishJsx, markdown: publishMarkdown });
90
+ dispatchInsert(descriptor, publishers);
95
91
  };
96
92
 
97
93
  return (
@@ -118,7 +114,7 @@ export function InsertMdxComponentButton() {
118
114
  <DropdownMenu.Content
119
115
  sideOffset={4}
120
116
  align="start"
121
- className="z-50 min-w-[14rem] max-h-72 overflow-auto rounded-md border border-line bg-panel shadow-md py-1 text-sm text-foreground"
117
+ className="scrollbar-visible z-50 min-w-[14rem] max-h-[min(18rem,var(--radix-dropdown-menu-content-available-height))] overflow-auto rounded-md border border-line bg-panel shadow-md py-1 text-sm text-foreground"
122
118
  >
123
119
  {groups.map((group, groupIndex) => (
124
120
  <div key={group.category || '__ungrouped__'}>