@delmaredigital/payload-puck 0.2.0 → 0.3.0

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