@kilivi/payloadcms-theme-management 0.2.18 → 0.3.1
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/dist/fields/themeConfigurationField.d.ts +3 -14
- package/dist/fields/themeConfigurationField.d.ts.map +1 -1
- package/dist/fields/themeConfigurationField.js +12 -35
- package/dist/fields/themeConfigurationField.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -77
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -9,20 +9,9 @@ interface ThemeConfigurationFieldOptions {
|
|
|
9
9
|
enableAdvancedFeatures?: boolean;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
* Theme Configuration
|
|
13
|
-
*
|
|
12
|
+
* Theme Configuration Field with Theme Selection as default value setter
|
|
13
|
+
* Theme Selection populates lightMode/darkMode colors automatically
|
|
14
14
|
*/
|
|
15
|
-
export declare function createThemeConfigurationField(options: ThemeConfigurationFieldOptions):
|
|
16
|
-
name: string;
|
|
17
|
-
label: {
|
|
18
|
-
en: string;
|
|
19
|
-
cs: string;
|
|
20
|
-
};
|
|
21
|
-
description: {
|
|
22
|
-
en: string;
|
|
23
|
-
cs: string;
|
|
24
|
-
};
|
|
25
|
-
fields: Field[];
|
|
26
|
-
};
|
|
15
|
+
export declare function createThemeConfigurationField(options: ThemeConfigurationFieldOptions): Field;
|
|
27
16
|
export {};
|
|
28
17
|
//# sourceMappingURL=themeConfigurationField.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themeConfigurationField.d.ts","sourceRoot":"","sources":["../../src/fields/themeConfigurationField.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAOpC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"themeConfigurationField.d.ts","sourceRoot":"","sources":["../../src/fields/themeConfigurationField.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAOpC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAG9C,UAAU,8BAA8B;IACtC,YAAY,EAAE,WAAW,EAAE,CAAA;IAC3B,YAAY,EAAE,MAAM,CAAA;IACpB,sBAAsB,EAAE,OAAO,CAAA;IAC/B,gBAAgB,EAAE,OAAO,CAAA;IACzB,oBAAoB,EAAE,OAAO,CAAA;IAC7B,sBAAsB,CAAC,EAAE,OAAO,CAAA;CACjC;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,8BAA8B,GAAG,KAAK,CAwZ5F"}
|
|
@@ -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
|
|
6
|
-
*
|
|
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,10 @@ import { darkModeColorsField, designSystemConfigField, extendedThemeSelectionFie
|
|
|
34
33
|
Field: '@kilivi/payloadcms-theme-management/fields/ThemePreviewField'
|
|
35
34
|
}
|
|
36
35
|
}
|
|
37
|
-
}
|
|
38
|
-
extendedThemeSelectionField
|
|
36
|
+
}
|
|
39
37
|
];
|
|
40
|
-
//
|
|
41
|
-
if (
|
|
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ší.'
|
|
53
|
-
}
|
|
54
|
-
},
|
|
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) {
|
|
38
|
+
// Color Mode Settings
|
|
39
|
+
if (includeColorModeToggle) {
|
|
66
40
|
fields.push({
|
|
67
41
|
type: 'collapsible',
|
|
68
42
|
label: {
|
|
@@ -499,16 +473,19 @@ import { darkModeColorsField, designSystemConfigField, extendedThemeSelectionFie
|
|
|
499
473
|
});
|
|
500
474
|
}
|
|
501
475
|
// Return just the tab configuration, not the full tabs field
|
|
502
|
-
//
|
|
476
|
+
// Return as group field with all theme configuration
|
|
503
477
|
return {
|
|
504
478
|
name: 'themeConfiguration',
|
|
479
|
+
type: 'group',
|
|
505
480
|
label: {
|
|
506
481
|
en: '🎨 Appearance Settings',
|
|
507
482
|
cs: '🎨 Nastavení vzhledu'
|
|
508
483
|
},
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
484
|
+
admin: {
|
|
485
|
+
description: {
|
|
486
|
+
en: 'Configure website appearance and styling',
|
|
487
|
+
cs: 'Nakonfigurujte vzhled a stylování webu'
|
|
488
|
+
}
|
|
512
489
|
},
|
|
513
490
|
fields
|
|
514
491
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/fields/themeConfigurationField.ts"],"sourcesContent":["import type { Field } from 'payload'\nimport {\n BASE_FONT_SIZE_OPTIONS,\n BODY_FONT_OPTIONS,\n HEADING_FONT_OPTIONS,\n LINE_HEIGHT_OPTIONS,\n} from '../constants/themeFonts.js'\nimport type { ThemePreset } from '../index.js'\nimport { darkModeField, lightModeField } from './colorModeFields.js'\nimport {\n darkModeColorsField,\n designSystemConfigField,\n extendedThemeSelectionField,\n lightModeColorsField,\n shadowConfigField,\n typographyConfigField,\n} from './extendedThemeFields.js'\n\ninterface ThemeConfigurationFieldOptions {\n themePresets: ThemePreset[]\n defaultTheme: string\n includeColorModeToggle: boolean\n includeCustomCSS: boolean\n includeBrandIdentity: boolean\n enableAdvancedFeatures?: boolean\n}\n\n/**\n * Theme Configuration Tab Configuration\n * Returns tab config that can be injected into existing tabs field\n */\nexport function createThemeConfigurationField(options: ThemeConfigurationFieldOptions): {\n name: string\n label: { en: string; cs: string }\n description: { en: string; cs: string }\n fields: Field[]\n} {\n const {\n themePresets,\n defaultTheme,\n includeColorModeToggle,\n includeCustomCSS,\n enableAdvancedFeatures = true,\n } = options\n\n const themeOptions = themePresets.map((preset) => {\n const previewColor = preset.preview?.colors.primary\n const label = previewColor ? `${preset.label} • ${previewColor}` : preset.label\n return {\n label,\n value: preset.name,\n }\n })\n\n const fields: Field[] = [\n {\n name: 'theme',\n type: 'select',\n required: true,\n defaultValue: defaultTheme,\n options: themeOptions,\n label: {\n en: '🎨 Theme Selection',\n cs: '🎨 Výběr tématu',\n },\n admin: {\n description: {\n en: 'Select a theme to auto-populate color values. You can customize colors after selection.',\n cs: 'Vyberte téma pro automatické předvyplnění barev. Po výběru můžete barvy upravit.',\n },\n components: {\n Field: '@kilivi/payloadcms-theme-management/fields/ThemePreviewField',\n },\n },\n },\n extendedThemeSelectionField,\n ]\n\n // Extended Theme Configuration (OKLCH colors, shadcn/ui compatible)\n if (enableAdvancedFeatures) {\n fields.push({\n type: 'collapsible',\n label: {\n en: '🎨 Extended Theme Configuration',\n cs: '🎨 Rozšířená konfigurace tématu',\n },\n admin: {\n initCollapsed: true,\n description: {\n en: 'Professional theme system with TweakCN compatibility. Full OKLCH color support, shadows, typography, and more.',\n cs: 'Profesionální systém témat s kompatibilitou TweakCN. Plná podpora OKLCH barev, stíny, typografie a další.',\n },\n },\n fields: [\n lightModeColorsField,\n darkModeColorsField,\n shadowConfigField,\n typographyConfigField,\n designSystemConfigField,\n ],\n })\n }\n\n // Color Mode Settings (only when NOT using extended theme configuration)\n if (includeColorModeToggle && !enableAdvancedFeatures) {\n fields.push({\n type: 'collapsible',\n label: {\n en: '🌗 Color Mode Settings',\n cs: '🌗 Nastavení barevného režimu',\n },\n admin: {\n initCollapsed: false,\n description: {\n en: 'Configure light and dark mode colors. Changes here override theme selection.',\n cs: 'Nakonfigurujte barvy světlého a tmavého režimu. Změny zde přepíší výběr tématu.',\n },\n },\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'colorMode',\n type: 'select',\n label: {\n en: 'Default Color Mode',\n cs: 'Výchozí barevný režim',\n },\n defaultValue: 'auto',\n options: [\n {\n label: {\n en: 'Auto (System)',\n cs: 'Automaticky (Systém)',\n },\n value: 'auto',\n },\n {\n label: { en: 'Light', cs: 'Světlý' },\n value: 'light',\n },\n {\n label: { en: 'Dark', cs: 'Tmavý' },\n value: 'dark',\n },\n ],\n admin: {\n description: {\n en: 'Default color mode for visitors',\n cs: 'Výchozí barevný režim pro návštěvníky',\n },\n width: '50%',\n },\n },\n {\n name: 'allowColorModeToggle',\n type: 'checkbox',\n label: {\n en: 'Enable Mode Toggle',\n cs: 'Povolit přepínač režimu',\n },\n defaultValue: true,\n admin: {\n description: {\n en: 'Let visitors switch modes',\n cs: 'Umožnit návštěvníkům přepínat režimy',\n },\n width: '50%',\n },\n },\n ],\n },\n lightModeField,\n darkModeField,\n ],\n })\n }\n\n // Typography (only when NOT using extended theme configuration)\n if (!enableAdvancedFeatures) {\n fields.push({\n type: 'collapsible',\n label: {\n en: '🅰️ Typography',\n cs: '🅰️ Typografie',\n },\n admin: {\n initCollapsed: true,\n description: {\n en: 'Choose font families and base typography settings. Leave fields on \"Use preset\" to inherit the theme defaults.',\n cs: 'Zvolte rodiny písem a základní typografické nastavení. Hodnota \"Použít výchozí\" zachová nastavení motivu.',\n },\n },\n fields: [\n {\n name: 'typography',\n type: 'group',\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'bodyFont',\n type: 'select',\n label: {\n en: 'Body font',\n cs: 'Písmo pro text',\n },\n defaultValue: 'preset',\n // @ts-expect-error - Pass full objects including fontFamily for custom rendering\n options: BODY_FONT_OPTIONS,\n admin: {\n width: '50%',\n components: {\n Field: '@kilivi/payloadcms-theme-management/fields/FontSelectField',\n },\n },\n },\n {\n name: 'headingFont',\n type: 'select',\n label: {\n en: 'Heading font',\n cs: 'Písmo pro nadpisy',\n },\n defaultValue: 'preset',\n // @ts-expect-error - Pass full objects including fontFamily for custom rendering\n options: HEADING_FONT_OPTIONS,\n admin: {\n width: '50%',\n components: {\n Field: '@kilivi/payloadcms-theme-management/fields/FontSelectField',\n },\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n name: 'bodyFontCustom',\n type: 'text',\n label: {\n en: 'Custom body font stack',\n cs: 'Vlastní písmo pro text',\n },\n admin: {\n width: '50%',\n placeholder: '\"IBM Plex Sans\", sans-serif',\n description: {\n en: 'Provide full CSS font-family stack when using a custom font.',\n cs: 'Při volbě vlastního písma zadejte celý CSS zápis font-family.',\n },\n condition: (_, siblingData) => siblingData?.bodyFont === 'custom',\n },\n },\n {\n name: 'headingFontCustom',\n type: 'text',\n label: {\n en: 'Custom heading font stack',\n cs: 'Vlastní písmo pro nadpisy',\n },\n admin: {\n width: '50%',\n placeholder: '\"Cormorant Garamond\", serif',\n description: {\n en: 'Provide full CSS font-family stack when using a custom heading font.',\n cs: 'Při volbě vlastního nadpisového písma zadejte celý CSS zápis font-family.',\n },\n condition: (_, siblingData) => siblingData?.headingFont === 'custom',\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n name: 'baseFontSize',\n type: 'select',\n label: {\n en: 'Base font size',\n cs: 'Základní velikost písma',\n },\n defaultValue: 'preset',\n options: BASE_FONT_SIZE_OPTIONS.map((option) => ({\n label: option.label,\n value: option.value,\n })),\n admin: {\n width: '50%',\n },\n },\n {\n name: 'lineHeight',\n type: 'select',\n label: {\n en: 'Line height',\n cs: 'Řádkování',\n },\n defaultValue: 'preset',\n options: LINE_HEIGHT_OPTIONS.map((option) => ({\n label: option.label,\n value: option.value,\n })),\n admin: {\n width: '50%',\n },\n },\n ],\n },\n ],\n },\n ],\n })\n }\n\n // Design Customization (only when NOT using extended theme configuration)\n if (!enableAdvancedFeatures) {\n fields.push({\n type: 'collapsible',\n label: {\n en: '✨ Design Customization',\n cs: '✨ Přizpůsobení designu',\n },\n admin: {\n initCollapsed: true,\n },\n fields: [\n {\n name: 'borderRadius',\n type: 'select',\n label: {\n en: 'Border Radius',\n cs: 'Zaoblení rohů',\n },\n defaultValue: 'medium',\n options: [\n { label: { en: 'None', cs: 'Žádné' }, value: 'none' },\n { label: { en: 'Small', cs: 'Malé' }, value: 'small' },\n { label: { en: 'Medium', cs: 'Střední' }, value: 'medium' },\n { label: { en: 'Large', cs: 'Velké' }, value: 'large' },\n { label: { en: 'Full', cs: 'Plné' }, value: 'xl' },\n ],\n admin: {\n components: {\n Field: '@kilivi/payloadcms-theme-management/fields/RadiusField',\n },\n width: '33%',\n },\n },\n {\n name: 'fontScale',\n type: 'select',\n label: {\n en: 'Font Scale',\n cs: 'Velikost písma',\n },\n defaultValue: 'medium',\n options: [\n { label: { en: 'Small', cs: 'Malé' }, value: 'small' },\n { label: { en: 'Medium', cs: 'Střední' }, value: 'medium' },\n { label: { en: 'Large', cs: 'Velké' }, value: 'large' },\n ],\n admin: {\n width: '33%',\n },\n },\n {\n name: 'spacing',\n type: 'select',\n label: {\n en: 'Spacing',\n cs: 'Mezery',\n },\n defaultValue: 'medium',\n options: [\n { label: { en: 'Compact', cs: 'Kompaktní' }, value: 'compact' },\n { label: { en: 'Medium', cs: 'Střední' }, value: 'medium' },\n { label: { en: 'Spacious', cs: 'Prostorné' }, value: 'spacious' },\n ],\n admin: {\n width: '34%',\n },\n },\n ],\n })\n } // End of !enableAdvancedFeatures block\n\n // Advanced Settings (when using extended theme configuration)\n if (enableAdvancedFeatures) {\n const advancedFields: Field[] = [\n {\n name: 'animationLevel',\n type: 'select',\n label: {\n en: 'Animation Level',\n cs: 'Úroveň animací',\n },\n defaultValue: 'medium',\n options: [\n { label: { en: 'None', cs: 'Žádné' }, value: 'none' },\n { label: { en: 'Reduced', cs: 'Snížené' }, value: 'reduced' },\n { label: { en: 'Medium', cs: 'Střední' }, value: 'medium' },\n { label: { en: 'High', cs: 'Vysoké' }, value: 'high' },\n ],\n admin: {\n description: {\n en: 'Control website animations and transitions',\n cs: 'Kontrola animací a přechodů na webu',\n },\n width: '50%',\n },\n },\n ]\n\n if (includeCustomCSS) {\n advancedFields.push({\n name: 'customCSS',\n type: 'code',\n label: {\n en: 'Custom CSS',\n cs: 'Vlastní CSS',\n },\n admin: {\n language: 'css',\n description: {\n en: 'Add custom CSS to override default styles',\n cs: 'Přidejte vlastní CSS pro přepsání výchozích stylů',\n },\n // placeholder:\n // ':root {\\n --primary: #your-color;\\n --border-radius: 8px;\\n --font-family: \"Your Font\";\\n}\\n\\n.custom-class {\\n /* Your custom styles */\\n}',\n // rows: 8,\n },\n })\n }\n\n fields.push({\n type: 'collapsible',\n label: {\n en: '⚙️ Advanced Settings',\n cs: '⚙️ Pokročilé nastavení',\n },\n admin: {\n initCollapsed: true,\n },\n fields: advancedFields,\n })\n }\n\n // Return just the tab configuration, not the full tabs field\n // The plugin will inject this into existing tabs or create a group field\n return {\n name: 'themeConfiguration',\n label: {\n en: '🎨 Appearance Settings',\n cs: '🎨 Nastavení vzhledu',\n },\n description: {\n en: 'Configure website appearance and styling',\n cs: 'Nakonfigurujte vzhled a stylování webu',\n },\n fields,\n }\n}\n"],"names":["BASE_FONT_SIZE_OPTIONS","BODY_FONT_OPTIONS","HEADING_FONT_OPTIONS","LINE_HEIGHT_OPTIONS","darkModeField","lightModeField","darkModeColorsField","designSystemConfigField","extendedThemeSelectionField","lightModeColorsField","shadowConfigField","typographyConfigField","createThemeConfigurationField","options","themePresets","defaultTheme","includeColorModeToggle","includeCustomCSS","enableAdvancedFeatures","themeOptions","map","preset","previewColor","preview","colors","primary","label","value","name","fields","type","required","defaultValue","en","cs","admin","description","components","Field","push","initCollapsed","width","placeholder","condition","_","siblingData","bodyFont","headingFont","option","advancedFields","language"],"mappings":"AACA,SACEA,sBAAsB,EACtBC,iBAAiB,EACjBC,oBAAoB,EACpBC,mBAAmB,QACd,6BAA4B;AAEnC,SAASC,aAAa,EAAEC,cAAc,QAAQ,uBAAsB;AACpE,SACEC,mBAAmB,EACnBC,uBAAuB,EACvBC,2BAA2B,EAC3BC,oBAAoB,EACpBC,iBAAiB,EACjBC,qBAAqB,QAChB,2BAA0B;AAWjC;;;CAGC,GACD,OAAO,SAASC,8BAA8BC,OAAuC;IAMnF,MAAM,EACJC,YAAY,EACZC,YAAY,EACZC,sBAAsB,EACtBC,gBAAgB,EAChBC,yBAAyB,IAAI,EAC9B,GAAGL;IAEJ,MAAMM,eAAeL,aAAaM,GAAG,CAAC,CAACC;QACrC,MAAMC,eAAeD,OAAOE,OAAO,EAAEC,OAAOC;QAC5C,MAAMC,QAAQJ,eAAe,GAAGD,OAAOK,KAAK,CAAC,GAAG,EAAEJ,cAAc,GAAGD,OAAOK,KAAK;QAC/E,OAAO;YACLA;YACAC,OAAON,OAAOO,IAAI;QACpB;IACF;IAEA,MAAMC,SAAkB;QACtB;YACED,MA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cAAc;4BACdG,OAAO;gCACLC,aAAa;oCACXH,IAAI;oCACJC,IAAI;gCACN;gCACAO,OAAO;4BACT;wBACF;qBACD;gBACH;gBACApC;gBACAD;aACD;QACH;IACF;IAEA,gEAAgE;IAChE,IAAI,CAACc,wBAAwB;QAC3BW,OAAOU,IAAI,CAAC;YACVT,MAAM;YACNJ,OAAO;gBACLO,IAAI;gBACJC,IAAI;YACN;YACAC,OAAO;gBACLK,eAAe;gBACfJ,aAAa;oBACXH,IAAI;oBACJC,IAAI;gBACN;YACF;YACAL,QAAQ;gBACN;oBACED,MAAM;oBACNE,MAAM;oBACND,QAAQ;wBACN;4BACEC,MAAM;4BACND,QAAQ;gCACN;oCACED,MAAM;oCACNE,MAAM;oCACNJ,OAAO;wCACLO,IAAI;wCACJC,IAAI;oCACN;oCACAF,cAAc;oCACd,iFAAiF;oCACjFnB,SAASZ;oCACTkC,OAAO;wCACLM,OAAO;wCACPJ,YAAY;4CACVC,OAAO;wCACT;oCACF;gCACF;gCACA;oCACEV,MAAM;oCACNE,MAAM;oCACNJ,OAAO;wCACLO,IAAI;wCACJC,IAAI;oCACN;oCACAF,cAAc;oCACd,iFAAiF;oCACjFnB,SAASX;oCACTiC,OAAO;wCACLM,OAAO;wCACPJ,YAAY;4CACVC,OAAO;wCACT;oCACF;gCACF;6BACD;wBACH;wBACA;4BACER,MAAM;4BACND,QAAQ;gCACN;oCACED,MAAM;oCACNE,MAAM;oCACNJ,OAAO;wCACLO,IAAI;wCACJC,IAAI;oCACN;oCACAC,OAAO;wCACLM,OAAO;wCACPC,aAAa;wCACbN,aAAa;4CACXH,IAAI;4CACJC,IAAI;wCACN;wCACAS,WAAW,CAACC,GAAGC,cAAgBA,aAAaC,aAAa;oCAC3D;gCACF;gCACA;oCACElB,MAAM;oCACNE,MAAM;oCACNJ,OAAO;wCACLO,IAAI;wCACJC,IAAI;oCACN;oCACAC,OAAO;wCACLM,OAAO;wCACPC,aAAa;wCACbN,aAAa;4CACXH,IAAI;4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O,IAAI;4BAAQC,IAAI;wBAAQ;wBAAGP,OAAO;oBAAO;oBACpD;wBAAED,OAAO;4BAAEO,IAAI;4BAAWC,IAAI;wBAAU;wBAAGP,OAAO;oBAAU;oBAC5D;wBAAED,OAAO;4BAAEO,IAAI;4BAAUC,IAAI;wBAAU;wBAAGP,OAAO;oBAAS;oBAC1D;wBAAED,OAAO;4BAAEO,IAAI;4BAAQC,IAAI;wBAAS;wBAAGP,OAAO;oBAAO;iBACtD;gBACDQ,OAAO;oBACLC,aAAa;wBACXH,IAAI;wBACJC,IAAI;oBACN;oBACAO,OAAO;gBACT;YACF;SACD;QAED,IAAIxB,kBAAkB;YACpBgC,eAAeV,IAAI,CAAC;gBAClBX,MAAM;gBACNE,MAAM;gBACNJ,OAAO;oBACLO,IAAI;oBACJC,IAAI;gBACN;gBACAC,OAAO;oBACLe,UAAU;oBACVd,aAAa;wBACXH,IAAI;wBACJC,IAAI;oBACN;gBAIF;YACF;QACF;QAEAL,OAAOU,IAAI,CAAC;YACVT,MAAM;YACNJ,OAAO;gBACLO,IAAI;gBACJC,IAAI;YACN;YACAC,OAAO;gBACLK,eAAe;YACjB;YACAX,QAAQoB;QACV;IACF;IAEA,6DAA6D;IAC7D,yEAAyE;IACzE,OAAO;QACLrB,MAAM;QACNF,OAAO;YACLO,IAAI;YACJC,IAAI;QACN;QACAE,aAAa;YACXH,IAAI;YACJC,IAAI;QACN;QACAL;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../src/fields/themeConfigurationField.ts"],"sourcesContent":["import type { Field } from 'payload'\nimport {\n BASE_FONT_SIZE_OPTIONS,\n BODY_FONT_OPTIONS,\n HEADING_FONT_OPTIONS,\n LINE_HEIGHT_OPTIONS,\n} from '../constants/themeFonts.js'\nimport type { ThemePreset } from '../index.js'\nimport { darkModeField, lightModeField } from './colorModeFields.js'\n\ninterface ThemeConfigurationFieldOptions {\n themePresets: ThemePreset[]\n defaultTheme: string\n includeColorModeToggle: boolean\n includeCustomCSS: boolean\n includeBrandIdentity: boolean\n enableAdvancedFeatures?: boolean\n}\n\n/**\n * Theme Configuration Field with Theme Selection as default value setter\n * Theme Selection populates lightMode/darkMode colors automatically\n */\nexport function createThemeConfigurationField(options: ThemeConfigurationFieldOptions): Field {\n const {\n themePresets,\n defaultTheme,\n includeColorModeToggle,\n includeCustomCSS,\n enableAdvancedFeatures = true,\n } = options\n\n const themeOptions = themePresets.map((preset) => {\n const previewColor = preset.preview?.colors.primary\n const label = previewColor ? `${preset.label} • ${previewColor}` : preset.label\n return {\n label,\n value: preset.name,\n }\n })\n\n const fields: Field[] = [\n {\n name: 'theme',\n type: 'select',\n required: true,\n defaultValue: defaultTheme,\n options: themeOptions,\n label: {\n en: '🎨 Theme Selection',\n cs: '🎨 Výběr tématu',\n },\n admin: {\n description: {\n en: 'Select a theme to auto-populate color values. You can customize colors after selection.',\n cs: 'Vyberte téma pro automatické předvyplnění barev. Po výběru můžete barvy upravit.',\n },\n components: {\n Field: '@kilivi/payloadcms-theme-management/fields/ThemePreviewField',\n },\n },\n },\n ]\n\n // Color Mode Settings\n if (includeColorModeToggle) {\n fields.push({\n type: 'collapsible',\n label: {\n en: '🌗 Color Mode Settings',\n cs: '🌗 Nastavení barevného režimu',\n },\n admin: {\n initCollapsed: false,\n description: {\n en: 'Configure light and dark mode colors. Changes here override theme selection.',\n cs: 'Nakonfigurujte barvy světlého a tmavého režimu. Změny zde přepíší výběr tématu.',\n },\n },\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'colorMode',\n type: 'select',\n label: {\n en: 'Default Color Mode',\n cs: 'Výchozí barevný režim',\n },\n defaultValue: 'auto',\n options: [\n {\n label: {\n en: 'Auto (System)',\n cs: 'Automaticky (Systém)',\n },\n value: 'auto',\n },\n {\n label: { en: 'Light', cs: 'Světlý' },\n value: 'light',\n },\n {\n label: { en: 'Dark', cs: 'Tmavý' },\n value: 'dark',\n },\n ],\n admin: {\n description: {\n en: 'Default color mode for visitors',\n cs: 'Výchozí barevný režim pro návštěvníky',\n },\n width: '50%',\n },\n },\n {\n name: 'allowColorModeToggle',\n type: 'checkbox',\n label: {\n en: 'Enable Mode Toggle',\n cs: 'Povolit přepínač režimu',\n },\n defaultValue: true,\n admin: {\n description: {\n en: 'Let visitors switch modes',\n cs: 'Umožnit návštěvníkům přepínat režimy',\n },\n width: '50%',\n },\n },\n ],\n },\n lightModeField,\n darkModeField,\n ],\n })\n }\n\n // Typography (only when NOT using extended theme configuration)\n if (!enableAdvancedFeatures) {\n fields.push({\n type: 'collapsible',\n label: {\n en: '🅰️ Typography',\n cs: '🅰️ Typografie',\n },\n admin: {\n initCollapsed: true,\n description: {\n en: 'Choose font families and base typography settings. Leave fields on \"Use preset\" to inherit the theme defaults.',\n cs: 'Zvolte rodiny písem a základní typografické nastavení. Hodnota \"Použít výchozí\" zachová nastavení motivu.',\n },\n },\n fields: [\n {\n name: 'typography',\n type: 'group',\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'bodyFont',\n type: 'select',\n label: {\n en: 'Body font',\n cs: 'Písmo pro text',\n },\n defaultValue: 'preset',\n // @ts-expect-error - Pass full objects including fontFamily for custom rendering\n options: BODY_FONT_OPTIONS,\n admin: {\n width: '50%',\n components: {\n Field: '@kilivi/payloadcms-theme-management/fields/FontSelectField',\n },\n },\n },\n {\n name: 'headingFont',\n type: 'select',\n label: {\n en: 'Heading font',\n cs: 'Písmo pro nadpisy',\n },\n defaultValue: 'preset',\n // @ts-expect-error - Pass full objects including fontFamily for custom rendering\n options: HEADING_FONT_OPTIONS,\n admin: {\n width: '50%',\n components: {\n Field: '@kilivi/payloadcms-theme-management/fields/FontSelectField',\n },\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n name: 'bodyFontCustom',\n type: 'text',\n label: {\n en: 'Custom body font stack',\n cs: 'Vlastní písmo pro text',\n },\n admin: {\n width: '50%',\n placeholder: '\"IBM Plex Sans\", sans-serif',\n description: {\n en: 'Provide full CSS font-family stack when using a custom font.',\n cs: 'Při volbě vlastního písma zadejte celý CSS zápis font-family.',\n },\n condition: (_, siblingData) => siblingData?.bodyFont === 'custom',\n },\n },\n {\n name: 'headingFontCustom',\n type: 'text',\n label: {\n en: 'Custom heading font stack',\n cs: 'Vlastní písmo pro nadpisy',\n },\n admin: {\n width: '50%',\n placeholder: '\"Cormorant Garamond\", serif',\n description: {\n en: 'Provide full CSS font-family stack when using a custom heading font.',\n cs: 'Při volbě vlastního nadpisového písma zadejte celý CSS zápis font-family.',\n },\n condition: (_, siblingData) => siblingData?.headingFont === 'custom',\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n name: 'baseFontSize',\n type: 'select',\n label: {\n en: 'Base font size',\n cs: 'Základní velikost písma',\n },\n defaultValue: 'preset',\n options: BASE_FONT_SIZE_OPTIONS.map((option) => ({\n label: option.label,\n value: option.value,\n })),\n admin: {\n width: '50%',\n },\n },\n {\n name: 'lineHeight',\n type: 'select',\n label: {\n en: 'Line height',\n cs: 'Řádkování',\n },\n defaultValue: 'preset',\n options: LINE_HEIGHT_OPTIONS.map((option) => ({\n label: option.label,\n value: option.value,\n })),\n admin: {\n width: '50%',\n },\n },\n ],\n },\n ],\n },\n ],\n })\n }\n\n // Design Customization (only when NOT using extended theme configuration)\n if (!enableAdvancedFeatures) {\n fields.push({\n type: 'collapsible',\n label: {\n en: '✨ Design Customization',\n cs: '✨ Přizpůsobení designu',\n },\n admin: {\n initCollapsed: true,\n },\n fields: [\n {\n name: 'borderRadius',\n type: 'select',\n label: {\n en: 'Border Radius',\n cs: 'Zaoblení rohů',\n },\n defaultValue: 'medium',\n options: [\n { label: { en: 'None', cs: 'Žádné' }, value: 'none' },\n { label: { en: 'Small', cs: 'Malé' }, value: 'small' },\n { label: { en: 'Medium', cs: 'Střední' }, value: 'medium' },\n { label: { en: 'Large', cs: 'Velké' }, value: 'large' },\n { label: { en: 'Full', cs: 'Plné' }, value: 'xl' },\n ],\n admin: {\n components: {\n Field: '@kilivi/payloadcms-theme-management/fields/RadiusField',\n },\n width: '33%',\n },\n },\n {\n name: 'fontScale',\n type: 'select',\n label: {\n en: 'Font Scale',\n cs: 'Velikost písma',\n },\n defaultValue: 'medium',\n options: [\n { label: { en: 'Small', cs: 'Malé' }, value: 'small' },\n { label: { en: 'Medium', cs: 'Střední' }, value: 'medium' },\n { label: { en: 'Large', cs: 'Velké' }, value: 'large' },\n ],\n admin: {\n width: '33%',\n },\n },\n {\n name: 'spacing',\n type: 'select',\n label: {\n en: 'Spacing',\n cs: 'Mezery',\n },\n defaultValue: 'medium',\n options: [\n { label: { en: 'Compact', cs: 'Kompaktní' }, value: 'compact' },\n { label: { en: 'Medium', cs: 'Střední' }, value: 'medium' },\n { label: { en: 'Spacious', cs: 'Prostorné' }, value: 'spacious' },\n ],\n admin: {\n width: '34%',\n },\n },\n ],\n })\n } // End of !enableAdvancedFeatures block\n\n // Advanced Settings (when using extended theme configuration)\n if (enableAdvancedFeatures) {\n const advancedFields: Field[] = [\n {\n name: 'animationLevel',\n type: 'select',\n label: {\n en: 'Animation Level',\n cs: 'Úroveň animací',\n },\n defaultValue: 'medium',\n options: [\n { label: { en: 'None', cs: 'Žádné' }, value: 'none' },\n { label: { en: 'Reduced', cs: 'Snížené' }, value: 'reduced' },\n { label: { en: 'Medium', cs: 'Střední' }, value: 'medium' },\n { label: { en: 'High', cs: 'Vysoké' }, value: 'high' },\n ],\n admin: {\n description: {\n en: 'Control website animations and transitions',\n cs: 'Kontrola animací a přechodů na webu',\n },\n width: '50%',\n },\n },\n ]\n\n if (includeCustomCSS) {\n advancedFields.push({\n name: 'customCSS',\n type: 'code',\n label: {\n en: 'Custom CSS',\n cs: 'Vlastní CSS',\n },\n admin: {\n language: 'css',\n description: {\n en: 'Add custom CSS to override default styles',\n cs: 'Přidejte vlastní CSS pro přepsání výchozích stylů',\n },\n // placeholder:\n // ':root {\\n --primary: #your-color;\\n --border-radius: 8px;\\n --font-family: \"Your Font\";\\n}\\n\\n.custom-class {\\n /* Your custom styles */\\n}',\n // rows: 8,\n },\n })\n }\n\n fields.push({\n type: 'collapsible',\n label: {\n en: '⚙️ Advanced Settings',\n cs: '⚙️ Pokročilé nastavení',\n },\n admin: {\n initCollapsed: true,\n },\n fields: advancedFields,\n })\n }\n\n // Return just the tab configuration, not the full tabs field\n // Return as group field with all theme configuration\n return {\n name: 'themeConfiguration',\n type: 'group',\n label: {\n en: '🎨 Appearance Settings',\n cs: '🎨 Nastavení vzhledu',\n },\n admin: {\n description: {\n en: 'Configure website appearance and styling',\n cs: 'Nakonfigurujte vzhled a stylování webu',\n },\n },\n fields,\n }\n}\n"],"names":["BASE_FONT_SIZE_OPTIONS","BODY_FONT_OPTIONS","HEADING_FONT_OPTIONS","LINE_HEIGHT_OPTIONS","darkModeField","lightModeField","createThemeConfigurationField","options","themePresets","defaultTheme","includeColorModeToggle","includeCustomCSS","enableAdvancedFeatures","themeOptions","map","preset","previewColor","preview","colors","primary","label","value","name","fields","type","required","defaultValue","en","cs","admin","description","components","Field","push","initCollapsed","width","placeholder","condition","_","siblingData","bodyFont","headingFont","option","advancedFields","language"],"mappings":"AACA,SACEA,sBAAsB,EACtBC,iBAAiB,EACjBC,oBAAoB,EACpBC,mBAAmB,QACd,6BAA4B;AAEnC,SAASC,aAAa,EAAEC,cAAc,QAAQ,uBAAsB;AAWpE;;;CAGC,GACD,OAAO,SAASC,8BAA8BC,OAAuC;IACnF,MAAM,EACJC,YAAY,EACZC,YAAY,EACZC,sBAAsB,EACtBC,gBAAgB,EAChBC,yBAAyB,IAAI,EAC9B,GAAGL;IAEJ,MAAMM,eAAeL,aAAaM,GAAG,CAAC,CAACC;QACrC,MAAMC,eAAeD,OAAOE,OAAO,EAAEC,OAAOC;QAC5C,MAAMC,QAAQJ,eAAe,GAAGD,OAAOK,KAAK,CAAC,GAAG,EAAEJ,cAAc,GAAGD,OAAOK,KAAK;QAC/E,OAAO;YACLA;YACAC,OAAON,OAAOO,IAAI;QACpB;IACF;IAEA,MAAMC,SAAkB;QACtB;YACED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AO;oBAAO;iBACtD;gBACDQ,OAAO;oBACLC,aAAa;wBACXH,IAAI;wBACJC,IAAI;oBACN;oBACAO,OAAO;gBACT;YACF;SACD;QAED,IAAIxB,kBAAkB;YACpBgC,eAAeV,IAAI,CAAC;gBAClBX,MAAM;gBACNE,MAAM;gBACNJ,OAAO;oBACLO,IAAI;oBACJC,IAAI;gBACN;gBACAC,OAAO;oBACLe,UAAU;oBACVd,aAAa;wBACXH,IAAI;wBACJC,IAAI;oBACN;gBAIF;YACF;QACF;QAEAL,OAAOU,IAAI,CAAC;YACVT,MAAM;YACNJ,OAAO;gBACLO,IAAI;gBACJC,IAAI;YACN;YACAC,OAAO;gBACLK,eAAe;YACjB;YACAX,QAAQoB;QACV;IACF;IAEA,6DAA6D;IAC7D,qDAAqD;IACrD,OAAO;QACLrB,MAAM;QACNE,MAAM;QACNJ,OAAO;YACLO,IAAI;YACJC,IAAI;QACN;QACAC,OAAO;YACLC,aAAa;gBACXH,IAAI;gBACJC,IAAI;YACN;QACF;QACAL;IACF;AACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -21,7 +21,6 @@ export { getThemeHtmlAttributes } from './utils/themeHtmlAttributes.js';
|
|
|
21
21
|
export type { Mode, ThemeDefaults } from './providers/Theme/types.js';
|
|
22
22
|
export { ThemeProvider } from './providers/Theme/index.js';
|
|
23
23
|
export { getFontLoaderCode, getThemeFontFamilies, ThemeFontProvider, useThemeFonts, FONT_IMPORT_MAP, } from './providers/font-loader.js';
|
|
24
|
-
export { ThemeLivePreview } from './fields/ThemeLivePreview.js';
|
|
25
24
|
export declare const ThemeManagementPlugin: (options?: ThemeManagementPluginOptions) => Plugin;
|
|
26
25
|
/** @deprecated use {@link themeManagementPlugin} */
|
|
27
26
|
export declare const themeConfigurationPlugin: (options?: ThemeManagementPluginOptions) => Plugin;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts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B,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,iCAAiC,CAAA;AACxC,YAAY,EAAE,4BAA4B,EAAE,8BAA8B,EAAE,MAAM,YAAY,CAAA;AAC9F,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,GAC1B,MAAM,sCAAsC,CAAA;AAC7C,YAAY,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAA;AACtF,OAAO,EAAE,sBAAsB,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACzE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAA;AAEvE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAG1D,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,eAAe,GAChB,MAAM,4BAA4B,CAAA;AAMnC,eAAO,MAAM,qBAAqB,aAxKa,4BAA4B,KAAQ,MAwKzB,CAAA;AAC1D,oDAAoD;AACpD,eAAO,MAAM,wBAAwB,aA1KU,4BAA4B,KAAQ,MA0KtB,CAAA;AAE7D,eAAe,qBAAqB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,59 +1,19 @@
|
|
|
1
1
|
import { createThemeConfigurationField } from './fields/themeConfigurationField.js';
|
|
2
2
|
import { defaultThemePresets } from './presets.js';
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const existingFields = fields ?? [];
|
|
11
|
-
// Find existing tabs field
|
|
12
|
-
const tabsFieldIndex = existingFields.findIndex((field)=>'type' in field && field.type === 'tabs');
|
|
13
|
-
if (tabsFieldIndex === -1) {
|
|
14
|
-
// No tabs field exists - add theme configuration as group field instead
|
|
15
|
-
if (enableLogging) {
|
|
16
|
-
console.log('🎨 Theme Management Plugin: No tabs field found, adding theme configuration as group field');
|
|
17
|
-
}
|
|
18
|
-
return [
|
|
19
|
-
...existingFields,
|
|
20
|
-
{
|
|
21
|
-
name: THEME_TAB_NAME,
|
|
22
|
-
type: 'group',
|
|
23
|
-
label: themeTabConfig.label,
|
|
24
|
-
admin: {
|
|
25
|
-
description: themeTabConfig.description
|
|
26
|
-
},
|
|
27
|
-
fields: themeTabConfig.fields
|
|
28
|
-
}
|
|
29
|
-
];
|
|
30
|
-
}
|
|
31
|
-
// Tabs field exists - inject our tab into it
|
|
3
|
+
const THEME_FIELD_NAME = 'themeConfiguration';
|
|
4
|
+
const removeExistingThemeField = (fields = [])=>fields.filter((field)=>{
|
|
5
|
+
const candidate = field;
|
|
6
|
+
return candidate?.name !== THEME_FIELD_NAME;
|
|
7
|
+
});
|
|
8
|
+
const upsertThemeField = (fields, themeField, enableLogging)=>{
|
|
9
|
+
const sanitized = removeExistingThemeField(fields ?? []);
|
|
32
10
|
if (enableLogging) {
|
|
33
|
-
console.log('🎨 Theme Management Plugin:
|
|
11
|
+
console.log('🎨 Theme Management Plugin: injecting theme configuration field');
|
|
34
12
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return existingFields;
|
|
39
|
-
}
|
|
40
|
-
const existingTabs = tabsField.tabs || [];
|
|
41
|
-
// Remove existing theme tab if present
|
|
42
|
-
const sanitizedTabs = removeExistingThemeTab(existingTabs);
|
|
43
|
-
// Create new tabs field with our tab added
|
|
44
|
-
const updatedTabsField = {
|
|
45
|
-
...tabsField,
|
|
46
|
-
tabs: [
|
|
47
|
-
...sanitizedTabs,
|
|
48
|
-
themeTabConfig
|
|
49
|
-
]
|
|
50
|
-
};
|
|
51
|
-
// Return fields array with updated tabs field
|
|
52
|
-
const newFields = [
|
|
53
|
-
...existingFields
|
|
13
|
+
return [
|
|
14
|
+
...sanitized,
|
|
15
|
+
themeField
|
|
54
16
|
];
|
|
55
|
-
newFields[tabsFieldIndex] = updatedTabsField;
|
|
56
|
-
return newFields;
|
|
57
17
|
};
|
|
58
18
|
const ensureCollectionsArray = (collections)=>Array.isArray(collections) ? collections : [];
|
|
59
19
|
export const themeManagementPlugin = (options = {})=>{
|
|
@@ -65,7 +25,7 @@ export const themeManagementPlugin = (options = {})=>{
|
|
|
65
25
|
}
|
|
66
26
|
return config;
|
|
67
27
|
}
|
|
68
|
-
const
|
|
28
|
+
const themeField = createThemeConfigurationField({
|
|
69
29
|
themePresets,
|
|
70
30
|
defaultTheme,
|
|
71
31
|
includeColorModeToggle,
|
|
@@ -83,7 +43,7 @@ export const themeManagementPlugin = (options = {})=>{
|
|
|
83
43
|
console.log(`🎨 Theme Management Plugin: enhancing collection "${collection.slug}"`);
|
|
84
44
|
}
|
|
85
45
|
const existingFields = Array.isArray(collection.fields) ? collection.fields : [];
|
|
86
|
-
const fields =
|
|
46
|
+
const fields = upsertThemeField(existingFields, themeField, enableLogging);
|
|
87
47
|
return {
|
|
88
48
|
...collection,
|
|
89
49
|
fields
|
|
@@ -95,30 +55,9 @@ export const themeManagementPlugin = (options = {})=>{
|
|
|
95
55
|
}
|
|
96
56
|
return config;
|
|
97
57
|
}
|
|
98
|
-
// Add custom admin view for theme preview
|
|
99
|
-
// Uses ThemePreviewLoader to avoid CSS import issues during generate:importmap
|
|
100
|
-
const admin = {
|
|
101
|
-
...config.admin,
|
|
102
|
-
components: {
|
|
103
|
-
...config.admin?.components,
|
|
104
|
-
views: {
|
|
105
|
-
...config.admin?.components?.views,
|
|
106
|
-
themePreview: {
|
|
107
|
-
Component: '@kilivi/payloadcms-theme-management/views/ThemePreviewView#default',
|
|
108
|
-
path: '/theme-preview',
|
|
109
|
-
exact: true,
|
|
110
|
-
meta: {
|
|
111
|
-
title: 'Theme Preview',
|
|
112
|
-
description: 'Real-time preview of your theme configuration'
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
58
|
return {
|
|
119
59
|
...config,
|
|
120
|
-
collections
|
|
121
|
-
admin
|
|
60
|
+
collections
|
|
122
61
|
};
|
|
123
62
|
};
|
|
124
63
|
};
|
|
@@ -168,8 +107,9 @@ export { getThemeHtmlAttributes } from './utils/themeHtmlAttributes.js';
|
|
|
168
107
|
export { ThemeProvider } from './providers/Theme/index.js';
|
|
169
108
|
// Font loading utilities for Next.js integration
|
|
170
109
|
export { getFontLoaderCode, getThemeFontFamilies, ThemeFontProvider, useThemeFonts, FONT_IMPORT_MAP } from './providers/font-loader.js';
|
|
171
|
-
//
|
|
172
|
-
|
|
110
|
+
// Note: Do NOT re-export client components from the root entry to avoid
|
|
111
|
+
// server-side evaluation during `payload generate:importmap`.
|
|
112
|
+
// If needed, import directly from subpath: `@kilivi/payloadcms-theme-management/fields/ThemeLivePreview`
|
|
173
113
|
export const ThemeManagementPlugin = themeManagementPlugin;
|
|
174
114
|
/** @deprecated use {@link themeManagementPlugin} */ export const themeConfigurationPlugin = themeManagementPlugin;
|
|
175
115
|
export default themeManagementPlugin;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { CollectionConfig, Config, Field, Plugin } from 'payload'\nimport { createThemeConfigurationField } from './fields/themeConfigurationField.js'\nimport type { SiteThemeConfiguration } from './payload-types.js'\nimport type { ThemePreset } from './presets.js'\nimport { defaultThemePresets } from './presets.js'\nimport type { FetchThemeConfigurationOptions, ThemeManagementPluginOptions } from './types.js'\n\nconst THEME_TAB_NAME = 'themeConfiguration'\n\ninterface TabConfig {\n name: string\n label: { en: string; cs: string }\n description?: { en: string; cs: string }\n fields: Field[]\n}\n\n/**\n * Remove existing theme tab from tabs field\n */\nconst removeExistingThemeTab = (tabs: TabConfig[]): TabConfig[] =>\n tabs.filter((tab) => tab?.name !== THEME_TAB_NAME)\n\n/**\n * Add theme configuration tab to existing tabs field or create fields array\n */\nconst upsertThemeTab = (\n fields: Field[] | undefined,\n themeTabConfig: TabConfig,\n enableLogging: boolean,\n): Field[] => {\n const existingFields = fields ?? []\n\n // Find existing tabs field\n const tabsFieldIndex = existingFields.findIndex(\n (field) => 'type' in field && field.type === 'tabs',\n )\n\n if (tabsFieldIndex === -1) {\n // No tabs field exists - add theme configuration as group field instead\n if (enableLogging) {\n console.log(\n '🎨 Theme Management Plugin: No tabs field found, adding theme configuration as group field',\n )\n }\n\n return [\n ...existingFields,\n {\n name: THEME_TAB_NAME,\n type: 'group',\n label: themeTabConfig.label,\n admin: {\n description: themeTabConfig.description,\n },\n fields: themeTabConfig.fields,\n },\n ]\n }\n\n // Tabs field exists - inject our tab into it\n if (enableLogging) {\n console.log('🎨 Theme Management Plugin: Adding theme configuration tab to existing tabs')\n }\n\n const tabsField = existingFields[tabsFieldIndex]\n\n if (!('tabs' in tabsField)) {\n console.warn('🎨 Theme Management Plugin: Found tabs field but it has no tabs property')\n return existingFields\n }\n\n const existingTabs = (tabsField.tabs as TabConfig[]) || []\n\n // Remove existing theme tab if present\n const sanitizedTabs = removeExistingThemeTab(existingTabs)\n\n // Create new tabs field with our tab added\n const updatedTabsField = {\n ...tabsField,\n tabs: [...sanitizedTabs, themeTabConfig],\n }\n\n // Return fields array with updated tabs field\n const newFields = [...existingFields]\n newFields[tabsFieldIndex] = updatedTabsField\n\n return newFields\n}\n\nconst ensureCollectionsArray = (collections: Config['collections']): CollectionConfig[] =>\n Array.isArray(collections) ? collections : []\n\nexport const themeManagementPlugin = (options: ThemeManagementPluginOptions = {}): Plugin => {\n return (config: Config): Config => {\n const {\n enabled = true,\n targetCollection = 'site-settings',\n themePresets = defaultThemePresets,\n defaultTheme = 'cool',\n includeColorModeToggle = true,\n includeCustomCSS = true,\n includeBrandIdentity = false,\n enableAdvancedFeatures = true,\n enableLogging = false,\n } = options\n\n if (!enabled) {\n if (enableLogging) {\n console.log('🎨 Theme Management Plugin: disabled via options, skipping.')\n }\n return config\n }\n\n const themeTabConfig = createThemeConfigurationField({\n themePresets,\n defaultTheme,\n includeColorModeToggle,\n includeCustomCSS,\n includeBrandIdentity: includeBrandIdentity ?? false,\n enableAdvancedFeatures,\n })\n\n let collectionTouched = false\n\n const collections = ensureCollectionsArray(config.collections).map((collection) => {\n if (collection.slug !== targetCollection) {\n return collection\n }\n\n collectionTouched = true\n\n if (enableLogging) {\n console.log(`🎨 Theme Management Plugin: enhancing collection \"${collection.slug}\"`)\n }\n\n const existingFields = Array.isArray(collection.fields) ? collection.fields : []\n\n const fields = upsertThemeTab(existingFields, themeTabConfig, enableLogging)\n\n return {\n ...collection,\n fields,\n }\n })\n\n if (!collectionTouched) {\n if (enableLogging) {\n console.warn(\n `🎨 Theme Management Plugin: collection \"${targetCollection}\" was not found, leaving config untouched.`,\n )\n }\n return config\n }\n\n // Add custom admin view for theme preview\n // Uses ThemePreviewLoader to avoid CSS import issues during generate:importmap\n const admin = {\n ...config.admin,\n components: {\n ...config.admin?.components,\n views: {\n ...config.admin?.components?.views,\n themePreview: {\n Component: '@kilivi/payloadcms-theme-management/views/ThemePreviewView#default',\n path: '/theme-preview' as `/${string}`,\n exact: true,\n meta: {\n title: 'Theme Preview',\n description: 'Real-time preview of your theme configuration',\n },\n },\n },\n },\n }\n\n return {\n ...config,\n collections,\n admin,\n }\n }\n}\n\ntype FetchOptionsInput = string | FetchThemeConfigurationOptions\n\nexport const fetchThemeConfiguration = async (\n options?: FetchOptionsInput,\n): Promise<SiteThemeConfiguration | null> => {\n const normalizedOptions = typeof options === 'string' ? { tenantSlug: options } : (options ?? {})\n\n const {\n tenantSlug,\n collectionSlug = 'site-settings',\n depth,\n locale,\n draft,\n queryParams = {},\n } = normalizedOptions\n\n const params = new URLSearchParams({ limit: '1' })\n\n if (typeof depth === 'number') params.set('depth', String(depth))\n if (tenantSlug) params.set('tenant', tenantSlug)\n if (locale) params.set('locale', locale)\n if (draft) params.set('draft', 'true')\n\n Object.entries(queryParams).forEach(([key, value]) => {\n if (value === undefined) return\n params.set(key, String(value))\n })\n\n const url = `/api/${collectionSlug}?${params.toString()}`\n\n try {\n const response = await fetch(url)\n if (!response.ok) {\n throw new Error(`Failed to fetch theme configuration (status ${response.status})`)\n }\n\n const data = (await response.json()) as {\n docs?: Array<{ themeConfiguration?: SiteThemeConfiguration }>\n }\n\n const doc = data.docs?.[0]\n\n return doc?.themeConfiguration ?? null\n } catch (error) {\n console.warn('Failed to fetch theme configuration:', error)\n return null\n }\n}\n\nexport const getThemePreset = (themeName: string): ThemePreset | null => {\n return defaultThemePresets.find((preset) => preset.name === themeName) || null\n}\n\nexport const getAvailableThemePresets = (): ThemePreset[] => {\n return defaultThemePresets\n}\n\nexport { defaultThemePresets } from './presets.js'\nexport type { ThemePreset, ThemeTypographyPreset } from './presets.js'\nexport {\n extendedThemePresets,\n allExtendedThemePresets,\n extendedThemeToCSSVariables,\n} from './extended-presets.js'\nexport type { ExtendedThemePreset, ShadcnColorTokens } from './extended-presets.js'\nexport {\n applyExtendedTheme,\n generateExtendedThemeCSS,\n resetExtendedTheme,\n getExtendedThemeTokens,\n createUseExtendedTheme,\n getTailwindVarReferences,\n} from './utils/extendedThemeHelpers.js'\nexport type { ThemeManagementPluginOptions, FetchThemeConfigurationOptions } from './types.js'\nexport {\n DEFAULT_THEME_CONFIGURATION,\n resolveThemeConfiguration,\n} from './utils/resolveThemeConfiguration.js'\nexport type { ResolvedThemeConfiguration } from './utils/resolveThemeConfiguration.js'\nexport { generateThemeColorsCss, hexToHsl } from './utils/themeColors.js'\nexport { generateThemeCSS, getThemeStyles } from './utils/themeUtils.js'\nexport { getThemeHtmlAttributes } from './utils/themeHtmlAttributes.js'\n\nexport type { Mode, ThemeDefaults } from './providers/Theme/types.js'\nexport { ThemeProvider } from './providers/Theme/index.js'\n\n// Font loading utilities for Next.js integration\nexport {\n getFontLoaderCode,\n getThemeFontFamilies,\n ThemeFontProvider,\n useThemeFonts,\n FONT_IMPORT_MAP,\n} from './providers/font-loader.js'\n\n// Components\nexport { ThemeLivePreview } from './fields/ThemeLivePreview.js'\n\nexport const ThemeManagementPlugin = themeManagementPlugin\n/** @deprecated use {@link themeManagementPlugin} */\nexport const themeConfigurationPlugin = themeManagementPlugin\n\nexport default themeManagementPlugin\n"],"names":["createThemeConfigurationField","defaultThemePresets","THEME_TAB_NAME","removeExistingThemeTab","tabs","filter","tab","name","upsertThemeTab","fields","themeTabConfig","enableLogging","existingFields","tabsFieldIndex","findIndex","field","type","console","log","label","admin","description","tabsField","warn","existingTabs","sanitizedTabs","updatedTabsField","newFields","ensureCollectionsArray","collections","Array","isArray","themeManagementPlugin","options","config","enabled","targetCollection","themePresets","defaultTheme","includeColorModeToggle","includeCustomCSS","includeBrandIdentity","enableAdvancedFeatures","collectionTouched","map","collection","slug","components","views","themePreview","Component","path","exact","meta","title","fetchThemeConfiguration","normalizedOptions","tenantSlug","collectionSlug","depth","locale","draft","queryParams","params","URLSearchParams","limit","set","String","Object","entries","forEach","key","value","undefined","url","toString","response","fetch","ok","Error","status","data","json","doc","docs","themeConfiguration","error","getThemePreset","themeName","find","preset","getAvailableThemePresets","extendedThemePresets","allExtendedThemePresets","extendedThemeToCSSVariables","applyExtendedTheme","generateExtendedThemeCSS","resetExtendedTheme","getExtendedThemeTokens","createUseExtendedTheme","getTailwindVarReferences","DEFAULT_THEME_CONFIGURATION","resolveThemeConfiguration","generateThemeColorsCss","hexToHsl","generateThemeCSS","getThemeStyles","getThemeHtmlAttributes","ThemeProvider","getFontLoaderCode","getThemeFontFamilies","ThemeFontProvider","useThemeFonts","FONT_IMPORT_MAP","ThemeLivePreview","ThemeManagementPlugin","themeConfigurationPlugin"],"mappings":"AACA,SAASA,6BAA6B,QAAQ,sCAAqC;AAGnF,SAASC,mBAAmB,QAAQ,eAAc;AAGlD,MAAMC,iBAAiB;AASvB;;CAEC,GACD,MAAMC,yBAAyB,CAACC,OAC9BA,KAAKC,MAAM,CAAC,CAACC,MAAQA,KAAKC,SAASL;AAErC;;CAEC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,SAAWA,OAAOnF,IAAI,KAAKiF,cAAc;AAC5E,EAAC;AAED,OAAO,MAAMG,2BAA2B;IACtC,OAAO1F;AACT,EAAC;AAED,SAASA,mBAAmB,QAAQ,eAAc;AAElD,SACE2F,oBAAoB,EACpBC,uBAAuB,EACvBC,2BAA2B,QACtB,wBAAuB;AAE9B,SACEC,kBAAkB,EAClBC,wBAAwB,EACxBC,kBAAkB,EAClBC,sBAAsB,EACtBC,sBAAsB,EACtBC,wBAAwB,QACnB,kCAAiC;AAExC,SACEC,2BAA2B,EAC3BC,yBAAyB,QACpB,uCAAsC;AAE7C,SAASC,sBAAsB,EAAEC,QAAQ,QAAQ,yBAAwB;AACzE,SAASC,gBAAgB,EAAEC,cAAc,QAAQ,wBAAuB;AACxE,SAASC,sBAAsB,QAAQ,iCAAgC;AAGvE,SAASC,aAAa,QAAQ,6BAA4B;AAE1D,iDAAiD;AACjD,SACEC,iBAAiB,EACjBC,oBAAoB,EACpBC,iBAAiB,EACjBC,aAAa,EACbC,eAAe,QACV,6BAA4B;AAEnC,aAAa;AACb,SAASC,gBAAgB,QAAQ,+BAA8B;AAE/D,OAAO,MAAMC,wBAAwBnF,sBAAqB;AAC1D,kDAAkD,GAClD,OAAO,MAAMoF,2BAA2BpF,sBAAqB;AAE7D,eAAeA,sBAAqB"}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { CollectionConfig, Config, Field, Plugin } from 'payload'\nimport { createThemeConfigurationField } from './fields/themeConfigurationField.js'\nimport type { SiteThemeConfiguration } from './payload-types.js'\nimport type { ThemePreset } from './presets.js'\nimport { defaultThemePresets } from './presets.js'\nimport type { FetchThemeConfigurationOptions, ThemeManagementPluginOptions } from './types.js'\n\nconst THEME_FIELD_NAME = 'themeConfiguration'\n\nconst removeExistingThemeField = (fields: Field[] = []): Field[] =>\n fields.filter((field) => {\n const candidate = field as { name?: unknown }\n return candidate?.name !== THEME_FIELD_NAME\n })\n\nconst upsertThemeField = (\n fields: Field[] | undefined,\n themeField: Field,\n enableLogging: boolean,\n): Field[] => {\n const sanitized = removeExistingThemeField(fields ?? [])\n\n if (enableLogging) {\n console.log('🎨 Theme Management Plugin: injecting theme configuration field')\n }\n\n return [...sanitized, themeField]\n}\n\nconst ensureCollectionsArray = (collections: Config['collections']): CollectionConfig[] =>\n Array.isArray(collections) ? collections : []\n\nexport const themeManagementPlugin = (options: ThemeManagementPluginOptions = {}): Plugin => {\n return (config: Config): Config => {\n const {\n enabled = true,\n targetCollection = 'site-settings',\n themePresets = defaultThemePresets,\n defaultTheme = 'cool',\n includeColorModeToggle = true,\n includeCustomCSS = true,\n includeBrandIdentity = false,\n enableAdvancedFeatures = true,\n enableLogging = false,\n } = options\n\n if (!enabled) {\n if (enableLogging) {\n console.log('🎨 Theme Management Plugin: disabled via options, skipping.')\n }\n return config\n }\n\n const themeField = createThemeConfigurationField({\n themePresets,\n defaultTheme,\n includeColorModeToggle,\n includeCustomCSS,\n includeBrandIdentity: includeBrandIdentity ?? false,\n enableAdvancedFeatures,\n })\n\n let collectionTouched = false\n\n const collections = ensureCollectionsArray(config.collections).map((collection) => {\n if (collection.slug !== targetCollection) {\n return collection\n }\n\n collectionTouched = true\n\n if (enableLogging) {\n console.log(`🎨 Theme Management Plugin: enhancing collection \"${collection.slug}\"`)\n }\n\n const existingFields = Array.isArray(collection.fields) ? collection.fields : []\n\n const fields = upsertThemeField(existingFields, themeField, enableLogging)\n\n return {\n ...collection,\n fields,\n }\n })\n\n if (!collectionTouched) {\n if (enableLogging) {\n console.warn(\n `🎨 Theme Management Plugin: collection \"${targetCollection}\" was not found, leaving config untouched.`,\n )\n }\n return config\n }\n\n return {\n ...config,\n collections,\n }\n }\n}\n\ntype FetchOptionsInput = string | FetchThemeConfigurationOptions\n\nexport const fetchThemeConfiguration = async (\n options?: FetchOptionsInput,\n): Promise<SiteThemeConfiguration | null> => {\n const normalizedOptions = typeof options === 'string' ? { tenantSlug: options } : (options ?? {})\n\n const {\n tenantSlug,\n collectionSlug = 'site-settings',\n depth,\n locale,\n draft,\n queryParams = {},\n } = normalizedOptions\n\n const params = new URLSearchParams({ limit: '1' })\n\n if (typeof depth === 'number') params.set('depth', String(depth))\n if (tenantSlug) params.set('tenant', tenantSlug)\n if (locale) params.set('locale', locale)\n if (draft) params.set('draft', 'true')\n\n Object.entries(queryParams).forEach(([key, value]) => {\n if (value === undefined) return\n params.set(key, String(value))\n })\n\n const url = `/api/${collectionSlug}?${params.toString()}`\n\n try {\n const response = await fetch(url)\n if (!response.ok) {\n throw new Error(`Failed to fetch theme configuration (status ${response.status})`)\n }\n\n const data = (await response.json()) as {\n docs?: Array<{ themeConfiguration?: SiteThemeConfiguration }>\n }\n\n const doc = data.docs?.[0]\n\n return doc?.themeConfiguration ?? null\n } catch (error) {\n console.warn('Failed to fetch theme configuration:', error)\n return null\n }\n}\n\nexport const getThemePreset = (themeName: string): ThemePreset | null => {\n return defaultThemePresets.find((preset) => preset.name === themeName) || null\n}\n\nexport const getAvailableThemePresets = (): ThemePreset[] => {\n return defaultThemePresets\n}\n\nexport { defaultThemePresets } from './presets.js'\nexport type { ThemePreset, ThemeTypographyPreset } from './presets.js'\nexport {\n extendedThemePresets,\n allExtendedThemePresets,\n extendedThemeToCSSVariables,\n} from './extended-presets.js'\nexport type { ExtendedThemePreset, ShadcnColorTokens } from './extended-presets.js'\nexport {\n applyExtendedTheme,\n generateExtendedThemeCSS,\n resetExtendedTheme,\n getExtendedThemeTokens,\n createUseExtendedTheme,\n getTailwindVarReferences,\n} from './utils/extendedThemeHelpers.js'\nexport type { ThemeManagementPluginOptions, FetchThemeConfigurationOptions } from './types.js'\nexport {\n DEFAULT_THEME_CONFIGURATION,\n resolveThemeConfiguration,\n} from './utils/resolveThemeConfiguration.js'\nexport type { ResolvedThemeConfiguration } from './utils/resolveThemeConfiguration.js'\nexport { generateThemeColorsCss, hexToHsl } from './utils/themeColors.js'\nexport { generateThemeCSS, getThemeStyles } from './utils/themeUtils.js'\nexport { getThemeHtmlAttributes } from './utils/themeHtmlAttributes.js'\n\nexport type { Mode, ThemeDefaults } from './providers/Theme/types.js'\nexport { ThemeProvider } from './providers/Theme/index.js'\n\n// Font loading utilities for Next.js integration\nexport {\n getFontLoaderCode,\n getThemeFontFamilies,\n ThemeFontProvider,\n useThemeFonts,\n FONT_IMPORT_MAP,\n} from './providers/font-loader.js'\n\n// Note: Do NOT re-export client components from the root entry to avoid\n// server-side evaluation during `payload generate:importmap`.\n// If needed, import directly from subpath: `@kilivi/payloadcms-theme-management/fields/ThemeLivePreview`\n\nexport const ThemeManagementPlugin = themeManagementPlugin\n/** @deprecated use {@link themeManagementPlugin} */\nexport const themeConfigurationPlugin = themeManagementPlugin\n\nexport default themeManagementPlugin\n"],"names":["createThemeConfigurationField","defaultThemePresets","THEME_FIELD_NAME","removeExistingThemeField","fields","filter","field","candidate","name","upsertThemeField","themeField","enableLogging","sanitized","console","log","ensureCollectionsArray","collections","Array","isArray","themeManagementPlugin","options","config","enabled","targetCollection","themePresets","defaultTheme","includeColorModeToggle","includeCustomCSS","includeBrandIdentity","enableAdvancedFeatures","collectionTouched","map","collection","slug","existingFields","warn","fetchThemeConfiguration","normalizedOptions","tenantSlug","collectionSlug","depth","locale","draft","queryParams","params","URLSearchParams","limit","set","String","Object","entries","forEach","key","value","undefined","url","toString","response","fetch","ok","Error","status","data","json","doc","docs","themeConfiguration","error","getThemePreset","themeName","find","preset","getAvailableThemePresets","extendedThemePresets","allExtendedThemePresets","extendedThemeToCSSVariables","applyExtendedTheme","generateExtendedThemeCSS","resetExtendedTheme","getExtendedThemeTokens","createUseExtendedTheme","getTailwindVarReferences","DEFAULT_THEME_CONFIGURATION","resolveThemeConfiguration","generateThemeColorsCss","hexToHsl","generateThemeCSS","getThemeStyles","getThemeHtmlAttributes","ThemeProvider","getFontLoaderCode","getThemeFontFamilies","ThemeFontProvider","useThemeFonts","FONT_IMPORT_MAP","ThemeManagementPlugin","themeConfigurationPlugin"],"mappings":"AACA,SAASA,6BAA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