@delmaredigital/payload-puck 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (565) hide show
  1. package/README.md +349 -1370
  2. package/dist/admin/EditWithPuckButton.d.ts +74 -0
  3. package/dist/admin/EditWithPuckButton.d.ts.map +1 -0
  4. package/dist/admin/EditWithPuckButton.js +114 -0
  5. package/dist/admin/EditWithPuckButton.js.map +1 -0
  6. package/dist/admin/EditWithPuckCell.d.ts +43 -0
  7. package/dist/admin/EditWithPuckCell.d.ts.map +1 -0
  8. package/dist/admin/EditWithPuckCell.js +66 -0
  9. package/dist/admin/EditWithPuckCell.js.map +1 -0
  10. package/dist/admin/PuckEditorView.d.ts +85 -0
  11. package/dist/admin/PuckEditorView.d.ts.map +1 -0
  12. package/dist/admin/PuckEditorView.js +135 -0
  13. package/dist/admin/PuckEditorView.js.map +1 -0
  14. package/dist/admin/client.d.ts +8 -104
  15. package/dist/admin/client.d.ts.map +1 -0
  16. package/dist/admin/client.js +14 -176
  17. package/dist/admin/client.js.map +1 -0
  18. package/dist/admin/generateAdminComponents.d.ts +51 -0
  19. package/dist/admin/generateAdminComponents.d.ts.map +1 -0
  20. package/dist/admin/generateAdminComponents.js +42 -0
  21. package/dist/admin/generateAdminComponents.js.map +1 -0
  22. package/dist/admin/index.d.ts +14 -150
  23. package/dist/admin/index.d.ts.map +1 -0
  24. package/dist/admin/index.js +17 -30
  25. package/dist/admin/index.js.map +1 -0
  26. package/dist/api/createPuckApiRoutes.d.ts +31 -0
  27. package/dist/api/createPuckApiRoutes.d.ts.map +1 -0
  28. package/dist/api/createPuckApiRoutes.js +193 -0
  29. package/dist/api/createPuckApiRoutes.js.map +1 -0
  30. package/dist/api/createPuckApiRoutesVersions.d.ts +28 -0
  31. package/dist/api/createPuckApiRoutesVersions.d.ts.map +1 -0
  32. package/dist/api/createPuckApiRoutesVersions.js +144 -0
  33. package/dist/api/createPuckApiRoutesVersions.js.map +1 -0
  34. package/dist/api/createPuckApiRoutesWithId.d.ts +34 -0
  35. package/dist/api/createPuckApiRoutesWithId.d.ts.map +1 -0
  36. package/dist/api/createPuckApiRoutesWithId.js +251 -0
  37. package/dist/api/createPuckApiRoutesWithId.js.map +1 -0
  38. package/dist/api/index.d.ts +11 -431
  39. package/dist/api/index.d.ts.map +1 -0
  40. package/dist/api/index.js +40 -587
  41. package/dist/api/index.js.map +1 -0
  42. package/dist/api/types.d.ts +302 -0
  43. package/dist/api/types.d.ts.map +1 -0
  44. package/dist/api/types.js +2 -0
  45. package/dist/api/types.js.map +1 -0
  46. package/dist/api/utils/mapRootProps.d.ts +76 -0
  47. package/dist/api/utils/mapRootProps.d.ts.map +1 -0
  48. package/dist/api/utils/mapRootProps.js +169 -0
  49. package/dist/api/utils/mapRootProps.js.map +1 -0
  50. package/dist/collections/Templates.d.ts +9 -0
  51. package/dist/collections/Templates.d.ts.map +1 -0
  52. package/dist/collections/Templates.js +62 -0
  53. package/dist/collections/Templates.js.map +1 -0
  54. package/dist/components/AccordionClient.d.ts +20 -0
  55. package/dist/components/AccordionClient.d.ts.map +1 -0
  56. package/dist/components/AccordionClient.js +67 -0
  57. package/dist/components/AccordionClient.js.map +1 -0
  58. package/dist/components/AnimatedWrapper.d.ts +33 -0
  59. package/dist/components/AnimatedWrapper.d.ts.map +1 -0
  60. package/dist/components/AnimatedWrapper.js +61 -0
  61. package/dist/components/AnimatedWrapper.js.map +1 -0
  62. package/dist/components/exports.d.ts +54 -0
  63. package/dist/components/exports.d.ts.map +1 -0
  64. package/dist/components/exports.js +71 -0
  65. package/dist/components/exports.js.map +1 -0
  66. package/dist/components/index.d.ts +8 -216
  67. package/dist/components/index.d.ts.map +1 -0
  68. package/dist/components/index.js +15 -9262
  69. package/dist/components/index.js.map +1 -0
  70. package/dist/components/interactive/Accordion.d.ts +28 -0
  71. package/dist/components/interactive/Accordion.d.ts.map +1 -0
  72. package/dist/components/interactive/Accordion.js +159 -0
  73. package/dist/components/interactive/Accordion.js.map +1 -0
  74. package/dist/components/interactive/Accordion.server.d.ts +29 -0
  75. package/dist/components/interactive/Accordion.server.d.ts.map +1 -0
  76. package/dist/components/interactive/Accordion.server.js +30 -0
  77. package/dist/components/interactive/Accordion.server.js.map +1 -0
  78. package/dist/components/interactive/Button.d.ts +26 -0
  79. package/dist/components/interactive/Button.d.ts.map +1 -0
  80. package/dist/components/interactive/Button.js +133 -0
  81. package/dist/components/interactive/Button.js.map +1 -0
  82. package/dist/components/interactive/Button.server.d.ts +28 -0
  83. package/dist/components/interactive/Button.server.d.ts.map +1 -0
  84. package/dist/components/interactive/Button.server.js +96 -0
  85. package/dist/components/interactive/Button.server.js.map +1 -0
  86. package/dist/components/interactive/Card.d.ts +27 -0
  87. package/dist/components/interactive/Card.d.ts.map +1 -0
  88. package/dist/components/interactive/Card.js +128 -0
  89. package/dist/components/interactive/Card.js.map +1 -0
  90. package/dist/components/interactive/Card.server.d.ts +29 -0
  91. package/dist/components/interactive/Card.server.d.ts.map +1 -0
  92. package/dist/components/interactive/Card.server.js +77 -0
  93. package/dist/components/interactive/Card.server.js.map +1 -0
  94. package/dist/components/interactive/Divider.d.ts +18 -0
  95. package/dist/components/interactive/Divider.d.ts.map +1 -0
  96. package/dist/components/interactive/Divider.js +68 -0
  97. package/dist/components/interactive/Divider.js.map +1 -0
  98. package/dist/components/interactive/Divider.server.d.ts +20 -0
  99. package/dist/components/interactive/Divider.server.d.ts.map +1 -0
  100. package/dist/components/interactive/Divider.server.js +50 -0
  101. package/dist/components/interactive/Divider.server.js.map +1 -0
  102. package/dist/components/interactive/index.d.ts +10 -0
  103. package/dist/components/interactive/index.d.ts.map +1 -0
  104. package/dist/components/interactive/index.js +10 -0
  105. package/dist/components/interactive/index.js.map +1 -0
  106. package/dist/components/layout/Container.d.ts +29 -0
  107. package/dist/components/layout/Container.d.ts.map +1 -0
  108. package/dist/components/layout/Container.js +166 -0
  109. package/dist/components/layout/Container.js.map +1 -0
  110. package/dist/components/layout/Container.server.d.ts +32 -0
  111. package/dist/components/layout/Container.server.d.ts.map +1 -0
  112. package/dist/components/layout/Container.server.js +105 -0
  113. package/dist/components/layout/Container.server.js.map +1 -0
  114. package/dist/components/layout/Flex.d.ts +36 -0
  115. package/dist/components/layout/Flex.d.ts.map +1 -0
  116. package/dist/components/layout/Flex.js +183 -0
  117. package/dist/components/layout/Flex.js.map +1 -0
  118. package/dist/components/layout/Flex.server.d.ts +36 -0
  119. package/dist/components/layout/Flex.server.d.ts.map +1 -0
  120. package/dist/components/layout/Flex.server.js +97 -0
  121. package/dist/components/layout/Flex.server.js.map +1 -0
  122. package/dist/components/layout/Grid.d.ts +31 -0
  123. package/dist/components/layout/Grid.d.ts.map +1 -0
  124. package/dist/components/layout/Grid.js +164 -0
  125. package/dist/components/layout/Grid.js.map +1 -0
  126. package/dist/components/layout/Grid.server.d.ts +32 -0
  127. package/dist/components/layout/Grid.server.d.ts.map +1 -0
  128. package/dist/components/layout/Grid.server.js +92 -0
  129. package/dist/components/layout/Grid.server.js.map +1 -0
  130. package/dist/components/layout/Section.d.ts +35 -0
  131. package/dist/components/layout/Section.d.ts.map +1 -0
  132. package/dist/components/layout/Section.js +212 -0
  133. package/dist/components/layout/Section.js.map +1 -0
  134. package/dist/components/layout/Section.server.d.ts +35 -0
  135. package/dist/components/layout/Section.server.d.ts.map +1 -0
  136. package/dist/components/layout/Section.server.js +144 -0
  137. package/dist/components/layout/Section.server.js.map +1 -0
  138. package/dist/components/layout/Spacer.d.ts +18 -0
  139. package/dist/components/layout/Spacer.d.ts.map +1 -0
  140. package/dist/components/layout/Spacer.js +99 -0
  141. package/dist/components/layout/Spacer.js.map +1 -0
  142. package/dist/components/layout/Spacer.server.d.ts +21 -0
  143. package/dist/components/layout/Spacer.server.d.ts.map +1 -0
  144. package/dist/components/layout/Spacer.server.js +61 -0
  145. package/dist/components/layout/Spacer.server.js.map +1 -0
  146. package/dist/components/layout/Template.d.ts +35 -0
  147. package/dist/components/layout/Template.d.ts.map +1 -0
  148. package/dist/components/layout/Template.js +124 -0
  149. package/dist/components/layout/Template.js.map +1 -0
  150. package/dist/components/layout/Template.server.d.ts +32 -0
  151. package/dist/components/layout/Template.server.d.ts.map +1 -0
  152. package/dist/components/layout/Template.server.js +75 -0
  153. package/dist/components/layout/Template.server.js.map +1 -0
  154. package/dist/components/layout/index.d.ts +14 -0
  155. package/dist/components/layout/index.d.ts.map +1 -0
  156. package/dist/components/layout/index.js +13 -0
  157. package/dist/components/layout/index.js.map +1 -0
  158. package/dist/components/media/Image.d.ts +30 -0
  159. package/dist/components/media/Image.d.ts.map +1 -0
  160. package/dist/components/media/Image.js +123 -0
  161. package/dist/components/media/Image.js.map +1 -0
  162. package/dist/components/media/Image.server.d.ts +28 -0
  163. package/dist/components/media/Image.server.d.ts.map +1 -0
  164. package/dist/components/media/Image.server.js +76 -0
  165. package/dist/components/media/Image.server.js.map +1 -0
  166. package/dist/components/media/index.d.ts +7 -0
  167. package/dist/components/media/index.d.ts.map +1 -0
  168. package/dist/components/media/index.js +7 -0
  169. package/dist/components/media/index.js.map +1 -0
  170. package/dist/components/typography/Heading.d.ts +21 -0
  171. package/dist/components/typography/Heading.d.ts.map +1 -0
  172. package/dist/components/typography/Heading.js +71 -0
  173. package/dist/components/typography/Heading.js.map +1 -0
  174. package/dist/components/typography/Heading.server.d.ts +21 -0
  175. package/dist/components/typography/Heading.server.d.ts.map +1 -0
  176. package/dist/components/typography/Heading.server.js +49 -0
  177. package/dist/components/typography/Heading.server.js.map +1 -0
  178. package/dist/components/typography/RichText.d.ts +20 -0
  179. package/dist/components/typography/RichText.d.ts.map +1 -0
  180. package/dist/components/typography/RichText.editor.d.ts +11 -0
  181. package/dist/components/typography/RichText.editor.d.ts.map +1 -0
  182. package/dist/components/typography/RichText.editor.js +67 -0
  183. package/dist/components/typography/RichText.editor.js.map +1 -0
  184. package/dist/components/typography/RichText.js +73 -0
  185. package/dist/components/typography/RichText.js.map +1 -0
  186. package/dist/components/typography/RichText.server.d.ts +22 -0
  187. package/dist/components/typography/RichText.server.d.ts.map +1 -0
  188. package/dist/components/typography/RichText.server.js +52 -0
  189. package/dist/components/typography/RichText.server.js.map +1 -0
  190. package/dist/components/typography/Text.d.ts +20 -0
  191. package/dist/components/typography/Text.d.ts.map +1 -0
  192. package/dist/components/typography/Text.js +61 -0
  193. package/dist/components/typography/Text.js.map +1 -0
  194. package/dist/components/typography/Text.server.d.ts +21 -0
  195. package/dist/components/typography/Text.server.d.ts.map +1 -0
  196. package/dist/components/typography/Text.server.js +39 -0
  197. package/dist/components/typography/Text.server.js.map +1 -0
  198. package/dist/components/typography/index.d.ts +10 -0
  199. package/dist/components/typography/index.d.ts.map +1 -0
  200. package/dist/components/typography/index.js +10 -0
  201. package/dist/components/typography/index.js.map +1 -0
  202. package/dist/config/config.editor.d.ts +15 -56
  203. package/dist/config/config.editor.d.ts.map +1 -0
  204. package/dist/config/config.editor.js +125 -9462
  205. package/dist/config/config.editor.js.map +1 -0
  206. package/dist/config/index.d.ts +7 -33
  207. package/dist/config/index.d.ts.map +1 -0
  208. package/dist/config/index.js +110 -2119
  209. package/dist/config/index.js.map +1 -0
  210. package/dist/config/merge.d.ts +23 -0
  211. package/dist/config/merge.d.ts.map +1 -0
  212. package/dist/config/merge.js +80 -0
  213. package/dist/config/merge.js.map +1 -0
  214. package/dist/config/presets.d.ts +342 -0
  215. package/dist/config/presets.d.ts.map +1 -0
  216. package/dist/config/presets.js +247 -0
  217. package/dist/config/presets.js.map +1 -0
  218. package/dist/editor/PuckEditor.client.d.ts +131 -0
  219. package/dist/editor/PuckEditor.client.d.ts.map +1 -0
  220. package/dist/editor/PuckEditor.client.js +42 -0
  221. package/dist/editor/PuckEditor.client.js.map +1 -0
  222. package/dist/editor/PuckEditorCore.client.d.ts +141 -0
  223. package/dist/editor/PuckEditorCore.client.d.ts.map +1 -0
  224. package/dist/editor/PuckEditorCore.client.js +306 -0
  225. package/dist/editor/PuckEditorCore.client.js.map +1 -0
  226. package/dist/editor/components/HeaderActions.d.ts +109 -0
  227. package/dist/editor/components/HeaderActions.d.ts.map +1 -0
  228. package/dist/editor/components/HeaderActions.js +254 -0
  229. package/dist/editor/components/HeaderActions.js.map +1 -0
  230. package/dist/editor/components/IframeWrapper.d.ts +77 -0
  231. package/dist/editor/components/IframeWrapper.d.ts.map +1 -0
  232. package/dist/editor/components/IframeWrapper.js +257 -0
  233. package/dist/editor/components/IframeWrapper.js.map +1 -0
  234. package/dist/editor/components/LoadingState.d.ts +14 -0
  235. package/dist/editor/components/LoadingState.d.ts.map +1 -0
  236. package/dist/editor/components/LoadingState.js +12 -0
  237. package/dist/editor/components/LoadingState.js.map +1 -0
  238. package/dist/editor/components/PreviewModal.d.ts +54 -0
  239. package/dist/editor/components/PreviewModal.d.ts.map +1 -0
  240. package/dist/editor/components/PreviewModal.js +298 -0
  241. package/dist/editor/components/PreviewModal.js.map +1 -0
  242. package/dist/editor/components/VersionHistory.d.ts +44 -0
  243. package/dist/editor/components/VersionHistory.d.ts.map +1 -0
  244. package/dist/editor/components/VersionHistory.js +308 -0
  245. package/dist/editor/components/VersionHistory.js.map +1 -0
  246. package/dist/editor/hooks/useUnsavedChanges.d.ts +27 -0
  247. package/dist/editor/hooks/useUnsavedChanges.d.ts.map +1 -0
  248. package/dist/editor/hooks/useUnsavedChanges.js +55 -0
  249. package/dist/editor/hooks/useUnsavedChanges.js.map +1 -0
  250. package/dist/editor/index.d.ts +16 -756
  251. package/dist/editor/index.d.ts.map +1 -0
  252. package/dist/editor/index.js +49 -4625
  253. package/dist/editor/index.js.map +1 -0
  254. package/dist/editor/plugins/index.d.ts +12 -0
  255. package/dist/editor/plugins/index.d.ts.map +1 -0
  256. package/dist/editor/plugins/index.js +12 -0
  257. package/dist/editor/plugins/index.js.map +1 -0
  258. package/dist/endpoints/index.d.ts +46 -0
  259. package/dist/endpoints/index.d.ts.map +1 -0
  260. package/dist/endpoints/index.js +204 -0
  261. package/dist/endpoints/index.js.map +1 -0
  262. package/dist/exports/client.d.ts +19 -0
  263. package/dist/exports/client.d.ts.map +1 -0
  264. package/dist/exports/client.js +21 -0
  265. package/dist/exports/client.js.map +1 -0
  266. package/dist/exports/rsc.d.ts +19 -0
  267. package/dist/exports/rsc.d.ts.map +1 -0
  268. package/dist/exports/rsc.js +19 -0
  269. package/dist/exports/rsc.js.map +1 -0
  270. package/dist/fields/AlignmentField.d.ts +36 -0
  271. package/dist/fields/AlignmentField.d.ts.map +1 -0
  272. package/dist/fields/AlignmentField.js +120 -0
  273. package/dist/fields/AlignmentField.js.map +1 -0
  274. package/dist/fields/AnimationField.d.ts +44 -0
  275. package/dist/fields/AnimationField.d.ts.map +1 -0
  276. package/dist/fields/AnimationField.js +329 -0
  277. package/dist/fields/AnimationField.js.map +1 -0
  278. package/dist/fields/BackgroundField.d.ts +40 -0
  279. package/dist/fields/BackgroundField.d.ts.map +1 -0
  280. package/dist/fields/BackgroundField.js +413 -0
  281. package/dist/fields/BackgroundField.js.map +1 -0
  282. package/dist/fields/BorderField.d.ts +29 -0
  283. package/dist/fields/BorderField.d.ts.map +1 -0
  284. package/dist/fields/BorderField.js +264 -0
  285. package/dist/fields/BorderField.js.map +1 -0
  286. package/dist/fields/ColorPickerField.d.ts +43 -0
  287. package/dist/fields/ColorPickerField.d.ts.map +1 -0
  288. package/dist/fields/ColorPickerField.js +285 -0
  289. package/dist/fields/ColorPickerField.js.map +1 -0
  290. package/dist/fields/DimensionsField.d.ts +43 -0
  291. package/dist/fields/DimensionsField.d.ts.map +1 -0
  292. package/dist/fields/DimensionsField.js +532 -0
  293. package/dist/fields/DimensionsField.js.map +1 -0
  294. package/dist/fields/FlexAlignmentField.d.ts +61 -0
  295. package/dist/fields/FlexAlignmentField.d.ts.map +1 -0
  296. package/dist/fields/FlexAlignmentField.js +166 -0
  297. package/dist/fields/FlexAlignmentField.js.map +1 -0
  298. package/dist/fields/FolderPickerField.d.ts +17 -0
  299. package/dist/fields/FolderPickerField.d.ts.map +1 -0
  300. package/dist/fields/FolderPickerField.js +282 -0
  301. package/dist/fields/FolderPickerField.js.map +1 -0
  302. package/dist/fields/GradientEditor.d.ts +22 -0
  303. package/dist/fields/GradientEditor.d.ts.map +1 -0
  304. package/dist/fields/GradientEditor.js +322 -0
  305. package/dist/fields/GradientEditor.js.map +1 -0
  306. package/dist/fields/LockedField.d.ts +67 -0
  307. package/dist/fields/LockedField.d.ts.map +1 -0
  308. package/dist/fields/LockedField.js +170 -0
  309. package/dist/fields/LockedField.js.map +1 -0
  310. package/dist/fields/MarginField.d.ts +31 -0
  311. package/dist/fields/MarginField.d.ts.map +1 -0
  312. package/dist/fields/MarginField.js +233 -0
  313. package/dist/fields/MarginField.js.map +1 -0
  314. package/dist/fields/MediaField.d.ts +33 -0
  315. package/dist/fields/MediaField.d.ts.map +1 -0
  316. package/dist/fields/MediaField.js +677 -0
  317. package/dist/fields/MediaField.js.map +1 -0
  318. package/dist/fields/PaddingField.d.ts +29 -0
  319. package/dist/fields/PaddingField.d.ts.map +1 -0
  320. package/dist/fields/PaddingField.js +232 -0
  321. package/dist/fields/PaddingField.js.map +1 -0
  322. package/dist/fields/PageSegmentField.d.ts +17 -0
  323. package/dist/fields/PageSegmentField.d.ts.map +1 -0
  324. package/dist/fields/PageSegmentField.js +92 -0
  325. package/dist/fields/PageSegmentField.js.map +1 -0
  326. package/dist/fields/ResetField.d.ts +27 -0
  327. package/dist/fields/ResetField.d.ts.map +1 -0
  328. package/dist/fields/ResetField.js +122 -0
  329. package/dist/fields/ResetField.js.map +1 -0
  330. package/dist/fields/ResponsiveField.d.ts +38 -0
  331. package/dist/fields/ResponsiveField.d.ts.map +1 -0
  332. package/dist/fields/ResponsiveField.js +275 -0
  333. package/dist/fields/ResponsiveField.js.map +1 -0
  334. package/dist/fields/ResponsiveVisibilityField.d.ts +34 -0
  335. package/dist/fields/ResponsiveVisibilityField.d.ts.map +1 -0
  336. package/dist/fields/ResponsiveVisibilityField.js +145 -0
  337. package/dist/fields/ResponsiveVisibilityField.js.map +1 -0
  338. package/dist/fields/SizeField.d.ts +54 -0
  339. package/dist/fields/SizeField.d.ts.map +1 -0
  340. package/dist/fields/SizeField.js +255 -0
  341. package/dist/fields/SizeField.js.map +1 -0
  342. package/dist/fields/SlugPreviewField.d.ts +16 -0
  343. package/dist/fields/SlugPreviewField.d.ts.map +1 -0
  344. package/dist/fields/SlugPreviewField.js +49 -0
  345. package/dist/fields/SlugPreviewField.js.map +1 -0
  346. package/dist/fields/TemplateField.d.ts +31 -0
  347. package/dist/fields/TemplateField.d.ts.map +1 -0
  348. package/dist/fields/TemplateField.js +428 -0
  349. package/dist/fields/TemplateField.js.map +1 -0
  350. package/dist/fields/TiptapField.d.ts +40 -0
  351. package/dist/fields/TiptapField.d.ts.map +1 -0
  352. package/dist/fields/TiptapField.js +857 -0
  353. package/dist/fields/TiptapField.js.map +1 -0
  354. package/dist/fields/TiptapModal.d.ts +10 -0
  355. package/dist/fields/TiptapModal.d.ts.map +1 -0
  356. package/dist/fields/TiptapModal.js +114 -0
  357. package/dist/fields/TiptapModal.js.map +1 -0
  358. package/dist/fields/TiptapModalField.d.ts +23 -0
  359. package/dist/fields/TiptapModalField.d.ts.map +1 -0
  360. package/dist/fields/TiptapModalField.js +55 -0
  361. package/dist/fields/TiptapModalField.js.map +1 -0
  362. package/dist/fields/TransformField.d.ts +31 -0
  363. package/dist/fields/TransformField.d.ts.map +1 -0
  364. package/dist/fields/TransformField.js +384 -0
  365. package/dist/fields/TransformField.js.map +1 -0
  366. package/dist/fields/VerticalAlignmentField.d.ts +35 -0
  367. package/dist/fields/VerticalAlignmentField.d.ts.map +1 -0
  368. package/dist/fields/VerticalAlignmentField.js +120 -0
  369. package/dist/fields/VerticalAlignmentField.js.map +1 -0
  370. package/dist/fields/WidthField.d.ts +28 -0
  371. package/dist/fields/WidthField.d.ts.map +1 -0
  372. package/dist/fields/WidthField.js +339 -0
  373. package/dist/fields/WidthField.js.map +1 -0
  374. package/dist/fields/index.d.ts +44 -559
  375. package/dist/fields/index.d.ts.map +1 -0
  376. package/dist/fields/index.js +91 -7704
  377. package/dist/fields/index.js.map +1 -0
  378. package/dist/fields/richtext-output.css +219 -0
  379. package/dist/{shared-X9UpCJKW.d.mts → fields/shared.d.ts} +111 -132
  380. package/dist/fields/shared.d.ts.map +1 -0
  381. package/dist/fields/shared.js +1542 -0
  382. package/dist/fields/shared.js.map +1 -0
  383. package/dist/fields/{index.css → tiptap-styles.css} +75 -166
  384. package/dist/hooks/index.d.ts +8 -0
  385. package/dist/hooks/index.d.ts.map +1 -0
  386. package/dist/hooks/index.js +8 -0
  387. package/dist/hooks/index.js.map +1 -0
  388. package/dist/hooks/useResponsiveStyles.d.ts +51 -0
  389. package/dist/hooks/useResponsiveStyles.d.ts.map +1 -0
  390. package/dist/hooks/useResponsiveStyles.js +149 -0
  391. package/dist/hooks/useResponsiveStyles.js.map +1 -0
  392. package/dist/hooks/useScrollAnimation.d.ts +56 -0
  393. package/dist/hooks/useScrollAnimation.d.ts.map +1 -0
  394. package/dist/hooks/useScrollAnimation.js +116 -0
  395. package/dist/hooks/useScrollAnimation.js.map +1 -0
  396. package/dist/index.d.ts +66 -6
  397. package/dist/index.d.ts.map +1 -0
  398. package/dist/index.js +67 -568
  399. package/dist/index.js.map +1 -0
  400. package/dist/layouts/LayoutWrapper.d.ts +33 -0
  401. package/dist/layouts/LayoutWrapper.d.ts.map +1 -0
  402. package/dist/layouts/LayoutWrapper.js +112 -0
  403. package/dist/layouts/LayoutWrapper.js.map +1 -0
  404. package/dist/layouts/defaults.d.ts +40 -0
  405. package/dist/layouts/defaults.d.ts.map +1 -0
  406. package/dist/layouts/defaults.js +106 -0
  407. package/dist/layouts/defaults.js.map +1 -0
  408. package/dist/layouts/index.d.ts +27 -94
  409. package/dist/layouts/index.d.ts.map +1 -0
  410. package/dist/layouts/index.js +30 -393
  411. package/dist/layouts/index.js.map +1 -0
  412. package/dist/{types-D7D3rZ1J.d.ts → layouts/types.d.ts} +8 -11
  413. package/dist/layouts/types.d.ts.map +1 -0
  414. package/dist/layouts/types.js +7 -0
  415. package/dist/layouts/types.js.map +1 -0
  416. package/dist/layouts/utils.d.ts +42 -0
  417. package/dist/layouts/utils.d.ts.map +1 -0
  418. package/dist/layouts/utils.js +83 -0
  419. package/dist/layouts/utils.js.map +1 -0
  420. package/dist/plugin/collections/Pages.d.ts +8 -0
  421. package/dist/plugin/collections/Pages.d.ts.map +1 -0
  422. package/dist/plugin/collections/Pages.js +117 -0
  423. package/dist/plugin/collections/Pages.js.map +1 -0
  424. package/dist/plugin/fields/index.d.ts +153 -0
  425. package/dist/plugin/fields/index.d.ts.map +1 -0
  426. package/dist/plugin/fields/index.js +364 -0
  427. package/dist/plugin/fields/index.js.map +1 -0
  428. package/dist/plugin/fields/types.d.ts +108 -0
  429. package/dist/plugin/fields/types.d.ts.map +1 -0
  430. package/dist/plugin/fields/types.js +7 -0
  431. package/dist/plugin/fields/types.js.map +1 -0
  432. package/dist/plugin/index.d.ts +13 -255
  433. package/dist/plugin/index.d.ts.map +1 -0
  434. package/dist/plugin/index.js +276 -553
  435. package/dist/plugin/index.js.map +1 -0
  436. package/dist/render/HybridPageRenderer.d.ts +85 -0
  437. package/dist/render/HybridPageRenderer.d.ts.map +1 -0
  438. package/dist/render/HybridPageRenderer.js +29 -0
  439. package/dist/render/HybridPageRenderer.js.map +1 -0
  440. package/dist/render/PageRenderer.d.ts +51 -0
  441. package/dist/render/PageRenderer.d.ts.map +1 -0
  442. package/dist/render/PageRenderer.js +61 -0
  443. package/dist/render/PageRenderer.js.map +1 -0
  444. package/dist/render/PuckEditor.client.d.ts +66 -0
  445. package/dist/render/PuckEditor.client.d.ts.map +1 -0
  446. package/dist/render/PuckEditor.client.js +66 -0
  447. package/dist/render/PuckEditor.client.js.map +1 -0
  448. package/dist/render/index.d.ts +8 -106
  449. package/dist/render/index.d.ts.map +1 -0
  450. package/dist/render/index.js +10 -2253
  451. package/dist/render/index.js.map +1 -0
  452. package/dist/theme/context.d.ts +59 -0
  453. package/dist/theme/context.d.ts.map +1 -0
  454. package/dist/theme/context.js +73 -0
  455. package/dist/theme/context.js.map +1 -0
  456. package/dist/theme/defaults.d.ts +39 -0
  457. package/dist/theme/defaults.d.ts.map +1 -0
  458. package/dist/theme/defaults.js +72 -0
  459. package/dist/theme/defaults.js.map +1 -0
  460. package/dist/theme/example.d.ts +30 -0
  461. package/dist/theme/example.d.ts.map +1 -0
  462. package/dist/theme/example.js +89 -0
  463. package/dist/theme/example.js.map +1 -0
  464. package/dist/theme/index.d.ts +17 -140
  465. package/dist/theme/index.d.ts.map +1 -0
  466. package/dist/theme/index.js +34 -200
  467. package/dist/theme/index.js.map +1 -0
  468. package/dist/{types-_6MvjyKv.d.ts → theme/types.d.ts} +8 -9
  469. package/dist/theme/types.d.ts.map +1 -0
  470. package/dist/theme/types.js +9 -0
  471. package/dist/theme/types.js.map +1 -0
  472. package/dist/theme/utils.d.ts +30 -0
  473. package/dist/theme/utils.d.ts.map +1 -0
  474. package/dist/theme/utils.js +84 -0
  475. package/dist/theme/utils.js.map +1 -0
  476. package/dist/{index-CQu6SzDg.d.mts → types/index.d.ts} +120 -115
  477. package/dist/types/index.d.ts.map +1 -0
  478. package/dist/types/index.js +2 -0
  479. package/dist/types/index.js.map +1 -0
  480. package/dist/utils/index.d.ts +23 -257
  481. package/dist/utils/index.d.ts.map +1 -0
  482. package/dist/utils/index.js +56 -425
  483. package/dist/utils/index.js.map +1 -0
  484. package/dist/utils/{index.d.mts → migration.d.ts} +16 -112
  485. package/dist/utils/migration.d.ts.map +1 -0
  486. package/dist/utils/migration.js +309 -0
  487. package/dist/utils/migration.js.map +1 -0
  488. package/dist/utils/validation.d.ts +89 -0
  489. package/dist/utils/validation.d.ts.map +1 -0
  490. package/dist/utils/validation.js +247 -0
  491. package/dist/utils/validation.js.map +1 -0
  492. package/dist/views/PuckConfigContext.d.ts +71 -0
  493. package/dist/views/PuckConfigContext.d.ts.map +1 -0
  494. package/dist/views/PuckConfigContext.js +45 -0
  495. package/dist/views/PuckConfigContext.js.map +1 -0
  496. package/dist/views/PuckEditorClient.d.ts +73 -0
  497. package/dist/views/PuckEditorClient.d.ts.map +1 -0
  498. package/dist/views/PuckEditorClient.js +130 -0
  499. package/dist/views/PuckEditorClient.js.map +1 -0
  500. package/dist/views/PuckEditorView.d.ts +19 -0
  501. package/dist/views/PuckEditorView.d.ts.map +1 -0
  502. package/dist/views/PuckEditorView.js +106 -0
  503. package/dist/views/PuckEditorView.js.map +1 -0
  504. package/dist/views/index.d.ts +10 -0
  505. package/dist/views/index.d.ts.map +1 -0
  506. package/dist/views/index.js +10 -0
  507. package/dist/views/index.js.map +1 -0
  508. package/package.json +51 -74
  509. package/dist/AccordionClient.d.mts +0 -24
  510. package/dist/AccordionClient.d.ts +0 -24
  511. package/dist/AccordionClient.js +0 -786
  512. package/dist/AccordionClient.mjs +0 -784
  513. package/dist/AnimatedWrapper.d.mts +0 -30
  514. package/dist/AnimatedWrapper.d.ts +0 -30
  515. package/dist/AnimatedWrapper.js +0 -379
  516. package/dist/AnimatedWrapper.mjs +0 -377
  517. package/dist/admin/client.d.mts +0 -108
  518. package/dist/admin/client.mjs +0 -173
  519. package/dist/admin/index.d.mts +0 -157
  520. package/dist/admin/index.mjs +0 -29
  521. package/dist/api/index.d.mts +0 -460
  522. package/dist/api/index.mjs +0 -578
  523. package/dist/components/index.css +0 -339
  524. package/dist/components/index.d.mts +0 -219
  525. package/dist/components/index.mjs +0 -9216
  526. package/dist/config/config.editor.css +0 -339
  527. package/dist/config/config.editor.d.mts +0 -153
  528. package/dist/config/config.editor.mjs +0 -9445
  529. package/dist/config/index.d.mts +0 -68
  530. package/dist/config/index.mjs +0 -2099
  531. package/dist/editor/index.d.mts +0 -784
  532. package/dist/editor/index.mjs +0 -4592
  533. package/dist/fields/index.d.mts +0 -600
  534. package/dist/fields/index.mjs +0 -7588
  535. package/dist/index-CoUQnyC3.d.ts +0 -327
  536. package/dist/index.d.mts +0 -6
  537. package/dist/index.mjs +0 -555
  538. package/dist/layouts/index.d.mts +0 -96
  539. package/dist/layouts/index.mjs +0 -378
  540. package/dist/plugin/index.d.mts +0 -289
  541. package/dist/plugin/index.mjs +0 -555
  542. package/dist/render/index.d.mts +0 -109
  543. package/dist/render/index.mjs +0 -2231
  544. package/dist/shared-X9UpCJKW.d.ts +0 -548
  545. package/dist/theme/index.d.mts +0 -155
  546. package/dist/theme/index.mjs +0 -186
  547. package/dist/types-D7D3rZ1J.d.mts +0 -116
  548. package/dist/types-_6MvjyKv.d.mts +0 -104
  549. package/dist/utils/index.mjs +0 -412
  550. package/dist/utils-DaRs9t0J.d.mts +0 -85
  551. package/dist/utils-gAvt0Vhw.d.ts +0 -85
  552. package/examples/README.md +0 -247
  553. package/examples/api/puck/pages/[id]/route.ts +0 -64
  554. package/examples/api/puck/pages/[id]/versions/route.ts +0 -47
  555. package/examples/api/puck/pages/route.ts +0 -45
  556. package/examples/app/(frontend)/page.tsx +0 -94
  557. package/examples/app/(manage)/layout.tsx +0 -31
  558. package/examples/app/[...slug]/page.tsx +0 -101
  559. package/examples/app/pages/[id]/edit/page.tsx +0 -148
  560. package/examples/components/CustomBanner.tsx +0 -368
  561. package/examples/config/custom-config.ts +0 -223
  562. package/examples/config/payload.config.example.ts +0 -64
  563. package/examples/lib/puck-layouts.ts +0 -258
  564. package/examples/lib/puck-theme.ts +0 -94
  565. package/examples/styles/puck-theme.css +0 -171
