@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
@@ -79,4 +79,12 @@ export function fieldsOfMetadata(metadata) {
79
79
  export function fieldsOfHostSchema(schema) {
80
80
  return fieldsOfMetadata(schema.metadata);
81
81
  }
82
+ /** The label a form shows for field `name`: camelCase and snake_case in Title Case. */
83
+ export function formatFieldLabel(name) {
84
+ return name
85
+ .replace(/([A-Z])/g, ' $1')
86
+ .replace(/_/g, ' ')
87
+ .replace(/^\w/, (c) => c.toUpperCase())
88
+ .trim();
89
+ }
82
90
  //# sourceMappingURL=schema-fields.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema-fields.js","sourceRoot":"","sources":["../../../src/utils/schema-fields.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,qBAAqB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAmBlH,6FAA6F;AAC7F,SAAS,aAAa,CACpB,QAA4B,EAC5B,IAAgB;IAIhB,MAAM,QAAQ,GAAG,qBAAqB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACvD,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,IAAI,QAAQ,EAAE,WAAW,CAAC;IAC9D,MAAM,IAAI,GAAG,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC;IAC9D,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;IAErE,IAAI,OAAO,IAAI,QAAQ,EAAE,CAAC;QACxB,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,qBAAqB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;QACxF,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,IAAI,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC;QAC3G,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAA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0F;AAC1F,MAAM,UAAU,kBAAkB,CAAC,MAAkB;IACnD,OAAO,gBAAgB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAC3C,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C,OAAO,IAAI;SACR,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC;SAC1B,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;SAClB,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;SACtC,IAAI,EAAE,CAAC;AACZ,CAAC"}
@@ -17,6 +17,8 @@ export declare class ContentWriteRefusedError extends Error {
17
17
  readonly refusal: EditorWriteRefusal;
18
18
  constructor(method: string, refusal: EditorWriteRefusal);
19
19
  }
20
+ /** Access wrappers preserve the backend client's request lifetime without merging unrelated clients. */
21
+ export declare function contentWriteOwner(client: ContentAPIClient): ContentAPIClient;
20
22
  /**
21
23
  * What the editor may do to content right now.
22
24
  *
@@ -1 +1 @@
1
- {"version":3,"file":"write-access.d.ts","sourceRoot":"","sources":["../../src/write-access.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,kBAAkB,EAAe,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE7G,qEAAqE;AACrE,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,OAAO,CAAC;AA4DnD,wFAAwF;AACxF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAyB,CAAC;AAElH;;;;;;GAMG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,yDAAyD;IACzD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;IAErC,YAAY,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAKtD;CACF;AAID;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,GAAE,QAAwB,GAAG,iBAAiB,CAGrF;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,CA0B7E"}
1
+ {"version":3,"file":"write-access.d.ts","sourceRoot":"","sources":["../../src/write-access.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,kBAAkB,EAAe,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE7G,qEAAqE;AACrE,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,OAAO,CAAC;AA2DnD,wFAAwF;AACxF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAyB,CAAC;AAElH;;;;;;GAMG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,yDAAyD;IACzD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;IAErC,YAAY,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAKtD;CACF;AAKD,wGAAwG;AACxG,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,CAE5E;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,GAAE,QAAwB,GAAG,iBAAiB,CAGrF;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,CA2B7E"}
@@ -11,15 +11,15 @@ import { getUIConfig } from './ui-config.js';
11
11
  * Removed client methods must also be removed from this classification;
12
12
  * browser-side helpers are not part of the content API's access boundary.
13
13
  *
14
- * `compileMDX` is a POST and still a read: it renders a preview of content
15
- * the caller already holds and persists nothing.
16
- *
17
14
  * `pullChanges` is a write. It rewrites the workspace tree from the remote;
18
15
  * that it destroys rather than creates does not make it an observation.
19
16
  */
20
17
  const CONTENT_METHOD_ACCESS = {
21
18
  getContent: 'read',
22
19
  getLocalized: 'read',
20
+ getClobbered: 'read',
21
+ // Dismissing deletes the record of a clobbered save.
22
+ dismissClobbered: 'write',
23
23
  createContent: 'write',
24
24
  updateLocalized: 'write',
25
25
  deleteContent: 'write',
@@ -30,7 +30,6 @@ const CONTENT_METHOD_ACCESS = {
30
30
  movePage: 'write',
31
31
  getFragments: 'read',
32
32
  getFragmentByName: 'read',
33
- compileMDX: 'read',
34
33
  getData: 'read',
35
34
  getDataByName: 'read',
36
35
  isDataNameAvailable: 'read',
@@ -77,6 +76,11 @@ export class ContentWriteRefusedError extends Error {
77
76
  }
78
77
  }
79
78
  const WRITABLE = Object.freeze({ writable: true });
79
+ const writeOwners = new WeakMap();
80
+ /** Access wrappers preserve the backend client's request lifetime without merging unrelated clients. */
81
+ export function contentWriteOwner(client) {
82
+ return writeOwners.get(client) ?? client;
83
+ }
80
84
  /**
81
85
  * What the editor may do to content right now.
82
86
  *
@@ -135,6 +139,7 @@ export function guardContentWrites(client) {
135
139
  configurable: false,
136
140
  });
137
141
  }
142
+ writeOwners.set(guarded, contentWriteOwner(client));
138
143
  return guarded;
139
144
  }
140
145
  //# sourceMappingURL=write-access.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"write-access.js","sourceRoot":"","sources":["../../src/write-access.ts"],"names":[],"mappings":"AACA,OAAO,EAAmD,WAAW,EAAiB,MAAM,gBAAgB,CAAC;AAK7G;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,qBAAqB,GAAG;IAC5B,UAAU,EAAE,MAAM;IAClB,YAAY,EAAE,MAAM;IACpB,aAAa,EAAE,OAAO;IAC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AAO,CAAC,qBAAqB,CAAC,EAAE,CAAC;QAC7E,IAAI,cAAc,KAAK,OAAO;YAAE,SAAS;QACzC,MAAM,QAAQ,GAAY,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACtD,0EAA0E;QAC1E,yEAAyE;QACzE,2EAA2E;QAC3E,sEAAsE;QACtE,oEAAoE;QACpE,0DAA0D;QAC1D,gEAAgE;QAChE,gBAAgB;QAChB,IAAI,OAAO,QAAQ,KAAK,UAAU;YAAE,SAAS;QAC7C,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE;YACrC,KAAK,EAAE,CAAC,GAAG,IAAe,EAAW,EAAE;gBACrC,MAAM,MAAM,GAAG,iBAAiB,EAAE,CAAC;gBACnC,IAAI,MAAM,CAAC,QAAQ;oBAAE,OAAO,QAAQ,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;gBACzD,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,wBAAwB,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;YAC9E,CAAC;YACD,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,KAAK;YACjB,YAAY,EAAE,KAAK;SACpB,CAAC,CAAC;IACL,CAAC;IACD,WAAW,CAAC,GAAG,CAAC,OAAO,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;IACpD,OAAO,OAAO,CAAC;AACjB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conloca/cms-spa",
3
- "version": "0.2.5",
3
+ "version": "0.3.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -65,6 +65,11 @@
65
65
  "import": "./dist/ts/puck-config.js",
66
66
  "default": "./dist/ts/puck-config.js"
67
67
  },
68
+ "./site-render": {
69
+ "types": "./dist/ts/site-render.d.ts",
70
+ "import": "./dist/ts/site-render.js",
71
+ "default": "./dist/ts/site-render.js"
72
+ },
68
73
  "./site-styles": {
69
74
  "types": "./dist/ts/site-styles.d.ts",
70
75
  "import": "./dist/ts/site-styles.js",
@@ -125,6 +130,7 @@
125
130
  "src",
126
131
  "!src/**/*.test.*",
127
132
  "!src/**/*.stories.*",
133
+ "!src/**/__fixtures__/**",
128
134
  "styles",
129
135
  "!**/*.tsbuildinfo"
130
136
  ],
@@ -134,9 +140,11 @@
134
140
  "test": "nx run cms-spa:test --outputStyle=stream"
135
141
  },
