@jhits/plugin-blog 0.0.7 → 0.0.9

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 (440) 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 +59 -55
  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/utils/index.ts +0 -2
  333. package/src/views/CanvasEditor/BlockWrapper.d.ts +16 -0
  334. package/src/views/CanvasEditor/BlockWrapper.d.ts.map +1 -0
  335. package/src/views/CanvasEditor/BlockWrapper.js +276 -0
  336. package/src/views/CanvasEditor/CanvasEditorView.d.ts +14 -0
  337. package/src/views/CanvasEditor/CanvasEditorView.d.ts.map +1 -0
  338. package/src/views/CanvasEditor/CanvasEditorView.js +209 -0
  339. package/src/views/CanvasEditor/EditorBody.d.ts +22 -0
  340. package/src/views/CanvasEditor/EditorBody.d.ts.map +1 -0
  341. package/src/views/CanvasEditor/EditorBody.js +505 -0
  342. package/src/views/CanvasEditor/EditorHeader.d.ts +18 -0
  343. package/src/views/CanvasEditor/EditorHeader.d.ts.map +1 -0
  344. package/src/views/CanvasEditor/EditorHeader.js +101 -0
  345. package/src/views/CanvasEditor/LayoutContainer.d.ts +17 -0
  346. package/src/views/CanvasEditor/LayoutContainer.d.ts.map +1 -0
  347. package/src/views/CanvasEditor/LayoutContainer.js +222 -0
  348. package/src/views/CanvasEditor/SaveConfirmationModal.d.ts +13 -0
  349. package/src/views/CanvasEditor/SaveConfirmationModal.d.ts.map +1 -0
  350. package/src/views/CanvasEditor/SaveConfirmationModal.js +78 -0
  351. package/src/views/CanvasEditor/components/CustomBlockItem.d.ts +14 -0
  352. package/src/views/CanvasEditor/components/CustomBlockItem.d.ts.map +1 -0
  353. package/src/views/CanvasEditor/components/CustomBlockItem.js +44 -0
  354. package/src/views/CanvasEditor/components/EditorCanvas.d.ts +29 -0
  355. package/src/views/CanvasEditor/components/EditorCanvas.d.ts.map +1 -0
  356. package/src/views/CanvasEditor/components/EditorCanvas.js +32 -0
  357. package/src/views/CanvasEditor/components/EditorLibrary.d.ts +7 -0
  358. package/src/views/CanvasEditor/components/EditorLibrary.d.ts.map +1 -0
  359. package/src/views/CanvasEditor/components/EditorLibrary.js +25 -0
  360. package/src/views/CanvasEditor/components/EditorSidebar.d.ts +13 -0
  361. package/src/views/CanvasEditor/components/EditorSidebar.d.ts.map +1 -0
  362. package/src/views/CanvasEditor/components/EditorSidebar.js +20 -0
  363. package/src/views/CanvasEditor/components/ErrorBanner.d.ts +6 -0
  364. package/src/views/CanvasEditor/components/ErrorBanner.d.ts.map +1 -0
  365. package/src/views/CanvasEditor/components/ErrorBanner.js +8 -0
  366. package/src/views/CanvasEditor/components/FeaturedMediaSection.d.ts +25 -0
  367. package/src/views/CanvasEditor/components/FeaturedMediaSection.d.ts.map +1 -0
  368. package/src/views/CanvasEditor/components/FeaturedMediaSection.js +182 -0
  369. package/src/views/CanvasEditor/components/LibraryItem.d.ts +14 -0
  370. package/src/views/CanvasEditor/components/LibraryItem.d.ts.map +1 -0
  371. package/src/views/CanvasEditor/components/LibraryItem.js +43 -0
  372. package/src/views/CanvasEditor/components/PrivacySettingsSection.d.ts +15 -0
  373. package/src/views/CanvasEditor/components/PrivacySettingsSection.d.ts.map +1 -0
  374. package/src/views/CanvasEditor/components/PrivacySettingsSection.js +63 -0
  375. package/src/views/CanvasEditor/components/index.d.ts +21 -0
  376. package/src/views/CanvasEditor/components/index.d.ts.map +1 -0
  377. package/src/views/CanvasEditor/components/index.js +12 -0
  378. package/src/views/CanvasEditor/hooks/index.d.ts +10 -0
  379. package/src/views/CanvasEditor/hooks/index.d.ts.map +1 -0
  380. package/src/views/CanvasEditor/hooks/index.js +9 -0
  381. package/src/views/CanvasEditor/hooks/useHeroBlock.d.ts +8 -0
  382. package/src/views/CanvasEditor/hooks/useHeroBlock.d.ts.map +1 -0
  383. package/src/views/CanvasEditor/hooks/useHeroBlock.js +79 -0
  384. package/src/views/CanvasEditor/hooks/useKeyboardShortcuts.d.ts +3 -0
  385. package/src/views/CanvasEditor/hooks/useKeyboardShortcuts.d.ts.map +1 -0
  386. package/src/views/CanvasEditor/hooks/useKeyboardShortcuts.js +114 -0
  387. package/src/views/CanvasEditor/hooks/usePostLoader.d.ts +5 -0
  388. package/src/views/CanvasEditor/hooks/usePostLoader.d.ts.map +1 -0
  389. package/src/views/CanvasEditor/hooks/usePostLoader.js +32 -0
  390. package/src/views/CanvasEditor/hooks/useRegisteredBlocks.d.ts +2 -0
  391. package/src/views/CanvasEditor/hooks/useRegisteredBlocks.d.ts.map +1 -0
  392. package/src/views/CanvasEditor/hooks/useRegisteredBlocks.js +47 -0
  393. package/src/views/CanvasEditor/hooks/useUnsavedChanges.d.ts +25 -0
  394. package/src/views/CanvasEditor/hooks/useUnsavedChanges.d.ts.map +1 -0
  395. package/src/views/CanvasEditor/hooks/useUnsavedChanges.js +285 -0
  396. package/src/views/CanvasEditor/index.d.ts +16 -0
  397. package/src/views/CanvasEditor/index.d.ts.map +1 -0
  398. package/src/views/CanvasEditor/index.js +9 -0
  399. package/src/views/PostManager/EmptyState.d.ts +10 -0
  400. package/src/views/PostManager/EmptyState.d.ts.map +1 -0
  401. package/src/views/PostManager/EmptyState.js +12 -0
  402. package/src/views/PostManager/PostActionsMenu.d.ts +12 -0
  403. package/src/views/PostManager/PostActionsMenu.d.ts.map +1 -0
  404. package/src/views/PostManager/PostActionsMenu.js +58 -0
  405. package/src/views/PostManager/PostCards.d.ts +15 -0
  406. package/src/views/PostManager/PostCards.d.ts.map +1 -0
  407. package/src/views/PostManager/PostCards.js +79 -0
  408. package/src/views/PostManager/PostFilters.d.ts +16 -0
  409. package/src/views/PostManager/PostFilters.d.ts.map +1 -0
  410. package/src/views/PostManager/PostFilters.js +10 -0
  411. package/src/views/PostManager/PostManagerView.d.ts +11 -0
  412. package/src/views/PostManager/PostManagerView.d.ts.map +1 -0
  413. package/src/views/PostManager/PostManagerView.js +174 -0
  414. package/src/views/PostManager/PostStats.d.ts +11 -0
  415. package/src/views/PostManager/PostStats.d.ts.map +1 -0
  416. package/src/views/PostManager/PostStats.js +46 -0
  417. package/src/views/PostManager/PostTable.d.ts +15 -0
  418. package/src/views/PostManager/PostTable.d.ts.map +1 -0
  419. package/src/views/PostManager/PostTable.js +79 -0
  420. package/src/views/PostManager/index.d.ts +12 -0
  421. package/src/views/PostManager/index.d.ts.map +1 -0
  422. package/src/views/PostManager/index.js +11 -0
  423. package/src/views/Preview/PreviewBridgeView.d.ts +12 -0
  424. package/src/views/Preview/PreviewBridgeView.d.ts.map +1 -0
  425. package/src/views/Preview/PreviewBridgeView.js +11 -0
  426. package/src/views/Preview/index.d.ts +6 -0
  427. package/src/views/Preview/index.d.ts.map +1 -0
  428. package/src/views/Preview/index.js +4 -0
  429. package/src/views/Settings/SettingsView.d.ts +10 -0
  430. package/src/views/Settings/SettingsView.d.ts.map +1 -0
  431. package/src/views/Settings/SettingsView.js +111 -0
  432. package/src/views/Settings/index.d.ts +6 -0
  433. package/src/views/Settings/index.d.ts.map +1 -0
  434. package/src/views/Settings/index.js +4 -0
  435. package/src/views/SlugSEO/SlugSEOManagerView.d.ts +12 -0
  436. package/src/views/SlugSEO/SlugSEOManagerView.d.ts.map +1 -0
  437. package/src/views/SlugSEO/SlugSEOManagerView.js +11 -0
  438. package/src/views/SlugSEO/index.d.ts +6 -0
  439. package/src/views/SlugSEO/index.d.ts.map +1 -0
  440. package/src/views/SlugSEO/index.js +4 -0
