@conloca/cms-spa 0.2.5 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (483) hide show
  1. package/dist/spa/main.css +262 -21
  2. package/dist/ts/.build-inputs.json +99 -57
  3. package/dist/ts/CmsSpaApp.d.ts +4 -6
  4. package/dist/ts/CmsSpaApp.d.ts.map +1 -1
  5. package/dist/ts/CmsSpaApp.js +19 -8
  6. package/dist/ts/CmsSpaApp.js.map +1 -1
  7. package/dist/ts/components/conflicts/EditorNoticeStrip.d.ts +44 -0
  8. package/dist/ts/components/conflicts/EditorNoticeStrip.d.ts.map +1 -0
  9. package/dist/ts/components/conflicts/EditorNoticeStrip.js +55 -0
  10. package/dist/ts/components/conflicts/EditorNoticeStrip.js.map +1 -0
  11. package/dist/ts/components/conflicts/FieldConflictList.d.ts +20 -0
  12. package/dist/ts/components/conflicts/FieldConflictList.d.ts.map +1 -0
  13. package/dist/ts/components/conflicts/FieldConflictList.js +14 -0
  14. package/dist/ts/components/conflicts/FieldConflictList.js.map +1 -0
  15. package/dist/ts/components/conflicts/FieldConflictPicker.d.ts +28 -0
  16. package/dist/ts/components/conflicts/FieldConflictPicker.d.ts.map +1 -0
  17. package/dist/ts/components/conflicts/FieldConflictPicker.js +52 -0
  18. package/dist/ts/components/conflicts/FieldConflictPicker.js.map +1 -0
  19. package/dist/ts/components/conflicts/OverwriteNotice.d.ts +11 -0
  20. package/dist/ts/components/conflicts/OverwriteNotice.d.ts.map +1 -0
  21. package/dist/ts/components/conflicts/OverwriteNotice.js +8 -0
  22. package/dist/ts/components/conflicts/OverwriteNotice.js.map +1 -0
  23. package/dist/ts/components/conflicts/PageDraftMenu.d.ts +11 -0
  24. package/dist/ts/components/conflicts/PageDraftMenu.d.ts.map +1 -0
  25. package/dist/ts/components/conflicts/PageDraftMenu.js +20 -0
  26. package/dist/ts/components/conflicts/PageDraftMenu.js.map +1 -0
  27. package/dist/ts/components/conflicts/PeerAvatars.d.ts +9 -0
  28. package/dist/ts/components/conflicts/PeerAvatars.d.ts.map +1 -0
  29. package/dist/ts/components/conflicts/PeerAvatars.js +29 -0
  30. package/dist/ts/components/conflicts/PeerAvatars.js.map +1 -0
  31. package/dist/ts/components/conflicts/PuckConflicts.d.ts +13 -0
  32. package/dist/ts/components/conflicts/PuckConflicts.d.ts.map +1 -0
  33. package/dist/ts/components/conflicts/PuckConflicts.js +59 -0
  34. package/dist/ts/components/conflicts/PuckConflicts.js.map +1 -0
  35. package/dist/ts/components/conflicts/RecentVersionsDialog.d.ts +15 -0
  36. package/dist/ts/components/conflicts/RecentVersionsDialog.d.ts.map +1 -0
  37. package/dist/ts/components/conflicts/RecentVersionsDialog.js +94 -0
  38. package/dist/ts/components/conflicts/RecentVersionsDialog.js.map +1 -0
  39. package/dist/ts/components/conflicts/conflict-label.d.ts +12 -0
  40. package/dist/ts/components/conflicts/conflict-label.d.ts.map +1 -0
  41. package/dist/ts/components/conflicts/conflict-label.js +120 -0
  42. package/dist/ts/components/conflicts/conflict-label.js.map +1 -0
  43. package/dist/ts/components/conflicts/use-page-conflicts.d.ts +26 -0
  44. package/dist/ts/components/conflicts/use-page-conflicts.d.ts.map +1 -0
  45. package/dist/ts/components/conflicts/use-page-conflicts.js +93 -0
  46. package/dist/ts/components/conflicts/use-page-conflicts.js.map +1 -0
  47. package/dist/ts/components/conflicts/version-copy.d.ts +7 -0
  48. package/dist/ts/components/conflicts/version-copy.d.ts.map +1 -0
  49. package/dist/ts/components/conflicts/version-copy.js +31 -0
  50. package/dist/ts/components/conflicts/version-copy.js.map +1 -0
  51. package/dist/ts/components/dashboard/RecentActivity.d.ts.map +1 -1
  52. package/dist/ts/components/dashboard/RecentActivity.js +2 -1
  53. package/dist/ts/components/dashboard/RecentActivity.js.map +1 -1
  54. package/dist/ts/components/dialogs/CreatePageDialog.js +1 -1
  55. package/dist/ts/components/dialogs/CreatePageDialog.js.map +1 -1
  56. package/dist/ts/components/dialogs/DataPropertiesDialog.d.ts +2 -1
  57. package/dist/ts/components/dialogs/DataPropertiesDialog.d.ts.map +1 -1
  58. package/dist/ts/components/dialogs/DataPropertiesDialog.js +15 -3
  59. package/dist/ts/components/dialogs/DataPropertiesDialog.js.map +1 -1
  60. package/dist/ts/components/dialogs/FragmentPropertiesDialog.d.ts +2 -1
  61. package/dist/ts/components/dialogs/FragmentPropertiesDialog.d.ts.map +1 -1
  62. package/dist/ts/components/dialogs/FragmentPropertiesDialog.js +16 -3
  63. package/dist/ts/components/dialogs/FragmentPropertiesDialog.js.map +1 -1
  64. package/dist/ts/components/dialogs/PageMetadataDialog.d.ts +9 -2
  65. package/dist/ts/components/dialogs/PageMetadataDialog.d.ts.map +1 -1
  66. package/dist/ts/components/dialogs/PageMetadataDialog.js +63 -16
  67. package/dist/ts/components/dialogs/PageMetadataDialog.js.map +1 -1
  68. package/dist/ts/components/dialogs/UnsavedChangesDialog.d.ts +16 -1
  69. package/dist/ts/components/dialogs/UnsavedChangesDialog.d.ts.map +1 -1
  70. package/dist/ts/components/dialogs/UnsavedChangesDialog.js +90 -2
  71. package/dist/ts/components/dialogs/UnsavedChangesDialog.js.map +1 -1
  72. package/dist/ts/components/dialogs/unsaved-guard.d.ts +9 -0
  73. package/dist/ts/components/dialogs/unsaved-guard.d.ts.map +1 -0
  74. package/dist/ts/components/dialogs/unsaved-guard.js +14 -0
  75. package/dist/ts/components/dialogs/unsaved-guard.js.map +1 -0
  76. package/dist/ts/components/editor/CMSMDXEditor.d.ts +6 -1
  77. package/dist/ts/components/editor/CMSMDXEditor.d.ts.map +1 -1
  78. package/dist/ts/components/editor/CMSMDXEditor.js +32 -15
  79. package/dist/ts/components/editor/CMSMDXEditor.js.map +1 -1
  80. package/dist/ts/components/editor/EditorFrame.d.ts +22 -0
  81. package/dist/ts/components/editor/EditorFrame.d.ts.map +1 -0
  82. package/dist/ts/components/editor/EditorFrame.js +72 -0
  83. package/dist/ts/components/editor/EditorFrame.js.map +1 -0
  84. package/dist/ts/components/editor/FragmentBlockTypeSelect.d.ts +10 -0
  85. package/dist/ts/components/editor/FragmentBlockTypeSelect.d.ts.map +1 -0
  86. package/dist/ts/components/editor/FragmentBlockTypeSelect.js +187 -0
  87. package/dist/ts/components/editor/FragmentBlockTypeSelect.js.map +1 -0
  88. package/dist/ts/components/editor/FragmentComponentBlock.d.ts +7 -0
  89. package/dist/ts/components/editor/FragmentComponentBlock.d.ts.map +1 -0
  90. package/dist/ts/components/editor/FragmentComponentBlock.js +180 -0
  91. package/dist/ts/components/editor/FragmentComponentBlock.js.map +1 -0
  92. package/dist/ts/components/editor/FragmentEditor.d.ts +3 -1
  93. package/dist/ts/components/editor/FragmentEditor.d.ts.map +1 -1
  94. package/dist/ts/components/editor/FragmentEditor.js +545 -130
  95. package/dist/ts/components/editor/FragmentEditor.js.map +1 -1
  96. package/dist/ts/components/editor/FragmentEditorHeaderActions.d.ts +20 -0
  97. package/dist/ts/components/editor/FragmentEditorHeaderActions.d.ts.map +1 -0
  98. package/dist/ts/components/editor/FragmentEditorHeaderActions.js +49 -0
  99. package/dist/ts/components/editor/FragmentEditorHeaderActions.js.map +1 -0
  100. package/dist/ts/components/editor/GenericBlock.d.ts.map +1 -1
  101. package/dist/ts/components/editor/GenericBlock.js +109 -12
  102. package/dist/ts/components/editor/GenericBlock.js.map +1 -1
  103. package/dist/ts/components/editor/InlinePreviewFrame.d.ts +19 -0
  104. package/dist/ts/components/editor/InlinePreviewFrame.d.ts.map +1 -0
  105. package/dist/ts/components/editor/InlinePreviewFrame.js +65 -0
  106. package/dist/ts/components/editor/InlinePreviewFrame.js.map +1 -0
  107. package/dist/ts/components/editor/JsxPropsPanel.d.ts.map +1 -1
  108. package/dist/ts/components/editor/JsxPropsPanel.js +62 -2
  109. package/dist/ts/components/editor/JsxPropsPanel.js.map +1 -1
  110. package/dist/ts/components/editor/LocaleSelector.d.ts +2 -1
  111. package/dist/ts/components/editor/LocaleSelector.d.ts.map +1 -1
  112. package/dist/ts/components/editor/LocaleSelector.js +2 -2
  113. package/dist/ts/components/editor/LocaleSelector.js.map +1 -1
  114. package/dist/ts/components/editor/MDXLivePreview.d.ts +2 -0
  115. package/dist/ts/components/editor/MDXLivePreview.d.ts.map +1 -1
  116. package/dist/ts/components/editor/MDXLivePreview.js +30 -38
  117. package/dist/ts/components/editor/MDXLivePreview.js.map +1 -1
  118. package/dist/ts/components/editor/MdxPageEditor.d.ts +7 -2
  119. package/dist/ts/components/editor/MdxPageEditor.d.ts.map +1 -1
  120. package/dist/ts/components/editor/MdxPageEditor.js +136 -10
  121. package/dist/ts/components/editor/MdxPageEditor.js.map +1 -1
  122. package/dist/ts/components/editor/PageEditor.d.ts +4 -1
  123. package/dist/ts/components/editor/PageEditor.d.ts.map +1 -1
  124. package/dist/ts/components/editor/PageEditor.js +78 -100
  125. package/dist/ts/components/editor/PageEditor.js.map +1 -1
  126. package/dist/ts/components/editor/PageEditorHeaderActions.d.ts +15 -4
  127. package/dist/ts/components/editor/PageEditorHeaderActions.d.ts.map +1 -1
  128. package/dist/ts/components/editor/PageEditorHeaderActions.js +13 -7
  129. package/dist/ts/components/editor/PageEditorHeaderActions.js.map +1 -1
  130. package/dist/ts/components/editor/PageEditorWrapper.d.ts +8 -2
  131. package/dist/ts/components/editor/PageEditorWrapper.d.ts.map +1 -1
  132. package/dist/ts/components/editor/PageEditorWrapper.js +99 -41
  133. package/dist/ts/components/editor/PageEditorWrapper.js.map +1 -1
  134. package/dist/ts/components/editor/body-sync-plugin.d.ts +2 -0
  135. package/dist/ts/components/editor/body-sync-plugin.d.ts.map +1 -0
  136. package/dist/ts/components/editor/body-sync-plugin.js +32 -0
  137. package/dist/ts/components/editor/body-sync-plugin.js.map +1 -0
  138. package/dist/ts/components/editor/draft-media-config.d.ts +6 -0
  139. package/dist/ts/components/editor/draft-media-config.d.ts.map +1 -1
  140. package/dist/ts/components/editor/draft-media-config.js +21 -0
  141. package/dist/ts/components/editor/draft-media-config.js.map +1 -1
  142. package/dist/ts/components/editor/fragment-save-check.d.ts +7 -0
  143. package/dist/ts/components/editor/fragment-save-check.d.ts.map +1 -0
  144. package/dist/ts/components/editor/fragment-save-check.js +13 -0
  145. package/dist/ts/components/editor/fragment-save-check.js.map +1 -0
  146. package/dist/ts/components/editor/fragment-save-lifetime.d.ts +18 -0
  147. package/dist/ts/components/editor/fragment-save-lifetime.d.ts.map +1 -0
  148. package/dist/ts/components/editor/fragment-save-lifetime.js +115 -0
  149. package/dist/ts/components/editor/fragment-save-lifetime.js.map +1 -0
  150. package/dist/ts/components/editor/host-wrapper-plugin.d.ts.map +1 -1
  151. package/dist/ts/components/editor/host-wrapper-plugin.js +20 -7
  152. package/dist/ts/components/editor/host-wrapper-plugin.js.map +1 -1
  153. package/dist/ts/components/editor/index.d.ts +0 -1
  154. package/dist/ts/components/editor/index.d.ts.map +1 -1
  155. package/dist/ts/components/editor/index.js +0 -1
  156. package/dist/ts/components/editor/index.js.map +1 -1
  157. package/dist/ts/components/editor/insert-menu/InsertMdxComponentButton.d.ts.map +1 -1
  158. package/dist/ts/components/editor/insert-menu/InsertMdxComponentButton.js +6 -11
  159. package/dist/ts/components/editor/insert-menu/InsertMdxComponentButton.js.map +1 -1
  160. package/dist/ts/components/editor/insert-menu/SlashMenuPlugin.d.ts.map +1 -1
  161. package/dist/ts/components/editor/insert-menu/SlashMenuPlugin.js +66 -12
  162. package/dist/ts/components/editor/insert-menu/SlashMenuPlugin.js.map +1 -1
  163. package/dist/ts/components/editor/insert-menu/insert-payload.d.ts +16 -21
  164. package/dist/ts/components/editor/insert-menu/insert-payload.d.ts.map +1 -1
  165. package/dist/ts/components/editor/insert-menu/insert-payload.js +75 -22
  166. package/dist/ts/components/editor/insert-menu/insert-payload.js.map +1 -1
  167. package/dist/ts/components/editor/insert-menu/mdx-components-plugin.d.ts +3 -1
  168. package/dist/ts/components/editor/insert-menu/mdx-components-plugin.d.ts.map +1 -1
  169. package/dist/ts/components/editor/insert-menu/mdx-components-plugin.js +5 -3
  170. package/dist/ts/components/editor/insert-menu/mdx-components-plugin.js.map +1 -1
  171. package/dist/ts/components/editor/jsx-layout-plugin.d.ts +25 -0
  172. package/dist/ts/components/editor/jsx-layout-plugin.d.ts.map +1 -0
  173. package/dist/ts/components/editor/jsx-layout-plugin.js +77 -0
  174. package/dist/ts/components/editor/jsx-layout-plugin.js.map +1 -0
  175. package/dist/ts/components/editor/offered-mdx-components.d.ts +11 -0
  176. package/dist/ts/components/editor/offered-mdx-components.d.ts.map +1 -0
  177. package/dist/ts/components/editor/offered-mdx-components.js +27 -0
  178. package/dist/ts/components/editor/offered-mdx-components.js.map +1 -0
  179. package/dist/ts/components/editor/page-setting-targets.d.ts.map +1 -1
  180. package/dist/ts/components/editor/page-setting-targets.js +2 -1
  181. package/dist/ts/components/editor/page-setting-targets.js.map +1 -1
  182. package/dist/ts/components/editor/preview-availability.d.ts +16 -1
  183. package/dist/ts/components/editor/preview-availability.d.ts.map +1 -1
  184. package/dist/ts/components/editor/preview-availability.js +16 -1
  185. package/dist/ts/components/editor/preview-availability.js.map +1 -1
  186. package/dist/ts/components/editor/prop-field-hint.d.ts +13 -0
  187. package/dist/ts/components/editor/prop-field-hint.d.ts.map +1 -0
  188. package/dist/ts/components/editor/prop-field-hint.js +70 -0
  189. package/dist/ts/components/editor/prop-field-hint.js.map +1 -0
  190. package/dist/ts/components/editor/soft-break-plugin.d.ts +21 -0
  191. package/dist/ts/components/editor/soft-break-plugin.d.ts.map +1 -0
  192. package/dist/ts/components/editor/soft-break-plugin.js +52 -0
  193. package/dist/ts/components/editor/soft-break-plugin.js.map +1 -0
  194. package/dist/ts/components/editor/use-live-page-settings.d.ts +13 -0
  195. package/dist/ts/components/editor/use-live-page-settings.d.ts.map +1 -0
  196. package/dist/ts/components/editor/use-live-page-settings.js +76 -0
  197. package/dist/ts/components/editor/use-live-page-settings.js.map +1 -0
  198. package/dist/ts/components/editor/usePagePreview.d.ts +32 -0
  199. package/dist/ts/components/editor/usePagePreview.d.ts.map +1 -0
  200. package/dist/ts/components/editor/usePagePreview.js +252 -0
  201. package/dist/ts/components/editor/usePagePreview.js.map +1 -0
  202. package/dist/ts/components/editors/DataEditor.d.ts +6 -3
  203. package/dist/ts/components/editors/DataEditor.d.ts.map +1 -1
  204. package/dist/ts/components/editors/DataEditor.js +153 -19
  205. package/dist/ts/components/editors/DataEditor.js.map +1 -1
  206. package/dist/ts/components/fields/MDXEditField.d.ts +1 -1
  207. package/dist/ts/components/fields/MDXEditField.js +2 -2
  208. package/dist/ts/components/fields/MDXEditField.js.map +1 -1
  209. package/dist/ts/components/forms/SchemaForm.d.ts.map +1 -1
  210. package/dist/ts/components/forms/SchemaForm.js +1 -9
  211. package/dist/ts/components/forms/SchemaForm.js.map +1 -1
  212. package/dist/ts/components/media/AssetDetailSidebar.d.ts.map +1 -1
  213. package/dist/ts/components/media/AssetDetailSidebar.js +43 -5
  214. package/dist/ts/components/media/AssetDetailSidebar.js.map +1 -1
  215. package/dist/ts/components/pages/DataList.d.ts.map +1 -1
  216. package/dist/ts/components/pages/DataList.js +16 -4
  217. package/dist/ts/components/pages/DataList.js.map +1 -1
  218. package/dist/ts/components/pages/FragmentList.d.ts.map +1 -1
  219. package/dist/ts/components/pages/FragmentList.js +10 -0
  220. package/dist/ts/components/pages/FragmentList.js.map +1 -1
  221. package/dist/ts/components/pages/PageList.d.ts.map +1 -1
  222. package/dist/ts/components/pages/PageList.js +54 -118
  223. package/dist/ts/components/pages/PageList.js.map +1 -1
  224. package/dist/ts/components/pages/PageRow.d.ts +21 -0
  225. package/dist/ts/components/pages/PageRow.d.ts.map +1 -0
  226. package/dist/ts/components/pages/PageRow.js +70 -0
  227. package/dist/ts/components/pages/PageRow.js.map +1 -0
  228. package/dist/ts/components/pages/PageTable.d.ts +21 -0
  229. package/dist/ts/components/pages/PageTable.d.ts.map +1 -0
  230. package/dist/ts/components/pages/PageTable.js +12 -0
  231. package/dist/ts/components/pages/PageTable.js.map +1 -0
  232. package/dist/ts/components/pages/page-list-model.d.ts +20 -0
  233. package/dist/ts/components/pages/page-list-model.d.ts.map +1 -0
  234. package/dist/ts/components/pages/page-list-model.js +78 -0
  235. package/dist/ts/components/pages/page-list-model.js.map +1 -0
  236. package/dist/ts/components/puck/MDXContent.d.ts +3 -3
  237. package/dist/ts/components/puck/MDXContent.d.ts.map +1 -1
  238. package/dist/ts/components/puck/MDXContent.js +24 -72
  239. package/dist/ts/components/puck/MDXContent.js.map +1 -1
  240. package/dist/ts/components/puck/csp-frame-harness.d.ts +14 -0
  241. package/dist/ts/components/puck/csp-frame-harness.d.ts.map +1 -0
  242. package/dist/ts/components/puck/csp-frame-harness.js +85 -0
  243. package/dist/ts/components/puck/csp-frame-harness.js.map +1 -0
  244. package/dist/ts/components/puck/use-fragment-render.d.ts +9 -0
  245. package/dist/ts/components/puck/use-fragment-render.d.ts.map +1 -0
  246. package/dist/ts/components/puck/use-fragment-render.js +70 -0
  247. package/dist/ts/components/puck/use-fragment-render.js.map +1 -0
  248. package/dist/ts/components/sandbox/ContentSandbox.d.ts +3 -5
  249. package/dist/ts/components/sandbox/ContentSandbox.d.ts.map +1 -1
  250. package/dist/ts/components/sandbox/ContentSandbox.js +6 -8
  251. package/dist/ts/components/sandbox/ContentSandbox.js.map +1 -1
  252. package/dist/ts/components/sandbox/frame-runtime.d.ts +1 -1
  253. package/dist/ts/components/sandbox/frame-runtime.d.ts.map +1 -1
  254. package/dist/ts/components/sandbox/frame-runtime.js +1 -1
  255. package/dist/ts/components/sandbox/frame-runtime.js.map +1 -1
  256. package/dist/ts/components/toast.d.ts +8 -4
  257. package/dist/ts/components/toast.d.ts.map +1 -1
  258. package/dist/ts/components/toast.js +6 -1
  259. package/dist/ts/components/toast.js.map +1 -1
  260. package/dist/ts/components/ui/Card.d.ts +3 -5
  261. package/dist/ts/components/ui/Card.d.ts.map +1 -1
  262. package/dist/ts/components/ui/Card.js +3 -5
  263. package/dist/ts/components/ui/Card.js.map +1 -1
  264. package/dist/ts/components/ui/Select.d.ts.map +1 -1
  265. package/dist/ts/components/ui/Select.js +12 -3
  266. package/dist/ts/components/ui/Select.js.map +1 -1
  267. package/dist/ts/draft-tools.d.ts +76 -0
  268. package/dist/ts/draft-tools.d.ts.map +1 -0
  269. package/dist/ts/draft-tools.js +2 -0
  270. package/dist/ts/draft-tools.js.map +1 -0
  271. package/dist/ts/frame/channel.d.ts +1 -1
  272. package/dist/ts/frame/channel.d.ts.map +1 -1
  273. package/dist/ts/frame/channel.js +3 -0
  274. package/dist/ts/frame/channel.js.map +1 -1
  275. package/dist/ts/frame/editor-frame.d.ts.map +1 -1
  276. package/dist/ts/frame/editor-frame.js +188 -30
  277. package/dist/ts/frame/editor-frame.js.map +1 -1
  278. package/dist/ts/frame/protocol.d.ts +73 -4
  279. package/dist/ts/frame/protocol.d.ts.map +1 -1
  280. package/dist/ts/frame/protocol.js +54 -16
  281. package/dist/ts/frame/protocol.js.map +1 -1
  282. package/dist/ts/hooks/useUnsavedChangesGuard.d.ts +5 -3
  283. package/dist/ts/hooks/useUnsavedChangesGuard.d.ts.map +1 -1
  284. package/dist/ts/hooks/useUnsavedChangesGuard.js +17 -7
  285. package/dist/ts/hooks/useUnsavedChangesGuard.js.map +1 -1
  286. package/dist/ts/host-style-probe.d.ts.map +1 -1
  287. package/dist/ts/host-style-probe.js +160 -40
  288. package/dist/ts/host-style-probe.js.map +1 -1
  289. package/dist/ts/index.d.ts +13 -0
  290. package/dist/ts/index.d.ts.map +1 -1
  291. package/dist/ts/index.js +14 -0
  292. package/dist/ts/index.js.map +1 -1
  293. package/dist/ts/live/data-binding.d.ts +67 -0
  294. package/dist/ts/live/data-binding.d.ts.map +1 -0
  295. package/dist/ts/live/data-binding.js +215 -0
  296. package/dist/ts/live/data-binding.js.map +1 -0
  297. package/dist/ts/live/doc-channel.d.ts +74 -0
  298. package/dist/ts/live/doc-channel.d.ts.map +1 -0
  299. package/dist/ts/live/doc-channel.js +293 -0
  300. package/dist/ts/live/doc-channel.js.map +1 -0
  301. package/dist/ts/live/held-fragment-edits.d.ts +15 -0
  302. package/dist/ts/live/held-fragment-edits.d.ts.map +1 -0
  303. package/dist/ts/live/held-fragment-edits.js +47 -0
  304. package/dist/ts/live/held-fragment-edits.js.map +1 -0
  305. package/dist/ts/live/markdown-binding.d.ts +54 -0
  306. package/dist/ts/live/markdown-binding.d.ts.map +1 -0
  307. package/dist/ts/live/markdown-binding.js +618 -0
  308. package/dist/ts/live/markdown-binding.js.map +1 -0
  309. package/dist/ts/live/markdown-live-plugin.d.ts +42 -0
  310. package/dist/ts/live/markdown-live-plugin.d.ts.map +1 -0
  311. package/dist/ts/live/markdown-live-plugin.js +918 -0
  312. package/dist/ts/live/markdown-live-plugin.js.map +1 -0
  313. package/dist/ts/live/messages.d.ts +142 -0
  314. package/dist/ts/live/messages.d.ts.map +1 -0
  315. package/dist/ts/live/messages.js +266 -0
  316. package/dist/ts/live/messages.js.map +1 -0
  317. package/dist/ts/live/puck-binding.d.ts +88 -0
  318. package/dist/ts/live/puck-binding.d.ts.map +1 -0
  319. package/dist/ts/live/puck-binding.js +467 -0
  320. package/dist/ts/live/puck-binding.js.map +1 -0
  321. package/dist/ts/live/undo.d.ts +29 -0
  322. package/dist/ts/live/undo.d.ts.map +1 -0
  323. package/dist/ts/live/undo.js +104 -0
  324. package/dist/ts/live/undo.js.map +1 -0
  325. package/dist/ts/live/use-live.d.ts +77 -0
  326. package/dist/ts/live/use-live.d.ts.map +1 -0
  327. package/dist/ts/live/use-live.js +207 -0
  328. package/dist/ts/live/use-live.js.map +1 -0
  329. package/dist/ts/mdx-components-define.d.ts +52 -15
  330. package/dist/ts/mdx-components-define.d.ts.map +1 -1
  331. package/dist/ts/mdx-components-define.js +136 -0
  332. package/dist/ts/mdx-components-define.js.map +1 -1
  333. package/dist/ts/mdx-components.d.ts +11 -19
  334. package/dist/ts/mdx-components.d.ts.map +1 -1
  335. package/dist/ts/mdx-components.js +23 -32
  336. package/dist/ts/mdx-components.js.map +1 -1
  337. package/dist/ts/media/AssetScopePill.d.ts.map +1 -1
  338. package/dist/ts/media/AssetScopePill.js +2 -1
  339. package/dist/ts/media/AssetScopePill.js.map +1 -1
  340. package/dist/ts/merge-default-props.d.ts.map +1 -1
  341. package/dist/ts/merge-default-props.js +3 -0
  342. package/dist/ts/merge-default-props.js.map +1 -1
  343. package/dist/ts/selected-block.d.ts +27 -2
  344. package/dist/ts/selected-block.d.ts.map +1 -1
  345. package/dist/ts/selected-block.js +43 -1
  346. package/dist/ts/selected-block.js.map +1 -1
  347. package/dist/ts/site-render.d.ts +60 -0
  348. package/dist/ts/site-render.d.ts.map +1 -0
  349. package/dist/ts/site-render.js +87 -0
  350. package/dist/ts/site-render.js.map +1 -0
  351. package/dist/ts/types.d.ts +3 -0
  352. package/dist/ts/types.d.ts.map +1 -1
  353. package/dist/ts/ui-config.d.ts +29 -13
  354. package/dist/ts/ui-config.d.ts.map +1 -1
  355. package/dist/ts/ui-config.js +14 -3
  356. package/dist/ts/ui-config.js.map +1 -1
  357. package/dist/ts/utils/apply-clash.d.ts +44 -0
  358. package/dist/ts/utils/apply-clash.d.ts.map +1 -0
  359. package/dist/ts/utils/apply-clash.js +102 -0
  360. package/dist/ts/utils/apply-clash.js.map +1 -0
  361. package/dist/ts/utils/mdast-tree.d.ts +5 -7
  362. package/dist/ts/utils/mdast-tree.d.ts.map +1 -1
  363. package/dist/ts/utils/mdast-tree.js +8 -13
  364. package/dist/ts/utils/mdast-tree.js.map +1 -1
  365. package/dist/ts/utils/pageMetadata.d.ts +6 -2
  366. package/dist/ts/utils/pageMetadata.d.ts.map +1 -1
  367. package/dist/ts/utils/pageMetadata.js +25 -7
  368. package/dist/ts/utils/pageMetadata.js.map +1 -1
  369. package/dist/ts/utils/schema-fields.d.ts +2 -0
  370. package/dist/ts/utils/schema-fields.d.ts.map +1 -1
  371. package/dist/ts/utils/schema-fields.js +8 -0
  372. package/dist/ts/utils/schema-fields.js.map +1 -1
  373. package/dist/ts/write-access.d.ts +2 -0
  374. package/dist/ts/write-access.d.ts.map +1 -1
  375. package/dist/ts/write-access.js +9 -4
  376. package/dist/ts/write-access.js.map +1 -1
  377. package/package.json +18 -7
  378. package/src/CmsSpaApp.tsx +20 -11
  379. package/src/components/conflicts/EditorNoticeStrip.tsx +135 -0
  380. package/src/components/conflicts/FieldConflictList.tsx +59 -0
  381. package/src/components/conflicts/FieldConflictPicker.tsx +158 -0
  382. package/src/components/conflicts/OverwriteNotice.tsx +30 -0
  383. package/src/components/conflicts/PageDraftMenu.tsx +51 -0
  384. package/src/components/conflicts/PeerAvatars.tsx +51 -0
  385. package/src/components/conflicts/PuckConflicts.tsx +92 -0
  386. package/src/components/conflicts/RecentVersionsDialog.tsx +154 -0
  387. package/src/components/conflicts/conflict-label.ts +124 -0
  388. package/src/components/conflicts/use-page-conflicts.ts +112 -0
  389. package/src/components/conflicts/version-copy.ts +33 -0
  390. package/src/components/dashboard/RecentActivity.tsx +3 -2
  391. package/src/components/dialogs/CreatePageDialog.tsx +1 -1
  392. package/src/components/dialogs/DataPropertiesDialog.tsx +22 -4
  393. package/src/components/dialogs/FragmentPropertiesDialog.tsx +23 -4
  394. package/src/components/dialogs/PageMetadataDialog.tsx +157 -65
  395. package/src/components/dialogs/UnsavedChangesDialog.tsx +171 -21
  396. package/src/components/dialogs/unsaved-guard.ts +15 -0
  397. package/src/components/editor/CMSMDXEditor.tsx +238 -198
  398. package/src/components/editor/EditorFrame.tsx +116 -0
  399. package/src/components/editor/FragmentBlockTypeSelect.tsx +245 -0
  400. package/src/components/editor/FragmentComponentBlock.tsx +257 -0
  401. package/src/components/editor/FragmentEditor.tsx +899 -213
  402. package/src/components/editor/FragmentEditorHeaderActions.tsx +77 -0
  403. package/src/components/editor/GenericBlock.tsx +127 -16
  404. package/src/components/editor/InlinePreviewFrame.tsx +78 -0
  405. package/src/components/editor/JsxPropsPanel.tsx +90 -6
  406. package/src/components/editor/LocaleSelector.tsx +4 -2
  407. package/src/components/editor/MDXLivePreview.tsx +44 -46
  408. package/src/components/editor/MdxPageEditor.tsx +247 -7
  409. package/src/components/editor/PageEditor.tsx +154 -121
  410. package/src/components/editor/PageEditorHeaderActions.tsx +65 -27
  411. package/src/components/editor/PageEditorWrapper.tsx +122 -45
  412. package/src/components/editor/body-sync-plugin.ts +44 -0
  413. package/src/components/editor/draft-media-config.ts +22 -0
  414. package/src/components/editor/fragment-save-check.ts +26 -0
  415. package/src/components/editor/fragment-save-lifetime.ts +142 -0
  416. package/src/components/editor/host-wrapper-plugin.ts +28 -7
  417. package/src/components/editor/index.ts +0 -1
  418. package/src/components/editor/insert-menu/InsertMdxComponentButton.tsx +7 -11
  419. package/src/components/editor/insert-menu/SlashMenuPlugin.tsx +95 -18
  420. package/src/components/editor/insert-menu/insert-payload.ts +79 -30
  421. package/src/components/editor/insert-menu/mdx-components-plugin.ts +5 -3
  422. package/src/components/editor/jsx-layout-plugin.ts +103 -0
  423. package/src/components/editor/offered-mdx-components.ts +35 -0
  424. package/src/components/editor/page-setting-targets.tsx +2 -0
  425. package/src/components/editor/preview-availability.ts +21 -1
  426. package/src/components/editor/prop-field-hint.ts +75 -0
  427. package/src/components/editor/soft-break-plugin.ts +55 -0
  428. package/src/components/editor/use-live-page-settings.ts +80 -0
  429. package/src/components/editor/usePagePreview.ts +291 -0
  430. package/src/components/editors/DataEditor.tsx +257 -22
  431. package/src/components/fields/MDXEditField.tsx +2 -2
  432. package/src/components/forms/SchemaForm.tsx +1 -10
  433. package/src/components/media/AssetDetailSidebar.tsx +47 -6
  434. package/src/components/pages/DataList.tsx +14 -4
  435. package/src/components/pages/FragmentList.tsx +8 -0
  436. package/src/components/pages/PageList.tsx +90 -337
  437. package/src/components/pages/PageRow.tsx +290 -0
  438. package/src/components/pages/PageTable.tsx +71 -0
  439. package/src/components/pages/page-list-model.ts +98 -0
  440. package/src/components/puck/MDXContent.tsx +37 -113
  441. package/src/components/puck/csp-frame-harness.tsx +99 -0
  442. package/src/components/puck/use-fragment-render.ts +82 -0
  443. package/src/components/sandbox/ContentSandbox.tsx +6 -11
  444. package/src/components/sandbox/frame-runtime.ts +0 -2
  445. package/src/components/toast.tsx +23 -5
  446. package/src/components/ui/Card.tsx +3 -5
  447. package/src/components/ui/Select.tsx +14 -6
  448. package/src/draft-tools.ts +77 -0
  449. package/src/frame/channel.ts +3 -1
  450. package/src/frame/editor-frame.ts +210 -30
  451. package/src/frame/protocol.ts +98 -15
  452. package/src/hooks/useUnsavedChangesGuard.ts +17 -6
  453. package/src/host-style-probe.ts +157 -37
  454. package/src/index.ts +90 -0
  455. package/src/live/data-binding.ts +252 -0
  456. package/src/live/doc-channel.ts +343 -0
  457. package/src/live/held-fragment-edits.ts +47 -0
  458. package/src/live/markdown-binding.ts +630 -0
  459. package/src/live/markdown-live-plugin.tsx +1037 -0
  460. package/src/live/messages.ts +370 -0
  461. package/src/live/puck-binding.tsx +579 -0
  462. package/src/live/undo.ts +112 -0
  463. package/src/live/use-live.ts +264 -0
  464. package/src/main.css +184 -4
  465. package/src/mdx-components-define.ts +170 -24
  466. package/src/mdx-components.ts +29 -30
  467. package/src/media/AssetScopePill.tsx +2 -1
  468. package/src/merge-default-props.ts +4 -0
  469. package/src/selected-block.ts +55 -3
  470. package/src/site-render.ts +146 -0
  471. package/src/types.ts +3 -0
  472. package/src/ui-config.ts +51 -15
  473. package/src/utils/apply-clash.ts +113 -0
  474. package/src/utils/mdast-tree.ts +8 -12
  475. package/src/utils/pageMetadata.ts +25 -7
  476. package/src/utils/schema-fields.ts +9 -0
  477. package/src/write-access.ts +10 -4
  478. package/styles/tailwind-theme.css +11 -0
  479. package/dist/ts/components/editor/ContentDiff.d.ts +0 -10
  480. package/dist/ts/components/editor/ContentDiff.d.ts.map +0 -1
  481. package/dist/ts/components/editor/ContentDiff.js +0 -52
  482. package/dist/ts/components/editor/ContentDiff.js.map +0 -1
  483. package/src/components/editor/ContentDiff.tsx +0 -251
