@kilivi/payloadcms-theme-management 0.2.18 → 0.3.2

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 (47) hide show
  1. package/dist/fields/ColorPickerField.js +1 -1
  2. package/dist/fields/ColorPickerField.js.map +1 -1
  3. package/dist/fields/ThemeTokenSelectField.d.ts.map +1 -1
  4. package/dist/fields/ThemeTokenSelectField.js +1 -1
  5. package/dist/fields/ThemeTokenSelectField.js.map +1 -1
  6. package/dist/fields/themeConfigurationField.d.ts +3 -14
  7. package/dist/fields/themeConfigurationField.d.ts.map +1 -1
  8. package/dist/fields/themeConfigurationField.js +233 -297
  9. package/dist/fields/themeConfigurationField.js.map +1 -1
  10. package/dist/index.d.ts +0 -1
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +17 -77
  13. package/dist/index.js.map +1 -1
  14. package/package.json +1 -1
  15. package/dist/fields/ExtendedThemeAutoPopulateField.d.ts +0 -12
  16. package/dist/fields/ExtendedThemeAutoPopulateField.d.ts.map +0 -1
  17. package/dist/fields/ExtendedThemeAutoPopulateField.js +0 -176
  18. package/dist/fields/ExtendedThemeAutoPopulateField.js.map +0 -1
  19. package/dist/fields/RadiusField.d.ts +0 -3
  20. package/dist/fields/RadiusField.d.ts.map +0 -1
  21. package/dist/fields/RadiusField.js +0 -174
  22. package/dist/fields/RadiusField.js.map +0 -1
  23. package/dist/fields/ThemeLivePreview.css +0 -190
  24. package/dist/fields/ThemeLivePreview.d.ts +0 -3
  25. package/dist/fields/ThemeLivePreview.d.ts.map +0 -1
  26. package/dist/fields/ThemeLivePreview.js +0 -195
  27. package/dist/fields/ThemeLivePreview.js.map +0 -1
  28. package/dist/fields/VISUAL_EXAMPLES.d.ts +0 -153
  29. package/dist/fields/VISUAL_EXAMPLES.d.ts.map +0 -1
  30. package/dist/fields/VISUAL_EXAMPLES.js +0 -148
  31. package/dist/fields/VISUAL_EXAMPLES.js.map +0 -1
  32. package/dist/fields/extendedThemeFields.d.ts +0 -139
  33. package/dist/fields/extendedThemeFields.d.ts.map +0 -1
  34. package/dist/fields/extendedThemeFields.js +0 -489
  35. package/dist/fields/extendedThemeFields.js.map +0 -1
  36. package/dist/views/ThemePreviewLoader.d.ts +0 -7
  37. package/dist/views/ThemePreviewLoader.d.ts.map +0 -1
  38. package/dist/views/ThemePreviewLoader.js +0 -43
  39. package/dist/views/ThemePreviewLoader.js.map +0 -1
  40. package/dist/views/ThemePreviewView.d.ts +0 -10
  41. package/dist/views/ThemePreviewView.d.ts.map +0 -1
  42. package/dist/views/ThemePreviewView.js +0 -43
  43. package/dist/views/ThemePreviewView.js.map +0 -1
  44. package/dist/views/ThemePreviewViewClient.d.ts +0 -7
  45. package/dist/views/ThemePreviewViewClient.d.ts.map +0 -1
  46. package/dist/views/ThemePreviewViewClient.js +0 -12
  47. package/dist/views/ThemePreviewViewClient.js.map +0 -1
@@ -1,9 +1,8 @@
1
1
  import { BASE_FONT_SIZE_OPTIONS, BODY_FONT_OPTIONS, HEADING_FONT_OPTIONS, LINE_HEIGHT_OPTIONS } from '../constants/themeFonts.js';
2
2
  import { darkModeField, lightModeField } from './colorModeFields.js';
