@conloca/cms-spa 0.1.14 → 0.1.16

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 (438) hide show
  1. package/dist/App-Bk1LNxbS.mjs +10851 -0
  2. package/dist/App-Bk1LNxbS.mjs.map +1 -0
  3. package/dist/App.d.ts +35 -0
  4. package/dist/App.d.ts.map +1 -0
  5. package/dist/App.js +52 -0
  6. package/dist/CmsSpaApp.d.ts +13 -0
  7. package/dist/CmsSpaApp.d.ts.map +1 -0
  8. package/dist/CmsSpaApp.js +33 -0
  9. package/dist/cn-dlASUkDY.mjs +10 -0
  10. package/dist/cn-dlASUkDY.mjs.map +1 -0
  11. package/dist/components/CMSDashboard.d.ts +2 -0
  12. package/dist/components/CMSDashboard.d.ts.map +1 -0
  13. package/dist/components/CMSDashboard.js +20 -0
  14. package/dist/components/CMSLayout.d.ts +2 -0
  15. package/dist/components/CMSLayout.d.ts.map +1 -0
  16. package/dist/components/CMSLayout.js +15 -0
  17. package/dist/components/ConlocaLogo.d.ts +2 -0
  18. package/dist/components/ConlocaLogo.d.ts.map +1 -0
  19. package/dist/components/ConlocaLogo.js +4 -0
  20. package/dist/components/GitStatusPanel.d.ts +25 -0
  21. package/dist/components/GitStatusPanel.d.ts.map +1 -0
  22. package/dist/components/GitStatusPanel.js +77 -0
  23. package/dist/components/MobileTopBar.d.ts +6 -0
  24. package/dist/components/MobileTopBar.d.ts.map +1 -0
  25. package/dist/components/MobileTopBar.js +6 -0
  26. package/dist/components/Sidebar.d.ts +8 -0
  27. package/dist/components/Sidebar.d.ts.map +1 -0
  28. package/dist/components/Sidebar.js +40 -0
  29. package/dist/components/UserAvatar.d.ts +2 -0
  30. package/dist/components/UserAvatar.d.ts.map +1 -0
  31. package/dist/components/UserAvatar.js +14 -0
  32. package/dist/components/cards/DataEntryCard.d.ts +14 -0
  33. package/dist/components/cards/DataEntryCard.d.ts.map +1 -0
  34. package/dist/components/cards/DataEntryCard.js +32 -0
  35. package/dist/components/cards/SectionCard.d.ts +15 -0
  36. package/dist/components/cards/SectionCard.d.ts.map +1 -0
  37. package/dist/components/cards/SectionCard.js +10 -0
  38. package/dist/components/cards/index.d.ts +2 -0
  39. package/dist/components/cards/index.d.ts.map +1 -0
  40. package/dist/components/cards/index.js +1 -0
  41. package/dist/components/dashboard/RecentActivity.d.ts +2 -0
  42. package/dist/components/dashboard/RecentActivity.d.ts.map +1 -0
  43. package/dist/components/dashboard/RecentActivity.js +58 -0
  44. package/dist/components/dialog.d.ts +53 -0
  45. package/dist/components/dialog.d.ts.map +1 -0
  46. package/dist/components/dialog.js +56 -0
  47. package/dist/components/dialogs/BlockPropertiesDialog.d.ts +12 -0
  48. package/dist/components/dialogs/BlockPropertiesDialog.d.ts.map +1 -0
  49. package/dist/components/dialogs/BlockPropertiesDialog.js +42 -0
  50. package/dist/components/dialogs/ConflictDialog.d.ts +10 -0
  51. package/dist/components/dialogs/ConflictDialog.d.ts.map +1 -0
  52. package/dist/components/dialogs/ConflictDialog.js +29 -0
  53. package/dist/components/dialogs/CreateDataDialog.d.ts +9 -0
  54. package/dist/components/dialogs/CreateDataDialog.d.ts.map +1 -0
  55. package/dist/components/dialogs/CreateDataDialog.js +20 -0
  56. package/dist/components/dialogs/CreateFolderDialog.d.ts +9 -0
  57. package/dist/components/dialogs/CreateFolderDialog.d.ts.map +1 -0
  58. package/dist/components/dialogs/CreateFolderDialog.js +33 -0
  59. package/dist/components/dialogs/CreatePageDialog.d.ts +10 -0
  60. package/dist/components/dialogs/CreatePageDialog.d.ts.map +1 -0
  61. package/dist/components/dialogs/CreatePageDialog.js +155 -0
  62. package/dist/components/dialogs/DataPropertiesDialog.d.ts +10 -0
  63. package/dist/components/dialogs/DataPropertiesDialog.d.ts.map +1 -0
  64. package/dist/components/dialogs/DataPropertiesDialog.js +38 -0
  65. package/dist/components/dialogs/DeleteConfirmDialog.d.ts +12 -0
  66. package/dist/components/dialogs/DeleteConfirmDialog.d.ts.map +1 -0
  67. package/dist/components/dialogs/DeleteConfirmDialog.js +7 -0
  68. package/dist/components/dialogs/ErrorModal.d.ts +14 -0
  69. package/dist/components/dialogs/ErrorModal.d.ts.map +1 -0
  70. package/dist/components/dialogs/ErrorModal.js +38 -0
  71. package/dist/components/dialogs/MoveFolderDialog.d.ts +11 -0
  72. package/dist/components/dialogs/MoveFolderDialog.d.ts.map +1 -0
  73. package/dist/components/dialogs/MoveFolderDialog.js +45 -0
  74. package/dist/components/dialogs/PageMetadataDialog.d.ts +10 -0
  75. package/dist/components/dialogs/PageMetadataDialog.d.ts.map +1 -0
  76. package/dist/components/dialogs/PageMetadataDialog.js +85 -0
  77. package/dist/components/dialogs/UnsavedChangesDialog.d.ts +8 -0
  78. package/dist/components/dialogs/UnsavedChangesDialog.d.ts.map +1 -0
  79. package/dist/components/dialogs/UnsavedChangesDialog.js +6 -0
  80. package/dist/components/dialogs/index.d.ts +9 -0
  81. package/dist/components/dialogs/index.d.ts.map +1 -0
  82. package/dist/components/dialogs/index.js +8 -0
  83. package/dist/components/editor/BlockEditor.d.ts +8 -0
  84. package/dist/components/editor/BlockEditor.d.ts.map +1 -0
  85. package/dist/components/editor/BlockEditor.js +262 -0
  86. package/dist/components/editor/BlockWrappers.d.ts +15 -0
  87. package/dist/components/editor/BlockWrappers.d.ts.map +1 -0
  88. package/dist/components/editor/BlockWrappers.js +29 -0
  89. package/dist/components/editor/CMSMDXEditor.d.ts +13 -0
  90. package/dist/components/editor/CMSMDXEditor.d.ts.map +1 -0
  91. package/dist/components/editor/CMSMDXEditor.js +123 -0
  92. package/dist/components/editor/ContentDiff.d.ts +10 -0
  93. package/dist/components/editor/ContentDiff.d.ts.map +1 -0
  94. package/dist/components/editor/ContentDiff.js +51 -0
  95. package/dist/components/editor/CreateBlockDialog.d.ts +26 -0
  96. package/dist/components/editor/CreateBlockDialog.d.ts.map +1 -0
  97. package/dist/components/editor/CreateBlockDialog.js +131 -0
  98. package/dist/components/editor/DrawerItemOverride.d.ts +8 -0
  99. package/dist/components/editor/DrawerItemOverride.d.ts.map +1 -0
  100. package/dist/components/editor/DrawerItemOverride.js +41 -0
  101. package/dist/components/editor/EditorChromeToggles.d.ts +16 -0
  102. package/dist/components/editor/EditorChromeToggles.d.ts.map +1 -0
  103. package/dist/components/editor/EditorChromeToggles.js +16 -0
  104. package/dist/components/editor/GenericBlock.d.ts +3 -0
  105. package/dist/components/editor/GenericBlock.d.ts.map +1 -0
  106. package/dist/components/editor/GenericBlock.js +1067 -0
  107. package/dist/components/editor/ImagePickerDialog.d.ts +6 -0
  108. package/dist/components/editor/ImagePickerDialog.d.ts.map +1 -0
  109. package/dist/components/editor/ImagePickerDialog.js +24 -0
  110. package/dist/components/editor/JsxPropsPanel.d.ts +16 -0
  111. package/dist/components/editor/JsxPropsPanel.d.ts.map +1 -0
  112. package/dist/components/editor/JsxPropsPanel.js +145 -0
  113. package/dist/components/editor/LocaleSelector.d.ts +9 -0
  114. package/dist/components/editor/LocaleSelector.d.ts.map +1 -0
  115. package/dist/components/editor/LocaleSelector.js +13 -0
  116. package/dist/components/editor/MDXLivePreview.d.ts +14 -0
  117. package/dist/components/editor/MDXLivePreview.d.ts.map +1 -0
  118. package/dist/components/editor/MDXLivePreview.js +103 -0
  119. package/dist/components/editor/MdxPageEditor.d.ts +10 -0
  120. package/dist/components/editor/MdxPageEditor.d.ts.map +1 -0
  121. package/dist/components/editor/MdxPageEditor.js +297 -0
  122. package/dist/components/editor/PageEditor.d.ts +18 -0
  123. package/dist/components/editor/PageEditor.d.ts.map +1 -0
  124. package/dist/components/editor/PageEditor.js +288 -0
  125. package/dist/components/editor/PageEditorHeaderActions.d.ts +16 -0
  126. package/dist/components/editor/PageEditorHeaderActions.d.ts.map +1 -0
  127. package/dist/components/editor/PageEditorHeaderActions.js +19 -0
  128. package/dist/components/editor/PageEditorWrapper.d.ts +7 -0
  129. package/dist/components/editor/PageEditorWrapper.d.ts.map +1 -0
  130. package/dist/components/editor/PageEditorWrapper.js +319 -0
  131. package/dist/components/editor/SearchableSelect.d.ts +34 -0
  132. package/dist/components/editor/SearchableSelect.d.ts.map +1 -0
  133. package/dist/components/editor/SearchableSelect.js +116 -0
  134. package/dist/components/editor/host-wrapper-plugin.d.ts +51 -0
  135. package/dist/components/editor/host-wrapper-plugin.d.ts.map +1 -0
  136. package/dist/components/editor/host-wrapper-plugin.js +37 -0
  137. package/dist/components/editor/index.d.ts +9 -0
  138. package/dist/components/editor/index.d.ts.map +1 -0
  139. package/dist/components/editor/index.js +7 -0
  140. package/dist/components/editor/insert-menu/InsertMdxComponentButton.d.ts +15 -0
  141. package/dist/components/editor/insert-menu/InsertMdxComponentButton.d.ts.map +1 -0
  142. package/dist/components/editor/insert-menu/InsertMdxComponentButton.js +90 -0
  143. package/dist/components/editor/insert-menu/SlashMenuPlugin.d.ts +12 -0
  144. package/dist/components/editor/insert-menu/SlashMenuPlugin.d.ts.map +1 -0
  145. package/dist/components/editor/insert-menu/SlashMenuPlugin.js +106 -0
  146. package/dist/components/editor/insert-menu/insert-payload.d.ts +76 -0
  147. package/dist/components/editor/insert-menu/insert-payload.d.ts.map +1 -0
  148. package/dist/components/editor/insert-menu/insert-payload.js +94 -0
  149. package/dist/components/editor/insert-menu/mdx-components-plugin.d.ts +8 -0
  150. package/dist/components/editor/insert-menu/mdx-components-plugin.d.ts.map +1 -0
  151. package/dist/components/editor/insert-menu/mdx-components-plugin.js +13 -0
  152. package/dist/components/editors/DataEditor.d.ts +19 -0
  153. package/dist/components/editors/DataEditor.d.ts.map +1 -0
  154. package/dist/components/editors/DataEditor.js +139 -0
  155. package/dist/components/fields/ContentBlockSelectorField.d.ts +14 -0
  156. package/dist/components/fields/ContentBlockSelectorField.d.ts.map +1 -0
  157. package/dist/components/fields/ContentBlockSelectorField.js +105 -0
  158. package/dist/components/fields/ImageField.d.ts +16 -0
  159. package/dist/components/fields/ImageField.d.ts.map +1 -0
  160. package/dist/components/fields/ImageField.js +39 -0
  161. package/dist/components/fields/MDXEditField.d.ts +17 -0
  162. package/dist/components/fields/MDXEditField.d.ts.map +1 -0
  163. package/dist/components/fields/MDXEditField.js +28 -0
  164. package/dist/components/forms/ChipArrayField.d.ts +12 -0
  165. package/dist/components/forms/ChipArrayField.d.ts.map +1 -0
  166. package/dist/components/forms/ChipArrayField.js +40 -0
  167. package/dist/components/forms/HintForm.d.ts +22 -0
  168. package/dist/components/forms/HintForm.d.ts.map +1 -0
  169. package/dist/components/forms/HintForm.js +162 -0
  170. package/dist/components/forms/SchemaForm.d.ts +15 -0
  171. package/dist/components/forms/SchemaForm.d.ts.map +1 -0
  172. package/dist/components/forms/SchemaForm.js +106 -0
  173. package/dist/components/index.d.ts +8 -0
  174. package/dist/components/index.d.ts.map +1 -0
  175. package/dist/components/index.js +13 -0
  176. package/dist/components/media/AssetCard.d.ts +14 -0
  177. package/dist/components/media/AssetCard.d.ts.map +1 -0
  178. package/dist/components/media/AssetCard.js +31 -0
  179. package/dist/components/media/AssetDetailSidebar.d.ts +11 -0
  180. package/dist/components/media/AssetDetailSidebar.d.ts.map +1 -0
  181. package/dist/components/media/AssetDetailSidebar.js +101 -0
  182. package/dist/components/media/BulkActionBar.d.ts +9 -0
  183. package/dist/components/media/BulkActionBar.d.ts.map +1 -0
  184. package/dist/components/media/BulkActionBar.js +8 -0
  185. package/dist/components/media/FolderNav.d.ts +7 -0
  186. package/dist/components/media/FolderNav.d.ts.map +1 -0
  187. package/dist/components/media/FolderNav.js +12 -0
  188. package/dist/components/media/FolderTreeSidebar.d.ts +9 -0
  189. package/dist/components/media/FolderTreeSidebar.d.ts.map +1 -0
  190. package/dist/components/media/FolderTreeSidebar.js +41 -0
  191. package/dist/components/media/ImagePicker.d.ts +14 -0
  192. package/dist/components/media/ImagePicker.d.ts.map +1 -0
  193. package/dist/components/media/ImagePicker.js +45 -0
  194. package/dist/components/media/MediaLibrary.d.ts +35 -0
  195. package/dist/components/media/MediaLibrary.d.ts.map +1 -0
  196. package/dist/components/media/MediaLibrary.js +100 -0
  197. package/dist/components/media/MediaToolbar.d.ts +21 -0
  198. package/dist/components/media/MediaToolbar.d.ts.map +1 -0
  199. package/dist/components/media/MediaToolbar.js +6 -0
  200. package/dist/components/media/UploadModal.d.ts +9 -0
  201. package/dist/components/media/UploadModal.d.ts.map +1 -0
  202. package/dist/components/media/UploadModal.js +42 -0
  203. package/dist/components/media/UploadZone.d.ts +8 -0
  204. package/dist/components/media/UploadZone.d.ts.map +1 -0
  205. package/dist/components/media/UploadZone.js +22 -0
  206. package/dist/components/media/index.d.ts +11 -0
  207. package/dist/components/media/index.d.ts.map +1 -0
  208. package/dist/components/media/index.js +10 -0
  209. package/dist/components/pages/BlockList.d.ts +2 -0
  210. package/dist/components/pages/BlockList.d.ts.map +1 -0
  211. package/dist/components/pages/BlockList.js +280 -0
  212. package/dist/components/pages/DataList.d.ts +7 -0
  213. package/dist/components/pages/DataList.d.ts.map +1 -0
  214. package/dist/components/pages/DataList.js +244 -0
  215. package/dist/components/pages/MediaPage.d.ts +8 -0
  216. package/dist/components/pages/MediaPage.d.ts.map +1 -0
  217. package/dist/components/pages/MediaPage.js +107 -0
  218. package/dist/components/pages/PageList.d.ts +7 -0
  219. package/dist/components/pages/PageList.d.ts.map +1 -0
  220. package/dist/components/pages/PageList.js +308 -0
  221. package/dist/components/pages/index.d.ts +3 -0
  222. package/dist/components/pages/index.d.ts.map +1 -0
  223. package/dist/components/pages/index.js +2 -0
  224. package/dist/components/puck/MDXContent.d.ts +10 -0
  225. package/dist/components/puck/MDXContent.d.ts.map +1 -0
  226. package/dist/components/puck/MDXContent.js +80 -0
  227. package/dist/components/puck/index.d.ts +2 -0
  228. package/dist/components/puck/index.d.ts.map +1 -0
  229. package/dist/components/puck/index.js +1 -0
  230. package/dist/components/toast.d.ts +44 -0
  231. package/dist/components/toast.d.ts.map +1 -0
  232. package/dist/components/toast.js +7 -0
  233. package/dist/components/ui/Banner.d.ts +76 -0
  234. package/dist/components/ui/Banner.d.ts.map +1 -0
  235. package/dist/components/ui/Banner.js +49 -0
  236. package/dist/components/ui/Button.d.ts +25 -0
  237. package/dist/components/ui/Button.d.ts.map +1 -0
  238. package/dist/components/ui/Button.js +33 -0
  239. package/dist/components/ui/Card.d.ts +72 -0
  240. package/dist/components/ui/Card.d.ts.map +1 -0
  241. package/dist/components/ui/Card.js +49 -0
  242. package/dist/components/ui/FieldError.d.ts +24 -0
  243. package/dist/components/ui/FieldError.d.ts.map +1 -0
  244. package/dist/components/ui/FieldError.js +17 -0
  245. package/dist/components/ui/IconButton.d.ts +13 -0
  246. package/dist/components/ui/IconButton.d.ts.map +1 -0
  247. package/dist/components/ui/IconButton.js +10 -0
  248. package/dist/components/ui/Input.d.ts +37 -0
  249. package/dist/components/ui/Input.d.ts.map +1 -0
  250. package/dist/components/ui/Input.js +9 -0
  251. package/dist/components/ui/SaveIndicator.d.ts +8 -0
  252. package/dist/components/ui/SaveIndicator.d.ts.map +1 -0
  253. package/dist/components/ui/SaveIndicator.js +32 -0
  254. package/dist/components/ui/Select.d.ts +8 -0
  255. package/dist/components/ui/Select.d.ts.map +1 -0
  256. package/dist/components/ui/Select.js +9 -0
  257. package/dist/components/ui/Separator.d.ts +7 -0
  258. package/dist/components/ui/Separator.d.ts.map +1 -0
  259. package/dist/components/ui/Separator.js +8 -0
  260. package/dist/components/ui/Textarea.d.ts +8 -0
  261. package/dist/components/ui/Textarea.d.ts.map +1 -0
  262. package/dist/components/ui/Textarea.js +5 -0
  263. package/dist/components/ui/Tooltip.d.ts +9 -0
  264. package/dist/components/ui/Tooltip.d.ts.map +1 -0
  265. package/dist/components/ui/Tooltip.js +7 -0
  266. package/dist/components/ui/index.d.ts +14 -0
  267. package/dist/components/ui/index.d.ts.map +1 -0
  268. package/dist/components/ui/index.js +17 -0
  269. package/dist/data-schemas.d.mts +0 -1
  270. package/dist/data-schemas.d.mts.map +1 -1
  271. package/dist/data-schemas.d.ts +22 -0
  272. package/dist/data-schemas.d.ts.map +1 -0
  273. package/dist/data-schemas.js +51 -0
  274. package/dist/data-schemas.mjs +3 -4
  275. package/dist/data-schemas.mjs.map +1 -1
  276. package/dist/dev-entry.d.ts +2 -0
  277. package/dist/dev-entry.d.ts.map +1 -0
  278. package/dist/dev-entry.js +19 -0
  279. package/dist/dialog.d.mts +56 -0
  280. package/dist/dialog.d.mts.map +1 -0
  281. package/dist/dialog.mjs +67 -0
  282. package/dist/dialog.mjs.map +1 -0
  283. package/dist/hooks/index.d.ts +10 -0
  284. package/dist/hooks/index.d.ts.map +1 -0
  285. package/dist/hooks/index.js +7 -0
  286. package/dist/hooks/useCanvasTheme.d.ts +12 -0
  287. package/dist/hooks/useCanvasTheme.d.ts.map +1 -0
  288. package/dist/hooks/useCanvasTheme.js +33 -0
  289. package/dist/hooks/useClickOutside.d.ts +7 -0
  290. package/dist/hooks/useClickOutside.d.ts.map +1 -0
  291. package/dist/hooks/useClickOutside.js +18 -0
  292. package/dist/hooks/useDialogState.d.ts +23 -0
  293. package/dist/hooks/useDialogState.d.ts.map +1 -0
  294. package/dist/hooks/useDialogState.js +31 -0
  295. package/dist/hooks/useEditorPref.d.ts +2 -0
  296. package/dist/hooks/useEditorPref.d.ts.map +1 -0
  297. package/dist/hooks/useEditorPref.js +49 -0
  298. package/dist/hooks/useErrorModal.d.ts +15 -0
  299. package/dist/hooks/useErrorModal.d.ts.map +1 -0
  300. package/dist/hooks/useErrorModal.js +35 -0
  301. package/dist/hooks/useSiteBaseUrl.d.ts +10 -0
  302. package/dist/hooks/useSiteBaseUrl.d.ts.map +1 -0
  303. package/dist/hooks/useSiteBaseUrl.js +14 -0
  304. package/dist/hooks/useTheme.d.ts +13 -0
  305. package/dist/hooks/useTheme.d.ts.map +1 -0
  306. package/dist/hooks/useTheme.js +69 -0
  307. package/dist/hooks/useUnsavedChangesGuard.d.ts +16 -0
  308. package/dist/hooks/useUnsavedChangesGuard.d.ts.map +1 -0
  309. package/dist/hooks/useUnsavedChangesGuard.js +29 -0
  310. package/dist/hooks/useUpload.d.ts +10 -0
  311. package/dist/hooks/useUpload.d.ts.map +1 -0
  312. package/dist/hooks/useUpload.js +42 -0
  313. package/dist/hooks/useUploadFlow.d.ts +42 -0
  314. package/dist/hooks/useUploadFlow.d.ts.map +1 -0
  315. package/dist/hooks/useUploadFlow.js +148 -0
  316. package/dist/host-style-probe.d.ts +22 -0
  317. package/dist/host-style-probe.d.ts.map +1 -0
  318. package/dist/host-style-probe.js +508 -0
  319. package/dist/index.d.mts +165 -48
  320. package/dist/index.d.mts.map +1 -1
  321. package/dist/index.d.ts +10 -0
  322. package/dist/index.d.ts.map +1 -0
  323. package/dist/index.js +12 -0
  324. package/dist/index.mjs +36 -2
  325. package/dist/index.mjs.map +1 -0
  326. package/dist/lib/utils.d.ts +13 -0
  327. package/dist/lib/utils.d.ts.map +1 -0
  328. package/dist/lib/utils.js +47 -0
  329. package/dist/main-spa-781YUplS.mjs +46 -0
  330. package/dist/main-spa-781YUplS.mjs.map +1 -0
  331. package/dist/main-spa.d.ts +8 -0
  332. package/dist/main-spa.d.ts.map +1 -0
  333. package/dist/main-spa.js +61 -0
  334. package/dist/main.d.mts +1 -1
  335. package/dist/main.d.ts +2 -0
  336. package/dist/main.d.ts.map +1 -0
  337. package/dist/main.js +13 -0
  338. package/dist/main.mjs +11 -4998
  339. package/dist/main.mjs.map +1 -1
  340. package/dist/mdx-components.d.mts +207 -0
  341. package/dist/mdx-components.d.mts.map +1 -0
  342. package/dist/mdx-components.d.ts +204 -0
  343. package/dist/mdx-components.d.ts.map +1 -0
  344. package/dist/mdx-components.js +217 -0
  345. package/dist/mdx-components.mjs +208 -0
  346. package/dist/mdx-components.mjs.map +1 -0
  347. package/dist/media/AssetScopePill.d.ts +30 -0
  348. package/dist/media/AssetScopePill.d.ts.map +1 -0
  349. package/dist/media/AssetScopePill.js +30 -0
  350. package/dist/media/MediaIssueBadge.d.ts +33 -0
  351. package/dist/media/MediaIssueBadge.d.ts.map +1 -0
  352. package/dist/media/MediaIssueBadge.js +54 -0
  353. package/dist/media/types.d.ts +101 -0
  354. package/dist/media/types.d.ts.map +1 -0
  355. package/dist/media/types.js +1 -0
  356. package/dist/media/use-asset-scope.d.ts +25 -0
  357. package/dist/media/use-asset-scope.d.ts.map +1 -0
  358. package/dist/media/use-asset-scope.js +54 -0
  359. package/dist/media/use-media-issue.d.ts +24 -0
  360. package/dist/media/use-media-issue.d.ts.map +1 -0
  361. package/dist/media/use-media-issue.js +49 -0
  362. package/dist/mock-puck-config.d.mts +23 -0
  363. package/dist/mock-puck-config.d.mts.map +1 -0
  364. package/dist/mock-puck-config.d.ts +21 -0
  365. package/dist/mock-puck-config.d.ts.map +1 -0
  366. package/dist/mock-puck-config.js +73 -0
  367. package/dist/mock-puck-config.mjs +125 -0
  368. package/dist/mock-puck-config.mjs.map +1 -0
  369. package/dist/page-schemas.d.mts +139 -6
  370. package/dist/page-schemas.d.mts.map +1 -1
  371. package/dist/page-schemas.d.ts +156 -0
  372. package/dist/page-schemas.d.ts.map +1 -0
  373. package/dist/page-schemas.js +118 -0
  374. package/dist/page-schemas.mjs +74 -6
  375. package/dist/page-schemas.mjs.map +1 -1
  376. package/dist/puck-config.d.mts +9 -1
  377. package/dist/puck-config.d.mts.map +1 -1
  378. package/dist/puck-config.d.ts +31 -0
  379. package/dist/puck-config.d.ts.map +1 -0
  380. package/dist/puck-config.js +50 -0
  381. package/dist/puck-config.mjs +3 -4
  382. package/dist/puck-config.mjs.map +1 -1
  383. package/dist/selected-block.d.ts +61 -0
  384. package/dist/selected-block.d.ts.map +1 -0
  385. package/dist/selected-block.js +64 -0
  386. package/dist/site-styles.d.mts +123 -0
  387. package/dist/site-styles.d.mts.map +1 -0
  388. package/dist/site-styles.d.ts +121 -0
  389. package/dist/site-styles.d.ts.map +1 -0
  390. package/dist/site-styles.js +253 -0
  391. package/dist/site-styles.mjs +234 -0
  392. package/dist/site-styles.mjs.map +1 -0
  393. package/dist/spa/main.css +5497 -4371
  394. package/dist/toast.d.mts +7 -0
  395. package/dist/toast.d.mts.map +1 -0
  396. package/dist/toast.mjs +16 -0
  397. package/dist/toast.mjs.map +1 -0
  398. package/dist/types.d.ts +57 -0
  399. package/dist/types.d.ts.map +1 -0
  400. package/dist/types.js +1 -0
  401. package/dist/ui-CIacC6Mv.mjs +318 -0
  402. package/dist/ui-CIacC6Mv.mjs.map +1 -0
  403. package/dist/ui-config.d.ts +70 -0
  404. package/dist/ui-config.d.ts.map +1 -0
  405. package/dist/ui-config.js +44 -0
  406. package/dist/ui.d.mts +290 -0
  407. package/dist/ui.d.mts.map +1 -0
  408. package/dist/ui.mjs +2 -0
  409. package/dist/utils/asset-url.d.ts +3 -0
  410. package/dist/utils/asset-url.d.ts.map +1 -0
  411. package/dist/utils/asset-url.js +7 -0
  412. package/dist/utils/cn.d.ts +3 -0
  413. package/dist/utils/cn.d.ts.map +1 -0
  414. package/dist/utils/cn.js +5 -0
  415. package/dist/utils/format-date.d.ts +15 -0
  416. package/dist/utils/format-date.d.ts.map +1 -0
  417. package/dist/utils/format-date.js +37 -0
  418. package/dist/utils/mdast-to-html.d.ts +55 -0
  419. package/dist/utils/mdast-to-html.d.ts.map +1 -0
  420. package/dist/utils/mdast-to-html.js +206 -0
  421. package/dist/utils/mdast-tree.d.ts +104 -0
  422. package/dist/utils/mdast-tree.d.ts.map +1 -0
  423. package/dist/utils/mdast-tree.js +285 -0
  424. package/dist/utils/pageMetadata.d.ts +67 -0
  425. package/dist/utils/pageMetadata.d.ts.map +1 -0
  426. package/dist/utils/pageMetadata.js +161 -0
  427. package/dist/utils/slugify.d.ts +12 -0
  428. package/dist/utils/slugify.d.ts.map +1 -0
  429. package/dist/utils/slugify.js +17 -0
  430. package/dist/utils/zodIntrospect.d.ts +24 -0
  431. package/dist/utils/zodIntrospect.d.ts.map +1 -0
  432. package/dist/utils/zodIntrospect.js +88 -0
  433. package/package.json +153 -35
  434. package/styles/styles.css.d.ts +2 -0
  435. package/styles/tailwind-theme.css +126 -0
  436. package/styles/tailwind-theme.css.d.ts +2 -0
  437. package/dist/puck-CvjeYQRH.mjs +0 -1533
  438. package/dist/puck-CvjeYQRH.mjs.map +0 -1
