@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
@@ -14,6 +14,7 @@ import { useProbedHostStyles } from '../../host-style-probe.js';
14
14
  import { isJsxDescriptor, toJsxComponentDescriptor, useMdxComponents } from '../../mdx-components.js';
15
15
  import { prepareImageUpload } from '../../media/prepare-image-upload.js';
16
16
  import { deriveProseSurfaceStyles } from '../../prose-surface-css.js';
17
+ import { useSiteRender } from '../../site-render.js';
17
18
  import {
18
19
  type SiteStyles,
19
20
  useEditorStyles,
@@ -24,20 +25,26 @@ import {
24
25
  } from '../../site-styles.js';
25
26
  import { getUIConfig, inEditorFrame } from '../../ui-config.js';
26
27
  import { assetRefOf } from '../../utils/asset-url.js';
28
+ import { bodySyncPlugin } from './body-sync-plugin.js';
27
29
  import { draftImagePreview } from './draft-media-config.js';
30
+ import { FragmentBlockTypeSelect } from './FragmentBlockTypeSelect.js';
31
+ import { FragmentComponentBlock } from './FragmentComponentBlock.js';
28
32
  import { GenericBlock } from './GenericBlock.js';
29
33
  import { hostWrapperPlugin } from './host-wrapper-plugin.js';
30
34
  import { ImagePickerDialog } from './ImagePickerDialog.js';
31
35
  import { InsertMdxComponentButton } from './insert-menu/InsertMdxComponentButton.js';
32
36
  import { mdxComponentsPlugin } from './insert-menu/mdx-components-plugin.js';
37
+ import { jsxLayoutPlugin } from './jsx-layout-plugin.js';
38
+ import { FragmentModeContext, offeredMdxComponents } from './offered-mdx-components.js';
39
+ import { softBreakPlugin } from './soft-break-plugin.js';
33
40
 
34
41
  const EDITOR_CSS: string = import.meta.env.CONLOCA_EDITOR_CSS || '';
35
42
 
36
43
  export interface CMSMDXEditorProps
37
44
  extends Omit<
38
45
  BaseMDXEditorProps,
46
+ | 'blockTypeSelect'
39
47
  | 'disableImageSettingsButton'
40
- | 'extraPlugins'
41
48
  | 'extraToolbarItems'
42
49
  | 'imageButtonRef'
43
50
  | 'imageDialog'
@@ -52,210 +59,243 @@ export interface CMSMDXEditorProps
52
59
  * to the static `editorStyles` registry if unset or the fetch fails.
53
60
  */
54
61
  previewRouteUrl?: string;
62
+ /**
63
+ * Edit a fragment: offer only the site's fragment vocabulary, render each component with the site's own component
64
+ * while typing (no `/api/render`), and insert components without imports.
65
+ */
66
+ fragment?: boolean;
55
67
  }
56
68
 