@@ -4,11 +4,11 @@ import {
4
4
  MenuOption,
5
5
  useBasicTypeaheadTriggerMatch,
6
6
  } from '@lexical/react/LexicalTypeaheadMenuPlugin';
7
- import { usePublisher } from '@mdxeditor/editor';
8
- import { useCallback, useContext, useMemo, useState } from 'react';
7
+ import { type ReactNode, useCallback, useContext, useLayoutEffect, useMemo, useRef, useState } from 'react';
9
8
  import { createPortal } from 'react-dom';
10
- import { type MdxComponentDescriptor, useMdxComponents } from '../../../mdx-components.js';
11
- import { dispatchInsert, insertJsx$, insertMarkdown$ } from './insert-payload.js';
9
+ import type { MdxComponentDescriptor } from '../../../mdx-components.js';
10
+ import { useOfferedMdxComponents } from '../offered-mdx-components.js';
11
+ import { dispatchInsert, useInsertPublishers } from './insert-payload.js';
12
12
 
13
13
  class MdxComponentOption extends MenuOption {
14
14
  constructor(public descriptor: MdxComponentDescriptor) {
@@ -51,9 +51,8 @@ export function SlashMenuPlugin() {
51
51
  // to re-render with a populated context.
52
52
  const ctx = useContext(LexicalComposerContext);
53
53
  const editor = ctx?.[0] ?? null;
54
- const allComponents = useMdxComponents();
55
- const publishJsx = usePublisher(insertJsx$);
56
- const publishMarkdown = usePublisher(insertMarkdown$);
54
+ const allComponents = useOfferedMdxComponents();
55
+ const publishers = useInsertPublishers();
57
56
  const [queryString, setQueryString] = useState<string | null>(null);
58
57
 
59
58
  const triggerFn = useBasicTypeaheadTriggerMatch('/', { minLength: 0, maxLength: 32 });
@@ -75,8 +74,12 @@ export function SlashMenuPlugin() {
75
74
  insert: { label: d.name, category: d.kind === 'flow' ? 'Components' : 'Patterns' },
76
75
  },
77
76
  );
78
- const matching = visible.filter((d) => matchesQuery(d, queryString ?? ''));
79
- return matching.map((d) => new MdxComponentOption(d));
77
+ const query = (queryString ?? '').toLowerCase();
78
+ const exact = (d: MdxComponentDescriptor) =>
79
+ query !== '' && (d.name.toLowerCase() === query || d.insert?.label.toLowerCase() === query);
80
+ // An entry named exactly what the author typed goes first; the rest keep the site's order.
81
+ const matching = visible.filter((d) => matchesQuery(d, query));
82
+ return [...matching.filter(exact), ...matching.filter((d) => !exact(d))].map((d) => new MdxComponentOption(d));
80
83
  }, [allComponents, queryString]);