@@ -0,0 +1,508 @@
1
+ import { useEffect, useState } from 'react';
2
+ /**
3
+ * Host-style probe — captures the host's computed styles for prose
4
+ * elements directly from the rendered live page, then exposes a
5
+ * stylesheet the editor can inject so its typed elements look like
6
+ * the published ones.
7
+ *
8
+ * Why a probe exists alongside the CSS grabber + wrapper auto-copy:
9
+ *
10
+ * - The CSS grabber + wrapper auto-copy work when the host styles
11
+ * prose through CLASS-on-WRAPPER descendant selectors:
12
+ * `.sl-markdown-content h1 { ... }`, `.prose h1 { ... }`. The editor
13
+ * gets wrapped in a clone of the host's wrapper, and the host's
14
+ * already-grabbed CSS reaches its typed elements via the cascade.
15
+ *
16
+ * - But some hosts style prose differently:
17
+ * - Utility-first Tailwind: `<h1 class="text-5xl font-bold">` — the
18
+ * styling is per-element via utility classes. The editor's typed
19
+ * `<h1>` has no utility classes; cascade can't help.
20
+ * - Inline styles: `<h1 style="...">` — only applies to that one
21
+ * element; not reusable via cascade.
22
+ *
23
+ * For both cases, the FINAL rendered styles still resolve to a
24
+ * normal set of CSS property values. `getComputedStyle()` reads
25
+ * them regardless of source. The probe captures those final values
26
+ * from a real rendered sample on the live page and synthesizes a
27
+ * stylesheet — `.conloca-prose--editor h1 { font-size: ...; ... }`
28
+ * — that styles the editor's typed elements to match.
29
+ *
30
+ * Approach:
31
+ *
32
+ * 1. Open a hidden same-origin iframe to the page's published URL.
33
+ * 2. Find the host's prose wrapper inside the iframe (or fall back
34
+ * to `<main>` / `<body>`).
35
+ * 3. For each prose tag we care about, prefer an existing element
36
+ * in the wrapper (so utility classes / inline styles on real
37
+ * elements are observed). Inject a synthetic probe element when
38
+ * no existing sample is present — descendant-selector hosts
39
+ * style the synthetic via the cascade.
40
+ * 4. Read the relevant computed style properties; build a CSS rule
41
+ * scoped to `.conloca-prose--editor <tag>`.
42
+ * 5. Tear down the iframe.
43
+ *
44
+ * Generic across hosts because it never reads source CSS — it reads
45
+ * the cascade's resolved output. Descendant selectors, utility
46
+ * classes, and inline styles all funnel into `getComputedStyle()`
47
+ * the same way.
48
+ */
49
+ /** Prose elements whose computed styles we capture, split by how
50
+ * they need to be probed. Block-level tags get probed directly under
51
+ * the prose wrapper (their styles don't depend on inline context).
52
+ * Inline tags get probed INSIDE a synthetic `<p>` so their font-size
53
+ * inherits from paragraph context, not from a heading they might
54
+ * happen to appear inside on the live page (eg an anchor inside an
55
+ * <h2> would otherwise capture 35px as its font-size and the editor's
56
+ * inline links would all render heading-sized).
57
+ *
58
+ * `li`, `th`, `td` are inline-context tags too: they're inside a
59
+ * parent (`ul`/`ol`, `tr`) that establishes their typography. We
60
+ * probe them directly under the wrapper because their parent's
61
+ * styling is captured separately and the cascade handles inheritance. */
62
+ const BLOCK_PROBE_TAGS = [
63
+ 'h1',
64
+ 'h2',
65
+ 'h3',
66
+ 'h4',
67
+ 'h5',
68
+ 'h6',
69
+ 'p',
70
+ 'pre',
71
+ 'ul',
72
+ 'ol',
73
+ 'li',
74
+ 'blockquote',
75
+ 'table',
76
+ 'th',
77
+ 'td',
78
+ 'hr',
79
+ ];
80
+ const INLINE_PROBE_TAGS = ['a', 'strong', 'em', 'code'];
81
+ /** Computed-style properties to capture per tag. Chosen for breadth —
82
+ * we want enough to make the editor look similar without over-
83
+ * specifying things that vary by selection state or container. Skips
84
+ * `width`, `height`, `display`, etc. which would distort the editor's
85
+ * own layout. */
86
+ const PROBE_PROPS = [
87
+ 'font-family',
88
+ 'font-size',
89
+ 'font-weight',
90
+ 'font-style',
91
+ 'line-height',
92
+ 'letter-spacing',
93
+ 'color',
94
+ 'background-color',
95
+ 'margin-block-start',
96
+ 'margin-block-end',
97
+ 'margin-inline-start',
98
+ 'margin-inline-end',
99
+ 'padding-block-start',
100
+ 'padding-block-end',
101
+ 'padding-inline-start',
102
+ 'padding-inline-end',
103
+ 'border-radius',
104
+ 'border-top-width',
105
+ 'border-right-width',
106
+ 'border-bottom-width',
107
+ 'border-left-width',
108
+ 'border-top-style',
109
+ 'border-right-style',
110
+ 'border-bottom-style',
111
+ 'border-left-style',
112
+ 'border-top-color',
113
+ 'border-right-color',
114
+ 'border-bottom-color',
115
+ 'border-left-color',
116
+ 'text-decoration-line',
117
+ 'text-decoration-color',
118
+ 'text-decoration-thickness',
119
+ 'text-underline-offset',
120
+ 'list-style-type',
121
+ 'list-style-position',
122
+ ];
123
+ const IFRAME_TIMEOUT_MS = 10_000;
124
+ /**
125
+ * Locate the host's prose wrapper inside the iframe's document, given
126
+ * the className the server-side discovery already resolved (eg
127
+ * `sl-markdown-content` for Starlight, `prose` for Tailwind Typography).
128
+ * We avoid duplicating the find-wrapper heuristic here: the server-side
129
+ * `findContentWrapper` does the smart majority+depth walk against raw
130
+ * HTML and gives us the right answer. The probe just resolves that
131
+ * className back to an actual element inside the iframe.
132
+ *
133
+ * Returns null when the class isn't found (probe falls back to no-op)
134
+ * or when no className was provided (host has no classed wrapper).
135
+ */
136
+ function findWrapperByClass(doc, className) {
137
+ if (!className)
138
+ return doc.querySelector('main');
139
+ // Match an element carrying ALL the classes in the discovered name
140
+ // (preserves Astro scoped-hash matching: `astro-xxxx` must be on the
141
+ // same element). `.foo.bar` requires all listed classes.
142
+ const selector = `.${className.split(/\s+/).filter(Boolean).join('.')}`;
143
+ const found = doc.querySelector(selector);
144
+ return found ?? doc.querySelector('main') ?? null;
145
+ }
146
+ /**
147
+ * Read computed styles for each PROBE_TAG inside a freshly loaded
148
+ * iframe's document. Returns one CSS rule string per tag, scoped to
149
+ * `.conloca-prose--editor <tag>` so it targets the editor's typed
150
+ * elements without leaking into the rest of the admin chrome.
151
+ */
152
+ function buildProbeStylesheet(doc, wrapperClass) {
153
+ const wrapper = findWrapperByClass(doc, wrapperClass);
154
+ const view = doc.defaultView;
155
+ if (!view || !wrapper)
156
+ return '';
157
+ const rules = [];
158
+ // Wrapper-level: capture inherited typography (font-family, color,
159
+ // line-height, etc.) that the host's prose container resolves through
160
+ // BODY inheritance. The probe can't read the cascade source, only
161
+ // the resolved computed values, but that's exactly what we want here:
162
+ // whatever the host's body/wrapper combination computes to.
163
+ //
164
+ // Why this matters: hosts like Starlight set `font-family: var(--sl-font)`
165
+ // on body and never on `.sl-markdown-content`. On the published page
166
+ // the wrapper inherits Inter. In the editor, MDXEditor's `_editorRoot_*`
167
+ // wrapper rule sets `font-family: var(--font-body)` (a generic system
168
+ // stack) and `color: var(--baseText)` (its own palette). Inheritance
169
+ // flows through THAT to the host's `.sl-markdown-content` clone and
170
+ // then to the contenteditable. Probing the wrapper and emitting a
171
+ // direct `:where(.conloca-prose--editor) { font: ...; color: ... }`
172
+ // rule beats inheritance and restores the host's typography.
173
+ const wrapperRule = probeWrapper(view, wrapper);
174
+ if (wrapperRule)
175
+ rules.push(wrapperRule);
176
+ // Block-level: inject INSIDE a synthetic two-element sequence so
177
+ // adjacent-sibling rules fire during the probe. Hosts like Starlight
178
+ // apply prose spacing via `:not(...) + :not(...) { margin-top: ... }`
179
+ // — the rule only fires when an element has a preceding sibling. A
180
+ // single-sample probe would catch the first-child margin (zero) and
181
+ // override the host's adjacent-sibling rule via specificity, so the
182
+ // editor's later paragraphs/headings would render flush against each
183
+ // other.
184
+ //
185
+ // We always use `<p>` as the preceding sibling because: (a) every
186
+ // prose block tag commonly follows a paragraph in real content; (b)
187
+ // Starlight's spacing rules are sibling-type-agnostic except for the
188
+ // "heading after non-heading" rule, which also fires when the
189
+ // previous sibling is a `<p>`.
190
+ for (const tag of BLOCK_PROBE_TAGS) {
191
+ const rule = probeBlockTagInSiblingContext(view, wrapper, tag);
192
+ if (rule)
193
+ rules.push(rule);
194
+ }
195
+ // Inline: always inject inside a synthetic `<p>` (newly added under
196
+ // the wrapper) so font-size / line-height etc. inherit from a
197
+ // paragraph context. Otherwise an anchor we find inside a heading
198
+ // would tell us "links are 35px," and the editor's inline links
199
+ // would render heading-sized. Removed after probing.
200
+ const synthParent = doc.createElement('p');
201
+ synthParent.setAttribute('data-conloca-probe-parent', 'true');
202
+ wrapper.appendChild(synthParent);
203
+ try {
204
+ for (const tag of INLINE_PROBE_TAGS) {
205
+ const rule = probeInlineTag(view, synthParent, tag);
206
+ if (rule)
207
+ rules.push(rule);
208
+ }
209
+ }
210
+ finally {
211
+ synthParent.remove();
212
+ }
213
+ return rules.join('\n');
214
+ }
215
+ /**
216
+ * Probe a block tag with an injected `<p>` preceding sibling so any
217
+ * adjacent-sibling spacing rules in the host's CSS fire while reading
218
+ * computed styles. This gives the "this element follows other content"
219
+ * margin context that single-sample probing misses.
220
+ *
221
+ * Special-case: when probing `<p>` itself we use another `<p>` as
222
+ * the preceding sibling. For `<li>` and table-cell tags we need to
223
+ * inject them inside a parent (`<ul>`/`<ol>`/`<table>`), preceded by
224
+ * a sibling of the same kind so list-item and cell adjacency rules fire.
225
+ */
226
+ function probeBlockTagInSiblingContext(view, wrapper, tag) {
227
+ const doc = wrapper.ownerDocument;
228
+ // Build the synthetic context. The element we read is always
229
+ // `target` — everything before it just creates the right adjacency.
230
+ let host;
231
+ let target;
232
+ if (tag === 'li') {
233
+ host = doc.createElement('ul');
234
+ host.appendChild(makeProbeEl(doc, 'li'));
235
+ target = makeProbeEl(doc, 'li');
236
+ host.appendChild(target);
237
+ }
238
+ else if (tag === 'th' || tag === 'td') {
239
+ host = doc.createElement('table');
240
+ const tr1 = doc.createElement('tr');
241
+ tr1.appendChild(makeProbeEl(doc, tag));
242
+ host.appendChild(tr1);
243
+ const tr2 = doc.createElement('tr');
244
+ target = makeProbeEl(doc, tag);
245
+ tr2.appendChild(target);
246
+ host.appendChild(tr2);
247
+ }
248
+ else {
249
+ // Standard "block element after a paragraph" context.
250
+ host = doc.createElement('div');
251
+ host.setAttribute('data-conloca-probe-host', 'true');
252
+ host.appendChild(makeProbeEl(doc, 'p'));
253
+ target = makeProbeEl(doc, tag);
254
+ host.appendChild(target);
255
+ }
256
+ host.setAttribute('data-conloca-probe-host', 'true');
257
+ wrapper.appendChild(host);
258
+ try {
259
+ return generateRule(view, target, tag);
260
+ }
261
+ finally {
262
+ host.remove();
263
+ }
264
+ }
265
+ /** Properties read directly off the host's prose wrapper. These are the
266
+ * typography "defaults" that hosts conventionally set on body and let
267
+ * inherit down — the wrapper itself rarely overrides them, so its
268
+ * computed values reflect the host's resolved body typography.
269
+ *
270
+ * Excludes margin/padding/border/background: those are wrapper layout
271
+ * concerns that the editor shouldn't inherit (the editor lives inside
272
+ * the CMS SPA shell, not the host's page layout). */
273
+ const WRAPPER_PROBE_PROPS = [
274
+ 'font-family',
275
+ 'font-size',
276
+ 'font-weight',
277
+ 'font-style',
278
+ 'line-height',
279
+ 'letter-spacing',
280
+ 'color',
281
+ ];
282
+ /**
283
+ * Emit the host wrapper's computed typography as CSS custom properties
284
+ * on `:root`. The editor's `editor-styles.css` reads these via
285
+ * `var(--conloca-host-*)` on `[class*="_contentEditable_"]` to override
286
+ * MDXEditor's bundled typography (`color: var(--baseTextContrast)`,
287
+ * `font-family: var(--font-body)`).
288
+ *
289
+ * Why route through custom properties instead of styling the wrapper
290
+ * directly: MDXEditor's `._contentEditable_*` rule is unlayered, so any
291
+ * layered probe rule loses the cascade regardless of selector
292
+ * specificity. Custom properties inherit through cascade layers and can
293
+ * be consumed by an unlayered rule in `editor-styles.css`, which DOES
294
+ * compete on equal terms with MDXEditor and wins on source order
295
+ * (editor-styles.css is imported after `@mdxeditor/editor/style.css`).
296
+ *
297
+ * Property names: short, namespaced under `--conloca-host-`. Map 1:1 to
298
+ * the inheritance-eligible typography properties that drive prose look.
299
+ */
300
+ function probeWrapper(view, wrapper) {
301
+ const cs = view.getComputedStyle(wrapper);
302
+ const propMap = {
303
+ 'font-family': '--conloca-host-font-family',
304
+ 'font-size': '--conloca-host-font-size',
305
+ 'font-weight': '--conloca-host-font-weight',
306
+ 'font-style': '--conloca-host-font-style',
307
+ 'line-height': '--conloca-host-line-height',
308
+ 'letter-spacing': '--conloca-host-letter-spacing',
309
+ color: '--conloca-host-color',
310
+ };
311
+ const decls = [];
312
+ for (const prop of WRAPPER_PROBE_PROPS) {
313
+ const value = cs.getPropertyValue(prop);
314
+ if (value && value !== 'normal' && value !== 'none') {
315
+ decls.push(`${propMap[prop]}: ${value}`);
316
+ }
317
+ }
318
+ if (decls.length === 0)
319
+ return '';
320
+ return `:root { ${decls.join('; ')}; }`;
321
+ }
322
+ function makeProbeEl(doc, tag) {
323
+ const el = doc.createElement(tag);
324
+ el.textContent = 'probe';
325
+ el.setAttribute('data-conloca-probe', 'true');
326
+ return el;
327
+ }
328
+ /** Properties that only carry meaning on list-container tags (ul, ol).
329
+ * Inherited by descendants but only renders a marker on actual list
330
+ * items — emitting it on every tag would override `<ol>`'s `decimal`
331
+ * with `<li>`'s inherited `disc` (since `li` is more specific to the
332
+ * rendered element), making ordered lists show bullets instead of
333
+ * numbers. Filtered out for any tag other than ul/ol. */
334
+ const LIST_STYLE_PROPS = new Set(['list-style-type', 'list-style-position']);
335
+ function generateRule(view, sample, tag) {
336
+ const cs = view.getComputedStyle(sample);
337
+ const decls = [];
338
+ const isListContainer = tag === 'ul' || tag === 'ol';
339
+ for (const prop of PROBE_PROPS) {
340
+ if (LIST_STYLE_PROPS.has(prop) && !isListContainer)
341
+ continue;
342
+ const value = cs.getPropertyValue(prop);
343
+ if (value && value !== 'normal' && value !== 'none') {
344
+ decls.push(`${prop}: ${value}`);
345
+ }
346
+ }
347
+ if (decls.length === 0)
348
+ return '';
349
+ // Wrap the wrapper class in `:where()` so the selector has the same
350
+ // specificity as a bare element selector (0,0,1). Without :where(),
351
+ // `.conloca-prose--editor ol` has specificity (0,1,1) — higher than
352
+ // host component rules like `.sl-steps` (0,1,0), so the probe's
353
+ // "ol defaults" override component-specific styling on `<ol>`
354
+ // elements that carry component classes (Steps, Tabs, etc.).
355
+ // With :where() the probe acts as a defaults layer for BARE prose
356
+ // tags: any host class selector targeting the same element wins.
357
+ return `:where(.conloca-prose--editor) ${tag} { ${decls.join('; ')}; }`;
358
+ }
359
+ /**
360
+ * Probe an inline tag inside the given parent (a synthetic `<p>` from
361
+ * the caller). Inline tags need a paragraph context so font-size etc.
362
+ * inherit from the right place — otherwise an `<a>` found inside an
363
+ * `<h2>` would capture heading-sized text.
364
+ */
365
+ function probeInlineTag(view, parent, tag) {
366
+ const doc = parent.ownerDocument;
367
+ const sample = makeProbeEl(doc, tag);
368
+ parent.appendChild(sample);
369
+ try {
370
+ return generateRule(view, sample, tag);
371
+ }
372
+ finally {
373
+ sample.remove();
374
+ }
375
+ }
376
+ /**
377
+ * Run a one-shot probe against `routeUrl`. Returns the generated
378
+ * stylesheet, or an empty string when the iframe failed to load or
379
+ * the page had no probable elements.
380
+ *
381
+ * `signal` lets the caller cancel a probe (eg the user navigated to
382
+ * a different page mid-fetch). Cleanup is best-effort.
383
+ */
384
+ export function probeHostStyles(routeUrl, wrapperClass, theme, signal) {
385
+ return new Promise((resolve) => {
386
+ if (typeof document === 'undefined') {
387
+ resolve('');
388
+ return;
389
+ }
390
+ const iframe = document.createElement('iframe');
391
+ // Width chosen so responsive prose styles resolve at their desktop
392
+ // tier (Starlight's `--sl-text-h2` etc. shift via media queries; a
393
+ // narrower probe captures the mobile-ish values which don't match
394
+ // what the editor's user actually sees). 1440px is a sane "desktop"
395
+ // default. The iframe is off-screen and hidden so width affects
396
+ // only CSS resolution, not user-visible layout.
397
+ iframe.style.cssText = 'position:absolute;left:-9999px;top:0;width:1440px;height:900px;visibility:hidden;border:0';
398
+ iframe.setAttribute('aria-hidden', 'true');
399
+ iframe.setAttribute('tabindex', '-1');
400
+ iframe.setAttribute('data-conloca-probe-iframe', '');
401
+ iframe.src = routeUrl;
402
+ let settled = false;
403
+ const cleanup = () => {
404
+ if (iframe.parentElement)
405
+ iframe.parentElement.removeChild(iframe);
406
+ };
407
+ const settle = (css) => {
408
+ if (settled)
409
+ return;
410
+ settled = true;
411
+ cleanup();
412
+ resolve(css);
413
+ };
414
+ const abortHandler = () => settle('');
415
+ signal?.addEventListener('abort', abortHandler);
416
+ const timeout = window.setTimeout(() => {
417
+ console.warn('[Conloca] Host style probe timed out for', routeUrl);
418
+ settle('');
419
+ }, IFRAME_TIMEOUT_MS);
420
+ iframe.addEventListener('load', () => {
421
+ window.clearTimeout(timeout);
422
+ // Force the iframe's theme to MATCH the editor's currently-active
423
+ // theme — not whatever the website's own theme provider resolved
424
+ // from its own localStorage key. The editor and the published
425
+ // page maintain independent theme preferences (the CMS SPA uses
426
+ // `conloca-theme`; Starlight uses `starlight-theme`), so by default
427
+ // the iframe paints in the website's last-saved scheme regardless
428
+ // of what the user is editing in. We override `data-theme` (and
429
+ // mirror as `.dark` class for Tailwind-style hosts) so the probe
430
+ // captures the scheme the editor is rendering, not the published
431
+ // page's stale scheme.
432
+ try {
433
+ const doc = iframe.contentDocument;
434
+ if (doc && theme) {
435
+ doc.documentElement.dataset.theme = theme;
436
+ doc.documentElement.classList.toggle('dark', theme === 'dark');
437
+ doc.documentElement.style.colorScheme = theme;
438
+ }
439
+ }
440
+ catch (err) {
441
+ // Same-origin iframe access can throw if the dev server emitted
442
+ // a sandboxed page; swallow and proceed with the probe anyway —
443
+ // worst case we capture the website's default theme values.
444
+ console.warn('[Conloca] Could not set probe iframe theme:', err);
445
+ }
446
+ // Two rAFs: first lands us after layout, second after the
447
+ // browser has applied any deferred styles (web fonts, etc.) AND
448
+ // any theme-attribute change applied above has propagated through
449
+ // the cascade. 2× rAF is a common idiom for "next paint with
450
+ // fonts ready."
451
+ requestAnimationFrame(() => {
452
+ requestAnimationFrame(() => {
453
+ if (signal?.aborted) {
454
+ settle('');
455
+ return;
456
+ }
457
+ try {
458
+ const doc = iframe.contentDocument;
459
+ if (!doc) {
460
+ settle('');
461
+ return;
462
+ }
463
+ const css = buildProbeStylesheet(doc, wrapperClass);
464
+ settle(css);
465
+ }
466
+ catch (err) {
467
+ console.warn('[Conloca] Host style probe failed:', err);
468
+ settle('');
469
+ }
470
+ });
471
+ });
472
+ });
473
+ iframe.addEventListener('error', () => {
474
+ window.clearTimeout(timeout);
475
+ settle('');
476
+ });
477
+ document.body.appendChild(iframe);
478
+ });
479
+ }
480
+ /**
481
+ * React hook wrapper. Re-probes whenever `routeUrl` changes or the
482
+ * document's theme attribute changes (so dark/light swaps refresh
483
+ * the captured styles).
484
+ *
485
+ * Returns the generated stylesheet as a single string. Callers feed
486
+ * it into `useInjectHostStyles` (or any other stylesheet injector)
487
+ * with a sensible layer name.
488
+ */
489
+ export function useProbedHostStyles(routeUrl, wrapperClass, options = {}) {
490
+ const [css, setCss] = useState('');
491
+ const theme = options.theme ?? null;
492
+ useEffect(() => {
493
+ if (!routeUrl) {
494
+ setCss('');
495
+ return;
496
+ }
497
+ const controller = new AbortController();
498
+ probeHostStyles(routeUrl, wrapperClass, theme, controller.signal).then((result) => {
499
+ if (controller.signal.aborted)
500
+ return;
501
+ setCss(result);
502
+ });
503
+ return () => {
504
+ controller.abort();
505
+ };
506
+ }, [routeUrl, wrapperClass, theme]);
507
+ return css;
508
+ }