@conloca/cms-spa 0.1.15 → 0.2.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 (767) hide show
  1. package/README.md +1 -1
  2. package/dist/spa/main.css +4078 -3571
  3. package/dist/ts/App.d.ts +35 -0
  4. package/dist/ts/App.d.ts.map +1 -0
  5. package/dist/ts/App.js +53 -0
  6. package/dist/ts/App.js.map +1 -0
  7. package/dist/ts/CmsSpaApp.d.ts +13 -0
  8. package/dist/ts/CmsSpaApp.d.ts.map +1 -0
  9. package/dist/ts/CmsSpaApp.js +50 -0
  10. package/dist/ts/CmsSpaApp.js.map +1 -0
  11. package/dist/ts/components/CMSDashboard.d.ts +2 -0
  12. package/dist/ts/components/CMSDashboard.d.ts.map +1 -0
  13. package/dist/ts/components/CMSDashboard.js +21 -0
  14. package/dist/ts/components/CMSDashboard.js.map +1 -0
  15. package/dist/ts/components/CMSLayout.d.ts +2 -0
  16. package/dist/ts/components/CMSLayout.d.ts.map +1 -0
  17. package/dist/ts/components/CMSLayout.js +15 -0
  18. package/dist/ts/components/CMSLayout.js.map +1 -0
  19. package/dist/ts/components/ConlocaLogo.d.ts +2 -0
  20. package/dist/ts/components/ConlocaLogo.d.ts.map +1 -0
  21. package/dist/ts/components/ConlocaLogo.js +5 -0
  22. package/dist/ts/components/ConlocaLogo.js.map +1 -0
  23. package/dist/ts/components/GitStatusPanel.d.ts +21 -0
  24. package/dist/ts/components/GitStatusPanel.d.ts.map +1 -0
  25. package/dist/ts/components/GitStatusPanel.js +74 -0
  26. package/dist/ts/components/GitStatusPanel.js.map +1 -0
  27. package/dist/ts/components/MobileTopBar.d.ts +6 -0
  28. package/dist/ts/components/MobileTopBar.d.ts.map +1 -0
  29. package/dist/ts/components/MobileTopBar.js +7 -0
  30. package/dist/ts/components/MobileTopBar.js.map +1 -0
  31. package/dist/ts/components/Sidebar.d.ts +8 -0
  32. package/dist/ts/components/Sidebar.d.ts.map +1 -0
  33. package/dist/ts/components/Sidebar.js +41 -0
  34. package/dist/ts/components/Sidebar.js.map +1 -0
  35. package/dist/ts/components/UserAvatar.d.ts +2 -0
  36. package/dist/ts/components/UserAvatar.d.ts.map +1 -0
  37. package/dist/ts/components/UserAvatar.js +15 -0
  38. package/dist/ts/components/UserAvatar.js.map +1 -0
  39. package/dist/ts/components/cards/DataEntryCard.d.ts +14 -0
  40. package/dist/ts/components/cards/DataEntryCard.d.ts.map +1 -0
  41. package/dist/ts/components/cards/DataEntryCard.js +39 -0
  42. package/dist/ts/components/cards/DataEntryCard.js.map +1 -0
  43. package/dist/ts/components/cards/SectionCard.d.ts +15 -0
  44. package/dist/ts/components/cards/SectionCard.d.ts.map +1 -0
  45. package/dist/ts/components/cards/SectionCard.js +11 -0
  46. package/dist/ts/components/cards/SectionCard.js.map +1 -0
  47. package/dist/ts/components/cards/index.d.ts +2 -0
  48. package/dist/ts/components/cards/index.d.ts.map +1 -0
  49. package/dist/ts/components/cards/index.js +2 -0
  50. package/dist/ts/components/cards/index.js.map +1 -0
  51. package/dist/ts/components/dashboard/RecentActivity.d.ts +2 -0
  52. package/dist/ts/components/dashboard/RecentActivity.d.ts.map +1 -0
  53. package/dist/ts/components/dashboard/RecentActivity.js +58 -0
  54. package/dist/ts/components/dashboard/RecentActivity.js.map +1 -0
  55. package/dist/ts/components/dialog.d.ts +53 -0
  56. package/dist/ts/components/dialog.d.ts.map +1 -0
  57. package/dist/ts/components/dialog.js +57 -0
  58. package/dist/ts/components/dialog.js.map +1 -0
  59. package/dist/ts/components/dialogs/ConflictDialog.d.ts +10 -0
  60. package/dist/ts/components/dialogs/ConflictDialog.d.ts.map +1 -0
  61. package/dist/ts/components/dialogs/ConflictDialog.js +28 -0
  62. package/dist/ts/components/dialogs/ConflictDialog.js.map +1 -0
  63. package/dist/ts/components/dialogs/CreateDataDialog.d.ts +9 -0
  64. package/dist/ts/components/dialogs/CreateDataDialog.d.ts.map +1 -0
  65. package/dist/ts/components/dialogs/CreateDataDialog.js +21 -0
  66. package/dist/ts/components/dialogs/CreateDataDialog.js.map +1 -0
  67. package/dist/ts/components/dialogs/CreateFolderDialog.d.ts +11 -0
  68. package/dist/ts/components/dialogs/CreateFolderDialog.d.ts.map +1 -0
  69. package/dist/ts/components/dialogs/CreateFolderDialog.js +39 -0
  70. package/dist/ts/components/dialogs/CreateFolderDialog.js.map +1 -0
  71. package/dist/ts/components/dialogs/CreatePageDialog.d.ts +11 -0
  72. package/dist/ts/components/dialogs/CreatePageDialog.d.ts.map +1 -0
  73. package/dist/ts/components/dialogs/CreatePageDialog.js +237 -0
  74. package/dist/ts/components/dialogs/CreatePageDialog.js.map +1 -0
  75. package/dist/ts/components/dialogs/DataPropertiesDialog.d.ts +10 -0
  76. package/dist/ts/components/dialogs/DataPropertiesDialog.d.ts.map +1 -0
  77. package/dist/ts/components/dialogs/DataPropertiesDialog.js +39 -0
  78. package/dist/ts/components/dialogs/DataPropertiesDialog.js.map +1 -0
  79. package/dist/ts/components/dialogs/DeleteConfirmDialog.d.ts +12 -0
  80. package/dist/ts/components/dialogs/DeleteConfirmDialog.d.ts.map +1 -0
  81. package/dist/ts/components/dialogs/DeleteConfirmDialog.js +8 -0
  82. package/dist/ts/components/dialogs/DeleteConfirmDialog.js.map +1 -0
  83. package/dist/ts/components/dialogs/ErrorModal.d.ts +14 -0
  84. package/dist/ts/components/dialogs/ErrorModal.d.ts.map +1 -0
  85. package/dist/ts/components/dialogs/ErrorModal.js +43 -0
  86. package/dist/ts/components/dialogs/ErrorModal.js.map +1 -0
  87. package/dist/ts/components/dialogs/FragmentPropertiesDialog.d.ts +12 -0
  88. package/dist/ts/components/dialogs/FragmentPropertiesDialog.d.ts.map +1 -0
  89. package/dist/ts/components/dialogs/FragmentPropertiesDialog.js +43 -0
  90. package/dist/ts/components/dialogs/FragmentPropertiesDialog.js.map +1 -0
  91. package/dist/ts/components/dialogs/MoveFolderDialog.d.ts +12 -0
  92. package/dist/ts/components/dialogs/MoveFolderDialog.d.ts.map +1 -0
  93. package/dist/ts/components/dialogs/MoveFolderDialog.js +69 -0
  94. package/dist/ts/components/dialogs/MoveFolderDialog.js.map +1 -0
  95. package/dist/ts/components/dialogs/PageMetadataDialog.d.ts +31 -0
  96. package/dist/ts/components/dialogs/PageMetadataDialog.d.ts.map +1 -0
  97. package/dist/ts/components/dialogs/PageMetadataDialog.js +154 -0
  98. package/dist/ts/components/dialogs/PageMetadataDialog.js.map +1 -0
  99. package/dist/ts/components/dialogs/UnsavedChangesDialog.d.ts +8 -0
  100. package/dist/ts/components/dialogs/UnsavedChangesDialog.d.ts.map +1 -0
  101. package/dist/ts/components/dialogs/UnsavedChangesDialog.js +7 -0
  102. package/dist/ts/components/dialogs/UnsavedChangesDialog.js.map +1 -0
  103. package/dist/ts/components/dialogs/index.d.ts +9 -0
  104. package/dist/ts/components/dialogs/index.d.ts.map +1 -0
  105. package/dist/ts/components/dialogs/index.js +9 -0
  106. package/dist/ts/components/dialogs/index.js.map +1 -0
  107. package/dist/ts/components/editor/CMSMDXEditor.d.ts +14 -0
  108. package/dist/ts/components/editor/CMSMDXEditor.d.ts.map +1 -0
  109. package/dist/ts/components/editor/CMSMDXEditor.js +209 -0
  110. package/dist/ts/components/editor/CMSMDXEditor.js.map +1 -0
  111. package/dist/ts/components/editor/ContentDiff.d.ts +10 -0
  112. package/dist/ts/components/editor/ContentDiff.d.ts.map +1 -0
  113. package/dist/ts/components/editor/ContentDiff.js +52 -0
  114. package/dist/ts/components/editor/ContentDiff.js.map +1 -0
  115. package/dist/ts/components/editor/CreateFragmentDialog.d.ts +26 -0
  116. package/dist/ts/components/editor/CreateFragmentDialog.d.ts.map +1 -0
  117. package/dist/ts/components/editor/CreateFragmentDialog.js +159 -0
  118. package/dist/ts/components/editor/CreateFragmentDialog.js.map +1 -0
  119. package/dist/ts/components/editor/DrawerItemOverride.d.ts +8 -0
  120. package/dist/ts/components/editor/DrawerItemOverride.d.ts.map +1 -0
  121. package/dist/ts/components/editor/DrawerItemOverride.js +37 -0
  122. package/dist/ts/components/editor/DrawerItemOverride.js.map +1 -0
  123. package/dist/ts/components/editor/EditorChromeToggles.d.ts +16 -0
  124. package/dist/ts/components/editor/EditorChromeToggles.d.ts.map +1 -0
  125. package/dist/ts/components/editor/EditorChromeToggles.js +17 -0
  126. package/dist/ts/components/editor/EditorChromeToggles.js.map +1 -0
  127. package/dist/ts/components/editor/FragmentEditor.d.ts +15 -0
  128. package/dist/ts/components/editor/FragmentEditor.d.ts.map +1 -0
  129. package/dist/ts/components/editor/FragmentEditor.js +322 -0
  130. package/dist/ts/components/editor/FragmentEditor.js.map +1 -0
  131. package/dist/ts/components/editor/FragmentWrappers.d.ts +20 -0
  132. package/dist/ts/components/editor/FragmentWrappers.d.ts.map +1 -0
  133. package/dist/ts/components/editor/FragmentWrappers.js +44 -0
  134. package/dist/ts/components/editor/FragmentWrappers.js.map +1 -0
  135. package/dist/ts/components/editor/GenericBlock.d.ts +3 -0
  136. package/dist/ts/components/editor/GenericBlock.d.ts.map +1 -0
  137. package/dist/ts/components/editor/GenericBlock.js +1124 -0
  138. package/dist/ts/components/editor/GenericBlock.js.map +1 -0
  139. package/dist/ts/components/editor/ImagePickerDialog.d.ts +6 -0
  140. package/dist/ts/components/editor/ImagePickerDialog.d.ts.map +1 -0
  141. package/dist/ts/components/editor/ImagePickerDialog.js +23 -0
  142. package/dist/ts/components/editor/ImagePickerDialog.js.map +1 -0
  143. package/dist/ts/components/editor/JsxPropsPanel.d.ts +16 -0
  144. package/dist/ts/components/editor/JsxPropsPanel.d.ts.map +1 -0
  145. package/dist/ts/components/editor/JsxPropsPanel.js +146 -0
  146. package/dist/ts/components/editor/JsxPropsPanel.js.map +1 -0
  147. package/dist/ts/components/editor/LocaleSelector.d.ts +9 -0
  148. package/dist/ts/components/editor/LocaleSelector.d.ts.map +1 -0
  149. package/dist/ts/components/editor/LocaleSelector.js +14 -0
  150. package/dist/ts/components/editor/LocaleSelector.js.map +1 -0
  151. package/dist/ts/components/editor/MDXLivePreview.d.ts +15 -0
  152. package/dist/ts/components/editor/MDXLivePreview.d.ts.map +1 -0
  153. package/dist/ts/components/editor/MDXLivePreview.js +111 -0
  154. package/dist/ts/components/editor/MDXLivePreview.js.map +1 -0
  155. package/dist/ts/components/editor/MdxPageEditor.d.ts +10 -0
  156. package/dist/ts/components/editor/MdxPageEditor.d.ts.map +1 -0
  157. package/dist/ts/components/editor/MdxPageEditor.js +353 -0
  158. package/dist/ts/components/editor/MdxPageEditor.js.map +1 -0
  159. package/dist/ts/components/editor/PageEditor.d.ts +54 -0
  160. package/dist/ts/components/editor/PageEditor.d.ts.map +1 -0
  161. package/dist/ts/components/editor/PageEditor.js +399 -0
  162. package/dist/ts/components/editor/PageEditor.js.map +1 -0
  163. package/dist/ts/components/editor/PageEditorHeaderActions.d.ts +22 -0
  164. package/dist/ts/components/editor/PageEditorHeaderActions.d.ts.map +1 -0
  165. package/dist/ts/components/editor/PageEditorHeaderActions.js +24 -0
  166. package/dist/ts/components/editor/PageEditorHeaderActions.js.map +1 -0
  167. package/dist/ts/components/editor/PageEditorWrapper.d.ts +38 -0
  168. package/dist/ts/components/editor/PageEditorWrapper.d.ts.map +1 -0
  169. package/dist/ts/components/editor/PageEditorWrapper.js +360 -0
  170. package/dist/ts/components/editor/PageEditorWrapper.js.map +1 -0
  171. package/dist/ts/components/editor/PuckWithUntouchedMetadata.d.ts +5 -0
  172. package/dist/ts/components/editor/PuckWithUntouchedMetadata.d.ts.map +1 -0
  173. package/dist/ts/components/editor/PuckWithUntouchedMetadata.js +53 -0
  174. package/dist/ts/components/editor/PuckWithUntouchedMetadata.js.map +1 -0
  175. package/dist/ts/components/editor/SearchableSelect.d.ts +34 -0
  176. package/dist/ts/components/editor/SearchableSelect.d.ts.map +1 -0
  177. package/dist/ts/components/editor/SearchableSelect.js +116 -0
  178. package/dist/ts/components/editor/SearchableSelect.js.map +1 -0
  179. package/dist/ts/components/editor/host-wrapper-plugin.d.ts +51 -0
  180. package/dist/ts/components/editor/host-wrapper-plugin.d.ts.map +1 -0
  181. package/dist/ts/components/editor/host-wrapper-plugin.js +38 -0
  182. package/dist/ts/components/editor/host-wrapper-plugin.js.map +1 -0
  183. package/dist/ts/components/editor/index.d.ts +9 -0
  184. package/dist/ts/components/editor/index.d.ts.map +1 -0
  185. package/dist/ts/components/editor/index.js +8 -0
  186. package/dist/ts/components/editor/index.js.map +1 -0
  187. package/dist/ts/components/editor/insert-menu/InsertMdxComponentButton.d.ts +15 -0
  188. package/dist/ts/components/editor/insert-menu/InsertMdxComponentButton.d.ts.map +1 -0
  189. package/dist/ts/components/editor/insert-menu/InsertMdxComponentButton.js +91 -0
  190. package/dist/ts/components/editor/insert-menu/InsertMdxComponentButton.js.map +1 -0
  191. package/dist/ts/components/editor/insert-menu/SlashMenuPlugin.d.ts +12 -0
  192. package/dist/ts/components/editor/insert-menu/SlashMenuPlugin.d.ts.map +1 -0
  193. package/dist/ts/components/editor/insert-menu/SlashMenuPlugin.js +107 -0
  194. package/dist/ts/components/editor/insert-menu/SlashMenuPlugin.js.map +1 -0
  195. package/dist/ts/components/editor/insert-menu/insert-payload.d.ts +76 -0
  196. package/dist/ts/components/editor/insert-menu/insert-payload.d.ts.map +1 -0
  197. package/dist/ts/components/editor/insert-menu/insert-payload.js +95 -0
  198. package/dist/ts/components/editor/insert-menu/insert-payload.js.map +1 -0
  199. package/dist/ts/components/editor/insert-menu/mdx-components-plugin.d.ts +8 -0
  200. package/dist/ts/components/editor/insert-menu/mdx-components-plugin.d.ts.map +1 -0
  201. package/dist/ts/components/editor/insert-menu/mdx-components-plugin.js +14 -0
  202. package/dist/ts/components/editor/insert-menu/mdx-components-plugin.js.map +1 -0
  203. package/dist/ts/components/editor/page-setting-targets.d.ts +24 -0
  204. package/dist/ts/components/editor/page-setting-targets.d.ts.map +1 -0
  205. package/dist/ts/components/editor/page-setting-targets.js +124 -0
  206. package/dist/ts/components/editor/page-setting-targets.js.map +1 -0
  207. package/dist/ts/components/editor/preview-availability.d.ts +18 -0
  208. package/dist/ts/components/editor/preview-availability.d.ts.map +1 -0
  209. package/dist/ts/components/editor/preview-availability.js +18 -0
  210. package/dist/ts/components/editor/preview-availability.js.map +1 -0
  211. package/dist/ts/components/editors/DataEditor.d.ts +18 -0
  212. package/dist/ts/components/editors/DataEditor.d.ts.map +1 -0
  213. package/dist/ts/components/editors/DataEditor.js +140 -0
  214. package/dist/ts/components/editors/DataEditor.js.map +1 -0
  215. package/dist/ts/components/fields/ContentFragmentSelectorField.d.ts +14 -0
  216. package/dist/ts/components/fields/ContentFragmentSelectorField.d.ts.map +1 -0
  217. package/dist/ts/components/fields/ContentFragmentSelectorField.js +108 -0
  218. package/dist/ts/components/fields/ContentFragmentSelectorField.js.map +1 -0
  219. package/dist/ts/components/fields/ImageField.d.ts +17 -0
  220. package/dist/ts/components/fields/ImageField.d.ts.map +1 -0
  221. package/dist/ts/components/fields/ImageField.js +39 -0
  222. package/dist/ts/components/fields/ImageField.js.map +1 -0
  223. package/dist/ts/components/fields/MDXEditField.d.ts +17 -0
  224. package/dist/ts/components/fields/MDXEditField.d.ts.map +1 -0
  225. package/dist/ts/components/fields/MDXEditField.js +29 -0
  226. package/dist/ts/components/fields/MDXEditField.js.map +1 -0
  227. package/dist/ts/components/forms/ChipArrayField.d.ts +12 -0
  228. package/dist/ts/components/forms/ChipArrayField.d.ts.map +1 -0
  229. package/dist/ts/components/forms/ChipArrayField.js +39 -0
  230. package/dist/ts/components/forms/ChipArrayField.js.map +1 -0
  231. package/dist/ts/components/forms/HintForm.d.ts +22 -0
  232. package/dist/ts/components/forms/HintForm.d.ts.map +1 -0
  233. package/dist/ts/components/forms/HintForm.js +195 -0
  234. package/dist/ts/components/forms/HintForm.js.map +1 -0
  235. package/dist/ts/components/forms/SchemaForm.d.ts +15 -0
  236. package/dist/ts/components/forms/SchemaForm.d.ts.map +1 -0
  237. package/dist/ts/components/forms/SchemaForm.js +103 -0
  238. package/dist/ts/components/forms/SchemaForm.js.map +1 -0
  239. package/dist/ts/components/index.d.ts +8 -0
  240. package/dist/ts/components/index.d.ts.map +1 -0
  241. package/dist/ts/components/index.js +14 -0
  242. package/dist/ts/components/index.js.map +1 -0
  243. package/dist/ts/components/media/AssetCard.d.ts +14 -0
  244. package/dist/ts/components/media/AssetCard.d.ts.map +1 -0
  245. package/dist/ts/components/media/AssetCard.js +26 -0
  246. package/dist/ts/components/media/AssetCard.js.map +1 -0
  247. package/dist/ts/components/media/AssetDetailSidebar.d.ts +15 -0
  248. package/dist/ts/components/media/AssetDetailSidebar.d.ts.map +1 -0
  249. package/dist/ts/components/media/AssetDetailSidebar.js +122 -0
  250. package/dist/ts/components/media/AssetDetailSidebar.js.map +1 -0
  251. package/dist/ts/components/media/BulkActionBar.d.ts +9 -0
  252. package/dist/ts/components/media/BulkActionBar.d.ts.map +1 -0
  253. package/dist/ts/components/media/BulkActionBar.js +9 -0
  254. package/dist/ts/components/media/BulkActionBar.js.map +1 -0
  255. package/dist/ts/components/media/FolderNav.d.ts +7 -0
  256. package/dist/ts/components/media/FolderNav.d.ts.map +1 -0
  257. package/dist/ts/components/media/FolderNav.js +13 -0
  258. package/dist/ts/components/media/FolderNav.js.map +1 -0
  259. package/dist/ts/components/media/FolderTreeSidebar.d.ts +9 -0
  260. package/dist/ts/components/media/FolderTreeSidebar.d.ts.map +1 -0
  261. package/dist/ts/components/media/FolderTreeSidebar.js +46 -0
  262. package/dist/ts/components/media/FolderTreeSidebar.js.map +1 -0
  263. package/dist/ts/components/media/ImagePicker.d.ts +14 -0
  264. package/dist/ts/components/media/ImagePicker.d.ts.map +1 -0
  265. package/dist/ts/components/media/ImagePicker.js +44 -0
  266. package/dist/ts/components/media/ImagePicker.js.map +1 -0
  267. package/dist/ts/components/media/MediaLibrary.d.ts +31 -0
  268. package/dist/ts/components/media/MediaLibrary.d.ts.map +1 -0
  269. package/dist/ts/components/media/MediaLibrary.js +87 -0
  270. package/dist/ts/components/media/MediaLibrary.js.map +1 -0
  271. package/dist/ts/components/media/MediaToolbar.d.ts +21 -0
  272. package/dist/ts/components/media/MediaToolbar.d.ts.map +1 -0
  273. package/dist/ts/components/media/MediaToolbar.js +7 -0
  274. package/dist/ts/components/media/MediaToolbar.js.map +1 -0
  275. package/dist/ts/components/media/UploadModal.d.ts +9 -0
  276. package/dist/ts/components/media/UploadModal.d.ts.map +1 -0
  277. package/dist/ts/components/media/UploadModal.js +36 -0
  278. package/dist/ts/components/media/UploadModal.js.map +1 -0
  279. package/dist/ts/components/media/index.d.ts +10 -0
  280. package/dist/ts/components/media/index.d.ts.map +1 -0
  281. package/dist/ts/components/media/index.js +10 -0
  282. package/dist/ts/components/media/index.js.map +1 -0
  283. package/dist/ts/components/pages/DataList.d.ts +7 -0
  284. package/dist/ts/components/pages/DataList.d.ts.map +1 -0
  285. package/dist/ts/components/pages/DataList.js +267 -0
  286. package/dist/ts/components/pages/DataList.js.map +1 -0
  287. package/dist/ts/components/pages/FragmentList.d.ts +2 -0
  288. package/dist/ts/components/pages/FragmentList.d.ts.map +1 -0
  289. package/dist/ts/components/pages/FragmentList.js +281 -0
  290. package/dist/ts/components/pages/FragmentList.js.map +1 -0
  291. package/dist/ts/components/pages/MediaPage.d.ts +8 -0
  292. package/dist/ts/components/pages/MediaPage.d.ts.map +1 -0
  293. package/dist/ts/components/pages/MediaPage.js +146 -0
  294. package/dist/ts/components/pages/MediaPage.js.map +1 -0
  295. package/dist/ts/components/pages/PageList.d.ts +7 -0
  296. package/dist/ts/components/pages/PageList.d.ts.map +1 -0
  297. package/dist/ts/components/pages/PageList.js +299 -0
  298. package/dist/ts/components/pages/PageList.js.map +1 -0
  299. package/dist/ts/components/pages/index.d.ts +3 -0
  300. package/dist/ts/components/pages/index.d.ts.map +1 -0
  301. package/dist/ts/components/pages/index.js +3 -0
  302. package/dist/ts/components/pages/index.js.map +1 -0
  303. package/dist/ts/components/puck/MDXContent.d.ts +19 -0
  304. package/dist/ts/components/puck/MDXContent.d.ts.map +1 -0
  305. package/dist/ts/components/puck/MDXContent.js +110 -0
  306. package/dist/ts/components/puck/MDXContent.js.map +1 -0
  307. package/dist/ts/components/puck/index.d.ts +2 -0
  308. package/dist/ts/components/puck/index.d.ts.map +1 -0
  309. package/dist/ts/components/puck/index.js +2 -0
  310. package/dist/ts/components/puck/index.js.map +1 -0
  311. package/dist/ts/components/sandbox/ContentSandbox.d.ts +31 -0
  312. package/dist/ts/components/sandbox/ContentSandbox.d.ts.map +1 -0
  313. package/dist/ts/components/sandbox/ContentSandbox.js +148 -0
  314. package/dist/ts/components/sandbox/ContentSandbox.js.map +1 -0
  315. package/dist/ts/components/sandbox/frame-runtime.d.ts +7 -0
  316. package/dist/ts/components/sandbox/frame-runtime.d.ts.map +1 -0
  317. package/dist/ts/components/sandbox/frame-runtime.js +7 -0
  318. package/dist/ts/components/sandbox/frame-runtime.js.map +1 -0
  319. package/dist/ts/components/toast.d.ts +44 -0
  320. package/dist/ts/components/toast.d.ts.map +1 -0
  321. package/dist/ts/components/toast.js +8 -0
  322. package/dist/ts/components/toast.js.map +1 -0
  323. package/dist/ts/components/ui/Banner.d.ts +76 -0
  324. package/dist/ts/components/ui/Banner.d.ts.map +1 -0
  325. package/dist/ts/components/ui/Banner.js +50 -0
  326. package/dist/ts/components/ui/Banner.js.map +1 -0
  327. package/dist/ts/components/ui/Button.d.ts +25 -0
  328. package/dist/ts/components/ui/Button.d.ts.map +1 -0
  329. package/dist/ts/components/ui/Button.js +34 -0
  330. package/dist/ts/components/ui/Button.js.map +1 -0
  331. package/dist/ts/components/ui/Card.d.ts +72 -0
  332. package/dist/ts/components/ui/Card.d.ts.map +1 -0
  333. package/dist/ts/components/ui/Card.js +50 -0
  334. package/dist/ts/components/ui/Card.js.map +1 -0
  335. package/dist/ts/components/ui/FieldError.d.ts +24 -0
  336. package/dist/ts/components/ui/FieldError.d.ts.map +1 -0
  337. package/dist/ts/components/ui/FieldError.js +18 -0
  338. package/dist/ts/components/ui/FieldError.js.map +1 -0
  339. package/dist/ts/components/ui/IconButton.d.ts +13 -0
  340. package/dist/ts/components/ui/IconButton.d.ts.map +1 -0
  341. package/dist/ts/components/ui/IconButton.js +11 -0
  342. package/dist/ts/components/ui/IconButton.js.map +1 -0
  343. package/dist/ts/components/ui/Input.d.ts +37 -0
  344. package/dist/ts/components/ui/Input.d.ts.map +1 -0
  345. package/dist/ts/components/ui/Input.js +10 -0
  346. package/dist/ts/components/ui/Input.js.map +1 -0
  347. package/dist/ts/components/ui/SaveIndicator.d.ts +8 -0
  348. package/dist/ts/components/ui/SaveIndicator.d.ts.map +1 -0
  349. package/dist/ts/components/ui/SaveIndicator.js +33 -0
  350. package/dist/ts/components/ui/SaveIndicator.js.map +1 -0
  351. package/dist/ts/components/ui/Select.d.ts +8 -0
  352. package/dist/ts/components/ui/Select.d.ts.map +1 -0
  353. package/dist/ts/components/ui/Select.js +10 -0
  354. package/dist/ts/components/ui/Select.js.map +1 -0
  355. package/dist/ts/components/ui/Separator.d.ts +7 -0
  356. package/dist/ts/components/ui/Separator.d.ts.map +1 -0
  357. package/dist/ts/components/ui/Separator.js +9 -0
  358. package/dist/ts/components/ui/Separator.js.map +1 -0
  359. package/dist/ts/components/ui/Textarea.d.ts +8 -0
  360. package/dist/ts/components/ui/Textarea.d.ts.map +1 -0
  361. package/dist/ts/components/ui/Textarea.js +6 -0
  362. package/dist/ts/components/ui/Textarea.js.map +1 -0
  363. package/dist/ts/components/ui/Tooltip.d.ts +9 -0
  364. package/dist/ts/components/ui/Tooltip.d.ts.map +1 -0
  365. package/dist/ts/components/ui/Tooltip.js +6 -0
  366. package/dist/ts/components/ui/Tooltip.js.map +1 -0
  367. package/dist/ts/components/ui/index.d.ts +14 -0
  368. package/dist/ts/components/ui/index.d.ts.map +1 -0
  369. package/dist/ts/components/ui/index.js +18 -0
  370. package/dist/ts/components/ui/index.js.map +1 -0
  371. package/dist/ts/data-schemas.d.ts +36 -0
  372. package/dist/ts/data-schemas.d.ts.map +1 -0
  373. package/dist/ts/data-schemas.js +52 -0
  374. package/dist/ts/data-schemas.js.map +1 -0
  375. package/dist/ts/dev-entry.d.ts +2 -0
  376. package/dist/ts/dev-entry.d.ts.map +1 -0
  377. package/dist/ts/dev-entry.js +23 -0
  378. package/dist/ts/dev-entry.js.map +1 -0
  379. package/dist/ts/editor-flush.d.ts +26 -0
  380. package/dist/ts/editor-flush.d.ts.map +1 -0
  381. package/dist/ts/editor-flush.js +40 -0
  382. package/dist/ts/editor-flush.js.map +1 -0
  383. package/dist/ts/hooks/index.d.ts +10 -0
  384. package/dist/ts/hooks/index.d.ts.map +1 -0
  385. package/dist/ts/hooks/index.js +8 -0
  386. package/dist/ts/hooks/index.js.map +1 -0
  387. package/dist/ts/hooks/useCanvasTheme.d.ts +12 -0
  388. package/dist/ts/hooks/useCanvasTheme.d.ts.map +1 -0
  389. package/dist/ts/hooks/useCanvasTheme.js +34 -0
  390. package/dist/ts/hooks/useCanvasTheme.js.map +1 -0
  391. package/dist/ts/hooks/useClickOutside.d.ts +7 -0
  392. package/dist/ts/hooks/useClickOutside.d.ts.map +1 -0
  393. package/dist/ts/hooks/useClickOutside.js +19 -0
  394. package/dist/ts/hooks/useClickOutside.js.map +1 -0
  395. package/dist/ts/hooks/useDialogState.d.ts +23 -0
  396. package/dist/ts/hooks/useDialogState.d.ts.map +1 -0
  397. package/dist/ts/hooks/useDialogState.js +32 -0
  398. package/dist/ts/hooks/useDialogState.js.map +1 -0
  399. package/dist/ts/hooks/useEditorPref.d.ts +2 -0
  400. package/dist/ts/hooks/useEditorPref.d.ts.map +1 -0
  401. package/dist/ts/hooks/useEditorPref.js +50 -0
  402. package/dist/ts/hooks/useEditorPref.js.map +1 -0
  403. package/dist/ts/hooks/useErrorModal.d.ts +15 -0
  404. package/dist/ts/hooks/useErrorModal.d.ts.map +1 -0
  405. package/dist/ts/hooks/useErrorModal.js +36 -0
  406. package/dist/ts/hooks/useErrorModal.js.map +1 -0
  407. package/dist/ts/hooks/useSiteBaseUrl.d.ts +10 -0
  408. package/dist/ts/hooks/useSiteBaseUrl.d.ts.map +1 -0
  409. package/dist/ts/hooks/useSiteBaseUrl.js +15 -0
  410. package/dist/ts/hooks/useSiteBaseUrl.js.map +1 -0
  411. package/dist/ts/hooks/useTheme.d.ts +12 -0
  412. package/dist/ts/hooks/useTheme.d.ts.map +1 -0
  413. package/dist/ts/hooks/useTheme.js +55 -0
  414. package/dist/ts/hooks/useTheme.js.map +1 -0
  415. package/dist/ts/hooks/useUnsavedChangesGuard.d.ts +16 -0
  416. package/dist/ts/hooks/useUnsavedChangesGuard.d.ts.map +1 -0
  417. package/dist/ts/hooks/useUnsavedChangesGuard.js +30 -0
  418. package/dist/ts/hooks/useUnsavedChangesGuard.js.map +1 -0
  419. package/dist/ts/hooks/useUpload.d.ts +5 -0
  420. package/dist/ts/hooks/useUpload.d.ts.map +1 -0
  421. package/dist/ts/hooks/useUpload.js +15 -0
  422. package/dist/ts/hooks/useUpload.js.map +1 -0
  423. package/dist/ts/hooks/useUploadFlow.d.ts +47 -0
  424. package/dist/ts/hooks/useUploadFlow.d.ts.map +1 -0
  425. package/dist/ts/hooks/useUploadFlow.js +154 -0
  426. package/dist/ts/hooks/useUploadFlow.js.map +1 -0
  427. package/dist/ts/host-discovery.d.ts +40 -0
  428. package/dist/ts/host-discovery.d.ts.map +1 -0
  429. package/dist/ts/host-discovery.js +39 -0
  430. package/dist/ts/host-discovery.js.map +1 -0
  431. package/dist/ts/host-style-probe.d.ts +81 -0
  432. package/dist/ts/host-style-probe.d.ts.map +1 -0
  433. package/dist/ts/host-style-probe.js +638 -0
  434. package/dist/ts/host-style-probe.js.map +1 -0
  435. package/dist/ts/index.d.ts +13 -0
  436. package/dist/ts/index.d.ts.map +1 -0
  437. package/dist/ts/index.js +17 -0
  438. package/dist/ts/index.js.map +1 -0
  439. package/dist/ts/lib/utils.d.ts +13 -0
  440. package/dist/ts/lib/utils.d.ts.map +1 -0
  441. package/dist/ts/lib/utils.js +48 -0
  442. package/dist/ts/lib/utils.js.map +1 -0
  443. package/dist/ts/main-spa.d.ts +8 -0
  444. package/dist/ts/main-spa.d.ts.map +1 -0
  445. package/dist/ts/main-spa.js +58 -0
  446. package/dist/ts/main-spa.js.map +1 -0
  447. package/dist/ts/main.d.ts +2 -0
  448. package/dist/ts/main.d.ts.map +1 -0
  449. package/dist/ts/main.js +16 -0
  450. package/dist/ts/main.js.map +1 -0
  451. package/dist/ts/mdx-components-define.d.ts +185 -0
  452. package/dist/ts/mdx-components-define.d.ts.map +1 -0
  453. package/dist/ts/mdx-components-define.js +140 -0
  454. package/dist/ts/mdx-components-define.js.map +1 -0
  455. package/dist/ts/mdx-components.d.ts +63 -0
  456. package/dist/ts/mdx-components.d.ts.map +1 -0
  457. package/dist/ts/mdx-components.js +129 -0
  458. package/dist/ts/mdx-components.js.map +1 -0
  459. package/dist/ts/media/AssetScopePill.d.ts +30 -0
  460. package/dist/ts/media/AssetScopePill.d.ts.map +1 -0
  461. package/dist/ts/media/AssetScopePill.js +31 -0
  462. package/dist/ts/media/AssetScopePill.js.map +1 -0
  463. package/dist/ts/media/MediaIssueBadge.d.ts +33 -0
  464. package/dist/ts/media/MediaIssueBadge.d.ts.map +1 -0
  465. package/dist/ts/media/MediaIssueBadge.js +55 -0
  466. package/dist/ts/media/MediaIssueBadge.js.map +1 -0
  467. package/dist/ts/media/types.d.ts +108 -0
  468. package/dist/ts/media/types.d.ts.map +1 -0
  469. package/dist/ts/media/types.js +2 -0
  470. package/dist/ts/media/types.js.map +1 -0
  471. package/dist/ts/media/use-asset-scope.d.ts +24 -0
  472. package/dist/ts/media/use-asset-scope.d.ts.map +1 -0
  473. package/dist/ts/media/use-asset-scope.js +57 -0
  474. package/dist/ts/media/use-asset-scope.js.map +1 -0
  475. package/dist/ts/media/use-media-issue.d.ts +24 -0
  476. package/dist/ts/media/use-media-issue.d.ts.map +1 -0
  477. package/dist/ts/media/use-media-issue.js +52 -0
  478. package/dist/ts/media/use-media-issue.js.map +1 -0
  479. package/dist/ts/merge-default-props.d.ts +23 -0
  480. package/dist/ts/merge-default-props.d.ts.map +1 -0
  481. package/dist/ts/merge-default-props.js +51 -0
  482. package/dist/ts/merge-default-props.js.map +1 -0
  483. package/dist/ts/mock-puck-config.d.ts +21 -0
  484. package/dist/ts/mock-puck-config.d.ts.map +1 -0
  485. package/dist/ts/mock-puck-config.js +74 -0
  486. package/dist/ts/mock-puck-config.js.map +1 -0
  487. package/dist/ts/page-schema-define.d.ts +134 -0
  488. package/dist/ts/page-schema-define.d.ts.map +1 -0
  489. package/dist/ts/page-schema-define.js +60 -0
  490. package/dist/ts/page-schema-define.js.map +1 -0
  491. package/dist/ts/page-schemas.d.ts +31 -0
  492. package/dist/ts/page-schemas.d.ts.map +1 -0
  493. package/dist/ts/page-schemas.js +56 -0
  494. package/dist/ts/page-schemas.js.map +1 -0
  495. package/dist/ts/page-setting-attributes.d.ts +27 -0
  496. package/dist/ts/page-setting-attributes.d.ts.map +1 -0
  497. package/dist/ts/page-setting-attributes.js +11 -0
  498. package/dist/ts/page-setting-attributes.js.map +1 -0
  499. package/dist/ts/prose-surface-css.d.ts +92 -0
  500. package/dist/ts/prose-surface-css.d.ts.map +1 -0
  501. package/dist/ts/prose-surface-css.js +349 -0
  502. package/dist/ts/prose-surface-css.js.map +1 -0
  503. package/dist/{puck-config.d.mts → ts/puck-config.d.ts} +11 -14
  504. package/dist/ts/puck-config.d.ts.map +1 -0
  505. package/dist/ts/puck-config.js +51 -0
  506. package/dist/ts/puck-config.js.map +1 -0
  507. package/dist/ts/sandbox-preview-styles.d.ts +63 -0
  508. package/dist/ts/sandbox-preview-styles.d.ts.map +1 -0
  509. package/dist/ts/sandbox-preview-styles.js +169 -0
  510. package/dist/ts/sandbox-preview-styles.js.map +1 -0
  511. package/dist/ts/selected-block.d.ts +61 -0
  512. package/dist/ts/selected-block.d.ts.map +1 -0
  513. package/dist/ts/selected-block.js +65 -0
  514. package/dist/ts/selected-block.js.map +1 -0
  515. package/dist/ts/site-css-layer.d.ts +40 -0
  516. package/dist/ts/site-css-layer.d.ts.map +1 -0
  517. package/dist/ts/site-css-layer.js +110 -0
  518. package/dist/ts/site-css-layer.js.map +1 -0
  519. package/dist/ts/site-styles.d.ts +141 -0
  520. package/dist/ts/site-styles.d.ts.map +1 -0
  521. package/dist/ts/site-styles.js +426 -0
  522. package/dist/ts/site-styles.js.map +1 -0
  523. package/dist/ts/theme.d.ts +46 -0
  524. package/dist/ts/theme.d.ts.map +1 -0
  525. package/dist/ts/theme.js +96 -0
  526. package/dist/ts/theme.js.map +1 -0
  527. package/dist/ts/types.d.ts +58 -0
  528. package/dist/ts/types.d.ts.map +1 -0
  529. package/dist/ts/types.js +2 -0
  530. package/dist/ts/types.js.map +1 -0
  531. package/dist/ts/ui-config.d.ts +249 -0
  532. package/dist/ts/ui-config.d.ts.map +1 -0
  533. package/dist/ts/ui-config.js +142 -0
  534. package/dist/ts/ui-config.js.map +1 -0
  535. package/dist/ts/utils/asset-url.d.ts +9 -0
  536. package/dist/ts/utils/asset-url.d.ts.map +1 -0
  537. package/dist/ts/utils/asset-url.js +19 -0
  538. package/dist/ts/utils/asset-url.js.map +1 -0
  539. package/dist/ts/utils/cn.d.ts +3 -0
  540. package/dist/ts/utils/cn.d.ts.map +1 -0
  541. package/dist/ts/utils/cn.js +6 -0
  542. package/dist/ts/utils/cn.js.map +1 -0
  543. package/dist/ts/utils/content-failure.d.ts +32 -0
  544. package/dist/ts/utils/content-failure.d.ts.map +1 -0
  545. package/dist/ts/utils/content-failure.js +67 -0
  546. package/dist/ts/utils/content-failure.js.map +1 -0
  547. package/dist/ts/utils/entry-meta.d.ts +29 -0
  548. package/dist/ts/utils/entry-meta.d.ts.map +1 -0
  549. package/dist/ts/utils/entry-meta.js +38 -0
  550. package/dist/ts/utils/entry-meta.js.map +1 -0
  551. package/dist/ts/utils/entry-name.d.ts +11 -0
  552. package/dist/ts/utils/entry-name.d.ts.map +1 -0
  553. package/dist/ts/utils/entry-name.js +19 -0
  554. package/dist/ts/utils/entry-name.js.map +1 -0
  555. package/dist/ts/utils/format-date.d.ts +15 -0
  556. package/dist/ts/utils/format-date.d.ts.map +1 -0
  557. package/dist/ts/utils/format-date.js +38 -0
  558. package/dist/ts/utils/format-date.js.map +1 -0
  559. package/dist/ts/utils/mdast-to-html.d.ts +55 -0
  560. package/dist/ts/utils/mdast-to-html.d.ts.map +1 -0
  561. package/dist/ts/utils/mdast-to-html.js +235 -0
  562. package/dist/ts/utils/mdast-to-html.js.map +1 -0
  563. package/dist/ts/utils/mdast-tree.d.ts +104 -0
  564. package/dist/ts/utils/mdast-tree.d.ts.map +1 -0
  565. package/dist/ts/utils/mdast-tree.js +286 -0
  566. package/dist/ts/utils/mdast-tree.js.map +1 -0
  567. package/dist/ts/utils/menu-placement.d.ts +8 -0
  568. package/dist/ts/utils/menu-placement.d.ts.map +1 -0
  569. package/dist/ts/utils/menu-placement.js +10 -0
  570. package/dist/ts/utils/menu-placement.js.map +1 -0
  571. package/dist/ts/utils/pageMetadata.d.ts +80 -0
  572. package/dist/ts/utils/pageMetadata.d.ts.map +1 -0
  573. package/dist/ts/utils/pageMetadata.js +249 -0
  574. package/dist/ts/utils/pageMetadata.js.map +1 -0
  575. package/dist/ts/utils/sanitize-html.d.ts +31 -0
  576. package/dist/ts/utils/sanitize-html.d.ts.map +1 -0
  577. package/dist/ts/utils/sanitize-html.js +84 -0
  578. package/dist/ts/utils/sanitize-html.js.map +1 -0
  579. package/dist/ts/utils/slugify.d.ts +14 -0
  580. package/dist/ts/utils/slugify.d.ts.map +1 -0
  581. package/dist/ts/utils/slugify.js +22 -0
  582. package/dist/ts/utils/slugify.js.map +1 -0
  583. package/dist/ts/utils/zodIntrospect.d.ts +19 -0
  584. package/dist/ts/utils/zodIntrospect.d.ts.map +1 -0
  585. package/dist/ts/utils/zodIntrospect.js +95 -0
  586. package/dist/ts/utils/zodIntrospect.js.map +1 -0
  587. package/dist/ts/write-access.d.ts +48 -0
  588. package/dist/ts/write-access.d.ts.map +1 -0
  589. package/dist/ts/write-access.js +140 -0
  590. package/dist/ts/write-access.js.map +1 -0
  591. package/package.json +217 -57
  592. package/src/App.tsx +78 -0
  593. package/src/CmsSpaApp.tsx +63 -0
  594. package/src/components/CMSDashboard.tsx +118 -0
  595. package/src/components/CMSLayout.tsx +25 -0
  596. package/src/components/ConlocaLogo.tsx +10 -0
  597. package/src/components/GitStatusPanel.tsx +188 -0
  598. package/src/components/MobileTopBar.tsx +22 -0
  599. package/src/components/Sidebar.tsx +146 -0
  600. package/src/components/UserAvatar.tsx +28 -0
  601. package/src/components/cards/DataEntryCard.tsx +163 -0
  602. package/src/components/cards/SectionCard.tsx +103 -0
  603. package/src/components/cards/index.ts +1 -0
  604. package/src/components/dashboard/RecentActivity.tsx +114 -0
  605. package/src/components/dialog.tsx +78 -0
  606. package/src/components/dialogs/ConflictDialog.tsx +139 -0
  607. package/src/components/dialogs/CreateDataDialog.tsx +70 -0
  608. package/src/components/dialogs/CreateFolderDialog.tsx +94 -0
  609. package/src/components/dialogs/CreatePageDialog.tsx +465 -0
  610. package/src/components/dialogs/DataPropertiesDialog.tsx +84 -0
  611. package/src/components/dialogs/DeleteConfirmDialog.tsx +61 -0
  612. package/src/components/dialogs/ErrorModal.tsx +109 -0
  613. package/src/components/dialogs/FragmentPropertiesDialog.tsx +97 -0
  614. package/src/components/dialogs/MoveFolderDialog.tsx +205 -0
  615. package/src/components/dialogs/PageMetadataDialog.tsx +311 -0
  616. package/src/components/dialogs/UnsavedChangesDialog.tsx +43 -0
  617. package/src/components/dialogs/index.ts +8 -0
  618. package/src/components/editor/CMSMDXEditor.tsx +281 -0
  619. package/src/components/editor/ContentDiff.tsx +251 -0
  620. package/src/components/editor/CreateFragmentDialog.tsx +227 -0
  621. package/src/components/editor/DrawerItemOverride.tsx +62 -0
  622. package/src/components/editor/EditorChromeToggles.tsx +35 -0
  623. package/src/components/editor/FragmentEditor.tsx +506 -0
  624. package/src/components/editor/FragmentWrappers.tsx +72 -0
  625. package/src/components/editor/GenericBlock.tsx +1361 -0
  626. package/src/components/editor/ImagePickerDialog.tsx +25 -0
  627. package/src/components/editor/JsxPropsPanel.tsx +293 -0
  628. package/src/components/editor/LocaleSelector.tsx +60 -0
  629. package/src/components/editor/MDXLivePreview.tsx +179 -0
  630. package/src/components/editor/MdxPageEditor.tsx +546 -0
  631. package/src/components/editor/PageEditor.tsx +529 -0
  632. package/src/components/editor/PageEditorHeaderActions.tsx +160 -0
  633. package/src/components/editor/PageEditorWrapper.tsx +502 -0
  634. package/src/components/editor/PuckWithUntouchedMetadata.tsx +65 -0
  635. package/src/components/editor/SearchableSelect.tsx +186 -0
  636. package/src/components/editor/host-wrapper-plugin.ts +91 -0
  637. package/src/components/editor/index.ts +8 -0
  638. package/src/components/editor/insert-menu/InsertMdxComponentButton.tsx +149 -0
  639. package/src/components/editor/insert-menu/SlashMenuPlugin.tsx +152 -0
  640. package/src/components/editor/insert-menu/insert-payload.ts +150 -0
  641. package/src/components/editor/insert-menu/mdx-components-plugin.ts +14 -0
  642. package/src/components/editor/page-setting-targets.tsx +154 -0
  643. package/src/components/editor/preview-availability.ts +20 -0
  644. package/src/components/editors/DataEditor.tsx +270 -0
  645. package/src/components/fields/ContentFragmentSelectorField.tsx +290 -0
  646. package/src/components/fields/ImageField.tsx +75 -0
  647. package/src/components/fields/MDXEditField.tsx +54 -0
  648. package/src/components/forms/ChipArrayField.tsx +81 -0
  649. package/src/components/forms/HintForm.tsx +437 -0
  650. package/src/components/forms/SchemaForm.tsx +307 -0
  651. package/src/components/index.ts +14 -0
  652. package/src/components/media/AssetCard.tsx +84 -0
  653. package/src/components/media/AssetDetailSidebar.tsx +335 -0
  654. package/src/components/media/BulkActionBar.tsx +33 -0
  655. package/src/components/media/FolderNav.tsx +44 -0
  656. package/src/components/media/FolderTreeSidebar.tsx +171 -0
  657. package/src/components/media/ImagePicker.tsx +102 -0
  658. package/src/components/media/MediaLibrary.tsx +183 -0
  659. package/src/components/media/MediaToolbar.tsx +100 -0
  660. package/src/components/media/UploadModal.tsx +266 -0
  661. package/src/components/media/index.ts +9 -0
  662. package/src/components/pages/DataList.tsx +496 -0
  663. package/src/components/pages/FragmentList.tsx +592 -0
  664. package/src/components/pages/MediaPage.tsx +284 -0
  665. package/src/components/pages/PageList.tsx +683 -0
  666. package/src/components/pages/index.ts +2 -0
  667. package/src/components/puck/MDXContent.tsx +199 -0
  668. package/src/components/puck/index.ts +1 -0
  669. package/src/components/sandbox/ContentSandbox.tsx +191 -0
  670. package/src/components/sandbox/frame-runtime.ts +15 -0
  671. package/src/components/toast.tsx +48 -0
  672. package/src/components/ui/Banner.tsx +108 -0
  673. package/src/components/ui/Button.tsx +51 -0
  674. package/src/components/ui/Card.tsx +124 -0
  675. package/src/components/ui/FieldError.tsx +37 -0
  676. package/src/components/ui/IconButton.tsx +40 -0
  677. package/src/components/ui/Input.tsx +66 -0
  678. package/src/components/ui/SaveIndicator.tsx +44 -0
  679. package/src/components/ui/Select.tsx +29 -0
  680. package/src/components/ui/Separator.tsx +14 -0
  681. package/src/components/ui/Textarea.tsx +22 -0
  682. package/src/components/ui/Tooltip.tsx +25 -0
  683. package/src/components/ui/index.ts +18 -0
  684. package/src/data-schemas.ts +82 -0
  685. package/src/dev-entry.tsx +25 -0
  686. package/src/dev.html +36 -0
  687. package/src/editor-flush.ts +47 -0
  688. package/src/hooks/index.ts +22 -0
  689. package/src/hooks/useCanvasTheme.tsx +52 -0
  690. package/src/hooks/useClickOutside.ts +24 -0
  691. package/src/hooks/useDialogState.ts +40 -0
  692. package/src/hooks/useEditorPref.ts +58 -0
  693. package/src/hooks/useErrorModal.tsx +63 -0
  694. package/src/hooks/useSiteBaseUrl.ts +16 -0
  695. package/src/hooks/useTheme.tsx +76 -0
  696. package/src/hooks/useUnsavedChangesGuard.ts +32 -0
  697. package/src/hooks/useUpload.ts +19 -0
  698. package/src/hooks/useUploadFlow.ts +227 -0
  699. package/src/host-discovery.ts +77 -0
  700. package/src/host-style-probe.ts +684 -0
  701. package/src/index.ts +42 -0
  702. package/src/lib/utils.ts +56 -0
  703. package/src/main-spa.tsx +69 -0
  704. package/src/main.css +1095 -0
  705. package/src/main.html +43 -0
  706. package/src/main.tsx +16 -0
  707. package/src/mdx-components-define.ts +296 -0
  708. package/src/mdx-components.ts +154 -0
  709. package/src/media/AssetScopePill.tsx +56 -0
  710. package/src/media/MediaIssueBadge.tsx +86 -0
  711. package/src/media/types.ts +96 -0
  712. package/src/media/use-asset-scope.ts +58 -0
  713. package/src/media/use-media-issue.ts +53 -0
  714. package/src/merge-default-props.ts +58 -0
  715. package/src/mock-puck-config.tsx +115 -0
  716. package/src/page-schema-define.ts +176 -0
  717. package/src/page-schemas.ts +80 -0
  718. package/src/page-setting-attributes.ts +40 -0
  719. package/src/prose-surface-css.ts +359 -0
  720. package/src/puck-config.ts +77 -0
  721. package/src/sandbox-preview-styles.ts +166 -0
  722. package/src/selected-block.ts +121 -0
  723. package/src/site-css-layer.ts +109 -0
  724. package/src/site-styles.ts +524 -0
  725. package/src/theme.ts +102 -0
  726. package/src/types.ts +63 -0
  727. package/src/ui-config.ts +334 -0
  728. package/src/utils/asset-url.ts +22 -0
  729. package/src/utils/cn.ts +6 -0
  730. package/src/utils/content-failure.ts +74 -0
  731. package/src/utils/entry-meta.ts +47 -0
  732. package/src/utils/entry-name.ts +21 -0
  733. package/src/utils/format-date.ts +34 -0
  734. package/src/utils/mdast-to-html.ts +247 -0
  735. package/src/utils/mdast-tree.ts +292 -0
  736. package/src/utils/menu-placement.ts +13 -0
  737. package/src/utils/pageMetadata.ts +285 -0
  738. package/src/utils/sanitize-html.ts +84 -0
  739. package/src/utils/slugify.ts +21 -0
  740. package/src/utils/zodIntrospect.ts +136 -0
  741. package/src/vite-env.d.ts +10 -0
  742. package/src/write-access.ts +147 -0
  743. package/styles/stylesheet.d.ts +6 -0
  744. package/styles/tailwind-theme.css +128 -0
  745. package/dist/data-schemas.d.mts +0 -26
  746. package/dist/data-schemas.d.mts.map +0 -1
  747. package/dist/data-schemas.mjs +0 -52
  748. package/dist/data-schemas.mjs.map +0 -1
  749. package/dist/index.d.mts +0 -125
  750. package/dist/index.d.mts.map +0 -1
  751. package/dist/index.mjs +0 -4
  752. package/dist/main.d.mts +0 -1
  753. package/dist/main.mjs +0 -5687
  754. package/dist/main.mjs.map +0 -1
  755. package/dist/page-schemas.d.mts +0 -26
  756. package/dist/page-schemas.d.mts.map +0 -1
  757. package/dist/page-schemas.mjs +0 -52
  758. package/dist/page-schemas.mjs.map +0 -1
  759. package/dist/puck-C9_F3_cJ.mjs +0 -1589
  760. package/dist/puck-C9_F3_cJ.mjs.map +0 -1
  761. package/dist/puck-config.d.mts.map +0 -1
  762. package/dist/puck-config.mjs +0 -51
  763. package/dist/puck-config.mjs.map +0 -1
  764. package/dist/site-styles.d.mts +0 -41
  765. package/dist/site-styles.d.mts.map +0 -1
  766. package/dist/site-styles.mjs +0 -52
  767. package/dist/site-styles.mjs.map +0 -1