3
- import { darkModeColorsField, designSystemConfigField, extendedThemeSelectionField, lightModeColorsField, shadowConfigField, typographyConfigField } from './extendedThemeFields.js';
4
3
  /**
5
- * Theme Configuration Tab Configuration
6
- * Returns tab config that can be injected into existing tabs field
4
+ * Theme Configuration Field with Theme Selection as default value setter
5
+ * Theme Selection populates lightMode/darkMode colors automatically
7
6
  */ export function createThemeConfigurationField(options) {
8
7
  const { themePresets, defaultTheme, includeColorModeToggle, includeCustomCSS, enableAdvancedFeatures = true } = options;
9
8
  const themeOptions = themePresets.map((preset)=>{
@@ -34,35 +33,108 @@ import { darkModeColorsField, designSystemConfigField, extendedThemeSelectionFie
34
33
  Field: '@kilivi/payloadcms-theme-management/fields/ThemePreviewField'
35
34
  }
36
35
  }
37
- },
38
- extendedThemeSelectionField
36
+ }
39
37
  ];
40
- // Extended Theme Configuration (OKLCH colors, shadcn/ui compatible)
41
- if (enableAdvancedFeatures) {
42
- fields.push({
43
- type: 'collapsible',
44
- label: {
45
- en: '🎨 Extended Theme Configuration',
46
- cs: '🎨 Rozšířená konfigurace tématu'
47
- },
48
- admin: {
49
- initCollapsed: true,
50
- description: {
51
- en: 'Professional theme system with TweakCN compatibility. Full OKLCH color support, shadows, typography, and more.',
52
- cs: 'Profesionální systém témat s kompatibilitou TweakCN. Plná podpora OKLCH barev, stíny, typografie a další.'
38
+ // Border Radius Configuration - Always visible
39
+ fields.push({
40
+ type: 'row',
41
+ fields: [
42
+ {
43
+ name: 'borderRadius',
44
+ type: 'select',
45
+ label: {
46
+ en: '📐 Border Radius',
47
+ cs: '📐 Zaoblení rohů'
48
+ },
49
+ defaultValue: 'medium',
50
+ options: [
51
+ {
52
+ label: {
53
+ en: 'None (0px)',
54
+ cs: 'Žádné (0px)'
55
+ },
56
+ value: 'none'
57
+ },
58
+ {
59
+ label: {
60
+ en: 'Small (0.25rem)',
61
+ cs: 'Malé (0.25rem)'
62
+ },
63
+ value: 'small'
64
+ },
65
+ {
66
+ label: {
67
+ en: 'Medium (0.5rem)',
68
+ cs: 'Střední (0.5rem)'
69
+ },
70
+ value: 'medium'
71
+ },
72
+ {
73
+ label: {
74
+ en: 'Large (0.75rem)',
75
+ cs: 'Velké (0.75rem)'
76
+ },
77
+ value: 'large'
78
+ },
79
+ {
80
+ label: {
81
+ en: 'XL (1rem)',
82
+ cs: 'XL (1rem)'
83
+ },
84
+ value: 'xl'
85
+ }
86
+ ],
87
+ admin: {
88
+ description: {
89
+ en: 'Default corner rounding for UI elements',
90
+ cs: 'Výchozí zaoblení rohů pro UI prvky'
91
+ },
92
+ width: '50%'
53
93
  }
54
94
  },
55
- fields: [
56
- lightModeColorsField,
57
- darkModeColorsField,
58
- shadowConfigField,
59
- typographyConfigField,
60
- designSystemConfigField
61
- ]
62
- });
63
- }
64
- // Color Mode Settings (only when NOT using extended theme configuration)
65
- if (includeColorModeToggle && !enableAdvancedFeatures) {
95
+ {
96
+ name: 'spacing',
97
+ type: 'select',
98
+ label: {
99
+ en: '📏 Spacing Scale',
100
+ cs: '📏 Škála rozestupů'
101
+ },
102
+ defaultValue: 'medium',
103
+ options: [
104
+ {
105
+ label: {
106
+ en: 'Compact',
107
+ cs: 'Kompaktní'
108
+ },
109
+ value: 'compact'
110
+ },
111
+ {
112
+ label: {
113
+ en: 'Medium',
114
+ cs: 'Střední'
115
+ },
116
+ value: 'medium'
117
+ },
118
+ {
119
+ label: {
120
+ en: 'Comfortable',
121
+ cs: 'Pohodlné'
122
+ },
123
+ value: 'comfortable'
124
+ }
125
+ ],
126
+ admin: {
127
+ description: {
128
+ en: 'Global spacing between elements',
129
+ cs: 'Globální rozestupy mezi prvky'
130
+ },
131
+ width: '50%'
132
+ }
133
+ }
134
+ ]
135
+ });
136
+ // Color Mode Settings
137
+ if (includeColorModeToggle) {
66
138
  fields.push({
67
139
  type: 'collapsible',
68
140
  label: {
@@ -142,283 +214,144 @@ import { darkModeColorsField, designSystemConfigField, extendedThemeSelectionFie
142
214
  ]
143
215
  });
144
216
  }
145
- // Typography (only when NOT using extended theme configuration)
146
- if (!enableAdvancedFeatures) {
147
- fields.push({
148
- type: 'collapsible',
149
- label: {
150
- en: '🅰️ Typography',
151
- cs: '🅰️ Typografie'
152
- },
153
- admin: {
154
- initCollapsed: true,
155
- description: {
156
- en: 'Choose font families and base typography settings. Leave fields on "Use preset" to inherit the theme defaults.',
157
- cs: 'Zvolte rodiny písem a základní typografické nastavení. Hodnota "Použít výchozí" zachová nastavení motivu.'
158
- }
159
- },
160
- fields: [
161
- {
162
- name: 'typography',
163
- type: 'group',
164
- fields: [
165
- {
166
- type: 'row',
167
- fields: [
168
- {
169
- name: 'bodyFont',
170
- type: 'select',
171
- label: {
172
- en: 'Body font',
173
- cs: 'Písmo pro text'
174
- },
175
- defaultValue: 'preset',
176
- // @ts-expect-error - Pass full objects including fontFamily for custom rendering
177
- options: BODY_FONT_OPTIONS,
178
- admin: {
179
- width: '50%',
180
- components: {
181
- Field: '@kilivi/payloadcms-theme-management/fields/FontSelectField'
182
- }
183
- }
217
+ // Typography - Always visible
218
+ fields.push({
219
+ type: 'collapsible',
220
+ label: {
221
+ en: '🅰️ Typography',
222
+ cs: '🅰️ Typografie'
223
+ },
224
+ admin: {
225
+ initCollapsed: true,
226
+ description: {
227
+ en: 'Choose font families and base typography settings. Leave fields on "Use preset" to inherit the theme defaults.',
228
+ cs: 'Zvolte rodiny písem a základní typografické nastavení. Hodnota "Použít výchozí" zachová nastavení motivu.'
229
+ }
230
+ },
231
+ fields: [
232
+ {
233
+ name: 'typography',
234
+ type: 'group',
235
+ fields: [
236
+ {
237
+ type: 'row',
238
+ fields: [
239
+ {
240
+ name: 'bodyFont',
241
+ type: 'select',
242
+ label: {
243
+ en: 'Body font',
244
+ cs: 'Písmo pro text'
184
245
  },
185
- {
186
- name: 'headingFont',
187
- type: 'select',
188
- label: {
189
- en: 'Heading font',
190
- cs: 'Písmo pro nadpisy'
191
- },
192
- defaultValue: 'preset',
193
- // @ts-expect-error - Pass full objects including fontFamily for custom rendering
194
- options: HEADING_FONT_OPTIONS,
195
- admin: {
196
- width: '50%',
197
- components: {
198
- Field: '@kilivi/payloadcms-theme-management/fields/FontSelectField'
199
- }
246
+ defaultValue: 'preset',
247
+ // @ts-expect-error - Pass full objects including fontFamily for custom rendering
248
+ options: BODY_FONT_OPTIONS,
249
+ admin: {
250
+ width: '50%',
251
+ components: {
252
+ Field: '@kilivi/payloadcms-theme-management/fields/FontSelectField'
200
253
  }
201
254
  }
202
- ]
203
- },
204
- {
205
- type: 'row',
206
- fields: [
207
- {
208
- name: 'bodyFontCustom',
209
- type: 'text',
210
- label: {
211
- en: 'Custom body font stack',
212
- cs: 'Vlastní písmo pro text'
213
- },
214
- admin: {
215
- width: '50%',
216
- placeholder: '"IBM Plex Sans", sans-serif',
217
- description: {
218
- en: 'Provide full CSS font-family stack when using a custom font.',
219
- cs: 'Při volbě vlastního písma zadejte celý CSS zápis font-family.'
220
- },
221
- condition: (_, siblingData)=>siblingData?.bodyFont === 'custom'
222
- }
255
+ },
256
+ {
257
+ name: 'headingFont',
258
+ type: 'select',
259
+ label: {
260
+ en: 'Heading font',
261
+ cs: 'Písmo pro nadpisy'
223
262
  },
224
- {
225
- name: 'headingFontCustom',
226
- type: 'text',
227
- label: {
228
- en: 'Custom heading font stack',
229
- cs: 'Vlastní písmo pro nadpisy'
230
- },
231
- admin: {
232
- width: '50%',
233
- placeholder: '"Cormorant Garamond", serif',
234
- description: {
235
- en: 'Provide full CSS font-family stack when using a custom heading font.',
236
- cs: 'Při volbě vlastního nadpisového písma zadejte celý CSS zápis font-family.'
237
- },
238
- condition: (_, siblingData)=>siblingData?.headingFont === 'custom'
263
+ defaultValue: 'preset',
264
+ // @ts-expect-error - Pass full objects including fontFamily for custom rendering
265
+ options: HEADING_FONT_OPTIONS,
266
+ admin: {
267
+ width: '50%',
268
+ components: {
269
+ Field: '@kilivi/payloadcms-theme-management/fields/FontSelectField'
239
270
  }
240
271
  }
241
- ]
242
- },
243
- {
244
- type: 'row',
245
- fields: [
246
- {
247
- name: 'baseFontSize',
248
- type: 'select',
249
- label: {
250
- en: 'Base font size',
251
- cs: 'Základní velikost písma'
252
- },
253
- defaultValue: 'preset',
254
- options: BASE_FONT_SIZE_OPTIONS.map((option)=>({
255
- label: option.label,
256
- value: option.value
257
- })),
258
- admin: {
259
- width: '50%'
260
- }
272
+ }
273
+ ]
274
+ },
275
+ {
276
+ type: 'row',
277
+ fields: [
278
+ {
279
+ name: 'bodyFontCustom',
280
+ type: 'text',
281
+ label: {
282
+ en: 'Custom body font stack',
283
+ cs: 'Vlastní písmo pro text'
261
284
  },
262
- {
263
- name: 'lineHeight',
264
- type: 'select',
265
- label: {
266
- en: 'Line height',
267
- cs: 'Řádkování'
285
+ admin: {
286
+ width: '50%',
287
+ placeholder: '"IBM Plex Sans", sans-serif',
288
+ description: {
289
+ en: 'Provide full CSS font-family stack when using a custom font.',
290
+ cs: 'Při volbě vlastního písma zadejte celý CSS zápis font-family.'
268
291
  },
269
- defaultValue: 'preset',
270
- options: LINE_HEIGHT_OPTIONS.map((option)=>({
271
- label: option.label,
272
- value: option.value
273
- })),
274
- admin: {
275
- width: '50%'
276
- }
292
+ condition: (_, siblingData)=>siblingData?.bodyFont === 'custom'
277
293
  }
278
- ]
279
- }
280
- ]
281
- }
282
- ]
283
- });
284
- }
285
- // Design Customization (only when NOT using extended theme configuration)
286
- if (!enableAdvancedFeatures) {
287
- fields.push({
288
- type: 'collapsible',
289
- label: {
290
- en: '✨ Design Customization',
291
- cs: '✨ Přizpůsobení designu'
292
- },
293
- admin: {
294
- initCollapsed: true
295
- },
296
- fields: [
297
- {
298
- name: 'borderRadius',
299
- type: 'select',
300
- label: {
301
- en: 'Border Radius',
302
- cs: 'Zaoblení rohů'
303
- },
304
- defaultValue: 'medium',
305
- options: [
306
- {
307
- label: {
308
- en: 'None',
309
- cs: 'Žádné'
310
- },
311
- value: 'none'
312
- },
313
- {
314
- label: {
315
- en: 'Small',
316
- cs: 'Malé'
317
- },
318
- value: 'small'
319
- },
320
- {
321
- label: {
322
- en: 'Medium',
323
- cs: 'Střední'
324
- },
325
- value: 'medium'
326
- },
327
- {
328
- label: {
329
- en: 'Large',
330
- cs: 'Velké'
331
- },
332
- value: 'large'
333
- },
334
- {
335
- label: {
336
- en: 'Full',
337
- cs: 'Plné'
338
- },
339
- value: 'xl'
340
- }
341
- ],
342
- admin: {
343
- components: {
344
- Field: '@kilivi/payloadcms-theme-management/fields/RadiusField'
345
- },
346
- width: '33%'
347
- }
348
- },
349
- {
350
- name: 'fontScale',
351
- type: 'select',
352
- label: {
353
- en: 'Font Scale',
354
- cs: 'Velikost písma'
355
- },
356
- defaultValue: 'medium',
357
- options: [
358
- {
359
- label: {
360
- en: 'Small',
361
- cs: 'Malé'
362
- },
363
- value: 'small'
364
- },
365
- {
366
- label: {
367
- en: 'Medium',
368
- cs: 'Střední'
369
- },
370
- value: 'medium'
371
- },
372
- {
373
- label: {
374
- en: 'Large',
375
- cs: 'Velké'
376
294
  },
377
- value: 'large'
378
- }
379
- ],
380
- admin: {
381
- width: '33%'
382
- }
383
- },
384
- {
385
- name: 'spacing',
386
- type: 'select',
387
- label: {
388
- en: 'Spacing',
389
- cs: 'Mezery'
295
+ {
296
+ name: 'headingFontCustom',
297
+ type: 'text',
298
+ label: {
299
+ en: 'Custom heading font stack',
300
+ cs: 'Vlastní písmo pro nadpisy'
301
+ },
302
+ admin: {
303
+ width: '50%',
304
+ placeholder: '"Cormorant Garamond", serif',
305
+ description: {
306
+ en: 'Provide full CSS font-family stack when using a custom heading font.',
307
+ cs: 'Při volbě vlastního nadpisového písma zadejte celý CSS zápis font-family.'
308
+ },
309
+ condition: (_, siblingData)=>siblingData?.headingFont === 'custom'
310
+ }
311
+ }
312
+ ]
390
313
  },
391
- defaultValue: 'medium',
392
- options: [
393
- {
394
- label: {
395
- en: 'Compact',
396
- cs: 'Kompaktní'
397
- },
398
- value: 'compact'
399
- },
400
- {
401
- label: {
402
- en: 'Medium',
403
- cs: 'Střední'
404
- },
405
- value: 'medium'
406
- },
407
- {
408
- label: {
409
- en: 'Spacious',
410
- cs: 'Prostorné'
314
+ {
315
+ type: 'row',
316
+ fields: [
317
+ {
318
+ name: 'baseFontSize',
319
+ type: 'select',
320
+ label: {
321
+ en: 'Base font size',
322
+ cs: 'Základní velikost písma'
323
+ },
324
+ defaultValue: 'preset',
325
+ options: BASE_FONT_SIZE_OPTIONS.map((option)=>({
326
+ label: option.label,
327
+ value: option.value
328
+ })),
329
+ admin: {
330
+ width: '50%'
331
+ }
411
332
  },
412
- value: 'spacious'
413
- }
414
- ],
415
- admin: {
416
- width: '34%'
333
+ {
334
+ name: 'lineHeight',
335
+ type: 'select',
336
+ label: {
337
+ en: 'Line height',
338
+ cs: 'Řádkování'
339
+ },
340
+ defaultValue: 'preset',
341
+ options: LINE_HEIGHT_OPTIONS.map((option)=>({
342
+ label: option.label,
343
+ value: option.value
344
+ })),
345
+ admin: {
346
+ width: '50%'
347
+ }
348
+ }
349
+ ]
417
350
  }
418
- }
419
- ]
420
- });
421
- } // End of !enableAdvancedFeatures block
351
+ ]
352
+ }
353
+ ]
354
+ });
422
355
  // Advanced Settings (when using extended theme configuration)
423
356
  if (enableAdvancedFeatures) {
424
357
  const advancedFields = [
@@ -499,16 +432,19 @@ import { darkModeColorsField, designSystemConfigField, extendedThemeSelectionFie
499
432
  });
500
433
  }
501
434
  // Return just the tab configuration, not the full tabs field
502
- // The plugin will inject this into existing tabs or create a group field
435
+ // Return as group field with all theme configuration
503
436
  return {
504
437
  name: 'themeConfiguration',
438
+ type: 'group',
505
439
  label: {
506
440
  en: '🎨 Appearance Settings',
507
441
  cs: '🎨 Nastavení vzhledu'
508
442
  },
509
- description: {
510
- en: 'Configure website appearance and styling',
511
- cs: 'Nakonfigurujte vzhled a stylování webu'
443
+ admin: {
444
+ description: {
445
+ en: 'Configure website appearance and styling',
446
+ cs: 'Nakonfigurujte vzhled a stylování webu'
447
+ }
512
448
  },
513
449
  fields
514
450
  };