81
84
 
82
85
  const onSelectOption = useCallback(
@@ -85,10 +88,10 @@ export function SlashMenuPlugin() {
85
88
  editor.update(() => {
86
89
  if (nodeToReplace) nodeToReplace.remove();
87
90
  });
88
- dispatchInsert(option.descriptor, { jsx: publishJsx, markdown: publishMarkdown });
91
+ dispatchInsert(option.descriptor, publishers);
89
92
  closeMenu();
90
93
  },
91
- [editor, publishJsx, publishMarkdown],
94
+ [editor, publishers],
92
95
  );
93
96
 
94
97
  if (!editor) return null;
@@ -114,12 +117,7 @@ export function SlashMenuPlugin() {
114
117
  // map to CSS vars the host's Tailwind never generates, so
115
118
  // collisions are impossible by construction.
116
119
  return createPortal(
117
- <div
118
- role="listbox"
119
- className="z-50 min-w-[14rem] max-h-72 overflow-auto rounded-md border border-line bg-panel shadow-md py-1 text-sm text-foreground"
120
- style={{ position: 'absolute', top: '100%', left: 0 }}
121
- data-slash-menu
122
- >
120
+ <SlashMenuList anchor={anchor} optionCount={opts.length}>
123
121
  {opts.map((opt, index) => {
124
122
  const isSelected = selectedIndex === index;
125
123
  return (
@@ -143,10 +141,89 @@ export function SlashMenuPlugin() {
143
141
  </button>
144
142
  );
145
143
  })}
146
- </div>,
144
+ </SlashMenuList>,
147
145
  anchor,
148
146
  );
149
147
  }}
