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