@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,545 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React__default from 'react';
3
+ import { CustomField, Field } from '@measured/puck';
4
+
5
+ interface MediaReference {
6
+ id: string | number;
7
+ url: string;
8
+ alt?: string;
9
+ width?: number;
10
+ height?: number;
11
+ }
12
+ interface MediaFieldProps {
13
+ value: MediaReference | null;
14
+ onChange: (value: MediaReference | null) => void;
15
+ label?: string;
16
+ readOnly?: boolean;
17
+ apiEndpoint?: string;
18
+ }
19
+ declare function MediaFieldInner({ value, onChange, label, readOnly, apiEndpoint, }: MediaFieldProps): react_jsx_runtime.JSX.Element;
20
+ declare const MediaField: React__default.MemoExoticComponent<typeof MediaFieldInner>;
21
+ /**
22
+ * Creates a Puck field configuration for media selection
23
+ */
24
+ declare function createMediaField(config: {
25
+ label?: string;
26
+ apiEndpoint?: string;
27
+ }): CustomField<MediaReference | null>;
28
+
29
+ /**
30
+ * Combines class names, filtering out falsy values
31
+ * A simple alternative to clsx/classnames for bundling purposes
32
+ */
33
+ declare function cn(...classes: (string | boolean | undefined | null)[]): string;
34
+ interface ColorValue {
35
+ hex: string;
36
+ opacity?: number;
37
+ }
38
+ interface PaddingValue {
39
+ top: number;
40
+ right: number;
41
+ bottom: number;
42
+ left: number;
43
+ unit: 'px' | 'rem' | 'em' | '%';
44
+ /** Whether all sides are linked (sync together). Defaults to true if not set. */
45
+ linked?: boolean;
46
+ }
47
+ interface BorderValue {
48
+ style: 'none' | 'solid' | 'dashed' | 'dotted';
49
+ width: number;
50
+ color: ColorValue | null;
51
+ radius: number;
52
+ sides: {
53
+ top: boolean;
54
+ right: boolean;
55
+ bottom: boolean;
56
+ left: boolean;
57
+ };
58
+ }
59
+ interface WidthValue {
60
+ mode: 'full' | 'contained' | 'custom';
61
+ maxWidth: number;
62
+ unit: 'px' | 'rem' | '%' | 'vw';
63
+ alignment: 'left' | 'center' | 'right';
64
+ }
65
+ type DimensionsUnit = 'px' | 'rem' | '%' | 'vw' | 'vh';
66
+ type DimensionsMode = 'full' | 'contained' | 'custom';
67
+ type ContentAlignment = 'left' | 'center' | 'right';
68
+ /**
69
+ * Represents a single dimension constraint (min or max for width or height)
70
+ */
71
+ interface DimensionConstraint {
72
+ value: number;
73
+ unit: DimensionsUnit;
74
+ enabled: boolean;
75
+ }
76
+ /**
77
+ * Full dimensions configuration value - replaces/extends WidthValue
78
+ * Supports min/max constraints for both width and height
79
+ */
80
+ interface DimensionsValue {
81
+ /** Width mode: full (100%), contained (centered max-width), or custom */
82
+ mode: DimensionsMode;
83
+ /** Content alignment within the container */
84
+ alignment: ContentAlignment;
85
+ /** Minimum width constraint (optional) */
86
+ minWidth?: DimensionConstraint | null;
87
+ /** Maximum width constraint (required for backward compat) */
88
+ maxWidth: DimensionConstraint;
89
+ /** Minimum height constraint (optional) */
90
+ minHeight?: DimensionConstraint | null;
91
+ /** Maximum height constraint (optional) */
92
+ maxHeight?: DimensionConstraint | null;
93
+ /** UI state: whether advanced mode is expanded */
94
+ advancedMode?: boolean;
95
+ }
96
+ /**
97
+ * Type guard to detect legacy WidthValue format
98
+ */
99
+ declare function isLegacyWidthValue(value: unknown): value is WidthValue;
100
+ /**
101
+ * Migrate legacy WidthValue to new DimensionsValue format
102
+ */
103
+ declare function migrateWidthValue(legacy: WidthValue): DimensionsValue;
104
+ interface GradientStop {
105
+ color: ColorValue;
106
+ position: number;
107
+ }
108
+ interface GradientValue {
109
+ type: 'linear' | 'radial';
110
+ angle: number;
111
+ stops: GradientStop[];
112
+ radialShape?: 'circle' | 'ellipse';
113
+ radialPosition?: 'center' | 'top' | 'bottom' | 'left' | 'right';
114
+ }
115
+ /**
116
+ * Gradient mask for fading images to transparent
117
+ */
118
+ interface GradientMask {
119
+ enabled: boolean;
120
+ direction: 'to-top' | 'to-bottom' | 'to-left' | 'to-right' | 'to-top-left' | 'to-top-right' | 'to-bottom-left' | 'to-bottom-right' | 'from-center';
121
+ startOpacity: number;
122
+ endOpacity: number;
123
+ startPosition: number;
124
+ endPosition: number;
125
+ }
126
+ interface BackgroundImageValue {
127
+ media: MediaReference | null;
128
+ size: 'cover' | 'contain' | 'auto';
129
+ position: 'center' | 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
130
+ repeat: 'no-repeat' | 'repeat' | 'repeat-x' | 'repeat-y';
131
+ attachment: 'scroll' | 'fixed';
132
+ /** Overall image opacity 0-100 (default 100) */
133
+ opacity?: number;
134
+ /** Gradient mask for fade to transparent effect */
135
+ mask?: GradientMask;
136
+ }
137
+ /**
138
+ * Overlay layer for images (Divi-style)
139
+ * Renders a color or gradient on top of the background image
140
+ */
141
+ interface BackgroundOverlay {
142
+ enabled: boolean;
143
+ type: 'solid' | 'gradient';
144
+ solid?: ColorValue | null;
145
+ gradient?: GradientValue | null;
146
+ }
147
+ interface BackgroundValue {
148
+ type: 'none' | 'solid' | 'gradient' | 'image';
149
+ solid?: ColorValue | null;
150
+ gradient?: GradientValue | null;
151
+ image?: BackgroundImageValue | null;
152
+ /** Overlay layer, only used when type === 'image' */
153
+ overlay?: BackgroundOverlay | null;
154
+ }
155
+ declare const visibilityField: Field;
156
+ declare const buttonStyleField: Field;
157
+ declare const buttonVariantField: Field;
158
+ declare const buttonSizeField: Field;
159
+ declare const backgroundColorField: Field;
160
+ declare const textColorField: Field;
161
+ declare const gapField: Field;
162
+ declare const shadowField: Field;
163
+ declare const spacerHeightField: Field;
164
+ declare const headingLevelField: Field;
165
+ declare const textSizeField: Field;
166
+ declare const aspectRatioField: Field;
167
+ declare const dividerStyleField: Field;
168
+ declare const borderRadiusField: Field;
169
+ declare const columnsCountField: Field;
170
+ declare const flexDirectionField: Field;
171
+ declare const flexWrapField: Field;
172
+ /**
173
+ * Maps alignment values to Tailwind classes
174
+ */
175
+ declare const alignmentMap: Record<string, string>;
176
+ /**
177
+ * Maps background color values to Tailwind classes
178
+ */
179
+ declare const bgColorMap: Record<string, string>;
180
+ /**
181
+ * Maps text color values to Tailwind classes
182
+ */
183
+ declare const textColorMap: Record<string, string>;
184
+ /**
185
+ * Maps gap values to Tailwind classes
186
+ */
187
+ declare const gapMap: Record<string, string>;
188
+ /**
189
+ * Maps shadow values to Tailwind classes
190
+ */
191
+ declare const shadowMap: Record<string, string>;
192
+ /**
193
+ * Maps spacer height values to Tailwind classes
194
+ */
195
+ declare const spacerHeightMap: Record<string, string>;
196
+ /**
197
+ * Maps heading level to Tailwind classes
198
+ */
199
+ declare const headingLevelMap: Record<string, string>;
200
+ /**
201
+ * Maps text size to Tailwind classes
202
+ */
203
+ declare const textSizeMap: Record<string, string>;
204
+ /**
205
+ * Maps aspect ratio to Tailwind classes
206
+ */
207
+ declare const aspectRatioMap: Record<string, string>;
208
+ /**
209
+ * Maps divider style to Tailwind classes
210
+ */
211
+ declare const dividerStyleMap: Record<string, string>;
212
+ /**
213
+ * Maps border radius to Tailwind classes
214
+ */
215
+ declare const borderRadiusMap: Record<string, string>;
216
+ /**
217
+ * Maps columns count to Tailwind grid classes (responsive)
218
+ */
219
+ declare const columnsCountMap: Record<string, string>;
220
+ /**
221
+ * Maps flex direction to Tailwind classes
222
+ */
223
+ declare const flexDirectionMap: Record<string, string>;
224
+ /**
225
+ * Maps justify content to Tailwind classes
226
+ * Supports both short (start) and full (flex-start) values
227
+ */
228
+ declare const justifyContentMap: Record<string, string>;
229
+ /**
230
+ * Maps align items to Tailwind classes
231
+ * Supports both short (start) and full (flex-start) values
232
+ */
233
+ declare const alignItemsMap: Record<string, string>;
234
+ /**
235
+ * Maps self-alignment to Tailwind classes (for grid/flex item alignment)
236
+ * Used by components like TextImageSplit for vertical self-alignment
237
+ */
238
+ declare const selfAlignmentMap: Record<string, string>;
239
+ /**
240
+ * Maps flex wrap to Tailwind classes
241
+ */
242
+ declare const flexWrapMap: Record<string, string>;
243
+ /**
244
+ * Convert ColorValue to CSS rgba string
245
+ */
246
+ declare function colorValueToCSS(color: ColorValue | null | undefined): string | undefined;
247
+ /**
248
+ * Convert PaddingValue to CSS padding string
249
+ */
250
+ declare function paddingValueToCSS(padding: PaddingValue | null | undefined): string | undefined;
251
+ /**
252
+ * Convert PaddingValue to CSS margin string (same structure, different property)
253
+ */
254
+ declare function marginValueToCSS(margin: PaddingValue | null | undefined): string | undefined;
255
+ /**
256
+ * Convert BorderValue to CSS properties object
257
+ */
258
+ declare function borderValueToCSS(border: BorderValue | null | undefined): React__default.CSSProperties | undefined;
259
+ /**
260
+ * Convert WidthValue to CSS properties object
261
+ */
262
+ declare function widthValueToCSS(width: WidthValue | null | undefined): React__default.CSSProperties | undefined;
263
+ /**
264
+ * Convert DimensionsValue to CSS properties object
265
+ * Handles both legacy WidthValue and new DimensionsValue formats
266
+ */
267
+ declare function dimensionsValueToCSS(dimensions: DimensionsValue | WidthValue | null | undefined): React__default.CSSProperties | undefined;
268
+ /**
269
+ * Get human-readable summary of dimensions
270
+ */
271
+ declare function getDimensionsSummary(dim: DimensionsValue | null | undefined): string;
272
+ /**
273
+ * Combined style generator for layout components
274
+ */
275
+ declare function getCustomStyleObject(options: {
276
+ backgroundColor?: ColorValue | null;
277
+ textColor?: ColorValue | null;
278
+ padding?: PaddingValue | null;
279
+ margin?: PaddingValue | null;
280
+ border?: BorderValue | null;
281
+ width?: WidthValue | null;
282
+ }): React__default.CSSProperties;
283
+ /**
284
+ * Convert GradientValue to CSS gradient string
285
+ */
286
+ declare function gradientValueToCSS(gradient: GradientValue | null | undefined): string;
287
+ /**
288
+ * Result of background CSS conversion
289
+ * Includes both styles and metadata for consumer components
290
+ */
291
+ interface BackgroundCSSResult {
292
+ /** CSS properties to apply directly */
293
+ styles: React__default.CSSProperties;
294
+ /** Image opacity (0-1) - consumer should apply via wrapper if needed */
295
+ imageOpacity?: number;
296
+ }
297
+ /**
298
+ * Convert BackgroundValue to CSS properties object
299
+ * Returns both styles and metadata for advanced features like image opacity
300
+ */
301
+ declare function backgroundValueToCSS(bg: BackgroundValue | null | undefined): React__default.CSSProperties;
302
+ /**
303
+ * Get image opacity from BackgroundValue (for consumer wrapper components)
304
+ * Returns undefined if no image or opacity is 100%
305
+ */
306
+ declare function getBackgroundImageOpacity(bg: BackgroundValue | null | undefined): number | undefined;
307
+ /**
308
+ * Check if any custom style values are set
309
+ */
310
+ declare function hasCustomStyles(options: {
311
+ backgroundColor?: ColorValue | null;
312
+ textColor?: ColorValue | null;
313
+ padding?: PaddingValue | null;
314
+ margin?: PaddingValue | null;
315
+ border?: BorderValue | null;
316
+ width?: WidthValue | null;
317
+ }): boolean;
318
+ type TransformOrigin = 'center' | 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
319
+ interface TransformValue {
320
+ rotate: number;
321
+ scaleX: number;
322
+ scaleY: number;
323
+ scaleLocked: boolean;
324
+ skewX: number;
325
+ skewY: number;
326
+ translateX: number;
327
+ translateY: number;
328
+ translateUnit: 'px' | 'rem' | '%';
329
+ origin: TransformOrigin;
330
+ enable3D: boolean;
331
+ perspective?: number;
332
+ rotateX?: number;
333
+ rotateY?: number;
334
+ }
335
+ /**
336
+ * Default transform value
337
+ */
338
+ declare const DEFAULT_TRANSFORM: TransformValue;
339
+ /**
340
+ * Convert TransformValue to CSS properties object
341
+ */
342
+ declare function transformValueToCSS(transform: TransformValue | null | undefined): React__default.CSSProperties | undefined;
343
+ type Breakpoint = 'base' | 'sm' | 'md' | 'lg' | 'xl';
344
+ /**
345
+ * Responsive value that can have different values at different breakpoints.
346
+ * Base is required, other breakpoints are optional overrides.
347
+ */
348
+ interface ResponsiveValue<T> {
349
+ base: T;
350
+ sm?: T;
351
+ md?: T;
352
+ lg?: T;
353
+ xl?: T;
354
+ }
355
+ /**
356
+ * Breakpoint configuration with labels and pixel values
357
+ */
358
+ declare const BREAKPOINTS: Array<{
359
+ key: Breakpoint;
360
+ label: string;
361
+ minWidth: number | null;
362
+ }>;
363
+ /**
364
+ * Type guard to check if a value is a ResponsiveValue (has breakpoint structure)
365
+ */
366
+ declare function isResponsiveValue<T>(value: unknown): value is ResponsiveValue<T>;
367
+ /**
368
+ * Converts React.CSSProperties to a CSS string for use in style tags
369
+ */
370
+ declare function cssPropertiesToString(styles: React__default.CSSProperties): string;
371
+ /**
372
+ * Result of converting a responsive value to CSS
373
+ */
374
+ interface ResponsiveCSSResult {
375
+ /** Base styles to apply as inline styles */
376
+ baseStyles: React__default.CSSProperties;
377
+ /** CSS media queries to render in a <style> tag */
378
+ mediaQueryCSS: string;
379
+ }
380
+ /**
381
+ * Converts a ResponsiveValue to CSS with media queries.
382
+ * Works with any value type that has a CSS converter function.
383
+ *
384
+ * @param value - The responsive or non-responsive value
385
+ * @param converter - Function to convert the value type to CSSProperties
386
+ * @param uniqueId - Unique class name for targeting in media queries
387
+ * @returns Object with baseStyles (inline) and mediaQueryCSS (for <style> tag)
388
+ *
389
+ * @example
390
+ * ```tsx
391
+ * const { baseStyles, mediaQueryCSS } = responsiveValueToCSS(
392
+ * dimensions,
393
+ * dimensionsValueToCSS,
394
+ * 'container-abc123'
395
+ * )
396
+ *
397
+ * return (
398
+ * <>
399
+ * {mediaQueryCSS && <style>{mediaQueryCSS}</style>}
400
+ * <div className="container-abc123" style={baseStyles}>...</div>
401
+ * </>
402
+ * )
403
+ * ```
404
+ */
405
+ declare function responsiveValueToCSS<T>(value: ResponsiveValue<T> | T | null | undefined, converter: (v: T) => React__default.CSSProperties | undefined, uniqueId: string): ResponsiveCSSResult;
406
+ /**
407
+ * Visibility value for show/hide per breakpoint
408
+ */
409
+ interface VisibilityValue {
410
+ /** Base visibility - true = visible, false = hidden (default: true) */
411
+ base: boolean;
412
+ /** Override for small screens (640px+) */
413
+ sm?: boolean;
414
+ /** Override for medium screens (768px+) */
415
+ md?: boolean;
416
+ /** Override for large screens (1024px+) */
417
+ lg?: boolean;
418
+ /** Override for extra large screens (1280px+) */
419
+ xl?: boolean;
420
+ }
421
+ /**
422
+ * Default visibility value (visible at all breakpoints)
423
+ */
424
+ declare const DEFAULT_VISIBILITY: VisibilityValue;
425
+ /**
426
+ * Converts a VisibilityValue to CSS with display: none media queries.
427
+ *
428
+ * @param visibility - The visibility settings per breakpoint
429
+ * @param uniqueId - Unique class name for targeting in media queries
430
+ * @returns CSS media queries string for hiding at specific breakpoints
431
+ */
432
+ declare function visibilityValueToCSS(visibility: VisibilityValue | null | undefined, uniqueId: string): string;
433
+ /** Standard CSS easing functions */
434
+ type EasingFunction = 'linear' | 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out';
435
+ /** Advanced easing with spring/bounce effects via cubic-bezier approximations */
436
+ type AdvancedEasingFunction = EasingFunction | 'spring' | 'spring-gentle' | 'bounce' | 'bounce-in' | 'bounce-out' | 'back-in' | 'back-out' | 'back-in-out' | 'elastic';
437
+ /** Map advanced easing to CSS cubic-bezier values */
438
+ declare const EASING_CSS_MAP: Record<AdvancedEasingFunction, string>;
439
+ /** Transform origin for animations (3x3 grid) */
440
+ type AnimationOrigin = 'center' | 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
441
+ /** Stagger direction for child animations */
442
+ type StaggerDirection = 'forward' | 'reverse' | 'center' | 'edges';
443
+ /** Configuration for staggered child animations */
444
+ interface StaggerConfig {
445
+ enabled: boolean;
446
+ /** Delay between each child element (ms) */
447
+ delay: number;
448
+ /** Maximum total delay to prevent very long animations */
449
+ maxDelay?: number;
450
+ /** Direction of stagger effect */
451
+ direction: StaggerDirection;
452
+ }
453
+ /** Animation categories for UI organization */
454
+ type AnimationCategory = 'fade' | 'scale' | 'slide' | 'blur' | 'rotate' | 'bounce' | 'flip' | 'zoom';
455
+ /**
456
+ * Extended entrance animation presets (27 total)
457
+ * Organized by category for the UI dropdown
458
+ */
459
+ type EntranceAnimation = 'none' | 'fade-in' | 'fade-up' | 'fade-down' | 'fade-left' | 'fade-right' | 'fade-scale' | 'scale-in' | 'scale-up' | 'scale-down' | 'scale-out' | 'slide-up' | 'slide-down' | 'slide-left' | 'slide-right' | 'blur-in' | 'blur-up' | 'blur-down' | 'rotate-in' | 'rotate-up' | 'rotate-down' | 'bounce-in' | 'bounce-up' | 'bounce-down' | 'flip-x' | 'flip-y' | 'zoom-in' | 'zoom-out';
460
+ /**
461
+ * Animation presets organized by category for UI
462
+ */
463
+ declare const ANIMATION_CATEGORIES: Array<{
464
+ category: AnimationCategory | 'none';
465
+ label: string;
466
+ animations: EntranceAnimation[];
467
+ }>;
468
+ interface AnimationValue {
469
+ mode: 'preset' | 'custom';
470
+ entrance?: EntranceAnimation;
471
+ entranceDuration?: number;
472
+ entranceDelay?: number;
473
+ /** Distance for translate animations (8-200px) */
474
+ distance?: number;
475
+ /** Starting scale for scale animations (0.1-2) */
476
+ scaleFrom?: number;
477
+ /** Rotation angle for rotate animations (-180 to 180deg) */
478
+ rotateAngle?: number;
479
+ /** Blur amount for blur animations (0-50px) */
480
+ blurAmount?: number;
481
+ origin?: AnimationOrigin;
482
+ easing?: AdvancedEasingFunction;
483
+ stagger?: StaggerConfig;
484
+ duration?: number;
485
+ delay?: number;
486
+ triggerOnScroll?: boolean;
487
+ triggerThreshold?: number;
488
+ triggerOnce?: boolean;
489
+ /** Margin around viewport for earlier/later triggering (e.g., "0px 0px -100px 0px") */
490
+ triggerMargin?: string;
491
+ }
492
+ /**
493
+ * Convert AnimationValue to CSS transition property (for custom mode)
494
+ * Returns undefined for preset mode - use getEntranceAnimationStyles instead
495
+ */
496
+ declare function animationValueToCSS(anim: AnimationValue | null): React__default.CSSProperties | undefined;
497
+ /**
498
+ * Get initial and animate styles for entrance animations
499
+ * Returns inline CSS style objects that work without Tailwind compilation
500
+ * Supports all 27 animation presets with customizable intensity
501
+ */
502
+ declare function getEntranceAnimationStyles(anim: AnimationValue | null): {
503
+ initial: React__default.CSSProperties;
504
+ animate: React__default.CSSProperties;
505
+ duration: number;
506
+ delay: number;
507
+ easing: string;
508
+ origin: string;
509
+ };
510
+ /**
511
+ * Get default easing for animation category
512
+ * Bounce animations default to bounce easing, etc.
513
+ */
514
+ declare function getDefaultEasingForAnimation(entrance: EntranceAnimation): AdvancedEasingFunction;
515
+ /**
516
+ * Get CSS custom properties for animation timing
517
+ * Useful for CSS-only animations with custom properties
518
+ */
519
+ declare function getAnimationCSSVariables(anim: AnimationValue | null): Record<string, string>;
520
+ /**
521
+ * Generate stagger delay for a specific child index
522
+ * Accounts for direction (forward, reverse, center, edges)
523
+ */
524
+ declare function getStaggerDelay(config: StaggerConfig, index: number, totalChildren: number): number;
525
+ /**
526
+ * Generate CSS styles for staggered children
527
+ * Returns an object with CSS custom properties for each child
528
+ */
529
+ declare function generateStaggerStyles(config: StaggerConfig | undefined, totalChildren: number): React__default.CSSProperties[];
530
+ /**
531
+ * Check which intensity controls are relevant for an animation type
532
+ */
533
+ declare function getRelevantIntensityControls(entrance: EntranceAnimation): {
534
+ showDistance: boolean;
535
+ showScale: boolean;
536
+ showRotate: boolean;
537
+ showBlur: boolean;
538
+ };
539
+ /**
540
+ * Default animation value
541
+ */
542
+ declare const DEFAULT_ANIMATION: AnimationValue;
543
+ declare const layoutComponentsDisallow: string[];
544
+
545
+ export { DEFAULT_ANIMATION as $, type AnimationValue as A, type BackgroundValue as B, type ColorValue as C, type DimensionsValue as D, type EasingFunction as E, type AdvancedEasingFunction as F, type GradientValue as G, type EntranceAnimation as H, type AnimationOrigin as I, type AnimationCategory as J, type StaggerDirection as K, animationValueToCSS as L, MediaField as M, getEntranceAnimationStyles as N, getAnimationCSSVariables as O, type PaddingValue as P, getDefaultEasingForAnimation as Q, type ResponsiveValue as R, type StaggerConfig as S, type TransformValue as T, getRelevantIntensityControls as U, type VisibilityValue as V, type WidthValue as W, getStaggerDelay as X, generateStaggerStyles as Y, EASING_CSS_MAP as Z, ANIMATION_CATEGORIES as _, type BorderValue as a, type TransformOrigin as a0, transformValueToCSS as a1, DEFAULT_TRANSFORM as a2, cn as a3, visibilityField as a4, buttonStyleField as a5, buttonVariantField as a6, buttonSizeField as a7, backgroundColorField as a8, textColorField as a9, selfAlignmentMap as aA, flexWrapMap as aB, colorValueToCSS as aC, paddingValueToCSS as aD, marginValueToCSS as aE, borderValueToCSS as aF, widthValueToCSS as aG, getCustomStyleObject as aH, type BackgroundCSSResult as aI, hasCustomStyles as aJ, layoutComponentsDisallow as aK, gapField as aa, shadowField as ab, spacerHeightField as ac, headingLevelField as ad, textSizeField as ae, aspectRatioField as af, dividerStyleField as ag, borderRadiusField as ah, columnsCountField as ai, flexDirectionField as aj, flexWrapField as ak, alignmentMap as al, bgColorMap as am, textColorMap as an, gapMap as ao, shadowMap as ap, spacerHeightMap as aq, headingLevelMap as ar, textSizeMap as as, aspectRatioMap as at, dividerStyleMap as au, borderRadiusMap as av, columnsCountMap as aw, flexDirectionMap as ax, justifyContentMap as ay, alignItemsMap as az, type MediaReference as b, createMediaField as c, dimensionsValueToCSS as d, type DimensionConstraint as e, type DimensionsUnit as f, getDimensionsSummary as g, type DimensionsMode as h, isLegacyWidthValue as i, type ContentAlignment as j, type BackgroundImageValue as k, type BackgroundOverlay as l, migrateWidthValue as m, type GradientStop as n, type GradientMask as o, backgroundValueToCSS as p, gradientValueToCSS as q, getBackgroundImageOpacity as r, type Breakpoint as s, type ResponsiveCSSResult as t, BREAKPOINTS as u, isResponsiveValue as v, responsiveValueToCSS as w, cssPropertiesToString as x, visibilityValueToCSS as y, DEFAULT_VISIBILITY as z };
@@ -0,0 +1,155 @@
1
+ import { T as ThemeConfig, R as ResolvedTheme, B as ButtonVariantStyles, a as BackgroundStyles, C as ColorPreset } from '../types-_6MvjyKv.mjs';
2
+ export { b as ButtonVariantConfig, c as ThemeContextValue } from '../types-_6MvjyKv.mjs';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+ import { ReactNode } from 'react';
5
+
6
+ interface ThemeProviderProps {
7
+ children: ReactNode;
8
+ /** Theme configuration to apply */
9
+ theme?: ThemeConfig;
10
+ }
11
+ /**
12
+ * Provides theme configuration to descendant Puck components
13
+ *
14
+ * @example
15
+ * ```tsx
16
+ * <ThemeProvider theme={{
17
+ * buttonVariants: {
18
+ * default: { classes: 'bg-primary text-white hover:bg-primary/90' }
19
+ * }
20
+ * }}>
21
+ * <PageRenderer data={data} />
22
+ * </ThemeProvider>
23
+ * ```
24
+ */
25
+ declare function ThemeProvider({ children, theme }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
26
+ /**
27
+ * Hook to access the current theme
28
+ *
29
+ * Returns DEFAULT_THEME if no ThemeProvider is present,
30
+ * ensuring components work standalone for backwards compatibility.
31
+ *
32
+ * @example
33
+ * ```tsx
34
+ * function MyComponent() {
35
+ * const theme = useTheme()
36
+ * const buttonClasses = getVariantClasses(theme.buttonVariants, 'primary')
37
+ * return <button className={buttonClasses}>Click me</button>
38
+ * }
39
+ * ```
40
+ */
41
+ declare function useTheme(): ResolvedTheme;
42
+ /**
43
+ * Gets the default theme for server components
44
+ *
45
+ * Use this when you need theme values in a server component
46
+ * where hooks cannot be used.
47
+ */
48
+ declare function getDefaultTheme(): ResolvedTheme;
49
+ /**
50
+ * Hook to check if a ThemeProvider is present
51
+ *
52
+ * Useful for conditional logic based on whether theming is configured.
53
+ */
54
+ declare function useHasThemeProvider(): boolean;
55
+
56
+ /**
57
+ * Default Theme Values
58
+ *
59
+ * These defaults ensure backwards compatibility - components render
60
+ * identically to before theming was introduced when no theme is provided.
61
+ */
62
+
63
+ /**
64
+ * Default button variant styles
65
+ * Uses semantic Tailwind classes that map to CSS variables (--primary, --secondary, etc.)
66
+ * This allows consuming apps to customize colors via their theme CSS variables.
67
+ */
68
+ declare const DEFAULT_BUTTON_VARIANTS: ButtonVariantStyles;
69
+ /**
70
+ * Default CTA button variant styles
71
+ * Uses semantic Tailwind classes that map to CSS variables.
72
+ */
73
+ declare const DEFAULT_CTA_BUTTON_VARIANTS: ButtonVariantStyles;
74
+ /**
75
+ * Default CTA background styles
76
+ * Uses semantic Tailwind classes that map to CSS variables.
77
+ */
78
+ declare const DEFAULT_CTA_BACKGROUND_STYLES: BackgroundStyles;
79
+ /**
80
+ * Default color picker presets
81
+ * Matches DEFAULT_PRESETS from ColorPickerField.tsx
82
+ */
83
+ declare const DEFAULT_COLOR_PRESETS: ColorPreset[];
84
+ /**
85
+ * Default focus ring color class
86
+ * Uses semantic ring color from CSS variables
87
+ */
88
+ declare const DEFAULT_FOCUS_RING = "focus:ring-ring";
89
+ /**
90
+ * Complete default theme
91
+ * Used when no ThemeProvider is present or no theme config is provided
92
+ */
93
+ declare const DEFAULT_THEME: ResolvedTheme;
94
+
95
+ /**
96
+ * Theme Resolution Utilities
97
+ *
98
+ * Functions for merging user-provided theme config with defaults
99
+ * and safely accessing theme values.
100
+ */
101
+
102
+ /**
103
+ * Merges user-provided theme config with defaults to create a fully resolved theme
104
+ */
105
+ declare function resolveTheme(config?: ThemeConfig): ResolvedTheme;
106
+ /**
107
+ * Safely gets variant classes from a variant styles object
108
+ *
109
+ * @param variants - The button variant styles object
110
+ * @param variant - The variant key to look up
111
+ * @param fallback - Fallback variant key if the requested variant doesn't exist
112
+ * @returns The CSS classes string for the variant
113
+ */
114
+ declare function getVariantClasses(variants: ButtonVariantStyles, variant: string, fallback?: string): string;
115
+ /**
116
+ * Safely gets background style classes
117
+ *
118
+ * @param styles - The background styles object
119
+ * @param style - The style key to look up
120
+ * @param fallback - Fallback style key if the requested style doesn't exist
121
+ * @returns The CSS classes string for the background
122
+ */
123
+ declare function getBackgroundClasses(styles: BackgroundStyles, style: string, fallback?: string): string;
124
+
125
+ /**
126
+ * Example Theme Configuration
127
+ *
128
+ * Copy this file to your project and customize it to match your design system.
129
+ *
130
+ * Usage:
131
+ * 1. Copy this file to your project (e.g., src/lib/puck-theme.ts)
132
+ * 2. Customize the values to match your CSS variables/design tokens
133
+ * 3. Import and pass to PageRenderer or PuckEditor:
134
+ *
135
+ * ```tsx
136
+ * import { puckTheme } from '@/lib/puck-theme'
137
+ *
138
+ * <PageRenderer data={data} config={config} theme={puckTheme} />
139
+ * ```
140
+ */
141
+
142
+ /**
143
+ * Example theme using shadcn/ui CSS variables
144
+ *
145
+ * This example assumes you have CSS variables like:
146
+ * --primary, --primary-foreground
147
+ * --secondary, --secondary-foreground
148
+ * --accent, --accent-foreground
149
+ * --muted, --muted-foreground
150
+ * --destructive, --destructive-foreground
151
+ * --ring (for focus rings)
152
+ */
153
+ declare const exampleTheme: ThemeConfig;
154
+
155
+ export { BackgroundStyles, ButtonVariantStyles, ColorPreset, DEFAULT_BUTTON_VARIANTS, DEFAULT_COLOR_PRESETS, DEFAULT_CTA_BACKGROUND_STYLES, DEFAULT_CTA_BUTTON_VARIANTS, DEFAULT_FOCUS_RING, DEFAULT_THEME, ResolvedTheme, ThemeConfig, ThemeProvider, type ThemeProviderProps, exampleTheme, getBackgroundClasses, getDefaultTheme, getVariantClasses, resolveTheme, useHasThemeProvider, useTheme };