150
148
  />
151
149
  );
152
150
  }
151
+
152
+ /** The tallest the menu gets (Tailwind's `max-h-72`); longer lists scroll inside it. */
153
+ const MENU_MAX_HEIGHT = 288;
154
+ /** Room kept between the menu and the caret, and between the menu and the viewport's edges. */
155
+ const MENU_GAP = 4;
156
+ const VIEWPORT_MARGIN = 8;
157
+
158
+ interface MenuPlacement {
159
+ top?: number;
160
+ bottom?: number;
161
+ left: number;
162
+ maxHeight: number;
163
+ }
164
+
165
+ /**
166
+ * Where the menu fits: under the caret, or above it when there is more room there, never past the editor's viewport.
167
+ * Lexical flips its menu only within the editor's own element, a few lines tall in a component's body, so a menu under
168
+ * a body near the bottom of the screen ran past it.
169
+ */
170
+ function placeMenu(anchor: HTMLElement, menu: HTMLElement): MenuPlacement {
171
+ const doc = anchor.ownerDocument;
172
+ const view = doc.defaultView ?? window;
173
+ const selection = doc.getSelection();
174
+ const range = selection && selection.rangeCount > 0 ? selection.getRangeAt(0).getBoundingClientRect() : null;
175
+ // Lexical's anchor sits a line under the caret; it stands in only when the caret has no box.
176
+ const caret = range && range.height > 0 ? range : anchor.getBoundingClientRect();
177
+ const below = view.innerHeight - caret.bottom - MENU_GAP - VIEWPORT_MARGIN;
178
+ const above = caret.top - MENU_GAP - VIEWPORT_MARGIN;
179
+ const wanted = Math.min(menu.scrollHeight, MENU_MAX_HEIGHT);
180
+ const left = Math.max(VIEWPORT_MARGIN, Math.min(caret.left, view.innerWidth - menu.offsetWidth - VIEWPORT_MARGIN));
181
+ if (below >= wanted || below >= above) {
182
+ return { top: caret.bottom + MENU_GAP, left, maxHeight: Math.min(MENU_MAX_HEIGHT, below) };
183
+ }
184
+ return { bottom: view.innerHeight - caret.top + MENU_GAP, left, maxHeight: Math.min(MENU_MAX_HEIGHT, above) };
185
+ }
186
+
187
+ interface SlashMenuListProps {
188
+ anchor: HTMLElement;
189
+ optionCount: number;
190
+ children: ReactNode;
191
+ }
192
+
193
+ /**
194
+ * The menu, fixed beside the caret and kept there while anything scrolls or the window resizes. It sits in a plain
195
+ * wrapper because Lexical writes the style of its anchor's first child.
196
+ */
197
+ function SlashMenuList({ anchor, optionCount, children }: SlashMenuListProps) {
198
+ const menuRef = useRef<HTMLDivElement>(null);
199
+ const [placement, setPlacement] = useState<MenuPlacement | null>(null);
200
+ // biome-ignore lint/correctness/useExhaustiveDependencies: a different number of options changes the menu's height.
201
+ useLayoutEffect(() => {
202
+ const doc = anchor.ownerDocument;
203
+ const view = doc.defaultView ?? window;
204
+ const place = () => {
205
+ if (menuRef.current) setPlacement(placeMenu(anchor, menuRef.current));
206
+ };
207
+ place();
208
+ view.addEventListener('resize', place);
209
+ doc.addEventListener('scroll', place, { capture: true, passive: true });
210
+ return () => {
211
+ view.removeEventListener('resize', place);
212
+ doc.removeEventListener('scroll', place, { capture: true });
213
+ };
214
+ }, [anchor, optionCount]);
215
+ return (
216
+ <div>
217
+ <div
218
+ ref={menuRef}
219
+ role="listbox"
220
+ className="scrollbar-visible z-50 min-w-[14rem] overflow-auto rounded-md border border-line bg-panel shadow-md py-1 text-sm text-foreground"
221
+ // Hidden at the top left for the first measurement, before the layout effect places it.
222
+ style={{ position: 'fixed', ...(placement ?? { top: 0, left: 0, visibility: 'hidden' }) }}
223
+ data-slash-menu
224
+ >
225
+ {children}
226
+ </div>
227
+ </div>
228
+ );
229
+ }
@@ -1,6 +1,11 @@
1
- import { insertJsx$, insertMarkdown$ } from '@mdxeditor/editor';
2
- import { fromMarkdown } from 'mdast-util-from-markdown';
1
+ import { type JsonValue, parseFragmentMdx } from '@conloca/mdx/render';
2
+ // Import gurx hooks from @mdxeditor/editor, not @mdxeditor/gurx: its re-export is the module instance the editor's
3
+ // realm context comes from.
4
+ import { activeEditor$, insertJsx$, insertMarkdown$, usePublisher, useRealm } from '@mdxeditor/editor';
5
+ import { $getSelection, $isNodeSelection } from 'lexical';
6
+ import type { Root } from 'mdast';
3
7
  import type { MdxJsxFlowElement, MdxJsxTextElement } from 'mdast-util-mdx-jsx';
