@delmaredigital/payload-puck 0.1.3 → 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 +293 -1237
  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 -219
  67. package/dist/components/index.d.ts.map +1 -0
  68. package/dist/components/index.js +15 -9155
  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 -9364
  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 -2028
  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 -4533
  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 -7685
  377. package/dist/fields/index.js.map +1 -0
  378. package/dist/fields/richtext-output.css +219 -0
  379. package/dist/{shared-DeNKN95N.d.mts → fields/shared.d.ts} +114 -133
  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 -2162
  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 +50 -72
  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 -222
  525. package/dist/components/index.mjs +0 -9109
  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 -9347
  529. package/dist/config/index.d.mts +0 -68
  530. package/dist/config/index.mjs +0 -2008
  531. package/dist/editor/index.d.mts +0 -784
  532. package/dist/editor/index.mjs +0 -4500
  533. package/dist/fields/index.d.mts +0 -600
  534. package/dist/fields/index.mjs +0 -7569
  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 -2140
  544. package/dist/shared-DeNKN95N.d.ts +0 -546
  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,2163 +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 mediaQueries = [];
511
- let baseStyles = {};
512
- BREAKPOINTS.forEach((bp) => {
513
- const bpValue = value[bp.key];
514
- if (bpValue === void 0) return;
515
- const cssProps = converter(bpValue);
516
- if (!cssProps) return;
517
- if (bp.key === "xs") {
518
- baseStyles = cssProps;
519
- } else {
520
- const styleString = cssPropertiesToString(cssProps);
521
- if (styleString) {
522
- mediaQueries.push(
523
- `@media (min-width: ${bp.minWidth}px) { .${uniqueId} { ${styleString} } }`
524
- );
525
- }
526
- }
527
- });
528
- return { baseStyles, mediaQueryCSS: mediaQueries.join("\n") };
529
- }
530
- function visibilityValueToCSS(visibility, uniqueId) {
531
- if (!visibility) return "";
532
- const mediaQueries = [];
533
- const breakpointWidths = {
534
- xs: null,
535
- // 0px
536
- sm: 640,
537
- md: 768,
538
- lg: 1024,
539
- xl: 1280
540
- };
541
- const getNextBreakpointWidth = (bp) => {
542
- const order = ["xs", "sm", "md", "lg", "xl"];
543
- const index = order.indexOf(bp);
544
- if (index === -1 || index === order.length - 1) return null;
545
- return breakpointWidths[order[index + 1]];
546
- };
547
- if (visibility.xs === false) {
548
- const nextWidth = getNextBreakpointWidth("xs");
549
- if (nextWidth) {
550
- mediaQueries.push(`@media (max-width: ${nextWidth - 1}px) { .${uniqueId} { display: none; } }`);
551
- } else {
552
- mediaQueries.push(`.${uniqueId} { display: none; }`);
553
- }
554
- }
555
- BREAKPOINTS.slice(1).forEach((bp) => {
556
- if (visibility[bp.key] === false) {
557
- const minWidth = breakpointWidths[bp.key];
558
- const maxWidth = getNextBreakpointWidth(bp.key);
559
- if (minWidth && maxWidth) {
560
- mediaQueries.push(
561
- `@media (min-width: ${minWidth}px) and (max-width: ${maxWidth - 1}px) { .${uniqueId} { display: none; } }`
562
- );
563
- } else if (minWidth) {
564
- mediaQueries.push(
565
- `@media (min-width: ${minWidth}px) { .${uniqueId} { display: none; } }`
566
- );
567
- }
568
- }
569
- });
570
- return mediaQueries.join("\n");
571
- }
572
- var stickyFooterContainerStyle = {
573
- minHeight: "100vh",
574
- display: "flex",
575
- flexDirection: "column"
576
- };
577
- var stickyFooterMainStyle = {
578
- flex: 1
579
- };
580
- function LayoutWrapper({ children, layout, className, overrides }) {
581
- if (!layout) {
582
- if (overrides?.background) {
583
- const bgStyles = backgroundValueToCSS(overrides.background);
584
- return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { minHeight: "100vh", ...bgStyles }, children });
585
- }
586
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
587
- }
588
- const Header = layout.header;
589
- const Footer = layout.footer;
590
- const shouldShowHeader = overrides?.showHeader === "hide" ? false : overrides?.showHeader === "show" ? true : !!Header;
591
- const shouldShowFooter = overrides?.showFooter === "hide" ? false : overrides?.showFooter === "show" ? true : !!Footer;
592
- const useStickyFooter = layout.stickyFooter !== false;
593
- const mainStyle = {
594
- ...layout.stickyHeaderHeight && shouldShowHeader ? { paddingTop: layout.stickyHeaderHeight } : {},
595
- ...useStickyFooter ? stickyFooterMainStyle : {}
596
- };
597
- const outerBackgroundStyles = overrides?.background ? backgroundValueToCSS(overrides.background) : {
598
- ...layout.styles?.wrapper?.background !== void 0 ? { background: layout.styles.wrapper.background } : {},
599
- ...layout.styles?.wrapper?.backgroundAttachment !== void 0 ? { backgroundAttachment: layout.styles.wrapper.backgroundAttachment } : {}
600
- };
601
- const effectiveMaxWidth = overrides?.maxWidth && overrides.maxWidth !== "default" ? overrides.maxWidth : layout.maxWidth;
602
- const wrapWithStickyFooter = (content) => {
603
- if (useStickyFooter) {
604
- return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { ...stickyFooterContainerStyle, ...outerBackgroundStyles }, children: content });
605
- }
606
- const hasBackground = Object.keys(outerBackgroundStyles).length > 0;
607
- if (hasBackground) {
608
- return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { minHeight: "100vh", ...outerBackgroundStyles }, children: content });
609
- }
610
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: content });
611
- };
612
- if (layout.wrapper) {
613
- const CustomWrapper = layout.wrapper;
614
- return wrapWithStickyFooter(
615
- /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
616
- shouldShowHeader && Header && /* @__PURE__ */ jsxRuntime.jsx(Header, {}),
617
- /* @__PURE__ */ jsxRuntime.jsx("main", { style: Object.keys(mainStyle).length > 0 ? mainStyle : void 0, children: /* @__PURE__ */ jsxRuntime.jsx(CustomWrapper, { children }) }),
618
- shouldShowFooter && Footer && /* @__PURE__ */ jsxRuntime.jsx(Footer, {})
619
- ] })
620
- );
621
- }
622
- const wrapperStyle = {
623
- ...layout.styles?.wrapper
624
- };
625
- const containerStyle = {
626
- ...effectiveMaxWidth && !layout.fullWidth ? { maxWidth: effectiveMaxWidth } : {},
627
- ...layout.styles?.container
628
- };
629
- const contentStyle = {
630
- ...layout.styles?.content
631
- };
632
- const dataAttrs = {
633
- "data-layout": layout.value,
634
- ...layout.dataAttributes
635
- };
636
- if (layout.fullWidth) {
637
- return wrapWithStickyFooter(
638
- /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
639
- shouldShowHeader && Header && /* @__PURE__ */ jsxRuntime.jsx(Header, {}),
640
- /* @__PURE__ */ jsxRuntime.jsx(
641
- "main",
642
- {
643
- className: [layout.classes?.wrapper, className].filter(Boolean).join(" ") || void 0,
644
- style: {
645
- ...mainStyle,
646
- ...Object.keys(wrapperStyle).length > 0 ? wrapperStyle : {}
647
- },
648
- ...dataAttrs,
649
- children
650
- }
651
- ),
652
- shouldShowFooter && Footer && /* @__PURE__ */ jsxRuntime.jsx(Footer, {})
653
- ] })
654
- );
655
- }
656
- return wrapWithStickyFooter(
657
- /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
658
- shouldShowHeader && Header && /* @__PURE__ */ jsxRuntime.jsx(Header, {}),
659
- /* @__PURE__ */ jsxRuntime.jsx(
660
- "main",
661
- {
662
- className: layout.classes?.wrapper || void 0,
663
- style: {
664
- ...mainStyle,
665
- ...Object.keys(wrapperStyle).length > 0 ? wrapperStyle : {}
666
- },
667
- ...dataAttrs,
668
- children: /* @__PURE__ */ jsxRuntime.jsx(
669
- "div",
670
- {
671
- className: [layout.classes?.container, className].filter(Boolean).join(" ") || void 0,
672
- style: Object.keys(containerStyle).length > 0 ? containerStyle : void 0,
673
- children: /* @__PURE__ */ jsxRuntime.jsx(
674
- "div",
675
- {
676
- className: layout.classes?.content || void 0,
677
- style: Object.keys(contentStyle).length > 0 ? contentStyle : void 0,
678
- children
679
- }
680
- )
681
- }
682
- )
683
- }
684
- ),
685
- shouldShowFooter && Footer && /* @__PURE__ */ jsxRuntime.jsx(Footer, {})
686
- ] })
687
- );
688
- }
689
- var idCounter = 0;
690
- function generateUniqueId() {
691
- return `c${(++idCounter).toString(36)}${Math.random().toString(36).slice(2, 6)}`;
692
- }
693
- var defaultProps = {
694
- content: [],
695
- background: null,
696
- customPadding: null,
697
- dimensions: null,
698
- border: null,
699
- margin: null,
700
- animation: null,
701
- innerBackground: null,
702
- innerPadding: null,
703
- innerBorder: null,
704
- visibility: null
705
- };
706
- var ContainerConfig = {
707
- label: "Container",
708
- fields: {
709
- content: { type: "slot" }
710
- },
711
- defaultProps,
712
- render: ({
713
- content: Content,
714
- background,
715
- customPadding,
716
- dimensions,
717
- border,
718
- margin,
719
- animation,
720
- innerBackground,
721
- innerPadding,
722
- innerBorder,
723
- visibility
724
- }) => {
725
- const uniqueId = generateUniqueId();
726
- const outerClass = `puck-container-outer-${uniqueId}`;
727
- const innerClass = `puck-container-inner-${uniqueId}`;
728
- const mediaQueries = [];
729
- const outerBackgroundStyles = backgroundValueToCSS(background);
730
- const outerStyles = {
731
- ...outerBackgroundStyles
732
- };
733
- const outerPaddingResult = responsiveValueToCSS(
734
- customPadding,
735
- (v) => ({ padding: paddingValueToCSS(v) }),
736
- outerClass
737
- );
738
- Object.assign(outerStyles, outerPaddingResult.baseStyles);
739
- if (outerPaddingResult.mediaQueryCSS) {
740
- mediaQueries.push(outerPaddingResult.mediaQueryCSS);
741
- }
742
- const outerBorderStyles = borderValueToCSS(border);
743
- if (outerBorderStyles) {
744
- Object.assign(outerStyles, outerBorderStyles);
745
- }
746
- const marginResult = responsiveValueToCSS(
747
- margin,
748
- (v) => ({ margin: marginValueToCSS(v) }),
749
- outerClass
750
- );
751
- Object.assign(outerStyles, marginResult.baseStyles);
752
- if (marginResult.mediaQueryCSS) {
753
- mediaQueries.push(marginResult.mediaQueryCSS);
754
- }
755
- const innerBackgroundStyles = backgroundValueToCSS(innerBackground);
756
- const innerStyles = {
757
- ...innerBackgroundStyles
758
- };
759
- const dimensionsResult = responsiveValueToCSS(
760
- dimensions,
761
- dimensionsValueToCSS,
762
- innerClass
763
- );
764
- Object.assign(innerStyles, dimensionsResult.baseStyles);
765
- if (dimensionsResult.mediaQueryCSS) {
766
- mediaQueries.push(dimensionsResult.mediaQueryCSS);
767
- }
768
- const innerPaddingResult = responsiveValueToCSS(
769
- innerPadding,
770
- (v) => ({ padding: paddingValueToCSS(v) }),
771
- innerClass
772
- );
773
- Object.assign(innerStyles, innerPaddingResult.baseStyles);
774
- if (innerPaddingResult.mediaQueryCSS) {
775
- mediaQueries.push(innerPaddingResult.mediaQueryCSS);
776
- }
777
- const innerBorderStyles = borderValueToCSS(innerBorder);
778
- if (innerBorderStyles) {
779
- Object.assign(innerStyles, innerBorderStyles);
780
- }
781
- const visibilityCSS = visibilityValueToCSS(visibility, outerClass);
782
- if (visibilityCSS) {
783
- mediaQueries.push(visibilityCSS);
784
- }
785
- const contentClasses = cn("px-4", innerClass);
786
- const hasInnerStyles = Object.keys(innerStyles).length > 0;
787
- const allMediaQueryCSS = mediaQueries.join("\n");
788
- const ContentSlot = Content;
789
- return /* @__PURE__ */ jsxRuntime.jsxs(AnimatedWrapper.AnimatedWrapper, { animation, children: [
790
- allMediaQueryCSS && /* @__PURE__ */ jsxRuntime.jsx("style", { children: allMediaQueryCSS }),
791
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: outerClass, style: outerStyles, children: hasInnerStyles ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: contentClasses, style: innerStyles, children: /* @__PURE__ */ jsxRuntime.jsx(ContentSlot, {}) }) : /* @__PURE__ */ jsxRuntime.jsx(ContentSlot, { className: contentClasses, style: innerStyles }) })
792
- ] });
793
- }
794
- };
795
- var idCounter2 = 0;
796
- function generateUniqueId2() {
797
- return `f${(++idCounter2).toString(36)}${Math.random().toString(36).slice(2, 6)}`;
798
- }
799
- var flexDirectionMap = {
800
- row: "flex-row",
801
- column: "flex-col",
802
- "row-reverse": "flex-row-reverse",
803
- "column-reverse": "flex-col-reverse"
804
- };
805
- var flexWrapMap = {
806
- wrap: "flex-wrap",
807
- nowrap: "flex-nowrap",
808
- "wrap-reverse": "flex-wrap-reverse"
809
- };
810
- var defaultProps2 = {
811
- content: [],
812
- direction: "row",
813
- justifyContent: null,
814
- alignItems: null,
815
- gap: 24,
816
- wrap: "wrap",
817
- background: null,
818
- customPadding: null,
819
- margin: null,
820
- dimensions: null,
821
- border: null,
822
- animation: null,
823
- visibility: null
824
- };
825
- var FlexConfig = {
826
- label: "Flex",
827
- fields: {
828
- content: { type: "slot" }
829
- },
830
- defaultProps: defaultProps2,
831
- render: ({
832
- content: Content,
833
- direction,
834
- justifyContent,
835
- alignItems,
836
- gap,
837
- wrap,
838
- background,
839
- customPadding,
840
- margin,
841
- dimensions,
842
- border,
843
- animation,
844
- visibility
845
- }) => {
846
- const uniqueId = generateUniqueId2();
847
- const wrapperClass = `puck-flex-${uniqueId}`;
848
- const contentClass = `puck-flex-content-${uniqueId}`;
849
- const mediaQueries = [];
850
- const backgroundStyles = backgroundValueToCSS(background);
851
- const wrapperStyles = {
852
- ...backgroundStyles
853
- };
854
- const paddingResult = responsiveValueToCSS(
855
- customPadding,
856
- (v) => ({ padding: paddingValueToCSS(v) }),
857
- wrapperClass
858
- );
859
- Object.assign(wrapperStyles, paddingResult.baseStyles);
860
- if (paddingResult.mediaQueryCSS) {
861
- mediaQueries.push(paddingResult.mediaQueryCSS);
862
- }
863
- const borderStyles = borderValueToCSS(border);
864
- if (borderStyles) {
865
- Object.assign(wrapperStyles, borderStyles);
866
- }
867
- const marginResult = responsiveValueToCSS(
868
- margin,
869
- (v) => ({ margin: marginValueToCSS(v) }),
870
- wrapperClass
871
- );
872
- Object.assign(wrapperStyles, marginResult.baseStyles);
873
- if (marginResult.mediaQueryCSS) {
874
- mediaQueries.push(marginResult.mediaQueryCSS);
875
- }
876
- const dimensionsResult = responsiveValueToCSS(
877
- dimensions,
878
- dimensionsValueToCSS,
879
- contentClass
880
- );
881
- const visibilityCSS = visibilityValueToCSS(visibility, wrapperClass);
882
- if (visibilityCSS) {
883
- mediaQueries.push(visibilityCSS);
884
- }
885
- const contentClasses = cn(
886
- "flex w-full min-h-[50px]",
887
- flexDirectionMap[direction],
888
- justifyContent && justifyContentMap[justifyContent],
889
- alignItems && alignItemsMap[alignItems],
890
- flexWrapMap[wrap],
891
- "[&>*]:min-w-0",
892
- contentClass
893
- );
894
- const contentStyles = {
895
- gap,
896
- ...dimensionsResult.baseStyles
897
- };
898
- if (dimensionsResult.mediaQueryCSS) {
899
- mediaQueries.push(dimensionsResult.mediaQueryCSS);
900
- }
901
- const allMediaQueryCSS = mediaQueries.join("\n");
902
- const ContentSlot = Content;
903
- return /* @__PURE__ */ jsxRuntime.jsxs(AnimatedWrapper.AnimatedWrapper, { animation, children: [
904
- allMediaQueryCSS && /* @__PURE__ */ jsxRuntime.jsx("style", { children: allMediaQueryCSS }),
905
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: wrapperClass, style: wrapperStyles, children: /* @__PURE__ */ jsxRuntime.jsx(ContentSlot, { className: contentClasses, style: contentStyles }) })
906
- ] });
907
- }
908
- };
909
- var idCounter3 = 0;
910
- function generateUniqueId3() {
911
- return `g${(++idCounter3).toString(36)}${Math.random().toString(36).slice(2, 6)}`;
912
- }
913
- var defaultProps3 = {
914
- content: [],
915
- numColumns: 3,
916
- gap: 24,
917
- background: null,
918
- customPadding: null,
919
- dimensions: null,
920
- border: null,
921
- margin: null,
922
- animation: null,
923
- visibility: null
924
- };
925
- var GridConfig = {
926
- label: "Grid",
927
- fields: {
928
- content: { type: "slot" }
929
- },
930
- defaultProps: defaultProps3,
931
- render: ({
932
- content: Content,
933
- numColumns,
934
- gap,
935
- background,
936
- customPadding,
937
- dimensions,
938
- border,
939
- margin,
940
- animation,
941
- visibility
942
- }) => {
943
- const uniqueId = generateUniqueId3();
944
- const wrapperClass = `puck-grid-${uniqueId}`;
945
- const contentClass = `puck-grid-content-${uniqueId}`;
946
- const mediaQueries = [];
947
- const backgroundStyles = backgroundValueToCSS(background);
948
- const wrapperStyles = {
949
- ...backgroundStyles
950
- };
951
- const paddingResult = responsiveValueToCSS(
952
- customPadding,
953
- (v) => ({ padding: paddingValueToCSS(v) }),
954
- wrapperClass
955
- );
956
- Object.assign(wrapperStyles, paddingResult.baseStyles);
957
- if (paddingResult.mediaQueryCSS) {
958
- mediaQueries.push(paddingResult.mediaQueryCSS);
959
- }
960
- const borderStyles = borderValueToCSS(border);
961
- if (borderStyles) {
962
- Object.assign(wrapperStyles, borderStyles);
963
- }
964
- const marginResult = responsiveValueToCSS(
965
- margin,
966
- (v) => ({ margin: marginValueToCSS(v) }),
967
- wrapperClass
968
- );
969
- Object.assign(wrapperStyles, marginResult.baseStyles);
970
- if (marginResult.mediaQueryCSS) {
971
- mediaQueries.push(marginResult.mediaQueryCSS);
972
- }
973
- const dimensionsResult = responsiveValueToCSS(
974
- dimensions,
975
- dimensionsValueToCSS,
976
- contentClass
977
- );
978
- const visibilityCSS = visibilityValueToCSS(visibility, wrapperClass);
979
- if (visibilityCSS) {
980
- mediaQueries.push(visibilityCSS);
981
- }
982
- const contentClasses = cn(
983
- "flex flex-col w-full",
984
- "md:grid",
985
- contentClass
986
- );
987
- const contentStyles = {
988
- gap,
989
- ...dimensionsResult.baseStyles
990
- };
991
- if (dimensionsResult.mediaQueryCSS) {
992
- mediaQueries.push(dimensionsResult.mediaQueryCSS);
993
- }
994
- const gridStyles = {
995
- ...contentStyles,
996
- "--grid-cols": numColumns
997
- };
998
- const allMediaQueryCSS = mediaQueries.join("\n");
999
- const ContentSlot = Content;
1000
- return /* @__PURE__ */ jsxRuntime.jsxs(AnimatedWrapper.AnimatedWrapper, { animation, children: [
1001
- allMediaQueryCSS && /* @__PURE__ */ jsxRuntime.jsx("style", { children: allMediaQueryCSS }),
1002
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: wrapperClass, style: wrapperStyles, children: [
1003
- /* @__PURE__ */ jsxRuntime.jsx(ContentSlot, { className: contentClasses, style: gridStyles }),
1004
- /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
1005
- @media (min-width: 768px) {
1006
- .flex.md\\:grid {
1007
- grid-template-columns: repeat(var(--grid-cols), 1fr);
1008
- }
1009
- }
1010
- ` })
1011
- ] })
1012
- ] });
1013
- }
1014
- };
1015
- var idCounter4 = 0;
1016
- function generateUniqueId4() {
1017
- return `s${(++idCounter4).toString(36)}${Math.random().toString(36).slice(2, 6)}`;
1018
- }
1019
- var defaultProps4 = {
1020
- id: "",
1021
- content: [],
1022
- background: null,
1023
- fullWidth: false,
1024
- customPadding: null,
1025
- dimensions: null,
1026
- border: null,
1027
- margin: null,
1028
- animation: null,
1029
- visibility: null
1030
- };
1031
- var SectionConfig = {
1032
- label: "Section",
1033
- fields: {
1034
- content: { type: "slot" }
1035
- },
1036
- defaultProps: defaultProps4,
1037
- render: ({
1038
- id,
1039
- content: Content,
1040
- background,
1041
- fullWidth,
1042
- customPadding,
1043
- dimensions,
1044
- border,
1045
- margin,
1046
- animation,
1047
- visibility
1048
- }) => {
1049
- const uniqueId = generateUniqueId4();
1050
- const sectionClass = `puck-section-${uniqueId}`;
1051
- const contentClass = `puck-section-content-${uniqueId}`;
1052
- const mediaQueries = [];
1053
- const backgroundStyles = backgroundValueToCSS(background);
1054
- const sectionStyles = {
1055
- ...backgroundStyles
1056
- };
1057
- const paddingResult = responsiveValueToCSS(
1058
- customPadding,
1059
- (v) => ({ padding: paddingValueToCSS(v) }),
1060
- sectionClass
1061
- );
1062
- Object.assign(sectionStyles, paddingResult.baseStyles);
1063
- if (paddingResult.mediaQueryCSS) {
1064
- mediaQueries.push(paddingResult.mediaQueryCSS);
1065
- }
1066
- const borderStyles = borderValueToCSS(border);
1067
- if (borderStyles) {
1068
- Object.assign(sectionStyles, borderStyles);
1069
- }
1070
- const marginResult = responsiveValueToCSS(
1071
- margin,
1072
- (v) => ({ margin: marginValueToCSS(v) }),
1073
- sectionClass
1074
- );
1075
- Object.assign(sectionStyles, marginResult.baseStyles);
1076
- if (marginResult.mediaQueryCSS) {
1077
- mediaQueries.push(marginResult.mediaQueryCSS);
1078
- }
1079
- const visibilityCSS = visibilityValueToCSS(visibility, sectionClass);
1080
- if (visibilityCSS) {
1081
- mediaQueries.push(visibilityCSS);
1082
- }
1083
- const sectionClasses = cn("relative w-full", sectionClass);
1084
- const dimensionsResult = responsiveValueToCSS(
1085
- dimensions,
1086
- dimensionsValueToCSS,
1087
- contentClass
1088
- );
1089
- if (dimensionsResult.mediaQueryCSS) {
1090
- mediaQueries.push(dimensionsResult.mediaQueryCSS);
1091
- }
1092
- const contentClasses = cn(
1093
- "relative z-10",
1094
- // Only apply preset content width if no dimensions set
1095
- !dimensions && !fullWidth && "max-w-[1200px] mx-auto px-4",
1096
- contentClass
1097
- );
1098
- const allMediaQueryCSS = mediaQueries.join("\n");
1099
- const ContentSlot = Content;
1100
- return /* @__PURE__ */ jsxRuntime.jsxs(AnimatedWrapper.AnimatedWrapper, { animation, children: [
1101
- allMediaQueryCSS && /* @__PURE__ */ jsxRuntime.jsx("style", { children: allMediaQueryCSS }),
1102
- /* @__PURE__ */ jsxRuntime.jsx(
1103
- "section",
1104
- {
1105
- id: id || void 0,
1106
- className: sectionClasses,
1107
- style: sectionStyles,
1108
- children: /* @__PURE__ */ jsxRuntime.jsx(ContentSlot, { className: contentClasses, style: dimensionsResult.baseStyles })
1109
- }
1110
- )
1111
- ] });
1112
- }
1113
- };
1114
- var idCounter5 = 0;
1115
- function generateUniqueId5() {
1116
- return `sp${(++idCounter5).toString(36)}${Math.random().toString(36).slice(2, 6)}`;
1117
- }
1118
- var heightMap = {
1119
- "8px": "h-2",
1120
- "16px": "h-4",
1121
- "24px": "h-6",
1122
- "32px": "h-8",
1123
- "48px": "h-12",
1124
- "64px": "h-16",
1125
- "80px": "h-20",
1126
- "96px": "h-24",
1127
- "128px": "h-32"
1128
- };
1129
- var widthMap = {
1130
- "8px": "w-2",
1131
- "16px": "w-4",
1132
- "24px": "w-6",
1133
- "32px": "w-8",
1134
- "48px": "w-12",
1135
- "64px": "w-16",
1136
- "80px": "w-20",
1137
- "96px": "w-24",
1138
- "128px": "w-32"
1139
- };
1140
- var defaultProps5 = {
1141
- size: "24px",
1142
- direction: "vertical",
1143
- visibility: null
1144
- };
1145
- var SpacerConfig = {
1146
- label: "Spacer",
1147
- defaultProps: defaultProps5,
1148
- render: ({ size, direction, visibility }) => {
1149
- const uniqueId = generateUniqueId5();
1150
- const wrapperClass = `puck-spacer-${uniqueId}`;
1151
- const visibilityCSS = visibilityValueToCSS(visibility, wrapperClass);
1152
- const getClasses = () => {
1153
- const heightClass = heightMap[size] || "h-6";
1154
- const widthClass = widthMap[size] || "w-6";
1155
- if (direction === "vertical") {
1156
- return `block ${heightClass} w-full`;
1157
- }
1158
- if (direction === "horizontal") {
1159
- return `inline-block ${widthClass} h-full`;
1160
- }
1161
- return `block ${heightClass} ${widthClass}`;
1162
- };
1163
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1164
- visibilityCSS && /* @__PURE__ */ jsxRuntime.jsx("style", { children: visibilityCSS }),
1165
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(getClasses(), wrapperClass), "aria-hidden": "true" })
1166
- ] });
1167
- }
1168
- };
1169
- var idCounter6 = 0;
1170
- function generateUniqueId6() {
1171
- return `t${(++idCounter6).toString(36)}${Math.random().toString(36).slice(2, 6)}`;
1172
- }
1173
- var defaultProps6 = {
1174
- content: [],
1175
- templateId: null,
1176
- dimensions: null,
1177
- customPadding: null,
1178
- margin: null,
1179
- visibility: null
1180
- };
1181
- var TemplateServerConfig = {
1182
- label: "Template",
1183
- fields: {
1184
- // In server config, templateId is just for reference (no loading UI)
1185
- templateId: {
1186
- type: "text",
1187
- label: "Template ID"
1188
- },
1189
- content: {
1190
- type: "slot"
1191
- }
1192
- },
1193
- defaultProps: defaultProps6,
1194
- render: ({ content: Content, dimensions, customPadding, margin, visibility }) => {
1195
- const uniqueId = generateUniqueId6();
1196
- const wrapperClass = `puck-template-${uniqueId}`;
1197
- const contentClass = `puck-template-content-${uniqueId}`;
1198
- const mediaQueries = [];
1199
- const wrapperStyles = {};
1200
- const paddingResult = responsiveValueToCSS(
1201
- customPadding,
1202
- (v) => ({ padding: paddingValueToCSS(v) }),
1203
- wrapperClass
1204
- );
1205
- Object.assign(wrapperStyles, paddingResult.baseStyles);
1206
- if (paddingResult.mediaQueryCSS) {
1207
- mediaQueries.push(paddingResult.mediaQueryCSS);
1208
- }
1209
- const marginResult = responsiveValueToCSS(
1210
- margin,
1211
- (v) => ({ margin: marginValueToCSS(v) }),
1212
- wrapperClass
1213
- );
1214
- Object.assign(wrapperStyles, marginResult.baseStyles);
1215
- if (marginResult.mediaQueryCSS) {
1216
- mediaQueries.push(marginResult.mediaQueryCSS);
1217
- }
1218
- const visibilityCSS = visibilityValueToCSS(visibility, wrapperClass);
1219
- if (visibilityCSS) {
1220
- mediaQueries.push(visibilityCSS);
1221
- }
1222
- const dimensionsResult = responsiveValueToCSS(
1223
- dimensions,
1224
- dimensionsValueToCSS,
1225
- contentClass
1226
- );
1227
- if (dimensionsResult.mediaQueryCSS) {
1228
- mediaQueries.push(dimensionsResult.mediaQueryCSS);
1229
- }
1230
- const allMediaQueryCSS = mediaQueries.join("\n");
1231
- const ContentSlot = Content;
1232
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1233
- allMediaQueryCSS && /* @__PURE__ */ jsxRuntime.jsx("style", { children: allMediaQueryCSS }),
1234
- /* @__PURE__ */ jsxRuntime.jsx(
1235
- "div",
1236
- {
1237
- className: cn("template-wrapper", wrapperClass),
1238
- style: Object.keys(wrapperStyles).length > 0 ? wrapperStyles : void 0,
1239
- children: /* @__PURE__ */ jsxRuntime.jsx(ContentSlot, { className: contentClass, style: dimensionsResult.baseStyles })
1240
- }
1241
- )
1242
- ] });
1243
- }
1244
- };
1245
- var defaultProps7 = {
1246
- text: "Heading Text",
1247
- level: "h2",
1248
- alignment: null,
1249
- textColor: null,
1250
- dimensions: null,
1251
- animation: null,
1252
- margin: null,
1253
- customPadding: null
1254
- };
1255
- var HeadingConfig = {
1256
- label: "Heading",
1257
- defaultProps: defaultProps7,
1258
- render: ({ text, level, alignment, textColor, dimensions, animation, margin, customPadding }) => {
1259
- const tag = level || "h2";
1260
- const alignmentValue = alignment ?? "left";
1261
- const classes = cn(
1262
- headingLevelMap[level] || headingLevelMap.h2,
1263
- alignmentMap[alignmentValue] || alignmentMap.left
1264
- );
1265
- const dimensionsStyles = dimensions ? dimensionsValueToCSS(dimensions) : void 0;
1266
- const style = {
1267
- ...dimensionsStyles
1268
- };
1269
- const marginCSS = marginValueToCSS(margin);
1270
- if (marginCSS) {
1271
- style.margin = marginCSS;
1272
- }
1273
- const paddingCSS = paddingValueToCSS(customPadding);
1274
- if (paddingCSS) {
1275
- style.padding = paddingCSS;
1276
- }
1277
- const colorCSS = colorValueToCSS(textColor);
1278
- if (colorCSS) {
1279
- style.color = colorCSS;
1280
- }
1281
- const headingElement = React.createElement(tag, { className: classes, style: Object.keys(style).length > 0 ? style : void 0 }, text);
1282
- return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper.AnimatedWrapper, { animation, children: headingElement });
1283
- }
1284
- };
1285
- var defaultProps8 = {
1286
- content: "Enter your text here...",
1287
- size: "base",
1288
- alignment: null,
1289
- textColor: null,
1290
- dimensions: null,
1291
- animation: null,
1292
- margin: null,
1293
- customPadding: null
1294
- };
1295
- var TextConfig = {
1296
- label: "Text",
1297
- defaultProps: defaultProps8,
1298
- render: ({ content, size, alignment, textColor, dimensions, animation, margin, customPadding }) => {
1299
- const dimensionsStyles = dimensions ? dimensionsValueToCSS(dimensions) : void 0;
1300
- const style = {
1301
- ...dimensionsStyles
1302
- };
1303
- const marginCSS = marginValueToCSS(margin);
1304
- if (marginCSS) {
1305
- style.margin = marginCSS;
1306
- }
1307
- const paddingCSS = paddingValueToCSS(customPadding);
1308
- if (paddingCSS) {
1309
- style.padding = paddingCSS;
1310
- }
1311
- const colorCSS = colorValueToCSS(textColor);
1312
- if (colorCSS) {
1313
- style.color = colorCSS;
1314
- }
1315
- const alignmentValue = alignment ?? "left";
1316
- return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper.AnimatedWrapper, { animation, children: /* @__PURE__ */ jsxRuntime.jsx(
1317
- "p",
1318
- {
1319
- className: cn(
1320
- textSizeMap[size] || textSizeMap.base,
1321
- alignmentMap[alignmentValue] || alignmentMap.left
1322
- ),
1323
- style: Object.keys(style).length > 0 ? style : void 0,
1324
- children: content
1325
- }
1326
- ) });
1327
- }
1328
- };
1329
- var defaultProps9 = {
1330
- content: "<p>Enter your content here...</p>",
1331
- alignment: null,
1332
- textColor: null,
1333
- dimensions: null,
1334
- animation: null,
1335
- margin: null,
1336
- customPadding: null
1337
- };
1338
- var RichTextConfig = {
1339
- label: "Rich Text",
1340
- defaultProps: defaultProps9,
1341
- render: ({ content, alignment, textColor, dimensions, animation, margin, customPadding }) => {
1342
- const dimensionsStyles = dimensions ? dimensionsValueToCSS(dimensions) : void 0;
1343
- const style = {
1344
- ...dimensionsStyles
1345
- };
1346
- const marginCSS = marginValueToCSS(margin);
1347
- if (marginCSS) {
1348
- style.margin = marginCSS;
1349
- }
1350
- const customPaddingCSS = paddingValueToCSS(customPadding);
1351
- if (customPaddingCSS) {
1352
- style.padding = customPaddingCSS;
1353
- }
1354
- const colorCSS = colorValueToCSS(textColor);
1355
- if (colorCSS) {
1356
- style.color = colorCSS;
1357
- }
1358
- const alignmentValue = alignment ?? "left";
1359
- const alignmentClass = alignmentMap[alignmentValue] || alignmentMap.left;
1360
- if (!content || content === "<p></p>") {
1361
- return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper.AnimatedWrapper, { animation, children: /* @__PURE__ */ jsxRuntime.jsx("section", { className: cn("relative overflow-hidden px-4", alignmentClass), style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "prose dark:prose-invert", children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: /* @__PURE__ */ jsxRuntime.jsx("em", { children: "No content available" }) }) }) }) });
1362
- }
1363
- return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper.AnimatedWrapper, { animation, children: /* @__PURE__ */ jsxRuntime.jsx("section", { className: cn("relative overflow-hidden px-4", alignmentClass), style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsxRuntime.jsx(
1364
- "div",
1365
- {
1366
- className: "prose dark:prose-invert",
1367
- dangerouslySetInnerHTML: { __html: content }
1368
- }
1369
- ) }) });
1370
- }
1371
- };
1372
- var idCounter7 = 0;
1373
- function generateUniqueId7() {
1374
- return `i${(++idCounter7).toString(36)}${Math.random().toString(36).slice(2, 6)}`;
1375
- }
1376
- var defaultProps10 = {
1377
- image: null,
1378
- alt: "",
1379
- aspectRatio: "auto",
1380
- link: "",
1381
- openInNewTab: false,
1382
- margin: null,
1383
- border: null,
1384
- dimensions: null,
1385
- alignment: null,
1386
- transform: null,
1387
- animation: null,
1388
- customPadding: null,
1389
- visibility: null
1390
- };
1391
- var ImageConfig = {
1392
- label: "Image",
1393
- defaultProps: defaultProps10,
1394
- render: ({ image, alt, aspectRatio, link, openInNewTab, dimensions, alignment, margin, border, transform, animation, customPadding, visibility }) => {
1395
- const uniqueId = generateUniqueId7();
1396
- const wrapperClass = `puck-image-${uniqueId}`;
1397
- const visibilityCSS = visibilityValueToCSS(visibility, wrapperClass);
1398
- const dimensionsStyles = dimensionsValueToCSS(dimensions);
1399
- const style = {
1400
- ...dimensionsStyles
1401
- };
1402
- const marginCSS = marginValueToCSS(margin);
1403
- if (marginCSS) {
1404
- style.margin = marginCSS;
1405
- }
1406
- const paddingCSS = paddingValueToCSS(customPadding);
1407
- if (paddingCSS) {
1408
- style.padding = paddingCSS;
1409
- }
1410
- const borderStyles = borderValueToCSS(border);
1411
- if (borderStyles) {
1412
- Object.assign(style, borderStyles);
1413
- }
1414
- const transformStyles = transformValueToCSS(transform);
1415
- if (transformStyles) {
1416
- Object.assign(style, transformStyles);
1417
- }
1418
- const alignmentValue = alignment ?? "center";
1419
- const alignmentClasses = cn(
1420
- "flex",
1421
- alignmentValue === "left" && "justify-start",
1422
- alignmentValue === "center" && "justify-center",
1423
- alignmentValue === "right" && "justify-end"
1424
- );
1425
- if (!image?.url) {
1426
- return /* @__PURE__ */ jsxRuntime.jsxs(AnimatedWrapper.AnimatedWrapper, { animation, children: [
1427
- visibilityCSS && /* @__PURE__ */ jsxRuntime.jsx("style", { children: visibilityCSS }),
1428
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("py-4 px-4", wrapperClass), style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: alignmentClasses, children: /* @__PURE__ */ jsxRuntime.jsx(
1429
- "div",
1430
- {
1431
- className: cn(
1432
- "relative overflow-hidden rounded-lg w-full max-w-md bg-muted flex items-center justify-center min-h-[200px]",
1433
- aspectRatioMap[aspectRatio] || ""
1434
- ),
1435
- children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "No image selected" })
1436
- }
1437
- ) }) })
1438
- ] });
1439
- }
1440
- const imageElement = aspectRatio === "auto" ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative overflow-hidden rounded-lg w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
1441
- "img",
1442
- {
1443
- src: image.url,
1444
- alt: alt || image.alt || "",
1445
- className: "w-full h-auto object-cover"
1446
- }
1447
- ) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("relative overflow-hidden rounded-lg w-full", aspectRatioMap[aspectRatio]), children: /* @__PURE__ */ jsxRuntime.jsx(
1448
- "img",
1449
- {
1450
- src: image.url,
1451
- alt: alt || image.alt || "",
1452
- className: "absolute inset-0 w-full h-full object-cover"
1453
- }
1454
- ) });
1455
- const content = link ? /* @__PURE__ */ jsxRuntime.jsx(
1456
- "a",
1457
- {
1458
- href: link,
1459
- target: openInNewTab ? "_blank" : void 0,
1460
- rel: openInNewTab ? "noopener noreferrer" : void 0,
1461
- className: "block transition-opacity hover:opacity-90",
1462
- children: imageElement
1463
- }
1464
- ) : imageElement;
1465
- return /* @__PURE__ */ jsxRuntime.jsxs(AnimatedWrapper.AnimatedWrapper, { animation, children: [
1466
- visibilityCSS && /* @__PURE__ */ jsxRuntime.jsx("style", { children: visibilityCSS }),
1467
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("py-4 px-4", wrapperClass), style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: alignmentClasses, children: content }) })
1468
- ] });
1469
- }
1470
- };
1471
- function cn2(...inputs) {
1472
- return tailwindMerge.twMerge(clsx.clsx(inputs));
1473
- }
1474
- var buttonVariants = classVarianceAuthority.cva(
1475
- "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",
1476
- {
1477
- variants: {
1478
- variant: {
1479
- default: "bg-primary text-primary-foreground hover:bg-primary/90",
1480
- destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
1481
- outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
1482
- secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
1483
- ghost: "hover:bg-accent hover:text-accent-foreground",
1484
- link: "text-primary underline-offset-4 hover:underline"
1485
- },
1486
- size: {
1487
- default: "h-10 px-4 py-2",
1488
- sm: "h-8 px-3 text-xs",
1489
- lg: "h-11 px-8",
1490
- icon: "h-10 w-10 p-2",
1491
- "icon-sm": "h-8 w-8 p-1.5"
1492
- }
1493
- },
1494
- defaultVariants: {
1495
- variant: "default",
1496
- size: "default"
1497
- }
1498
- }
1499
- );
1500
- var Button = React__namespace.forwardRef(
1501
- ({ className, variant, size, asChild = false, ...props }, ref) => {
1502
- const Comp = asChild ? reactSlot.Slot : "button";
1503
- return /* @__PURE__ */ jsxRuntime.jsx(
1504
- Comp,
1505
- {
1506
- className: cn2(buttonVariants({ variant, size, className })),
1507
- ref,
1508
- ...props
1509
- }
1510
- );
1511
- }
1512
- );
1513
- Button.displayName = "Button";
1514
- var Input = React__namespace.forwardRef(
1515
- ({ className, type, ...props }, ref) => {
1516
- return /* @__PURE__ */ jsxRuntime.jsx(
1517
- "input",
1518
- {
1519
- type,
1520
- className: cn2(
1521
- "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",
1522
- className
1523
- ),
1524
- ref,
1525
- ...props
1526
- }
1527
- );
1528
- }
1529
- );
1530
- Input.displayName = "Input";
1531
- var labelVariants = classVarianceAuthority.cva(
1532
- "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
1533
- );
1534
- var Label = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1535
- LabelPrimitive__namespace.Root,
1536
- {
1537
- ref,
1538
- className: cn2(labelVariants(), className),
1539
- ...props
1540
- }
1541
- ));
1542
- Label.displayName = LabelPrimitive__namespace.Root.displayName;
1543
- var DEFAULT_VALUE = {
1544
- mode: "default"
1545
- };
1546
- var CUSTOM_DEFAULTS = {
1547
- height: 40,
1548
- paddingX: 16,
1549
- paddingY: 8,
1550
- fontSize: 14,
1551
- unit: "px"
1552
- };
1553
- function SizeFieldInner({
1554
- value,
1555
- onChange,
1556
- label = "Size",
1557
- readOnly,
1558
- showHeight = true,
1559
- showFontSize = true
1560
- }) {
1561
- const currentValue = value || DEFAULT_VALUE;
1562
- const handleModeChange = React.useCallback((mode) => {
1563
- if (mode === "custom") {
1564
- onChange({
1565
- mode,
1566
- ...CUSTOM_DEFAULTS
1567
- });
1568
- } else {
1569
- onChange({ mode });
1570
- }
1571
- }, [onChange]);
1572
- const handleValueChange = React.useCallback((field, val) => {
1573
- onChange({
1574
- ...currentValue,
1575
- [field]: val
1576
- });
1577
- }, [currentValue, onChange]);
1578
- const handleUnitChange = React.useCallback((unit) => {
1579
- onChange({
1580
- ...currentValue,
1581
- unit
1582
- });
1583
- }, [currentValue, onChange]);
1584
- const handleClear = React.useCallback(() => {
1585
- onChange(null);
1586
- }, [onChange]);
1587
- const presets = [
1588
- { mode: "sm", label: "SM" },
1589
- { mode: "default", label: "Default" },
1590
- { mode: "lg", label: "LG" },
1591
- { mode: "custom", label: "Custom" }
1592
- ];
1593
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "puck-field space-y-3", children: [
1594
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
1595
- /* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-sm font-medium text-foreground", children: label }),
1596
- value && !readOnly && /* @__PURE__ */ jsxRuntime.jsx(
1597
- Button,
1598
- {
1599
- type: "button",
1600
- variant: "ghost",
1601
- size: "icon-sm",
1602
- onClick: handleClear,
1603
- className: "text-muted-foreground hover:text-destructive",
1604
- title: "Reset to default",
1605
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" })
1606
- }
1607
- )
1608
- ] }),
1609
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-1", children: presets.map(({ mode, label: modeLabel }) => {
1610
- const isActive = currentValue.mode === mode;
1611
- return /* @__PURE__ */ jsxRuntime.jsx(
1612
- Button,
1613
- {
1614
- type: "button",
1615
- variant: isActive ? "default" : "secondary",
1616
- size: "sm",
1617
- onClick: () => handleModeChange(mode),
1618
- disabled: readOnly,
1619
- className: cn2(
1620
- "text-xs",
1621
- isActive && "bg-primary hover:bg-primary/90"
1622
- ),
1623
- children: modeLabel
1624
- },
1625
- mode
1626
- );
1627
- }) }),
1628
- currentValue.mode === "custom" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3 p-3 bg-muted/50 rounded-md", children: [
1629
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
1630
- /* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-[10px] uppercase tracking-wide text-muted-foreground flex-shrink-0", children: "Unit:" }),
1631
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-1", children: ["px", "rem"].map((unit) => {
1632
- const isActive = (currentValue.unit || "px") === unit;
1633
- return /* @__PURE__ */ jsxRuntime.jsx(
1634
- Button,
1635
- {
1636
- type: "button",
1637
- variant: isActive ? "default" : "outline",
1638
- size: "sm",
1639
- onClick: () => handleUnitChange(unit),
1640
- disabled: readOnly,
1641
- className: cn2(
1642
- "text-xs font-mono h-7 px-2",
1643
- isActive && "bg-primary hover:bg-primary/90"
1644
- ),
1645
- children: unit
1646
- },
1647
- unit
1648
- );
1649
- }) })
1650
- ] }),
1651
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-2", children: [
1652
- showHeight && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
1653
- /* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-[10px] uppercase tracking-wide text-muted-foreground", children: "Height" }),
1654
- /* @__PURE__ */ jsxRuntime.jsx(
1655
- Input,
1656
- {
1657
- type: "number",
1658
- min: 0,
1659
- value: currentValue.height ?? CUSTOM_DEFAULTS.height,
1660
- onChange: (e) => handleValueChange("height", parseInt(e.target.value, 10) || 0),
1661
- disabled: readOnly,
1662
- className: "h-8 text-sm font-mono"
1663
- }
1664
- )
1665
- ] }),
1666
- showFontSize && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
1667
- /* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-[10px] uppercase tracking-wide text-muted-foreground", children: "Font Size" }),
1668
- /* @__PURE__ */ jsxRuntime.jsx(
1669
- Input,
1670
- {
1671
- type: "number",
1672
- min: 0,
1673
- value: currentValue.fontSize ?? CUSTOM_DEFAULTS.fontSize,
1674
- onChange: (e) => handleValueChange("fontSize", parseInt(e.target.value, 10) || 0),
1675
- disabled: readOnly,
1676
- className: "h-8 text-sm font-mono"
1677
- }
1678
- )
1679
- ] }),
1680
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
1681
- /* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-[10px] uppercase tracking-wide text-muted-foreground", children: "Padding X" }),
1682
- /* @__PURE__ */ jsxRuntime.jsx(
1683
- Input,
1684
- {
1685
- type: "number",
1686
- min: 0,
1687
- value: currentValue.paddingX ?? CUSTOM_DEFAULTS.paddingX,
1688
- onChange: (e) => handleValueChange("paddingX", parseInt(e.target.value, 10) || 0),
1689
- disabled: readOnly,
1690
- className: "h-8 text-sm font-mono"
1691
- }
1692
- )
1693
- ] }),
1694
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
1695
- /* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-[10px] uppercase tracking-wide text-muted-foreground", children: "Padding Y" }),
1696
- /* @__PURE__ */ jsxRuntime.jsx(
1697
- Input,
1698
- {
1699
- type: "number",
1700
- min: 0,
1701
- value: currentValue.paddingY ?? CUSTOM_DEFAULTS.paddingY,
1702
- onChange: (e) => handleValueChange("paddingY", parseInt(e.target.value, 10) || 0),
1703
- disabled: readOnly,
1704
- className: "h-8 text-sm font-mono"
1705
- }
1706
- )
1707
- ] })
1708
- ] }),
1709
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-xs text-muted-foreground font-mono pt-1 border-t border-border/50", children: [
1710
- showHeight && `h: ${currentValue.height ?? CUSTOM_DEFAULTS.height}${currentValue.unit || "px"}`,
1711
- showHeight && " | ",
1712
- `p: ${currentValue.paddingY ?? CUSTOM_DEFAULTS.paddingY}${currentValue.unit || "px"} ${currentValue.paddingX ?? CUSTOM_DEFAULTS.paddingX}${currentValue.unit || "px"}`,
1713
- showFontSize && ` | font: ${currentValue.fontSize ?? CUSTOM_DEFAULTS.fontSize}${currentValue.unit || "px"}`
1714
- ] })
1715
- ] })
1716
- ] });
1717
- }
1718
- React.memo(SizeFieldInner);
1719
- function sizeValueToCSS(size) {
1720
- if (!size || size.mode !== "custom") return void 0;
1721
- const unit = size.unit || "px";
1722
- const style = {};
1723
- if (size.height != null) {
1724
- style.height = `${size.height}${unit}`;
1725
- }
1726
- if (size.paddingX != null || size.paddingY != null) {
1727
- const py = size.paddingY ?? 0;
1728
- const px = size.paddingX ?? 0;
1729
- style.padding = `${py}${unit} ${px}${unit}`;
1730
- }
1731
- if (size.fontSize != null) {
1732
- style.fontSize = `${size.fontSize}${unit}`;
1733
- }
1734
- return Object.keys(style).length > 0 ? style : void 0;
1735
- }
1736
- function getSizeClasses(size, sizeMap) {
1737
- if (!size) return sizeMap.default || "";
1738
- if (size.mode === "custom") return "";
1739
- return sizeMap[size.mode] || sizeMap.default || "";
1740
- }
1741
-
1742
- // src/theme/defaults.ts
1743
- var DEFAULT_BUTTON_VARIANTS = {
1744
- default: { classes: "bg-primary text-primary-foreground hover:bg-primary/90" },
1745
- secondary: { classes: "bg-secondary text-secondary-foreground hover:bg-secondary/80" },
1746
- outline: { classes: "border border-input bg-background hover:bg-accent hover:text-accent-foreground" },
1747
- ghost: { classes: "bg-transparent hover:bg-accent hover:text-accent-foreground" },
1748
- destructive: { classes: "bg-destructive text-destructive-foreground hover:bg-destructive/90" },
1749
- link: { classes: "text-primary underline-offset-4 hover:underline bg-transparent" }
1750
- };
1751
- var DEFAULT_FOCUS_RING = "focus:ring-ring";
1752
-
1753
- // src/theme/utils.ts
1754
- function getVariantClasses(variants, variant, fallback = "default") {
1755
- const config = variants[variant];
1756
- if (config?.classes) {
1757
- return config.classes;
1758
- }
1759
- const fallbackConfig = variants[fallback];
1760
- return fallbackConfig?.classes ?? "";
1761
- }
1762
- var sizeStyles = {
1763
- sm: "h-8 px-3 text-sm",
1764
- default: "h-10 px-4",
1765
- lg: "h-12 px-8 text-lg"
1766
- };
1767
- var alignmentWrapperMap = {
1768
- left: "text-left",
1769
- center: "text-center",
1770
- right: "text-right"
1771
- };
1772
- var defaultProps11 = {
1773
- text: "Click Me",
1774
- link: "",
1775
- variant: "default",
1776
- size: null,
1777
- openInNewTab: "no",
1778
- margin: null,
1779
- customBackgroundColor: null,
1780
- customTextColor: null,
1781
- customBorder: null,
1782
- alignment: null,
1783
- transform: null,
1784
- animation: null,
1785
- customPadding: null
1786
- };
1787
- var ButtonConfig = {
1788
- label: "Button",
1789
- defaultProps: defaultProps11,
1790
- render: ({ text, link, variant, size, openInNewTab, alignment, margin, customBackgroundColor, customTextColor, customBorder, transform, animation, customPadding }) => {
1791
- const hasCustomBackground = customBackgroundColor?.hex;
1792
- const hasCustomTextColor = customTextColor?.hex;
1793
- const hasCustomPadding = customPadding;
1794
- const hasCustomSize = size?.mode === "custom";
1795
- const variantClasses = getVariantClasses(DEFAULT_BUTTON_VARIANTS, variant, "default");
1796
- const sizeClasses = getSizeClasses(size, sizeStyles);
1797
- const buttonClasses = cn(
1798
- "inline-flex items-center justify-center font-medium transition-colors",
1799
- `focus:outline-none focus:ring-2 focus:ring-offset-2 ${DEFAULT_FOCUS_RING}`,
1800
- "disabled:opacity-50 disabled:pointer-events-none",
1801
- // Only apply variant styles if no custom background/text color
1802
- !hasCustomBackground && !hasCustomTextColor && variantClasses,
1803
- // Only apply background portion of variant if no custom background
1804
- hasCustomBackground && !hasCustomTextColor && "hover:opacity-90",
1805
- // Only apply size classes if not using custom size or custom padding
1806
- !hasCustomPadding && !hasCustomSize && sizeClasses,
1807
- // Apply rounded-md unless custom border has radius
1808
- !customBorder?.radius && "rounded-md"
1809
- );
1810
- const buttonStyle = {};
1811
- if (hasCustomBackground) {
1812
- buttonStyle.backgroundColor = colorValueToCSS(customBackgroundColor);
1813
- }
1814
- if (hasCustomTextColor) {
1815
- buttonStyle.color = colorValueToCSS(customTextColor);
1816
- }
1817
- const borderStyles = borderValueToCSS(customBorder);
1818
- if (borderStyles) {
1819
- Object.assign(buttonStyle, borderStyles);
1820
- }
1821
- const customSizeStyles = sizeValueToCSS(size);
1822
- if (customSizeStyles) {
1823
- Object.assign(buttonStyle, customSizeStyles);
1824
- }
1825
- const paddingCSS = paddingValueToCSS(customPadding);
1826
- if (paddingCSS) {
1827
- buttonStyle.padding = paddingCSS;
1828
- }
1829
- const transformStyles = transformValueToCSS(transform);
1830
- if (transformStyles) {
1831
- Object.assign(buttonStyle, transformStyles);
1832
- }
1833
- const buttonElement = link ? /* @__PURE__ */ jsxRuntime.jsx(
1834
- "a",
1835
- {
1836
- href: link,
1837
- target: openInNewTab === "yes" ? "_blank" : void 0,
1838
- rel: openInNewTab === "yes" ? "noopener noreferrer" : void 0,
1839
- className: buttonClasses,
1840
- style: buttonStyle,
1841
- children: text
1842
- }
1843
- ) : /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: buttonClasses, style: buttonStyle, children: text });
1844
- const wrapperStyle = {};
1845
- const marginCSS = marginValueToCSS(margin);
1846
- if (marginCSS) {
1847
- wrapperStyle.margin = marginCSS;
1848
- }
1849
- const alignmentValue = alignment ?? "left";
1850
- return /* @__PURE__ */ jsxRuntime.jsx(
1851
- AnimatedWrapper.AnimatedWrapper,
1852
- {
1853
- animation,
1854
- className: alignmentWrapperMap[alignmentValue] || alignmentWrapperMap.left,
1855
- style: wrapperStyle,
1856
- children: buttonElement
1857
- }
1858
- );
1859
- }
1860
- };
1861
- var defaultProps12 = {
1862
- image: null,
1863
- heading: "Card Heading",
1864
- text: "Card description text goes here.",
1865
- link: "",
1866
- openInNewTab: false,
1867
- shadow: "md",
1868
- margin: null,
1869
- background: null,
1870
- border: null,
1871
- dimensions: null,
1872
- alignment: null,
1873
- transform: null,
1874
- animation: null,
1875
- customPadding: null
1876
- };
1877
- var CardConfig = {
1878
- label: "Card",
1879
- defaultProps: defaultProps12,
1880
- render: ({ image, heading, text, link, openInNewTab, shadow, background, dimensions, alignment, margin, border, transform, animation, customPadding }) => {
1881
- const hasBorderRadius = border?.radius && border.radius > 0;
1882
- const cardClasses = cn(
1883
- "overflow-hidden transition-all bg-card",
1884
- !hasBorderRadius && "rounded-lg",
1885
- shadowMap[shadow] || "",
1886
- link && "hover:shadow-lg cursor-pointer"
1887
- );
1888
- const wrapperStyle = {};
1889
- const marginCSS = marginValueToCSS(margin);
1890
- if (marginCSS) {
1891
- wrapperStyle.margin = marginCSS;
1892
- }
1893
- const dimensionsStyles = dimensionsValueToCSS(dimensions);
1894
- if (dimensionsStyles) {
1895
- Object.assign(wrapperStyle, dimensionsStyles);
1896
- }
1897
- const transformStyles = transformValueToCSS(transform);
1898
- if (transformStyles) {
1899
- Object.assign(wrapperStyle, transformStyles);
1900
- }
1901
- const alignmentValue = alignment ?? "left";
1902
- const alignmentClasses = cn(
1903
- "flex",
1904
- alignmentValue === "left" && "justify-start",
1905
- alignmentValue === "center" && "justify-center",
1906
- alignmentValue === "right" && "justify-end"
1907
- );
1908
- const backgroundStyles = backgroundValueToCSS(background);
1909
- const cardStyle = {
1910
- ...backgroundStyles
1911
- };
1912
- const borderStyles = borderValueToCSS(border);
1913
- if (borderStyles) {
1914
- Object.assign(cardStyle, borderStyles);
1915
- }
1916
- const paddingCSS = paddingValueToCSS(customPadding);
1917
- if (paddingCSS) {
1918
- cardStyle.padding = paddingCSS;
1919
- }
1920
- const cardContent = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cardClasses, style: cardStyle, children: [
1921
- image?.url ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative aspect-video w-full overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
1922
- "img",
1923
- {
1924
- src: image.url,
1925
- alt: image.alt || heading || "",
1926
- className: "w-full h-full object-cover"
1927
- }
1928
- ) }) : /* @__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" }) }),
1929
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-4", children: [
1930
- heading && /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-lg font-semibold text-foreground mb-2", children: heading }),
1931
- text && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: text })
1932
- ] })
1933
- ] });
1934
- if (link) {
1935
- return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper.AnimatedWrapper, { animation, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: alignmentClasses, children: /* @__PURE__ */ jsxRuntime.jsx(
1936
- "a",
1937
- {
1938
- href: link,
1939
- target: openInNewTab ? "_blank" : void 0,
1940
- rel: openInNewTab ? "noopener noreferrer" : void 0,
1941
- className: "block",
1942
- style: wrapperStyle,
1943
- children: cardContent
1944
- }
1945
- ) }) });
1946
- }
1947
- return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper.AnimatedWrapper, { animation, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: alignmentClasses, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: wrapperStyle, children: cardContent }) }) });
1948
- }
1949
- };
1950
- var defaultProps13 = {
1951
- style: "solid",
1952
- color: null,
1953
- margin: null,
1954
- dimensions: null,
1955
- transform: null,
1956
- animation: null,
1957
- customPadding: null
1958
- };
1959
- var DividerConfig = {
1960
- label: "Divider",
1961
- defaultProps: defaultProps13,
1962
- render: ({ style, color, dimensions, margin, transform, animation, customPadding }) => {
1963
- const dimensionsStyles = dimensionsValueToCSS(dimensions);
1964
- const wrapperStyle = {
1965
- ...dimensionsStyles
1966
- };
1967
- const marginCSS = marginValueToCSS(margin);
1968
- if (marginCSS) {
1969
- wrapperStyle.margin = marginCSS;
1970
- }
1971
- const paddingCSS = paddingValueToCSS(customPadding);
1972
- if (paddingCSS) {
1973
- wrapperStyle.padding = paddingCSS;
1974
- }
1975
- const transformStyles = transformValueToCSS(transform);
1976
- if (transformStyles) {
1977
- Object.assign(wrapperStyle, transformStyles);
1978
- }
1979
- const customColor = colorValueToCSS(color);
1980
- const hrStyle = customColor ? { borderColor: customColor } : void 0;
1981
- return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper.AnimatedWrapper, { animation, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4", style: Object.keys(wrapperStyle).length > 0 ? wrapperStyle : void 0, children: /* @__PURE__ */ jsxRuntime.jsx(
1982
- "hr",
1983
- {
1984
- className: cn(
1985
- "border-t border-border",
1986
- dividerStyleMap[style] || dividerStyleMap.solid
1987
- ),
1988
- style: hrStyle
1989
- }
1990
- ) }) });
1991
- }
1992
- };
1993
- var defaultProps14 = {
1994
- items: [
1995
- {
1996
- title: "What is this?",
1997
- content: "This is an accordion component that can expand and collapse.",
1998
- defaultOpen: false
1999
- },
2000
- {
2001
- title: "How do I use it?",
2002
- content: "Click on each item to expand or collapse it.",
2003
- defaultOpen: false
2004
- }
2005
- ],
2006
- allowMultiple: false,
2007
- textColor: null,
2008
- margin: null,
2009
- background: null,
2010
- dimensions: null,
2011
- transform: null,
2012
- animation: null,
2013
- customPadding: null
2014
- };
2015
- var AccordionConfig = {
2016
- label: "Accordion",
2017
- defaultProps: defaultProps14,
2018
- render: (props) => /* @__PURE__ */ jsxRuntime.jsx(
2019
- AccordionClient.AccordionClient,
2020
- {
2021
- items: props.items,
2022
- allowMultiple: props.allowMultiple,
2023
- textColor: props.textColor,
2024
- margin: props.margin,
2025
- background: props.background,
2026
- dimensions: props.dimensions,
2027
- transform: props.transform,
2028
- animation: props.animation,
2029
- customPadding: props.customPadding
2030
- }
2031
- )
2032
- };
2033
- function createConfig(layouts = DEFAULT_LAYOUTS) {
2034
- const layoutOptions = layoutsToOptions(layouts);
2035
- return {
2036
- root: {
2037
- fields: {
2038
- title: {
2039
- type: "text",
2040
- label: "Page Title"
2041
- },
2042
- pageLayout: {
2043
- type: "select",
2044
- label: "Page Layout",
2045
- options: layoutOptions.map(({ value, label }) => ({ value, label }))
2046
- }
2047
- },
2048
- defaultProps: {
2049
- title: "New Page",
2050
- pageLayout: "default"
2051
- },
2052
- render: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children })
2053
- },
2054
- categories: {
2055
- layout: {
2056
- title: "Layout",
2057
- components: ["Container", "Flex", "Grid", "Section", "Spacer", "Template"],
2058
- defaultExpanded: true
2059
- },
2060
- typography: {
2061
- title: "Typography",
2062
- components: ["Heading", "Text", "RichText"]
2063
- },
2064
- media: {
2065
- title: "Media",
2066
- components: ["Image"]
2067
- },
2068
- interactive: {
2069
- title: "Interactive",
2070
- components: ["Button", "Card", "Divider", "Accordion"]
2071
- }
2072
- },
2073
- components: {
2074
- // Layout
2075
- Container: ContainerConfig,
2076
- Flex: FlexConfig,
2077
- Grid: GridConfig,
2078
- Section: SectionConfig,
2079
- Spacer: SpacerConfig,
2080
- Template: TemplateServerConfig,
2081
- // Typography
2082
- Heading: HeadingConfig,
2083
- Text: TextConfig,
2084
- RichText: RichTextConfig,
2085
- // Media
2086
- Image: ImageConfig,
2087
- // Interactive
2088
- Button: ButtonConfig,
2089
- Card: CardConfig,
2090
- Divider: DividerConfig,
2091
- Accordion: AccordionConfig
2092
- }
2093
- };
2094
- }
2095
- var baseConfig = createConfig(DEFAULT_LAYOUTS);
2096
- function PageRenderer({
2097
- data,
2098
- config = baseConfig,
2099
- wrapper: Wrapper,
2100
- className,
2101
- layouts = DEFAULT_LAYOUTS
2102
- }) {
2103
- if (!data || !data.content) {
2104
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className, children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: "No content available" }) });
2105
- }
2106
- const content = /* @__PURE__ */ jsxRuntime.jsx(puck.Render, { config, data });
2107
- const rootProps = data.root?.props;
2108
- const overrides = {
2109
- showHeader: rootProps?.showHeader,
2110
- showFooter: rootProps?.showFooter,
2111
- background: rootProps?.pageBackground,
2112
- maxWidth: rootProps?.pageMaxWidth
2113
- };
2114
- let result = content;
2115
- if (Wrapper) {
2116
- result = /* @__PURE__ */ jsxRuntime.jsx(Wrapper, { children: result });
2117
- } else {
2118
- const pageLayout = rootProps?.pageLayout;
2119
- const layout = pageLayout ? getLayout(layouts, pageLayout) : void 0;
2120
- if (layout) {
2121
- result = /* @__PURE__ */ jsxRuntime.jsx(LayoutWrapper, { layout, className, overrides, children: result });
2122
- } else if (className || overrides.background) {
2123
- result = /* @__PURE__ */ jsxRuntime.jsx(LayoutWrapper, { className, overrides, children: result });
2124
- }
2125
- }
2126
- return result;
2127
- }
2128
- function HybridPageRenderer({
2129
- page,
2130
- legacyRenderer,
2131
- legacyBlocksField = "layout",
2132
- fallback = /* @__PURE__ */ jsxRuntime.jsx("div", { children: "No content available" }),
2133
- config,
2134
- layouts,
2135
- wrapper,
2136
- className
2137
- }) {
2138
- const puckData = page.puckData;
2139
- const hasPuckContent = puckData?.content && Array.isArray(puckData.content) && puckData.content.length > 0;
2140
- const legacyBlocks = page[legacyBlocksField];
2141
- const hasLegacyContent = Array.isArray(legacyBlocks) && legacyBlocks.length > 0;
2142
- if (page.editorVersion === "puck" && hasPuckContent) {
2143
- return /* @__PURE__ */ jsxRuntime.jsx(
2144
- PageRenderer,
2145
- {
2146
- data: puckData,
2147
- config,
2148
- layouts,
2149
- wrapper,
2150
- className
2151
- }
2152
- );
2153
- }
2154
- if (hasLegacyContent) {
2155
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: legacyRenderer(legacyBlocks) });
2156
- }
2157
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: fallback });
2158
- }
2159
-
2160
- exports.HybridPageRenderer = HybridPageRenderer;
2161
- exports.PageRenderer = PageRenderer;
2162
- //# 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
2163
11
  //# sourceMappingURL=index.js.map