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