@@ -0,0 +1,144 @@
1
+ /**
2
+ * Rich Text Preview Component
3
+ * Renders HTML content with client-provided styles
4
+ * Also supports plain text with formatting markers using the plugin-content parser
5
+ */
6
+ 'use client';
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ import React from 'react';
9
+ import { parse, useParserConfig } from '@jhits/plugin-content';
10
+ /**
11
+ * Check if content is HTML or plain text with formatting markers
12
+ */
13
+ function isHtmlContent(content) {
14
+ // If content contains HTML tags, it's HTML
15
+ if (/<[a-z][\s\S]*>/i.test(content)) {
16
+ return true;
17
+ }
18
+ // If content contains HTML entities, it's likely HTML
19
+ if (/&[a-z]+;/i.test(content)) {
20
+ return true;
21
+ }
22
+ // Otherwise, it's plain text (potentially with formatting markers)
23
+ return false;
24
+ }
25
+ export function RichTextPreview({ content, formatting, className = '', }) {
26
+ // Handle empty content
27
+ if (!content || content.trim() === '') {
28
+ return _jsx("div", { className: className, children: "\u00A0" });
29
+ }
30
+ // Get parser config from context (provided by client app)
31
+ const parserConfig = useParserConfig();
32
+ // Check if content is HTML or plain text
33
+ const isHtml = isHtmlContent(content);
34
+ // If it's plain text, use the parser from plugin-content
35
+ if (!isHtml) {
36
+ const parsedContent = parse(content, false, parserConfig);
37
+ return (_jsx("div", { className: className, children: parsedContent }));
38
+ }
39
+ // Otherwise, continue with HTML rendering logic
40
+ // Apply client-provided styles to HTML content
41
+ const applyStyles = (html) => {
42
+ if (!formatting?.styles)
43
+ return html;
44
+ const styles = formatting.styles;
45
+ let styledHtml = html;
46
+ // Apply bold style - handle both <strong> and <b> tags
47
+ if (styles.bold) {
48
+ // Replace <strong> tags
49
+ styledHtml = styledHtml.replace(/<strong\b([^>]*)>/gi, (match, attrs) => {
50
+ // Check if class already exists
51
+ if (attrs && attrs.includes('class=')) {
52
+ return match.replace(/class="([^"]*)"/, `class="$1 ${styles.bold}"`);
53
+ }
54
+ return `<strong class="${styles.bold}">`;
55
+ });
56
+ // Replace <b> tags
57
+ styledHtml = styledHtml.replace(/<b\b([^>]*)>/gi, (match, attrs) => {
58
+ if (attrs && attrs.includes('class=')) {
59
+ return match.replace(/class="([^"]*)"/, `class="$1 ${styles.bold}"`);
60
+ }
61
+ return `<b class="${styles.bold}">`;
62
+ });
63
+ }
64
+ // Apply italic style - handle both <em> and <i> tags
65
+ if (styles.italic) {
66
+ styledHtml = styledHtml.replace(/<em\b([^>]*)>/gi, (match, attrs) => {
67
+ if (attrs && attrs.includes('class=')) {
68
+ return match.replace(/class="([^"]*)"/, `class="$1 ${styles.italic}"`);
69
+ }
70
+ return `<em class="${styles.italic}">`;
71
+ });
72
+ styledHtml = styledHtml.replace(/<i\b([^>]*)>/gi, (match, attrs) => {
73
+ if (attrs && attrs.includes('class=')) {
74
+ return match.replace(/class="([^"]*)"/, `class="$1 ${styles.italic}"`);
75
+ }
76
+ return `<i class="${styles.italic}">`;
77
+ });
78
+ }
79
+ // Apply underline style
80
+ if (styles.underline) {
81
+ styledHtml = styledHtml.replace(/<u\b([^>]*)>/gi, (match, attrs) => {
82
+ if (attrs && attrs.includes('class=')) {
83
+ return match.replace(/class="([^"]*)"/, `class="$1 ${styles.underline}"`);
84
+ }
85
+ return `<u class="${styles.underline}">`;
86
+ });
87
+ }
88
+ // Apply link style
89
+ if (styles.link) {
90
+ styledHtml = styledHtml.replace(/<a\b([^>]*)>/gi, (match, attrs) => {
91
+ if (attrs && attrs.includes('class=')) {
92
+ return match.replace(/class="([^"]*)"/, `class="$1 ${styles.link}"`);
93
+ }
94
+ return match.replace('>', ` class="${styles.link}">`);
95
+ });
96
+ }
97
+ // Apply color classes to spans (preserve existing classes)
98
+ if (styles.colorClasses) {
99
+ Object.entries(styles.colorClasses).forEach(([color, colorClass]) => {
100
+ // Match spans that might have the color class already or need it added
101
+ const regex = new RegExp(`<span([^>]*)class="([^"]*)"([^>]*)>`, 'gi');
102
+ styledHtml = styledHtml.replace(regex, (match, beforeAttrs, existingClasses, afterAttrs) => {
103
+ // Don't add if class already exists
104
+ if (existingClasses.includes(colorClass)) {
105
+ return match;
106
+ }
107
+ // Add the color class
108
+ return `<span${beforeAttrs}class="${existingClasses} ${colorClass}"${afterAttrs}>`;
109
+ });
110
+ // Also handle spans without class attribute
111
+ const regexNoClass = new RegExp(`<span([^>]*)>`, 'gi');
112
+ styledHtml = styledHtml.replace(regexNoClass, (match, attrs) => {
113
+ // Only add if this span doesn't already have a class and we're looking for a specific color
114
+ if (!attrs.includes('class=')) {
115
+ return match.replace('>', ` class="${colorClass}">`);
116
+ }
117
+ return match;
118
+ });
119
+ });
120
+ }
121
+ return styledHtml;
122
+ };
123
+ const styledContent = formatting ? applyStyles(content) : content;
124
+ // For rendering, we'll use a ref to set innerHTML only on the client side
125
+ // This avoids SSR issues while still allowing HTML rendering
126
+ const contentRef = React.useRef(null);
127
+ React.useEffect(() => {
128
+ if (contentRef.current && styledContent) {
129
+ contentRef.current.innerHTML = styledContent;
130
+ }
131
+ }, [styledContent]);
132
+ // For server-side rendering, render plain text
133
+ if (typeof window === 'undefined') {
134
+ const textContent = styledContent
135
+ .replace(/<[^>]*>/g, '')
136
+ .replace(/&nbsp;/g, ' ')
137
+ .replace(/&amp;/g, '&')
138
+ .replace(/&lt;/g, '<')
139
+ .replace(/&gt;/g, '>')
140
+ .replace(/&quot;/g, '"');
141
+ return (_jsx("div", { className: className, children: textContent || '\u00A0' }));
142
+ }
143
+ return (_jsx("div", { ref: contentRef, className: className }));
144
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Rich Text Utilities
3
+ * Export rich text editor and preview components
4
+ */
5
+ export { RichTextEditor } from './RichTextEditor';
6
+ export { RichTextPreview } from './RichTextPreview';
7
+ export type { RichTextFormattingConfig, RichTextEditorProps } from './RichTextEditor';
8
+ export type { RichTextPreviewProps } from './RichTextPreview';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/rich-text/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACtF,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Rich Text Utilities
3
+ * Export rich text editor and preview components
4
+ */
5
+ export { RichTextEditor } from './RichTextEditor';
6
+ export { RichTextPreview } from './RichTextPreview';
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Block Helper Utilities
3
+ * Functions for working with blocks, including nested structures
4
+ */
5
+ import { Block } from '../../types/block';
6
+ /**
7
+ * Get child blocks from a container block
8
+ * Handles both Block[] and string[] formats
9
+ */
10
+ export declare function getChildBlocks(block: Block, allBlocks?: Block[]): Block[];
11
+ /**
12
+ * Check if a block is a container (has children or is marked as container)
13
+ */
14
+ export declare function isContainerBlock(block: Block, blockRegistry: {
15
+ get: (type: string) => {
16
+ isContainer?: boolean;
17
+ } | undefined;
18
+ }): boolean;
19
+ /**
20
+ * Find a block by ID recursively (including nested blocks)
21
+ */
22
+ export declare function findBlockById(blocks: Block[], id: string): Block | null;
23
+ //# sourceMappingURL=blockHelpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blockHelpers.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/blockHelpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,GAAE,KAAK,EAAO,GAAG,KAAK,EAAE,CAiC7E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE;IAAE,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK;QAAE,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,SAAS,CAAA;CAAE,GAAG,OAAO,CAGvI;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,CAavE"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Block Helper Utilities
3
+ * Functions for working with blocks, including nested structures
4
+ */
5
+ /**
6
+ * Get child blocks from a container block
7
+ * Handles both Block[] and string[] formats
8
+ */
9
+ export function getChildBlocks(block, allBlocks = []) {
10
+ if (!block.children || block.children.length === 0) {
11
+ return [];
12
+ }
13
+ // If children are Block objects, return them directly
14
+ if (block.children.length > 0 && typeof block.children[0] === 'object' && 'id' in block.children[0]) {
15
+ return block.children;
16
+ }
17
+ // If children are IDs, resolve them from allBlocks (recursively search nested blocks)
18
+ const childIds = block.children;
19
+ const resolvedBlocks = [];
20
+ function findBlockRecursive(blocks, id) {
21
+ for (const b of blocks) {
22
+ if (b.id === id)
23
+ return b;
24
+ if (b.children && Array.isArray(b.children) && b.children.length > 0) {
25
+ if (typeof b.children[0] === 'object') {
26
+ const found = findBlockRecursive(b.children, id);
27
+ if (found)
28
+ return found;
29
+ }
30
+ }
31
+ }
32
+ return null;
33
+ }
34
+ childIds.forEach(id => {
35
+ const found = findBlockRecursive(allBlocks, id);
36
+ if (found)
37
+ resolvedBlocks.push(found);
38
+ });
39
+ return resolvedBlocks;
40
+ }
41
+ /**
42
+ * Check if a block is a container (has children or is marked as container)
43
+ */
44
+ export function isContainerBlock(block, blockRegistry) {
45
+ const definition = blockRegistry.get(block.type);
46
+ return definition?.isContainer === true || (block.children !== undefined && block.children.length > 0);
47
+ }
48
+ /**
49
+ * Find a block by ID recursively (including nested blocks)
50
+ */
51
+ export function findBlockById(blocks, id) {
52
+ for (const block of blocks) {
53
+ if (block.id === id) {
54
+ return block;
55
+ }
56
+ if (block.children && Array.isArray(block.children) && block.children.length > 0) {
57
+ if (typeof block.children[0] === 'object') {
58
+ const found = findBlockById(block.children, id);
59
+ if (found)
60
+ return found;
61
+ }
62
+ }
63
+ }
64
+ return null;
65
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Plugin Configuration Validation Utilities
3
+ * Validates plugin configuration and custom blocks
4
+ */
5
+ import { ClientBlockDefinition } from '../../types/block';
6
+ /**
7
+ * Check if a route requires the hero block
8
+ */
9
+ export declare function routeRequiresHeroBlock(route: string): boolean;
10
+ /**
11
+ * Find hero block definition in custom blocks
12
+ */
13
+ export declare function findHeroBlock(customBlocks: ClientBlockDefinition[]): ClientBlockDefinition | undefined;
14
+ /**
15
+ * Hook to validate hero block configuration
16
+ * Only validates for routes that require it, and waits for customBlocks to load
17
+ *
18
+ * @param route - Current route (e.g., 'posts', 'editor', 'new')
19
+ * @param customBlocks - Array of custom block definitions
20
+ * @param propsCustomBlocks - Custom blocks from props (for immediate validation)
21
+ */
22
+ export declare function useHeroBlockValidation(route: string, customBlocks: ClientBlockDefinition[], propsCustomBlocks?: ClientBlockDefinition[]): void;
23
+ //# sourceMappingURL=configValidation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configValidation.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/configValidation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAO1D;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,YAAY,EAAE,qBAAqB,EAAE,GAAG,qBAAqB,GAAG,SAAS,CAEtG;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAClC,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,qBAAqB,EAAE,EACrC,iBAAiB,CAAC,EAAE,qBAAqB,EAAE,GAC5C,IAAI,CAgGN"}
@@ -0,0 +1,111 @@
1
+ /**
2
+ * Plugin Configuration Validation Utilities
3
+ * Validates plugin configuration and custom blocks
4
+ */
5
+ import { useEffect, useState, useMemo } from 'react';
6
+ /**
7
+ * Routes that require the hero block to be defined
8
+ */
9
+ const ROUTES_REQUIRING_HERO_BLOCK = ['editor', 'new', 'preview'];
10
+ /**
11
+ * Check if a route requires the hero block
12
+ */
13
+ export function routeRequiresHeroBlock(route) {
14
+ return ROUTES_REQUIRING_HERO_BLOCK.includes(route);
15
+ }
16
+ /**
17
+ * Find hero block definition in custom blocks
18
+ */
19
+ export function findHeroBlock(customBlocks) {
20
+ return customBlocks.find(block => block.type === 'hero');
21
+ }
22
+ /**
23
+ * Hook to validate hero block configuration
24
+ * Only validates for routes that require it, and waits for customBlocks to load
25
+ *
26
+ * @param route - Current route (e.g., 'posts', 'editor', 'new')
27
+ * @param customBlocks - Array of custom block definitions
28
+ * @param propsCustomBlocks - Custom blocks from props (for immediate validation)
29
+ */
30
+ export function useHeroBlockValidation(route, customBlocks, propsCustomBlocks) {
31
+ const needsHeroBlock = useMemo(() => routeRequiresHeroBlock(route), [route]);
32
+ const heroBlockDefinition = useMemo(() => {
33
+ // Only search for hero block if route needs it
34
+ return needsHeroBlock ? findHeroBlock(customBlocks) : undefined;
35
+ }, [customBlocks, needsHeroBlock]);
36
+ // Track if we've given customBlocks time to load from window global
37
+ // This prevents false errors when customBlocks are loaded asynchronously
38
+ // Only track this if we actually need the hero block
39
+ const [hasCheckedForBlocks, setHasCheckedForBlocks] = useState(false);
40
+ // Give window global a chance to load before validating
41
+ // Only do this if the route needs the hero block
42
+ useEffect(() => {
43
+ // Early return: Skip all validation logic if route doesn't need hero block
44
+ if (!needsHeroBlock) {
45
+ return;
46
+ }
47
+ if (typeof window === 'undefined') {
48
+ setHasCheckedForBlocks(true); // Server-side, no need to wait
49
+ return;
50
+ }
51
+ // If props are provided, we can validate immediately
52
+ if (propsCustomBlocks && propsCustomBlocks.length > 0) {
53
+ setHasCheckedForBlocks(true);
54
+ return;
55
+ }
56
+ // Check if window global is already available
57
+ if (window.__JHITS_PLUGIN_PROPS__?.['plugin-blog']?.customBlocks) {
58
+ setHasCheckedForBlocks(true);
59
+ return;
60
+ }
61
+ // Retry mechanism: check multiple times with increasing delays
62
+ // This handles the case where BlogPluginInit's useEffect runs after BlogPlugin mounts
63
+ // BlogPluginInit runs initBlogPlugin in useEffect, which may execute after BlogPlugin's first render
64
+ let attempt = 0;
65
+ const maxAttempts = 6;
66
+ const delays = [50, 100, 200, 300, 500, 1000]; // Progressive delays: total ~2.15s
67
+ const timers = [];
68
+ const checkWithRetry = () => {
69
+ const windowGlobal = window.__JHITS_PLUGIN_PROPS__?.['plugin-blog']?.customBlocks;
70
+ if (windowGlobal && windowGlobal.length > 0) {
71
+ // Found it! Mark as checked
72
+ setHasCheckedForBlocks(true);
73
+ return;
74
+ }
75
+ if (attempt < maxAttempts) {
76
+ const timer = setTimeout(() => {
77
+ attempt++;
78
+ checkWithRetry();
79
+ }, delays[attempt]);
80
+ timers.push(timer);
81
+ }
82
+ else {
83
+ // After all retries, mark as checked (even if not found)
84
+ // This prevents infinite waiting and allows validation to proceed
85
+ setHasCheckedForBlocks(true);
86
+ }
87
+ };
88
+ // Start checking
89
+ checkWithRetry();
90
+ // Cleanup all timers
91
+ return () => {
92
+ timers.forEach(timer => clearTimeout(timer));
93
+ };
94
+ }, [propsCustomBlocks, needsHeroBlock]);
95
+ // Validate that Hero block is required (only for editor routes, and only after we've checked for blocks)
96
+ useEffect(() => {
97
+ // Early return if route doesn't need hero block - no validation needed
98
+ if (!needsHeroBlock) {
99
+ return;
100
+ }
101
+ // Only validate if:
102
+ // 1. We're in a route that needs the hero block (already checked above)
103
+ // 2. We've given customBlocks time to load (hasCheckedForBlocks is true)
104
+ // 3. The hero block is still not found
105
+ if (hasCheckedForBlocks && !heroBlockDefinition) {
106
+ console.error('[BlogPlugin] Hero block is REQUIRED but not found in customBlocks. ' +
107
+ 'Please define a block with type: "hero" in your blog config. ' +
108
+ `Current route: "${route}"`);
109
+ }
110
+ }, [heroBlockDefinition, needsHeroBlock, hasCheckedForBlocks, route]);
111
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Utility exports
3
+ */
4
+ export * from './slugify';
5
+ export * from './blockHelpers';
6
+ export * from './configValidation';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Utility exports
3
+ */
4
+ export * from './slugify';
5
+ export * from './blockHelpers';
6
+ export * from './configValidation';
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Slug Utilities
3
+ * Functions for generating and validating URL slugs
4
+ */
5
+ /**
6
+ * Convert a string to a URL-friendly slug
7
+ */
8
+ export declare function slugify(text: string): string;
9
+ /**
10
+ * Generate a slug from a title
11
+ * Automatically handles edge cases and ensures uniqueness
12
+ */
13
+ export declare function generateSlugFromTitle(title: string, existingSlugs?: string[]): string;
14
+ /**
15
+ * Validate a slug format
16
+ */
17
+ export declare function isValidSlug(slug: string): boolean;
18
+ /**
19
+ * Check if a slug collides with existing slugs
20
+ */
21
+ export declare function checkSlugCollision(slug: string, existingSlugs: string[], excludeId?: string): {
22
+ isCollision: boolean;
23
+ conflictingId?: string;
24
+ };
25
+ //# sourceMappingURL=slugify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slugify.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/slugify.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAU5C;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,GAAE,MAAM,EAAO,GAAG,MAAM,CAkBzF;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIjD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG;IAC3F,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B,CAkBA"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Slug Utilities
3
+ * Functions for generating and validating URL slugs
4
+ */
5
+ /**
6
+ * Convert a string to a URL-friendly slug
7
+ */
8
+ export function slugify(text) {
9
+ return text
10
+ .toString()
11
+ .toLowerCase()
12
+ .trim()
13
+ .replace(/\s+/g, '-') // Replace spaces with hyphens
14
+ .replace(/[^\w\-]+/g, '') // Remove all non-word chars
15
+ .replace(/\-\-+/g, '-') // Replace multiple hyphens with single hyphen
16
+ .replace(/^-+/, '') // Trim hyphens from start
17
+ .replace(/-+$/, ''); // Trim hyphens from end
18
+ }
19
+ /**
20
+ * Generate a slug from a title
21
+ * Automatically handles edge cases and ensures uniqueness
22
+ */
23
+ export function generateSlugFromTitle(title, existingSlugs = []) {
24
+ let baseSlug = slugify(title);
25
+ // If slug is empty after processing, use a fallback
26
+ if (!baseSlug) {
27
+ baseSlug = 'untitled-post';
28
+ }
29
+ // Check for collisions and append number if needed
30
+ let finalSlug = baseSlug;
31
+ let counter = 1;
32
+ while (existingSlugs.includes(finalSlug)) {
33
+ finalSlug = `${baseSlug}-${counter}`;
34
+ counter++;
35
+ }
36
+ return finalSlug;
37
+ }
38
+ /**
39
+ * Validate a slug format
40
+ */
41
+ export function isValidSlug(slug) {
42
+ // Slug should be lowercase, alphanumeric with hyphens
43
+ const slugRegex = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
44
+ return slugRegex.test(slug) && slug.length > 0 && slug.length <= 200;
45
+ }
46
+ /**
47
+ * Check if a slug collides with existing slugs
48
+ */
49
+ export function checkSlugCollision(slug, existingSlugs, excludeId) {
50
+ // Normalize the slug for comparison
51
+ const normalizedSlug = slug.toLowerCase().trim();
52
+ // Check against existing slugs (excluding current post if editing)
53
+ for (const existing of existingSlugs) {
54
+ if (existing.toLowerCase().trim() === normalizedSlug) {
55
+ // If we have an excludeId, we need to check if this is the same post
56
+ // This would require additional context (like a post ID map)
57
+ // For now, we'll return collision if it matches
58
+ return {
59
+ isCollision: true,
60
+ conflictingId: existing,
61
+ };
62
+ }
63
+ }
64
+ return { isCollision: false };
65
+ }
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Block Registry
3
+ * Dynamic registry for all block types in the system
4
+ * Multi-Tenant Architecture: Blocks are provided by client applications
5
+ *
6
+ * The registry is a singleton that starts empty and is populated by client apps
7
+ */
8
+ import { BlockTypeDefinition, BlockRegistry as IBlockRegistry, ClientBlockDefinition } from '../types/block';
9
+ /**
10
+ * Dynamic Block Registry Implementation
11
+ * No default blocks - all blocks must be registered by client applications
12
+ */
13
+ declare class BlockRegistryImpl implements IBlockRegistry {
14
+ private _types;
15
+ get types(): Map<string, BlockTypeDefinition>;
16
+ /**
17
+ * Register a single block type
18
+ */
19
+ register(definition: BlockTypeDefinition): void;
20
+ /**
21
+ * Register multiple client blocks at once
22
+ * This is the primary method for client applications to register their blocks
23
+ */
24
+ registerClientBlocks(definitions: ClientBlockDefinition[]): void;
25
+ /**
26
+ * Get block type definition by type string
27
+ */
28
+ get(type: string): BlockTypeDefinition | undefined;
29
+ /**
30
+ * Get all registered block types
31
+ */
32
+ getAll(): BlockTypeDefinition[];
33
+ /**
34
+ * Get block types filtered by category
35
+ */
36
+ getByCategory(category: BlockTypeDefinition['category']): BlockTypeDefinition[];
37
+ /**
38
+ * Check if a block type is registered
39
+ */
40
+ has(type: string): boolean;
41
+ /**
42
+ * Unregister a block type (useful for testing or dynamic loading)
43
+ */
44
+ unregister(type: string): boolean;
45
+ /**
46
+ * Clear all registered block types
47
+ * Useful for testing or resetting the registry
48
+ */
49
+ clear(): void;
50
+ /**
51
+ * Get count of registered blocks
52
+ */
53
+ getCount(): number;
54
+ }
55
+ export declare const blockRegistry: BlockRegistryImpl;
56
+ export {};
57
+ /**
58
+ * NOTE: No default blocks are registered automatically.
59
+ * Client applications must call registerClientBlocks() to populate the registry.
60
+ * This ensures the editor is a true "shell" without hardcoded blocks.
61
+ */
62
+ //# sourceMappingURL=BlockRegistry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BlockRegistry.d.ts","sourceRoot":"","sources":["../../src/registry/BlockRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACH,mBAAmB,EACnB,aAAa,IAAI,cAAc,EAC/B,qBAAqB,EACxB,MAAM,gBAAgB,CAAC;AAExB;;;GAGG;AACH,cAAM,iBAAkB,YAAW,cAAc;IAC7C,OAAO,CAAC,MAAM,CAA+C;IAE7D,IAAI,KAAK,IAAI,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAE5C;IAED;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,mBAAmB,GAAG,IAAI;IAa/C;;;OAGG;IACH,oBAAoB,CAAC,WAAW,EAAE,qBAAqB,EAAE,GAAG,IAAI;IAmChE;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS;IAIlD;;OAEG;IACH,MAAM,IAAI,mBAAmB,EAAE;IAI/B;;OAEG;IACH,aAAa,CAAC,QAAQ,EAAE,mBAAmB,CAAC,UAAU,CAAC,GAAG,mBAAmB,EAAE;IAI/E;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1B;;OAEG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIjC;;;OAGG;IACH,KAAK,IAAI,IAAI;IAIb;;OAEG;IACH,QAAQ,IAAI,MAAM;CAGrB;AAGD,eAAO,MAAM,aAAa,mBAA0B,CAAC;;AAErD;;;;GAIG"}