8
+ import { useMemo } from 'react';
4
9
  import {
5
10
  isJsxDescriptor,
6
11
  isSnippetDescriptor,
@@ -37,28 +42,45 @@ export type InsertJsxPayload =
37
42
  children?: MdxJsxTextElement['children'];
38
43
  };
39
44
 
45
+ /** A default body as a loaded fragment parses it; one the parser refuses inserts the component with an empty body. */
46
+ function parseDefaultBody(name: string, body: string): Root {
47
+ try {
48
+ return parseFragmentMdx(body);
49
+ } catch (error) {
50
+ console.warn(`[insert] ${name}: its default body could not be parsed, inserting it empty.`, error);
51
+ return { type: 'root', children: [] };
52
+ }
53
+ }
54
+
40
55
  /**
41
56
  * Build the payload accepted by @mdxeditor/editor's `insertJsx$` signal.
42
57
  *
43
58
  * Strings round-trip as plain attributes; numbers/booleans become
44
- * expression attributes (`{2}`, `{true}`) because the upstream
45
- * `mdxJsxAttribute.value` shape is either a string or an
46
- * `{ type: 'expression', value: string }` object.
59
+ * expression attributes (`{2}`, `{true}`) and lists/objects JSON
60
+ * expressions, because the upstream `mdxJsxAttribute.value` shape is
61
+ * either a string or an `{ type: 'expression', value: string }` object.
47
62
  *
48
- * `descriptor.defaults.children` is parsed with `mdast-util-from-markdown`
49
- * using only CommonMark — descriptors that need MDX-flavored starter
50
- * content (e.g. nested JSX) should leave `children` undefined and let the
51
- * author build the body via in-place editing.
63
+ * `descriptor.defaults.children` is parsed by `parseFragmentMdx`, the parse
64
+ * the save check reads a fragment with, so component tags in a default
65
+ * become JSX nodes exactly as they would in a loaded fragment.
52
66
  */
