@jhits/plugin-blog 0.0.8 → 0.0.10

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 (439) hide show
  1. package/dist/api/categories.d.ts +8 -0
  2. package/dist/api/categories.d.ts.map +1 -0
  3. package/dist/api/categories.js +30 -0
  4. package/dist/api/check-title.d.ts +8 -0
  5. package/dist/api/check-title.d.ts.map +1 -0
  6. package/dist/api/check-title.js +47 -0
  7. package/dist/api/config-handler.d.ts +21 -0
  8. package/dist/api/config-handler.d.ts.map +1 -0
  9. package/dist/api/config-handler.js +46 -0
  10. package/dist/api/handler.d.ts +42 -0
  11. package/dist/api/handler.d.ts.map +1 -0
  12. package/dist/api/handler.js +331 -0
  13. package/dist/api/index.d.ts +12 -0
  14. package/dist/api/index.d.ts.map +1 -0
  15. package/dist/api/index.js +12 -0
  16. package/dist/api/route.d.ts +50 -0
  17. package/dist/api/route.d.ts.map +1 -0
  18. package/dist/api/route.js +69 -0
  19. package/dist/api/router.d.ts +27 -0
  20. package/dist/api/router.d.ts.map +1 -0
  21. package/dist/api/router.js +98 -0
  22. package/dist/api-server.d.ts +9 -0
  23. package/dist/api-server.d.ts.map +1 -0
  24. package/dist/api-server.js +9 -0
  25. package/dist/config.d.ts +14 -0
  26. package/dist/config.d.ts.map +1 -0
  27. package/dist/config.js +156 -0
  28. package/dist/hooks/index.d.ts +8 -0
  29. package/dist/hooks/index.d.ts.map +1 -0
  30. package/dist/hooks/index.js +7 -0
  31. package/dist/hooks/useBlog.d.ts +31 -0
  32. package/dist/hooks/useBlog.d.ts.map +1 -0
  33. package/dist/hooks/useBlog.js +57 -0
  34. package/dist/hooks/useBlogs.d.ts +39 -0
  35. package/dist/hooks/useBlogs.d.ts.map +1 -0
  36. package/dist/hooks/useBlogs.js +82 -0
  37. package/dist/hooks/useCategories.d.ts +9 -0
  38. package/dist/hooks/useCategories.d.ts.map +1 -0
  39. package/dist/hooks/useCategories.js +70 -0
  40. package/dist/index.d.ts +55 -0
  41. package/dist/index.d.ts.map +1 -0
  42. package/dist/index.js +228 -0
  43. package/dist/index.server.d.ts +12 -0
  44. package/dist/index.server.d.ts.map +1 -0
  45. package/dist/index.server.js +10 -0
  46. package/dist/init.d.ts +40 -0
  47. package/dist/init.d.ts.map +1 -0
  48. package/dist/init.js +41 -0
  49. package/dist/lib/blocks/BlockRenderer.d.ts +54 -0
  50. package/dist/lib/blocks/BlockRenderer.d.ts.map +1 -0
  51. package/dist/lib/blocks/BlockRenderer.js +54 -0
  52. package/dist/lib/blocks/index.d.ts +5 -0
  53. package/dist/lib/blocks/index.d.ts.map +1 -0
  54. package/dist/lib/blocks/index.js +4 -0
  55. package/dist/lib/config-storage.d.ts +30 -0
  56. package/dist/lib/config-storage.d.ts.map +1 -0
  57. package/dist/lib/config-storage.js +31 -0
  58. package/dist/lib/index.d.ts +8 -0
  59. package/dist/lib/index.d.ts.map +1 -0
  60. package/dist/lib/index.js +7 -0
  61. package/dist/lib/layouts/blocks/ColumnsBlock.d.ts +25 -0
  62. package/dist/lib/layouts/blocks/ColumnsBlock.d.ts.map +1 -0
  63. package/dist/lib/layouts/blocks/ColumnsBlock.js +186 -0
  64. package/dist/lib/layouts/blocks/SectionBlock.d.ts +25 -0
  65. package/dist/lib/layouts/blocks/SectionBlock.d.ts.map +1 -0
  66. package/dist/lib/layouts/blocks/SectionBlock.js +44 -0
  67. package/dist/lib/layouts/blocks/index.d.ts +7 -0
  68. package/dist/lib/layouts/blocks/index.d.ts.map +1 -0
  69. package/dist/lib/layouts/blocks/index.js +6 -0
  70. package/dist/lib/layouts/index.d.ts +23 -0
  71. package/dist/lib/layouts/index.d.ts.map +1 -0
  72. package/dist/lib/layouts/index.js +45 -0
  73. package/dist/lib/layouts/registerLayoutBlocks.d.ts +9 -0
  74. package/dist/lib/layouts/registerLayoutBlocks.d.ts.map +1 -0
  75. package/dist/lib/layouts/registerLayoutBlocks.js +60 -0
  76. package/dist/lib/mappers/apiMapper.d.ts +66 -0
  77. package/dist/lib/mappers/apiMapper.d.ts.map +1 -0
  78. package/dist/lib/mappers/apiMapper.js +188 -0
  79. package/dist/lib/migration/index.d.ts +5 -0
  80. package/dist/lib/migration/index.d.ts.map +1 -0
  81. package/dist/lib/migration/index.js +4 -0
  82. package/dist/lib/migration/mapper.d.ts +37 -0
  83. package/dist/lib/migration/mapper.d.ts.map +1 -0
  84. package/dist/lib/migration/mapper.js +98 -0
  85. package/dist/lib/rich-text/RichTextEditor.d.ts +45 -0
  86. package/dist/lib/rich-text/RichTextEditor.d.ts.map +1 -0
  87. package/dist/lib/rich-text/RichTextEditor.js +556 -0
  88. package/dist/lib/rich-text/RichTextPreview.d.ts +16 -0
  89. package/dist/lib/rich-text/RichTextPreview.d.ts.map +1 -0
  90. package/dist/lib/rich-text/RichTextPreview.js +144 -0
  91. package/dist/lib/rich-text/index.d.ts +9 -0
  92. package/dist/lib/rich-text/index.d.ts.map +1 -0
  93. package/dist/lib/rich-text/index.js +6 -0
  94. package/dist/lib/utils/blockHelpers.d.ts +23 -0
  95. package/dist/lib/utils/blockHelpers.d.ts.map +1 -0
  96. package/dist/lib/utils/blockHelpers.js +65 -0
  97. package/dist/lib/utils/configValidation.d.ts +23 -0
  98. package/dist/lib/utils/configValidation.d.ts.map +1 -0
  99. package/dist/lib/utils/configValidation.js +111 -0
  100. package/dist/lib/utils/index.d.ts +7 -0
  101. package/dist/lib/utils/index.d.ts.map +1 -0
  102. package/dist/lib/utils/index.js +6 -0
  103. package/dist/lib/utils/slugify.d.ts +25 -0
  104. package/dist/lib/utils/slugify.d.ts.map +1 -0
  105. package/dist/lib/utils/slugify.js +65 -0
  106. package/dist/registry/BlockRegistry.d.ts +62 -0
  107. package/dist/registry/BlockRegistry.d.ts.map +1 -0
  108. package/dist/registry/BlockRegistry.js +112 -0
  109. package/dist/registry/index.d.ts +6 -0
  110. package/dist/registry/index.d.ts.map +1 -0
  111. package/dist/registry/index.js +4 -0
  112. package/dist/state/EditorContext.d.ts +45 -0
  113. package/dist/state/EditorContext.d.ts.map +1 -0
  114. package/dist/state/EditorContext.js +215 -0
  115. package/dist/state/index.d.ts +7 -0
  116. package/dist/state/index.d.ts.map +1 -0
  117. package/dist/state/index.js +6 -0
  118. package/dist/state/reducer.d.ts +11 -0
  119. package/dist/state/reducer.d.ts.map +1 -0
  120. package/dist/state/reducer.js +599 -0
  121. package/dist/state/types.d.ts +162 -0
  122. package/dist/state/types.d.ts.map +1 -0
  123. package/dist/state/types.js +27 -0
  124. package/dist/types/block.d.ts +221 -0
  125. package/dist/types/block.d.ts.map +1 -0
  126. package/dist/types/block.js +6 -0
  127. package/dist/types/index.d.ts +8 -0
  128. package/dist/types/index.d.ts.map +1 -0
  129. package/dist/types/index.js +5 -0
  130. package/dist/types/post.d.ts +136 -0
  131. package/dist/types/post.d.ts.map +1 -0
  132. package/dist/types/post.js +5 -0
  133. package/dist/utils/client.d.ts +48 -0
  134. package/dist/utils/client.d.ts.map +1 -0
  135. package/dist/utils/client.js +77 -0
  136. package/dist/utils/index.d.ts +6 -0
  137. package/dist/utils/index.d.ts.map +1 -0
  138. package/dist/utils/index.js +5 -0
  139. package/dist/views/CanvasEditor/BlockWrapper.d.ts +16 -0
  140. package/dist/views/CanvasEditor/BlockWrapper.d.ts.map +1 -0
  141. package/dist/views/CanvasEditor/BlockWrapper.js +285 -0
  142. package/dist/views/CanvasEditor/CanvasEditorView.d.ts +14 -0
  143. package/dist/views/CanvasEditor/CanvasEditorView.d.ts.map +1 -0
  144. package/dist/views/CanvasEditor/CanvasEditorView.js +215 -0
  145. package/dist/views/CanvasEditor/EditorBody.d.ts +22 -0
  146. package/dist/views/CanvasEditor/EditorBody.d.ts.map +1 -0
  147. package/dist/views/CanvasEditor/EditorBody.js +505 -0
  148. package/dist/views/CanvasEditor/EditorHeader.d.ts +18 -0
  149. package/dist/views/CanvasEditor/EditorHeader.d.ts.map +1 -0
  150. package/dist/views/CanvasEditor/EditorHeader.js +101 -0
  151. package/dist/views/CanvasEditor/LayoutContainer.d.ts +17 -0
  152. package/dist/views/CanvasEditor/LayoutContainer.d.ts.map +1 -0
  153. package/dist/views/CanvasEditor/LayoutContainer.js +222 -0
  154. package/dist/views/CanvasEditor/SaveConfirmationModal.d.ts +13 -0
  155. package/dist/views/CanvasEditor/SaveConfirmationModal.d.ts.map +1 -0
  156. package/dist/views/CanvasEditor/SaveConfirmationModal.js +78 -0
  157. package/dist/views/CanvasEditor/components/CustomBlockItem.d.ts +14 -0
  158. package/dist/views/CanvasEditor/components/CustomBlockItem.d.ts.map +1 -0
  159. package/dist/views/CanvasEditor/components/CustomBlockItem.js +44 -0
  160. package/dist/views/CanvasEditor/components/EditorCanvas.d.ts +29 -0
  161. package/dist/views/CanvasEditor/components/EditorCanvas.d.ts.map +1 -0
  162. package/dist/views/CanvasEditor/components/EditorCanvas.js +32 -0
  163. package/dist/views/CanvasEditor/components/EditorLibrary.d.ts +7 -0
  164. package/dist/views/CanvasEditor/components/EditorLibrary.d.ts.map +1 -0
  165. package/dist/views/CanvasEditor/components/EditorLibrary.js +25 -0
  166. package/dist/views/CanvasEditor/components/EditorSidebar.d.ts +13 -0
  167. package/dist/views/CanvasEditor/components/EditorSidebar.d.ts.map +1 -0
  168. package/dist/views/CanvasEditor/components/EditorSidebar.js +19 -0
  169. package/dist/views/CanvasEditor/components/ErrorBanner.d.ts +6 -0
  170. package/dist/views/CanvasEditor/components/ErrorBanner.d.ts.map +1 -0
  171. package/dist/views/CanvasEditor/components/ErrorBanner.js +8 -0
  172. package/dist/views/CanvasEditor/components/FeaturedMediaSection.d.ts +25 -0
  173. package/dist/views/CanvasEditor/components/FeaturedMediaSection.d.ts.map +1 -0
  174. package/dist/views/CanvasEditor/components/FeaturedMediaSection.js +199 -0
  175. package/dist/views/CanvasEditor/components/LibraryItem.d.ts +14 -0
  176. package/dist/views/CanvasEditor/components/LibraryItem.d.ts.map +1 -0
  177. package/dist/views/CanvasEditor/components/LibraryItem.js +43 -0
  178. package/dist/views/CanvasEditor/components/PrivacySettingsSection.d.ts +15 -0
  179. package/dist/views/CanvasEditor/components/PrivacySettingsSection.d.ts.map +1 -0
  180. package/dist/views/CanvasEditor/components/PrivacySettingsSection.js +70 -0
  181. package/dist/views/CanvasEditor/components/index.d.ts +21 -0
  182. package/dist/views/CanvasEditor/components/index.d.ts.map +1 -0
  183. package/dist/views/CanvasEditor/components/index.js +12 -0
  184. package/dist/views/CanvasEditor/hooks/index.d.ts +10 -0
  185. package/dist/views/CanvasEditor/hooks/index.d.ts.map +1 -0
  186. package/dist/views/CanvasEditor/hooks/index.js +9 -0
  187. package/dist/views/CanvasEditor/hooks/useHeroBlock.d.ts +8 -0
  188. package/dist/views/CanvasEditor/hooks/useHeroBlock.d.ts.map +1 -0
  189. package/dist/views/CanvasEditor/hooks/useHeroBlock.js +90 -0
  190. package/dist/views/CanvasEditor/hooks/useKeyboardShortcuts.d.ts +3 -0
  191. package/dist/views/CanvasEditor/hooks/useKeyboardShortcuts.d.ts.map +1 -0
  192. package/dist/views/CanvasEditor/hooks/useKeyboardShortcuts.js +119 -0
  193. package/dist/views/CanvasEditor/hooks/usePostLoader.d.ts +5 -0
  194. package/dist/views/CanvasEditor/hooks/usePostLoader.d.ts.map +1 -0
  195. package/dist/views/CanvasEditor/hooks/usePostLoader.js +32 -0
  196. package/dist/views/CanvasEditor/hooks/useRegisteredBlocks.d.ts +2 -0
  197. package/dist/views/CanvasEditor/hooks/useRegisteredBlocks.d.ts.map +1 -0
  198. package/dist/views/CanvasEditor/hooks/useRegisteredBlocks.js +47 -0
  199. package/dist/views/CanvasEditor/hooks/useUnsavedChanges.d.ts +25 -0
  200. package/dist/views/CanvasEditor/hooks/useUnsavedChanges.d.ts.map +1 -0
  201. package/dist/views/CanvasEditor/hooks/useUnsavedChanges.js +285 -0
  202. package/dist/views/CanvasEditor/index.d.ts +16 -0
  203. package/dist/views/CanvasEditor/index.d.ts.map +1 -0
  204. package/dist/views/CanvasEditor/index.js +9 -0
  205. package/dist/views/PostManager/EmptyState.d.ts +10 -0
  206. package/dist/views/PostManager/EmptyState.d.ts.map +1 -0
  207. package/dist/views/PostManager/EmptyState.js +12 -0
  208. package/dist/views/PostManager/PostActionsMenu.d.ts +12 -0
  209. package/dist/views/PostManager/PostActionsMenu.d.ts.map +1 -0
  210. package/dist/views/PostManager/PostActionsMenu.js +58 -0
  211. package/dist/views/PostManager/PostCards.d.ts +15 -0
  212. package/dist/views/PostManager/PostCards.d.ts.map +1 -0
  213. package/dist/views/PostManager/PostCards.js +77 -0
  214. package/dist/views/PostManager/PostFilters.d.ts +16 -0
  215. package/dist/views/PostManager/PostFilters.d.ts.map +1 -0
  216. package/dist/views/PostManager/PostFilters.js +10 -0
  217. package/dist/views/PostManager/PostManagerView.d.ts +11 -0
  218. package/dist/views/PostManager/PostManagerView.d.ts.map +1 -0
  219. package/dist/views/PostManager/PostManagerView.js +179 -0
  220. package/dist/views/PostManager/PostStats.d.ts +11 -0
  221. package/dist/views/PostManager/PostStats.d.ts.map +1 -0
  222. package/dist/views/PostManager/PostStats.js +46 -0
  223. package/dist/views/PostManager/PostTable.d.ts +15 -0
  224. package/dist/views/PostManager/PostTable.d.ts.map +1 -0
  225. package/dist/views/PostManager/PostTable.js +77 -0
  226. package/dist/views/PostManager/index.d.ts +12 -0
  227. package/dist/views/PostManager/index.d.ts.map +1 -0
  228. package/dist/views/PostManager/index.js +11 -0
  229. package/dist/views/Preview/PreviewBridgeView.d.ts +12 -0
  230. package/dist/views/Preview/PreviewBridgeView.d.ts.map +1 -0
  231. package/dist/views/Preview/PreviewBridgeView.js +11 -0
  232. package/dist/views/Preview/index.d.ts +6 -0
  233. package/dist/views/Preview/index.d.ts.map +1 -0
  234. package/dist/views/Preview/index.js +4 -0
  235. package/dist/views/Settings/SettingsView.d.ts +10 -0
  236. package/dist/views/Settings/SettingsView.d.ts.map +1 -0
  237. package/dist/views/Settings/SettingsView.js +113 -0
  238. package/dist/views/Settings/index.d.ts +6 -0
  239. package/dist/views/Settings/index.d.ts.map +1 -0
  240. package/dist/views/Settings/index.js +4 -0
  241. package/dist/views/SlugSEO/SlugSEOManagerView.d.ts +12 -0
  242. package/dist/views/SlugSEO/SlugSEOManagerView.d.ts.map +1 -0
  243. package/dist/views/SlugSEO/SlugSEOManagerView.js +11 -0
  244. package/dist/views/SlugSEO/index.d.ts +6 -0
  245. package/dist/views/SlugSEO/index.d.ts.map +1 -0
  246. package/dist/views/SlugSEO/index.js +4 -0
  247. package/package.json +4 -4
  248. package/src/hooks/index.d.ts +8 -0
  249. package/src/hooks/index.d.ts.map +1 -0
  250. package/src/hooks/index.js +7 -0
  251. package/src/hooks/useBlog.d.ts +31 -0
  252. package/src/hooks/useBlog.d.ts.map +1 -0
  253. package/src/hooks/useBlog.js +57 -0
  254. package/src/hooks/useBlogs.d.ts +39 -0
  255. package/src/hooks/useBlogs.d.ts.map +1 -0
  256. package/src/hooks/useBlogs.js +82 -0
  257. package/src/hooks/useCategories.d.ts +9 -0
  258. package/src/hooks/useCategories.d.ts.map +1 -0
  259. package/src/hooks/useCategories.js +70 -0
  260. package/src/index.d.ts +55 -0
  261. package/src/index.d.ts.map +1 -0
  262. package/src/index.js +228 -0
  263. package/src/init.d.ts +40 -0
  264. package/src/init.d.ts.map +1 -0
  265. package/src/init.js +41 -0
  266. package/src/lib/blocks/BlockRenderer.d.ts +54 -0
  267. package/src/lib/blocks/BlockRenderer.d.ts.map +1 -0
  268. package/src/lib/blocks/BlockRenderer.js +54 -0
  269. package/src/lib/config-storage.d.ts +30 -0
  270. package/src/lib/config-storage.d.ts.map +1 -0
  271. package/src/lib/config-storage.js +31 -0
  272. package/src/lib/layouts/blocks/ColumnsBlock.d.ts +25 -0
  273. package/src/lib/layouts/blocks/ColumnsBlock.d.ts.map +1 -0
  274. package/src/lib/layouts/blocks/ColumnsBlock.js +182 -0
  275. package/src/lib/layouts/blocks/SectionBlock.d.ts +25 -0
  276. package/src/lib/layouts/blocks/SectionBlock.d.ts.map +1 -0
  277. package/src/lib/layouts/blocks/SectionBlock.js +44 -0
  278. package/src/lib/layouts/index.d.ts +23 -0
  279. package/src/lib/layouts/index.d.ts.map +1 -0
  280. package/src/lib/layouts/index.js +45 -0
  281. package/src/lib/layouts/registerLayoutBlocks.d.ts +9 -0
  282. package/src/lib/layouts/registerLayoutBlocks.d.ts.map +1 -0
  283. package/src/lib/layouts/registerLayoutBlocks.js +60 -0
  284. package/src/lib/mappers/apiMapper.d.ts +66 -0
  285. package/src/lib/mappers/apiMapper.d.ts.map +1 -0
  286. package/src/lib/mappers/apiMapper.js +191 -0
  287. package/src/lib/rich-text/RichTextEditor.d.ts +45 -0
  288. package/src/lib/rich-text/RichTextEditor.d.ts.map +1 -0
  289. package/src/lib/rich-text/RichTextEditor.js +564 -0
  290. package/src/lib/rich-text/RichTextPreview.d.ts +16 -0
  291. package/src/lib/rich-text/RichTextPreview.d.ts.map +1 -0
  292. package/src/lib/rich-text/RichTextPreview.js +144 -0
  293. package/src/lib/rich-text/index.d.ts +9 -0
  294. package/src/lib/rich-text/index.d.ts.map +1 -0
  295. package/src/lib/rich-text/index.js +6 -0
  296. package/src/lib/utils/blockHelpers.d.ts +23 -0
  297. package/src/lib/utils/blockHelpers.d.ts.map +1 -0
  298. package/src/lib/utils/blockHelpers.js +65 -0
  299. package/src/lib/utils/configValidation.d.ts +23 -0
  300. package/src/lib/utils/configValidation.d.ts.map +1 -0
  301. package/src/lib/utils/configValidation.js +113 -0
  302. package/src/registry/BlockRegistry.d.ts +62 -0
  303. package/src/registry/BlockRegistry.d.ts.map +1 -0
  304. package/src/registry/BlockRegistry.js +112 -0
  305. package/src/registry/index.d.ts +6 -0
  306. package/src/registry/index.d.ts.map +1 -0
  307. package/src/registry/index.js +4 -0
  308. package/src/state/EditorContext.d.ts +45 -0
  309. package/src/state/EditorContext.d.ts.map +1 -0
  310. package/src/state/EditorContext.js +215 -0
  311. package/src/state/index.d.ts +7 -0
  312. package/src/state/index.d.ts.map +1 -0
  313. package/src/state/index.js +6 -0
  314. package/src/state/reducer.d.ts +11 -0
  315. package/src/state/reducer.d.ts.map +1 -0
  316. package/src/state/reducer.js +443 -0
  317. package/src/state/types.d.ts +162 -0
  318. package/src/state/types.d.ts.map +1 -0
  319. package/src/state/types.js +27 -0
  320. package/src/types/block.d.ts +221 -0
  321. package/src/types/block.d.ts.map +1 -0
  322. package/src/types/block.js +6 -0
  323. package/src/types/index.d.ts +8 -0
  324. package/src/types/index.d.ts.map +1 -0
  325. package/src/types/index.js +5 -0
  326. package/src/types/post.d.ts +136 -0
  327. package/src/types/post.d.ts.map +1 -0
  328. package/src/types/post.js +5 -0
  329. package/src/utils/client.d.ts +48 -0
  330. package/src/utils/client.d.ts.map +1 -0
  331. package/src/utils/client.js +77 -0
  332. package/src/views/CanvasEditor/BlockWrapper.d.ts +16 -0
  333. package/src/views/CanvasEditor/BlockWrapper.d.ts.map +1 -0
  334. package/src/views/CanvasEditor/BlockWrapper.js +276 -0
  335. package/src/views/CanvasEditor/CanvasEditorView.d.ts +14 -0
  336. package/src/views/CanvasEditor/CanvasEditorView.d.ts.map +1 -0
  337. package/src/views/CanvasEditor/CanvasEditorView.js +209 -0
  338. package/src/views/CanvasEditor/EditorBody.d.ts +22 -0
  339. package/src/views/CanvasEditor/EditorBody.d.ts.map +1 -0
  340. package/src/views/CanvasEditor/EditorBody.js +505 -0
  341. package/src/views/CanvasEditor/EditorHeader.d.ts +18 -0
  342. package/src/views/CanvasEditor/EditorHeader.d.ts.map +1 -0
  343. package/src/views/CanvasEditor/EditorHeader.js +101 -0
  344. package/src/views/CanvasEditor/LayoutContainer.d.ts +17 -0
  345. package/src/views/CanvasEditor/LayoutContainer.d.ts.map +1 -0
  346. package/src/views/CanvasEditor/LayoutContainer.js +222 -0
  347. package/src/views/CanvasEditor/SaveConfirmationModal.d.ts +13 -0
  348. package/src/views/CanvasEditor/SaveConfirmationModal.d.ts.map +1 -0
  349. package/src/views/CanvasEditor/SaveConfirmationModal.js +78 -0
  350. package/src/views/CanvasEditor/components/CustomBlockItem.d.ts +14 -0
  351. package/src/views/CanvasEditor/components/CustomBlockItem.d.ts.map +1 -0
  352. package/src/views/CanvasEditor/components/CustomBlockItem.js +44 -0
  353. package/src/views/CanvasEditor/components/EditorCanvas.d.ts +29 -0
  354. package/src/views/CanvasEditor/components/EditorCanvas.d.ts.map +1 -0
  355. package/src/views/CanvasEditor/components/EditorCanvas.js +32 -0
  356. package/src/views/CanvasEditor/components/EditorLibrary.d.ts +7 -0
  357. package/src/views/CanvasEditor/components/EditorLibrary.d.ts.map +1 -0
  358. package/src/views/CanvasEditor/components/EditorLibrary.js +25 -0
  359. package/src/views/CanvasEditor/components/EditorSidebar.d.ts +13 -0
  360. package/src/views/CanvasEditor/components/EditorSidebar.d.ts.map +1 -0
  361. package/src/views/CanvasEditor/components/EditorSidebar.js +20 -0
  362. package/src/views/CanvasEditor/components/ErrorBanner.d.ts +6 -0
  363. package/src/views/CanvasEditor/components/ErrorBanner.d.ts.map +1 -0
  364. package/src/views/CanvasEditor/components/ErrorBanner.js +8 -0
  365. package/src/views/CanvasEditor/components/FeaturedMediaSection.d.ts +25 -0
  366. package/src/views/CanvasEditor/components/FeaturedMediaSection.d.ts.map +1 -0
  367. package/src/views/CanvasEditor/components/FeaturedMediaSection.js +182 -0
  368. package/src/views/CanvasEditor/components/LibraryItem.d.ts +14 -0
  369. package/src/views/CanvasEditor/components/LibraryItem.d.ts.map +1 -0
  370. package/src/views/CanvasEditor/components/LibraryItem.js +43 -0
  371. package/src/views/CanvasEditor/components/PrivacySettingsSection.d.ts +15 -0
  372. package/src/views/CanvasEditor/components/PrivacySettingsSection.d.ts.map +1 -0
  373. package/src/views/CanvasEditor/components/PrivacySettingsSection.js +63 -0
  374. package/src/views/CanvasEditor/components/index.d.ts +21 -0
  375. package/src/views/CanvasEditor/components/index.d.ts.map +1 -0
  376. package/src/views/CanvasEditor/components/index.js +12 -0
  377. package/src/views/CanvasEditor/hooks/index.d.ts +10 -0
  378. package/src/views/CanvasEditor/hooks/index.d.ts.map +1 -0
  379. package/src/views/CanvasEditor/hooks/index.js +9 -0
  380. package/src/views/CanvasEditor/hooks/useHeroBlock.d.ts +8 -0
  381. package/src/views/CanvasEditor/hooks/useHeroBlock.d.ts.map +1 -0
  382. package/src/views/CanvasEditor/hooks/useHeroBlock.js +79 -0
  383. package/src/views/CanvasEditor/hooks/useKeyboardShortcuts.d.ts +3 -0
  384. package/src/views/CanvasEditor/hooks/useKeyboardShortcuts.d.ts.map +1 -0
  385. package/src/views/CanvasEditor/hooks/useKeyboardShortcuts.js +114 -0
  386. package/src/views/CanvasEditor/hooks/usePostLoader.d.ts +5 -0
  387. package/src/views/CanvasEditor/hooks/usePostLoader.d.ts.map +1 -0
  388. package/src/views/CanvasEditor/hooks/usePostLoader.js +32 -0
  389. package/src/views/CanvasEditor/hooks/useRegisteredBlocks.d.ts +2 -0
  390. package/src/views/CanvasEditor/hooks/useRegisteredBlocks.d.ts.map +1 -0
  391. package/src/views/CanvasEditor/hooks/useRegisteredBlocks.js +47 -0
  392. package/src/views/CanvasEditor/hooks/useUnsavedChanges.d.ts +25 -0
  393. package/src/views/CanvasEditor/hooks/useUnsavedChanges.d.ts.map +1 -0
  394. package/src/views/CanvasEditor/hooks/useUnsavedChanges.js +285 -0
  395. package/src/views/CanvasEditor/index.d.ts +16 -0
  396. package/src/views/CanvasEditor/index.d.ts.map +1 -0
  397. package/src/views/CanvasEditor/index.js +9 -0
  398. package/src/views/PostManager/EmptyState.d.ts +10 -0
  399. package/src/views/PostManager/EmptyState.d.ts.map +1 -0
  400. package/src/views/PostManager/EmptyState.js +12 -0
  401. package/src/views/PostManager/PostActionsMenu.d.ts +12 -0
  402. package/src/views/PostManager/PostActionsMenu.d.ts.map +1 -0
  403. package/src/views/PostManager/PostActionsMenu.js +58 -0
  404. package/src/views/PostManager/PostCards.d.ts +15 -0
  405. package/src/views/PostManager/PostCards.d.ts.map +1 -0
  406. package/src/views/PostManager/PostCards.js +79 -0
  407. package/src/views/PostManager/PostFilters.d.ts +16 -0
  408. package/src/views/PostManager/PostFilters.d.ts.map +1 -0
  409. package/src/views/PostManager/PostFilters.js +10 -0
  410. package/src/views/PostManager/PostManagerView.d.ts +11 -0
  411. package/src/views/PostManager/PostManagerView.d.ts.map +1 -0
  412. package/src/views/PostManager/PostManagerView.js +174 -0
  413. package/src/views/PostManager/PostStats.d.ts +11 -0
  414. package/src/views/PostManager/PostStats.d.ts.map +1 -0
  415. package/src/views/PostManager/PostStats.js +46 -0
  416. package/src/views/PostManager/PostTable.d.ts +15 -0
  417. package/src/views/PostManager/PostTable.d.ts.map +1 -0
  418. package/src/views/PostManager/PostTable.js +79 -0
  419. package/src/views/PostManager/index.d.ts +12 -0
  420. package/src/views/PostManager/index.d.ts.map +1 -0
  421. package/src/views/PostManager/index.js +11 -0
  422. package/src/views/Preview/PreviewBridgeView.d.ts +12 -0
  423. package/src/views/Preview/PreviewBridgeView.d.ts.map +1 -0
  424. package/src/views/Preview/PreviewBridgeView.js +11 -0
  425. package/src/views/Preview/index.d.ts +6 -0
  426. package/src/views/Preview/index.d.ts.map +1 -0
  427. package/src/views/Preview/index.js +4 -0
  428. package/src/views/Settings/SettingsView.d.ts +10 -0
  429. package/src/views/Settings/SettingsView.d.ts.map +1 -0
  430. package/src/views/Settings/SettingsView.js +111 -0
  431. package/src/views/Settings/index.d.ts +6 -0
  432. package/src/views/Settings/index.d.ts.map +1 -0
  433. package/src/views/Settings/index.js +4 -0
  434. package/src/views/SlugSEO/SlugSEOManagerView.d.ts +12 -0
  435. package/src/views/SlugSEO/SlugSEOManagerView.d.ts.map +1 -0
  436. package/src/views/SlugSEO/SlugSEOManagerView.js +11 -0
  437. package/src/views/SlugSEO/index.d.ts +6 -0
  438. package/src/views/SlugSEO/index.d.ts.map +1 -0
  439. package/src/views/SlugSEO/index.js +4 -0
