@jhits/plugin-blog 0.0.10 → 0.0.12

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 (276) hide show
  1. package/package.json +4 -5
  2. package/src/api/categories.ts +0 -43
  3. package/src/api/check-title.ts +0 -60
  4. package/src/api/config-handler.ts +0 -76
  5. package/src/api/handler.ts +0 -418
  6. package/src/api/index.ts +0 -33
  7. package/src/api/route.ts +0 -116
  8. package/src/api/router.ts +0 -128
  9. package/src/api-server.ts +0 -11
  10. package/src/config.ts +0 -161
  11. package/src/hooks/index.d.ts +0 -8
  12. package/src/hooks/index.d.ts.map +0 -1
  13. package/src/hooks/index.js +0 -7
  14. package/src/hooks/index.ts +0 -9
  15. package/src/hooks/useBlog.d.ts +0 -31
  16. package/src/hooks/useBlog.d.ts.map +0 -1
  17. package/src/hooks/useBlog.js +0 -57
  18. package/src/hooks/useBlog.ts +0 -85
  19. package/src/hooks/useBlogs.d.ts +0 -39
  20. package/src/hooks/useBlogs.d.ts.map +0 -1
  21. package/src/hooks/useBlogs.js +0 -82
  22. package/src/hooks/useBlogs.ts +0 -123
  23. package/src/hooks/useCategories.d.ts +0 -9
  24. package/src/hooks/useCategories.d.ts.map +0 -1
  25. package/src/hooks/useCategories.js +0 -70
  26. package/src/hooks/useCategories.ts +0 -76
  27. package/src/index.d.ts +0 -55
  28. package/src/index.d.ts.map +0 -1
  29. package/src/index.js +0 -228
  30. package/src/index.server.ts +0 -14
  31. package/src/index.tsx +0 -335
  32. package/src/init.d.ts +0 -40
  33. package/src/init.d.ts.map +0 -1
  34. package/src/init.js +0 -41
  35. package/src/init.tsx +0 -63
  36. package/src/lib/blocks/BlockRenderer.d.ts +0 -54
  37. package/src/lib/blocks/BlockRenderer.d.ts.map +0 -1
  38. package/src/lib/blocks/BlockRenderer.js +0 -54
  39. package/src/lib/blocks/BlockRenderer.tsx +0 -141
  40. package/src/lib/blocks/index.ts +0 -6
  41. package/src/lib/config-storage.d.ts +0 -30
  42. package/src/lib/config-storage.d.ts.map +0 -1
  43. package/src/lib/config-storage.js +0 -31
  44. package/src/lib/config-storage.ts +0 -65
  45. package/src/lib/index.ts +0 -9
  46. package/src/lib/layouts/blocks/ColumnsBlock.d.ts +0 -25
  47. package/src/lib/layouts/blocks/ColumnsBlock.d.ts.map +0 -1
  48. package/src/lib/layouts/blocks/ColumnsBlock.js +0 -182
  49. package/src/lib/layouts/blocks/ColumnsBlock.tsx +0 -298
  50. package/src/lib/layouts/blocks/ColumnsBlock.tsx.tmp +0 -81
  51. package/src/lib/layouts/blocks/SectionBlock.d.ts +0 -25
  52. package/src/lib/layouts/blocks/SectionBlock.d.ts.map +0 -1
  53. package/src/lib/layouts/blocks/SectionBlock.js +0 -44
  54. package/src/lib/layouts/blocks/SectionBlock.tsx +0 -104
  55. package/src/lib/layouts/blocks/index.ts +0 -8
  56. package/src/lib/layouts/index.d.ts +0 -23
  57. package/src/lib/layouts/index.d.ts.map +0 -1
  58. package/src/lib/layouts/index.js +0 -45
  59. package/src/lib/layouts/index.ts +0 -52
  60. package/src/lib/layouts/registerLayoutBlocks.d.ts +0 -9
  61. package/src/lib/layouts/registerLayoutBlocks.d.ts.map +0 -1
  62. package/src/lib/layouts/registerLayoutBlocks.js +0 -60
  63. package/src/lib/layouts/registerLayoutBlocks.ts +0 -64
  64. package/src/lib/mappers/apiMapper.d.ts +0 -66
  65. package/src/lib/mappers/apiMapper.d.ts.map +0 -1
  66. package/src/lib/mappers/apiMapper.js +0 -191
  67. package/src/lib/mappers/apiMapper.ts +0 -254
  68. package/src/lib/migration/index.ts +0 -6
  69. package/src/lib/migration/mapper.ts +0 -140
  70. package/src/lib/rich-text/RichTextEditor.d.ts +0 -45
  71. package/src/lib/rich-text/RichTextEditor.d.ts.map +0 -1
  72. package/src/lib/rich-text/RichTextEditor.js +0 -564
  73. package/src/lib/rich-text/RichTextEditor.tsx +0 -826
  74. package/src/lib/rich-text/RichTextPreview.d.ts +0 -16
  75. package/src/lib/rich-text/RichTextPreview.d.ts.map +0 -1
  76. package/src/lib/rich-text/RichTextPreview.js +0 -144
  77. package/src/lib/rich-text/RichTextPreview.tsx +0 -210
  78. package/src/lib/rich-text/index.d.ts +0 -9
  79. package/src/lib/rich-text/index.d.ts.map +0 -1
  80. package/src/lib/rich-text/index.js +0 -6
  81. package/src/lib/rich-text/index.ts +0 -10
  82. package/src/lib/utils/blockHelpers.d.ts +0 -23
  83. package/src/lib/utils/blockHelpers.d.ts.map +0 -1
  84. package/src/lib/utils/blockHelpers.js +0 -65
  85. package/src/lib/utils/blockHelpers.ts +0 -72
  86. package/src/lib/utils/configValidation.d.ts +0 -23
  87. package/src/lib/utils/configValidation.d.ts.map +0 -1
  88. package/src/lib/utils/configValidation.js +0 -113
  89. package/src/lib/utils/configValidation.ts +0 -137
  90. package/src/lib/utils/index.ts +0 -8
  91. package/src/lib/utils/slugify.ts +0 -79
  92. package/src/registry/BlockRegistry.d.ts +0 -62
  93. package/src/registry/BlockRegistry.d.ts.map +0 -1
  94. package/src/registry/BlockRegistry.js +0 -112
  95. package/src/registry/BlockRegistry.ts +0 -139
  96. package/src/registry/index.d.ts +0 -6
  97. package/src/registry/index.d.ts.map +0 -1
  98. package/src/registry/index.js +0 -4
  99. package/src/registry/index.ts +0 -11
  100. package/src/state/EditorContext.d.ts +0 -45
  101. package/src/state/EditorContext.d.ts.map +0 -1
  102. package/src/state/EditorContext.js +0 -215
  103. package/src/state/EditorContext.tsx +0 -283
  104. package/src/state/index.d.ts +0 -7
  105. package/src/state/index.d.ts.map +0 -1
  106. package/src/state/index.js +0 -6
  107. package/src/state/index.ts +0 -8
  108. package/src/state/reducer.d.ts +0 -11
  109. package/src/state/reducer.d.ts.map +0 -1
  110. package/src/state/reducer.js +0 -443
  111. package/src/state/reducer.ts +0 -694
  112. package/src/state/types.d.ts +0 -162
  113. package/src/state/types.d.ts.map +0 -1
  114. package/src/state/types.js +0 -27
  115. package/src/state/types.ts +0 -160
  116. package/src/types/block.d.ts +0 -221
  117. package/src/types/block.d.ts.map +0 -1
  118. package/src/types/block.js +0 -6
  119. package/src/types/block.ts +0 -269
  120. package/src/types/index.d.ts +0 -8
  121. package/src/types/index.d.ts.map +0 -1
  122. package/src/types/index.js +0 -5
  123. package/src/types/index.ts +0 -17
  124. package/src/types/post.d.ts +0 -136
  125. package/src/types/post.d.ts.map +0 -1
  126. package/src/types/post.js +0 -5
  127. package/src/types/post.ts +0 -169
  128. package/src/utils/client.d.ts +0 -48
  129. package/src/utils/client.d.ts.map +0 -1
  130. package/src/utils/client.js +0 -77
  131. package/src/utils/client.ts +0 -122
  132. package/src/utils/index.ts +0 -7
  133. package/src/views/CanvasEditor/BlockWrapper.d.ts +0 -16
  134. package/src/views/CanvasEditor/BlockWrapper.d.ts.map +0 -1
  135. package/src/views/CanvasEditor/BlockWrapper.js +0 -276
  136. package/src/views/CanvasEditor/BlockWrapper.tsx +0 -522
  137. package/src/views/CanvasEditor/CanvasEditorView.d.ts +0 -14
  138. package/src/views/CanvasEditor/CanvasEditorView.d.ts.map +0 -1
  139. package/src/views/CanvasEditor/CanvasEditorView.js +0 -209
  140. package/src/views/CanvasEditor/CanvasEditorView.tsx +0 -337
  141. package/src/views/CanvasEditor/EditorBody.d.ts +0 -22
  142. package/src/views/CanvasEditor/EditorBody.d.ts.map +0 -1
  143. package/src/views/CanvasEditor/EditorBody.js +0 -505
  144. package/src/views/CanvasEditor/EditorBody.tsx +0 -665
  145. package/src/views/CanvasEditor/EditorHeader.d.ts +0 -18
  146. package/src/views/CanvasEditor/EditorHeader.d.ts.map +0 -1
  147. package/src/views/CanvasEditor/EditorHeader.js +0 -101
  148. package/src/views/CanvasEditor/EditorHeader.tsx +0 -268
  149. package/src/views/CanvasEditor/LayoutContainer.d.ts +0 -17
  150. package/src/views/CanvasEditor/LayoutContainer.d.ts.map +0 -1
  151. package/src/views/CanvasEditor/LayoutContainer.js +0 -222
  152. package/src/views/CanvasEditor/LayoutContainer.tsx +0 -322
  153. package/src/views/CanvasEditor/SaveConfirmationModal.d.ts +0 -13
  154. package/src/views/CanvasEditor/SaveConfirmationModal.d.ts.map +0 -1
  155. package/src/views/CanvasEditor/SaveConfirmationModal.js +0 -78
  156. package/src/views/CanvasEditor/SaveConfirmationModal.tsx +0 -233
  157. package/src/views/CanvasEditor/components/CustomBlockItem.d.ts +0 -14
  158. package/src/views/CanvasEditor/components/CustomBlockItem.d.ts.map +0 -1
  159. package/src/views/CanvasEditor/components/CustomBlockItem.js +0 -44
  160. package/src/views/CanvasEditor/components/CustomBlockItem.tsx +0 -92
  161. package/src/views/CanvasEditor/components/EditorCanvas.d.ts +0 -29
  162. package/src/views/CanvasEditor/components/EditorCanvas.d.ts.map +0 -1
  163. package/src/views/CanvasEditor/components/EditorCanvas.js +0 -32
  164. package/src/views/CanvasEditor/components/EditorCanvas.tsx +0 -160
  165. package/src/views/CanvasEditor/components/EditorLibrary.d.ts +0 -7
  166. package/src/views/CanvasEditor/components/EditorLibrary.d.ts.map +0 -1
  167. package/src/views/CanvasEditor/components/EditorLibrary.js +0 -25
  168. package/src/views/CanvasEditor/components/EditorLibrary.tsx +0 -122
  169. package/src/views/CanvasEditor/components/EditorSidebar.d.ts +0 -13
  170. package/src/views/CanvasEditor/components/EditorSidebar.d.ts.map +0 -1
  171. package/src/views/CanvasEditor/components/EditorSidebar.js +0 -20
  172. package/src/views/CanvasEditor/components/EditorSidebar.tsx +0 -181
  173. package/src/views/CanvasEditor/components/ErrorBanner.d.ts +0 -6
  174. package/src/views/CanvasEditor/components/ErrorBanner.d.ts.map +0 -1
  175. package/src/views/CanvasEditor/components/ErrorBanner.js +0 -8
  176. package/src/views/CanvasEditor/components/ErrorBanner.tsx +0 -31
  177. package/src/views/CanvasEditor/components/FeaturedMediaSection.d.ts +0 -25
  178. package/src/views/CanvasEditor/components/FeaturedMediaSection.d.ts.map +0 -1
  179. package/src/views/CanvasEditor/components/FeaturedMediaSection.js +0 -182
  180. package/src/views/CanvasEditor/components/FeaturedMediaSection.tsx +0 -341
  181. package/src/views/CanvasEditor/components/LibraryItem.d.ts +0 -14
  182. package/src/views/CanvasEditor/components/LibraryItem.d.ts.map +0 -1
  183. package/src/views/CanvasEditor/components/LibraryItem.js +0 -43
  184. package/src/views/CanvasEditor/components/LibraryItem.tsx +0 -80
  185. package/src/views/CanvasEditor/components/PrivacySettingsSection.d.ts +0 -15
  186. package/src/views/CanvasEditor/components/PrivacySettingsSection.d.ts.map +0 -1
  187. package/src/views/CanvasEditor/components/PrivacySettingsSection.js +0 -63
  188. package/src/views/CanvasEditor/components/PrivacySettingsSection.tsx +0 -212
  189. package/src/views/CanvasEditor/components/index.d.ts +0 -21
  190. package/src/views/CanvasEditor/components/index.d.ts.map +0 -1
  191. package/src/views/CanvasEditor/components/index.js +0 -12
  192. package/src/views/CanvasEditor/components/index.ts +0 -28
  193. package/src/views/CanvasEditor/hooks/index.d.ts +0 -10
  194. package/src/views/CanvasEditor/hooks/index.d.ts.map +0 -1
  195. package/src/views/CanvasEditor/hooks/index.js +0 -9
  196. package/src/views/CanvasEditor/hooks/index.ts +0 -10
  197. package/src/views/CanvasEditor/hooks/useHeroBlock.d.ts +0 -8
  198. package/src/views/CanvasEditor/hooks/useHeroBlock.d.ts.map +0 -1
  199. package/src/views/CanvasEditor/hooks/useHeroBlock.js +0 -79
  200. package/src/views/CanvasEditor/hooks/useHeroBlock.ts +0 -103
  201. package/src/views/CanvasEditor/hooks/useKeyboardShortcuts.d.ts +0 -3
  202. package/src/views/CanvasEditor/hooks/useKeyboardShortcuts.d.ts.map +0 -1
  203. package/src/views/CanvasEditor/hooks/useKeyboardShortcuts.js +0 -114
  204. package/src/views/CanvasEditor/hooks/useKeyboardShortcuts.ts +0 -142
  205. package/src/views/CanvasEditor/hooks/usePostLoader.d.ts +0 -5
  206. package/src/views/CanvasEditor/hooks/usePostLoader.d.ts.map +0 -1
  207. package/src/views/CanvasEditor/hooks/usePostLoader.js +0 -32
  208. package/src/views/CanvasEditor/hooks/usePostLoader.ts +0 -39
  209. package/src/views/CanvasEditor/hooks/useRegisteredBlocks.d.ts +0 -2
  210. package/src/views/CanvasEditor/hooks/useRegisteredBlocks.d.ts.map +0 -1
  211. package/src/views/CanvasEditor/hooks/useRegisteredBlocks.js +0 -47
  212. package/src/views/CanvasEditor/hooks/useRegisteredBlocks.ts +0 -55
  213. package/src/views/CanvasEditor/hooks/useUnsavedChanges.d.ts +0 -25
  214. package/src/views/CanvasEditor/hooks/useUnsavedChanges.d.ts.map +0 -1
  215. package/src/views/CanvasEditor/hooks/useUnsavedChanges.js +0 -285
  216. package/src/views/CanvasEditor/hooks/useUnsavedChanges.ts +0 -339
  217. package/src/views/CanvasEditor/index.d.ts +0 -16
  218. package/src/views/CanvasEditor/index.d.ts.map +0 -1
  219. package/src/views/CanvasEditor/index.js +0 -9
  220. package/src/views/CanvasEditor/index.ts +0 -16
  221. package/src/views/PostManager/EmptyState.d.ts +0 -10
  222. package/src/views/PostManager/EmptyState.d.ts.map +0 -1
  223. package/src/views/PostManager/EmptyState.js +0 -12
  224. package/src/views/PostManager/EmptyState.tsx +0 -42
  225. package/src/views/PostManager/PostActionsMenu.d.ts +0 -12
  226. package/src/views/PostManager/PostActionsMenu.d.ts.map +0 -1
  227. package/src/views/PostManager/PostActionsMenu.js +0 -58
  228. package/src/views/PostManager/PostActionsMenu.tsx +0 -112
  229. package/src/views/PostManager/PostCards.d.ts +0 -15
  230. package/src/views/PostManager/PostCards.d.ts.map +0 -1
  231. package/src/views/PostManager/PostCards.js +0 -79
  232. package/src/views/PostManager/PostCards.tsx +0 -197
  233. package/src/views/PostManager/PostFilters.d.ts +0 -16
  234. package/src/views/PostManager/PostFilters.d.ts.map +0 -1
  235. package/src/views/PostManager/PostFilters.js +0 -10
  236. package/src/views/PostManager/PostFilters.tsx +0 -95
  237. package/src/views/PostManager/PostManagerView.d.ts +0 -11
  238. package/src/views/PostManager/PostManagerView.d.ts.map +0 -1
  239. package/src/views/PostManager/PostManagerView.js +0 -174
  240. package/src/views/PostManager/PostManagerView.tsx +0 -289
  241. package/src/views/PostManager/PostStats.d.ts +0 -11
  242. package/src/views/PostManager/PostStats.d.ts.map +0 -1
  243. package/src/views/PostManager/PostStats.js +0 -46
  244. package/src/views/PostManager/PostStats.tsx +0 -81
  245. package/src/views/PostManager/PostTable.d.ts +0 -15
  246. package/src/views/PostManager/PostTable.d.ts.map +0 -1
  247. package/src/views/PostManager/PostTable.js +0 -79
  248. package/src/views/PostManager/PostTable.tsx +0 -230
  249. package/src/views/PostManager/index.d.ts +0 -12
  250. package/src/views/PostManager/index.d.ts.map +0 -1
  251. package/src/views/PostManager/index.js +0 -11
  252. package/src/views/PostManager/index.ts +0 -15
  253. package/src/views/Preview/PreviewBridgeView.d.ts +0 -12
  254. package/src/views/Preview/PreviewBridgeView.d.ts.map +0 -1
  255. package/src/views/Preview/PreviewBridgeView.js +0 -11
  256. package/src/views/Preview/PreviewBridgeView.tsx +0 -64
  257. package/src/views/Preview/index.d.ts +0 -6
  258. package/src/views/Preview/index.d.ts.map +0 -1
  259. package/src/views/Preview/index.js +0 -4
  260. package/src/views/Preview/index.ts +0 -7
  261. package/src/views/Settings/SettingsView.d.ts +0 -10
  262. package/src/views/Settings/SettingsView.d.ts.map +0 -1
  263. package/src/views/Settings/SettingsView.js +0 -111
  264. package/src/views/Settings/SettingsView.tsx +0 -298
  265. package/src/views/Settings/index.d.ts +0 -6
  266. package/src/views/Settings/index.d.ts.map +0 -1
  267. package/src/views/Settings/index.js +0 -4
  268. package/src/views/Settings/index.ts +0 -7
  269. package/src/views/SlugSEO/SlugSEOManagerView.d.ts +0 -12
  270. package/src/views/SlugSEO/SlugSEOManagerView.d.ts.map +0 -1
  271. package/src/views/SlugSEO/SlugSEOManagerView.js +0 -11
  272. package/src/views/SlugSEO/SlugSEOManagerView.tsx +0 -94
  273. package/src/views/SlugSEO/index.d.ts +0 -6
  274. package/src/views/SlugSEO/index.d.ts.map +0 -1
  275. package/src/views/SlugSEO/index.js +0 -4
  276. package/src/views/SlugSEO/index.ts +0 -7