53
67
  export function buildInsertPayload(
54
68
  descriptor: MdxJsxComponentDescriptor,
55
- overrides: Record<string, string | number | boolean> = {},
69
+ overrides: Record<string, JsonValue> = {},
56
70
  ): InsertJsxPayload {
57
71
  const merged = { ...(descriptor.defaults?.attributes ?? {}), ...overrides };
58
72
  const props: InsertJsxProps = {};
59
73
  for (const [name, value] of Object.entries(merged)) {
74
+ if (value === null) continue;
60
75
  const propType = descriptor.props?.find((p) => p.name === name)?.type;
61
- if (propType === 'number' || propType === 'boolean' || typeof value === 'number' || typeof value === 'boolean') {
76
+ if (typeof value === 'object' && value !== null) {
77
+ props[name] = { type: 'expression', value: JSON.stringify(value) };
78
+ } else if (
79
+ propType === 'number' ||
80
+ propType === 'boolean' ||
81
+ typeof value === 'number' ||
82
+ typeof value === 'boolean'
83
+ ) {
62
84
  props[name] = { type: 'expression', value: String(value) };
63
85
  } else {
64
86
  props[name] = String(value);
@@ -67,14 +89,14 @@ export function buildInsertPayload(
67
89
 
68
90
  // Parse the optional starter body. The cast on the result narrows the
69
91
  // upstream mdast root's `children` to the flow/text element children types
70
- // the library expects — `fromMarkdown` itself returns a Root whose
71
- // children are block-level, which is the same set as `MdxJsxFlowElement`
72
- // accepts. For text-kind descriptors, callers are responsible for
73
- // providing CommonMark that is phrasing-only (the wildcard cast is
74
- // explicit so the contract is visible at the call site).
92
+ // the library expects — the parsed Root's children are block-level, which
93
+ // is the same set as `MdxJsxFlowElement` accepts. For text-kind
94
+ // descriptors, callers are responsible for providing markdown that is
95
+ // phrasing-only (the wildcard cast is explicit so the contract is visible
96
+ // at the call site).
75
97
  let children: InsertJsxPayload['children'];
76
98
  if (descriptor.hasChildren && descriptor.defaults?.children) {
77
- const root = fromMarkdown(descriptor.defaults.children);
99
+ const root = parseDefaultBody(descriptor.name, descriptor.defaults.children);
78
100
  children = root.children as InsertJsxPayload['children'];
79
101
  }
80
102
 
@@ -104,18 +126,52 @@ export function hasRequiredProps(descriptor: MdxJsxComponentDescriptor): boolean
104
126
  }
105
127
 
106
128
  /**
107
- * Publisher bundle accepted by `dispatchInsert`. The slash menu and the
108
- * toolbar `+` button each call `usePublisher` for both signals up-front
109
- * (hooks can't be conditional) and pass the pair in; the dispatcher then
110
- * routes by descriptor kind. Keeping the two publishers together in one
111
- * value also makes future signal additions a single-line change at the
112
- * call sites.
129
+ * Publisher bundle accepted by `dispatchInsert`, one per insert signal; the
130
+ * dispatcher routes by descriptor kind.
113
131
  */
114
132
  export interface InsertPublishers {
115
133
  jsx: (payload: InsertJsxPayload) => void;
116
134
  markdown: (value: string) => void;
117
135
  }
118
136
 
137
+ /**
138
+ * A caret right after the selected component. An arrow key onto a block component selects the component itself, and
139
+ * MDXEditor inserts only at a caret: `insertJsx$` silently inserts nothing, and `insertMarkdown$` replaces the
140
+ * selected component with the snippet.
141
+ */
142
+ function $caretAfterSelectedComponent(): void {
143
+ const selection = $getSelection();
144
+ if (!$isNodeSelection(selection)) return;
145
+ const nodes = selection.getNodes();
146
+ const last = nodes[nodes.length - 1];
147
+ if (!last) return;
148
+ const after = last.getIndexWithinParent() + 1;
149
+ last.getParentOrThrow().select(after, after);
150
+ }
151
+
152
+ /**
153
+ * The slash menu's and toolbar's publishers. Each insert lands in the editor the author was last in (a component's
154
+ * body is its own editor), at its caret, or right after the component selected there.
155
+ */
156
+ export function useInsertPublishers(): InsertPublishers {
157
+ const realm = useRealm();
158
+ const publishJsx = usePublisher(insertJsx$);
159
+ const publishMarkdown = usePublisher(insertMarkdown$);
160
+ return useMemo<InsertPublishers>(() => {
161
+ const toCaret = () => realm.getValue(activeEditor$)?.update($caretAfterSelectedComponent, { discrete: true });
162
+ return {
163
+ jsx: (payload) => {
164
+ toCaret();
165
+ publishJsx(payload);
166
+ },
167
+ markdown: (value) => {
168
+ toCaret();
169
+ publishMarkdown(value);
170
+ },
171
+ };
172
+ }, [realm, publishJsx, publishMarkdown]);
173
+ }
174
+
119
175
  /**
120
176
  * Insert a descriptor's content into the editor. JSX descriptors go
121
177
  * through `insertJsx$` so they land as a proper Lexical decorator node
@@ -141,10 +197,3 @@ export function dispatchInsert(descriptor: MdxComponentDescriptor, publishers: I
141
197
  const _exhaustive: never = descriptor;
142
198
  void _exhaustive;
143
199
  }
144
-
145
- /**
146
- * Convenience re-export of the upstream signals so call sites don't need
147
- * to import them separately. Keeping both signal references in one module
148
- * also documents which library symbols the insert pipeline depends on.
149
- */
150
- export { insertJsx$, insertMarkdown$ };
@@ -1,14 +1,16 @@
1
- import { addComposerChild$, realmPlugin } from '@mdxeditor/editor';
1
+ import { addComposerChild$, addNestedEditorChild$, realmPlugin } from '@mdxeditor/editor';
2
2
  import { SlashMenuPlugin } from './SlashMenuPlugin.js';
3
3
 
4
4
  /**
5
5
  * Realm plugin that wires the slash menu into @mdxeditor/editor's Lexical
6
6
  * composer tree. The plugin's only job is to publish `SlashMenuPlugin`
7
7
  * (which itself calls `useLexicalComposerContext`) through
8
- * `addComposerChild$` so it mounts inside the editor's composer.
8
+ * `addComposerChild$` so it mounts inside the editor's composer, and through
9
+ * `addNestedEditorChild$` so a component's body (a nested editor) gets its
10
+ * own menu at its own caret.
9
11
  */
10
12
  export const mdxComponentsPlugin = realmPlugin({
11
13
  init(realm) {
12
- realm.pub(addComposerChild$, SlashMenuPlugin);
14
+ realm.pubIn({ [addComposerChild$]: SlashMenuPlugin, [addNestedEditorChild$]: SlashMenuPlugin });
13
15
  },
14
16
  });
@@ -0,0 +1,103 @@
1
+ import { addMdastExtension$, addToMarkdownExtension$, realmPlugin } from '@mdxeditor/editor';
2
+ import { type MdxJsxFlowElement, mdxJsxFromMarkdown, mdxJsxToMarkdown } from 'mdast-util-mdx-jsx';
3
+
4
+ /** How a component block was written in the source. Columns and indents count from the block's opening `<`. */
5
+ interface SourceLayout {
6
+ /** The opening tag as written (the whole block when it closes itself), later lines relative to its `<`. */
7
+ open: string;
8
+ /** The attributes `open` spells, to tell whether it still does. */
9
+ attributes: string;
10
+ openEndLine: number;
11
+ /** Line breaks after the opening tag and before the closing tag, and the children's and closing tag's indents. */
12
+ body?: { openBreaks: number; indent: number; closeBreaks: number; closeIndent: number };
13
+ }
14
+
15
+ declare module 'mdast-util-mdx-jsx' {
16
+ interface MdxJsxFlowElementData {
17
+ /** Absent for blocks made in the editor. */
18
+ sourceLayout?: SourceLayout;
19
+ }
20
+ }
21
+
22
+ const stockExitFlowTag = mdxJsxFromMarkdown().exit?.mdxJsxFlowTag;
23
+ const stockFlowElement = mdxJsxToMarkdown().handlers?.mdxJsxFlowElement;
24
+ if (!stockExitFlowTag || !stockFlowElement) throw new Error('mdast-util-mdx-jsx no longer handles flow elements');
25
+
26
+ // The name too: a renamed block's recorded opening tag would no longer match its closing tag.
27
+ const attributesOf = (element: MdxJsxFlowElement) =>
28
+ JSON.stringify([element.name, element.attributes], (key, value) =>
29
+ key === 'position' || key === 'data' ? undefined : value,
30
+ );
31
+
32
+ /** The stock tag exit, plus the source layout of the block the tag opens or closes. */
33
+ const exitFlowTag: typeof stockExitFlowTag = function (token) {
34
+ const tag = this.data.mdxJsxTag;
35
+ // The tag's text buffer sits on top until the stock exit resumes it.
36
+ const closed = this.stack[this.stack.length - 2];
37
+ stockExitFlowTag.call(this, token);
38
+ if (tag?.close) {
39
+ if (closed?.type !== 'mdxJsxFlowElement') return;
40
+ const layout = closed.data?.sourceLayout;
41
+ const start = closed.position?.start;
42
+ const first = closed.children[0]?.position;
43
+ const last = closed.children[closed.children.length - 1]?.position;
44
+ if (layout && start && first && last) {
45
+ layout.body = {
46
+ openBreaks: first.start.line - layout.openEndLine,
47
+ indent: Math.max(0, first.start.column - start.column),
48
+ closeBreaks: token.start.line - last.end.line,
49
+ closeIndent: Math.max(0, token.start.column - start.column),
50
+ };
51
+ }
52
+ return;
53
+ }
54
+ const top = this.stack[this.stack.length - 1];
55
+ const element = tag?.selfClosing && top && 'children' in top ? top.children[top.children.length - 1] : top;
56
+ if (element?.type !== 'mdxJsxFlowElement') return;
57
+ // Later lines lose the block's own indent, which the parent writes back; each keeps its source line ending.
58
+ const open = this.sliceSerialize(token).replace(
59
+ new RegExp(`(\\r\\n|\\r|\\n) {0,${token.start.column - 1}}`, 'g'),
60
+ '$1',
61
+ );
62
+ element.data = {
63
+ ...element.data,
64
+ sourceLayout: { open, attributes: attributesOf(element), openEndLine: token.end.line },
65
+ };
66
+ };
67
+
68
+ /**
69
+ * Writes a component block the way its source laid it out, where the stock handler indents its children by two spaces
70
+ * per level and drops the blank line before its closing tag. Its children are written as usual, so an edit inside
71
+ * changes only what was edited.
72
+ */
73
+ const flowElement: typeof stockFlowElement = (node: MdxJsxFlowElement, parent, state, info) => {
74
+ const layout = node.data?.sourceLayout;
75
+ // Inside a quote or list item the container indents the block; leave that to the stock handler.
76
+ const contained = state.stack.some((name) => name === 'blockquote' || name === 'listItem');
77
+ const body = layout?.body;
78
+ if (!layout || contained || node.children.length > 0 !== (body !== undefined)) {
79
+ return stockFlowElement(node, parent, state, info);
80
+ }
81
+ const sameAttributes = layout.attributes === attributesOf(node);
82
+ if (!body) return sameAttributes ? layout.open : stockFlowElement(node, parent, state, info);
83
+ // The stock opening tag is the self-closing tag of the block without its children.
84
+ const open = sameAttributes
85
+ ? layout.open
86
+ : stockFlowElement({ ...node, children: [] }, parent, state, info)
87
+ .trimStart()
88
+ .replace(/ ?\/>$/, '>');
89
+ const children = state.indentLines(state.containerFlow(node, info), (line, _, blank) =>
90
+ blank ? '' : ' '.repeat(body.indent) + line,
91
+ );
92
+ return `${open}${'\n'.repeat(body.openBreaks)}${children}${'\n'.repeat(body.closeBreaks)}${' '.repeat(body.closeIndent)}</${node.name ?? ''}>`;
93
+ };
94
+
95
+ /** Saves component blocks in their source layout, so opening and saving a file rewrites none of them. */
96
+ export const jsxLayoutPlugin = realmPlugin({
97
+ init(realm) {
98
+ realm.pubIn({
99
+ [addMdastExtension$]: [{ exit: { mdxJsxFlowTag: exitFlowTag } }],
100
+ [addToMarkdownExtension$]: [{ handlers: { mdxJsxFlowElement: flowElement } }],
101
+ });
102
+ },
103
+ });
@@ -0,0 +1,35 @@
1
+ import type { FragmentVocabulary } from '@conloca/mdx/render';
2
+ import { createContext, useContext, useMemo } from 'react';
3
+ import { isJsxDescriptor, type MdxComponents, useMdxComponents } from '../../mdx-components.js';
4
+ import { useSiteRender } from '../../site-render.js';
5
+
6
+ /** True inside a fragment editor: only the site's fragment vocabulary is offered, rendered by the site's own components. */
7
+ export const FragmentModeContext = createContext(false);
8
+
9
+ /**
10
+ * The components an editor offers. A page gets every descriptor; a fragment gets the snippets and the vocabulary's
11
+ * components, with a plain flow descriptor for each vocabulary component the registry does not describe.
12
+ */
13
+ export function offeredMdxComponents(
14
+ descriptors: MdxComponents,
15
+ vocabulary: FragmentVocabulary | undefined,
16
+ ): MdxComponents {
17
+ if (!vocabulary) return descriptors;
18
+ const names = Object.keys(vocabulary.components);
19
+ const kept = descriptors.filter((d) => !isJsxDescriptor(d) || names.includes(d.name));
20
+ const described = new Set(descriptors.filter(isJsxDescriptor).map((d) => d.name));
21
+ const synthesized = names
22
+ .filter((name) => !described.has(name))
23
+ .map((name) => ({ name, kind: 'flow' as const, hasChildren: true }));
24
+ return [...kept, ...synthesized];
25
+ }
26
+
27
+ export function useOfferedMdxComponents(): MdxComponents {
28
+ const fragment = useContext(FragmentModeContext);
29
+ const descriptors = useMdxComponents();
30
+ const { vocabulary } = useSiteRender();
31
+ return useMemo(
32
+ () => offeredMdxComponents(descriptors, fragment ? vocabulary : undefined),
33
+ [descriptors, fragment, vocabulary],
34
+ );
35
+ }
@@ -1,6 +1,7 @@
1
1
  import { type Overrides, registerOverlayPortal, useGetPuck } from '@puckeditor/core';
2
2
  import { createContext, type ReactNode, useContext, useEffect, useRef, useState } from 'react';
3
3
  import { PAGE_SETTING_ATTRIBUTE } from '../../page-setting-attributes.js';
4
+ import { PageConflictFields } from '../conflicts/PuckConflicts.js';
4
5
 
5
6
  /**
6
7
  * The parts of blocks that show one of the page's settings (marked with
@@ -143,6 +144,7 @@ export const FieldsWithPageSettingsHint: Overrides['fields'] = ({ children, item
143
144
 
144
145
  return (
145
146
  <>
147
+ <PageConflictFields blockId={blockId} />
146
148
  {shows && (
147
149
  <p className="px-4 pt-4 text-xs text-grey-04 dark:text-grey-07">
148
150
  Parts of this block come from Page settings. Click one on the page to edit it.
@@ -18,7 +18,27 @@ export const PREVIEW_UNAVAILABLE_TITLE = 'Preview is not available for this bran
18
18
  * site; it reassures that nothing they did is broken.
19
19
  */
20
20
  export const PREVIEW_UNAVAILABLE_DETAIL =
21
- 'This branch has no preview server, so there is no preview page to open. Your draft is still saved, and publishing and the live site are unaffected.';
21
+ 'Preview is currently unavailable for this branch. Your draft is still saved, and publishing and the live site are unaffected.';
22
22
 
23
23
  /** What the Preview control on a docs (MDX) page says until docs pages render drafts. */
24
24
  export const DOCS_PREVIEW_UNAVAILABLE = "Full-page preview isn't available for docs pages yet";
25
+
26
+ /**
27
+ * The neutral next step when only an unavailable capability is known. A host's refusal carries its own next step,
28
+ * since confirmation or an upgrade may be needed instead. Names no host button: this editor also runs without one.
29
+ */
30
+ export const PREVIEW_UNAVAILABLE_NEXT_STEP = 'Choose Check again to ask the site for the current preview status.';
31
+
32
+ /** The toast action that asks the site again, instead of making the person reload the editor to find out. */
33
+ export const PREVIEW_CHECK_AGAIN = 'Check again';
34
+
35
+ /** The toast action for a failure that is not about the site's setup. */
36
+ export const PREVIEW_TRY_AGAIN = 'Try again';
37
+
38
+ /** The browser refused the preview tab: the site is fine, the browser needs to be told it may open one. */
39
+ export const PREVIEW_BLOCKED_TITLE = 'Your browser blocked the preview tab';
40
+ export const PREVIEW_BLOCKED_DETAIL = 'Allow pop-ups for this site, then try again.';
41
+
42
+ /** A genuine fault, which must not read as though the site is misconfigured. */
43
+ export const PREVIEW_FAILED_TITLE = 'Could not open preview';
44
+ export const PREVIEW_FAILED_DETAIL = 'Something went wrong creating the preview link. Please try again.';
@@ -0,0 +1,75 @@
1
+ import type { JsonValue } from '@conloca/mdx/render';
2
+ import { isJsonValue } from '../../live/messages.js';
3
+ import type { MdxComponentField } from '../../mdx-components.js';
4
+ import type { FieldHint } from '../../page-schemas.js';
5
+
6
+ function unknownField(field: never): never {
7
+ throw new Error(`Unknown prop type ${JSON.stringify(field)}`);
8
+ }
9
+
10
+ /** The `HintForm` control for a descriptor prop, so list and object props get structured fields. */
11
+ export function propFieldHint(prop: MdxComponentField): FieldHint {
12
+ const common = { label: prop.label, help: prop.help };
13
+ switch (prop.type) {
14
+ case 'list':
15
+ return { ...common, control: 'array', of: propFieldHint(prop.of) };
16
+ case 'object':
17
+ return {
18
+ ...common,
19
+ control: 'object',
20
+ fields: Object.fromEntries(Object.entries(prop.fields).map(([key, field]) => [key, propFieldHint(field)])),
21
+ };
22
+ case 'string':
23
+ return prop.options?.length
24
+ ? { ...common, control: 'select', options: prop.options }
25
+ : { ...common, control: 'text' };
26
+ case 'number':
27
+ return { ...common, control: 'number' };
28
+ case 'boolean':
29
+ return { ...common, control: 'switch' };
30
+ default:
31
+ return unknownField(prop);
32
+ }
33
+ }
34
+
35
+ export function emptyFieldValue(field: MdxComponentField): JsonValue {
36
+ switch (field.type) {
37
+ case 'object':
38
+ return {};
39
+ case 'list':
40
+ return [];
41
+ case 'string':
42
+ return '';
43
+ case 'number':
44
+ return 0;
45
+ case 'boolean':
46
+ return false;
47
+ default:
48
+ return unknownField(field);
49
+ }
50
+ }
51
+
52
+ /**
53
+ * The JSON a `HintForm` draft stands for: list items `HintForm`'s Add item leaves `undefined` become
54
+ * the field's empty value, keys a cleared input left `undefined` are dropped, and keys the descriptor
55
+ * does not declare are kept in place, so a no-op edit serializes to the same JSON.
56
+ */
57
+ export function normalizeFieldValue(field: MdxComponentField, value: unknown): JsonValue {
58
+ if (field.type === 'list') {
59
+ return Array.isArray(value)
60
+ ? value.map((item) => (item === undefined ? emptyFieldValue(field.of) : normalizeFieldValue(field.of, item)))
61
+ : [];
62
+ }
63
+ if (field.type === 'object') {
64
+ if (value === null || typeof value !== 'object' || Array.isArray(value)) return {};
65
+ return Object.fromEntries(
66
+ Object.entries(value).flatMap(([key, v]: [string, unknown]): Array<[string, JsonValue]> => {
67
+ if (v === undefined) return [];
68
+ const sub = Object.keys(field.fields).includes(key) ? field.fields[key] : undefined;
69
+ if (sub) return [[key, normalizeFieldValue(sub, v)]];
70
+ return isJsonValue(v) ? [[key, v]] : [];
71
+ }),
72
+ );
73
+ }
74
+ return isJsonValue(value) ? value : emptyFieldValue(field);
75
+ }
@@ -0,0 +1,55 @@
1
+ import { addImportVisitor$, addLexicalNode$, type MdastImportVisitor, realmPlugin } from '@mdxeditor/editor';
2
+ import { $create, $createTextNode, $isElementNode, type EditorConfig, TextNode } from 'lexical';
3
+ import type * as Mdast from 'mdast';
4
+
5
+ /**
6
+ * A source line ending inside a paragraph (a soft break). Its text stays the line ending, so the stock text export
7
+ * writes the paragraph back byte for byte; only its span collapses that ending to a space, the way the published page
8
+ * shows it, where the editable's `pre-wrap` would draw it as a line break.
9
+ */
10
+ export class SoftBreakNode extends TextNode {
11
+ override $config() {
12
+ return this.config('conloca-soft-break', { extends: TextNode });
13
+ }
14
+
15
+ override createDOM(config: EditorConfig): HTMLElement {
16
+ const dom = super.createDOM(config);
17
+ dom.style.whiteSpace = 'normal';
18
+ return dom;
19
+ }
20
+
21
+ // Typing next to the break starts a text node of its own, so typed spaces keep the editable's `pre-wrap`.
22
+ override canInsertTextBefore(): boolean {
23
+ return false;
24
+ }
25
+
26
+ override canInsertTextAfter(): boolean {
27
+ return false;
28
+ }
29
+ }
30
+
31
+ /** Splits a text node at its source line endings, each kept as a {@link SoftBreakNode}. */
32
+ const MdastSoftBreakTextVisitor: MdastImportVisitor<Mdast.Text> = {
33
+ testNode: (node) => node.type === 'text' && /[\r\n]/.test(node.value),
34
+ priority: 10,
35
+ visitNode({ mdastNode, lexicalParent, actions }) {
36
+ // mdast `text` is phrasing content, so its Lexical parent is an element (the stock visitor assumes so too).
37
+ if (!$isElementNode(lexicalParent)) throw new Error(`text inside ${lexicalParent.getType()}`);
38
+ const format = actions.getParentFormatting();
39
+ const style = actions.getParentStyle();
40
+ for (const [index, part] of mdastNode.value.split(/(\r\n|\r|\n)/).entries()) {
41
+ if (part === '') continue;
42
+ const node = index % 2 === 1 ? $create(SoftBreakNode).setTextContent(part) : $createTextNode(part);
43
+ node.setFormat(format);
44
+ if (style !== '') node.setStyle(style);
45
+ lexicalParent.append(node);
46
+ }
47
+ },
48
+ };
49
+
50
+ /** Shows a paragraph's source line endings as the spaces the published page shows. */
51
+ export const softBreakPlugin = realmPlugin({
52
+ init(realm) {
53
+ realm.pubIn({ [addImportVisitor$]: [MdastSoftBreakTextVisitor], [addLexicalNode$]: [SoftBreakNode] });
54
+ },
55
+ });