@@ -0,0 +1,443 @@
1
+ /**
2
+ * Editor Reducer
3
+ * Pure function that handles state transitions
4
+ */
5
+ import { initialEditorState } from './types';
6
+ /**
7
+ * Generate a unique block ID
8
+ */
9
+ function generateBlockId() {
10
+ // Use crypto.randomUUID if available, otherwise fallback to timestamp-based
11
+ if (typeof crypto !== 'undefined' && crypto.randomUUID) {
12
+ return crypto.randomUUID();
13
+ }
14
+ return `block-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
15
+ }
16
+ /**
17
+ * Clone a block with a new ID
18
+ */
19
+ function cloneBlock(block) {
20
+ return Object.assign(Object.assign({}, block), { id: generateBlockId(), data: Object.assign({}, block.data), meta: block.meta ? Object.assign({}, block.meta) : undefined, children: block.children ? (Array.isArray(block.children[0])
21
+ ? block.children.map(cloneBlock)
22
+ : [...block.children]) : undefined });
23
+ }
24
+ /**
25
+ * Find a block by ID recursively (including nested blocks)
26
+ */
27
+ function findBlockById(blocks, id) {
28
+ for (const block of blocks) {
29
+ if (block.id === id) {
30
+ return block;
31
+ }
32
+ if (block.children && Array.isArray(block.children) && block.children.length > 0) {
33
+ // Check if children are Block objects or IDs
34
+ if (typeof block.children[0] === 'object') {
35
+ const found = findBlockById(block.children, id);
36
+ if (found)
37
+ return found;
38
+ }
39
+ }
40
+ }
41
+ return null;
42
+ }
43
+ /**
44
+ * Update blocks recursively to add a block to a container
45
+ */
46
+ function addBlockToContainer(blocks, containerId, newBlock, index) {
47
+ return blocks.map(block => {
48
+ // Check if this is the container (exact match or column container like "block-123-col-0")
49
+ const isContainer = block.id === containerId;
50
+ const isColumnContainer = containerId.startsWith(`${block.id}-col-`);
51
+ if (isContainer) {
52
+ // Direct container match
53
+ const currentChildren = Array.isArray(block.children)
54
+ ? (typeof block.children[0] === 'object'
55
+ ? block.children
56
+ : [])
57
+ : [];
58
+ const updatedChildren = [...currentChildren];
59
+ if (index !== undefined && index >= 0 && index <= updatedChildren.length) {
60
+ updatedChildren.splice(index, 0, newBlock);
61
+ }
62
+ else {
63
+ updatedChildren.push(newBlock);
64
+ }
65
+ return Object.assign(Object.assign({}, block), { children: updatedChildren });
66
+ }
67
+ else if (isColumnContainer) {
68
+ // Column container - extract column index and store in block meta
69
+ const columnIndex = parseInt(containerId.split('-col-')[1] || '0', 10);
70
+ newBlock.meta = Object.assign(Object.assign({}, newBlock.meta), { columnIndex });
71
+ const currentChildren = Array.isArray(block.children)
72
+ ? (typeof block.children[0] === 'object'
73
+ ? block.children
74
+ : [])
75
+ : [];
76
+ const updatedChildren = [...currentChildren];
77
+ if (index !== undefined && index >= 0 && index <= updatedChildren.length) {
78
+ updatedChildren.splice(index, 0, newBlock);
79
+ }
80
+ else {
81
+ updatedChildren.push(newBlock);
82
+ }
83
+ return Object.assign(Object.assign({}, block), { children: updatedChildren });
84
+ }
85
+ // Recursively search nested blocks
86
+ if (block.children && Array.isArray(block.children) && block.children.length > 0) {
87
+ if (typeof block.children[0] === 'object') {
88
+ return Object.assign(Object.assign({}, block), { children: addBlockToContainer(block.children, containerId, newBlock, index) });
89
+ }
90
+ }
91
+ return block;
92
+ });
93
+ }
94
+ /**
95
+ * Update blocks recursively to update a nested block
96
+ */
97
+ function updateNestedBlock(blocks, id, data) {
98
+ return blocks.map(block => {
99
+ if (block.id === id) {
100
+ return Object.assign(Object.assign({}, block), { data: Object.assign(Object.assign({}, block.data), data) });
101
+ }
102
+ if (block.children && Array.isArray(block.children) && block.children.length > 0) {
103
+ if (typeof block.children[0] === 'object') {
104
+ return Object.assign(Object.assign({}, block), { children: updateNestedBlock(block.children, id, data) });
105
+ }
106
+ }
107
+ return block;
108
+ });
109
+ }
110
+ /**
111
+ * Update blocks recursively to delete a nested block
112
+ */
113
+ function deleteNestedBlock(blocks, id) {
114
+ return blocks
115
+ .filter(block => block.id !== id)
116
+ .map(block => {
117
+ if (block.children && Array.isArray(block.children) && block.children.length > 0) {
118
+ if (typeof block.children[0] === 'object') {
119
+ return Object.assign(Object.assign({}, block), { children: deleteNestedBlock(block.children, id) });
120
+ }
121
+ }
122
+ return block;
123
+ });
124
+ }
125
+ /**
126
+ * Find and remove a block from wherever it is (root or nested)
127
+ */
128
+ function removeBlockFromTree(blocks, blockId) {
129
+ let removedBlock = null;
130
+ console.log('[removeBlockFromTree] Searching for block:', {
131
+ blockId,
132
+ rootBlocks: blocks.map(b => ({ id: b.id, type: b.type })),
133
+ });
134
+ // First check root level
135
+ const rootIndex = blocks.findIndex(b => b.id === blockId);
136
+ if (rootIndex !== -1) {
137
+ removedBlock = blocks[rootIndex];
138
+ console.log('[removeBlockFromTree] Found at root level:', {
139
+ blockId,
140
+ index: rootIndex,
141
+ block: { id: removedBlock.id, type: removedBlock.type },
142
+ });
143
+ return {
144
+ updatedBlocks: blocks.filter((_, i) => i !== rootIndex),
145
+ removedBlock,
146
+ };
147
+ }
148
+ // Then check nested blocks
149
+ const updatedBlocks = blocks.map(block => {
150
+ if (block.children && Array.isArray(block.children) && block.children.length > 0) {
151
+ if (typeof block.children[0] === 'object') {
152
+ const children = block.children;
153
+ const childIndex = children.findIndex(b => b.id === blockId);
154
+ if (childIndex !== -1) {
155
+ removedBlock = children[childIndex];
156
+ console.log('[removeBlockFromTree] Found in nested container:', {
157
+ blockId,
158
+ containerId: block.id,
159
+ containerType: block.type,
160
+ childIndex,
161
+ block: { id: removedBlock.id, type: removedBlock.type },
162
+ });
163
+ return Object.assign(Object.assign({}, block), { children: children.filter((_, i) => i !== childIndex) });
164
+ }
165
+ // Recursively search nested children
166
+ const { updatedBlocks: updatedChildren, removedBlock: foundBlock } = removeBlockFromTree(children, blockId);
167
+ if (foundBlock) {
168
+ removedBlock = foundBlock;
169
+ console.log('[removeBlockFromTree] Found in deeper nesting:', {
170
+ blockId,
171
+ containerId: block.id,
172
+ block: { id: removedBlock.id, type: removedBlock.type },
173
+ });
174
+ return Object.assign(Object.assign({}, block), { children: updatedChildren });
175
+ }
176
+ }
177
+ }
178
+ return block;
179
+ });
180
+ if (!removedBlock) {
181
+ console.warn('[removeBlockFromTree] Block not found in tree:', { blockId });
182
+ }
183
+ return { updatedBlocks, removedBlock };
184
+ }
185
+ /**
186
+ * Update blocks recursively to move a nested block within the same container
187
+ */
188
+ function moveNestedBlock(blocks, containerId, blockId, newIndex) {
189
+ return blocks.map(block => {
190
+ if (block.id === containerId && block.children && Array.isArray(block.children)) {
191
+ const children = typeof block.children[0] === 'object'
192
+ ? block.children
193
+ : [];
194
+ const currentIndex = children.findIndex(b => b.id === blockId);
195
+ if (currentIndex !== -1 && newIndex >= 0 && newIndex < children.length) {
196
+ const updatedChildren = [...children];
197
+ const [movedBlock] = updatedChildren.splice(currentIndex, 1);
198
+ updatedChildren.splice(newIndex, 0, movedBlock);
199
+ return Object.assign(Object.assign({}, block), { children: updatedChildren });
200
+ }
201
+ }
202
+ if (block.children && Array.isArray(block.children) && block.children.length > 0) {
203
+ if (typeof block.children[0] === 'object') {
204
+ return Object.assign(Object.assign({}, block), { children: moveNestedBlock(block.children, containerId, blockId, newIndex) });
205
+ }
206
+ }
207
+ return block;
208
+ });
209
+ }
210
+ /**
211
+ * Move a block to a container (handles cross-container moves)
212
+ */
213
+ function moveBlockToContainer(blocks, blockId, containerId, newIndex) {
214
+ console.log('[moveBlockToContainer] Starting move:', {
215
+ blockId,
216
+ containerId,
217
+ newIndex,
218
+ });
219
+ // First, find and remove the block from wherever it is
220
+ const { updatedBlocks, removedBlock } = removeBlockFromTree(blocks, blockId);
221
+ if (!removedBlock) {
222
+ // Block not found, return unchanged
223
+ console.warn('[moveBlockToContainer] Block not found, cannot move');
224
+ return blocks;
225
+ }
226
+ console.log('[moveBlockToContainer] Block removed, now adding to container:', {
227
+ removedBlock: { id: removedBlock.id, type: removedBlock.type },
228
+ containerId,
229
+ newIndex,
230
+ });
231
+ // Handle column containers
232
+ const isColumnContainer = containerId.includes('-col-');
233
+ if (isColumnContainer) {
234
+ const [parentId, columnPart] = containerId.split('-col-');
235
+ const columnIndex = parseInt(columnPart || '0', 10);
236
+ removedBlock.meta = Object.assign(Object.assign({}, removedBlock.meta), { columnIndex });
237
+ console.log('[moveBlockToContainer] Setting column index:', { columnIndex });
238
+ }
239
+ // Now add the block to the target container
240
+ const result = addBlockToContainer(updatedBlocks, containerId, removedBlock, newIndex);
241
+ console.log('[moveBlockToContainer] Move complete:', {
242
+ resultBlocks: result.map(b => ({ id: b.id, type: b.type })),
243
+ });
244
+ return result;
245
+ }
246
+ /**
247
+ * Editor Reducer
248
+ * Handles all state transitions for the editor
249
+ */
250
+ export function editorReducer(state, action) {
251
+ switch (action.type) {
252
+ case 'SET_BLOCKS':
253
+ return Object.assign(Object.assign({}, state), { blocks: action.payload, isDirty: true });
254
+ case 'ADD_BLOCK': {
255
+ const { block, index, containerId } = action.payload;
256
+ const newBlock = Object.assign(Object.assign({}, block), { id: block.id || generateBlockId() });
257
+ // If containerId is provided, add to container's children
258
+ if (containerId) {
259
+ const updatedBlocks = addBlockToContainer(state.blocks, containerId, newBlock, index);
260
+ return Object.assign(Object.assign({}, state), { blocks: updatedBlocks, selectedBlockId: newBlock.id, isDirty: true });
261
+ }
262
+ // Otherwise, add to root level
263
+ const newBlocks = [...state.blocks];
264
+ if (index !== undefined && index >= 0 && index <= newBlocks.length) {
265
+ newBlocks.splice(index, 0, newBlock);
266
+ }
267
+ else {
268
+ newBlocks.push(newBlock);
269
+ }
270
+ return Object.assign(Object.assign({}, state), { blocks: newBlocks, selectedBlockId: newBlock.id, isDirty: true });
271
+ }
272
+ case 'UPDATE_BLOCK': {
273
+ const { id, data } = action.payload;
274
+ // Check if block is at root level
275
+ const rootBlock = state.blocks.find(block => block.id === id);
276
+ if (rootBlock) {
277
+ const newBlocks = state.blocks.map(block => block.id === id
278
+ ? Object.assign(Object.assign({}, block), { data: Object.assign(Object.assign({}, block.data), data) }) : block);
279
+ return Object.assign(Object.assign({}, state), { blocks: newBlocks, isDirty: true });
280
+ }
281
+ // Otherwise, update nested block
282
+ const newBlocks = updateNestedBlock(state.blocks, id, data);
283
+ return Object.assign(Object.assign({}, state), { blocks: newBlocks, isDirty: true });
284
+ }
285
+ case 'DELETE_BLOCK': {
286
+ const { id } = action.payload;
287
+ // Check if block is at root level
288
+ const rootBlock = state.blocks.find(block => block.id === id);
289
+ if (rootBlock) {
290
+ const newBlocks = state.blocks.filter(block => block.id !== id);
291
+ const wasSelected = state.selectedBlockId === id;
292
+ return Object.assign(Object.assign({}, state), { blocks: newBlocks, selectedBlockId: wasSelected ? null : state.selectedBlockId, isDirty: true });
293
+ }
294
+ // Otherwise, delete nested block
295
+ const newBlocks = deleteNestedBlock(state.blocks, id);
296
+ const wasSelected = state.selectedBlockId === id;
297
+ return Object.assign(Object.assign({}, state), { blocks: newBlocks, selectedBlockId: wasSelected ? null : state.selectedBlockId, isDirty: true });
298
+ }
299
+ case 'DUPLICATE_BLOCK': {
300
+ const { id } = action.payload;
301
+ const blockIndex = state.blocks.findIndex(block => block.id === id);
302
+ if (blockIndex === -1) {
303
+ return state;
304
+ }
305
+ const blockToDuplicate = state.blocks[blockIndex];
306
+ const duplicatedBlock = cloneBlock(blockToDuplicate);
307
+ const newBlocks = [...state.blocks];
308
+ newBlocks.splice(blockIndex + 1, 0, duplicatedBlock);
309
+ return Object.assign(Object.assign({}, state), { blocks: newBlocks, selectedBlockId: duplicatedBlock.id, isDirty: true });
310
+ }
311
+ case 'MOVE_BLOCK': {
312
+ const { id, newIndex, containerId: rawContainerId } = action.payload;
313
+ // Normalize 'root' string to undefined
314
+ const containerId = rawContainerId === 'root' || rawContainerId === undefined ? undefined : rawContainerId;
315
+ console.log('[Reducer] MOVE_BLOCK action:', {
316
+ blockId: id,
317
+ newIndex,
318
+ rawContainerId,
319
+ normalizedContainerId: containerId || 'root',
320
+ currentRootBlocks: state.blocks.map(b => ({ id: b.id, type: b.type, hasChildren: !!b.children })),
321
+ });
322
+ // If containerId is provided (and not 'root'), move to/within container
323
+ if (containerId) {
324
+ // First check if block is already in this container
325
+ const containerBlock = findBlockById(state.blocks, containerId);
326
+ console.log('[Reducer] Container lookup:', {
327
+ containerId,
328
+ found: !!containerBlock,
329
+ hasChildren: (containerBlock === null || containerBlock === void 0 ? void 0 : containerBlock.children) ? Array.isArray(containerBlock.children) : false,
330
+ });
331
+ if (containerBlock && containerBlock.children && Array.isArray(containerBlock.children)) {
332
+ const children = typeof containerBlock.children[0] === 'object'
333
+ ? containerBlock.children
334
+ : [];
335
+ const currentIndex = children.findIndex(b => b.id === id);
336
+ console.log('[Reducer] Block in container check:', {
337
+ blockId: id,
338
+ currentIndex,
339
+ containerChildren: children.map(b => ({ id: b.id, type: b.type })),
340
+ });
341
+ if (currentIndex !== -1) {
342
+ // Block is already in this container - move within container
343
+ console.log('[Reducer] Moving within container');
344
+ const newBlocks = moveNestedBlock(state.blocks, containerId, id, newIndex);
345
+ console.log('[Reducer] After move within container:', {
346
+ newRootBlocks: newBlocks.map(b => ({ id: b.id, type: b.type })),
347
+ });
348
+ return Object.assign(Object.assign({}, state), { blocks: newBlocks, isDirty: true });
349
+ }
350
+ }
351
+ // Block is not in this container - move it from wherever it is (root or nested)
352
+ console.log('[Reducer] Moving block to container from elsewhere');
353
+ const newBlocks = moveBlockToContainer(state.blocks, id, containerId, newIndex);
354
+ console.log('[Reducer] After move to container:', {
355
+ newRootBlocks: newBlocks.map(b => ({ id: b.id, type: b.type })),
356
+ });
357
+ return Object.assign(Object.assign({}, state), { blocks: newBlocks, isDirty: true });
358
+ }
359
+ // Moving to root level (containerId is undefined)
360
+ const currentIndex = state.blocks.findIndex(block => block.id === id);
361
+ console.log('[Reducer] Moving to root level:', {
362
+ blockId: id,
363
+ currentIndex,
364
+ isInRoot: currentIndex !== -1,
365
+ newIndex,
366
+ rootBlocksCount: state.blocks.length,
367
+ });
368
+ if (currentIndex !== -1) {
369
+ // Block is already at root level - move within root
370
+ if (newIndex < 0 || newIndex >= state.blocks.length) {
371
+ console.warn('[Reducer] Invalid newIndex for root move:', { newIndex, blocksLength: state.blocks.length });
372
+ return state;
373
+ }
374
+ console.log('[Reducer] Moving within root level');
375
+ const newBlocks = [...state.blocks];
376
+ const [movedBlock] = newBlocks.splice(currentIndex, 1);
377
+ newBlocks.splice(newIndex, 0, movedBlock);
378
+ console.log('[Reducer] After move within root:', {
379
+ newRootBlocks: newBlocks.map(b => ({ id: b.id, type: b.type })),
380
+ });
381
+ return Object.assign(Object.assign({}, state), { blocks: newBlocks, isDirty: true });
382
+ }
383
+ // Block is nested somewhere - move it to root level
384
+ console.log('[Reducer] Block is nested, removing from tree and adding to root');
385
+ const { updatedBlocks, removedBlock } = removeBlockFromTree(state.blocks, id);
386
+ console.log('[Reducer] Block removal result:', {
387
+ removedBlock: removedBlock ? { id: removedBlock.id, type: removedBlock.type } : null,
388
+ updatedBlocksCount: updatedBlocks.length,
389
+ });
390
+ if (removedBlock) {
391
+ // Clear any nested metadata (like columnIndex)
392
+ const cleanedBlock = Object.assign(Object.assign({}, removedBlock), { meta: removedBlock.meta ? Object.assign(Object.assign({}, removedBlock.meta), { columnIndex: undefined }) : undefined });
393
+ const newBlocks = [...updatedBlocks];
394
+ if (newIndex >= 0 && newIndex <= newBlocks.length) {
395
+ newBlocks.splice(newIndex, 0, cleanedBlock);
396
+ }
397
+ else {
398
+ newBlocks.push(cleanedBlock);
399
+ }
400
+ console.log('[Reducer] After move nested to root:', {
401
+ newRootBlocks: newBlocks.map(b => ({ id: b.id, type: b.type })),
402
+ insertedAt: newIndex >= 0 && newIndex <= updatedBlocks.length ? newIndex : newBlocks.length - 1,
403
+ });
404
+ return Object.assign(Object.assign({}, state), { blocks: newBlocks, isDirty: true });
405
+ }
406
+ console.warn('[Reducer] Block not found in tree:', { blockId: id });
407
+ return state;
408
+ }
409
+ case 'SET_TITLE':
410
+ return Object.assign(Object.assign({}, state), { title: action.payload, isDirty: true });
411
+ case 'SET_SLUG':
412
+ return Object.assign(Object.assign({}, state), { slug: action.payload, isDirty: true });
413
+ case 'SET_SEO':
414
+ return Object.assign(Object.assign({}, state), { seo: Object.assign(Object.assign({}, state.seo), action.payload), isDirty: true });
415
+ case 'SET_METADATA':
416
+ return Object.assign(Object.assign({}, state), { metadata: Object.assign(Object.assign({}, state.metadata), action.payload), isDirty: true });
417
+ case 'SET_STATUS':
418
+ return Object.assign(Object.assign({}, state), { status: action.payload, isDirty: true });
419
+ case 'SET_FOCUS_MODE':
420
+ return Object.assign(Object.assign({}, state), { focusMode: action.payload });
421
+ case 'SELECT_BLOCK':
422
+ return Object.assign(Object.assign({}, state), { selectedBlockId: action.payload });
423
+ case 'SET_DRAGGED_BLOCK':
424
+ return Object.assign(Object.assign({}, state), { draggedBlockId: action.payload });
425
+ case 'LOAD_POST': {
426
+ const post = action.payload;
427
+ return Object.assign(Object.assign({}, state), { blocks: post.blocks, title: post.title, slug: post.slug, seo: post.seo, metadata: post.metadata, status: post.publication.status, postId: post.id, isDirty: false, selectedBlockId: null });
428
+ }
429
+ case 'RESET_EDITOR':
430
+ return Object.assign({}, initialEditorState);
431
+ case 'MARK_CLEAN':
432
+ return Object.assign(Object.assign({}, state), { isDirty: false });
433
+ case 'MARK_DIRTY':
434
+ return Object.assign(Object.assign({}, state), { isDirty: true });
435
+ case 'UNDO':
436
+ case 'REDO':
437
+ case 'SAVE_HISTORY':
438
+ // These are handled by the context, not the reducer
439
+ return state;
440
+ default:
441
+ return state;
442
+ }
443
+ }
@@ -0,0 +1,162 @@
1
+ /**
2
+ * State Management Types
3
+ * Types for the editor state management system
4
+ */
5
+ import { Block } from '../types/block';
6
+ import { BlogPost, PostStatus, SEOMetadata, PostMetadata } from '../types/post';
7
+ /**
8
+ * Editor State
9
+ * Represents the current state of the editor
10
+ */
11
+ export interface EditorState {
12
+ /** Array of blocks in the editor */
13
+ blocks: Block[];
14
+ /** Post title */
15
+ title: string;
16
+ /** Post slug */
17
+ slug: string;
18
+ /** SEO metadata */
19
+ seo: SEOMetadata;
20
+ /** Post metadata */
21
+ metadata: PostMetadata;
22
+ /** Publication status */
23
+ status: PostStatus;
24
+ /** Whether the post has unsaved changes */
25
+ isDirty: boolean;
26
+ /** Whether the editor is in focus mode */
27
+ focusMode: boolean;
28
+ /** Currently selected block ID */
29
+ selectedBlockId: string | null;
30
+ /** Currently dragged block ID */
31
+ draggedBlockId: string | null;
32
+ /** Post ID (if editing existing post) */
33
+ postId: string | null;
34
+ }
35
+ /**
36
+ * Editor Actions
37
+ * Actions that can be dispatched to modify editor state
38
+ */
39
+ export type EditorAction = {
40
+ type: 'SET_BLOCKS';
41
+ payload: Block[];
42
+ } | {
43
+ type: 'ADD_BLOCK';
44
+ payload: {
45
+ block: Block;
46
+ index?: number;
47
+ containerId?: string;
48
+ };
49
+ } | {
50
+ type: 'UPDATE_BLOCK';
51
+ payload: {
52
+ id: string;
53
+ data: Partial<Block['data']>;
54
+ };
55
+ } | {
56
+ type: 'DELETE_BLOCK';
57
+ payload: {
58
+ id: string;
59
+ };
60
+ } | {
61
+ type: 'DUPLICATE_BLOCK';
62
+ payload: {
63
+ id: string;
64
+ };
65
+ } | {
66
+ type: 'MOVE_BLOCK';
67
+ payload: {
68
+ id: string;
69
+ newIndex: number;
70
+ containerId?: string;
71
+ };
72
+ } | {
73
+ type: 'SET_TITLE';
74
+ payload: string;
75
+ } | {
76
+ type: 'SET_SLUG';
77
+ payload: string;
78
+ } | {
79
+ type: 'SET_SEO';
80
+ payload: Partial<SEOMetadata>;
81
+ } | {
82
+ type: 'SET_METADATA';
83
+ payload: Partial<PostMetadata>;
84
+ } | {
85
+ type: 'SET_STATUS';
86
+ payload: PostStatus;
87
+ } | {
88
+ type: 'SET_FOCUS_MODE';
89
+ payload: boolean;
90
+ } | {
91
+ type: 'SELECT_BLOCK';
92
+ payload: string | null;
93
+ } | {
94
+ type: 'SET_DRAGGED_BLOCK';
95
+ payload: string | null;
96
+ } | {
97
+ type: 'LOAD_POST';
98
+ payload: BlogPost;
99
+ } | {
100
+ type: 'RESET_EDITOR';
101
+ } | {
102
+ type: 'MARK_CLEAN';
103
+ } | {
104
+ type: 'MARK_DIRTY';
105
+ } | {
106
+ type: 'UNDO';
107
+ } | {
108
+ type: 'REDO';
109
+ } | {
110
+ type: 'SAVE_HISTORY';
111
+ };
112
+ /**
113
+ * Editor Context Value
114
+ * The value provided by the EditorContext
115
+ */
116
+ export interface EditorContextValue {
117
+ /** Current editor state */
118
+ state: EditorState;
119
+ /** Dispatch an action to modify state */
120
+ dispatch: (action: EditorAction) => void;
121
+ /** Enable dark mode for content area and wrappers */
122
+ darkMode: boolean;
123
+ /** Background colors for the editor */
124
+ backgroundColors?: {
125
+ /** Background color for light mode (REQUIRED) */
126
+ light: string;
127
+ /** Background color for dark mode (optional) */
128
+ dark?: string;
129
+ };
130
+ /** Helper functions for common operations */
131
+ helpers: {
132
+ /** Add a new block (supports nested containers via containerId) */
133
+ addBlock: (type: string, index?: number, containerId?: string) => void;
134
+ /** Update a block's data */
135
+ updateBlock: (id: string, data: Partial<Block['data']>) => void;
136
+ /** Delete a block */
137
+ deleteBlock: (id: string) => void;
138
+ /** Duplicate a block */
139
+ duplicateBlock: (id: string) => void;
140
+ /** Move a block to a new position (supports nested containers via containerId) */
141
+ moveBlock: (id: string, newIndex: number, containerId?: string) => void;
142
+ /** Load a post into the editor */
143
+ loadPost: (post: BlogPost) => void;
144
+ /** Reset editor to initial state */
145
+ resetEditor: () => void;
146
+ /** Save current state (triggers save callback) */
147
+ save: (heroBlock?: Block | null) => Promise<void>;
148
+ /** Undo last action */
149
+ undo: () => void;
150
+ /** Redo last undone action */
151
+ redo: () => void;
152
+ };
153
+ /** Whether undo is available */
154
+ canUndo: boolean;
155
+ /** Whether redo is available */
156
+ canRedo: boolean;
157
+ }
158
+ /**
159
+ * Initial Editor State
160
+ */
161
+ export declare const initialEditorState: EditorState;
162
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAEhF;;;GAGG;AACH,MAAM,WAAW,WAAW;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AO,CAAC;IAEjB,gCAAgC;IAChC,OAAO,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,WAmBhC,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * State Management Types
3
+ * Types for the editor state management system
4
+ */
5
+ /**
6
+ * Initial Editor State
7
+ */
8
+ export const initialEditorState = {
9
+ blocks: [],
10
+ title: '',
11
+ slug: '',
12
+ seo: {
13
+ title: '',
14
+ description: '',
15
+ },
16
+ metadata: {
17
+ categories: [],
18
+ tags: [],
19
+ excerpt: '',
20
+ },
21
+ status: 'draft',
22
+ isDirty: false,
23
+ focusMode: false,
24
+ selectedBlockId: null,
25
+ draggedBlockId: null,
26
+ postId: null,
27
+ };