@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.
- package/LICENSE +73 -0
- package/README.md +1580 -0
- package/dist/AccordionClient.d.mts +24 -0
- package/dist/AccordionClient.d.ts +24 -0
- package/dist/AccordionClient.js +786 -0
- package/dist/AccordionClient.js.map +1 -0
- package/dist/AccordionClient.mjs +784 -0
- package/dist/AccordionClient.mjs.map +1 -0
- package/dist/AnimatedWrapper.d.mts +30 -0
- package/dist/AnimatedWrapper.d.ts +30 -0
- package/dist/AnimatedWrapper.js +379 -0
- package/dist/AnimatedWrapper.js.map +1 -0
- package/dist/AnimatedWrapper.mjs +377 -0
- package/dist/AnimatedWrapper.mjs.map +1 -0
- package/dist/admin/client.d.mts +108 -0
- package/dist/admin/client.d.ts +108 -0
- package/dist/admin/client.js +177 -0
- package/dist/admin/client.js.map +1 -0
- package/dist/admin/client.mjs +173 -0
- package/dist/admin/client.mjs.map +1 -0
- package/dist/admin/index.d.mts +157 -0
- package/dist/admin/index.d.ts +157 -0
- package/dist/admin/index.js +31 -0
- package/dist/admin/index.js.map +1 -0
- package/dist/admin/index.mjs +29 -0
- package/dist/admin/index.mjs.map +1 -0
- package/dist/api/index.d.mts +460 -0
- package/dist/api/index.d.ts +460 -0
- package/dist/api/index.js +588 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/index.mjs +578 -0
- package/dist/api/index.mjs.map +1 -0
- package/dist/components/index.css +339 -0
- package/dist/components/index.css.map +1 -0
- package/dist/components/index.d.mts +222 -0
- package/dist/components/index.d.ts +222 -0
- package/dist/components/index.js +9177 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index.mjs +9130 -0
- package/dist/components/index.mjs.map +1 -0
- package/dist/config/config.editor.css +339 -0
- package/dist/config/config.editor.css.map +1 -0
- package/dist/config/config.editor.d.mts +153 -0
- package/dist/config/config.editor.d.ts +153 -0
- package/dist/config/config.editor.js +9400 -0
- package/dist/config/config.editor.js.map +1 -0
- package/dist/config/config.editor.mjs +9368 -0
- package/dist/config/config.editor.mjs.map +1 -0
- package/dist/config/index.d.mts +68 -0
- package/dist/config/index.d.ts +68 -0
- package/dist/config/index.js +2017 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/index.mjs +1991 -0
- package/dist/config/index.mjs.map +1 -0
- package/dist/editor/index.d.mts +784 -0
- package/dist/editor/index.d.ts +784 -0
- package/dist/editor/index.js +4517 -0
- package/dist/editor/index.js.map +1 -0
- package/dist/editor/index.mjs +4483 -0
- package/dist/editor/index.mjs.map +1 -0
- package/dist/fields/index.css +339 -0
- package/dist/fields/index.css.map +1 -0
- package/dist/fields/index.d.mts +600 -0
- package/dist/fields/index.d.ts +600 -0
- package/dist/fields/index.js +7739 -0
- package/dist/fields/index.js.map +1 -0
- package/dist/fields/index.mjs +7590 -0
- package/dist/fields/index.mjs.map +1 -0
- package/dist/index-CQu6SzDg.d.mts +327 -0
- package/dist/index-CoUQnyC3.d.ts +327 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +569 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +555 -0
- package/dist/index.mjs.map +1 -0
- package/dist/layouts/index.d.mts +96 -0
- package/dist/layouts/index.d.ts +96 -0
- package/dist/layouts/index.js +394 -0
- package/dist/layouts/index.js.map +1 -0
- package/dist/layouts/index.mjs +378 -0
- package/dist/layouts/index.mjs.map +1 -0
- package/dist/plugin/index.d.mts +289 -0
- package/dist/plugin/index.d.ts +289 -0
- package/dist/plugin/index.js +569 -0
- package/dist/plugin/index.js.map +1 -0
- package/dist/plugin/index.mjs +555 -0
- package/dist/plugin/index.mjs.map +1 -0
- package/dist/render/index.d.mts +109 -0
- package/dist/render/index.d.ts +109 -0
- package/dist/render/index.js +2146 -0
- package/dist/render/index.js.map +1 -0
- package/dist/render/index.mjs +2123 -0
- package/dist/render/index.mjs.map +1 -0
- package/dist/shared-DMAF1AcH.d.mts +545 -0
- package/dist/shared-DMAF1AcH.d.ts +545 -0
- package/dist/theme/index.d.mts +155 -0
- package/dist/theme/index.d.ts +155 -0
- package/dist/theme/index.js +201 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/theme/index.mjs +186 -0
- package/dist/theme/index.mjs.map +1 -0
- package/dist/types-D7D3rZ1J.d.mts +116 -0
- package/dist/types-D7D3rZ1J.d.ts +116 -0
- package/dist/types-_6MvjyKv.d.mts +104 -0
- package/dist/types-_6MvjyKv.d.ts +104 -0
- package/dist/utils/index.d.mts +267 -0
- package/dist/utils/index.d.ts +267 -0
- package/dist/utils/index.js +426 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/index.mjs +412 -0
- package/dist/utils/index.mjs.map +1 -0
- package/dist/utils-DaRs9t0J.d.mts +85 -0
- package/dist/utils-gAvt0Vhw.d.ts +85 -0
- package/examples/README.md +240 -0
- package/examples/api/puck/pages/[id]/route.ts +64 -0
- package/examples/api/puck/pages/[id]/versions/route.ts +47 -0
- package/examples/api/puck/pages/route.ts +45 -0
- package/examples/app/(frontend)/page.tsx +94 -0
- package/examples/app/[...slug]/page.tsx +101 -0
- package/examples/app/pages/[id]/edit/page.tsx +148 -0
- package/examples/components/CustomBanner.tsx +368 -0
- package/examples/config/custom-config.ts +223 -0
- package/examples/config/payload.config.example.ts +64 -0
- package/examples/lib/puck-layouts.ts +258 -0
- package/examples/lib/puck-theme.ts +94 -0
- package/examples/styles/puck-theme.css +171 -0
- package/package.json +157 -0
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import { CollectionConfig, Access, Field } from 'payload';
|
|
2
|
+
import { Data, Config } from '@measured/puck';
|
|
3
|
+
import { L as LayoutDefinition } from './types-D7D3rZ1J.mjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Theme Type Definitions
|
|
7
|
+
*
|
|
8
|
+
* Defines all theme-related TypeScript interfaces for the payload-puck plugin.
|
|
9
|
+
* These types enable consuming applications to customize button variants,
|
|
10
|
+
* color presets, and other visual styles.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Configuration for a single button variant
|
|
14
|
+
*/
|
|
15
|
+
interface ButtonVariantConfig {
|
|
16
|
+
/** Tailwind classes for the variant */
|
|
17
|
+
classes: string;
|
|
18
|
+
/** Optional CSS variable reference for dynamic theming */
|
|
19
|
+
cssVariable?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Map of button variant names to their configurations
|
|
23
|
+
*/
|
|
24
|
+
interface ButtonVariantStyles {
|
|
25
|
+
default?: ButtonVariantConfig;
|
|
26
|
+
primary?: ButtonVariantConfig;
|
|
27
|
+
secondary?: ButtonVariantConfig;
|
|
28
|
+
outline?: ButtonVariantConfig;
|
|
29
|
+
ghost?: ButtonVariantConfig;
|
|
30
|
+
destructive?: ButtonVariantConfig;
|
|
31
|
+
link?: ButtonVariantConfig;
|
|
32
|
+
[key: string]: ButtonVariantConfig | undefined;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Color preset for the color picker
|
|
36
|
+
*/
|
|
37
|
+
interface ColorPreset {
|
|
38
|
+
/** Hex color value (e.g., '#3b82f6') */
|
|
39
|
+
hex: string;
|
|
40
|
+
/** Display label for the preset */
|
|
41
|
+
label: string;
|
|
42
|
+
/** Optional CSS variable reference (e.g., 'var(--color-primary)') */
|
|
43
|
+
cssVariable?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Background style configurations for CTA components
|
|
47
|
+
*/
|
|
48
|
+
interface BackgroundStyles {
|
|
49
|
+
default?: string;
|
|
50
|
+
dark?: string;
|
|
51
|
+
light?: string;
|
|
52
|
+
[key: string]: string | undefined;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Theme configuration provided by consuming applications
|
|
56
|
+
* All properties are optional and will be merged with defaults
|
|
57
|
+
*/
|
|
58
|
+
interface ThemeConfig {
|
|
59
|
+
/**
|
|
60
|
+
* Button variant styles
|
|
61
|
+
* Merged with default button variants
|
|
62
|
+
*/
|
|
63
|
+
buttonVariants?: Partial<ButtonVariantStyles>;
|
|
64
|
+
/**
|
|
65
|
+
* CTA button variant styles
|
|
66
|
+
* Merged with default CTA button variants
|
|
67
|
+
*/
|
|
68
|
+
ctaButtonVariants?: Partial<ButtonVariantStyles>;
|
|
69
|
+
/**
|
|
70
|
+
* CTA background styles
|
|
71
|
+
* Merged with default background styles
|
|
72
|
+
*/
|
|
73
|
+
ctaBackgroundStyles?: Partial<BackgroundStyles>;
|
|
74
|
+
/**
|
|
75
|
+
* Color picker preset colors
|
|
76
|
+
* If provided, replaces defaults unless extendColorPresets is true
|
|
77
|
+
*/
|
|
78
|
+
colorPresets?: ColorPreset[];
|
|
79
|
+
/**
|
|
80
|
+
* Whether to extend default color presets (true) or replace them (false)
|
|
81
|
+
* @default false
|
|
82
|
+
*/
|
|
83
|
+
extendColorPresets?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Focus ring color class (e.g., 'focus:ring-primary')
|
|
86
|
+
* @default 'focus:ring-blue-500'
|
|
87
|
+
*/
|
|
88
|
+
focusRingColor?: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Admin UI configuration for the Puck plugin
|
|
93
|
+
*/
|
|
94
|
+
interface PuckAdminConfig {
|
|
95
|
+
/**
|
|
96
|
+
* Whether to add the visual editor button to the collection
|
|
97
|
+
* @default true
|
|
98
|
+
*/
|
|
99
|
+
addEditButton?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* URL pattern for the Puck editor page (outside of Payload admin)
|
|
102
|
+
* Use {id} as placeholder for document ID
|
|
103
|
+
* @default '/pages/{id}/edit'
|
|
104
|
+
*/
|
|
105
|
+
editorPathPattern?: string;
|
|
106
|
+
/**
|
|
107
|
+
* Button label text
|
|
108
|
+
* @default 'Edit with Puck'
|
|
109
|
+
*/
|
|
110
|
+
buttonLabel?: string;
|
|
111
|
+
/**
|
|
112
|
+
* Position of the edit button in admin sidebar
|
|
113
|
+
* @default 'sidebar'
|
|
114
|
+
*/
|
|
115
|
+
buttonPosition?: 'sidebar' | 'main';
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Configuration options for the Puck plugin
|
|
119
|
+
*/
|
|
120
|
+
interface PuckPluginOptions {
|
|
121
|
+
/**
|
|
122
|
+
* Collection slug for pages
|
|
123
|
+
* @default 'pages'
|
|
124
|
+
*/
|
|
125
|
+
pagesCollection?: string;
|
|
126
|
+
/**
|
|
127
|
+
* Whether to auto-generate the Pages collection
|
|
128
|
+
* Set to false if you want to define your own collection
|
|
129
|
+
* @default true
|
|
130
|
+
*/
|
|
131
|
+
autoGenerateCollection?: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Custom collection config to merge with defaults
|
|
134
|
+
*/
|
|
135
|
+
collectionOverrides?: Partial<CollectionConfig>;
|
|
136
|
+
/**
|
|
137
|
+
* Access control for Puck operations
|
|
138
|
+
* Uses Payload's Access type for full compatibility
|
|
139
|
+
*/
|
|
140
|
+
access?: {
|
|
141
|
+
read?: Access;
|
|
142
|
+
create?: Access;
|
|
143
|
+
update?: Access;
|
|
144
|
+
delete?: Access;
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Page layout configuration
|
|
148
|
+
* Define custom layouts that affect how page content is rendered
|
|
149
|
+
* @default DEFAULT_LAYOUTS
|
|
150
|
+
*/
|
|
151
|
+
layouts?: LayoutDefinition[];
|
|
152
|
+
/**
|
|
153
|
+
* Additional fields to add to the Pages collection
|
|
154
|
+
*/
|
|
155
|
+
additionalFields?: Field[];
|
|
156
|
+
/**
|
|
157
|
+
* Admin UI configuration
|
|
158
|
+
* Configure how the visual editor integrates with Payload admin
|
|
159
|
+
*/
|
|
160
|
+
admin?: PuckAdminConfig;
|
|
161
|
+
/**
|
|
162
|
+
* Theme configuration for customizing button styles, colors, and presets
|
|
163
|
+
* All values are optional and will fall back to defaults
|
|
164
|
+
*/
|
|
165
|
+
theme?: ThemeConfig;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Root properties for a Puck page
|
|
169
|
+
*/
|
|
170
|
+
interface PuckRootProps {
|
|
171
|
+
title?: string;
|
|
172
|
+
pageLayout?: string;
|
|
173
|
+
[key: string]: unknown;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Complete Puck page data structure
|
|
177
|
+
*/
|
|
178
|
+
interface PuckPageData extends Data {
|
|
179
|
+
root: {
|
|
180
|
+
props: PuckRootProps;
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* SEO/Meta configuration for a page.
|
|
185
|
+
* Uses the official @payloadcms/plugin-seo convention.
|
|
186
|
+
*/
|
|
187
|
+
interface PageMeta {
|
|
188
|
+
title?: string;
|
|
189
|
+
description?: string;
|
|
190
|
+
image?: string | {
|
|
191
|
+
id: string;
|
|
192
|
+
url: string;
|
|
193
|
+
alt?: string;
|
|
194
|
+
};
|
|
195
|
+
noindex?: boolean;
|
|
196
|
+
nofollow?: boolean;
|
|
197
|
+
excludeFromSitemap?: boolean;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* @deprecated Use PageMeta instead. This alias is kept for backwards compatibility.
|
|
201
|
+
*/
|
|
202
|
+
type PageSEO = PageMeta;
|
|
203
|
+
/**
|
|
204
|
+
* Conversion type options
|
|
205
|
+
*/
|
|
206
|
+
type ConversionType = 'lead' | 'registration' | 'purchase' | 'donation' | 'newsletter' | 'contact' | 'custom';
|
|
207
|
+
/**
|
|
208
|
+
* Conversion tracking configuration for a page
|
|
209
|
+
*/
|
|
210
|
+
interface PageConversionTracking {
|
|
211
|
+
isConversionPage?: boolean;
|
|
212
|
+
conversionType?: ConversionType;
|
|
213
|
+
conversionValue?: number;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Editor version options
|
|
217
|
+
*/
|
|
218
|
+
type EditorVersion = 'legacy' | 'puck';
|
|
219
|
+
/**
|
|
220
|
+
* Page document from Payload
|
|
221
|
+
*/
|
|
222
|
+
interface PageDocument {
|
|
223
|
+
id: string;
|
|
224
|
+
title: string;
|
|
225
|
+
slug: string;
|
|
226
|
+
pageLayout: string;
|
|
227
|
+
editorVersion?: EditorVersion;
|
|
228
|
+
isHomepage: boolean;
|
|
229
|
+
puckData: PuckPageData | null;
|
|
230
|
+
meta?: PageMeta;
|
|
231
|
+
conversionTracking?: PageConversionTracking;
|
|
232
|
+
createdAt: string;
|
|
233
|
+
updatedAt: string;
|
|
234
|
+
_status?: 'draft' | 'published';
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Shared props for all Puck components
|
|
238
|
+
*/
|
|
239
|
+
interface SharedComponentProps {
|
|
240
|
+
id?: string;
|
|
241
|
+
maxWidth?: 'narrow' | 'medium' | 'wide' | 'full';
|
|
242
|
+
verticalPadding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
243
|
+
visibility?: 'always' | 'authenticated' | 'guest';
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Media object from Payload
|
|
247
|
+
*/
|
|
248
|
+
interface MediaObject {
|
|
249
|
+
id: string;
|
|
250
|
+
url: string;
|
|
251
|
+
alt?: string;
|
|
252
|
+
width?: number;
|
|
253
|
+
height?: number;
|
|
254
|
+
filename?: string;
|
|
255
|
+
mimeType?: string;
|
|
256
|
+
sizes?: {
|
|
257
|
+
thumbnail?: {
|
|
258
|
+
url: string;
|
|
259
|
+
width: number;
|
|
260
|
+
height: number;
|
|
261
|
+
};
|
|
262
|
+
medium?: {
|
|
263
|
+
url: string;
|
|
264
|
+
width: number;
|
|
265
|
+
height: number;
|
|
266
|
+
};
|
|
267
|
+
large?: {
|
|
268
|
+
url: string;
|
|
269
|
+
width: number;
|
|
270
|
+
height: number;
|
|
271
|
+
};
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Options for merging Puck configurations
|
|
276
|
+
*/
|
|
277
|
+
interface MergeConfigOptions {
|
|
278
|
+
/**
|
|
279
|
+
* Base config to extend
|
|
280
|
+
*/
|
|
281
|
+
base: Config;
|
|
282
|
+
/**
|
|
283
|
+
* Additional components to add
|
|
284
|
+
*/
|
|
285
|
+
components?: Config['components'];
|
|
286
|
+
/**
|
|
287
|
+
* Additional categories to add/merge
|
|
288
|
+
*/
|
|
289
|
+
categories?: Config['categories'];
|
|
290
|
+
/**
|
|
291
|
+
* Root config overrides
|
|
292
|
+
*/
|
|
293
|
+
root?: Partial<Config['root']>;
|
|
294
|
+
/**
|
|
295
|
+
* Components to exclude from base
|
|
296
|
+
*/
|
|
297
|
+
exclude?: string[];
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Props for the MediaField custom field
|
|
301
|
+
*/
|
|
302
|
+
interface MediaFieldProps {
|
|
303
|
+
value: MediaObject | string | null;
|
|
304
|
+
onChange: (value: MediaObject | string | null) => void;
|
|
305
|
+
label?: string;
|
|
306
|
+
allowedTypes?: string[];
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Props for the ColorPickerField custom field
|
|
310
|
+
*/
|
|
311
|
+
interface ColorPickerFieldProps {
|
|
312
|
+
value: string;
|
|
313
|
+
onChange: (value: string) => void;
|
|
314
|
+
label?: string;
|
|
315
|
+
showOpacity?: boolean;
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Props for the TiptapField custom field
|
|
319
|
+
*/
|
|
320
|
+
interface TiptapFieldProps {
|
|
321
|
+
value: string;
|
|
322
|
+
onChange: (value: string) => void;
|
|
323
|
+
label?: string;
|
|
324
|
+
readOnly?: boolean;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
export type { ConversionType as C, EditorVersion as E, MediaObject as M, PuckPageData as P, SharedComponentProps as S, TiptapFieldProps as T, PuckRootProps as a, MergeConfigOptions as b, PuckPluginOptions as c, PuckAdminConfig as d, PageMeta as e, PageSEO as f, PageConversionTracking as g, PageDocument as h, MediaFieldProps as i, ColorPickerFieldProps as j, ThemeConfig as k };
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import { CollectionConfig, Access, Field } from 'payload';
|
|
2
|
+
import { Data, Config } from '@measured/puck';
|
|
3
|
+
import { L as LayoutDefinition } from './types-D7D3rZ1J.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Theme Type Definitions
|
|
7
|
+
*
|
|
8
|
+
* Defines all theme-related TypeScript interfaces for the payload-puck plugin.
|
|
9
|
+
* These types enable consuming applications to customize button variants,
|
|
10
|
+
* color presets, and other visual styles.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Configuration for a single button variant
|
|
14
|
+
*/
|
|
15
|
+
interface ButtonVariantConfig {
|
|
16
|
+
/** Tailwind classes for the variant */
|
|
17
|
+
classes: string;
|
|
18
|
+
/** Optional CSS variable reference for dynamic theming */
|
|
19
|
+
cssVariable?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Map of button variant names to their configurations
|
|
23
|
+
*/
|
|
24
|
+
interface ButtonVariantStyles {
|
|
25
|
+
default?: ButtonVariantConfig;
|
|
26
|
+
primary?: ButtonVariantConfig;
|
|
27
|
+
secondary?: ButtonVariantConfig;
|
|
28
|
+
outline?: ButtonVariantConfig;
|
|
29
|
+
ghost?: ButtonVariantConfig;
|
|
30
|
+
destructive?: ButtonVariantConfig;
|
|
31
|
+
link?: ButtonVariantConfig;
|
|
32
|
+
[key: string]: ButtonVariantConfig | undefined;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Color preset for the color picker
|
|
36
|
+
*/
|
|
37
|
+
interface ColorPreset {
|
|
38
|
+
/** Hex color value (e.g., '#3b82f6') */
|
|
39
|
+
hex: string;
|
|
40
|
+
/** Display label for the preset */
|
|
41
|
+
label: string;
|
|
42
|
+
/** Optional CSS variable reference (e.g., 'var(--color-primary)') */
|
|
43
|
+
cssVariable?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Background style configurations for CTA components
|
|
47
|
+
*/
|
|
48
|
+
interface BackgroundStyles {
|
|
49
|
+
default?: string;
|
|
50
|
+
dark?: string;
|
|
51
|
+
light?: string;
|
|
52
|
+
[key: string]: string | undefined;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Theme configuration provided by consuming applications
|
|
56
|
+
* All properties are optional and will be merged with defaults
|
|
57
|
+
*/
|
|
58
|
+
interface ThemeConfig {
|
|
59
|
+
/**
|
|
60
|
+
* Button variant styles
|
|
61
|
+
* Merged with default button variants
|
|
62
|
+
*/
|
|
63
|
+
buttonVariants?: Partial<ButtonVariantStyles>;
|
|
64
|
+
/**
|
|
65
|
+
* CTA button variant styles
|
|
66
|
+
* Merged with default CTA button variants
|
|
67
|
+
*/
|
|
68
|
+
ctaButtonVariants?: Partial<ButtonVariantStyles>;
|
|
69
|
+
/**
|
|
70
|
+
* CTA background styles
|
|
71
|
+
* Merged with default background styles
|
|
72
|
+
*/
|
|
73
|
+
ctaBackgroundStyles?: Partial<BackgroundStyles>;
|
|
74
|
+
/**
|
|
75
|
+
* Color picker preset colors
|
|
76
|
+
* If provided, replaces defaults unless extendColorPresets is true
|
|
77
|
+
*/
|
|
78
|
+
colorPresets?: ColorPreset[];
|
|
79
|
+
/**
|
|
80
|
+
* Whether to extend default color presets (true) or replace them (false)
|
|
81
|
+
* @default false
|
|
82
|
+
*/
|
|
83
|
+
extendColorPresets?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Focus ring color class (e.g., 'focus:ring-primary')
|
|
86
|
+
* @default 'focus:ring-blue-500'
|
|
87
|
+
*/
|
|
88
|
+
focusRingColor?: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Admin UI configuration for the Puck plugin
|
|
93
|
+
*/
|
|
94
|
+
interface PuckAdminConfig {
|
|
95
|
+
/**
|
|
96
|
+
* Whether to add the visual editor button to the collection
|
|
97
|
+
* @default true
|
|
98
|
+
*/
|
|
99
|
+
addEditButton?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* URL pattern for the Puck editor page (outside of Payload admin)
|
|
102
|
+
* Use {id} as placeholder for document ID
|
|
103
|
+
* @default '/pages/{id}/edit'
|
|
104
|
+
*/
|
|
105
|
+
editorPathPattern?: string;
|
|
106
|
+
/**
|
|
107
|
+
* Button label text
|
|
108
|
+
* @default 'Edit with Puck'
|
|
109
|
+
*/
|
|
110
|
+
buttonLabel?: string;
|
|
111
|
+
/**
|
|
112
|
+
* Position of the edit button in admin sidebar
|
|
113
|
+
* @default 'sidebar'
|
|
114
|
+
*/
|
|
115
|
+
buttonPosition?: 'sidebar' | 'main';
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Configuration options for the Puck plugin
|
|
119
|
+
*/
|
|
120
|
+
interface PuckPluginOptions {
|
|
121
|
+
/**
|
|
122
|
+
* Collection slug for pages
|
|
123
|
+
* @default 'pages'
|
|
124
|
+
*/
|
|
125
|
+
pagesCollection?: string;
|
|
126
|
+
/**
|
|
127
|
+
* Whether to auto-generate the Pages collection
|
|
128
|
+
* Set to false if you want to define your own collection
|
|
129
|
+
* @default true
|
|
130
|
+
*/
|
|
131
|
+
autoGenerateCollection?: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Custom collection config to merge with defaults
|
|
134
|
+
*/
|
|
135
|
+
collectionOverrides?: Partial<CollectionConfig>;
|
|
136
|
+
/**
|
|
137
|
+
* Access control for Puck operations
|
|
138
|
+
* Uses Payload's Access type for full compatibility
|
|
139
|
+
*/
|
|
140
|
+
access?: {
|
|
141
|
+
read?: Access;
|
|
142
|
+
create?: Access;
|
|
143
|
+
update?: Access;
|
|
144
|
+
delete?: Access;
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Page layout configuration
|
|
148
|
+
* Define custom layouts that affect how page content is rendered
|
|
149
|
+
* @default DEFAULT_LAYOUTS
|
|
150
|
+
*/
|
|
151
|
+
layouts?: LayoutDefinition[];
|
|
152
|
+
/**
|
|
153
|
+
* Additional fields to add to the Pages collection
|
|
154
|
+
*/
|
|
155
|
+
additionalFields?: Field[];
|
|
156
|
+
/**
|
|
157
|
+
* Admin UI configuration
|
|
158
|
+
* Configure how the visual editor integrates with Payload admin
|
|
159
|
+
*/
|
|
160
|
+
admin?: PuckAdminConfig;
|
|
161
|
+
/**
|
|
162
|
+
* Theme configuration for customizing button styles, colors, and presets
|
|
163
|
+
* All values are optional and will fall back to defaults
|
|
164
|
+
*/
|
|
165
|
+
theme?: ThemeConfig;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Root properties for a Puck page
|
|
169
|
+
*/
|
|
170
|
+
interface PuckRootProps {
|
|
171
|
+
title?: string;
|
|
172
|
+
pageLayout?: string;
|
|
173
|
+
[key: string]: unknown;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Complete Puck page data structure
|
|
177
|
+
*/
|
|
178
|
+
interface PuckPageData extends Data {
|
|
179
|
+
root: {
|
|
180
|
+
props: PuckRootProps;
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* SEO/Meta configuration for a page.
|
|
185
|
+
* Uses the official @payloadcms/plugin-seo convention.
|
|
186
|
+
*/
|
|
187
|
+
interface PageMeta {
|
|
188
|
+
title?: string;
|
|
189
|
+
description?: string;
|
|
190
|
+
image?: string | {
|
|
191
|
+
id: string;
|
|
192
|
+
url: string;
|
|
193
|
+
alt?: string;
|
|
194
|
+
};
|
|
195
|
+
noindex?: boolean;
|
|
196
|
+
nofollow?: boolean;
|
|
197
|
+
excludeFromSitemap?: boolean;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* @deprecated Use PageMeta instead. This alias is kept for backwards compatibility.
|
|
201
|
+
*/
|
|
202
|
+
type PageSEO = PageMeta;
|
|
203
|
+
/**
|
|
204
|
+
* Conversion type options
|
|
205
|
+
*/
|
|
206
|
+
type ConversionType = 'lead' | 'registration' | 'purchase' | 'donation' | 'newsletter' | 'contact' | 'custom';
|
|
207
|
+
/**
|
|
208
|
+
* Conversion tracking configuration for a page
|
|
209
|
+
*/
|
|
210
|
+
interface PageConversionTracking {
|
|
211
|
+
isConversionPage?: boolean;
|
|
212
|
+
conversionType?: ConversionType;
|
|
213
|
+
conversionValue?: number;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Editor version options
|
|
217
|
+
*/
|
|
218
|
+
type EditorVersion = 'legacy' | 'puck';
|
|
219
|
+
/**
|
|
220
|
+
* Page document from Payload
|
|
221
|
+
*/
|
|
222
|
+
interface PageDocument {
|
|
223
|
+
id: string;
|
|
224
|
+
title: string;
|
|
225
|
+
slug: string;
|
|
226
|
+
pageLayout: string;
|
|
227
|
+
editorVersion?: EditorVersion;
|
|
228
|
+
isHomepage: boolean;
|
|
229
|
+
puckData: PuckPageData | null;
|
|
230
|
+
meta?: PageMeta;
|
|
231
|
+
conversionTracking?: PageConversionTracking;
|
|
232
|
+
createdAt: string;
|
|
233
|
+
updatedAt: string;
|
|
234
|
+
_status?: 'draft' | 'published';
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Shared props for all Puck components
|
|
238
|
+
*/
|
|
239
|
+
interface SharedComponentProps {
|
|
240
|
+
id?: string;
|
|
241
|
+
maxWidth?: 'narrow' | 'medium' | 'wide' | 'full';
|
|
242
|
+
verticalPadding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
243
|
+
visibility?: 'always' | 'authenticated' | 'guest';
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Media object from Payload
|
|
247
|
+
*/
|
|
248
|
+
interface MediaObject {
|
|
249
|
+
id: string;
|
|
250
|
+
url: string;
|
|
251
|
+
alt?: string;
|
|
252
|
+
width?: number;
|
|
253
|
+
height?: number;
|
|
254
|
+
filename?: string;
|
|
255
|
+
mimeType?: string;
|
|
256
|
+
sizes?: {
|
|
257
|
+
thumbnail?: {
|
|
258
|
+
url: string;
|
|
259
|
+
width: number;
|
|
260
|
+
height: number;
|
|
261
|
+
};
|
|
262
|
+
medium?: {
|
|
263
|
+
url: string;
|
|
264
|
+
width: number;
|
|
265
|
+
height: number;
|
|
266
|
+
};
|
|
267
|
+
large?: {
|
|
268
|
+
url: string;
|
|
269
|
+
width: number;
|
|
270
|
+
height: number;
|
|
271
|
+
};
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Options for merging Puck configurations
|
|
276
|
+
*/
|
|
277
|
+
interface MergeConfigOptions {
|
|
278
|
+
/**
|
|
279
|
+
* Base config to extend
|
|
280
|
+
*/
|
|
281
|
+
base: Config;
|
|
282
|
+
/**
|
|
283
|
+
* Additional components to add
|
|
284
|
+
*/
|
|
285
|
+
components?: Config['components'];
|
|
286
|
+
/**
|
|
287
|
+
* Additional categories to add/merge
|
|
288
|
+
*/
|
|
289
|
+
categories?: Config['categories'];
|
|
290
|
+
/**
|
|
291
|
+
* Root config overrides
|
|
292
|
+
*/
|
|
293
|
+
root?: Partial<Config['root']>;
|
|
294
|
+
/**
|
|
295
|
+
* Components to exclude from base
|
|
296
|
+
*/
|
|
297
|
+
exclude?: string[];
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Props for the MediaField custom field
|
|
301
|
+
*/
|
|
302
|
+
interface MediaFieldProps {
|
|
303
|
+
value: MediaObject | string | null;
|
|
304
|
+
onChange: (value: MediaObject | string | null) => void;
|
|
305
|
+
label?: string;
|
|
306
|
+
allowedTypes?: string[];
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Props for the ColorPickerField custom field
|
|
310
|
+
*/
|
|
311
|
+
interface ColorPickerFieldProps {
|
|
312
|
+
value: string;
|
|
313
|
+
onChange: (value: string) => void;
|
|
314
|
+
label?: string;
|
|
315
|
+
showOpacity?: boolean;
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Props for the TiptapField custom field
|
|
319
|
+
*/
|
|
320
|
+
interface TiptapFieldProps {
|
|
321
|
+
value: string;
|
|
322
|
+
onChange: (value: string) => void;
|
|
323
|
+
label?: string;
|
|
324
|
+
readOnly?: boolean;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
export type { ConversionType as C, EditorVersion as E, MediaObject as M, PuckPageData as P, SharedComponentProps as S, TiptapFieldProps as T, PuckRootProps as a, MergeConfigOptions as b, PuckPluginOptions as c, PuckAdminConfig as d, PageMeta as e, PageSEO as f, PageConversionTracking as g, PageDocument as h, MediaFieldProps as i, ColorPickerFieldProps as j, ThemeConfig as k };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { j as ColorPickerFieldProps, C as ConversionType, E as EditorVersion, i as MediaFieldProps, M as MediaObject, b as MergeConfigOptions, g as PageConversionTracking, h as PageDocument, e as PageMeta, f as PageSEO, d as PuckAdminConfig, P as PuckPageData, c as PuckPluginOptions, a as PuckRootProps, S as SharedComponentProps, k as ThemeConfig, T as TiptapFieldProps } from './index-CQu6SzDg.mjs';
|
|
2
|
+
export { GetPuckFieldsOptions, TemplatesCollection, conversionFieldGroup, createEditorVersionField, createPageLayoutField, createPuckPlugin, editorVersionField, generatePagesCollection, generatePuckEditField, getPuckFields, isHomepageField, pageLayoutField, puckDataField, seoFieldGroup } from './plugin/index.mjs';
|
|
3
|
+
export { Config as PuckConfig, Data as PuckData } from '@measured/puck';
|
|
4
|
+
import 'payload';
|
|
5
|
+
import './types-D7D3rZ1J.mjs';
|
|
6
|
+
import 'react';
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { j as ColorPickerFieldProps, C as ConversionType, E as EditorVersion, i as MediaFieldProps, M as MediaObject, b as MergeConfigOptions, g as PageConversionTracking, h as PageDocument, e as PageMeta, f as PageSEO, d as PuckAdminConfig, P as PuckPageData, c as PuckPluginOptions, a as PuckRootProps, S as SharedComponentProps, k as ThemeConfig, T as TiptapFieldProps } from './index-CoUQnyC3.js';
|
|
2
|
+
export { GetPuckFieldsOptions, TemplatesCollection, conversionFieldGroup, createEditorVersionField, createPageLayoutField, createPuckPlugin, editorVersionField, generatePagesCollection, generatePuckEditField, getPuckFields, isHomepageField, pageLayoutField, puckDataField, seoFieldGroup } from './plugin/index.js';
|
|
3
|
+
export { Config as PuckConfig, Data as PuckData } from '@measured/puck';
|
|
4
|
+
import 'payload';
|
|
5
|
+
import './types-D7D3rZ1J.js';
|
|
6
|
+
import 'react';
|