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