@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
@@ -6,6 +6,7 @@
6
6
  * `mdx-components.ts`, which re-exports everything here for compatibility.
7
7
  * Mirrors the `page-schemas` / `page-schema-define` split.
8
8
  */
9
+ import { type FragmentOutlineProps, type JsonValue, outlineIdFor } from '@conloca/mdx/render';
9
10
  import type { JsxEditorProps } from '@mdxeditor/editor';
10
11
  import type { MdxJsxAttribute, MdxJsxFlowElement, MdxJsxTextElement } from 'mdast-util-mdx-jsx';
11
12
  import type { ComponentType } from 'react';
@@ -35,32 +36,32 @@ import type { ComponentType } from 'react';
35
36
  * effects) are dropped. See the astro-cms README for the full constraint.
36
37
  */
37
38
 
39
+ /** Fields every prop shares. `hidden` keeps a top-level prop out of the settings panel; its value is still kept. */
40
+ interface MdxComponentPropBase {
41
+ name: string;
42
+ required?: boolean;
43
+ label?: string;
44
+ help?: string;
45
+ hidden?: boolean;
46
+ }
47
+
38
48
  export type MdxComponentProp =
39
- | {
40
- name: string;
49
+ | (MdxComponentPropBase & {
41
50
  type: 'string';
42
- required?: boolean;
43
- label?: string;
44
- help?: string;
45
51
  defaultValue?: string;
46
52
  options?: ReadonlyArray<{ value: string; label: string }>;
47
- }
48
- | {
49
- name: string;
50
- type: 'number';
51
- required?: boolean;
52
- label?: string;
53
- help?: string;
54
- defaultValue?: number;
55
- }
56
- | {
57
- name: string;
58
- type: 'boolean';
59
- required?: boolean;
60
- label?: string;
61
- help?: string;
62
- defaultValue?: boolean;
63
- };
53
+ })
54
+ | (MdxComponentPropBase & { type: 'number'; defaultValue?: number })
55
+ | (MdxComponentPropBase & { type: 'boolean'; defaultValue?: boolean })
56
+ | (MdxComponentPropBase & { type: 'list'; of: MdxComponentField })
57
+ | (MdxComponentPropBase & { type: 'object'; fields: Record<string, MdxComponentField> });
58
+
59
+ /** A list item or object field: an `MdxComponentProp` without `name`. */
60
+ export type MdxComponentField = MdxComponentProp extends infer P
61
+ ? P extends MdxComponentProp
62
+ ? Omit<P, 'name'>
63
+ : never
64
+ : never;
64
65
 