@@ -1,2254 +1,11 @@
1
- 'use strict';
2
-
3
- var puck = require('@measured/puck');
4
- var jsxRuntime = require('react/jsx-runtime');
5
- var AnimatedWrapper = require('../AnimatedWrapper');
6
- var React = require('react');
7
- var lucideReact = require('lucide-react');
8
- var reactSlot = require('@radix-ui/react-slot');
9
- var classVarianceAuthority = require('class-variance-authority');
10
- var clsx = require('clsx');
11
- var tailwindMerge = require('tailwind-merge');
12
- var LabelPrimitive = require('@radix-ui/react-label');
13
- var AccordionClient = require('../AccordionClient');
14
-
15
- function _interopNamespace(e) {
16
- if (e && e.__esModule) return e;
17
- var n = Object.create(null);
18
- if (e) {
19
- Object.keys(e).forEach(function (k) {
20
- if (k !== 'default') {
21
- var d = Object.getOwnPropertyDescriptor(e, k);
22
- Object.defineProperty(n, k, d.get ? d : {
23
- enumerable: true,
24
- get: function () { return e[k]; }
25
- });
26
- }
27
- });
28
- }
29
- n.default = e;
30
- return Object.freeze(n);
31
- }
32
-
33
- var React__namespace = /*#__PURE__*/_interopNamespace(React);
34
- var LabelPrimitive__namespace = /*#__PURE__*/_interopNamespace(LabelPrimitive);
35
-
36
- // src/render/PageRenderer.tsx
37
-
38
- // src/layouts/defaults.ts
39
- var defaultLayout = {
40
- value: "default",
41
- label: "Default",
42
- description: "Standard page layout with contained content width",
43
- classes: {
44
- wrapper: "",
45
- container: "mx-auto px-4 sm:px-6 lg:px-8",
46
- content: ""
47
- },
48
- maxWidth: "1200px",
49
- fullWidth: false
50
- };
51
- var landingLayout = {
52
- value: "landing",
53
- label: "Landing",
54
- description: "Full-width sections with no global container constraints",
55
- classes: {
56
- wrapper: "",
57
- container: "",
58
- content: ""
59
- },
60
- fullWidth: true
61
- };
62
- var fullWidthLayout = {
63
- value: "full-width",
64
- label: "Full Width",
65
- description: "Content spans the full viewport width",
66
- classes: {
67
- wrapper: "w-full",
68
- container: "w-full",
69
- content: ""
70
- },
71
- maxWidth: "100%",
72
- fullWidth: true
73
- };
74
- var DEFAULT_LAYOUTS = [
75
- defaultLayout,
76
- landingLayout,
77
- fullWidthLayout
78
- ];
79
-
80
- // src/layouts/utils.ts
81
- function getLayout(layouts, value, fallback = "default") {
82
- const layout = layouts.find((l) => l.value === value);
83
- if (layout) return layout;
84
- if (value !== fallback) {
85
- return layouts.find((l) => l.value === fallback);
86
- }
87
- return layouts[0];
88
- }
89
- function layoutsToOptions(layouts) {
90
- return layouts.map(({ value, label, description }) => ({
91
- value,
92
- label,
93
- description
94
- }));
95
- }
96
-
97
- // src/fields/shared.ts
98
- function cn(...classes) {
99
- return classes.filter(Boolean).join(" ");
100
- }
101
- function isLegacyWidthValue(value) {
102
- if (!value || typeof value !== "object") return false;
103
- const v = value;
104
- return typeof v.maxWidth === "number" && typeof v.unit === "string" && typeof v.mode === "string" && !("minWidth" in v) && !("minHeight" in v) && !("maxHeight" in v);
105
- }
106
- var alignmentMap = {
107
- left: "text-left",
108
- center: "text-center",
109
- right: "text-right"
110
- };
111
- var shadowMap = {
112
- none: "",
113
- sm: "shadow-sm",
114
- md: "shadow-md",
115
- lg: "shadow-lg",
116
- xl: "shadow-xl",
117
- "2xl": "shadow-2xl"
118
- };
119
- var headingLevelMap = {
120
- h1: "text-4xl md:text-5xl lg:text-6xl font-bold tracking-tight",
121
- h2: "text-3xl md:text-4xl font-bold tracking-tight",
122
- h3: "text-2xl md:text-3xl font-semibold",
123
- h4: "text-xl md:text-2xl font-semibold",
124
- h5: "text-lg md:text-xl font-medium",
125
- h6: "text-base md:text-lg font-medium"
126
- };
127
- var textSizeMap = {
128
- xs: "text-xs",
129
- sm: "text-sm",
130
- base: "text-base",
131
- lg: "text-lg",
132
- xl: "text-xl",
133
- "2xl": "text-2xl"
134
- };
135
- var aspectRatioMap = {
136
- auto: "",
137
- square: "aspect-square",
138
- video: "aspect-video",
139
- portrait: "aspect-[3/4]",
140
- landscape: "aspect-[4/3]",
141
- wide: "aspect-[21/9]"
142
- };
143
- var dividerStyleMap = {
144
- solid: "border-solid",
145
- dashed: "border-dashed",
146
- dotted: "border-dotted"
147
- };
148
- var justifyContentMap = {
149
- start: "justify-start",
150
- "flex-start": "justify-start",
151
- center: "justify-center",
152
- end: "justify-end",
153
- "flex-end": "justify-end",
154
- between: "justify-between",
155
- "space-between": "justify-between",
156
- around: "justify-around",
157
- "space-around": "justify-around",
158
- evenly: "justify-evenly",
159
- "space-evenly": "justify-evenly"
160
- };
161
- var alignItemsMap = {
162
- start: "items-start",
163
- "flex-start": "items-start",
164
- center: "items-center",
165
- end: "items-end",
166
- "flex-end": "items-end",
167
- stretch: "items-stretch",
168
- baseline: "items-baseline"
169
- };
170
- function hexToRgb(hex) {
171
- const clean = hex.replace(/^#/, "");
172
- if (clean.length !== 6) return null;
173
- const r = parseInt(clean.substring(0, 2), 16);
174
- const g = parseInt(clean.substring(2, 4), 16);
175
- const b = parseInt(clean.substring(4, 6), 16);
176
- if (isNaN(r) || isNaN(g) || isNaN(b)) return null;
177
- return { r, g, b };
178
- }
179
- function colorValueToCSS(color) {
180
- if (!color?.hex) return void 0;
181
- const rgb = hexToRgb(color.hex);
182
- if (!rgb) return color.hex;
183
- const opacity = (color.opacity ?? 100) / 100;
184
- if (opacity === 1) {
185
- return color.hex;
186
- }
187
- return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${opacity})`;
188
- }
189
- function paddingValueToCSS(padding) {
190
- if (!padding) return void 0;
191
- const { top, right, bottom, left, unit } = padding;
192
- if (top === right && right === bottom && bottom === left) {
193
- return `${top}${unit}`;
194
- }
195
- if (top === bottom && left === right) {
196
- return `${top}${unit} ${right}${unit}`;
197
- }
198
- if (left === right) {
199
- return `${top}${unit} ${right}${unit} ${bottom}${unit}`;
200
- }
201
- return `${top}${unit} ${right}${unit} ${bottom}${unit} ${left}${unit}`;
202
- }
203
- function marginValueToCSS(margin) {
204
- if (!margin) return void 0;
205
- const { top, right, bottom, left, unit } = margin;
206
- if (top === right && right === bottom && bottom === left) {
207
- return `${top}${unit}`;
208
- }
209
- if (top === bottom && left === right) {
210
- return `${top}${unit} ${right}${unit}`;
211
- }
212
- if (left === right) {
213
- return `${top}${unit} ${right}${unit} ${bottom}${unit}`;
214
- }
215
- return `${top}${unit} ${right}${unit} ${bottom}${unit} ${left}${unit}`;
216
- }
217
- function borderValueToCSS(border) {
218
- if (!border || border.style === "none") return void 0;
219
- const color = colorValueToCSS(border.color) || "#000000";
220
- const style = {};
221
- if (border.sides.top) {
222
- style.borderTopWidth = `${border.width}px`;
223
- style.borderTopStyle = border.style;
224
- style.borderTopColor = color;
225
- }
226
- if (border.sides.right) {
227
- style.borderRightWidth = `${border.width}px`;
228
- style.borderRightStyle = border.style;
229
- style.borderRightColor = color;
230
- }
231
- if (border.sides.bottom) {
232
- style.borderBottomWidth = `${border.width}px`;
233
- style.borderBottomStyle = border.style;
234
- style.borderBottomColor = color;
235
- }
236
- if (border.sides.left) {
237
- style.borderLeftWidth = `${border.width}px`;
238
- style.borderLeftStyle = border.style;
239
- style.borderLeftColor = color;
240
- }
241
- if (border.radius > 0) {
242
- style.borderRadius = `${border.radius}px`;
243
- }
244
- return Object.keys(style).length > 0 ? style : void 0;
245
- }
246
- function widthValueToCSS(width) {
247
- if (!width) return void 0;
248
- const style = {};
249
- if (width.mode === "full") {
250
- style.width = "100%";
251
- style.maxWidth = "100%";
252
- } else {
253
- style.maxWidth = `${width.maxWidth}${width.unit}`;
254
- style.width = "100%";
255
- }
256
- switch (width.alignment) {
257
- case "left":
258
- style.marginLeft = "0";
259
- style.marginRight = "auto";
260
- break;
261
- case "center":
262
- style.marginLeft = "auto";
263
- style.marginRight = "auto";
264
- break;
265
- case "right":
266
- style.marginLeft = "auto";
267
- style.marginRight = "0";
268
- break;
269
- }
270
- return style;
271
- }
272
- function dimensionsValueToCSS(dimensions) {
273
- if (!dimensions) return void 0;
274
- if (isLegacyWidthValue(dimensions)) {
275
- return widthValueToCSS(dimensions);
276
- }
277
- const dim = dimensions;
278
- const style = {};
279
- if (dim.mode === "full") {
280
- style.width = "100%";
281
- style.maxWidth = "100%";
282
- } else {
283
- style.width = "100%";
284
- if (dim.maxWidth?.enabled !== false && dim.maxWidth?.value > 0) {
285
- style.maxWidth = `${dim.maxWidth.value}${dim.maxWidth.unit}`;
286
- }
287
- if (dim.minWidth?.enabled && dim.minWidth.value > 0) {
288
- style.minWidth = `${dim.minWidth.value}${dim.minWidth.unit}`;
289
- }
290
- }
291
- if (dim.minHeight?.enabled && dim.minHeight.value > 0) {
292
- style.minHeight = `${dim.minHeight.value}${dim.minHeight.unit}`;
293
- }
294
- if (dim.maxHeight?.enabled && dim.maxHeight.value > 0) {
295
- style.maxHeight = `${dim.maxHeight.value}${dim.maxHeight.unit}`;
296
- }
297
- switch (dim.alignment) {
298
- case "left":
299
- style.marginLeft = "0";
300
- style.marginRight = "auto";
301
- break;
302
- case "center":
303
- style.marginLeft = "auto";
304
- style.marginRight = "auto";
305
- break;
306
- case "right":
307
- style.marginLeft = "auto";
308
- style.marginRight = "0";
309
- break;
310
- }
311
- return style;
312
- }
313
- function gradientValueToCSS(gradient) {
314
- if (!gradient?.stops || gradient.stops.length === 0) {
315
- return "transparent";
316
- }
317
- const sortedStops = [...gradient.stops].sort((a, b) => a.position - b.position);
318
- const stopsCSS = sortedStops.map((stop) => {
319
- const color = colorValueToCSS(stop.color) || "transparent";
320
- return `${color} ${stop.position}%`;
321
- }).join(", ");
322
- if (gradient.type === "radial") {
323
- const shape = gradient.radialShape || "circle";
324
- const position = gradient.radialPosition || "center";
325
- return `radial-gradient(${shape} at ${position}, ${stopsCSS})`;
326
- }
327
- return `linear-gradient(${gradient.angle}deg, ${stopsCSS})`;
328
- }
329
- function positionToCSS(position) {
330
- const positionMap = {
331
- center: "center",
332
- top: "top",
333
- bottom: "bottom",
334
- left: "left",
335
- right: "right",
336
- "top-left": "top left",
337
- "top-right": "top right",
338
- "bottom-left": "bottom left",
339
- "bottom-right": "bottom right"
340
- };
341
- return position ? positionMap[position] || "center" : "center";
342
- }
343
- function maskDirectionToCSS(direction) {
344
- const directionMap = {
345
- "to-top": "to top",
346
- "to-bottom": "to bottom",
347
- "to-left": "to left",
348
- "to-right": "to right",
349
- "to-top-left": "to top left",
350
- "to-top-right": "to top right",
351
- "to-bottom-left": "to bottom left",
352
- "to-bottom-right": "to bottom right",
353
- "from-center": "radial"
354
- // Not used for linear, handled separately in maskToCSS
355
- };
356
- return directionMap[direction] || "to bottom";
357
- }
358
- function maskToCSS(mask) {
359
- const startAlpha = (mask.startOpacity ?? 100) / 100;
360
- const endAlpha = (mask.endOpacity ?? 0) / 100;
361
- if (mask.direction === "from-center") {
362
- return `radial-gradient(circle at center, rgba(0,0,0,${startAlpha}) ${mask.startPosition}%, rgba(0,0,0,${endAlpha}) ${mask.endPosition}%)`;
363
- }
364
- const direction = maskDirectionToCSS(mask.direction);
365
- return `linear-gradient(${direction}, rgba(0,0,0,${startAlpha}) ${mask.startPosition}%, rgba(0,0,0,${endAlpha}) ${mask.endPosition}%)`;
366
- }
367
- function backgroundValueToCSS(bg) {
368
- if (!bg || bg.type === "none") {
369
- return {};
370
- }
371
- const style = {};
372
- switch (bg.type) {
373
- case "solid":
374
- if (bg.solid?.hex) {
375
- style.backgroundColor = colorValueToCSS(bg.solid);
376
- }
377
- break;
378
- case "gradient":
379
- if (bg.gradient && bg.gradient.stops && bg.gradient.stops.length > 0) {
380
- style.background = gradientValueToCSS(bg.gradient);
381
- }
382
- break;
383
- case "image":
384
- if (bg.image?.media?.url) {
385
- const imageUrl = bg.image.media.url;
386
- const size = bg.image.size || "cover";
387
- const position = positionToCSS(bg.image.position);
388
- const repeat = bg.image.repeat || "no-repeat";
389
- const attachment = bg.image.attachment || "scroll";
390
- if (bg.overlay?.enabled) {
391
- const overlayCSS = bg.overlay.type === "solid" ? colorValueToCSS(bg.overlay.solid) : gradientValueToCSS(bg.overlay.gradient);
392
- if (bg.overlay.type === "solid" && overlayCSS) {
393
- style.backgroundImage = `linear-gradient(${overlayCSS}, ${overlayCSS}), url(${imageUrl})`;
394
- } else {
395
- style.backgroundImage = `${overlayCSS}, url(${imageUrl})`;
396
- }
397
- style.backgroundSize = `auto, ${size}`;
398
- style.backgroundPosition = `center, ${position}`;
399
- style.backgroundRepeat = `no-repeat, ${repeat}`;
400
- style.backgroundAttachment = `scroll, ${attachment}`;
401
- } else {
402
- style.backgroundImage = `url(${imageUrl})`;
403
- style.backgroundSize = size;
404
- style.backgroundPosition = position;
405
- style.backgroundRepeat = repeat;
406
- style.backgroundAttachment = attachment;
407
- }
408
- if (bg.image.mask?.enabled) {
409
- const maskCSS = maskToCSS(bg.image.mask);
410
- style.maskImage = maskCSS;
411
- style.WebkitMaskImage = maskCSS;
412
- }
413
- }
414
- break;
415
- }
416
- return style;
417
- }
418
- function transformOriginToCSS(origin) {
419
- const originMap = {
420
- center: "center",
421
- top: "top",
422
- bottom: "bottom",
423
- left: "left",
424
- right: "right",
425
- "top-left": "top left",
426
- "top-right": "top right",
427
- "bottom-left": "bottom left",
428
- "bottom-right": "bottom right"
429
- };
430
- return originMap[origin] || "center";
431
- }
432
- function transformValueToCSS(transform) {
433
- if (!transform) return void 0;
434
- const style = {};
435
- const transforms = [];
436
- if (transform.enable3D && transform.perspective) {
437
- style.perspective = `${transform.perspective}px`;
438
- }
439
- if (transform.translateX !== 0 || transform.translateY !== 0) {
440
- transforms.push(
441
- `translate(${transform.translateX}${transform.translateUnit}, ${transform.translateY}${transform.translateUnit})`
442
- );
443
- }
444
- if (transform.rotate !== 0) {
445
- transforms.push(`rotate(${transform.rotate}deg)`);
446
- }
447
- if (transform.enable3D) {
448
- if (transform.rotateX && transform.rotateX !== 0) {
449
- transforms.push(`rotateX(${transform.rotateX}deg)`);
450
- }
451
- if (transform.rotateY && transform.rotateY !== 0) {
452
- transforms.push(`rotateY(${transform.rotateY}deg)`);
453
- }
454
- }
455
- if (transform.scaleX !== 1 || transform.scaleY !== 1) {
456
- if (transform.scaleX === transform.scaleY) {
457
- transforms.push(`scale(${transform.scaleX})`);
458
- } else {
459
- transforms.push(`scale(${transform.scaleX}, ${transform.scaleY})`);
460
- }
461
- }
462
- if (transform.skewX !== 0 || transform.skewY !== 0) {
463
- if (transform.skewX !== 0 && transform.skewY !== 0) {
464
- transforms.push(`skew(${transform.skewX}deg, ${transform.skewY}deg)`);
465
- } else if (transform.skewX !== 0) {
466
- transforms.push(`skewX(${transform.skewX}deg)`);
467
- } else {
468
- transforms.push(`skewY(${transform.skewY}deg)`);
469
- }
470
- }
471
- if (transforms.length > 0) {
472
- style.transform = transforms.join(" ");
473
- }
474
- if (transform.origin !== "center") {
475
- style.transformOrigin = transformOriginToCSS(transform.origin);
476
- }
477
- if (transform.enable3D) {
478
- style.transformStyle = "preserve-3d";
479
- }
480
- return Object.keys(style).length > 0 ? style : void 0;
481
- }
482
- var BREAKPOINTS = [
483
- { key: "xs", label: "XS", minWidth: null },
484
- { key: "sm", label: "SM", minWidth: 640 },
485
- { key: "md", label: "MD", minWidth: 768 },
486
- { key: "lg", label: "LG", minWidth: 1024 },
487
- { key: "xl", label: "XL", minWidth: 1280 }
488
- ];
489
- function isResponsiveValue(value) {
490
- if (!value || typeof value !== "object") return false;
491
- return "xs" in value;
492
- }
493
- function camelToKebab(str) {
494
- return str.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
495
- }
496
- function cssPropertiesToString(styles) {
497
- return Object.entries(styles).filter(([, value]) => value !== void 0 && value !== null && value !== "").map(([key, value]) => `${camelToKebab(key)}: ${value}`).join("; ");
498
- }
499
- function responsiveValueToCSS(value, converter, uniqueId) {
500
- if (value === null || value === void 0) {
501
- return { baseStyles: {}, mediaQueryCSS: "" };
502
- }
503
- if (!isResponsiveValue(value)) {
504
- const styles = converter(value);
505
- return {
506
- baseStyles: styles || {},
507
- mediaQueryCSS: ""
508
- };
509
- }
510
- const cssRules = [];
511
- BREAKPOINTS.forEach((bp) => {
512
- const bpValue = value[bp.key];
513
- if (bpValue === void 0) return;
514
- const cssProps = converter(bpValue);
515
- if (!cssProps) return;
516
- const styleString = cssPropertiesToString(cssProps);
517
- if (!styleString) return;
518
- if (bp.key === "xs") {
519
- cssRules.push(`.${uniqueId} { ${styleString} }`);
520
- } else {
521
- cssRules.push(
522
- `@media (min-width: ${bp.minWidth}px) { .${uniqueId} { ${styleString} } }`
523
- );
524
- }
525
- });
526
- return { baseStyles: {}, mediaQueryCSS: cssRules.join("\n") };
527
- }
528
- function visibilityValueToCSS(visibility, uniqueId) {
529
- if (!visibility) return "";
530
- const mediaQueries = [];
531
- const breakpointWidths = {
532
- xs: null,
533
- // 0px
534
- sm: 640,
535
- md: 768,
536
- lg: 1024,
537
- xl: 1280
538
- };
539
- const getNextBreakpointWidth = (bp) => {
540
- const order = ["xs", "sm", "md", "lg", "xl"];
541
- const index = order.indexOf(bp);
542
- if (index === -1 || index === order.length - 1) return null;
543
- return breakpointWidths[order[index + 1]];
544
- };
545
- if (visibility.xs === false) {
546
- const nextWidth = getNextBreakpointWidth("xs");
547
- if (nextWidth) {
548
- mediaQueries.push(`@media (max-width: ${nextWidth - 1}px) { .${uniqueId} { display: none; } }`);
549
- } else {
550
- mediaQueries.push(`.${uniqueId} { display: none; }`);
551
- }
552
- }
553
- BREAKPOINTS.slice(1).forEach((bp) => {
554
- if (visibility[bp.key] === false) {
555
- const minWidth = breakpointWidths[bp.key];
556
- const maxWidth = getNextBreakpointWidth(bp.key);
557
- if (minWidth && maxWidth) {
558
- mediaQueries.push(
559
- `@media (min-width: ${minWidth}px) and (max-width: ${maxWidth - 1}px) { .${uniqueId} { display: none; } }`
560
- );
561
- } else if (minWidth) {
562
- mediaQueries.push(
563
- `@media (min-width: ${minWidth}px) { .${uniqueId} { display: none; } }`
564
- );
565
- }
566
- }
567
- });
568
- return mediaQueries.join("\n");
569
- }
570
- var stickyFooterContainerStyle = {
571
- minHeight: "100vh",
572
- display: "flex",
573
- flexDirection: "column"
574
- };
575
- var stickyFooterMainStyle = {
576
- flex: 1
577
- };
578
- function LayoutWrapper({ children, layout, className, overrides }) {
579
- if (!layout) {
580
- if (overrides?.background) {
581
- const bgStyles = backgroundValueToCSS(overrides.background);
582
- return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { minHeight: "100vh", ...bgStyles }, children });
583
- }
584
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
585
- }
586
- const Header = layout.header;
587
- const Footer = layout.footer;
588
- const shouldShowHeader = overrides?.showHeader === "hide" ? false : overrides?.showHeader === "show" ? true : !!Header;
589
- const shouldShowFooter = overrides?.showFooter === "hide" ? false : overrides?.showFooter === "show" ? true : !!Footer;
590
- const useStickyFooter = layout.stickyFooter !== false;
591
- const mainStyle = {
592
- ...layout.stickyHeaderHeight && shouldShowHeader ? { paddingTop: layout.stickyHeaderHeight } : {},
593
- ...useStickyFooter ? stickyFooterMainStyle : {}
594
- };
595
- const outerBackgroundStyles = overrides?.background ? backgroundValueToCSS(overrides.background) : {
596
- ...layout.styles?.wrapper?.background !== void 0 ? { background: layout.styles.wrapper.background } : {},
597
- ...layout.styles?.wrapper?.backgroundAttachment !== void 0 ? { backgroundAttachment: layout.styles.wrapper.backgroundAttachment } : {}
598
- };
599
- const effectiveMaxWidth = overrides?.maxWidth && overrides.maxWidth !== "default" ? overrides.maxWidth : layout.maxWidth;
600
- const wrapWithStickyFooter = (content) => {
601
- if (useStickyFooter) {
602
- return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { ...stickyFooterContainerStyle, ...outerBackgroundStyles }, children: content });
603
- }
604
- const hasBackground = Object.keys(outerBackgroundStyles).length > 0;
605
- if (hasBackground) {
606
- return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { minHeight: "100vh", ...outerBackgroundStyles }, children: content });
607
- }
608
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: content });
609
- };
610
- if (layout.wrapper) {
611
- const CustomWrapper = layout.wrapper;
612
- return wrapWithStickyFooter(
613
- /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
614
- shouldShowHeader && Header && /* @__PURE__ */ jsxRuntime.jsx(Header, {}),
615
- /* @__PURE__ */ jsxRuntime.jsx("main", { style: Object.keys(mainStyle).length > 0 ? mainStyle : void 0, children: /* @__PURE__ */ jsxRuntime.jsx(CustomWrapper, { children }) }),
616
- shouldShowFooter && Footer && /* @__PURE__ */ jsxRuntime.jsx(Footer, {})
617
- ] })
618
- );
619
- }
620
- const wrapperStyle = {
621
- ...layout.styles?.wrapper
622
- };
623
- const containerStyle = {
624
- ...effectiveMaxWidth && !layout.fullWidth ? { maxWidth: effectiveMaxWidth } : {},
625
- ...layout.styles?.container
626
- };
627
- const contentStyle = {
628
- ...layout.styles?.content
629
- };
630
- const dataAttrs = {
631
- "data-layout": layout.value,
632
- ...layout.dataAttributes
633
- };
634
- if (layout.fullWidth) {
635
- return wrapWithStickyFooter(
636
- /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
637
- shouldShowHeader && Header && /* @__PURE__ */ jsxRuntime.jsx(Header, {}),
638
- /* @__PURE__ */ jsxRuntime.jsx(
639
- "main",
640
- {
641
- className: [layout.classes?.wrapper, className].filter(Boolean).join(" ") || void 0,
642
- style: {
643
- ...mainStyle,
644
- ...Object.keys(wrapperStyle).length > 0 ? wrapperStyle : {}
645
- },
646
- ...dataAttrs,
647
- children
648
- }
649
- ),
650
- shouldShowFooter && Footer && /* @__PURE__ */ jsxRuntime.jsx(Footer, {})
651
- ] })
652
- );
653
- }
654
- return wrapWithStickyFooter(
655
- /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
656
- shouldShowHeader && Header && /* @__PURE__ */ jsxRuntime.jsx(Header, {}),
657
- /* @__PURE__ */ jsxRuntime.jsx(
658
- "main",
659
- {
660
- className: layout.classes?.wrapper || void 0,
661
- style: {
662
- ...mainStyle,
663
- ...Object.keys(wrapperStyle).length > 0 ? wrapperStyle : {}
664
- },
665
- ...dataAttrs,
666
- children: /* @__PURE__ */ jsxRuntime.jsx(
667
- "div",
668
- {
669
- className: [layout.classes?.container, className].filter(Boolean).join(" ") || void 0,
670
- style: Object.keys(containerStyle).length > 0 ? containerStyle : void 0,
671
- children: /* @__PURE__ */ jsxRuntime.jsx(
672
- "div",
673
- {
674
- className: layout.classes?.content || void 0,
675
- style: Object.keys(contentStyle).length > 0 ? contentStyle : void 0,
676
- children
677
- }
678
- )
679
- }
680
- )
681
- }
682
- ),
683
- shouldShowFooter && Footer && /* @__PURE__ */ jsxRuntime.jsx(Footer, {})
684
- ] })
685
- );
686
- }
687
- var idCounter = 0;
688
- function generateUniqueId() {
689
- return `c${(++idCounter).toString(36)}${Math.random().toString(36).slice(2, 6)}`;
690
- }
691
- var defaultProps = {
692
- content: [],
693
- visibility: null,
694
- dimensions: null,
695
- background: null,
696
- border: null,
697
- padding: null,
698
- margin: null,
699
- animation: null
700
- };
701
- var ContainerConfig = {
702
- label: "Container",
703
- fields: {
704
- content: { type: "slot" }
705
- },
706
- defaultProps,
707
- render: ({
708
- content: Content,
709
- visibility,
710
- dimensions,
711
- background,
712
- border,
713
- padding,
714
- margin,
715
- animation
716
- }) => {
717
- const uniqueId = generateUniqueId();
718
- const containerClass = `puck-container-${uniqueId}`;
719
- const mediaQueries = [];
720
- const containerStyles = {};
721
- const backgroundStyles = backgroundValueToCSS(background);
722
- if (backgroundStyles) {
723
- Object.assign(containerStyles, backgroundStyles);
724
- }
725
- const borderStyles = borderValueToCSS(border);
726
- if (borderStyles) {
727
- Object.assign(containerStyles, borderStyles);
728
- }
729
- const dimensionsResult = responsiveValueToCSS(
730
- dimensions,
731
- dimensionsValueToCSS,
732
- containerClass
733
- );
734
- Object.assign(containerStyles, dimensionsResult.baseStyles);
735
- if (dimensionsResult.mediaQueryCSS) {
736
- mediaQueries.push(dimensionsResult.mediaQueryCSS);
737
- }
738
- const hasMinHeight = (() => {
739
- if (!dimensions) return false;
740
- if (typeof dimensions === "object" && "xs" in dimensions) {
741
- const responsiveDims = dimensions;
742
- return Object.values(responsiveDims).some((v) => {
743
- if (!v || typeof v !== "object") return false;
744
- const dim2 = v;
745
- return dim2.minHeight?.enabled && dim2.minHeight?.value > 0;
746
- });
747
- }
748
- const dim = dimensions;
749
- return dim.minHeight?.enabled && dim.minHeight?.value > 0;
750
- })();
751
- if (hasMinHeight) {
752
- containerStyles.display = "flex";
753
- containerStyles.flexDirection = "column";
754
- }
755
- const paddingResult = responsiveValueToCSS(
756
- padding,
757
- (v) => ({ padding: paddingValueToCSS(v) }),
758
- containerClass
759
- );
760
- Object.assign(containerStyles, paddingResult.baseStyles);
761
- if (paddingResult.mediaQueryCSS) {
762
- mediaQueries.push(paddingResult.mediaQueryCSS);
763
- }
764
- const marginResult = responsiveValueToCSS(
765
- margin,
766
- (v) => ({ margin: marginValueToCSS(v) }),
767
- containerClass
768
- );
769
- Object.assign(containerStyles, marginResult.baseStyles);
770
- if (marginResult.mediaQueryCSS) {
771
- mediaQueries.push(marginResult.mediaQueryCSS);
772
- }
773
- const visibilityCSS = visibilityValueToCSS(visibility, containerClass);
774
- if (visibilityCSS) {
775
- mediaQueries.push(visibilityCSS);
776
- }
777
- const allMediaQueryCSS = mediaQueries.join("\n");
778
- const hasStyles = Object.keys(containerStyles).length > 0;
779
- const ContentSlot = Content;
780
- const renderContent = () => {
781
- if (hasMinHeight) {
782
- return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 1, display: "flex", flexDirection: "column", minHeight: 0 }, children: /* @__PURE__ */ jsxRuntime.jsx(ContentSlot, { style: { flex: 1 } }) });
783
- }
784
- return /* @__PURE__ */ jsxRuntime.jsx(ContentSlot, {});
785
- };
786
- return /* @__PURE__ */ jsxRuntime.jsxs(AnimatedWrapper.AnimatedWrapper, { animation, children: [
787
- allMediaQueryCSS && /* @__PURE__ */ jsxRuntime.jsx("style", { children: allMediaQueryCSS }),
788
- hasStyles ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: containerClass, style: containerStyles, children: renderContent() }) : /* @__PURE__ */ jsxRuntime.jsx(ContentSlot, { className: containerClass })
789
- ] });
790
- }
791
- };
792
- var idCounter2 = 0;
793
- function generateUniqueId2() {
794
- return `f${(++idCounter2).toString(36)}${Math.random().toString(36).slice(2, 6)}`;
795
- }
796
- var flexDirectionMap = {
797
- row: "flex-row",
798
- column: "flex-col",
799
- "row-reverse": "flex-row-reverse",
800
- "column-reverse": "flex-col-reverse"
801
- };
802
- var flexWrapMap = {
803
- wrap: "flex-wrap",
804
- nowrap: "flex-nowrap",
805
- "wrap-reverse": "flex-wrap-reverse"
806
- };
807
- var defaultProps2 = {
808
- content: [],
809
- direction: "row",
810
- justifyContent: null,
811
- alignItems: null,
812
- gap: 24,
813
- wrap: "wrap",
814
- background: null,
815
- customPadding: null,
816
- margin: null,
817
- dimensions: null,
818
- border: null,
819
- animation: null,
820
- visibility: null
821
- };
822
- var FlexConfig = {
823
- label: "Flex",
824
- fields: {
825
- content: { type: "slot" }
826
- },
827
- defaultProps: defaultProps2,
828
- render: ({
829
- content: Content,
830
- direction,
831
- justifyContent,
832
- alignItems,
833
- gap,
834
- wrap,
835
- background,
836
- customPadding,
837
- margin,
838
- dimensions,
839
- border,
840
- animation,
841
- visibility
842
- }) => {
843
- const uniqueId = generateUniqueId2();
844
- const wrapperClass = `puck-flex-${uniqueId}`;
845
- const contentClass = `puck-flex-content-${uniqueId}`;
846
- const mediaQueries = [];
847
- const backgroundStyles = backgroundValueToCSS(background);
848
- const wrapperStyles = {
849
- ...backgroundStyles
850
- };
851
- const paddingResult = responsiveValueToCSS(
852
- customPadding,
853
- (v) => ({ padding: paddingValueToCSS(v) }),
854
- wrapperClass
855
- );
856
- Object.assign(wrapperStyles, paddingResult.baseStyles);
857
- if (paddingResult.mediaQueryCSS) {
858
- mediaQueries.push(paddingResult.mediaQueryCSS);
859
- }
860
- const borderStyles = borderValueToCSS(border);
861
- if (borderStyles) {
862
- Object.assign(wrapperStyles, borderStyles);
863
- }
864
- const marginResult = responsiveValueToCSS(
865
- margin,
866
- (v) => ({ margin: marginValueToCSS(v) }),
867
- wrapperClass
868
- );
869
- Object.assign(wrapperStyles, marginResult.baseStyles);
870
- if (marginResult.mediaQueryCSS) {
871
- mediaQueries.push(marginResult.mediaQueryCSS);
872
- }
873
- const dimensionsResult = responsiveValueToCSS(
874
- dimensions,
875
- dimensionsValueToCSS,
876
- contentClass
877
- );
878
- const visibilityCSS = visibilityValueToCSS(visibility, wrapperClass);
879
- if (visibilityCSS) {
880
- mediaQueries.push(visibilityCSS);
881
- }
882
- const contentClasses = cn(
883
- "flex w-full min-h-[50px]",
884
- flexDirectionMap[direction],
885
- justifyContent && justifyContentMap[justifyContent],
886
- alignItems && alignItemsMap[alignItems],
887
- flexWrapMap[wrap],
888
- "[&>*]:min-w-0",
889
- contentClass
890
- );
891
- const contentStyles = {
892
- gap,
893
- ...dimensionsResult.baseStyles
894
- };
895
- if (dimensionsResult.mediaQueryCSS) {
896
- mediaQueries.push(dimensionsResult.mediaQueryCSS);
897
- }
898
- const allMediaQueryCSS = mediaQueries.join("\n");
899
- const ContentSlot = Content;
900
- return /* @__PURE__ */ jsxRuntime.jsxs(AnimatedWrapper.AnimatedWrapper, { animation, children: [
901
- allMediaQueryCSS && /* @__PURE__ */ jsxRuntime.jsx("style", { children: allMediaQueryCSS }),
902
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: wrapperClass, style: wrapperStyles, children: /* @__PURE__ */ jsxRuntime.jsx(ContentSlot, { className: contentClasses, style: contentStyles }) })
903
- ] });
904
- }
905
- };
906
- var idCounter3 = 0;
907
- function generateUniqueId3() {
908
- return `g${(++idCounter3).toString(36)}${Math.random().toString(36).slice(2, 6)}`;
909
- }
910
- var defaultProps3 = {
911
- content: [],
912
- numColumns: 3,
913
- gap: 24,
914
- background: null,
915
- customPadding: null,
916
- dimensions: null,
917
- border: null,
918
- margin: null,
919
- animation: null,
920
- visibility: null
921
- };
922
- var GridConfig = {
923
- label: "Grid",
924
- fields: {
925
- content: { type: "slot" }
926
- },
927
- defaultProps: defaultProps3,
928
- render: ({
929
- content: Content,
930
- numColumns,
931
- gap,
932
- background,
933
- customPadding,
934
- dimensions,
935
- border,
936
- margin,
937
- animation,
938
- visibility
939
- }) => {
940
- const uniqueId = generateUniqueId3();
941
- const wrapperClass = `puck-grid-${uniqueId}`;
942
- const contentClass = `puck-grid-content-${uniqueId}`;
943
- const mediaQueries = [];
944
- const backgroundStyles = backgroundValueToCSS(background);
945
- const wrapperStyles = {
946
- ...backgroundStyles
947
- };
948
- const paddingResult = responsiveValueToCSS(
949
- customPadding,
950
- (v) => ({ padding: paddingValueToCSS(v) }),
951
- wrapperClass
952
- );
953
- Object.assign(wrapperStyles, paddingResult.baseStyles);
954
- if (paddingResult.mediaQueryCSS) {
955
- mediaQueries.push(paddingResult.mediaQueryCSS);
956
- }
957
- const borderStyles = borderValueToCSS(border);
958
- if (borderStyles) {
959
- Object.assign(wrapperStyles, borderStyles);
960
- }
961
- const marginResult = responsiveValueToCSS(
962
- margin,
963
- (v) => ({ margin: marginValueToCSS(v) }),
964
- wrapperClass
965
- );
966
- Object.assign(wrapperStyles, marginResult.baseStyles);
967
- if (marginResult.mediaQueryCSS) {
968
- mediaQueries.push(marginResult.mediaQueryCSS);
969
- }
970
- const dimensionsResult = responsiveValueToCSS(
971
- dimensions,
972
- dimensionsValueToCSS,
973
- contentClass
974
- );
975
- const visibilityCSS = visibilityValueToCSS(visibility, wrapperClass);
976
- if (visibilityCSS) {
977
- mediaQueries.push(visibilityCSS);
978
- }
979
- const contentClasses = cn(
980
- "flex flex-col w-full",
981
- "md:grid",
982
- contentClass
983
- );
984
- const contentStyles = {
985
- gap,
986
- ...dimensionsResult.baseStyles
987
- };
988
- if (dimensionsResult.mediaQueryCSS) {
989
- mediaQueries.push(dimensionsResult.mediaQueryCSS);
990
- }
991
- const gridStyles = {
992
- ...contentStyles,
993
- "--grid-cols": numColumns
994
- };
995
- const allMediaQueryCSS = mediaQueries.join("\n");
996
- const ContentSlot = Content;
997
- return /* @__PURE__ */ jsxRuntime.jsxs(AnimatedWrapper.AnimatedWrapper, { animation, children: [
998
- allMediaQueryCSS && /* @__PURE__ */ jsxRuntime.jsx("style", { children: allMediaQueryCSS }),
999
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: wrapperClass, style: wrapperStyles, children: [
1000
- /* @__PURE__ */ jsxRuntime.jsx(ContentSlot, { className: contentClasses, style: gridStyles }),
1001
- /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
1002
- @media (min-width: 768px) {
1003
- .flex.md\\:grid {
1004
- grid-template-columns: repeat(var(--grid-cols), 1fr);
1005
- }
1006
- }
1007
- ` })
1008
- ] })
1009
- ] });
1010
- }
1011
- };
1012
- var idCounter4 = 0;
1013
- function generateUniqueId4() {
1014
- return `s${(++idCounter4).toString(36)}${Math.random().toString(36).slice(2, 6)}`;
1015
- }
1016
- var DEFAULT_CONTENT_DIMENSIONS = {
1017
- mode: "contained",
1018
- alignment: "center",
1019
- maxWidth: { value: 1200, unit: "px", enabled: true }
1020
- };
1021
- var DEFAULT_CONTENT_PADDING = {
1022
- top: 0,
1023
- right: 16,
1024
- bottom: 0,
1025
- left: 16,
1026
- unit: "px",
1027
- linked: false
1028
- };
1029
- var defaultProps4 = {
1030
- id: "",
1031
- content: [],
1032
- // Section layer defaults
1033
- sectionBackground: null,
1034
- sectionBorder: null,
1035
- sectionPadding: null,
1036
- sectionMargin: null,
1037
- // Content layer defaults - 1200px max-width so two-layer design is immediately visible
1038
- contentDimensions: { xs: DEFAULT_CONTENT_DIMENSIONS },
1039
- contentBackground: null,
1040
- contentBorder: null,
1041
- contentPadding: { xs: DEFAULT_CONTENT_PADDING },
1042
- // Other
1043
- animation: null,
1044
- visibility: null
1045
- };
1046
- var SectionConfig = {
1047
- label: "Section",
1048
- fields: {
1049
- content: { type: "slot" }
1050
- },
1051
- defaultProps: defaultProps4,
1052
- render: ({
1053
- id,
1054
- content: Content,
1055
- sectionBackground,
1056
- sectionBorder,
1057
- sectionPadding,
1058
- sectionMargin,
1059
- contentDimensions,
1060
- contentBackground,
1061
- contentBorder,
1062
- contentPadding,
1063
- animation,
1064
- visibility
1065
- }) => {
1066
- const uniqueId = generateUniqueId4();
1067
- const sectionClass = `puck-section-${uniqueId}`;
1068
- const contentClass = `puck-section-content-${uniqueId}`;
1069
- const mediaQueries = [];
1070
- const sectionBackgroundStyles = backgroundValueToCSS(sectionBackground);
1071
- const sectionStyles = {
1072
- ...sectionBackgroundStyles
1073
- };
1074
- const sectionBorderStyles = borderValueToCSS(sectionBorder);
1075
- if (sectionBorderStyles) {
1076
- Object.assign(sectionStyles, sectionBorderStyles);
1077
- }
1078
- const sectionPaddingResult = responsiveValueToCSS(
1079
- sectionPadding,
1080
- (v) => ({ padding: paddingValueToCSS(v) }),
1081
- sectionClass
1082
- );
1083
- Object.assign(sectionStyles, sectionPaddingResult.baseStyles);
1084
- if (sectionPaddingResult.mediaQueryCSS) {
1085
- mediaQueries.push(sectionPaddingResult.mediaQueryCSS);
1086
- }
1087
- const sectionMarginResult = responsiveValueToCSS(
1088
- sectionMargin,
1089
- (v) => ({ margin: marginValueToCSS(v) }),
1090
- sectionClass
1091
- );
1092
- Object.assign(sectionStyles, sectionMarginResult.baseStyles);
1093
- if (sectionMarginResult.mediaQueryCSS) {
1094
- mediaQueries.push(sectionMarginResult.mediaQueryCSS);
1095
- }
1096
- const visibilityCSS = visibilityValueToCSS(visibility, sectionClass);
1097
- if (visibilityCSS) {
1098
- mediaQueries.push(visibilityCSS);
1099
- }
1100
- const contentBackgroundStyles = backgroundValueToCSS(contentBackground);
1101
- const contentStyles = {
1102
- ...contentBackgroundStyles
1103
- };
1104
- const contentDimensionsResult = responsiveValueToCSS(
1105
- contentDimensions,
1106
- dimensionsValueToCSS,
1107
- contentClass
1108
- );
1109
- Object.assign(contentStyles, contentDimensionsResult.baseStyles);
1110
- if (contentDimensionsResult.mediaQueryCSS) {
1111
- mediaQueries.push(contentDimensionsResult.mediaQueryCSS);
1112
- }
1113
- const hasMinHeight = (() => {
1114
- if (!contentDimensions) return false;
1115
- if (typeof contentDimensions === "object" && "xs" in contentDimensions) {
1116
- const responsiveDims = contentDimensions;
1117
- return Object.values(responsiveDims).some((v) => {
1118
- if (!v || typeof v !== "object") return false;
1119
- const dim2 = v;
1120
- return dim2.minHeight?.enabled && dim2.minHeight?.value > 0;
1121
- });
1122
- }
1123
- const dim = contentDimensions;
1124
- return dim.minHeight?.enabled && dim.minHeight?.value > 0;
1125
- })();
1126
- if (hasMinHeight) {
1127
- contentStyles.display = "flex";
1128
- contentStyles.flexDirection = "column";
1129
- }
1130
- const contentBorderStyles = borderValueToCSS(contentBorder);
1131
- if (contentBorderStyles) {
1132
- Object.assign(contentStyles, contentBorderStyles);
1133
- }
1134
- const contentPaddingResult = responsiveValueToCSS(
1135
- contentPadding,
1136
- (v) => ({ padding: paddingValueToCSS(v) }),
1137
- contentClass
1138
- );
1139
- Object.assign(contentStyles, contentPaddingResult.baseStyles);
1140
- if (contentPaddingResult.mediaQueryCSS) {
1141
- mediaQueries.push(contentPaddingResult.mediaQueryCSS);
1142
- }
1143
- const sectionClasses = cn("relative w-full", sectionClass);
1144
- const contentClasses = cn("relative z-10", contentClass);
1145
- const hasContentStyles = Object.keys(contentStyles).length > 0;
1146
- const allMediaQueryCSS = mediaQueries.join("\n");
1147
- const ContentSlot = Content;
1148
- const renderContent = () => {
1149
- if (hasMinHeight) {
1150
- return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 1, display: "flex", flexDirection: "column", minHeight: 0 }, children: /* @__PURE__ */ jsxRuntime.jsx(ContentSlot, { style: { flex: 1 } }) });
1151
- }
1152
- return /* @__PURE__ */ jsxRuntime.jsx(ContentSlot, {});
1153
- };
1154
- return /* @__PURE__ */ jsxRuntime.jsxs(AnimatedWrapper.AnimatedWrapper, { animation, children: [
1155
- allMediaQueryCSS && /* @__PURE__ */ jsxRuntime.jsx("style", { children: allMediaQueryCSS }),
1156
- /* @__PURE__ */ jsxRuntime.jsx(
1157
- "section",
1158
- {
1159
- id: id || void 0,
1160
- className: sectionClasses,
1161
- style: sectionStyles,
1162
- children: hasContentStyles ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: contentClasses, style: contentStyles, children: renderContent() }) : /* @__PURE__ */ jsxRuntime.jsx(ContentSlot, { className: contentClasses })
1163
- }
1164
- )
1165
- ] });
1166
- }
1167
- };
1168
- var idCounter5 = 0;
1169
- function generateUniqueId5() {
1170
- return `sp${(++idCounter5).toString(36)}${Math.random().toString(36).slice(2, 6)}`;
1171
- }
1172
- var heightMap = {
1173
- "8px": "h-2",
1174
- "16px": "h-4",
1175
- "24px": "h-6",
1176
- "32px": "h-8",
1177
- "48px": "h-12",
1178
- "64px": "h-16",
1179
- "80px": "h-20",
1180
- "96px": "h-24",
1181
- "128px": "h-32"
1182
- };
1183
- var widthMap = {
1184
- "8px": "w-2",
1185
- "16px": "w-4",
1186
- "24px": "w-6",
1187
- "32px": "w-8",
1188
- "48px": "w-12",
1189
- "64px": "w-16",
1190
- "80px": "w-20",
1191
- "96px": "w-24",
1192
- "128px": "w-32"
1193
- };
1194
- var defaultProps5 = {
1195
- size: "24px",
1196
- direction: "vertical",
1197
- visibility: null
1198
- };
1199
- var SpacerConfig = {
1200
- label: "Spacer",
1201
- defaultProps: defaultProps5,
1202
- render: ({ size, direction, visibility }) => {
1203
- const uniqueId = generateUniqueId5();
1204
- const wrapperClass = `puck-spacer-${uniqueId}`;
1205
- const visibilityCSS = visibilityValueToCSS(visibility, wrapperClass);
1206
- const getClasses = () => {
1207
- const heightClass = heightMap[size] || "h-6";
1208
- const widthClass = widthMap[size] || "w-6";
1209
- if (direction === "vertical") {
1210
- return `block ${heightClass} w-full`;
1211
- }
1212
- if (direction === "horizontal") {
1213
- return `inline-block ${widthClass} h-full`;
1214
- }
1215
- return `block ${heightClass} ${widthClass}`;
1216
- };
1217
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1218
- visibilityCSS && /* @__PURE__ */ jsxRuntime.jsx("style", { children: visibilityCSS }),
1219
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(getClasses(), wrapperClass), "aria-hidden": "true" })
1220
- ] });
1221
- }
1222
- };
1223
- var idCounter6 = 0;
1224
- function generateUniqueId6() {
1225
- return `t${(++idCounter6).toString(36)}${Math.random().toString(36).slice(2, 6)}`;
1226
- }
1227
- var defaultProps6 = {
1228
- content: [],
1229
- templateId: null,
1230
- dimensions: null,
1231
- customPadding: null,
1232
- margin: null,
1233
- visibility: null
1234
- };
1235
- var TemplateServerConfig = {
1236
- label: "Template",
1237
- fields: {
1238
- // In server config, templateId is just for reference (no loading UI)
1239
- templateId: {
1240
- type: "text",
1241
- label: "Template ID"
1242
- },
1243
- content: {
1244
- type: "slot"
1245
- }
1246
- },
1247
- defaultProps: defaultProps6,
1248
- render: ({ content: Content, dimensions, customPadding, margin, visibility }) => {
1249
- const uniqueId = generateUniqueId6();
1250
- const wrapperClass = `puck-template-${uniqueId}`;
1251
- const contentClass = `puck-template-content-${uniqueId}`;
1252
- const mediaQueries = [];
1253
- const wrapperStyles = {};
1254
- const paddingResult = responsiveValueToCSS(
1255
- customPadding,
1256
- (v) => ({ padding: paddingValueToCSS(v) }),
1257
- wrapperClass
1258
- );
1259
- Object.assign(wrapperStyles, paddingResult.baseStyles);
1260
- if (paddingResult.mediaQueryCSS) {
1261
- mediaQueries.push(paddingResult.mediaQueryCSS);
1262
- }
1263
- const marginResult = responsiveValueToCSS(
1264
- margin,
1265
- (v) => ({ margin: marginValueToCSS(v) }),
1266
- wrapperClass
1267
- );
1268
- Object.assign(wrapperStyles, marginResult.baseStyles);
1269
- if (marginResult.mediaQueryCSS) {
1270
- mediaQueries.push(marginResult.mediaQueryCSS);
1271
- }
1272
- const visibilityCSS = visibilityValueToCSS(visibility, wrapperClass);
1273
- if (visibilityCSS) {
1274
- mediaQueries.push(visibilityCSS);
1275
- }
1276
- const dimensionsResult = responsiveValueToCSS(
1277
- dimensions,
1278
- dimensionsValueToCSS,
1279
- contentClass
1280
- );
1281
- if (dimensionsResult.mediaQueryCSS) {
1282
- mediaQueries.push(dimensionsResult.mediaQueryCSS);
1283
- }
1284
- const allMediaQueryCSS = mediaQueries.join("\n");
1285
- const ContentSlot = Content;
1286
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1287
- allMediaQueryCSS && /* @__PURE__ */ jsxRuntime.jsx("style", { children: allMediaQueryCSS }),
1288
- /* @__PURE__ */ jsxRuntime.jsx(
1289
- "div",
1290
- {
1291
- className: cn("template-wrapper", wrapperClass),
1292
- style: Object.keys(wrapperStyles).length > 0 ? wrapperStyles : void 0,
1293
- children: /* @__PURE__ */ jsxRuntime.jsx(ContentSlot, { className: contentClass, style: dimensionsResult.baseStyles })
1294
- }
1295
- )
1296
- ] });
1297
- }
1298
- };
1299
- var defaultProps7 = {
1300
- text: "Heading Text",
1301
- level: "h2",
1302
- alignment: null,
1303
- textColor: null,
1304
- dimensions: null,
1305
- animation: null,
1306
- margin: null,
1307
- customPadding: null
1308
- };
1309
- var HeadingConfig = {
1310
- label: "Heading",
1311
- defaultProps: defaultProps7,
1312
- render: ({ text, level, alignment, textColor, dimensions, animation, margin, customPadding }) => {
1313
- const tag = level || "h2";
1314
- const alignmentValue = alignment ?? "left";
1315
- const classes = cn(
1316
- headingLevelMap[level] || headingLevelMap.h2,
1317
- alignmentMap[alignmentValue] || alignmentMap.left
1318
- );
1319
- const dimensionsStyles = dimensions ? dimensionsValueToCSS(dimensions) : void 0;
1320
- const style = {
1321
- ...dimensionsStyles
1322
- };
1323
- const marginCSS = marginValueToCSS(margin);
1324
- if (marginCSS) {
1325
- style.margin = marginCSS;
1326
- }
1327
- const paddingCSS = paddingValueToCSS(customPadding);
1328
- if (paddingCSS) {
1329
- style.padding = paddingCSS;
1330
- }
1331
- const colorCSS = colorValueToCSS(textColor);
1332
- if (colorCSS) {
1333
- style.color = colorCSS;
1334
- }
1335
- const headingElement = React.createElement(tag, { className: classes, style: Object.keys(style).length > 0 ? style : void 0 }, text);
1336
- return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper.AnimatedWrapper, { animation, children: headingElement });
1337
- }
1338
- };
1339
- var defaultProps8 = {
1340
- content: "Enter your text here...",
1341
- size: "base",
1342
- alignment: null,
1343
- textColor: null,
1344
- dimensions: null,
1345
- animation: null,
1346
- margin: null,
1347
- customPadding: null
1348
- };
1349
- var TextConfig = {
1350
- label: "Text",
1351
- defaultProps: defaultProps8,
1352
- render: ({ content, size, alignment, textColor, dimensions, animation, margin, customPadding }) => {
1353
- const dimensionsStyles = dimensions ? dimensionsValueToCSS(dimensions) : void 0;
1354
- const style = {
1355
- ...dimensionsStyles
1356
- };
1357
- const marginCSS = marginValueToCSS(margin);
1358
- if (marginCSS) {
1359
- style.margin = marginCSS;
1360
- }
1361
- const paddingCSS = paddingValueToCSS(customPadding);
1362
- if (paddingCSS) {
1363
- style.padding = paddingCSS;
1364
- }
1365
- const colorCSS = colorValueToCSS(textColor);
1366
- if (colorCSS) {
1367
- style.color = colorCSS;
1368
- }
1369
- const alignmentValue = alignment ?? "left";
1370
- return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper.AnimatedWrapper, { animation, children: /* @__PURE__ */ jsxRuntime.jsx(
1371
- "p",
1372
- {
1373
- className: cn(
1374
- textSizeMap[size] || textSizeMap.base,
1375
- alignmentMap[alignmentValue] || alignmentMap.left
1376
- ),
1377
- style: Object.keys(style).length > 0 ? style : void 0,
1378
- children: content
1379
- }
1380
- ) });
1381
- }
1382
- };
1383
- var DEFAULT_PADDING = {
1384
- top: 0,
1385
- right: 16,
1386
- bottom: 0,
1387
- left: 16,
1388
- unit: "px",
1389
- linked: false
1390
- };
1391
- var defaultProps9 = {
1392
- content: "<p>Enter your content here...</p>",
1393
- alignment: null,
1394
- textColor: null,
1395
- dimensions: null,
1396
- animation: null,
1397
- margin: null,
1398
- customPadding: DEFAULT_PADDING
1399
- // Default 16px horizontal padding
1400
- };
1401
- var RichTextConfig = {
1402
- label: "Rich Text",
1403
- defaultProps: defaultProps9,
1404
- render: ({ content, alignment, textColor, dimensions, animation, margin, customPadding }) => {
1405
- const dimensionsStyles = dimensions ? dimensionsValueToCSS(dimensions) : void 0;
1406
- const style = {
1407
- ...dimensionsStyles
1408
- };
1409
- const marginCSS = marginValueToCSS(margin);
1410
- if (marginCSS) {
1411
- style.margin = marginCSS;
1412
- }
1413
- const customPaddingCSS = paddingValueToCSS(customPadding);
1414
- if (customPaddingCSS) {
1415
- style.padding = customPaddingCSS;
1416
- }
1417
- const colorCSS = colorValueToCSS(textColor);
1418
- if (colorCSS) {
1419
- style.color = colorCSS;
1420
- }
1421
- const alignmentValue = alignment ?? "left";
1422
- const alignmentClass = alignmentMap[alignmentValue] || alignmentMap.left;
1423
- if (!content || content === "<p></p>") {
1424
- return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper.AnimatedWrapper, { animation, children: /* @__PURE__ */ jsxRuntime.jsx("section", { className: cn("relative overflow-hidden", alignmentClass), style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "prose dark:prose-invert max-w-none", children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: /* @__PURE__ */ jsxRuntime.jsx("em", { children: "No content available" }) }) }) }) });
1425
- }
1426
- return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper.AnimatedWrapper, { animation, children: /* @__PURE__ */ jsxRuntime.jsx("section", { className: cn("relative overflow-hidden", alignmentClass), style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsxRuntime.jsx(
1427
- "div",
1428
- {
1429
- className: "prose dark:prose-invert max-w-none",
1430
- dangerouslySetInnerHTML: { __html: content }
1431
- }
1432
- ) }) });
1433
- }
1434
- };
1435
- var DEFAULT_PADDING2 = {
1436
- top: 16,
1437
- right: 16,
1438
- bottom: 16,
1439
- left: 16,
1440
- unit: "px",
1441
- linked: true
1442
- };
1443
- var idCounter7 = 0;
1444
- function generateUniqueId7() {
1445
- return `i${(++idCounter7).toString(36)}${Math.random().toString(36).slice(2, 6)}`;
1446
- }
1447
- var defaultProps10 = {
1448
- image: null,
1449
- alt: "",
1450
- aspectRatio: "auto",
1451
- link: "",
1452
- openInNewTab: false,
1453
- margin: null,
1454
- border: null,
1455
- dimensions: null,
1456
- alignment: null,
1457
- transform: null,
1458
- animation: null,
1459
- customPadding: DEFAULT_PADDING2,
1460
- // Default 16px padding
1461
- visibility: null
1462
- };
1463
- var ImageConfig = {
1464
- label: "Image",
1465
- defaultProps: defaultProps10,
1466
- render: ({ image, alt, aspectRatio, link, openInNewTab, dimensions, alignment, margin, border, transform, animation, customPadding, visibility }) => {
1467
- const uniqueId = generateUniqueId7();
1468
- const wrapperClass = `puck-image-${uniqueId}`;
1469
- const visibilityCSS = visibilityValueToCSS(visibility, wrapperClass);
1470
- const dimensionsStyles = dimensionsValueToCSS(dimensions);
1471
- const style = {
1472
- ...dimensionsStyles
1473
- };
1474
- const marginCSS = marginValueToCSS(margin);
1475
- if (marginCSS) {
1476
- style.margin = marginCSS;
1477
- }
1478
- const paddingCSS = paddingValueToCSS(customPadding);
1479
- if (paddingCSS) {
1480
- style.padding = paddingCSS;
1481
- }
1482
- const borderStyles = borderValueToCSS(border);
1483
- if (borderStyles) {
1484
- Object.assign(style, borderStyles);
1485
- }
1486
- const transformStyles = transformValueToCSS(transform);
1487
- if (transformStyles) {
1488
- Object.assign(style, transformStyles);
1489
- }
1490
- const alignmentValue = alignment ?? "center";
1491
- const alignmentClasses = cn(
1492
- "flex",
1493
- alignmentValue === "left" && "justify-start",
1494
- alignmentValue === "center" && "justify-center",
1495
- alignmentValue === "right" && "justify-end"
1496
- );
1497
- if (!image?.url) {
1498
- return /* @__PURE__ */ jsxRuntime.jsxs(AnimatedWrapper.AnimatedWrapper, { animation, children: [
1499
- visibilityCSS && /* @__PURE__ */ jsxRuntime.jsx("style", { children: visibilityCSS }),
1500
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: wrapperClass, style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: alignmentClasses, children: /* @__PURE__ */ jsxRuntime.jsx(
1501
- "div",
1502
- {
1503
- className: cn(
1504
- "relative overflow-hidden rounded-lg w-full max-w-md bg-muted flex items-center justify-center min-h-[200px]",
1505
- aspectRatioMap[aspectRatio] || ""
1506
- ),
1507
- children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "No image selected" })
1508
- }
1509
- ) }) })
1510
- ] });
1511
- }
1512
- const imageElement = aspectRatio === "auto" ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative overflow-hidden rounded-lg w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
1513
- "img",
1514
- {
1515
- src: image.url,
1516
- alt: alt || image.alt || "",
1517
- className: "w-full h-auto object-cover"
1518
- }
1519
- ) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("relative overflow-hidden rounded-lg w-full", aspectRatioMap[aspectRatio]), children: /* @__PURE__ */ jsxRuntime.jsx(
1520
- "img",
1521
- {
1522
- src: image.url,
1523
- alt: alt || image.alt || "",
1524
- className: "absolute inset-0 w-full h-full object-cover"
1525
- }
1526
- ) });
1527
- const content = link ? /* @__PURE__ */ jsxRuntime.jsx(
1528
- "a",
1529
- {
1530
- href: link,
1531
- target: openInNewTab ? "_blank" : void 0,
1532
- rel: openInNewTab ? "noopener noreferrer" : void 0,
1533
- className: "block transition-opacity hover:opacity-90",
1534
- children: imageElement
1535
- }
1536
- ) : imageElement;
1537
- return /* @__PURE__ */ jsxRuntime.jsxs(AnimatedWrapper.AnimatedWrapper, { animation, children: [
1538
- visibilityCSS && /* @__PURE__ */ jsxRuntime.jsx("style", { children: visibilityCSS }),
1539
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: wrapperClass, style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: alignmentClasses, children: content }) })
1540
- ] });
1541
- }
1542
- };
1543
- function cn2(...inputs) {
1544
- return tailwindMerge.twMerge(clsx.clsx(inputs));
1545
- }
1546
- var buttonVariants = classVarianceAuthority.cva(
1547
- "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
1548
- {
1549
- variants: {
1550
- variant: {
1551
- default: "bg-primary text-primary-foreground hover:bg-primary/90",
1552
- destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
1553
- outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
1554
- secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
1555
- ghost: "hover:bg-accent hover:text-accent-foreground",
1556
- link: "text-primary underline-offset-4 hover:underline"
1557
- },
1558
- size: {
1559
- default: "h-10 px-4 py-2",
1560
- sm: "h-8 px-3 text-xs",
1561
- lg: "h-11 px-8",
1562
- icon: "h-10 w-10 p-2",
1563
- "icon-sm": "h-8 w-8 p-1.5"
1564
- }
1565
- },
1566
- defaultVariants: {
1567
- variant: "default",
1568
- size: "default"
1569
- }
1570
- }
1571
- );
1572
- var Button = React__namespace.forwardRef(
1573
- ({ className, variant, size, asChild = false, ...props }, ref) => {
1574
- const Comp = asChild ? reactSlot.Slot : "button";
1575
- return /* @__PURE__ */ jsxRuntime.jsx(
1576
- Comp,
1577
- {
1578
- className: cn2(buttonVariants({ variant, size, className })),
1579
- ref,
1580
- ...props
1581
- }
1582
- );
1583
- }
1584
- );
1585
- Button.displayName = "Button";
1586
- var Input = React__namespace.forwardRef(
1587
- ({ className, type, ...props }, ref) => {
1588
- return /* @__PURE__ */ jsxRuntime.jsx(
1589
- "input",
1590
- {
1591
- type,
1592
- className: cn2(
1593
- "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
1594
- className
1595
- ),
1596
- ref,
1597
- ...props
1598
- }
1599
- );
1600
- }
1601
- );
1602
- Input.displayName = "Input";
1603
- var labelVariants = classVarianceAuthority.cva(
1604
- "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
1605
- );
1606
- var Label = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1607
- LabelPrimitive__namespace.Root,
1608
- {
1609
- ref,
1610
- className: cn2(labelVariants(), className),
1611
- ...props
1612
- }
1613
- ));
1614
- Label.displayName = LabelPrimitive__namespace.Root.displayName;
1615
- var DEFAULT_VALUE = {
1616
- mode: "default"
1617
- };
1618
- var CUSTOM_DEFAULTS = {
1619
- height: 40,
1620
- paddingX: 16,
1621
- paddingY: 8,
1622
- fontSize: 14,
1623
- unit: "px"
1624
- };
1625
- function SizeFieldInner({
1626
- value,
1627
- onChange,
1628
- label = "Size",
1629
- readOnly,
1630
- showHeight = true,
1631
- showFontSize = true
1632
- }) {
1633
- const currentValue = value || DEFAULT_VALUE;
1634
- const handleModeChange = React.useCallback((mode) => {
1635
- if (mode === "custom") {
1636
- onChange({
1637
- mode,
1638
- ...CUSTOM_DEFAULTS
1639
- });
1640
- } else {
1641
- onChange({ mode });
1642
- }
1643
- }, [onChange]);
1644
- const handleValueChange = React.useCallback((field, val) => {
1645
- onChange({
1646
- ...currentValue,
1647
- [field]: val
1648
- });
1649
- }, [currentValue, onChange]);
1650
- const handleUnitChange = React.useCallback((unit) => {
1651
- onChange({
1652
- ...currentValue,
1653
- unit
1654
- });
1655
- }, [currentValue, onChange]);
1656
- const handleClear = React.useCallback(() => {
1657
- onChange(null);
1658
- }, [onChange]);
1659
- const presets = [
1660
- { mode: "sm", label: "SM" },
1661
- { mode: "default", label: "Default" },
1662
- { mode: "lg", label: "LG" },
1663
- { mode: "custom", label: "Custom" }
1664
- ];
1665
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "puck-field space-y-3", children: [
1666
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
1667
- /* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-sm font-medium text-foreground", children: label }),
1668
- value && !readOnly && /* @__PURE__ */ jsxRuntime.jsx(
1669
- Button,
1670
- {
1671
- type: "button",
1672
- variant: "ghost",
1673
- size: "icon-sm",
1674
- onClick: handleClear,
1675
- className: "text-muted-foreground hover:text-destructive",
1676
- title: "Reset to default",
1677
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" })
1678
- }
1679
- )
1680
- ] }),
1681
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-1", children: presets.map(({ mode, label: modeLabel }) => {
1682
- const isActive = currentValue.mode === mode;
1683
- return /* @__PURE__ */ jsxRuntime.jsx(
1684
- Button,
1685
- {
1686
- type: "button",
1687
- variant: isActive ? "default" : "secondary",
1688
- size: "sm",
1689
- onClick: () => handleModeChange(mode),
1690
- disabled: readOnly,
1691
- className: cn2(
1692
- "text-xs",
1693
- isActive && "bg-primary hover:bg-primary/90"
1694
- ),
1695
- children: modeLabel
1696
- },
1697
- mode
1698
- );
1699
- }) }),
1700
- currentValue.mode === "custom" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3 p-3 bg-muted/50 rounded-md", children: [
1701
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
1702
- /* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-[10px] uppercase tracking-wide text-muted-foreground flex-shrink-0", children: "Unit:" }),
1703
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-1", children: ["px", "rem"].map((unit) => {
1704
- const isActive = (currentValue.unit || "px") === unit;
1705
- return /* @__PURE__ */ jsxRuntime.jsx(
1706
- Button,
1707
- {
1708
- type: "button",
1709
- variant: isActive ? "default" : "outline",
1710
- size: "sm",
1711
- onClick: () => handleUnitChange(unit),
1712
- disabled: readOnly,
1713
- className: cn2(
1714
- "text-xs font-mono h-7 px-2",
1715
- isActive && "bg-primary hover:bg-primary/90"
1716
- ),
1717
- children: unit
1718
- },
1719
- unit
1720
- );
1721
- }) })
1722
- ] }),
1723
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-2", children: [
1724
- showHeight && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
1725
- /* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-[10px] uppercase tracking-wide text-muted-foreground", children: "Height" }),
1726
- /* @__PURE__ */ jsxRuntime.jsx(
1727
- Input,
1728
- {
1729
- type: "number",
1730
- min: 0,
1731
- value: currentValue.height ?? CUSTOM_DEFAULTS.height,
1732
- onChange: (e) => handleValueChange("height", parseInt(e.target.value, 10) || 0),
1733
- disabled: readOnly,
1734
- className: "h-8 text-sm font-mono"
1735
- }
1736
- )
1737
- ] }),
1738
- showFontSize && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
1739
- /* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-[10px] uppercase tracking-wide text-muted-foreground", children: "Font Size" }),
1740
- /* @__PURE__ */ jsxRuntime.jsx(
1741
- Input,
1742
- {
1743
- type: "number",
1744
- min: 0,
1745
- value: currentValue.fontSize ?? CUSTOM_DEFAULTS.fontSize,
1746
- onChange: (e) => handleValueChange("fontSize", parseInt(e.target.value, 10) || 0),
1747
- disabled: readOnly,
1748
- className: "h-8 text-sm font-mono"
1749
- }
1750
- )
1751
- ] }),
1752
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
1753
- /* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-[10px] uppercase tracking-wide text-muted-foreground", children: "Padding X" }),
1754
- /* @__PURE__ */ jsxRuntime.jsx(
1755
- Input,
1756
- {
1757
- type: "number",
1758
- min: 0,
1759
- value: currentValue.paddingX ?? CUSTOM_DEFAULTS.paddingX,
1760
- onChange: (e) => handleValueChange("paddingX", parseInt(e.target.value, 10) || 0),
1761
- disabled: readOnly,
1762
- className: "h-8 text-sm font-mono"
1763
- }
1764
- )
1765
- ] }),
1766
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
1767
- /* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-[10px] uppercase tracking-wide text-muted-foreground", children: "Padding Y" }),
1768
- /* @__PURE__ */ jsxRuntime.jsx(
1769
- Input,
1770
- {
1771
- type: "number",
1772
- min: 0,
1773
- value: currentValue.paddingY ?? CUSTOM_DEFAULTS.paddingY,
1774
- onChange: (e) => handleValueChange("paddingY", parseInt(e.target.value, 10) || 0),
1775
- disabled: readOnly,
1776
- className: "h-8 text-sm font-mono"
1777
- }
1778
- )
1779
- ] })
1780
- ] }),
1781
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-xs text-muted-foreground font-mono pt-1 border-t border-border/50", children: [
1782
- showHeight && `h: ${currentValue.height ?? CUSTOM_DEFAULTS.height}${currentValue.unit || "px"}`,
1783
- showHeight && " | ",
1784
- `p: ${currentValue.paddingY ?? CUSTOM_DEFAULTS.paddingY}${currentValue.unit || "px"} ${currentValue.paddingX ?? CUSTOM_DEFAULTS.paddingX}${currentValue.unit || "px"}`,
1785
- showFontSize && ` | font: ${currentValue.fontSize ?? CUSTOM_DEFAULTS.fontSize}${currentValue.unit || "px"}`
1786
- ] })
1787
- ] })
1788
- ] });
1789
- }
1790
- React.memo(SizeFieldInner);
1791
- function sizeValueToCSS(size) {
1792
- if (!size || size.mode !== "custom") return void 0;
1793
- const unit = size.unit || "px";
1794
- const style = {};
1795
- if (size.height != null) {
1796
- style.height = `${size.height}${unit}`;
1797
- }
1798
- if (size.paddingX != null || size.paddingY != null) {
1799
- const py = size.paddingY ?? 0;
1800
- const px = size.paddingX ?? 0;
1801
- style.padding = `${py}${unit} ${px}${unit}`;
1802
- }
1803
- if (size.fontSize != null) {
1804
- style.fontSize = `${size.fontSize}${unit}`;
1805
- }
1806
- return Object.keys(style).length > 0 ? style : void 0;
1807
- }
1808
- function getSizeClasses(size, sizeMap) {
1809
- if (!size) return sizeMap.default || "";
1810
- if (size.mode === "custom") return "";
1811
- return sizeMap[size.mode] || sizeMap.default || "";
1812
- }
1813
-
1814
- // src/theme/defaults.ts
1815
- var DEFAULT_BUTTON_VARIANTS = {
1816
- default: { classes: "bg-primary text-primary-foreground hover:bg-primary/90" },
1817
- secondary: { classes: "bg-secondary text-secondary-foreground hover:bg-secondary/80" },
1818
- outline: { classes: "border border-input bg-background hover:bg-accent hover:text-accent-foreground" },
1819
- ghost: { classes: "bg-transparent hover:bg-accent hover:text-accent-foreground" },
1820
- destructive: { classes: "bg-destructive text-destructive-foreground hover:bg-destructive/90" },
1821
- link: { classes: "text-primary underline-offset-4 hover:underline bg-transparent" }
1822
- };
1823
- var DEFAULT_FOCUS_RING = "focus:ring-ring";
1824
-
1825
- // src/theme/utils.ts
1826
- function getVariantClasses(variants, variant, fallback = "default") {
1827
- const config = variants[variant];
1828
- if (config?.classes) {
1829
- return config.classes;
1830
- }
1831
- const fallbackConfig = variants[fallback];
1832
- return fallbackConfig?.classes ?? "";
1833
- }
1834
- var sizeStyles = {
1835
- sm: "h-8 px-3 text-sm",
1836
- default: "h-10 px-4",
1837
- lg: "h-12 px-8 text-lg"
1838
- };
1839
- var alignmentWrapperMap = {
1840
- left: "text-left",
1841
- center: "text-center",
1842
- right: "text-right"
1843
- };
1844
- var defaultProps11 = {
1845
- text: "Click Me",
1846
- link: "",
1847
- variant: "default",
1848
- size: null,
1849
- openInNewTab: "no",
1850
- margin: null,
1851
- customBackgroundColor: null,
1852
- customTextColor: null,
1853
- customBorder: null,
1854
- alignment: null,
1855
- transform: null,
1856
- animation: null,
1857
- customPadding: null
1858
- };
1859
- var ButtonConfig = {
1860
- label: "Button",
1861
- defaultProps: defaultProps11,
1862
- render: ({ text, link, variant, size, openInNewTab, alignment, margin, customBackgroundColor, customTextColor, customBorder, transform, animation, customPadding }) => {
1863
- const hasCustomBackground = customBackgroundColor?.hex;
1864
- const hasCustomTextColor = customTextColor?.hex;
1865
- const hasCustomPadding = customPadding;
1866
- const hasCustomSize = size?.mode === "custom";
1867
- const variantClasses = getVariantClasses(DEFAULT_BUTTON_VARIANTS, variant, "default");
1868
- const sizeClasses = getSizeClasses(size, sizeStyles);
1869
- const buttonClasses = cn(
1870
- "inline-flex items-center justify-center font-medium transition-colors",
1871
- `focus:outline-none focus:ring-2 focus:ring-offset-2 ${DEFAULT_FOCUS_RING}`,
1872
- "disabled:opacity-50 disabled:pointer-events-none",
1873
- // Only apply variant styles if no custom background/text color
1874
- !hasCustomBackground && !hasCustomTextColor && variantClasses,
1875
- // Only apply background portion of variant if no custom background
1876
- hasCustomBackground && !hasCustomTextColor && "hover:opacity-90",
1877
- // Only apply size classes if not using custom size or custom padding
1878
- !hasCustomPadding && !hasCustomSize && sizeClasses,
1879
- // Apply rounded-md unless custom border has radius
1880
- !customBorder?.radius && "rounded-md"
1881
- );
1882
- const buttonStyle = {};
1883
- if (hasCustomBackground) {
1884
- buttonStyle.backgroundColor = colorValueToCSS(customBackgroundColor);
1885
- }
1886
- if (hasCustomTextColor) {
1887
- buttonStyle.color = colorValueToCSS(customTextColor);
1888
- }
1889
- const borderStyles = borderValueToCSS(customBorder);
1890
- if (borderStyles) {
1891
- Object.assign(buttonStyle, borderStyles);
1892
- }
1893
- const customSizeStyles = sizeValueToCSS(size);
1894
- if (customSizeStyles) {
1895
- Object.assign(buttonStyle, customSizeStyles);
1896
- }
1897
- const paddingCSS = paddingValueToCSS(customPadding);
1898
- if (paddingCSS) {
1899
- buttonStyle.padding = paddingCSS;
1900
- }
1901
- const transformStyles = transformValueToCSS(transform);
1902
- if (transformStyles) {
1903
- Object.assign(buttonStyle, transformStyles);
1904
- }
1905
- const buttonElement = link ? /* @__PURE__ */ jsxRuntime.jsx(
1906
- "a",
1907
- {
1908
- href: link,
1909
- target: openInNewTab === "yes" ? "_blank" : void 0,
1910
- rel: openInNewTab === "yes" ? "noopener noreferrer" : void 0,
1911
- className: buttonClasses,
1912
- style: buttonStyle,
1913
- children: text
1914
- }
1915
- ) : /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: buttonClasses, style: buttonStyle, children: text });
1916
- const wrapperStyle = {};
1917
- const marginCSS = marginValueToCSS(margin);
1918
- if (marginCSS) {
1919
- wrapperStyle.margin = marginCSS;
1920
- }
1921
- const alignmentValue = alignment ?? "left";
1922
- return /* @__PURE__ */ jsxRuntime.jsx(
1923
- AnimatedWrapper.AnimatedWrapper,
1924
- {
1925
- animation,
1926
- className: alignmentWrapperMap[alignmentValue] || alignmentWrapperMap.left,
1927
- style: wrapperStyle,
1928
- children: buttonElement
1929
- }
1930
- );
1931
- }
1932
- };
1933
- var DEFAULT_CONTENT_PADDING2 = {
1934
- top: 16,
1935
- right: 16,
1936
- bottom: 16,
1937
- left: 16,
1938
- unit: "px",
1939
- linked: true
1940
- };
1941
- var defaultProps12 = {
1942
- image: null,
1943
- heading: "Card Heading",
1944
- text: "Card description text goes here.",
1945
- link: "",
1946
- openInNewTab: false,
1947
- shadow: "md",
1948
- margin: null,
1949
- background: null,
1950
- border: null,
1951
- dimensions: null,
1952
- alignment: null,
1953
- transform: null,
1954
- animation: null,
1955
- contentPadding: DEFAULT_CONTENT_PADDING2
1956
- // Default 16px padding
1957
- };
1958
- var CardConfig = {
1959
- label: "Card",
1960
- defaultProps: defaultProps12,
1961
- render: ({ image, heading, text, link, openInNewTab, shadow, background, dimensions, alignment, margin, border, transform, animation, contentPadding }) => {
1962
- const hasBorderRadius = border?.radius && border.radius > 0;
1963
- const cardClasses = cn(
1964
- "overflow-hidden transition-all bg-card",
1965
- !hasBorderRadius && "rounded-lg",
1966
- shadowMap[shadow] || "",
1967
- link && "hover:shadow-lg cursor-pointer"
1968
- );
1969
- const wrapperStyle = {};
1970
- const marginCSS = marginValueToCSS(margin);
1971
- if (marginCSS) {
1972
- wrapperStyle.margin = marginCSS;
1973
- }
1974
- const dimensionsStyles = dimensionsValueToCSS(dimensions);
1975
- if (dimensionsStyles) {
1976
- Object.assign(wrapperStyle, dimensionsStyles);
1977
- }
1978
- const transformStyles = transformValueToCSS(transform);
1979
- if (transformStyles) {
1980
- Object.assign(wrapperStyle, transformStyles);
1981
- }
1982
- const alignmentValue = alignment ?? "left";
1983
- const alignmentClasses = cn(
1984
- "flex",
1985
- alignmentValue === "left" && "justify-start",
1986
- alignmentValue === "center" && "justify-center",
1987
- alignmentValue === "right" && "justify-end"
1988
- );
1989
- const backgroundStyles = backgroundValueToCSS(background);
1990
- const cardStyle = {
1991
- ...backgroundStyles
1992
- };
1993
- const borderStyles = borderValueToCSS(border);
1994
- if (borderStyles) {
1995
- Object.assign(cardStyle, borderStyles);
1996
- }
1997
- const contentStyle = {};
1998
- const contentPaddingCSS = paddingValueToCSS(contentPadding);
1999
- if (contentPaddingCSS) {
2000
- contentStyle.padding = contentPaddingCSS;
2001
- }
2002
- const cardContent = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cardClasses, style: cardStyle, children: [
2003
- image?.url ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative aspect-video w-full overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
2004
- "img",
2005
- {
2006
- src: image.url,
2007
- alt: image.alt || heading || "",
2008
- className: "w-full h-full object-cover"
2009
- }
2010
- ) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "aspect-video w-full bg-muted flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "No image" }) }),
2011
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle, children: [
2012
- heading && /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-lg font-semibold text-foreground mb-2", children: heading }),
2013
- text && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: text })
2014
- ] })
2015
- ] });
2016
- if (link) {
2017
- return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper.AnimatedWrapper, { animation, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: alignmentClasses, children: /* @__PURE__ */ jsxRuntime.jsx(
2018
- "a",
2019
- {
2020
- href: link,
2021
- target: openInNewTab ? "_blank" : void 0,
2022
- rel: openInNewTab ? "noopener noreferrer" : void 0,
2023
- className: "block",
2024
- style: wrapperStyle,
2025
- children: cardContent
2026
- }
2027
- ) }) });
2028
- }
2029
- return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper.AnimatedWrapper, { animation, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: alignmentClasses, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: wrapperStyle, children: cardContent }) }) });
2030
- }
2031
- };
2032
- var DEFAULT_PADDING3 = {
2033
- top: 0,
2034
- right: 16,
2035
- bottom: 0,
2036
- left: 16,
2037
- unit: "px",
2038
- linked: false
2039
- };
2040
- var defaultProps13 = {
2041
- style: "solid",
2042
- color: null,
2043
- margin: null,
2044
- dimensions: null,
2045
- transform: null,
2046
- animation: null,
2047
- customPadding: DEFAULT_PADDING3
2048
- // Default 16px horizontal padding
2049
- };
2050
- var DividerConfig = {
2051
- label: "Divider",
2052
- defaultProps: defaultProps13,
2053
- render: ({ style, color, dimensions, margin, transform, animation, customPadding }) => {
2054
- const dimensionsStyles = dimensionsValueToCSS(dimensions);
2055
- const wrapperStyle = {
2056
- ...dimensionsStyles
2057
- };
2058
- const marginCSS = marginValueToCSS(margin);
2059
- if (marginCSS) {
2060
- wrapperStyle.margin = marginCSS;
2061
- }
2062
- const paddingCSS = paddingValueToCSS(customPadding);
2063
- if (paddingCSS) {
2064
- wrapperStyle.padding = paddingCSS;
2065
- }
2066
- const transformStyles = transformValueToCSS(transform);
2067
- if (transformStyles) {
2068
- Object.assign(wrapperStyle, transformStyles);
2069
- }
2070
- const customColor = colorValueToCSS(color);
2071
- const hrStyle = customColor ? { borderColor: customColor } : void 0;
2072
- return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper.AnimatedWrapper, { animation, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: Object.keys(wrapperStyle).length > 0 ? wrapperStyle : void 0, children: /* @__PURE__ */ jsxRuntime.jsx(
2073
- "hr",
2074
- {
2075
- className: cn(
2076
- "border-t border-border",
2077
- dividerStyleMap[style] || dividerStyleMap.solid
2078
- ),
2079
- style: hrStyle
2080
- }
2081
- ) }) });
2082
- }
2083
- };
2084
- var defaultProps14 = {
2085
- items: [
2086
- {
2087
- title: "What is this?",
2088
- content: "This is an accordion component that can expand and collapse.",
2089
- defaultOpen: false
2090
- },
2091
- {
2092
- title: "How do I use it?",
2093
- content: "Click on each item to expand or collapse it.",
2094
- defaultOpen: false
2095
- }
2096
- ],
2097
- allowMultiple: false,
2098
- textColor: null,
2099
- margin: null,
2100
- background: null,
2101
- dimensions: null,
2102
- transform: null,
2103
- animation: null,
2104
- customPadding: null
2105
- };
2106
- var AccordionConfig = {
2107
- label: "Accordion",
2108
- defaultProps: defaultProps14,
2109
- render: (props) => /* @__PURE__ */ jsxRuntime.jsx(
2110
- AccordionClient.AccordionClient,
2111
- {
2112
- items: props.items,
2113
- allowMultiple: props.allowMultiple,
2114
- textColor: props.textColor,
2115
- margin: props.margin,
2116
- background: props.background,
2117
- dimensions: props.dimensions,
2118
- transform: props.transform,
2119
- animation: props.animation,
2120
- customPadding: props.customPadding
2121
- }
2122
- )
2123
- };
2124
- function createConfig(layouts = DEFAULT_LAYOUTS) {
2125
- const layoutOptions = layoutsToOptions(layouts);
2126
- return {
2127
- root: {
2128
- fields: {
2129
- title: {
2130
- type: "text",
2131
- label: "Page Title"
2132
- },
2133
- pageLayout: {
2134
- type: "select",
2135
- label: "Page Layout",
2136
- options: layoutOptions.map(({ value, label }) => ({ value, label }))
2137
- }
2138
- },
2139
- defaultProps: {
2140
- title: "New Page",
2141
- pageLayout: "default"
2142
- },
2143
- render: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children })
2144
- },
2145
- categories: {
2146
- layout: {
2147
- title: "Layout",
2148
- components: ["Container", "Flex", "Grid", "Section", "Spacer", "Template"],
2149
- defaultExpanded: true
2150
- },
2151
- typography: {
2152
- title: "Typography",
2153
- components: ["Heading", "Text", "RichText"]
2154
- },
2155
- media: {
2156
- title: "Media",
2157
- components: ["Image"]
2158
- },
2159
- interactive: {
2160
- title: "Interactive",
2161
- components: ["Button", "Card", "Divider", "Accordion"]
2162
- }
2163
- },
2164
- components: {
2165
- // Layout
2166
- Container: ContainerConfig,
2167
- Flex: FlexConfig,
2168
- Grid: GridConfig,
2169
- Section: SectionConfig,
2170
- Spacer: SpacerConfig,
2171
- Template: TemplateServerConfig,
2172
- // Typography
2173
- Heading: HeadingConfig,
2174
- Text: TextConfig,
2175
- RichText: RichTextConfig,
2176
- // Media
2177
- Image: ImageConfig,
2178
- // Interactive
2179
- Button: ButtonConfig,
2180
- Card: CardConfig,
2181
- Divider: DividerConfig,
2182
- Accordion: AccordionConfig
2183
- }
2184
- };
2185
- }
2186
- var baseConfig = createConfig(DEFAULT_LAYOUTS);
2187
- function PageRenderer({
2188
- data,
2189
- config = baseConfig,
2190
- wrapper: Wrapper,
2191
- className,
2192
- layouts = DEFAULT_LAYOUTS
2193
- }) {
2194
- if (!data || !data.content) {
2195
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className, children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: "No content available" }) });
2196
- }
2197
- const content = /* @__PURE__ */ jsxRuntime.jsx(puck.Render, { config, data });
2198
- const rootProps = data.root?.props;
2199
- const overrides = {
2200
- showHeader: rootProps?.showHeader,
2201
- showFooter: rootProps?.showFooter,
2202
- background: rootProps?.pageBackground,
2203
- maxWidth: rootProps?.pageMaxWidth
2204
- };
2205
- let result = content;
2206
- if (Wrapper) {
2207
- result = /* @__PURE__ */ jsxRuntime.jsx(Wrapper, { children: result });
2208
- } else {
2209
- const pageLayout = rootProps?.pageLayout;
2210
- const layout = pageLayout ? getLayout(layouts, pageLayout) : void 0;
2211
- if (layout) {
2212
- result = /* @__PURE__ */ jsxRuntime.jsx(LayoutWrapper, { layout, className, overrides, children: result });
2213
- } else if (className || overrides.background) {
2214
- result = /* @__PURE__ */ jsxRuntime.jsx(LayoutWrapper, { className, overrides, children: result });
2215
- }
2216
- }
2217
- return result;
2218
- }
2219
- function HybridPageRenderer({
2220
- page,
2221
- legacyRenderer,
2222
- legacyBlocksField = "layout",
2223
- fallback = /* @__PURE__ */ jsxRuntime.jsx("div", { children: "No content available" }),
2224
- config,
2225
- layouts,
2226
- wrapper,
2227
- className
2228
- }) {
2229
- const puckData = page.puckData;
2230
- const hasPuckContent = puckData?.content && Array.isArray(puckData.content) && puckData.content.length > 0;
2231
- const legacyBlocks = page[legacyBlocksField];
2232
- const hasLegacyContent = Array.isArray(legacyBlocks) && legacyBlocks.length > 0;
2233
- if (page.editorVersion === "puck" && hasPuckContent) {
2234
- return /* @__PURE__ */ jsxRuntime.jsx(
2235
- PageRenderer,
2236
- {
2237
- data: puckData,
2238
- config,
2239
- layouts,
2240
- wrapper,
2241
- className
2242
- }
2243
- );
2244
- }
2245
- if (hasLegacyContent) {
2246
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: legacyRenderer(legacyBlocks) });
2247
- }
2248
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: fallback });
2249
- }
2250
-
2251
- exports.HybridPageRenderer = HybridPageRenderer;
2252
- exports.PageRenderer = PageRenderer;
2253
- //# sourceMappingURL=index.js.map
1
+ /**
2
+ * Rendering components for Puck pages
3
+ *
4
+ * This module only exports server-safe components.
5
+ * For the client-side editor, use '@delmaredigital/payload-puck/editor'
6
+ */
7
+ export { PageRenderer } from './PageRenderer';
8
+ export { HybridPageRenderer } from './HybridPageRenderer';
9
+ // Note: PuckEditor has been moved to '@delmaredigital/payload-puck/editor'
10
+ // to avoid RSC import issues with the client-only Puck component
2254
11
  //# sourceMappingURL=index.js.map