@@ -0,0 +1,1124 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { NestedLexicalEditor, useLexicalNodeRemove, useMdastNodeUpdater, useNestedEditorContext, } from '@mdxeditor/editor';
3
+ import { $getNodeByKey } from 'lexical';
4
+ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
5
+ import { createPortal } from 'react-dom';
6
+ import { containsMarkdownMarkers, isJsxDescriptor, useMdxComponents, writeAttribute, } from '../../mdx-components.js';
7
+ import { useSandboxPreviewStyles } from '../../sandbox-preview-styles.js';
8
+ import { getSelectedBlock, setSelectedBlock, useSelectedBlock } from '../../selected-block.js';
9
+ import { bodyNeedsStaticHtml, isHtmlTag, mdastToHtml } from '../../utils/mdast-to-html.js';
10
+ import { effectiveChildren, getMdastAtPath, getNamedSlotName, readAttrs, removeMdastNodeAtPath, replaceMdastAtPath, replaceMdastNodeAtPath, slotIdToPath, stripBodyFields, } from '../../utils/mdast-tree.js';
11
+ import { sanitizeComponentHtml, sanitizeHtml } from '../../utils/sanitize-html.js';
12
+ import { ContentSandbox } from '../sandbox/ContentSandbox.js';
13
+ const SLOT_TAG = 'conloca-slot';
14
+ const RENDER_ENDPOINT = '/__cms/api/render';
15
+ /**
16
+ * Find string-prop values inside the SSR'd preview and make their rendering
17
+ * element directly editable. The author types in place; on blur the new
18
+ * value flows back through `onPropChange`, which routes through the same
19
+ * mdast updater the side panel uses — so a LinkCard's `description` can
20
+ * be edited inline OR in the side panel, both update the same source.
21
+ *
22
+ * Resolution is a conservative text-match heuristic: only leaf elements
23
+ * (no element children) whose `textContent.trim()` equals the prop value
24
+ * qualify, AND the match must be unique. If two elements happen to render
25
+ * the same string, or the value is too short to disambiguate (<3 chars),
26
+ * the prop falls back to side-panel-only editing. This avoids accidentally
27
+ * binding the wrong element when a value like "tip" coincides with body
28
+ * text or a CSS class.
29
+ *
30
+ * Commits land on blur (or Enter), not on keystroke — committing per-key
31
+ * would refire the render endpoint on every character and lose focus
32
+ * each time the new HTML replaces the wrapper.
33
+ *
34
+ * No registry opt-in for now; the uniqueness + length guards make the
35
+ * heuristic safe enough that "automatically inline-editable for components
36
+ * where it makes sense" matches the zero-config goal of the broader
37
+ * registry work.
38
+ */
39
+ function wireInlinePropEditors(wrap, attrs, onPropChange) {
40
+ for (const [propName, rawValue] of Object.entries(attrs)) {
41
+ if (typeof rawValue !== 'string')
42
+ continue;
43
+ const value = rawValue.trim();
44
+ if (value.length < 3)
45
+ continue;
46
+ // Skip markdown-bearing values. A `plaintext-only` contenteditable
47
+ // strips `**bold**` / inline code / link syntax on commit, so we
48
+ // route these props through the side panel instead. The author sees
49
+ // the raw string there and decides whether to keep the formatting.
50
+ // Conservative detection (see `containsMarkdownMarkers`) — false
51
+ // positive cost is "edit via panel" which is fine; false negative
52
+ // cost is silent formatting loss, which isn't.
53
+ if (containsMarkdownMarkers(value))
54
+ continue;
55
+ // Two parallel walks, combined for uniqueness. The element walk
56
+ // catches "value lives in a leaf span" cases (LinkCard's
57
+ // `<span class="description">`); the text-node walk catches "value
58
+ // is a text node sibling of an icon" cases (Aside's title sits
59
+ // inside `<p class="starlight-aside__title">` right next to an SVG).
60
+ // Total matches across both walks must equal 1 — otherwise we can't
61
+ // unambiguously bind the prop to a single rendering location and
62
+ // fall back to side-panel-only editing.
63
+ const elementMatches = [];
64
+ for (const el of Array.from(wrap.querySelectorAll('*'))) {
65
+ // Leaf-only — skip elements with element children, otherwise we'd
66
+ // turn an entire `<a class="sl-link-card">` into a contenteditable.
67
+ if (el.children.length > 0)
68
+ continue;
69
+ // Skip already-wired editors so re-renders don't double-bind.
70
+ if (el.hasAttribute('data-conloca-prop'))
71
+ continue;
72
+ if ((el.textContent ?? '').trim() === value)
73
+ elementMatches.push(el);
74
+ }
75
+ const textMatches = [];
76
+ const walker = wrap.ownerDocument.createTreeWalker(wrap, NodeFilter.SHOW_TEXT);
77
+ let textNode = walker.nextNode();
78
+ while (textNode) {
79
+ const t = textNode;
80
+ const parent = t.parentElement;
81
+ // A text node wholly contained by a leaf element is already
82
+ // represented by `elementMatches`; only consider mixed-content
83
+ // parents that have not already been wired.
84
+ if (parent &&
85
+ parent.children.length > 0 &&
86
+ !parent.closest('[data-conloca-prop]') &&
87
+ (t.nodeValue ?? '').trim() === value) {
88
+ textMatches.push(t);
89
+ }
90
+ textNode = walker.nextNode();
91
+ }
92
+ if (elementMatches.length + textMatches.length !== 1)
93
+ continue;
94
+ // Resolve the actual target element. For text-node matches we wrap
95
+ // the value in a fresh span so we have something to attach
96
+ // contenteditable to. Surrounding whitespace stays as plain text
97
+ // nodes either side of the span, so the icon→text spacing the host
98
+ // designed for is preserved.
99
+ let target;
100
+ if (elementMatches.length === 1) {
101
+ target = elementMatches[0];
102
+ }
103
+ else {
104
+ const t = textMatches[0];
105
+ const original = t.nodeValue ?? '';
106
+ const idx = original.indexOf(value);
107
+ const before = idx > 0 ? original.slice(0, idx) : '';
108
+ const after = idx + value.length < original.length ? original.slice(idx + value.length) : '';
109
+ const span = wrap.ownerDocument.createElement('span');
110
+ span.textContent = value;
111
+ const parent = t.parentNode;
112
+ if (before)
113
+ parent.insertBefore(wrap.ownerDocument.createTextNode(before), t);
114
+ parent.insertBefore(span, t);
115
+ if (after)
116
+ parent.insertBefore(wrap.ownerDocument.createTextNode(after), t);
117
+ parent.removeChild(t);
118
+ target = span;
119
+ }
120
+ bindInlinePropEditor(target, propName, onPropChange);
121
+ }
122
+ }
123
+ /**
124
+ * Attach the inline-prop event listeners to a target element. Pulled
125
+ * out of `wireInlinePropEditors` so both the selector-driven path
126
+ * (defaults like Aside's auto-derived "Note" title) and the text-match
127
+ * path (explicit prop values that render as visible text) share the
128
+ * same wiring code — contenteditable attribute, focus override against
129
+ * stretched-link anchors, Enter/Escape semantics, and the blur commit
130
+ * that flows back through `onPropChange`.
131
+ */
132
+ function bindInlinePropEditor(target, propName, onPropChange) {
133
+ // `plaintext-only` keeps the contenteditable from accepting rich
134
+ // formatting (bold, italic, pasted markup). String props are flat
135
+ // text — bolding inside one would silently lose the styling on
136
+ // save anyway, so the affordance shouldn't suggest otherwise.
137
+ target.setAttribute('contenteditable', 'plaintext-only');
138
+ target.setAttribute('data-conloca-prop', propName);
139
+ target.setAttribute('spellcheck', 'true');
140
+ // Small visual cue so the author can tell which inline regions
141
+ // accept editing. Faint outline-color on hover, no layout shift.
142
+ target.classList.add('conloca-inline-prop');
143
+ let committed = (target.textContent ?? '').trim();
144
+ const commit = () => {
145
+ const next = (target.textContent ?? '').trim();
146
+ if (next !== committed) {
147
+ committed = next;
148
+ onPropChange(propName, next);
149
+ }
150
+ };
151
+ target.addEventListener('blur', commit);
152
+ target.addEventListener('keydown', (e) => {
153
+ // Enter commits (string props are single-line); Escape reverts.
154
+ if (e.key === 'Enter') {
155
+ e.preventDefault();
156
+ target.blur();
157
+ }
158
+ else if (e.key === 'Escape') {
159
+ e.preventDefault();
160
+ target.textContent = committed;
161
+ target.blur();
162
+ }
163
+ });
164
+ // Anchor-parent focus override. When the inline-editable element sits
165
+ // inside a clickable anchor (Starlight's `<LinkCard>` wraps title +
166
+ // description in a single `<a>`), the browser's default mousedown
167
+ // focuses the anchor, not our contenteditable child. Override by
168
+ // calling preventDefault() to stop the anchor's default focus, then
169
+ // explicitly focus the contenteditable and place the caret at the
170
+ // click point. `stopPropagation` is intentionally NOT used — the
171
+ // parent block's mousedownCapture still needs to fire so the side
172
+ // panel updates with this block's props.
173
+ target.addEventListener('mousedown', (e) => {
174
+ e.preventDefault();
175
+ target.focus();
176
+ // `caretPositionFromPoint` is the spec API; WebKit/older Chromium
177
+ // ship `caretRangeFromPoint` instead. Try both, fall back to the
178
+ // end of the text if neither works.
179
+ const doc = target.ownerDocument;
180
+ let range = null;
181
+ const cp = doc.caretPositionFromPoint;
182
+ if (cp) {
183
+ const pos = cp.call(doc, e.clientX, e.clientY);
184
+ if (pos) {
185
+ range = doc.createRange();
186
+ range.setStart(pos.offsetNode, pos.offset);
187
+ range.collapse(true);
188
+ }
189
+ }
190
+ else if (doc.caretRangeFromPoint) {
191
+ range = doc.caretRangeFromPoint(e.clientX, e.clientY);
192
+ }
193
+ if (!range) {
194
+ range = doc.createRange();
195
+ range.selectNodeContents(target);
196
+ range.collapse(false);
197
+ }
198
+ const sel = doc.defaultView?.getSelection();
199
+ if (sel) {
200
+ sel.removeAllRanges();
201
+ sel.addRange(range);
202
+ }
203
+ });
204
+ }
205
+ /**
206
+ * Activate the tab the author clicked on inside an SSR'd `<starlight-tabs>`
207
+ * preview. Mirrors what `<starlight-tabs>`'s connectedCallback does at
208
+ * runtime on the published page — toggling `aria-selected` on the trigger
209
+ * and the `hidden` attribute on the matching panel — but runs purely off
210
+ * the DOM we already SSR'd, so the editor doesn't need to load the host's
211
+ * tab script.
212
+ *
213
+ * Starlight's tab markup ([starlight-tabs] > [role=tablist] > a[role=tab]
214
+ * with `href="#tab-panel-N"`, and `<section role="tabpanel" id="...">`
215
+ * siblings of the tablist) is stable enough that this resolves by
216
+ * traversing roles + the href hash. If Starlight ever ships a different
217
+ * variant the resolution falls back to no-op, which is the same as the
218
+ * pre-fix behaviour.
219
+ */
220
+ function activateTabInPlace(tab) {
221
+ const tablist = tab.closest('[role="tablist"]');
222
+ // The panels live as siblings of the tablist inside the same custom
223
+ // element (or inside a generic ancestor if Starlight changes shape).
224
+ const tabsRoot = tab.closest('starlight-tabs') ?? tablist?.parentElement ?? null;
225
+ if (!tablist || !tabsRoot)
226
+ return;
227
+ // Deselect every trigger in this tablist; tabindex=-1 keeps keyboard
228
+ // focus order matching Starlight's runtime behaviour.
229
+ for (const t of tablist.querySelectorAll('[role="tab"]')) {
230
+ t.setAttribute('aria-selected', 'false');
231
+ t.setAttribute('tabindex', '-1');
232
+ }
233
+ tab.setAttribute('aria-selected', 'true');
234
+ tab.setAttribute('tabindex', '0');
235
+ // Resolve target panel via the trigger's `href="#id"`. Falls back to
236
+ // positional match if href is missing — covers future Starlight shapes
237
+ // that wire via aria-controls or index.
238
+ const href = tab.getAttribute('href') || '';
239
+ const targetId = href.startsWith('#') ? href.slice(1) : '';
240
+ const panels = Array.from(tabsRoot.querySelectorAll('[role="tabpanel"]'));
241
+ let activeIndex = -1;
242
+ if (targetId) {
243
+ activeIndex = panels.findIndex((p) => p.id === targetId);
244
+ }
245
+ if (activeIndex < 0) {
246
+ const triggers = Array.from(tablist.querySelectorAll('[role="tab"]'));
247
+ activeIndex = triggers.indexOf(tab);
248
+ }
249
+ panels.forEach((p, i) => {
250
+ if (i === activeIndex)
251
+ p.removeAttribute('hidden');
252
+ else
253
+ p.setAttribute('hidden', '');
254
+ });
255
+ }
256
+ /**
257
+ * In-memory cache of rendered HTML keyed by the full tree shape +
258
+ * document index. Same edit state reuses cached HTML without a server
259
+ * roundtrip. Cleared on page reload.
260
+ */
261
+ const renderCache = new Map();
262
+ function cacheKey(req) {
263
+ return `${req.documentIndex}::${req.inline ? 'inline::' : ''}${stableStringify(stripBodyFields(req.tree))}`;
264
+ }
265
+ function stableStringify(obj) {
266
+ // Stable across key order so attribute reordering doesn't bust the cache.
267
+ // For nested objects/arrays (children trees) JSON.stringify already
268
+ // preserves array order which is what we want.
269
+ const sort = (v) => {
270
+ if (Array.isArray(v))
271
+ return v.map(sort);
272
+ if (v && typeof v === 'object') {
273
+ const keys = Object.keys(v).sort();
274
+ return Object.fromEntries(keys.map((k) => [k, sort(v[k])]));
275
+ }
276
+ return v;
277
+ };
278
+ return JSON.stringify(sort(obj));
279
+ }
280
+ async function fetchRendered(req) {
281
+ const key = cacheKey(req);
282
+ const cached = renderCache.get(key);
283
+ if (cached !== undefined)
284
+ return cached;
285
+ const res = await fetch(RENDER_ENDPOINT, {
286
+ method: 'POST',
287
+ headers: { 'content-type': 'application/json' },
288
+ body: JSON.stringify(req),
289
+ });
290
+ if (!res.ok)
291
+ throw new Error(`Render endpoint returned ${res.status}: ${await res.text()}`);
292
+ const html = await res.text();
293
+ renderCache.set(key, html);
294
+ return html;
295
+ }
296
+ /**
297
+ * Given a child slot element inside a container's SSR'd preview,
298
+ * return the DOM subtree that belongs to ONLY this child. Used to
299
+ * bound the inline-prop scan so we don't accidentally match a
300
+ * sibling child's title.
301
+ *
302
+ * Heuristic: walk up from the slot. Each ancestor is a candidate.
303
+ * We keep walking as long as the parent of the ancestor contains
304
+ * exactly one slot-with-data-slot-id descendant (this slot). The
305
+ * moment we'd step into an ancestor whose subtree contains MORE
306
+ * than one slot — that's the boundary between children — we stop
307
+ * and return the last single-slot ancestor.
308
+ *
309
+ * For Starlight CardGrid the result is the `<article class="card">`
310
+ * for each child. For a future framework that wraps each child
311
+ * differently the same logic applies — we don't care about the
312
+ * specific class names.
313
+ *
314
+ * Returns `null` if the slot isn't actually inside a container with
315
+ * sibling slots (eg edge cases where the framework only emits one
316
+ * child). The caller falls back to wiring against the whole wrapper.
317
+ */
318
+ function findChildRegion(slot) {
319
+ let region = slot;
320
+ let parent = slot.parentElement;
321
+ while (parent) {
322
+ const slotCount = parent.querySelectorAll(`${SLOT_TAG}[data-slot-id]`).length;
323
+ if (slotCount > 1) {
324
+ // Parent encloses more than one child — region is the current
325
+ // node (before stepping into the multi-child container).
326
+ return region === slot ? null : region;
327
+ }
328
+ region = parent;
329
+ parent = parent.parentElement;
330
+ }
331
+ return region === slot ? null : region;
332
+ }
333
+ /**
334
+ * Find the first mdast `list` node inside a component's effective
335
+ * children. Returns both the list and the path that `getMdastAtPath`
336
+ * would walk to reach it. `null` when no list is present at the top
337
+ * level — eg a regular Aside body where children are paragraphs.
338
+ *
339
+ * Handles two common shapes:
340
+ * 1. `{ name: 'Steps', children: [list] }` — path: `[0]`
341
+ * 2. `{ name: 'Steps', children: [{paragraph, children:[list]}] }`
342
+ * — `effectiveChildren` unwraps the single-paragraph wrapper, so
343
+ * the list is still reached at path `[0]`.
344
+ *
345
+ * Restricted to "first child is a list" because that's the strict-
346
+ * slot list pattern (Steps, FileTree). A Card body that happens to
347
+ * contain a list as a non-leading child stays in the regular slot
348
+ * path — those have a real `<conloca-slot>` from the server already.
349
+ */
350
+ function findTopLevelList(node) {
351
+ const effective = effectiveChildren(node);
352
+ if (effective.length === 0)
353
+ return null;
354
+ const first = effective[0];
355
+ if (first?.type !== 'list' || !Array.isArray(first.children))
356
+ return null;
357
+ return { list: first, path: [0] };
358
+ }
359
+ /**
360
+ * Wire each `<li>` of the first ordered/unordered list in the
361
+ * rendered preview as a contenteditable, with on-blur commit that
362
+ * rewrites the corresponding mdast `listItem`. Used for strict-slot
363
+ * list components (Starlight `<Steps>`, `<FileTree>`) where the
364
+ * framework rejects `<conloca-slot>` children — we can't portal a
365
+ * Lexical editor into them, so we edit the rendered HTML in place.
366
+ *
367
+ * Trade-off vs the portal path: this loses any inline formatting on
368
+ * commit (the blur handler reads `textContent` and rewrites the item
369
+ * as plain text). The rendered output keeps whatever formatting the
370
+ * framework SSR'd (bold survives across renders that don't touch the
371
+ * item), but typing in a step replaces its content with plaintext.
372
+ * For step descriptions and file-tree labels that's usually fine; for
373
+ * heavily-formatted lists the user has to edit through markdown.
374
+ *
375
+ * DOM mutation safety: we DO NOT replace the li's children or inject
376
+ * anything React might reconcile against. Just set `contenteditable`
377
+ * on the existing element and attach listeners. The next render's
378
+ * `wrap.innerHTML = sanitizeComponentHtml(html)` wipes the contenteditable cleanly.
379
+ */
380
+ function wireListItemEditors(wrap, node, updater, pendingFocusIndexRef) {
381
+ const found = findTopLevelList(node);
382
+ if (!found)
383
+ return;
384
+ const domList = wrap.querySelector('ol, ul');
385
+ if (!domList)
386
+ return;
387
+ const domItems = Array.from(domList.children).filter((c) => c.tagName === 'LI');
388
+ if (domItems.length !== found.list.children.length)
389
+ return;
390
+ // Default-deny tree-shaped lists. A flat plaintext editor over an
391
+ // `<li>` that contains a nested `<ul>`/`<ol>` would collapse the
392
+ // sub-tree into a single text node on commit. FileTree is the
393
+ // canonical case, but the same trap applies to any nav-menu /
394
+ // outline / nested-list component. The side panel still works;
395
+ // authors who need to restructure the tree edit the raw MDX.
396
+ // Future: a proper tree-aware editor can ship as a follow-up that
397
+ // handles recursive wiring, path-scoped writes, and add/remove
398
+ // affordances for sub-items.
399
+ if (domItems.some((li) => li.querySelector('ul, ol') !== null))
400
+ return;
401
+ const listOrdered = found.list.ordered ?? false;
402
+ /**
403
+ * Shared helper that writes a new list of items back through the
404
+ * mdast updater, preserving the paragraph-wrap shape if any. All
405
+ * commit / insert / remove paths funnel through this so the
406
+ * write-side logic stays in one place.
407
+ */
408
+ const writeListChildren = (newListChildren) => {
409
+ const newList = { type: 'list', ordered: listOrdered, children: newListChildren };
410
+ const originalKids = (node.children ?? []);
411
+ const isWrapped = originalKids.length === 1 && originalKids[0]?.type === 'paragraph';
412
+ const newChildren = isWrapped ? [{ ...originalKids[0], children: [newList] }] : [newList];
413
+ updater({ children: newChildren });
414
+ };
415
+ const buildListItem = (text) => ({
416
+ type: 'listItem',
417
+ children: [{ type: 'paragraph', children: [{ type: 'text', value: text }] }],
418
+ });
419
+ for (let i = 0; i < domItems.length; i++) {
420
+ const li = domItems[i];
421
+ // Skip already-wired editors so re-renders don't double-bind.
422
+ if (li.hasAttribute('data-conloca-listitem'))
423
+ continue;
424
+ li.setAttribute('data-conloca-listitem', String(i));
425
+ li.setAttribute('contenteditable', 'plaintext-only');
426
+ li.classList.add('conloca-listitem');
427
+ let committed = (li.textContent ?? '').trim();
428
+ const itemIndex = i;
429
+ const commit = () => {
430
+ const next = (li.textContent ?? '').trim();
431
+ if (next === committed)
432
+ return;
433
+ committed = next;
434
+ // Build a fresh listItem with a single paragraph of plain text.
435
+ // Future enhancement: parse inline markdown so `**bold**` round-
436
+ // trips correctly. For now, plaintext-only matches the editing
437
+ // affordance authors see (no formatting toolbar in the li).
438
+ const newListChildren = found.list.children.map((it, idx) => (idx === itemIndex ? buildListItem(next) : it));
439
+ writeListChildren(newListChildren);
440
+ };
441
+ /**
442
+ * Insert an empty list item BELOW this one and ask the next
443
+ * render to focus the new li. The render cycle is:
444
+ * 1. writeListChildren → mdast updates → React re-renders
445
+ * 2. html-injection effect runs `wrap.innerHTML = sanitizeComponentHtml(html)`
446
+ * 3. wireListItemEditors runs again; it sees the pending
447
+ * focus index and focuses that li.
448
+ * The ref decouples the focus request from the render — we
449
+ * can't focus the new li synchronously because it doesn't
450
+ * exist in the DOM yet.
451
+ */
452
+ const insertItemBelow = () => {
453
+ // Commit current text first so we don't lose any unsaved
454
+ // typing in this li. `commit` is a no-op if nothing changed.
455
+ const currentText = (li.textContent ?? '').trim();
456
+ const updatedCurrent = buildListItem(currentText);
457
+ const newListChildren = [
458
+ ...found.list.children.slice(0, itemIndex),
459
+ updatedCurrent,
460
+ buildListItem(''),
461
+ ...found.list.children.slice(itemIndex + 1),
462
+ ];
463
+ pendingFocusIndexRef.current = itemIndex + 1;
464
+ writeListChildren(newListChildren);
465
+ };
466
+ /**
467
+ * Remove this list item from the list. Used when the author
468
+ * presses Backspace at the start of an already-empty step. If
469
+ * removing would leave the list empty we leave one empty item
470
+ * — Starlight's `<Steps>` rejects an empty `<ol>` and the
471
+ * author probably wants to keep editing.
472
+ */
473
+ const removeSelf = () => {
474
+ if (found.list.children.length <= 1)
475
+ return;
476
+ const newListChildren = found.list.children.filter((_, idx) => idx !== itemIndex);
477
+ // Focus the previous item after re-render (or the new first
478
+ // item if we removed the head).
479
+ pendingFocusIndexRef.current = Math.max(0, itemIndex - 1);
480
+ writeListChildren(newListChildren);
481
+ };
482
+ li.addEventListener('blur', commit);
483
+ li.addEventListener('keydown', (e) => {
484
+ if (e.key === 'Enter' && !e.shiftKey) {
485
+ // Enter splits the list: commit current text, append a new
486
+ // empty item below, focus it. Standard list-editor pattern
487
+ // (Notion, Bear, native markdown editors).
488
+ e.preventDefault();
489
+ insertItemBelow();
490
+ }
491
+ else if (e.key === 'Backspace') {
492
+ // Backspace at the start of an empty item removes the item.
493
+ // Anywhere else: default delete-character behaviour.
494
+ const text = (li.textContent ?? '').trim();
495
+ if (text.length === 0) {
496
+ e.preventDefault();
497
+ removeSelf();
498
+ }
499
+ }
500
+ else if (e.key === 'Escape') {
501
+ e.preventDefault();
502
+ li.textContent = committed;
503
+ li.blur();
504
+ }
505
+ });
506
+ }
507
+ // After every re-wire pass, honor any pending focus request from
508
+ // the previous render's keyboard handler. This is what makes Enter
509
+ // / Backspace feel responsive — the new li appears AND gets the
510
+ // caret in one perceived action.
511
+ if (pendingFocusIndexRef.current !== null) {
512
+ const targetIdx = pendingFocusIndexRef.current;
513
+ pendingFocusIndexRef.current = null;
514
+ const target = domItems[targetIdx];
515
+ if (target) {
516
+ // Defer to next microtask so any in-flight focus management
517
+ // (Lexical refocus after the discrete update) settles first.
518
+ Promise.resolve().then(() => {
519
+ target.focus();
520
+ // Place caret at start for the freshly-inserted empty item.
521
+ const range = target.ownerDocument.createRange();
522
+ range.selectNodeContents(target);
523
+ range.collapse(true);
524
+ const sel = target.ownerDocument.defaultView?.getSelection();
525
+ if (sel) {
526
+ sel.removeAllRanges();
527
+ sel.addRange(range);
528
+ }
529
+ });
530
+ }
531
+ }
532
+ }
533
+ /**
534
+ * Walk the mdast subtree starting at `node` and build the render-tree
535
+ * payload. Children that are JSX elements (flow OR text — MDX parses
536
+ * inline-written JSX as text variants) with a registered descriptor
537
+ * are recursed into; anything else terminates the recursion and the
538
+ * parent ends up with a single body slot like a leaf would.
539
+ *
540
+ * `isRoot=true` means this is the top-level node the caller will
541
+ * portal a Lexical editor into. We skip the static text fallback on
542
+ * the root so the portal isn't stacked on top of duplicate text —
543
+ * the editor itself owns the body content for the root. Nested
544
+ * leaves (children inside a container) DO get the fallback, since
545
+ * they aren't being portaled into yet (Phase 3).
546
+ */
547
+ function buildRenderTree(node, descriptors, slotIdPrefix, isRoot = false) {
548
+ const name = node.name ?? '';
549
+ const desc = descriptors.find((d) => 'name' in d && d.name === name);
550
+ const jsxDesc = desc && isJsxDescriptor(desc) ? desc : null;
551
+ const source = jsxDesc?.import?.from;
552
+ if (!source)
553
+ return null;
554
+ const allKids = effectiveChildren(node);
555
+ // Extract `<Fragment slot="name">…</Fragment>` children into a
556
+ // namedSlots map and continue body processing with the remaining
557
+ // (default-slot) children only. This is the Astro convention for
558
+ // multi-slot components like `<Layout>` or `<Hero>`.
559
+ const namedSlots = {};
560
+ const kids = [];
561
+ for (const child of allKids) {
562
+ const slot = getNamedSlotName(child);
563
+ if (slot) {
564
+ const inner = child.children;
565
+ namedSlots[slot] = sanitizeHtml(mdastToHtml({ children: Array.isArray(inner) ? inner : [] }));
566
+ }
567
+ else {
568
+ kids.push(child);
569
+ }
570
+ }
571
+ const children = [];
572
+ let hasJsxChildren = false;
573
+ for (let i = 0; i < kids.length; i++) {
574
+ const child = kids[i];
575
+ if (child?.type === 'mdxJsxFlowElement' || child?.type === 'mdxJsxTextElement') {
576
+ const childTree = buildRenderTree(child, descriptors, `${slotIdPrefix}.${i}`);
577
+ if (childTree) {
578
+ children.push(childTree);
579
+ hasJsxChildren = true;
580
+ }
581
+ }
582
+ }
583
+ // If the body is a markdown list (Steps/FileTree), render it as
584
+ // raw HTML — those components' Astro implementations validate the
585
+ // slot tag name and reject `<conloca-slot>`. `bodyHtml` makes the
586
+ // server emit our rendered list directly as the slot content with
587
+ // no wrapper.
588
+ const bodyHtml = !hasJsxChildren && bodyNeedsStaticHtml(kids) ? sanitizeHtml(mdastToHtml({ children: kids })) : undefined;
589
+ // Previously, nested leaves shipped a static-text `body` fallback
590
+ // inside their slot so authored text was visible even without an
591
+ // inline editor — back when only the root slot got a Lexical
592
+ // portal. Every container child now gets its own `ContainerSlotEditor`
593
+ // portaled in (see `GenericBlock`), so the slot's owner is always
594
+ // an editor. Emitting `body` here would render the same text twice:
595
+ // once as static text from the SSR'd slot, once via the portaled
596
+ // editor's contentEditable. Always omit.
597
+ const body = undefined;
598
+ return {
599
+ component: name,
600
+ source,
601
+ defaultExport: jsxDesc?.import?.default ?? false,
602
+ props: readAttrs(node),
603
+ slotId: slotIdPrefix,
604
+ ...(hasJsxChildren ? { children } : {}),
605
+ ...(body ? { body } : {}),
606
+ ...(bodyHtml ? { bodyHtml } : {}),
607
+ ...(Object.keys(namedSlots).length > 0 ? { namedSlots } : {}),
608
+ };
609
+ }
610
+ /**
611
+ * True when every non-trivial child of `node` is itself a JSX element
612
+ * (flow or text variant). This is the "container" case (CardGrid with
613
+ * Cards inside, Tabs with TabItems). Text-bearing or mixed children
614
+ * fall through to leaf rendering with one body slot.
615
+ */
616
+ function isPureContainer(node) {
617
+ const allKids = effectiveChildren(node);
618
+ if (allKids.length === 0)
619
+ return false;
620
+ // Ignore named-slot Fragments — they're passed as separate slots,
621
+ // not part of the default-body container detection.
622
+ const kids = allKids.filter((k) => getNamedSlotName(k) == null);
623
+ if (kids.length === 0)
624
+ return false;
625
+ let sawJsx = false;
626
+ for (const child of kids) {
627
+ const c = child;
628
+ if (!c || typeof c !== 'object')
629
+ continue;
630
+ if (c.type === 'mdxJsxFlowElement' || c.type === 'mdxJsxTextElement') {
631
+ sawJsx = true;
632
+ continue;
633
+ }
634
+ // Permit pure-whitespace text nodes between block JSX.
635
+ if (c.type === 'text' && typeof c.value === 'string' && c.value.trim() === '')
636
+ continue;
637
+ return false;
638
+ }
639
+ return sawJsx;
640
+ }
641
+ /**
642
+ * One nested editor scoped to a single child inside a container's
643
+ * render-tree. The parent's MDXEditor `JsxNode` owns the WHOLE mdast
644
+ * subtree (CardGrid + its Cards + grandchildren) as one opaque blob;
645
+ * we can't give each child its own Lexical node within the library's
646
+ * data model. Instead, this component sits inside the parent's JsxEditor
647
+ * context (via `<NestedLexicalEditor>`) and uses `getContent` /
648
+ * `getUpdatedMdastNode` to read and write a SPECIFIC child by mdast
649
+ * path. The same `effectiveChildren` unwrap that buildRenderTree did
650
+ * on read is mirrored in the write helper so the original tree shape
651
+ * round-trips on save.
652
+ *
653
+ * Concurrency caveat: when two `ContainerSlotEditor` instances inside
654
+ * the same parent both fire `getUpdatedMdastNode`, each sees the
655
+ * parent snapshot captured by `useMdastNodeUpdater` at its render
656
+ * time. MDXEditor's `discrete: true` update path makes the parent
657
+ * commit synchronously between blurs and React re-renders before
658
+ * the next blur could fire, so blur-driven prose edits are safe. The
659
+ * race exists only for non-blur updates (codemirror's
660
+ * `NESTED_EDITOR_UPDATED_COMMAND` while still focused) — vanishingly
661
+ * rare in container-child editing today.
662
+ */
663
+ function ContainerSlotEditor({ path }) {
664
+ return (_jsx(NestedLexicalEditor, { getContent: (parent) => {
665
+ const target = getMdastAtPath(parent, path);
666
+ return target?.children ?? [];
667
+ }, getUpdatedMdastNode: (parent, newChildren) => replaceMdastAtPath(parent, path, newChildren) }));
668
+ }
669
+ export function GenericBlock({ mdastNode }) {
670
+ const updater = useMdastNodeUpdater();
671
+ const removeNode = useLexicalNodeRemove();
672
+ const descriptors = useMdxComponents();
673
+ const descriptorsByName = useMemo(() => {
674
+ const byName = new Map();
675
+ for (const candidate of descriptors) {
676
+ if ('name' in candidate)
677
+ byName.set(candidate.name, candidate);
678
+ }
679
+ return byName;
680
+ }, [descriptors]);
681
+ const { parentEditor, lexicalNode } = useNestedEditorContext();
682
+ const node = mdastNode;
683
+ const attrs = readAttrs(node);
684
+ const name = node.name ?? '';
685
+ const found = descriptorsByName.get(name);
686
+ const descriptor = found && isJsxDescriptor(found) ? found : null;
687
+ const source = descriptor?.import?.from;
688
+ // Inline (text-kind) components — `<Icon>`, anything rendered as
689
+ // `mdxJsxTextElement` — sit inside a paragraph's text flow and must
690
+ // NOT carry block wrappers. The phantom-sibling / `sl-markdown-content`
691
+ // path only makes sense for root-level flow blocks (Card colour
692
+ // cycle, CSS-grid placement); for inline elements it would force a
693
+ // line break and stack hidden siblings around the glyph.
694
+ const isInline = descriptor?.kind === 'text';
695
+ // This block's 1-based position among Lexical's root-level children.
696
+ // Passed to the render endpoint so it can prepend phantom siblings and
697
+ // restore the same `:nth-child(N)` position the live page would have.
698
+ // Subscribes to the parent editor so the index updates when the user
699
+ // adds, deletes, or reorders blocks above this one. Inline components
700
+ // skip this entirely — they aren't root children.
701
+ const [documentIndex, setDocumentIndex] = useState(1);
702
+ useEffect(() => {
703
+ if (isInline)
704
+ return;
705
+ const computeIndex = () => {
706
+ parentEditor.getEditorState().read(() => {
707
+ const me = $getNodeByKey(lexicalNode.getKey());
708
+ // Walk up to the root-level child (a JSX block lives inside a
709
+ // Lexical paragraph; the paragraph is the root's direct child).
710
+ let cursor = me;
711
+ while (cursor && cursor.getParent() && cursor.getParent()?.getParent() !== null) {
712
+ cursor = cursor.getParent();
713
+ }
714
+ const root = cursor?.getParent();
715
+ if (root && cursor) {
716
+ const idx = root.getChildren().indexOf(cursor);
717
+ if (idx >= 0)
718
+ setDocumentIndex(idx + 1);
719
+ }
720
+ });
721
+ };
722
+ computeIndex();
723
+ return parentEditor.registerUpdateListener(computeIndex);
724
+ }, [parentEditor, lexicalNode, isInline]);
725
+ // Container mode: when all of this node's children are themselves
726
+ // JSX flow elements with known descriptors, we render the whole
727
+ // subtree in one server call so the children emerge as real DOM
728
+ // siblings of their parent (vs. each child rendering in its own
729
+ // wrapper). This fixes CSS grid layout and positional CSS for
730
+ // components like CardGrid and Tabs whose children must be direct
731
+ // DOM children of the container.
732
+ const containerMode = isPureContainer(node);
733
+ // Build the full render-tree payload. For leaves this is one node
734
+ // with a `<conloca-slot>` body slot. For containers it recurses
735
+ // into children. `tree` is null when we lack an import source for
736
+ // the root component — the fallback wrapper handles that path.
737
+ const tree = useMemo(() => buildRenderTree(node, descriptors, 'root', true),
738
+ // mdast attrs/children are regenerated on every render but
739
+ // structurally stable, so we use stableStringify in cacheKey to
740
+ // dedupe identical requests. Recomputing the tree per render is
741
+ // cheap.
742
+ // eslint-disable-next-line react-hooks/exhaustive-deps
743
+ [node, descriptors]);
744
+ const selectionSignature = useMemo(() => stableStringify({ node }), [node]);
745
+ const renderReq = useMemo(() => (tree ? { tree, documentIndex, ...(isInline ? { inline: true } : {}) } : null), [tree, documentIndex, isInline]);
746
+ const [html, setHtml] = useState(() => renderReq ? (renderCache.get(cacheKey(renderReq)) ?? null) : null);
747
+ const [error, setError] = useState(null);
748
+ const wrapperRef = useRef(null);
749
+ const [slotEl, setSlotEl] = useState(null);
750
+ /** Container-mode slots: slot-id → element. Each entry portals a
751
+ * `<ContainerSlotEditor>` into that element so every child's body
752
+ * is inline-editable, even when N children share one SSR'd wrapper. */
753
+ const [containerSlots, setContainerSlots] = useState(() => new Map());
754
+ /** Index of a list item that should receive focus after the next
755
+ * render commits. Set by the Enter / Backspace handlers in
756
+ * `wireListItemEditors`; consumed by the same function on the
757
+ * next re-wire pass. Lives at component level (not effect-local)
758
+ * so it survives across render cycles. */
759
+ const pendingListItemFocusRef = useRef(null);
760
+ // Preview wiring must only re-run when the rendered HTML changes:
761
+ // replacing innerHTML during selection-only renders would destroy
762
+ // contenteditable focus. Keep the current editor bindings in a ref so
763
+ // that the HTML-triggered effect still commits through the latest node.
764
+ const previewBindingsRef = useRef({ attrs, node, updater });
765
+ previewBindingsRef.current.attrs = attrs;
766
+ previewBindingsRef.current.node = node;
767
+ previewBindingsRef.current.updater = updater;
768
+ // Fetch (or serve from cache) the rendered HTML on prop changes.
769
+ useEffect(() => {
770
+ if (!renderReq)
771
+ return;
772
+ let cancelled = false;
773
+ setError(null);
774
+ fetchRendered(renderReq)
775
+ .then((next) => {
776
+ if (!cancelled)
777
+ setHtml(next);
778
+ })
779
+ .catch((err) => {
780
+ if (cancelled)
781
+ return;
782
+ setError(err instanceof Error ? err.message : String(err));
783
+ console.warn('[Conloca] GenericBlock render failed:', err);
784
+ });
785
+ return () => {
786
+ cancelled = true;
787
+ };
788
+ }, [renderReq]);
789
+ // Imperatively swap the wrapper's inner HTML when the rendered
790
+ // string changes, then locate every body slot in the SSR'd markup.
791
+ //
792
+ // Leaf mode: one `<conloca-slot>` at the root, portaled with a
793
+ // single `<NestedLexicalEditor>` for the component's body.
794
+ //
795
+ // Container mode: each child JSX node also emits a slot (carrying
796
+ // its `data-slot-id` from the buildRenderTree path). Each gets its
797
+ // own portaled `<ContainerSlotEditor>` scoped to that child's mdast
798
+ // subtree via path resolution — so editing the body of a Card
799
+ // inside a CardGrid works the same as editing the body of a
800
+ // root-level Aside.
801
+ useEffect(() => {
802
+ const wrap = wrapperRef.current;
803
+ if (!wrap || html == null)
804
+ return;
805
+ const { attrs: currentAttrs, node: currentNode, updater: currentUpdater } = previewBindingsRef.current;
806
+ const currentOnPropChange = (propName, value) => {
807
+ currentUpdater({
808
+ attributes: writeAttribute(currentNode.attributes, propName, value),
809
+ });
810
+ };
811
+ // The render-endpoint RESPONSE lands in the PRIVILEGED admin document here
812
+ // (this fourth content-execution site can't be iframed — the portaled
813
+ // Lexical editors need same-origin DOM access). It is DOMPurified before the
814
+ // innerHTML assignment so no active markup reaches the privileged document,
815
+ // whatever produced it: the `bodyHtml`/`namedSlots` we send, OR a string prop
816
+ // a registered component reflected through `set:html`. `sanitizeComponentHtml`
817
+ // is used (not the strict author `sanitizeHtml`) because the response is our
818
+ // OWN registered-component output — it keeps the `<iframe>` embeds and SVG
819
+ // `<use>` icons real components emit, while still stripping scripts, `on*`
820
+ // handlers, dangerous URL schemes, and CSS `url()` beacons. Escaped entities
821
+ // survive untouched, so legitimate prop text (`5 &lt; 10`) still renders;
822
+ // `conloca-slot` stays allowlisted so the inline-editing slots survive.
823
+ wrap.innerHTML = sanitizeComponentHtml(html);
824
+ // After replacing the preview HTML, scan for string-prop values that
825
+ // appear exactly once as a leaf element's textContent and wire those
826
+ // elements as contenteditable. Authors edit eg LinkCard's `description`
827
+ // in place; the blur handler commits via `onPropChange`. Runs after
828
+ // every prop change because the new HTML wipes prior contenteditable
829
+ // attributes — re-wiring keeps inline editing alive across re-renders.
830
+ wireInlinePropEditors(wrap, currentAttrs, currentOnPropChange);
831
+ if (containerMode) {
832
+ // Multiple slots — discover them all and key by slot-id so the
833
+ // path resolution in `ContainerSlotEditor` can find the right
834
+ // mdast subtree to edit.
835
+ const next = new Map();
836
+ const slotEls = wrap.querySelectorAll(`${SLOT_TAG}[data-slot-id]`);
837
+ for (const el of Array.from(slotEls)) {
838
+ const slotId = el.getAttribute('data-slot-id');
839
+ if (slotId)
840
+ next.set(slotId, el);
841
+ }
842
+ setContainerSlots(next);
843
+ setSlotEl(null);
844
+ // Per-child inline-prop wiring. The container's own
845
+ // `wireInlinePropEditors` call above only matches against the
846
+ // container's props (eg CardGrid's `stagger`) — child Cards'
847
+ // `title` and `icon` values are skipped because the matcher
848
+ // doesn't know they belong to a child. For each child slot
849
+ // we find the enclosing region (the DOM subtree the framework
850
+ // rendered for that one child), then run the matcher against
851
+ // the child's own attrs with a child-scoped `onPropChange` that
852
+ // routes through `replaceMdastNodeAtPath`. This is what lets
853
+ // the author click "First card" inside a CardGrid and edit it.
854
+ for (const [slotId, slotEl] of next) {
855
+ const childPath = slotIdToPath(slotId);
856
+ const childNode = getMdastAtPath(currentNode, childPath);
857
+ if (!childNode)
858
+ continue;
859
+ const region = findChildRegion(slotEl);
860
+ if (!region)
861
+ continue;
862
+ // Tag the child's enclosing region with its path so the
863
+ // wrapper-level mousedown/focus handler (`handleSelect`) can
864
+ // resolve which child a click landed in. The slot-id walk
865
+ // alone isn't enough — clicks on a child's title or icon
866
+ // (which sit OUTSIDE the slot) wouldn't find a slot ancestor
867
+ // via `closest`. This attribute IS a child ancestor in those
868
+ // cases, so `closest('[data-conloca-child-path]')` lands on
869
+ // the right region.
870
+ region.setAttribute('data-conloca-child-path', slotId);
871
+ const childAttrs = readAttrs(childNode);
872
+ const childOnPropChange = (propName, value) => {
873
+ const newChild = {
874
+ ...childNode,
875
+ attributes: writeAttribute(childNode.attributes, propName, value),
876
+ };
877
+ const nextRoot = replaceMdastNodeAtPath(currentNode, childPath, newChild);
878
+ currentUpdater({ children: nextRoot.children });
879
+ };
880
+ wireInlinePropEditors(region, childAttrs, childOnPropChange);
881
+ }
882
+ }
883
+ else {
884
+ // Not a JSX container (so `containerMode` is false). But the
885
+ // mdast might still be a list-based strict-slot component (Steps,
886
+ // FileTree, anything else whose framework component validates
887
+ // its slot as a real `<ol>` / `<ul>` and rejects `<conloca-slot>`
888
+ // children). For those, we wire each `<li>` as a contenteditable
889
+ // with on-blur commit — no DOM mutation, no portal collision
890
+ // with React. Trade-off: plaintext-only commits (loses bold/
891
+ // italic on edit). Future enhancement: parse inline markdown
892
+ // back from contenteditable text so formatting round-trips.
893
+ wireListItemEditors(wrap, currentNode, currentUpdater, pendingListItemFocusRef);
894
+ setContainerSlots(new Map());
895
+ setSlotEl(wrap.querySelector(SLOT_TAG));
896
+ }
897
+ // `previewBindingsRef` supplies the current attrs, node, and updater
898
+ // without making their render-local identities effect triggers.
899
+ // This preserves focus while preventing stale editor callbacks.
900
+ }, [html, containerMode]);
901
+ const slot = (_jsx(NestedLexicalEditor, { getContent: (n) => n.children, getUpdatedMdastNode: (n, children) => ({ ...n, children: children }) }));
902
+ const onPropChange = useCallback((propName, next) => {
903
+ // Route through the type-aware writer so booleans become JSX
904
+ // shorthand (`<CardGrid stagger />`), numbers become expressions
905
+ // (`<Box columns={3} />`), and strings stay as string literals.
906
+ // The inline-prop editor in the preview still calls this with
907
+ // string values — `writeAttribute` handles those identically to
908
+ // `writeStringAttribute` (the previous narrow writer).
909
+ updater({ attributes: writeAttribute(node.attributes, propName, next) });
910
+ }, [updater, node.attributes]);
911
+ // Publish to the side-panel registry whenever this block is the
912
+ // currently-selected one, or its props change while still selected.
913
+ // The panel reads `descriptor`/`attrs` to render the form and calls
914
+ // back through `onPropChange`/`removeNode` (closed over the block's
915
+ // own updater hooks) so updates flow on the same path inline editing
916
+ // used.
917
+ // Stable per-block identity. `useLexicalNodeRemove` returns a fresh
918
+ // closure on each render so we can't key off `removeNode`. The Lexical
919
+ // node `getKey()` is stable for the block's whole lifetime and unique
920
+ // across siblings — exactly what the side-panel registry and the
921
+ // `is-selected` className need to identify the active block.
922
+ const blockKey = lexicalNode.getKey();
923
+ // Selection publication is keyed by a structural signature rather
924
+ // than render-local mdast and callback identities. The mutable
925
+ // bindings keep the published handlers current without feeding the
926
+ // external selection store an infinite render loop.
927
+ const selectionBindingsRef = useRef({
928
+ signature: selectionSignature,
929
+ attrs,
930
+ onPropChange,
931
+ removeNode,
932
+ node,
933
+ updater,
934
+ });
935
+ const selectionBindings = selectionBindingsRef.current;
936
+ selectionBindings.signature = selectionSignature;
937
+ selectionBindings.attrs = attrs;
938
+ selectionBindings.onPropChange = onPropChange;
939
+ selectionBindings.removeNode = removeNode;
940
+ selectionBindings.node = node;
941
+ selectionBindings.updater = updater;
942
+ useEffect(() => {
943
+ const bindings = selectionBindingsRef.current;
944
+ // Effects run after commit; only publish a snapshot that matches the
945
+ // structural change which scheduled this effect.
946
+ if (bindings.signature !== selectionSignature)
947
+ return;
948
+ const { attrs: currentAttrs, onPropChange: currentOnPropChange, removeNode: currentRemoveNode, node: currentNode, updater: currentUpdater, } = bindings;
949
+ if (!descriptor)
950
+ return;
951
+ const current = getSelectedBlock();
952
+ if (!current)
953
+ return;
954
+ if (current.key === blockKey) {
955
+ // Container/leaf itself is selected — republish with current attrs.
956
+ setSelectedBlock({
957
+ key: blockKey,
958
+ name,
959
+ descriptor,
960
+ attrs: currentAttrs,
961
+ onPropChange: currentOnPropChange,
962
+ onRemove: currentRemoveNode,
963
+ });
964
+ return;
965
+ }
966
+ // A child of this container might be the selection. Child keys are
967
+ // `${containerKey}:${dotPath}` — strip our prefix to find which
968
+ // child path the panel is showing. Re-resolve that child from the
969
+ // current mdast so panel inputs reflect prop edits done elsewhere
970
+ // (inline editor commits, programmatic updates).
971
+ if (containerMode && current.key.startsWith(`${blockKey}:`)) {
972
+ const dotPath = current.key.slice(blockKey.length + 1);
973
+ const childPath = dotPath ? dotPath.split('.').map((s) => Number.parseInt(s, 10)) : [];
974
+ const childNode = getMdastAtPath(currentNode, childPath);
975
+ if (!childNode || childNode.name !== current.name)
976
+ return;
977
+ const childDescriptor = descriptorsByName.get(childNode.name);
978
+ if (!childDescriptor || !isJsxDescriptor(childDescriptor))
979
+ return;
980
+ const childAttrs = readAttrs(childNode);
981
+ const childOnPropChange = (propName, value) => {
982
+ const newChild = {
983
+ ...childNode,
984
+ attributes: writeAttribute(childNode.attributes, propName, value),
985
+ };
986
+ const next = replaceMdastNodeAtPath(currentNode, childPath, newChild);
987
+ currentUpdater({ children: next.children });
988
+ };
989
+ const childOnRemove = () => {
990
+ const next = removeMdastNodeAtPath(currentNode, childPath);
991
+ currentUpdater({ children: next.children });
992
+ };
993
+ setSelectedBlock({
994
+ key: current.key,
995
+ name: childNode.name,
996
+ descriptor: childDescriptor,
997
+ attrs: childAttrs,
998
+ onPropChange: childOnPropChange,
999
+ onRemove: childOnRemove,
1000
+ });
1001
+ }
1002
+ // The signature changes only when mdast content changes; the
1003
+ // descriptor map changes only when the host registry changes.
1004
+ // Render-local editor bindings are read from the ref above.
1005
+ }, [selectionSignature, descriptor, name, blockKey, containerMode, descriptorsByName]);
1006
+ const handleSelect = useCallback((e) => {
1007
+ if (!descriptor)
1008
+ return;
1009
+ // Container resolution: when the click/focus landed inside a
1010
+ // child slot (eg a Card inside a CardGrid), publish the CHILD's
1011
+ // descriptor + attrs to the panel instead of the container's.
1012
+ // The same wrapper handler covers both cases — we walk from the
1013
+ // event target to find the nearest `data-slot-id` ancestor; if
1014
+ // one exists, the user clicked into a child, otherwise the click
1015
+ // hit container-level chrome and the container itself is the
1016
+ // selection.
1017
+ if (containerMode && e) {
1018
+ const target = e.target;
1019
+ // Prefer the child-region marker stamped by the html-injection
1020
+ // effect — covers clicks anywhere inside a child (title, icon,
1021
+ // body). The slot-id fallback covers the case where the
1022
+ // region marker is missing (eg edge cases where the region
1023
+ // walker couldn't find a bounded subtree).
1024
+ const regionEl = target?.closest('[data-conloca-child-path]');
1025
+ const slotEl = regionEl ?? target?.closest('[data-slot-id]');
1026
+ if (slotEl) {
1027
+ const slotId = slotEl.getAttribute('data-conloca-child-path') ?? slotEl.getAttribute('data-slot-id') ?? '';
1028
+ const childPath = slotIdToPath(slotId);
1029
+ const childNode = getMdastAtPath(node, childPath);
1030
+ if (childNode?.name) {
1031
+ const childDescriptor = descriptors.find((d) => d.name === childNode.name);
1032
+ if (childDescriptor && isJsxDescriptor(childDescriptor)) {
1033
+ const childAttrs = readAttrs(childNode);
1034
+ const childKey = `${blockKey}:${childPath.join('.')}`;
1035
+ const childOnPropChange = (propName, value) => {
1036
+ const newChild = {
1037
+ ...childNode,
1038
+ attributes: writeAttribute(childNode.attributes, propName, value),
1039
+ };
1040
+ const next = replaceMdastNodeAtPath(node, childPath, newChild);
1041
+ updater({ children: next.children });
1042
+ };
1043
+ const childOnRemove = () => {
1044
+ const next = removeMdastNodeAtPath(node, childPath);
1045
+ updater({ children: next.children });
1046
+ };
1047
+ setSelectedBlock({
1048
+ key: childKey,
1049
+ name: childNode.name,
1050
+ descriptor: childDescriptor,
1051
+ attrs: childAttrs,
1052
+ onPropChange: childOnPropChange,
1053
+ onRemove: childOnRemove,
1054
+ });
1055
+ return;
1056
+ }
1057
+ }
1058
+ }
1059
+ }
1060
+ setSelectedBlock({ key: blockKey, name, descriptor, attrs, onPropChange, onRemove: removeNode });
1061
+ }, [blockKey, descriptor, name, attrs, onPropChange, removeNode, containerMode, node, descriptors, updater]);
1062
+ // SSR'd component previews ship with real interactive anchors — Starlight
1063
+ // `<LinkCard>`s navigate, `<Tabs>` triggers are `<a role="tab" href="#...">`,
1064
+ // any `<a>` inside a `<Card>` body, etc. In a live page Starlight's custom
1065
+ // elements (`<starlight-tabs>`) wire click → tab-panel toggle, and link
1066
+ // anchors navigate. In the editor neither of those is desirable: the JS
1067
+ // that runs `<starlight-tabs>`'s connectedCallback isn't loaded under
1068
+ // /__cms, and navigation yanks the author away from what they're editing.
1069
+ //
1070
+ // So intercept anchor clicks in capture phase and handle the two cases:
1071
+ // 1. `[role="tab"]` → switch tabs in place (manual ARIA toggle that
1072
+ // mirrors what `<starlight-tabs>` would do at runtime). The author
1073
+ // can now click "npm" to see and edit the npm tab body.
1074
+ // 2. Any other `<a>` → swallow. Selection still fires from the
1075
+ // `mousedown` handler so the block becomes selected as if it were a
1076
+ // static surface.
1077
+ //
1078
+ // `auxclick` (middle-click) gets the anchor swallow too — without it
1079
+ // middle-click on a LinkCard would still "open in new tab" and escape
1080
+ // the editor.
1081
+ const handleAnchorClickInPreview = useCallback((e) => {
1082
+ const target = e.target;
1083
+ const tab = target?.closest('[role="tab"]');
1084
+ if (tab) {
1085
+ e.preventDefault();
1086
+ e.stopPropagation();
1087
+ activateTabInPlace(tab);
1088
+ return;
1089
+ }
1090
+ if (target?.closest('a')) {
1091
+ e.preventDefault();
1092
+ e.stopPropagation();
1093
+ }
1094
+ }, []);
1095
+ // Per-block "am I selected" subscription. Compares the registry's
1096
+ // current key with this block's stable key; safe across re-renders.
1097
+ // The CSS hook is the `is-selected` class on the wrapper, which paints
1098
+ // the accent outline; the side panel keys off the same registry.
1099
+ const selected = useSelectedBlock();
1100
+ const isSelected = selected?.key === blockKey;
1101
+ const sandboxStyles = useSandboxPreviewStyles();
1102
+ // Raw HTML in MDX (`<div class="x">`, `<details>`, etc.) lands here
1103
+ // with a lowercase tag name and no registered component descriptor.
1104
+ // Render the whole subtree client-side as HTML — no SSR roundtrip,
1105
+ // no labelled fallback. Static (not inline-editable) for now.
1106
+ if (!source && isHtmlTag(name)) {
1107
+ // Raw HTML is sanitized AND rendered inside the opaque-origin sandbox —
1108
+ // defence in depth: even a payload that slips past the sanitizer cannot
1109
+ // reach this document's cookies or `__CONTENT_API_CLIENT__`. This block is
1110
+ // static (no descriptor, so `handleSelect` already no-ops); anchor
1111
+ // navigation is swallowed by ignoring the frame's `link` message.
1112
+ const rawHtml = sanitizeHtml(mdastToHtml(node));
1113
+ return (_jsx("div", { className: `conloca-generic-block conloca-generic-block--html${isSelected ? ' is-selected' : ''}`, onMouseDownCapture: handleSelect, onFocusCapture: handleSelect, children: _jsx(ContentSandbox, { mode: "html", content: rawHtml, styles: sandboxStyles }) }));
1114
+ }
1115
+ // Text-kind components are inline glyphs (Icon, raw-HTML inline tags).
1116
+ // Wrapping them in a `<div>` would force a line break inside the
1117
+ // paragraph that contains them. Use `<span>` wrappers and a class
1118
+ // modifier so CSS can drop block-level styling for this path.
1119
+ if (isInline) {
1120
+ return (_jsx("span", { className: `conloca-generic-block conloca-generic-block--inline${isSelected ? ' is-selected' : ''}`, onMouseDownCapture: handleSelect, onFocusCapture: handleSelect, onClickCapture: handleAnchorClickInPreview, onAuxClickCapture: handleAnchorClickInPreview, children: source && !error ? (_jsxs(_Fragment, { children: [_jsx("span", { ref: wrapperRef, className: "conloca-generic-block__rendered" }), slotEl && createPortal(slot, slotEl)] })) : (_jsxs("span", { className: "conloca-generic-block__fallback", "data-mdx-block": name, children: [_jsx("span", { className: "conloca-generic-block__fallback-label", children: name }), _jsx("span", { className: "conloca-generic-block__fallback-body", children: slot })] })) }));
1121
+ }
1122
+ return (_jsx("div", { className: `conloca-generic-block${isSelected ? ' is-selected' : ''}`, onMouseDownCapture: handleSelect, onFocusCapture: handleSelect, onClickCapture: handleAnchorClickInPreview, onAuxClickCapture: handleAnchorClickInPreview, children: source && !error ? (_jsxs(_Fragment, { children: [_jsx("div", { ref: wrapperRef, className: "conloca-generic-block__rendered" }), slotEl && createPortal(slot, slotEl), Array.from(containerSlots).map(([slotId, el]) => createPortal(_jsx(ContainerSlotEditor, { path: slotIdToPath(slotId) }, slotId), el))] })) : (_jsxs("div", { className: "conloca-generic-block__fallback", "data-mdx-block": name, children: [_jsx("span", { className: "conloca-generic-block__fallback-label", children: name }), _jsx("div", { className: "conloca-generic-block__fallback-body", children: slot })] })) }));
1123
+ }
1124
+ //# sourceMappingURL=GenericBlock.js.map