65
66
  export interface MdxComponentInsertHint {
66
67
  /** Human-readable label shown in the slash menu and the toolbar dropdown. */
@@ -95,9 +96,15 @@ export interface MdxJsxComponentDescriptor {
95
96
  props?: ReadonlyArray<MdxComponentProp>;
96
97
  /** Whether the component accepts children (nested rich-text editor). */
97
98
  hasChildren?: boolean;
99
+ /**
100
+ * Offer the component in the fragment editor's Block type dropdown, next to Paragraph and the headings: its body is
101
+ * one line of text, such as an eyebrow or a quiet title. Choosing it turns the line into the component; choosing
102
+ * Paragraph turns it back. Needs `kind: 'flow'` and `hasChildren: true`.
103
+ */
104
+ blockType?: boolean;
98
105
  /** Default attributes used at insert time. */
99
106
  defaults?: {
100
- attributes?: Record<string, string | number | boolean>;
107
+ attributes?: Record<string, JsonValue>;
101
108
  /** Raw MDX snippet parsed to mdast children at insert time. */
102
109
  children?: string;
103
110
  };
@@ -151,6 +158,51 @@ export function isSnippetDescriptor(d: MdxComponentDescriptor): d is MdxSnippetD
151
158
  return d.kind === 'snippet';
152
159
  }
153
160
 
161
+ /**
162
+ * Merge auto-discovered descriptors over host-authored ones.
163
+ *
164
+ * Discovered entries win on a name collision: they are derived from the
165
+ * source of truth (the MDX files and component folders themselves), while a
166
+ * hand-written list can lag. Discovery cannot see the host's editor settings,
167
+ * though: the host's `insert` (labels, descriptions), `props` (labels, help,
168
+ * `hidden`) and `blockType` stay on the merged entry. The exception is a name
169
+ * in `hostWins`, the site's fragment vocabulary components: there the host's
170
+ * declared types are the contract, so the host entry is kept and the
171
+ * discovered one dropped. ONE rule for every caller: the editors and the
172
+ * component manifest.
173
+ *
174
+ * Host survivors keep their relative order and discovered entries append
175
+ * after them, so a colliding entry surfaces at its discovered position, not
176
+ * its host slot. Inputs are assumed unique-by-name — that validation lives
177
+ * in `defineMdxComponents` and the discovery merge, not here.
178
+ */
179
+ export function mergeDiscoveredMdxComponents(
180
+ hostAuthored: MdxComponents,
181
+ discovered: MdxComponents,
182
+ hostWins: ReadonlySet<string> = new Set(),
183
+ ): MdxComponents {
184
+ if (discovered.length === 0) return hostAuthored;
185
+ const host = new Map(hostAuthored.map((descriptor) => [descriptor.name, descriptor]));
186
+ const kept = discovered.filter((descriptor) => !(hostWins.has(descriptor.name) && host.has(descriptor.name)));
187
+ const keptNames = new Set(kept.map((descriptor) => descriptor.name));
188
+ const merged = hostAuthored.filter((descriptor) => !keptNames.has(descriptor.name));
189
+ for (const descriptor of kept) {
190
+ const authored = host.get(descriptor.name);
191
+ if (!authored || !isJsxDescriptor(authored) || !isJsxDescriptor(descriptor)) {
192
+ merged.push(descriptor);
193
+ continue;
194
+ }
195
+ const { insert, props, blockType } = authored;
196
+ merged.push({
197
+ ...descriptor,
198
+ ...(insert && { insert }),
199
+ ...(props && { props }),
200
+ ...(blockType !== undefined && { blockType }),
201
+ });
202
+ }
203
+ return merged;
204
+ }
205
+
154
206
  /**
155
207
  * Identity helper that validates registration-time invariants.
156
208
  *
@@ -183,12 +235,23 @@ export function defineMdxComponents(components: MdxComponents): MdxComponents {
183
235
  }
184
236
  throw new Error(`defineMdxComponents: duplicate descriptor for '${descriptor.name}'.`);
185
237
  }
238
+ if (isJsxDescriptor(descriptor)) checkJsxProps(descriptor);
186
239
  if (isJsxDescriptor(descriptor) && descriptor.kind === 'text' && descriptor.hasChildren) {
187
240
  throw new Error(
188
241
  `defineMdxComponents: descriptor '${descriptor.name}' has kind: 'text' with hasChildren: true — ` +
189
242
  "text-kind JSX is treated as an inline atom; use kind: 'flow' for components with children.",
190
243
  );
191
244
  }
245
+ if (
246
+ isJsxDescriptor(descriptor) &&
247
+ descriptor.blockType &&
248
+ (descriptor.kind !== 'flow' || !descriptor.hasChildren)
249
+ ) {
250
+ throw new Error(
251
+ `defineMdxComponents: descriptor '${descriptor.name}' has blockType: true — a block type holds a line of text, ` +
252
+ "so it needs kind: 'flow' and hasChildren: true.",
253
+ );
254
+ }
192
255
  if (isSnippetDescriptor(descriptor) && descriptor.content.length === 0) {
193
256
  throw new Error(
194
257
  `defineMdxComponents: snippet descriptor '${descriptor.name}' has empty content — ` +
@@ -200,6 +263,64 @@ export function defineMdxComponents(components: MdxComponents): MdxComponents {
200
263
  return components;
201
264
  }
202
265
 
266
+ function isPlainObject(v: unknown): v is { [key: string]: JsonValue } {
267
+ return typeof v === 'object' && v !== null && !Array.isArray(v);
268
+ }
269
+
270
+ /** Throws when a field has an unusable shape or `value` (when given) contradicts it. `path` is `Card.cta.href`. */
271
+ function checkField(field: MdxComponentField, path: string, value?: JsonValue): void {
272
+ const fail = (why: string): never => {
273
+ throw new Error(`defineMdxComponents: ${path} ${why}.`);
274
+ };
275
+ const typeName: unknown = field.type;
276
+ const has = value !== undefined && value !== null;
277
+ switch (field.type) {
278
+ case 'string':
279
+ case 'number':
280
+ case 'boolean':
281
+ if (has && typeof value !== field.type) fail(`default must be a ${field.type}`);
282
+ return;
283
+ case 'list':
284
+ if (!field.of) fail("is a list without 'of'");
285
+ if (has && !Array.isArray(value)) fail('default must be an array');
286
+ checkField(field.of, `${path}[]`);
287
+ if (Array.isArray(value)) {
288
+ for (const [i, item] of value.entries()) checkField(field.of, `${path}[${i}]`, item);
289
+ }
290
+ return;
291
+ case 'object':
292
+ if (!field.fields || Object.keys(field.fields).length === 0) fail("is an object without 'fields'");
293
+ if (has && !isPlainObject(value)) fail('default must be an object');
294
+ for (const [key, sub] of Object.entries(field.fields)) {
295
+ checkField(sub, `${path}.${key}`, isPlainObject(value) ? value[key] : undefined);
296
+ }
297
+ return;
298
+ default:
299
+ fail(`has unknown type '${String(typeName)}'`);
300
+ }
301
+ }
302
+
303
+ function checkJsxProps(d: MdxJsxComponentDescriptor): void {
304
+ const defaults = d.defaults?.attributes ?? {};
305
+ for (const prop of d.props ?? []) {
306
+ if (/^on/i.test(prop.name)) {
307
+ console.warn(
308
+ `defineMdxComponents: ${d.name}.${prop.name} starts with "on" and is never passed to the component; rename it.`,
309
+ );
310
+ }
311
+ const value = defaults[prop.name];
312
+ const scalar = prop.type === 'string' || prop.type === 'number' || prop.type === 'boolean';
313
+ // Scalar props predate this check; a throw here would crash existing sites at boot, so warn instead.
314
+ if (scalar && value !== undefined && value !== null && typeof value !== prop.type) {
315
+ console.warn(
316
+ `defineMdxComponents: ${d.name}.${prop.name} default should be a ${prop.type}, got ${JSON.stringify(value)}.`,
317
+ );
318
+ continue;
319
+ }
320
+ checkField(prop, `${d.name}.${prop.name}`, value);
321
+ }
322
+ }
323
+
203
324
  /**
204
325
  * Read a string-valued JSX attribute from an mdast flow element. Returns
205
326
  * an empty string when the attribute is missing or holds an expression
@@ -250,6 +371,24 @@ export function writeStringAttribute<T extends MdxJsxFlowElement | MdxJsxTextEle
250
371
  return next as T['attributes'];
251
372
  }
252
373
 
374
+ /**
375
+ * `attributes` with the outline anchor (the `outline.id` prop) made from the contents text (`outline.text`) when the
376
+ * element has no anchor and has text. An existing anchor is never changed, so links to it keep working after the text
377
+ * is edited. `taken` holds the anchors already in the document.
378
+ */
379
+ export function withOutlineId<T extends MdxJsxFlowElement | MdxJsxTextElement>(
380
+ attributes: T['attributes'],
381
+ outline: FragmentOutlineProps,
382
+ taken: Iterable<string>,
383
+ ): T['attributes'] {
384
+ const named = (name: string) =>
385
+ attributes.find((a): a is MdxJsxAttribute => a.type === 'mdxJsxAttribute' && a.name === name);
386
+ const id = named(outline.id);
387
+ const text = named(outline.text)?.value;
388
+ if ((id && id.value !== '') || typeof text !== 'string' || text.trim() === '') return attributes;
389
+ return writeAttribute<T>(attributes, outline.id, outlineIdFor(text, taken));
390
+ }
391
+
253
392
  /**
254
393
  * Type-aware attribute writer. Encodes the value into the right
255
394
  * mdast shape so the saved MDX matches what an author would write
@@ -270,7 +409,7 @@ export function writeStringAttribute<T extends MdxJsxFlowElement | MdxJsxTextEle
270
409
  export function writeAttribute<T extends MdxJsxFlowElement | MdxJsxTextElement>(
271
410
  attributes: T['attributes'],
272
411
  name: string,
273
- value: string | boolean | number | null | undefined,
412
+ value: JsonValue | null | undefined,
274
413
  ): T['attributes'] {
275
414
  const next = attributes.filter((a) => !(a.type === 'mdxJsxAttribute' && a.name === name));
276
415
  if (value === null || value === undefined) return next as T['attributes'];
@@ -291,6 +430,13 @@ export function writeAttribute<T extends MdxJsxFlowElement | MdxJsxTextElement>(
291
430
  name,
292
431
  value: { type: 'mdxJsxAttributeValueExpression', value: String(value) },
293
432
  });
433
+ } else if (typeof value === 'object') {
434
+ // Lists and objects: a JSON literal expression, which readAttrs parses back.
435
+ next.push({
436
+ type: 'mdxJsxAttribute',
437
+ name,
438
+ value: { type: 'mdxJsxAttributeValueExpression', value: JSON.stringify(value) },
439
+ });
294
440
  }
295
441
  return next as T['attributes'];
296
442
  }
@@ -1,6 +1,12 @@
1
1
  import type { JsxComponentDescriptor, JsxEditorProps } from '@mdxeditor/editor';
2
2
  import { type ComponentType, useEffect, useState } from 'react';
3
- import { isJsxDescriptor, type MdxComponentDescriptor, type MdxComponents } from './mdx-components-define.js';
3
+ import {
4
+ isJsxDescriptor,
5
+ type MdxComponentDescriptor,
6
+ type MdxComponents,
7
+ mergeDiscoveredMdxComponents,
8
+ } from './mdx-components-define.js';
9
+ import { getSiteRender, subscribeSiteRender } from './site-render.js';
4
10
 
5
11
  // The declaration surface (types, defineMdxComponents, the attribute
6
12
  // helpers) lives in mdx-components-define — editor-free so content configs
@@ -20,10 +26,14 @@ export * from './mdx-components-define.js';
20
26
  *
21
27
  * Snippet descriptors are not JSX — call sites filter them out before
22
28
  * dispatching here. Passing one throws to surface the misuse loudly.
29
+ *
30
+ * `withImport: false` drops the import a save would emit: a fragment's
31
+ * components come from the site's vocabulary, never from an import.
23
32
  */
24
33
  export function toJsxComponentDescriptor(
25
34
  d: MdxComponentDescriptor,
26
35
  fallbackEditor: ComponentType<JsxEditorProps>,
36
+ { withImport }: { withImport: boolean } = { withImport: true },
27
37
  ): JsxComponentDescriptor {
28
38
  if (!isJsxDescriptor(d)) {
29
39
  throw new Error(`toJsxComponentDescriptor: '${d.name}' is a snippet, not a JSX component.`);
@@ -33,12 +43,12 @@ export function toJsxComponentDescriptor(
33
43
  kind: d.kind,
34
44
  props: (d.props ?? []).map((p) => ({
35
45
  name: p.name,
36
- type: p.type === 'boolean' ? 'expression' : p.type,
46
+ type: p.type === 'string' || p.type === 'number' ? p.type : 'expression',
37
47
  required: p.required,
38
48
  })),
39
49
  hasChildren: d.hasChildren,
40
50
  Editor: d.Editor ?? fallbackEditor,
41
- ...(d.import ? { source: d.import.from, defaultExport: d.import.default ?? false } : {}),
51
+ ...(withImport && d.import ? { source: d.import.from, defaultExport: d.import.default ?? false } : {}),
42
52
  };
43
53
  }
44
54
 
@@ -95,41 +105,30 @@ export function getMdxComponents(): MdxComponents {
95
105
  * settled last overwrote the other's entries — discovered components
96
106
  * vanished whenever the fetch won the race. Each producer now writes its
97
107
  * own remembered slot and the registry is recomputed as the merge of both,
98
- * so settle order stops mattering. A host app that installs the full list
99
- * with a single `setMdxComponents` call keeps doing so; these slots are
100
- * dev-only plumbing.
108
+ * so settle order stops mattering. An editor embedding the CMS installs
109
+ * through the same two slots.
110
+ *
111
+ * The merge keeps host-authored entries for the current site render's
112
+ * fragment vocabulary names, and is redone whenever the site render changes.
101
113
  */
102
114
  export function installHostAuthoredMdxComponents(components: MdxComponents): void {
103
- const state = getSharedState();
104
- state.hostAuthored = components;
105
- setMdxComponents(mergeDiscoveredMdxComponents(components, state.discovered ?? []));
115
+ getSharedState().hostAuthored = components;
116
+ remerge();
106
117
  }
107
118
 
108
119
  /** Install the auto-discovered descriptor list — see `installHostAuthoredMdxComponents`. */
109
120
  export function installDiscoveredMdxComponents(components: MdxComponents): void {
110
- const state = getSharedState();
111
- state.discovered = components;
112
- setMdxComponents(mergeDiscoveredMdxComponents(state.hostAuthored ?? [], components));
121
+ getSharedState().discovered = components;
122
+ remerge();
113
123
  }
114
124
 
115
- /**
116
- * Merge auto-discovered descriptors over host-authored ones.
117
- *
118
- * Discovered entries win on a name collision: they are derived from the
119
- * source of truth (the MDX files and component folders themselves), while a
120
- * hand-written list can lag. ONE rule for every caller — the dev SPA merges
121
- * the `/api/registry` response over the `schemasPath` exports, and a host app
122
- * merges the same two lists from what it supplies.
123
- *
124
- * Host survivors keep their relative order and discovered entries append
125
- * after them, so a colliding entry surfaces at its discovered position, not
126
- * its host slot. Inputs are assumed unique-by-name — that validation lives
127
- * in `defineMdxComponents` and the discovery merge, not here.
128
- */
129
- export function mergeDiscoveredMdxComponents(hostAuthored: MdxComponents, discovered: MdxComponents): MdxComponents {
130
- if (discovered.length === 0) return hostAuthored;
131
- const discoveredNames = new Set(discovered.map((descriptor) => descriptor.name));
132
- return [...hostAuthored.filter((descriptor) => !discoveredNames.has(descriptor.name)), ...discovered];
125
+ let unsubscribeSiteRender: (() => void) | undefined;
126
+
127
+ function remerge(): void {
128
+ unsubscribeSiteRender ??= subscribeSiteRender(remerge);
129
+ const state = getSharedState();
130
+ const hostWins = new Set(Object.keys(getSiteRender().vocabulary.components));
131
+ setMdxComponents(mergeDiscoveredMdxComponents(state.hostAuthored ?? [], state.discovered ?? [], hostWins));
133
132
  }
134
133
 
135
134
  /**
@@ -1,3 +1,4 @@
1
+ import { pageStatusLabel } from '../ui-config.js';
1
2
  import { cn } from '../utils/cn.js';
2
3
  import type { AssetScope } from './types.js';
3
4
 
@@ -32,7 +33,7 @@ export function AssetScopePill({ scope, size = 'sm', className }: AssetScopePill
32
33
  if (!scope) return null;
33
34
 
34
35
  const isBranch = scope === 'branch';
35
- const label = isBranch ? 'Branch only' : 'Published';
36
+ const label = isBranch ? 'Branch only' : pageStatusLabel('published', 'Published');
36
37
  const sizeClasses = size === 'sm' ? 'text-[10px] px-1.5 py-0.5 leading-tight' : 'text-xs px-2 py-0.5';
37
38
 
38
39
  const variantClasses = isBranch
@@ -50,8 +50,12 @@ export function mergeDefaultProps(data: Data, config: Config): Data {
50
50
  }
51
51
  }
52
52
 
53
+ // Root's defaultProps go under its props as Puck fills them in on load (`root.props || root`).
54
+ const rootDefaults = config.root?.defaultProps;
55
+
53
56
  return {
54
57
  ...data,
58
+ ...(rootDefaults && { root: { ...data.root, props: { ...rootDefaults, ...(data.root?.props ?? data.root) } } }),
55
59
  content: mergedContent,
56
60
  ...(mergedZones && { zones: mergedZones }),
57
61
  };
@@ -1,4 +1,5 @@
1
- import { useEffect, useState } from 'react';
1
+ import type { JsonValue } from '@conloca/mdx/render';
2
+ import { useEffect, useRef, useState } from 'react';
2
3
  import type { MdxJsxComponentDescriptor } from './mdx-components.js';
3
4
 
4
5
  /**
@@ -34,11 +35,12 @@ export interface SelectedBlock {
34
35
  attrs: Record<string, unknown>;
35
36
  /** Apply a prop change. Wrapped by the owning block over its updater.
36
37
  * Accepts strings (text props), booleans (checkbox props), numbers
37
- * (numeric inputs), or `null`/`undefined` (remove the attribute).
38
+ * (numeric inputs), lists and objects (JSON expressions), or
39
+ * `null`/`undefined` (remove the attribute).
38
40
  * The block routes the value through `writeAttribute` which picks
39
41
  * the right mdast shape — string literal, JSX shorthand, or
40
42
  * expression. */
41
- onPropChange: (name: string, value: string | boolean | number | null | undefined) => void;
43
+ onPropChange: (name: string, value: JsonValue | null | undefined) => void;
42
44
  /** Remove the block from the document. */
43
45
  onRemove: () => void;
44
46
  }
@@ -46,6 +48,10 @@ export interface SelectedBlock {
46
48
  interface SharedState {
47
49
  selected: SelectedBlock | null;
48
50
  subscribers: Set<(next: SelectedBlock | null) => void>;
51
+ /** Optional: state made by an older copy of this module has none. */
52
+ drafts?: Set<() => void>;
53
+ /** Co-editing bindings open now (see `markLiveEditing`); optional as `drafts` is. */
54
+ live?: number;
49
55
  }
50
56
 
51
57
  declare global {
@@ -119,3 +125,49 @@ export function useSelectedBlock(): SelectedBlock | null {
119
125
 
120
126
  return selected;
121
127
  }
128
+
129
+ /**
130
+ * Registers a field's commit while it may hold typed text that commits only when the field is left (the side panel's
131
+ * fields, a block's inline prop fields, and its list-item fields off co-editing). The co-editing binding commits them
132
+ * all before a teammate's change rebuilds the block they write to, and before the editor closes. `commit` must do
133
+ * nothing when nothing is typed.
134
+ * Returns the release.
135
+ */
136
+ export function trackDraft(commit: () => void): () => void {
137
+ const state = getState();
138
+ state.drafts ??= new Set();
139
+ const drafts = state.drafts;
140
+ drafts.add(commit);
141
+ return () => {
142
+ drafts.delete(commit);
143
+ };
144
+ }
145
+
146
+ /** Commits every tracked draft; see `trackDraft`. */
147
+ export function commitDrafts(): void {
148
+ for (const commit of getState().drafts ?? []) commit();
149
+ }
150
+
151
+ /** `trackDraft` for a React field: its latest `commit` stays tracked while it is mounted. */
152
+ export function useTrackedDraft(commit: () => void): void {
153
+ const latest = useRef(commit);
154
+ latest.current = commit;
155
+ useEffect(() => trackDraft(() => latest.current()), []);
156
+ }
157
+
158
+ /**
159
+ * Marks the editor as co-edited while its binding is open: list items then write as they are typed, so teammates see
160
+ * it and no way out of the page drops it. Otherwise they write once the item is left, one undo step per visit.
161
+ * Returns the release.
162
+ */
163
+ export function markLiveEditing(): () => void {
164
+ const state = getState();
165
+ state.live = (state.live ?? 0) + 1;
166
+ return () => {
167
+ state.live = (state.live ?? 1) - 1;
168
+ };
169
+ }
170
+
171
+ export function isLiveEditing(): boolean {
172
+ return (getState().live ?? 0) > 0;
173
+ }
@@ -0,0 +1,146 @@
1
+ import type { MDXHeading as FragmentHeading } from '@conloca/content-api';
2
+ import {
3
+ EMPTY_FRAGMENT_VOCABULARY,
4
+ evaluateMDXToComponent,
5
+ type FragmentOutlineComponent,
6
+ type FragmentVocabulary,
7
+ isFragmentVocabulary,
8
+ } from '@conloca/mdx/render';
9
+ import { type ComponentType, type ReactNode, useEffect, useState } from 'react';
10
+
11
+ /**
12
+ * The site's own fragment renderer, vocabulary and editor frames, so the
13
+ * inline canvas renders a fragment with the site's components and its copy of
14
+ * the renderer. The dev entry (`${cmsRoute}/site-render-entry.js`) sets it from
15
+ * the site's modules; until then the editor's own renderer and an empty
16
+ * vocabulary stand in.
17
+ *
18
+ * Uses window so virtual modules and bundled code share the same state.
19
+ */
20
+
21
+ /**
22
+ * What a fragment renderer returns. `componentOutline` is optional because a
23
+ * site's own renderer may be a copy of `@conloca/mdx` from before it existed.
24
+ */
25
+ export interface EvaluatedFragment {
26
+ Component: ComponentType | null;
27
+ error?: Error;
28
+ outline: readonly FragmentHeading[];
29
+ componentOutline?: readonly FragmentOutlineComponent[];
30
+ }
31
+
32
+ export type FragmentEvaluate = (mdx: string, vocabulary?: FragmentVocabulary) => Promise<EvaluatedFragment>;
33
+
34
+ export type EditorFrame = ComponentType<{ pathname: string; children: ReactNode }>;
35
+
36
+ export interface SiteRender {
37
+ evaluate: FragmentEvaluate;
38
+ vocabulary: FragmentVocabulary;
39
+ frames: Readonly<Record<string, EditorFrame>>;
40
+ source: 'site' | 'editor';
41
+ }
42
+
43
+ interface SharedSiteRenderState {
44
+ render: SiteRender;
45
+ subscribers: Set<(render: SiteRender) => void>;
46
+ }
47
+
48
+ declare global {
49
+ interface Window {
50
+ __SITE_RENDER_STATE__?: SharedSiteRenderState;
51
+ }
52
+ }
53
+
54
+ const FALLBACK: SiteRender = {
55
+ evaluate: evaluateMDXToComponent,
56
+ vocabulary: EMPTY_FRAGMENT_VOCABULARY,
57
+ frames: {},
58
+ source: 'editor',
59
+ };
60
+
61
+ const getSharedState = (): SharedSiteRenderState => {
62
+ if (typeof window !== 'undefined') {
63
+ // oxlint-disable-next-line no-underscore-dangle -- the browser global declared above.
64
+ window.__SITE_RENDER_STATE__ ??= { render: FALLBACK, subscribers: new Set() };
65
+ // oxlint-disable-next-line no-underscore-dangle -- the browser global declared above.
66
+ return window.__SITE_RENDER_STATE__;
67
+ }
68
+ // SSR fallback
69
+ return { render: FALLBACK, subscribers: new Set() };
70
+ };
71
+
72
+ const isPlainObject = (value: unknown): value is object =>
73
+ typeof value === 'object' && value !== null && Object.getPrototypeOf(value) === Object.prototype;
74
+
75
+ // Shape checks only: site code supplies these, and a wrong signature surfaces as a render error.
76
+ const isFragmentEvaluate = (value: unknown): value is FragmentEvaluate => typeof value === 'function';
77
+ const isEditorFrame = (value: unknown): value is EditorFrame =>
78
+ typeof value === 'function' || (typeof value === 'object' && value !== null && '$$typeof' in value);
79
+
80
+ /**
81
+ * Register the site's render inputs. Each field is checked by shape, since it
82
+ * comes from site code: a malformed one is replaced by the fallback and named
83
+ * in one warning.
84
+ */
85
+ export function setSiteRender(input: { evaluate?: unknown; vocabulary?: unknown; frames?: unknown }): void {
86
+ const siteEvaluate = isFragmentEvaluate(input.evaluate) ? input.evaluate : undefined;
87
+ if (input.evaluate !== undefined && siteEvaluate === undefined) {
88
+ console.warn('[conloca] evaluate is not a function; using the editor renderer');
89
+ }
90
+ const vocabulary = isFragmentVocabulary(input.vocabulary) ? input.vocabulary : EMPTY_FRAGMENT_VOCABULARY;
91
+ if (input.vocabulary !== undefined && vocabulary !== input.vocabulary) {
92
+ console.warn('[conloca] fragmentComponents is not defineFragmentComponents(...) output; using no components');
93
+ }
94
+ const frames: Record<string, EditorFrame> = {};
95
+ if (isPlainObject(input.frames)) {
96
+ for (const [name, frame] of Object.entries(input.frames)) {
97
+ if (isEditorFrame(frame)) frames[name] = frame;
98
+ }
99
+ } else if (input.frames !== undefined) {
100
+ console.warn('[conloca] editorFrames is not an object; using no frames');
101
+ }
102
+ const render: SiteRender = {
103
+ evaluate: siteEvaluate ?? evaluateMDXToComponent,
104
+ vocabulary,
105
+ frames,
106
+ source: siteEvaluate ? 'site' : 'editor',
107
+ };
108
+ const state = getSharedState();
109
+ state.render = render;
110
+ state.subscribers.forEach((fn) => {
111
+ fn(render);
112
+ });
113
+ }
114
+
115
+ /** The current site render, or the editor's fallback until one is set. */
116
+ export function getSiteRender(): SiteRender {
117
+ return getSharedState().render;
118
+ }
119
+
120
+ /** Call `listener` on every later `setSiteRender`; returns the unsubscribe. */
121
+ export function subscribeSiteRender(listener: (render: SiteRender) => void): () => void {
122
+ const state = getSharedState();
123
+ state.subscribers.add(listener);
124
+ return () => {
125
+ state.subscribers.delete(listener);
126
+ };
127
+ }
128
+
129
+ /** React hook for the current site render; re-renders the caller when it changes (HMR support). */
130
+ export function useSiteRender(): SiteRender {
131
+ const [render, setRender] = useState(() => getSharedState().render);
132
+
133
+ useEffect(() => {
134
+ const state = getSharedState();
135
+ // Re-sync in case it changed between render and effect
136
+ if (state.render !== render) {
137
+ setRender(state.render);
138
+ }
139
+ state.subscribers.add(setRender);
140
+ return () => {
141
+ state.subscribers.delete(setRender);
142
+ };
143
+ }, [render]);
144
+
145
+ return render;
146
+ }
package/src/types.ts CHANGED
@@ -39,6 +39,9 @@ export interface PageMetadata {
39
39
  pathname: string;
40
40
  publishDate: Date | null;
41
41
  unpublishDate: Date | null;
42
+ /** The `publishAt` / `unpublishAt` text the page was read with, sent back unchanged while its date is not changed. */
43
+ publishAtText?: string;
44
+ unpublishAtText?: string;
42
45
  robots?: string;
43
46
  canonical?: string;
44
47
  customMeta?: Record<string, unknown>;