@@ -1,52 +0,0 @@
1
- /**
2
- * Layout System Constants
3
- * Standardized spacing and styling for layout blocks
4
- */
5
-
6
- // Spacing Constants (Earth-tone aligned)
7
- export const LAYOUT_CONSTANTS = {
8
- GUTTER: '2rem', // 32px - Space between columns
9
- SPACING: '4rem', // 64px - Vertical padding for sections
10
- SPACING_SM: '2rem', // 32px - Smaller vertical padding
11
- SPACING_LG: '6rem', // 96px - Larger vertical padding
12
- BORDER_RADIUS: '2rem', // 32px - Consistent rounded corners
13
- } as const;
14
-
15
- // Background Colors (Light mode only - matches client website theme)
16
- export const LAYOUT_BACKGROUNDS = {
17
- DEFAULT: 'bg-white',
18
- NEUTRAL: 'bg-neutral-50',
19
- SAGE: 'bg-primary/5',
20
- CREAM: 'bg-amber-50/50',
21
- } as const;
22
-
23
- // Column Layout Presets
24
- export type ColumnLayout = '50-50' | '33-66' | '66-33' | '25-25-25-25' | '25-75' | '75-25';
25
-
26
- export const COLUMN_LAYOUTS: Record<ColumnLayout, { grid: string; widths: number[] }> = {
27
- '50-50': {
28
- grid: 'grid-cols-2',
29
- widths: [50, 50],
30
- },
31
- '33-66': {
32
- grid: 'grid-cols-3',
33
- widths: [33, 66],
34
- },
35
- '66-33': {
36
- grid: 'grid-cols-3',
37
- widths: [66, 33],
38
- },
39
- '25-25-25-25': {
40
- grid: 'grid-cols-4',
41
- widths: [25, 25, 25, 25],
42
- },
43
- '25-75': {
44
- grid: 'grid-cols-4',
45
- widths: [25, 75],
46
- },
47
- '75-25': {
48
- grid: 'grid-cols-4',
49
- widths: [75, 25],
50
- },
51
- };
52
-
@@ -1,9 +0,0 @@
1
- /**
2
- * Register Core Layout Blocks
3
- * Registers Section and Columns blocks in the block registry
4
- */
5
- /**
6
- * Register all core layout blocks
7
- */
8
- export declare function registerLayoutBlocks(): void;
9
- //# sourceMappingURL=registerLayoutBlocks.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registerLayoutBlocks.d.ts","sourceRoot":"","sources":["registerLayoutBlocks.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH;;GAEG;AACH,wBAAgB,oBAAoB,SAiDnC"}
@@ -1,60 +0,0 @@
1
- /**
2
- * Register Core Layout Blocks
3
- * Registers Section and Columns blocks in the block registry
4
- */
5
- import { blockRegistry } from '../../registry/BlockRegistry';
6
- import { SectionEdit, SectionPreview } from './blocks/SectionBlock';
7
- import { ColumnsEdit, ColumnsPreview } from './blocks/ColumnsBlock';
8
- import { Columns, Square } from 'lucide-react';
9
- /**
10
- * Register all core layout blocks
11
- */
12
- export function registerLayoutBlocks() {
13
- // Section Block
14
- blockRegistry.register({
15
- type: 'section',
16
- name: 'Section',
17
- description: 'Full-width wrapper with configurable padding and background',
18
- icon: Square,
19
- defaultData: {
20
- padding: 'md',
21
- background: 'DEFAULT',
22
- },
23
- category: 'layout',
24
- isContainer: true,
25
- validate: (data) => {
26
- return ['sm', 'md', 'lg'].includes(data.padding) &&
27
- ['DEFAULT', 'NEUTRAL', 'SAGE', 'CREAM'].includes(data.background);
28
- },
29
- components: {
30
- Edit: SectionEdit,
31
- Preview: SectionPreview,
32
- Icon: Square,
33
- },
34
- });
35
- // Columns Block
36
- blockRegistry.register({
37
- type: 'columns',
38
- name: 'Columns',
39
- description: 'Flex/grid container with configurable column layouts (50/50, 33/66, etc.)',
40
- icon: Columns,
41
- defaultData: {
42
- columnCount: 2, // Start with 2 columns, can be dynamically added/removed
43
- columnWidths: [50, 50], // Equal width columns by default
44
- },
45
- category: 'layout',
46
- isContainer: true,
47
- validate: (data) => {
48
- // Support both new dynamic system (columnCount) and legacy layout system
49
- if (data.columnCount !== undefined) {
50
- return typeof data.columnCount === 'number' && data.columnCount > 0 && data.columnCount <= 6;
51
- }
52
- return ['50-50', '33-66', '66-33', '25-25-25-25', '25-75', '75-25'].includes(data.layout);
53
- },
54
- components: {
55
- Edit: ColumnsEdit,
56
- Preview: ColumnsPreview,
57
- Icon: Columns,
58
- },
59
- });
60
- }
@@ -1,64 +0,0 @@
1
- /**
2
- * Register Core Layout Blocks
3
- * Registers Section and Columns blocks in the block registry
4
- */
5
-
6
- import { blockRegistry } from '../../registry/BlockRegistry';
7
- import { SectionEdit, SectionPreview } from './blocks/SectionBlock';
8
- import { ColumnsEdit, ColumnsPreview } from './blocks/ColumnsBlock';
9
- import { Columns, Square } from 'lucide-react';
10
-
11
- /**
12
- * Register all core layout blocks
13
- */
14
- export function registerLayoutBlocks() {
15
- // Section Block
16
- blockRegistry.register({
17
- type: 'section',
18
- name: 'Section',
19
- description: 'Full-width wrapper with configurable padding and background',
20
- icon: Square,
21
- defaultData: {
22
- padding: 'md',
23
- background: 'DEFAULT',
24
- },
25
- category: 'layout',
26
- isContainer: true,
27
- validate: (data) => {
28
- return ['sm', 'md', 'lg'].includes(data.padding as string) &&
29
- ['DEFAULT', 'NEUTRAL', 'SAGE', 'CREAM'].includes(data.background as string);
30
- },
31
- components: {
32
- Edit: SectionEdit as any,
33
- Preview: SectionPreview as any,
34
- Icon: Square,
35
- },
36
- });
37
-
38
- // Columns Block
39
- blockRegistry.register({
40
- type: 'columns',
41
- name: 'Columns',
42
- description: 'Flex/grid container with configurable column layouts (50/50, 33/66, etc.)',
43
- icon: Columns,
44
- defaultData: {
45
- columnCount: 2, // Start with 2 columns, can be dynamically added/removed
46
- columnWidths: [50, 50], // Equal width columns by default
47
- },
48
- category: 'layout',
49
- isContainer: true,
50
- validate: (data) => {
51
- // Support both new dynamic system (columnCount) and legacy layout system
52
- if (data.columnCount !== undefined) {
53
- return typeof data.columnCount === 'number' && data.columnCount > 0 && data.columnCount <= 6;
54
- }
55
- return ['50-50', '33-66', '66-33', '25-25-25-25', '25-75', '75-25'].includes(data.layout as string);
56
- },
57
- components: {
58
- Edit: ColumnsEdit as any,
59
- Preview: ColumnsPreview as any,
60
- Icon: Columns,
61
- },
62
- });
63
- }
64
-
@@ -1,66 +0,0 @@
1
- /**
2
- * API Mapper
3
- * Converts between API format (MongoDB) and BlogPost format
4
- */
5
- import { BlogPost, PostStatus, SEOMetadata, PostMetadata } from '../../types/post';
6
- import { Block } from '../../types/block';
7
- /**
8
- * API Blog Document Format (from MongoDB)
9
- */
10
- export interface APIBlogDocument {
11
- _id?: string;
12
- id?: string;
13
- title: string;
14
- slug: string;
15
- contentBlocks?: Block[];
16
- content?: any[];
17
- summary?: string;
18
- image?: {
19
- id?: string;
20
- src?: string;
21
- alt?: string;
22
- isCustom?: boolean;
23
- };
24
- categoryTags?: {
25
- category?: string;
26
- tags?: string[];
27
- };
28
- publicationData?: {
29
- status?: PostStatus | 'concept';
30
- date?: string | Date;
31
- };
32
- seo?: {
33
- title?: string;
34
- description?: string;
35
- keywords?: string[];
36
- ogImage?: string;
37
- canonicalUrl?: string;
38
- };
39
- authorId?: string;
40
- createdAt?: string | Date;
41
- updatedAt?: string | Date;
42
- }
43
- /**
44
- * Convert API document to BlogPost format
45
- */
46
- export declare function apiToBlogPost(doc: APIBlogDocument): BlogPost;
47
- /**
48
- * Convert BlogPost to API document format
49
- */
50
- export declare function blogPostToAPI(post: BlogPost, authorId?: string): Partial<APIBlogDocument>;
51
- /**
52
- * Convert EditorState to API format for saving
53
- * @param state - Editor state
54
- * @param authorId - Optional author ID
55
- * @param heroBlock - Optional hero block (stored separately from content blocks)
56
- */
57
- export declare function editorStateToAPI(state: {
58
- title: string;
59
- slug: string;
60
- blocks: Block[];
61
- seo: SEOMetadata;
62
- metadata: PostMetadata;
63
- status: PostStatus;
64
- postId?: string | null;
65
- }, authorId?: string, heroBlock?: Block | null): Partial<APIBlogDocument>;
66
- //# sourceMappingURL=apiMapper.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"apiMapper.d.ts","sourceRoot":"","sources":["apiMapper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,KAAK,EAAE,CAAC;IACxB,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE;QACJ,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,OAAO,CAAC;KAGtB,CAAC;IACF,YAAY,CAAC,EAAE;QACX,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC;IACF,eAAe,CAAC,EAAE;QACd,MAAM,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;QAChC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACxB,CAAC;IACF,GAAG,CAAC,EAAE;QACF,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,YAAY,CAAC,EAAE,MAAM,CAAC;KACzB,CAAC;IACF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,eAAe,GAAG,QAAQ,CAmE5D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAgCzF;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,GAAG,EAAE,WAAW,CAAC;IACjB,QAAQ,EAAE,YAAY,CAAC;IACvB,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,KAAK,GAAG,IAAI,GAAG,OAAO,CAAC,eAAe,CAAC,CAkFxE"}
@@ -1,191 +0,0 @@
1
- /**
2
- * API Mapper
3
- * Converts between API format (MongoDB) and BlogPost format
4
- */
5
- /**
6
- * Convert API document to BlogPost format
7
- */
8
- export function apiToBlogPost(doc) {
9
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
10
- const id = ((_a = doc._id) === null || _a === void 0 ? void 0 : _a.toString()) || doc.id || '';
11
- // Use contentBlocks if available, otherwise fallback to content (legacy)
12
- // Hero block is included in contentBlocks
13
- const blocks = doc.contentBlocks || [];
14
- // Convert publication data
15
- const publicationDate = ((_b = doc.publicationData) === null || _b === void 0 ? void 0 : _b.date)
16
- ? (typeof doc.publicationData.date === 'string'
17
- ? doc.publicationData.date
18
- : doc.publicationData.date.toISOString())
19
- : undefined;
20
- // Convert SEO data
21
- const seo = {
22
- title: (_c = doc.seo) === null || _c === void 0 ? void 0 : _c.title,
23
- description: (_d = doc.seo) === null || _d === void 0 ? void 0 : _d.description,
24
- keywords: (_e = doc.seo) === null || _e === void 0 ? void 0 : _e.keywords,
25
- ogImage: (_f = doc.seo) === null || _f === void 0 ? void 0 : _f.ogImage,
26
- canonicalUrl: (_g = doc.seo) === null || _g === void 0 ? void 0 : _g.canonicalUrl,
27
- };
28
- // Convert metadata
29
- // Only store semantic ID (id) and alt - plugin-images handles everything else
30
- const metadata = {
31
- featuredImage: doc.image ? {
32
- // Prefer id (semantic ID) over src (legacy)
33
- id: doc.image.id || doc.image.src,
34
- alt: doc.image.alt,
35
- isCustom: doc.image.isCustom,
36
- // Don't load transform fields - plugin-images handles those
37
- } : undefined,
38
- categories: ((_h = doc.categoryTags) === null || _h === void 0 ? void 0 : _h.category) ? [doc.categoryTags.category] : [],
39
- tags: ((_j = doc.categoryTags) === null || _j === void 0 ? void 0 : _j.tags) || [],
40
- excerpt: doc.summary,
41
- privacy: undefined, // Privacy settings not in API yet
42
- };
43
- // Convert publication data - API uses 'concept' but we use 'draft'
44
- const apiStatus = ((_k = doc.publicationData) === null || _k === void 0 ? void 0 : _k.status) || 'concept';
45
- const normalizedStatus = apiStatus === 'concept' ? 'draft' : apiStatus;
46
- const publication = {
47
- status: normalizedStatus,
48
- date: publicationDate,
49
- authorId: doc.authorId,
50
- updatedAt: doc.updatedAt
51
- ? (typeof doc.updatedAt === 'string' ? doc.updatedAt : doc.updatedAt.toISOString())
52
- : undefined,
53
- };
54
- return {
55
- id,
56
- title: doc.title,
57
- slug: doc.slug,
58
- blocks,
59
- seo,
60
- publication,
61
- metadata,
62
- createdAt: doc.createdAt
63
- ? (typeof doc.createdAt === 'string' ? doc.createdAt : doc.createdAt.toISOString())
64
- : new Date().toISOString(),
65
- updatedAt: doc.updatedAt
66
- ? (typeof doc.updatedAt === 'string' ? doc.updatedAt : doc.updatedAt.toISOString())
67
- : new Date().toISOString(),
68
- };
69
- }
70
- /**
71
- * Convert BlogPost to API document format
72
- */
73
- export function blogPostToAPI(post, authorId) {
74
- var _a;
75
- return {
76
- title: post.title,
77
- slug: post.slug,
78
- contentBlocks: post.blocks, // Use new block format
79
- summary: post.metadata.excerpt,
80
- // Only save semantic ID (id) and alt - plugin-images handles transform data
81
- image: post.metadata.featuredImage ? {
82
- id: post.metadata.featuredImage.id,
83
- alt: post.metadata.featuredImage.alt,
84
- isCustom: post.metadata.featuredImage.isCustom,
85
- // Don't save transform fields - plugin-images API handles those
86
- } : undefined,
87
- categoryTags: {
88
- category: ((_a = post.metadata.categories) === null || _a === void 0 ? void 0 : _a[0]) || '',
89
- tags: post.metadata.tags || [],
90
- },
91
- publicationData: {
92
- // API uses 'concept' instead of 'draft'
93
- status: post.publication.status === 'draft' ? 'concept' : post.publication.status,
94
- date: post.publication.date ? new Date(post.publication.date) : new Date(),
95
- },
96
- seo: {
97
- title: post.seo.title,
98
- description: post.seo.description,
99
- keywords: post.seo.keywords,
100
- ogImage: post.seo.ogImage,
101
- canonicalUrl: post.seo.canonicalUrl,
102
- },
103
- authorId: authorId || post.publication.authorId,
104
- updatedAt: new Date(),
105
- };
106
- }
107
- /**
108
- * Convert EditorState to API format for saving
109
- * @param state - Editor state
110
- * @param authorId - Optional author ID
111
- * @param heroBlock - Optional hero block (stored separately from content blocks)
112
- */
113
- export function editorStateToAPI(state, authorId, heroBlock) {
114
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
115
- // Map status: draft -> concept, published -> published, everything else stays as-is
116
- const apiStatus = state.status === 'draft' ? 'concept' : state.status;
117
- console.log('[editorStateToAPI] Mapping status:', {
118
- editorStatus: state.status,
119
- apiStatus: apiStatus,
120
- willBePublished: apiStatus === 'published'
121
- });
122
- // Try to get category from metadata first, then check hero block
123
- let category = undefined;
124
- if (state.metadata.categories && state.metadata.categories.length > 0 && ((_a = state.metadata.categories[0]) === null || _a === void 0 ? void 0 : _a.trim())) {
125
- category = state.metadata.categories[0].trim();
126
- }
127
- else {
128
- // Check hero block for category - use the passed heroBlock parameter first, then check state.blocks
129
- const heroBlockToCheck = heroBlock || state.blocks.find(block => block.type === 'hero');
130
- if (heroBlockToCheck && heroBlockToCheck.data && typeof heroBlockToCheck.data === 'object') {
131
- const heroCategory = heroBlockToCheck.data.category;
132
- if (heroCategory && typeof heroCategory === 'string' && heroCategory.trim()) {
133
- category = heroCategory.trim();
134
- }
135
- }
136
- }
137
- console.log('[editorStateToAPI] Category resolution:', {
138
- fromMetadata: (_b = state.metadata.categories) === null || _b === void 0 ? void 0 : _b[0],
139
- fromHeroBlock: ((_c = (heroBlock || state.blocks.find(b => b.type === 'hero'))) === null || _c === void 0 ? void 0 : _c.data) ? (heroBlock || state.blocks.find(b => b.type === 'hero')).data.category : undefined,
140
- finalCategory: category,
141
- hasHeroBlock: !!heroBlock,
142
- heroBlockImage: (heroBlock === null || heroBlock === void 0 ? void 0 : heroBlock.data) ? (_d = heroBlock.data) === null || _d === void 0 ? void 0 : _d.image : undefined,
143
- });
144
- // Include hero block in contentBlocks if it exists
145
- // Filter out any existing hero blocks from state.blocks first, then add the current hero block
146
- const contentBlocksWithoutHero = state.blocks.filter(block => block.type !== 'hero');
147
- const allBlocks = heroBlock
148
- ? [heroBlock, ...contentBlocksWithoutHero]
149
- : contentBlocksWithoutHero;
150
- console.log('[editorStateToAPI] Hero block details:', {
151
- hasHeroBlock: !!heroBlock,
152
- heroBlockType: heroBlock === null || heroBlock === void 0 ? void 0 : heroBlock.type,
153
- heroBlockId: heroBlock === null || heroBlock === void 0 ? void 0 : heroBlock.id,
154
- heroBlockImage: (heroBlock === null || heroBlock === void 0 ? void 0 : heroBlock.data) ? (_e = heroBlock.data) === null || _e === void 0 ? void 0 : _e.image : undefined,
155
- heroBlockImageSrc: (heroBlock === null || heroBlock === void 0 ? void 0 : heroBlock.data) ? (_g = (_f = heroBlock.data) === null || _f === void 0 ? void 0 : _f.image) === null || _g === void 0 ? void 0 : _g.src : undefined,
156
- contentBlocksCount: allBlocks.length,
157
- contentBlocksTypes: allBlocks.map(b => b.type),
158
- heroBlockInContentBlocks: ((_h = allBlocks.find(b => b.type === 'hero')) === null || _h === void 0 ? void 0 : _h.data) ? (_j = allBlocks.find(b => b.type === 'hero').data) === null || _j === void 0 ? void 0 : _j.image : undefined,
159
- });
160
- return {
161
- title: state.title,
162
- slug: state.slug,
163
- contentBlocks: allBlocks,
164
- summary: state.metadata.excerpt,
165
- // Only save semantic ID (id) and alt - plugin-images handles transform data
166
- // Only create image object if id exists and is not empty
167
- image: ((_l = (_k = state.metadata.featuredImage) === null || _k === void 0 ? void 0 : _k.id) === null || _l === void 0 ? void 0 : _l.trim()) ? {
168
- id: state.metadata.featuredImage.id.trim(),
169
- alt: state.metadata.featuredImage.alt || '',
170
- isCustom: state.metadata.featuredImage.isCustom,
171
- // Don't save transform fields - plugin-images API handles those
172
- } : undefined,
173
- categoryTags: {
174
- category: category,
175
- tags: state.metadata.tags || [],
176
- },
177
- publicationData: {
178
- status: apiStatus,
179
- date: new Date(),
180
- },
181
- seo: {
182
- title: state.seo.title,
183
- description: state.seo.description,
184
- keywords: state.seo.keywords,
185
- ogImage: state.seo.ogImage,
186
- canonicalUrl: state.seo.canonicalUrl,
187
- },
188
- authorId,
189
- updatedAt: new Date(),
190
- };
191
- }