57
- export const CMSMDXEditor = forwardRef<MDXEditorMethods, CMSMDXEditorProps>(({ previewRouteUrl, ...props }, ref) => {
58
- const insertImageRef = useRef<HTMLButtonElement>(null);
59
- const uploadAsset = useUploadAsset();
60
- const registeredMdxComponents = useMdxComponents();
61
- // Style injection has two paths:
62
- //
63
- // 1. `useFetchedSiteStyles(previewRouteUrl)` — auto-discovery. When a
64
- // route URL is provided, ask the integration for that route's full
65
- // effective CSS (Tailwind, theme, scoped styles) so the editor
66
- // matches the published page without the host curating a list.
67
- // 2. `useEditorStyles()` — the original, manually-configured narrow path.
68
- // Fallback when no route URL is available or the fetch fails.
69
- //
70
- // Full host CSS must stay inside the editor surface. Site styles often
71
- // contain bare `h1`, `button`, and Tailwind reset rules that would otherwise
72
- // restyle the admin header and any host app around it.
73
- //
74
- // Inside a parent frame the dev-server endpoints do not exist, so the
75
- // probe's load of the real page stands in for them (see `routeStyles`).
76
- const inFrame = inEditorFrame();
77
- const devServerRouteUrl = inFrame ? undefined : previewRouteUrl;
78
- const fetchedStyles = useFetchedSiteStyles(devServerRouteUrl);
79
- const staticEditorStyles = useEditorStyles();
80
- // Probe the host's computed styles for each prose tag from the
81
- // actual live page and synthesize a stylesheet scoped to the
82
- // editor's contenteditable. This catches what the wrapper auto-
83
- // copy misses: utility-class-styled elements (Tailwind utility-
84
- // first), inline `style` attributes, and any other styling that
85
- // resolves to computed values but isn't reachable via a wrapper-
86
- // and-descendant cascade. The probe takes the discovered wrapper
87
- // class so it queries the same element inside the iframe — avoids
88
- // duplicate find-wrapper logic. `css` is empty while the probe is in
89
- // flight AND when the page has nothing probable; gate fallbacks on
90
- // `settled`, not on the empty string alone, or the derived tier
91
- // paints first and flips when the probe lands.
92
- // Discover the host page's content-root shape (eg `<article class="card">`
93
- // on Starlight) AND its code-block chrome wrapper (eg `<div class=
94
- // "expressive-code">`). The editor wraps its contenteditable in a clone
95
- // of `content` via `hostWrapperPlugin`, so host CSS paints the prose
96
- // surface naturally. It also threads `codeBlock` through to the
97
- // code-block frame component (in @conloca/mdx) so it can carry the host's
98
- // code-block classes and inherit the host's code-block CSS the same way.
99
- const fetchedWrappers = useFetchedHostWrappers(devServerRouteUrl);
100
- // Editor and published page maintain independent theme preferences
101
- // (CMS SPA → `conloca-theme`; Starlight → `starlight-theme`). The
102
- // probe needs to capture styles in the EDITOR's current scheme, not
103
- // the published page's, so we pass our resolved theme through. When
104
- // the user toggles theme inside the editor, the hook's dep on
105
- // `theme` re-runs the probe and the new computed values land.
106
- const { resolvedTheme } = useTheme();
107
- const probe = useProbedHostStyles(previewRouteUrl, fetchedWrappers.content?.className ?? null, {
108
- theme: resolvedTheme,
109
- discover: inFrame,
110
- });
111
- const { css: probedStyles, settled: probeSettled } = probe;
112
- // The route's own CSS and wrappers: from the dev endpoints locally, from the
113
- // page the probe loaded in a frame.
114
- const routeStyles = inFrame ? probe.styles : fetchedStyles;
115
- const hostWrappers = inFrame ? probe.wrappers : fetchedWrappers;
116
- // First tier with content wins: live discovery, then the manually-configured
117
- // path.
118
- const activeStyles = routeStyles.length > 0 ? routeStyles : staticEditorStyles;
119
- // The editor mounts directly in the parent SPA's React tree, so the broad
120
- // stylesheet is confined to `.conloca-mdx-editor-surround` below. The
121
- // content still receives the site's complete cascade while adjacent admin
122
- // chrome keeps its own tokens and utilities.
123
- //
124
- // The host can also append raw CSS via the integration's `editorCSS`
125
- // option (see `ConlocaCMSOptions`) — concatenated AFTER auto-
126
- // discovered styles so it sits later in the same cascade layer and
127
- // wins on tie-breaks. Empty string when the host didn't set it; no
128
- // marker `<style>` is emitted for the no-op case.
129
- const editorCss = getUIConfig().editorCss ?? EDITOR_CSS;
130
- const styleStack = useMemo<SiteStyles>(
131
- () => (editorCss ? [...activeStyles, editorCss] : activeStyles),
132
- [activeStyles, editorCss],
133
- );
134
- const probedStack = useMemo<SiteStyles>(() => (probedStyles ? [probedStyles] : []), [probedStyles]);
135
- // Injected here, AFTER the probe has been read, so the bridge inside this
136
- // hook can be gated on it. Head order is unchanged: this tier still lands
137
- // before `conloca-host-defaults` below, and the two never compete anyway —
138
- // this one is layered, that one deliberately is not.
139
- //
140
- // `bridgeHostVars` is the gate. Both this bridge and the probe publish the
141
- // same `--conloca-host-*` typography contract, and this one writes inline
142
- // properties on `<html>` while the probe emits a `:root` rule — so without
143
- // the gate the bridge would outrank the probe purely because inline beats a
144
- // stylesheet. The probe reads the REAL rendered page; it must win wherever
145
- // it works, which is every editor served by the site's dev server. The bridge
146
- // is the fallback where the probe cannot run at all (a site on a different
147
- // origin from the editor, or a production build with no dev server).
148
- useInjectHostStyles('conloca-host-preview', styleStack, {
149
- scopeSelector: '.conloca-mdx-editor-surround',
150
- // Fallback bridge only after the probe has settled empty. While the
151
- // probe is in flight, leave the contract unset rather than publishing
152
- // derived vars that the probe will immediately overwrite.
153
- bridgeHostVars: probeSettled && probedStyles === '',
154
- });
155
- useInjectHostStyles('conloca-host-defaults', probedStack, { layered: false });
156
- // Production styles tier: prose-safe rules derived from the siteStyles
157
- // registry (the siteStyles option's CSS) plus a paper base. Fallback ONLY —
158
- // when the discovery endpoint delivered (dev server), this stays empty so
159
- // discovery-styled surfaces keep their host-painted look, paper included.
160
- // Unlayered for the same reason as the probe stack: the editor's default
161
- // prose scale is unlayered and would beat any layered override.
162
- const siteStyles = useSiteStyles();
163
- const proseSurface = useMemo<SiteStyles>(
164
- // Derived from the siteStyles registry, the host CSS the surface shows.
69
+ export const CMSMDXEditor = forwardRef<MDXEditorMethods, CMSMDXEditorProps>(
70
+ ({ previewRouteUrl, fragment = false, ...props }, ref) => {
71
+ const insertImageRef = useRef<HTMLButtonElement>(null);
72
+ const uploadAsset = useUploadAsset();
73
+ const { vocabulary } = useSiteRender();
74
+ const registered = useMdxComponents();
75
+ const registeredMdxComponents = useMemo(
76
+ () => offeredMdxComponents(registered, fragment ? vocabulary : undefined),
77
+ [registered, fragment, vocabulary],
78
+ );
79
+ // Style injection has two paths:
80
+ //
81
+ // 1. `useFetchedSiteStyles(previewRouteUrl)` — auto-discovery. When a
82
+ // route URL is provided, ask the integration for that route's full
83
+ // effective CSS (Tailwind, theme, scoped styles) so the editor
84
+ // matches the published page without the host curating a list.
85
+ // 2. `useEditorStyles()` — the original, manually-configured narrow path.
86
+ // Fallback when no route URL is available or the fetch fails.
87
+ //
88
+ // Full host CSS must stay inside the editor surface. Site styles often
89
+ // contain bare `h1`, `button`, and Tailwind reset rules that would otherwise
90
+ // restyle the admin header and any host app around it.
165
91
  //
166
- // It must run ALONGSIDE the layered host CSS, not instead of it. That CSS is
167
- // injected into a cascade LAYER, the editor's default prose scale is
168
- // unlayered, and layered always loses to unlayered — so the layered tier
169
- // alone cannot restore heading metrics. This tier is the prose-scoped subset that is safe to
170
- // inject unlayered, which is what actually beats the defaults. Live
171
- // discovery is the exception: it ships the computed-style probe, itself
172
- // unlayered and better at the same job.
92
+ // Inside a parent frame the dev-server endpoints do not exist, so the
93
+ // probe's load of the real page stands in for them (see `routeStyles`).
94
+ const inFrame = inEditorFrame();
95
+ const devServerRouteUrl = inFrame ? undefined : previewRouteUrl;
96
+ const fetchedStyles = useFetchedSiteStyles(devServerRouteUrl);
97
+ const staticEditorStyles = useEditorStyles();
98
+ // Probe the host's computed styles for each prose tag from the
99
+ // actual live page and synthesize a stylesheet scoped to the
100
+ // editor's contenteditable. This catches what the wrapper auto-
101
+ // copy misses: utility-class-styled elements (Tailwind utility-
102
+ // first), inline `style` attributes, and any other styling that
103
+ // resolves to computed values but isn't reachable via a wrapper-
104
+ // and-descendant cascade. The probe takes the discovered wrapper
105
+ // class so it queries the same element inside the iframe — avoids
106
+ // duplicate find-wrapper logic. `css` is empty while the probe is in
107
+ // flight AND when the page has nothing probable; gate fallbacks on
108
+ // `settled`, not on the empty string alone, or the derived tier
109
+ // paints first and flips when the probe lands.
110
+ // Discover the host page's content-root shape (eg `<article class="card">`
111
+ // on Starlight) AND its code-block chrome wrapper (eg `<div class=
112
+ // "expressive-code">`). The editor wraps its contenteditable in a clone
113
+ // of `content` via `hostWrapperPlugin`, so host CSS paints the prose
114
+ // surface naturally. It also threads `codeBlock` through to the
115
+ // code-block frame component (in @conloca/mdx) so it can carry the host's
116
+ // code-block classes and inherit the host's code-block CSS the same way.
117
+ const fetchedWrappers = useFetchedHostWrappers(devServerRouteUrl);
118
+ // Editor and published page maintain independent theme preferences
119
+ // (CMS SPA → `conloca-theme`; Starlight → `starlight-theme`). The
120
+ // probe needs to capture styles in the EDITOR's current scheme, not
121
+ // the published page's, so we pass our resolved theme through. When
122
+ // the user toggles theme inside the editor, the hook's dep on
123
+ // `theme` re-runs the probe and the new computed values land.
124
+ const { resolvedTheme } = useTheme();
125
+ const probe = useProbedHostStyles(previewRouteUrl, fetchedWrappers.content?.className ?? null, {
126
+ theme: resolvedTheme,
127
+ discover: inFrame,
128
+ });
129
+ const { css: probedStyles, settled: probeSettled } = probe;
130
+ // The route's own CSS and wrappers: from the dev endpoints locally, from the
131
+ // page the probe loaded in a frame.
132
+ const routeStyles = inFrame ? probe.styles : fetchedStyles;
133
+ const hostWrappers = inFrame ? probe.wrappers : fetchedWrappers;
134
+ // First tier with content wins: live discovery, then the manually-configured
135
+ // path.
136
+ const activeStyles = routeStyles.length > 0 ? routeStyles : staticEditorStyles;
137
+ // The editor mounts directly in the parent SPA's React tree, so the broad
138
+ // stylesheet is confined to `.conloca-mdx-editor-surround` below. The
139
+ // content still receives the site's complete cascade while adjacent admin
140
+ // chrome keeps its own tokens and utilities.
173
141
  //
174
- // The discovered wrapper class goes in as a second scope root. Host themes
175
- // scope prose to their OWN wrapper class (`.sl-markdown-content`), never to
176
- // `.conloca-prose`, so filtering on the Conloca class alone yielded an
177
- // empty tier on every real site. `hostWrapperPlugin` renders a clone of
178
- // that wrapper around the contenteditable, so those selectors match here.
179
- // Gated on the probe as well as on live discovery. Both this tier and the
180
- // probe inject UNLAYERED, and for a heading they land on equal specificity
181
- // — `.conloca-prose--editor h2` (0,1,1) against
182
- // `.sl-markdown-content h2:not(:where(…))` (0,1,1), since `:not(:where())`
183
- // contributes nothing — so whichever is later in head order wins, and that
184
- // is this tier. Without this gate a working probe would be a measurable
185
- // no-op wherever a host sets siteStyles.
142
+ // The host can also append raw CSS via the integration's `editorCSS`
143
+ // option (see `ConlocaCMSOptions`) — concatenated AFTER auto-
144
+ // discovered styles so it sits later in the same cascade layer and
145
+ // wins on tie-breaks. Empty string when the host didn't set it; no
146
+ // marker `<style>` is emitted for the no-op case.
147
+ const editorCss = getUIConfig().editorCss ?? EDITOR_CSS;
148
+ const styleStack = useMemo<SiteStyles>(
149
+ () => (editorCss ? [...activeStyles, editorCss] : activeStyles),
150
+ [activeStyles, editorCss],
151
+ );
152
+ const probedStack = useMemo<SiteStyles>(() => (probedStyles ? [probedStyles] : []), [probedStyles]);
153
+ // Injected here, AFTER the probe has been read, so the bridge inside this
154
+ // hook can be gated on it. Head order is unchanged: this tier still lands
155
+ // before `conloca-host-defaults` below, and the two never compete anyway —
156
+ // this one is layered, that one deliberately is not.
186
157
  //
187
- // `probeSettled` is the load-bearing half of the gate. `probedStyles === ''`
188
- // alone is true on the initial render (probe still in flight) AND after a
189
- // definitive empty failure, so gating only on the string paints this tier
190
- // first, then tears it down when the probe lands — a visible flash on
191
- // every editor open that relies on siteStyles. Hold the tier
192
- // until the probe has resolved once; only then, if it settled empty, fill in
193
- // with derived rules.
194
- () =>
195
- routeStyles.length === 0 && probeSettled && probedStyles === ''
196
- ? deriveProseSurfaceStyles(siteStyles, hostWrappers.content?.className)
197
- : [],
198
- [routeStyles, probeSettled, probedStyles, siteStyles, hostWrappers],
199
- );
200
- useInjectHostStyles('conloca-prose-surface', proseSurface, { layered: false });
201
- // Recompose the plugins list whenever the wrappers change so the plugin
202
- // re-runs its `update` and the wrapper component refreshes inside the
203
- // editor. The hostWrapperPlugin's renderers read reactively from their
204
- // own Cells, so we DON'T need to remount the entire editor for this.
205
- const extraPlugins = useMemo<RealmPlugin[]>(
206
- () => [
207
- mdxComponentsPlugin(),
208
- hostWrapperPlugin({ wrapper: hostWrappers.content, codeBlockWrapper: hostWrappers.codeBlock }),
209
- ],
210
- [hostWrappers],
211
- );
212
- const jsxComponentDescriptors = useMemo<JsxComponentDescriptor[]>(
213
- // Filter to JSX flavors before translating — snippets live in the same
214
- // registry but aren't valid input for @mdxeditor/editor's jsxPlugin, and
215
- // toJsxComponentDescriptor throws if handed one to surface the misuse.
216
- () =>
217
- registeredMdxComponents
218
- .filter(isJsxDescriptor)
219
- .map((descriptor) => toJsxComponentDescriptor(descriptor, GenericBlock)),
220
- [registeredMdxComponents],
221
- );
158
+ // `bridgeHostVars` is the gate. Both this bridge and the probe publish the
159
+ // same `--conloca-host-*` typography contract, and this one writes inline
160
+ // properties on `<html>` while the probe emits a `:root` rule — so without
161
+ // the gate the bridge would outrank the probe purely because inline beats a
162
+ // stylesheet. The probe reads the REAL rendered page; it must win wherever
163
+ // it works, which is every editor served by the site's dev server. The bridge
164
+ // is the fallback where the probe cannot run at all (a site on a different
165
+ // origin from the editor, or a production build with no dev server).
166
+ useInjectHostStyles('conloca-host-preview', styleStack, {
167
+ scopeSelector: '.conloca-mdx-editor-surround',
168
+ // Fallback bridge only after the probe has settled empty. While the
169
+ // probe is in flight, leave the contract unset rather than publishing
170
+ // derived vars that the probe will immediately overwrite.
171
+ bridgeHostVars: probeSettled && probedStyles === '',
172
+ });
173
+ useInjectHostStyles('conloca-host-defaults', probedStack, { layered: false });
174
+ // Production styles tier: prose-safe rules derived from the siteStyles
175
+ // registry (the siteStyles option's CSS) plus a paper base. Fallback ONLY —
176
+ // when the discovery endpoint delivered (dev server), this stays empty so
177
+ // discovery-styled surfaces keep their host-painted look, paper included.
178
+ // Unlayered for the same reason as the probe stack: the editor's default
179
+ // prose scale is unlayered and would beat any layered override.
180
+ const siteStyles = useSiteStyles();
181
+ const proseSurface = useMemo<SiteStyles>(
182
+ // Derived from the siteStyles registry, the host CSS the surface shows.
183
+ //
184
+ // It must run ALONGSIDE the layered host CSS, not instead of it. That CSS is
185
+ // injected into a cascade LAYER, the editor's default prose scale is
186
+ // unlayered, and layered always loses to unlayered — so the layered tier
187
+ // alone cannot restore heading metrics. This tier is the prose-scoped subset that is safe to
188
+ // inject unlayered, which is what actually beats the defaults. Live
189
+ // discovery is the exception: it ships the computed-style probe, itself
190
+ // unlayered and better at the same job.
191
+ //
192
+ // The discovered wrapper class goes in as a second scope root. Host themes
193
+ // scope prose to their OWN wrapper class (`.sl-markdown-content`), never to
194
+ // `.conloca-prose`, so filtering on the Conloca class alone yielded an
195
+ // empty tier on every real site. `hostWrapperPlugin` renders a clone of
196
+ // that wrapper around the contenteditable, so those selectors match here.
197
+ // Gated on the probe as well as on live discovery. Both this tier and the
198
+ // probe inject UNLAYERED, and for a heading they land on equal specificity
199
+ // — `.conloca-prose--editor h2` (0,1,1) against
200
+ // `.sl-markdown-content h2:not(:where(…))` (0,1,1), since `:not(:where())`
201
+ // contributes nothing — so whichever is later in head order wins, and that
202
+ // is this tier. Without this gate a working probe would be a measurable
203
+ // no-op wherever a host sets siteStyles.
204
+ //
205
+ // `probeSettled` is the load-bearing half of the gate. `probedStyles === ''`
206
+ // alone is true on the initial render (probe still in flight) AND after a
207
+ // definitive empty failure, so gating only on the string paints this tier
208
+ // first, then tears it down when the probe lands — a visible flash on
209
+ // every editor open that relies on siteStyles. Hold the tier
210
+ // until the probe has resolved once; only then, if it settled empty, fill in
211
+ // with derived rules.
212
+ () =>
213
+ routeStyles.length === 0 && probeSettled && probedStyles === ''
214
+ ? deriveProseSurfaceStyles(siteStyles, hostWrappers.content?.className)
215
+ : [],
216
+ [routeStyles, probeSettled, probedStyles, siteStyles, hostWrappers],
217
+ );
218
+ useInjectHostStyles('conloca-prose-surface', proseSurface, { layered: false });
219
+ // Recompose the plugins list whenever the wrappers change so the plugin
220
+ // re-runs its `update` and the wrapper component refreshes inside the
221
+ // editor. The hostWrapperPlugin's renderers read reactively from their
222
+ // own Cells, so we DON'T need to remount the entire editor for this.
223
+ // The caller's plugins (co-editing) come after the editor's own.
224
+ const extraPlugins = useMemo<RealmPlugin[]>(
225
+ () => [
226
+ jsxLayoutPlugin(),
227
+ mdxComponentsPlugin(),
228
+ softBreakPlugin(),
229
+ bodySyncPlugin(),
230
+ hostWrapperPlugin({ wrapper: hostWrappers.content, codeBlockWrapper: hostWrappers.codeBlock }),
231
+ ...(props.extraPlugins ?? []),
232
+ ],
233
+ [hostWrappers, props.extraPlugins],
234
+ );
235
+ const jsxComponentDescriptors = useMemo<JsxComponentDescriptor[]>(
236
+ // Filter to JSX flavors before translating — snippets live in the same
237
+ // registry but aren't valid input for @mdxeditor/editor's jsxPlugin, and
238
+ // toJsxComponentDescriptor throws if handed one to surface the misuse.
239
+ () =>
240
+ registeredMdxComponents.filter(isJsxDescriptor).map((descriptor) =>
241
+ fragment
242
+ ? toJsxComponentDescriptor({ ...descriptor, Editor: undefined }, FragmentComponentBlock, {
243
+ withImport: false,
244
+ })
245
+ : toJsxComponentDescriptor(descriptor, GenericBlock),
246
+ ),
247
+ [registeredMdxComponents, fragment],
248
+ );
249
+ const blockTypeSelect = useMemo(
250
+ () =>
251
+ fragment ? (
252
+ <FragmentBlockTypeSelect
253
+ components={registeredMdxComponents.filter(isJsxDescriptor).filter((d) => d.blockType)}
254
+ />
255
+ ) : undefined,
256
+ [registeredMdxComponents, fragment],
257
+ );
222
258
 
223
- // Wire paste/drop image uploads to the same backend mutation that powers
224
- // the asset library's UploadModal. The library expects a Promise<string>
225
- // resolving to the image src; we hand back the link `assetRefOf` stores,
226
- // so it round-trips identically to a path picked from the asset browser.
227
- const imageUploadHandler = useCallback(
228
- async (file: File) => {
229
- const formData = buildUploadFormData(await prepareImageUpload(file, DEFAULT_MAX_FILE_SIZE), undefined, '/');
230
- const asset = await uploadAsset.mutateAsync(formData);
231
- return assetRefOf(asset);
232
- },
233
- [uploadAsset],
234
- );
259
+ // Wire paste/drop image uploads to the same backend mutation that powers
260
+ // the asset library's UploadModal. The library expects a Promise<string>
261
+ // resolving to the image src; we hand back the link `assetRefOf` stores,
262
+ // so it round-trips identically to a path picked from the asset browser.
263
+ const imageUploadHandler = useCallback(
264
+ async (file: File) => {
265
+ const formData = buildUploadFormData(await prepareImageUpload(file, DEFAULT_MAX_FILE_SIZE), undefined, '/');
266
+ const asset = await uploadAsset.mutateAsync(formData);
267
+ return assetRefOf(asset);
268
+ },
269
+ [uploadAsset],
270
+ );
235
271
 
236
- return (
237
- <BaseMDXEditor
238
- ref={ref}
239
- {...props}
240
- imageDialog={ImagePickerDialog}
241
- disableImageSettingsButton={true}
242
- imageButtonRef={insertImageRef}
243
- imageUploadHandler={imageUploadHandler}
244
- // The site does not serve branch drafts: draft images show their loaded bytes, draft addresses a placeholder until then.
245
- imagePreviewHandler={draftImagePreview}
246
- jsxComponentDescriptors={jsxComponentDescriptors}
247
- extraPlugins={extraPlugins}
248
- extraToolbarItems={<InsertMdxComponentButton />}
249
- onImageShortcut={() => {
250
- if (insertImageRef.current) {
251
- insertImageRef.current.click();
252
- return;
253
- }
272
+ return (
273
+ <FragmentModeContext.Provider value={fragment}>
274
+ <BaseMDXEditor
275
+ ref={ref}
276
+ {...props}
277
+ imageDialog={ImagePickerDialog}
278
+ disableImageSettingsButton={true}
279
+ imageButtonRef={insertImageRef}
280
+ imageUploadHandler={imageUploadHandler}
281
+ // The site does not serve branch drafts: draft images show their loaded bytes, draft addresses a placeholder until then.
282
+ imagePreviewHandler={draftImagePreview}
283
+ jsxComponentDescriptors={jsxComponentDescriptors}
284
+ extraPlugins={extraPlugins}
285
+ extraToolbarItems={<InsertMdxComponentButton />}
286
+ blockTypeSelect={blockTypeSelect}
287
+ onImageShortcut={() => {
288
+ if (insertImageRef.current) {
289
+ insertImageRef.current.click();
290
+ return;
291
+ }
254
292
 
255
- console.warn('[CMSMDXEditor] InsertImage ref not attached - toolbar may not be rendered');
256
- }}
257
- />
258
- );
259
- });
293
+ console.warn('[CMSMDXEditor] InsertImage ref not attached - toolbar may not be rendered');
294
+ }}
295
+ />
296
+ </FragmentModeContext.Provider>
297
+ );
298
+ },
299
+ );
260
300
 
