@delmaredigital/payload-puck 0.1.3 → 0.3.0

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