136
142
  "dependencies": {
137
- "@conloca/content-api-client": "0.2.5",
138
- "@conloca/mdx": "0.2.5",
143
+ "@conloca/content-api": "0.3.0",
144
+ "@conloca/content-api-client": "0.3.0",
145
+ "@conloca/mdx": "0.3.0",
139
146
  "@lexical/react": "^0.48.0",
147
+ "@lexical/rich-text": "^0.48.0",
140
148
  "@mdxeditor/editor": "^4.2.3",
141
149
  "@puckeditor/core": "^0.23.0",
142
150
  "@radix-ui/react-dialog": "^1.1.23",
@@ -147,15 +155,16 @@
147
155
  "@types/mdast": "^4.0.4",
148
156
  "@typia/interface": "^14.0.5",
149
157
  "clsx": "^2.1.1",
158
+ "diff": "^9.0.0",
150
159
  "dompurify": "^3.4.17",
151
160
  "lexical": "^0.48.0",
152
161
  "lucide-react": "^0.564.0",
153
- "mdast-util-from-markdown": "^2.0.3",
154
162
  "mdast-util-mdx-jsx": "^3.2.0",
155
163
  "react-router-dom": "^7.18.3",
156
164
  "sonner": "^2.0.8",
157
165
  "tailwind-merge": "^3.6.0",
158
- "tslib": "^2.8.1"
166
+ "tslib": "^2.8.1",
167
+ "yjs": "^13.6.32"
159
168
  },