261
301
  CMSMDXEditor.displayName = 'CMSMDXEditor';
@@ -0,0 +1,116 @@
1
+ import React from 'react';
2
+ import { type EditorFrame, useSiteRender } from '../../site-render.js';
3
+ import { getUIConfig } from '../../ui-config.js';
4
+
5
+ /** The page on the canvas, for the editor frame; provided by `PageEditor`, read inside Puck's iframe override. */
6
+ export const CanvasPageContext = React.createContext<{ pathname: string; collection: string | undefined }>({
7
+ pathname: '/',
8
+ collection: undefined,
9
+ });
10
+
11
+ /** Errors thrown by the page inside a frame, so the frame's boundary passes them on instead of blaming the frame. */
12
+ const pageErrors = new WeakSet();
13
+
14
+ interface PageErrorTagState {
15
+ error: object | undefined;
16
+ }
17
+
18
+ /** Tags an error from the page's own blocks, then rethrows it to the boundaries above. */
19
+ class PageErrorTag extends React.Component<{ children: React.ReactNode }, PageErrorTagState> {
20
+ override state: PageErrorTagState = { error: undefined };
21
+
22
+ static getDerivedStateFromError(error: unknown): PageErrorTagState {
23
+ // A thrown primitive cannot sit in a WeakSet, so it is wrapped once in an Error that reads as the primitive; an
24
+ // already-tagged error passes as is.
25
+ const tagged = typeof error === 'object' && error !== null ? error : new Error(String(error));
26
+ pageErrors.add(tagged);
27
+ return { error: tagged };
28
+ }
29
+
30
+ override render() {
31
+ if (this.state.error !== undefined) throw this.state.error;
32
+ return this.props.children;
33
+ }
34
+ }
35
+
36
+ interface FrameErrorBoundaryState {
37
+ error: unknown;
38
+ failed: boolean;
39
+ }
40
+
41
+ const isPageError = (error: unknown) => typeof error === 'object' && error !== null && pageErrors.has(error);
42
+
43
+ /** Renders the page bare once the site's frame throws, naming the route in one error; page errors pass through. */
44
+ class FrameErrorBoundary extends React.Component<
45
+ { route: string; Frame: EditorFrame; pathname: string; children: React.ReactNode },
46
+ FrameErrorBoundaryState
47
+ > {
48
+ override state: FrameErrorBoundaryState = { error: undefined, failed: false };
49
+
50
+ static getDerivedStateFromError(error: unknown) {
51
+ return isPageError(error) ? { error } : { error: undefined, failed: true };
52
+ }
53
+
54
+ override componentDidCatch(error: unknown) {
55
+ if (isPageError(error)) return;
56
+ console.error(
57
+ `[conloca] The editor frame of route '${this.props.route}' failed; showing the page unframed.`,
58
+ error,
59
+ );
60
+ }
61
+
62
+ override componentDidUpdate(previous: { Frame: EditorFrame }) {
63
+ // A replaced frame (HMR) gets another try.
64
+ if (previous.Frame !== this.props.Frame && this.state.failed) this.setState({ failed: false });
65
+ }
66
+
67
+ override render() {
68
+ const { Frame, pathname, children } = this.props;
69
+ if (this.state.error !== undefined) throw this.state.error;
70
+ // Still tagged once the frame failed, so later page errors pass on instead of counting as frame failures.
71
+ if (this.state.failed) return <PageErrorTag>{children}</PageErrorTag>;
72
+ return (
73
+ <Frame pathname={pathname}>
74
+ <div data-conloca-page-root="">
75
+ <PageErrorTag>{children}</PageErrorTag>
76
+ </div>
77
+ </Frame>
78
+ );
79
+ }
80
+ }
81
+
82
+ /** The page inside `Frame`, around the published page's `data-conloca-page-root` marker; bare if the frame throws. */
83
+ export function FramedContent({
84
+ route,
85
+ Frame,
86
+ pathname,
87
+ children,
88
+ }: {
89
+ route: string;
90
+ Frame: EditorFrame;
91
+ pathname: string;
92
+ children: React.ReactNode;
93
+ }) {
94
+ return (
95
+ <FrameErrorBoundary route={route} Frame={Frame} pathname={pathname}>
96
+ {children}
97
+ </FrameErrorBoundary>
98
+ );
99
+ }
100
+
101
+ /**
102
+ * Shows the page inside the editor frame of the first routing entry serving its collection; bare when no entry or
103
+ * frame applies.
104
+ */
105
+ export function EditorFrameBoundary({ children }: { children: React.ReactNode }) {
106
+ const { pathname, collection } = React.useContext(CanvasPageContext);
107
+ const { frames } = useSiteRender();
108
+ const route = getUIConfig().dataBindings?.entries?.find((e) => e.collection === collection)?.frame;
109
+ const Frame = route === undefined ? undefined : frames[route];
110
+ if (route === undefined || Frame === undefined) return <>{children}</>;
111
+ return (
112
+ <FramedContent route={route} Frame={Frame} pathname={pathname}>
113
+ {children}
114
+ </FramedContent>
115
+ );
116
+ }