160
169
  "peerDependencies": {
161
170
  "react": "^19.0.0",
@@ -248,7 +257,8 @@
248
257
  "default",
249
258
  "^production",
250
259
  "{workspaceRoot}/package.json",
251
- "{workspaceRoot}/bun.lock"
260
+ "{workspaceRoot}/bun.lock",
261
+ "{workspaceRoot}/packages/mdx/src/__tests__/fixtures/**"
252
262
  ],
253
263
  "outputs": [
254
264
  "{workspaceRoot}/dist/storybook/cms-spa"
@@ -266,7 +276,8 @@
266
276
  "parallelism": false,
267
277
  "inputs": [
268
278
  "default",
269
- "^production"
279
+ "^production",
280
+ "{workspaceRoot}/packages/mdx/src/__tests__/fixtures/**"
270
281
  ],
271
282
  "dependsOn": [
272
283
  "^build",
package/src/CmsSpaApp.tsx CHANGED
@@ -6,22 +6,33 @@ import App from './App.js';
6
6
  import { clearMediaCache } from './frame/media-cache.js';
7
7
  import { CanvasThemeProvider } from './hooks/useCanvasTheme.js';
8
8
  import { ThemeProvider } from './hooks/useTheme.js';
9
- import { getUIConfig } from './ui-config.js';
9
+ import { getUIConfig, type UIConfig } from './ui-config.js';
10
10
  import { guardContentWrites } from './write-access.js';
11
11
 
12
+ const defaultClients = new WeakMap<UIConfig, { baseUrl: string | undefined; client: ContentAPIClient }>();
13
+
14
+ /** A same-workspace host remount replaces the query cache, but must retain the owner of outstanding writes. */
15
+ function contentClientFor(config: UIConfig): ContentAPIClient {
16
+ if (config.contentClient) return config.contentClient;
17
+ const existing = defaultClients.get(config);
18
+ if (existing && existing.baseUrl === config.apiBaseUrl) return existing.client;
19
+ const client = new ContentAPIClient({ baseUrl: config.apiBaseUrl });
20
+ defaultClients.set(config, { baseUrl: config.apiBaseUrl, client });
21
+ return client;
22
+ }
23
+
12
24
  /**
13
25
  * The full cms-spa editor as a React component.
14
26
  *
15
27
  * Reads the current `UIConfig` via `getUIConfig` — callers MUST call
16
- * `configureUI` before rendering this component. The `QueryClient`
17
- * and `ContentAPIClient` singletons are built via `useMemo`, so
18
- * consumers that force a fresh mount via React `key` (e.g. on
19
- * switching to another site) get clean cache state for the new site,
20
- * while single-mount consumers (e.g. astro-cms's `/__cms` route)
21
- * keep the same instances for the lifetime of the page.
28
+ * `configureUI` before rendering this component. Each mount owns its query
29
+ * cache. Default content clients belong to the exact installed config, so a
30
+ * same-workspace remount can await earlier writes while a new configuration
31
+ * gets a separate client. A supplied content client keeps its own identity.
22
32
  */
23
33
  export function CmsSpaApp() {
24
34
  const config = getUIConfig();
35
+ const contentClient = contentClientFor(config);
25
36
 
26
37
  const queryClient = useMemo(() => new QueryClient(config.queryClientOptions), [config.queryClientOptions]);
27
38
 
@@ -49,10 +60,8 @@ export function CmsSpaApp() {
49
60
  // is gated whether or not its author knew the seam existed. Reads are
50
61
  // untouched — a read-only editor still renders all of its content.
51
62
  useMemo(() => {
52
- setContentAPIClient(
53
- guardContentWrites(config.contentClient ?? new ContentAPIClient({ baseUrl: config.apiBaseUrl })),
54
- );
55
- }, [config.apiBaseUrl, config.contentClient]);
63
+ setContentAPIClient(guardContentWrites(contentClient));
64
+ }, [contentClient]);
56
65
 
57
66
  return (
58
67
  <QueryClientProvider client={queryClient}>
@@ -0,0 +1,135 @@
1
+ import { isRecord } from '@conloca/content-api/component-vocabulary';
2
+ import type { Config } from '@puckeditor/core';
3
+ import { useState } from 'react';
4
+ import type { PageRef } from '../../draft-tools.js';
5
+ import type { LiveMessage } from '../../live/messages.js';
6
+ import { type DocEditValue, useDocEdit, useDocRead, useLiveMessage } from '../../live/use-live.js';
7
+ import { cn } from '../../utils/cn.js';
8
+ import { type ConflictLabel, resolveConflictLabel } from './conflict-label.js';
9
+ import { FieldConflictList } from './FieldConflictList.js';
10
+ import { OverwriteNotice } from './OverwriteNotice.js';
11
+ import { conflictAge, conflictSource, draftToolsPage, samePage, usePageConflicts } from './use-page-conflicts.js';
12
+
13
+ type Overwritten = Extract<LiveMessage, { type: 'conloca:overwritten' }>;
14
+
15
+ export interface EditorNoticeStripProps {
16
+ page: PageRef;
17
+ /** The page's data as the editor holds it; labels resolve against it and `config` (Puck), else name the key. */
18
+ data?: unknown;
19
+ config?: Config;
20
+ /** The page's shared doc key, where `Restore yours` writes; without it there is nothing to restore into. */
21
+ docKey?: string;
22
+ /**
23
+ * Set where the fields panel shows each block's pickers (Puck): the strip only counts them and links each field to its
24
+ * block. Without it the strip shows the full pickers itself.
25
+ */
26
+ onSelect?: (anchor: string) => void;
27
+ }
28
+
29
+ const NO_COMPONENTS: Config = { components: {} };
30
+
31
+ const fieldName = (label: ConflictLabel) => `${label.field}${label.component === null ? '' : ` on ${label.component}`}`;
32
+
33
+ /** A rich-text value is overwritten whole (`…props.body`), but its field is `…props.body.value`. */
34
+ export function overwriteFieldAnchor(message: Overwritten): string {
35
+ return isRecord(message.value) && 'value' in message.value ? `${message.anchor}.value` : message.anchor;
36
+ }
37
+
38
+ /** An overwrite notice, with the teammate's value the field held when it arrived. */
39
+ type OpenOverwrite = Overwritten & { seen: DocEditValue };
40
+
41
+ /**
42
+ * The page's open overwrite notices, one per anchor, newest kept; prose (`body#…`) merges and is never one. `read`
43
+ * records the field's value at notice time, so Restore can tell a newer change from the one announced.
44
+ */
45
+ export function useOverwrites(page: PageRef, read: (anchor: string) => DocEditValue = () => undefined) {
46
+ const [notices, setNotices] = useState<OpenOverwrite[]>([]);
47
+ useLiveMessage('conloca:overwritten', (message) => {
48
+ if (!samePage(message, page) || message.anchor.startsWith('body#')) return;
49
+ const notice = { ...message, seen: read(message.anchor) };
50
+ setNotices((open) => [...open.filter((other) => other.anchor !== message.anchor), notice]);
51
+ });
52
+ const dismiss = (anchor: string) => setNotices((open) => open.filter((notice) => notice.anchor !== anchor));
53
+ return { notices, dismiss };
54
+ }
55
+
56
+ /** Above the editor body: the page's field clashes still to decide and the values teammates replaced. */
57
+ export function EditorNoticeStrip({ page, data, config = NO_COMPONENTS, docKey, onSelect }: EditorNoticeStripProps) {
58
+ const { conflicts, pendingAnchor, goneAnchors, pick, error } = usePageConflicts(page);
59
+ const { notices, dismiss } = useOverwrites(page, useDocRead(docKey ?? ''));
60
+ const write = useDocEdit(docKey ?? '');
61
+ const [restoreError, setRestoreError] = useState<string | null>(null);
62
+
63
+ // Only over the value announced: a newer one (theirs or a third person's) is never replaced unseen.
64
+ const restore = (notice: OpenOverwrite) => {
65
+ const result = write(notice.anchor, notice.value, { value: notice.seen });
66
+ setRestoreError(result.ok ? null : result.message);
67
+ if (result.ok || result.reason === 'changed') dismiss(notice.anchor);
68
+ };
69
+
70
+ return (
71
+ <div className={cn('flex flex-col gap-2 px-4 empty:hidden', conflicts.length + notices.length > 0 && 'py-2')}>
72
+ {notices.map((notice) => (
73
+ <div key={notice.anchor} data-field-anchor={overwriteFieldAnchor(notice)}>
74
+ <OverwriteNotice
75
+ label={resolveConflictLabel(overwriteFieldAnchor(notice), data, config).field}
76
+ byName={notice.byName}
77
+ {...(docKey ? { onRestore: () => restore(notice) } : {})}
78
+ onDismiss={() => dismiss(notice.anchor)}
79
+ />
80
+ </div>
81
+ ))}
82
+ {restoreError ? (
83
+ <p role="alert" className={cn('text-sm text-red-04 dark:text-red-08')}>
84
+ {restoreError}
85
+ </p>
86
+ ) : null}
87
+ {conflicts.length === 0 ? (
88
+ <p role="status" className="sr-only">
89
+ No fields need a decision
90
+ </p>
91
+ ) : onSelect ? (
92
+ <nav aria-label="Fields that need a decision" className={cn('flex flex-wrap items-center gap-2 text-sm')}>
93
+ <p role="status" className={cn('font-medium')}>
94
+ {conflicts.length === 1 ? '1 field needs a decision' : `${conflicts.length} fields need a decision`}
95
+ </p>
96
+ {conflicts.map((conflict) => (
97
+ <button
98
+ key={conflict.anchor}
99
+ type="button"
100
+ className={cn('underline text-azure-04 dark:text-azure-08')}
101
+ onClick={() => onSelect(conflict.anchor)}
102
+ >
103
+ {fieldName(resolveConflictLabel(conflict.anchor, data, config))}
104
+ </button>
105
+ ))}
106
+ </nav>
107
+ ) : (
108
+ <FieldConflictList
109
+ conflicts={conflicts}
110
+ data={data}
111
+ config={config}
112
+ sourceLabel={conflictSource}
113
+ age={(conflict) => conflictAge(conflict)}
114
+ {...(pendingAnchor === undefined ? {} : { pendingAnchor })}
115
+ goneAnchors={goneAnchors}
116
+ onPick={(anchor, choice) => {
117
+ const conflict = conflicts.find((candidate) => candidate.anchor === anchor);
118
+ if (conflict) void pick(conflict, choice);
119
+ }}
120
+ />
121
+ )}
122
+ {error && !onSelect ? (
123
+ <p role="alert" className={cn('text-sm text-red-04 dark:text-red-08')}>
124
+ {error.text}
125
+ </p>
126
+ ) : null}
127
+ </div>
128
+ );
129
+ }
130
+
131
+ /** The strip for an editor without Puck's fields panel (MDX, fragments, data): the full pickers inline; nothing without draft tools. */
132
+ export function DraftNoticeStrip({ id, locale, docKey }: { id: string | undefined; locale: string; docKey?: string }) {
133
+ const page = draftToolsPage(id, locale);
134
+ return page ? <EditorNoticeStrip page={page} {...(docKey === undefined ? {} : { docKey })} /> : null;
135
+ }
@@ -0,0 +1,59 @@
1
+ import type { FieldConflict } from '@conloca/content-api';
2
+ import type { Config } from '@puckeditor/core';
3
+ import { cn } from '../../utils/cn.js';
4
+ import { resolveConflictLabel } from './conflict-label.js';
5
+ import { type ConflictChoice, FieldConflictPicker } from './FieldConflictPicker.js';
6
+
7
+ export interface FieldConflictListProps<C extends FieldConflict = FieldConflict> {
8
+ conflicts: C[];
9
+ /** The page's data as the editor holds it; the labels resolve against it and `config`. */
10
+ data: unknown;
11
+ config: Config;
12
+ sourceLabel: (conflict: C) => string;
13
+ theirsBy?: (conflict: C) => string | undefined;
14
+ age?: (conflict: C) => string | undefined;
15
+ /** The anchor whose choice is being sent; only that picker waits. */
16
+ pendingAnchor?: string;
17
+ /** Anchors whose block was removed: their pickers offer only `Keep mine`. */
18
+ goneAnchors?: ReadonlySet<string>;
19
+ onPick: (anchor: string, choice: ConflictChoice) => void;
20
+ }
21
+
22
+ /** Every field on a page waiting for a decision, with a count screen readers announce as it changes. */
23
+ export function FieldConflictList<C extends FieldConflict>({
24
+ conflicts,
25
+ data,
26
+ config,
27
+ sourceLabel,
28
+ theirsBy,
29
+ age,
30
+ pendingAnchor,
31
+ goneAnchors,
32
+ onPick,
33
+ }: FieldConflictListProps<C>) {
34
+ const count = conflicts.length;
35
+ return (
36
+ <section className={cn('flex flex-col gap-3')}>
37
+ <p role="status" className={cn('text-sm font-medium')}>
38
+ {count === 1 ? '1 field needs a decision' : `${count} fields need a decision`}
39
+ </p>
40
+ {conflicts.map((conflict) => {
41
+ const by = theirsBy?.(conflict);
42
+ const ago = age?.(conflict);
43
+ return (
44
+ <FieldConflictPicker
45
+ key={conflict.anchor}
46
+ conflict={conflict}
47
+ label={resolveConflictLabel(conflict.anchor, data, config)}
48
+ sourceLabel={sourceLabel(conflict)}
49
+ {...(by === undefined ? {} : { theirsBy: by })}
50
+ {...(ago === undefined ? {} : { age: ago })}
51
+ pending={pendingAnchor === conflict.anchor}
52
+ mineOnly={goneAnchors?.has(conflict.anchor) ?? false}
53
+ onPick={(choice) => onPick(conflict.anchor, choice)}
54
+ />
55
+ );
56
+ })}
57
+ </section>
58
+ );
59
+ }
@@ -0,0 +1,158 @@
1
+ import type { FieldConflict, JsonValue } from '@conloca/content-api';
2
+ import { type KeyboardEvent, useId, useRef, useState } from 'react';
3
+ import { cn } from '../../utils/cn.js';
4
+ import { Button } from '../ui/Button.js';
5
+ import { Input } from '../ui/Input.js';
6
+ import type { ConflictLabel } from './conflict-label.js';
7
+
8
+ /** What a person decided: keep their value, take the other one, or settle on a value they typed. */
9
+ export type ConflictChoice = 'mine' | 'theirs' | { kind: 'value'; value: JsonValue };
10
+
11
+ export interface FieldConflictPickerProps {
12
+ conflict: FieldConflict;
13
+ label: ConflictLabel;
14
+ /** Where the other value came from, for example `from GitHub`. */
15
+ sourceLabel: string;
16
+ /** Who wrote the other value; without it the other value is "theirs". */
17
+ theirsBy?: string;
18
+ /** How long ago the other value arrived, for example `2 hours ago`. */
19
+ age?: string;
20
+ /** A choice is being sent: every button is disabled until it settles. */
21
+ pending?: boolean;
22
+ /** The field's block was removed: only `Keep mine` can settle it. */
23
+ mineOnly?: boolean;
24
+ onPick: (choice: ConflictChoice) => void;
25
+ }
26
+
27
+ /** The string leaves of a value, in order. */
28
+ function leaves(value: JsonValue): string[] {
29
+ if (value === null) return [];
30
+ if (Array.isArray(value)) return value.flatMap(leaves);
31
+ if (typeof value === 'object') return Object.values(value).flatMap(leaves);
32
+ return [String(value)];
33
+ }
34
+
35
+ /** One value as a person reads it: text, a list of its items, or an object's text joined with `·`; never JSON. */
36
+ function ConflictValue({ value }: { value: JsonValue | undefined }) {
37
+ if (value === undefined) return <span className="italic">(deleted)</span>;
38
+ if (leaves(value).join('') === '') return <span className="italic">(empty)</span>;
39
+ if (Array.isArray(value)) {
40
+ return (
41
+ <ul className={cn('list-disc pl-5')}>
42
+ {value.map((item, index) => (
43
+ // Items of an id-less list have nothing steadier than their place.
44
+ // biome-ignore lint/suspicious/noArrayIndexKey: the list is read-only and never reordered here.
45
+ <li key={index} className={cn('line-clamp-3')}>
46
+ {leaves(item).join(' · ')}
47
+ </li>
48
+ ))}
49
+ </ul>
50
+ );
51
+ }
52
+ return <span className={cn('line-clamp-3')}>{leaves(value).join(' · ')}</span>;
53
+ }
54
+
55
+ /**
56
+ * One field two people changed differently. The person keeps theirs, takes the other value or types a new one; nothing
57
+ * settles before they choose. A file a git rule keeps back has no choice here: a developer has to change the setting.
58
+ */
59
+ export function FieldConflictPicker({
60
+ conflict,
61
+ label,
62
+ sourceLabel,
63
+ theirsBy,
64
+ age,
65
+ pending = false,
66
+ mineOnly = false,
67
+ onPick,
68
+ }: FieldConflictPickerProps) {
69
+ const [draft, setDraft] = useState<string | null>(null);
70
+ const editButton = useRef<HTMLButtonElement>(null);
71
+ const inputId = useId();
72
+ const name = `${label.field}${label.component === null ? '' : ` on ${label.component}`}, ${sourceLabel}`;
73
+ const theirs = conflict.theirs;
74
+ const theirsName = theirsBy === undefined ? 'Their value:' : `${theirsBy}'s value:`;
75
+
76
+ const closeEdit = () => {
77
+ setDraft(null);
78
+ // The box takes focus with it when it closes; hand it back to the button that opened it.
79
+ requestAnimationFrame(() => editButton.current?.focus());
80
+ };
81
+ const onEditKey = (event: KeyboardEvent<HTMLInputElement>) => {
82
+ if (event.key !== 'Escape') return;
83
+ event.preventDefault();
84
+ event.stopPropagation();
85
+ closeEdit();
86
+ };
87
+
88
+ return (
89
+ <fieldset
90
+ aria-label={name}
91
+ aria-busy={pending ? 'true' : undefined}
92
+ className={cn('flex flex-col gap-2 rounded-md border border-line bg-panel p-3 text-sm')}
93
+ >
94
+ <p className={cn('font-medium text-grey-01 dark:text-grey-12')}>
95
+ {name}
96
+ {age === undefined ? null : (
97
+ <span className={cn('ml-1 font-normal text-grey-04 dark:text-grey-07')}>{age}</span>
98
+ )}
99
+ </p>
100
+ {conflict.anchor.startsWith('lfs:') ? (
101
+ <p>Ask your developer: this file needs a git setting before it can ship.</p>
102
+ ) : (
103
+ <>
104
+ <div>
105
+ <span className={cn('font-medium')}>Your value:</span> <ConflictValue value={conflict.ours} />
106
+ </div>
107
+ <div>
108
+ <span className={cn('font-medium')}>{theirsName}</span> <ConflictValue value={theirs} />
109
+ </div>
110
+ {draft === null ? (
111
+ <div className={cn('flex flex-wrap gap-2')}>
112
+ <Button size="sm" variant="outline" disabled={pending} onClick={() => onPick('mine')}>
113
+ Keep mine
114
+ </Button>
115
+ <Button size="sm" variant="outline" disabled={pending || mineOnly} onClick={() => onPick('theirs')}>
116
+ {theirsBy === undefined ? 'Use theirs' : `Use ${theirsBy}'s`}
117
+ </Button>
118
+ {typeof theirs === 'string' ? (
119
+ <Button
120
+ ref={editButton}
121
+ size="sm"
122
+ variant="ghost"
123
+ disabled={pending || mineOnly}
124
+ onClick={() => setDraft(theirs)}
125
+ >
126
+ Edit
127
+ </Button>
128
+ ) : null}
129
+ </div>
130
+ ) : (
131
+ <div className={cn('flex flex-col gap-2')}>
132
+ <label htmlFor={inputId} className={cn('font-medium')}>
133
+ New value for {label.field}
134
+ </label>
135
+ <Input
136
+ id={inputId}
137
+ size="sm"
138
+ value={draft}
139
+ autoFocus
140
+ disabled={pending}
141
+ onChange={(event) => setDraft(event.target.value)}
142
+ onKeyDown={onEditKey}
143
+ />
144
+ <div className={cn('flex gap-2')}>
145
+ <Button size="sm" disabled={pending} onClick={() => onPick({ kind: 'value', value: draft })}>
146
+ Save value
147
+ </Button>
148
+ <Button size="sm" variant="ghost" disabled={pending} onClick={closeEdit}>
149
+ Cancel
150
+ </Button>
151
+ </div>
152
+ </div>
153
+ )}
154
+ </>
155
+ )}
156
+ </fieldset>
157
+ );
158
+ }
@@ -0,0 +1,30 @@
1
+ import { cn } from '../../utils/cn.js';
2
+ import { Button } from '../ui/Button.js';
3
+
4
+ export interface OverwriteNoticeProps {
5
+ /** The field as a person reads it, for example `Hero title`. */
6
+ label: string;
7
+ byName: string;
8
+ /** Absent: there is no open shared doc to write the value back into. */
9
+ onRestore?: () => void;
10
+ onDismiss: () => void;
11
+ }
12
+
13
+ /** A teammate replaced a value this person had written; it stays until they restore theirs or dismiss it. */
14
+ export function OverwriteNotice({ label, byName, onRestore, onDismiss }: OverwriteNoticeProps) {
15
+ return (
16
+ <div className={cn('flex flex-wrap items-center gap-2 rounded-md border border-line bg-panel p-3 text-sm')}>
17
+ <p role="status" className={cn('flex-1')}>
18
+ {byName} changed {label}.
19
+ </p>
20
+ {onRestore ? (
21
+ <Button size="sm" variant="outline" onClick={onRestore}>
22
+ Restore yours
23
+ </Button>
24
+ ) : null}
25
+ <Button size="sm" variant="ghost" onClick={onDismiss}>
26
+ Dismiss
27
+ </Button>
28
+ </div>
29
+ );
30
+ }