@kilivi/payloadcms-theme-management 1.1.2 → 2.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/README.md +318 -847
- package/dist/components/AppearanceSessionControls.d.ts +15 -0
- package/dist/components/AppearanceSessionControls.d.ts.map +1 -0
- package/dist/components/AppearanceSessionControls.js +152 -0
- package/dist/components/AppearanceSessionControls.js.map +1 -0
- package/dist/components/ColorModeToggle.css +42 -0
- package/dist/components/ColorModeToggle.d.ts +40 -0
- package/dist/components/ColorModeToggle.d.ts.map +1 -0
- package/dist/components/ColorModeToggle.js +111 -0
- package/dist/components/ColorModeToggle.js.map +1 -0
- package/dist/components/ServerThemeInjector.d.ts.map +1 -1
- package/dist/components/ServerThemeInjector.js +41 -14
- package/dist/components/ServerThemeInjector.js.map +1 -1
- package/dist/components/ThemeLivePreviewSync.d.ts +1 -0
- package/dist/components/ThemeLivePreviewSync.d.ts.map +1 -1
- package/dist/components/ThemeLivePreviewSync.js +1 -1
- package/dist/components/ThemeLivePreviewSync.js.map +1 -1
- package/dist/components/ThemeSwitcher.d.ts +36 -0
- package/dist/components/ThemeSwitcher.d.ts.map +1 -0
- package/dist/components/ThemeSwitcher.js +89 -0
- package/dist/components/ThemeSwitcher.js.map +1 -0
- package/dist/components/typographyPreviewUtils.d.ts.map +1 -1
- package/dist/components/typographyPreviewUtils.js +8 -1
- package/dist/components/typographyPreviewUtils.js.map +1 -1
- package/dist/constants/devicePreviews.d.ts +35 -0
- package/dist/constants/devicePreviews.d.ts.map +1 -0
- package/dist/constants/devicePreviews.js +43 -0
- package/dist/constants/devicePreviews.js.map +1 -0
- package/dist/constants/themeFonts.js +9 -9
- package/dist/constants/themeFonts.js.map +1 -1
- package/dist/extended-presets.d.ts +0 -4
- package/dist/extended-presets.d.ts.map +1 -1
- package/dist/extended-presets.js +1 -18
- package/dist/extended-presets.js.map +1 -1
- package/dist/extended-themes.d.ts.map +1 -1
- package/dist/extended-themes.js +428 -0
- package/dist/extended-themes.js.map +1 -1
- package/dist/fields/AccessibilityAuditField.d.ts +2 -0
- package/dist/fields/AccessibilityAuditField.d.ts.map +1 -0
- package/dist/fields/AccessibilityAuditField.js +303 -0
- package/dist/fields/AccessibilityAuditField.js.map +1 -0
- package/dist/fields/AppearancePreviewField.d.ts +2 -0
- package/dist/fields/AppearancePreviewField.d.ts.map +1 -0
- package/dist/fields/AppearancePreviewField.js +763 -0
- package/dist/fields/AppearancePreviewField.js.map +1 -0
- package/dist/fields/ColorPickerField.d.ts.map +1 -1
- package/dist/fields/ColorPickerField.js +89 -85
- package/dist/fields/ColorPickerField.js.map +1 -1
- package/dist/fields/FontSelectField.d.ts +6 -0
- package/dist/fields/FontSelectField.d.ts.map +1 -1
- package/dist/fields/FontSelectField.js +195 -122
- package/dist/fields/FontSelectField.js.map +1 -1
- package/dist/fields/PaletteGeneratorField.d.ts +7 -0
- package/dist/fields/PaletteGeneratorField.d.ts.map +1 -0
- package/dist/fields/PaletteGeneratorField.js +327 -0
- package/dist/fields/PaletteGeneratorField.js.map +1 -0
- package/dist/fields/StylePresetField.d.ts +3 -0
- package/dist/fields/StylePresetField.d.ts.map +1 -0
- package/dist/fields/StylePresetField.js +462 -0
- package/dist/fields/StylePresetField.js.map +1 -0
- package/dist/fields/ThemeColorPickerField.css +115 -35
- package/dist/fields/ThemeColorPickerField.d.ts.map +1 -1
- package/dist/fields/ThemeColorPickerField.js +204 -70
- package/dist/fields/ThemeColorPickerField.js.map +1 -1
- package/dist/fields/ThemeExportField.d.ts +6 -0
- package/dist/fields/ThemeExportField.d.ts.map +1 -0
- package/dist/fields/ThemeExportField.js +202 -0
- package/dist/fields/ThemeExportField.js.map +1 -0
- package/dist/fields/ThemePresetImportField.d.ts.map +1 -1
- package/dist/fields/ThemePresetImportField.js +56 -25
- package/dist/fields/ThemePresetImportField.js.map +1 -1
- package/dist/fields/ThemePreviewField.css +382 -5
- package/dist/fields/ThemePreviewField.d.ts.map +1 -1
- package/dist/fields/ThemePreviewField.js +268 -170
- package/dist/fields/ThemePreviewField.js.map +1 -1
- package/dist/fields/ThemeTokenSelectField.d.ts.map +1 -1
- package/dist/fields/ThemeTokenSelectField.js +278 -80
- package/dist/fields/ThemeTokenSelectField.js.map +1 -1
- package/dist/fields/colorFieldHelpers.d.ts +90 -0
- package/dist/fields/colorFieldHelpers.d.ts.map +1 -0
- package/dist/fields/colorFieldHelpers.js +133 -0
- package/dist/fields/colorFieldHelpers.js.map +1 -0
- package/dist/fields/colorModeFields.d.ts +1 -1
- package/dist/fields/colorModeFields.d.ts.map +1 -1
- package/dist/fields/colorModeFields.js +49 -7
- package/dist/fields/colorModeFields.js.map +1 -1
- package/dist/fields/themeConfigurationField.d.ts +8 -1
- package/dist/fields/themeConfigurationField.d.ts.map +1 -1
- package/dist/fields/themeConfigurationField.js +961 -29
- package/dist/fields/themeConfigurationField.js.map +1 -1
- package/dist/globals/ThemeSettings/FontPicker/FontPreview.d.ts.map +1 -1
- package/dist/globals/ThemeSettings/FontPicker/FontPreview.js +8 -4
- package/dist/globals/ThemeSettings/FontPicker/FontPreview.js.map +1 -1
- package/dist/globals/ThemeSettings/FontPicker/index.d.ts.map +1 -1
- package/dist/globals/ThemeSettings/FontPicker/index.js +81 -26
- package/dist/globals/ThemeSettings/FontPicker/index.js.map +1 -1
- package/dist/globals/ThemeSettings/FontPicker/styles.css +98 -41
- package/dist/globals/ThemeSettings/FontPicker/translations.d.ts +6 -0
- package/dist/globals/ThemeSettings/FontPicker/translations.d.ts.map +1 -1
- package/dist/globals/ThemeSettings/FontPicker/translations.js +14 -2
- package/dist/globals/ThemeSettings/FontPicker/translations.js.map +1 -1
- package/dist/globals/ThemeSettings/config.d.ts.map +1 -1
- package/dist/globals/ThemeSettings/config.js +76 -79
- package/dist/globals/ThemeSettings/config.js.map +1 -1
- package/dist/globals/ThemeSettings/fields/FontLoadingGuideField.d.ts.map +1 -1
- package/dist/globals/ThemeSettings/fields/FontLoadingGuideField.js +63 -62
- package/dist/globals/ThemeSettings/fields/FontLoadingGuideField.js.map +1 -1
- package/dist/globals/ThemeSettings/fields/TypographyInfoField.d.ts.map +1 -1
- package/dist/globals/ThemeSettings/fields/TypographyInfoField.js +22 -25
- package/dist/globals/ThemeSettings/fields/TypographyInfoField.js.map +1 -1
- package/dist/hooks/useAppearanceSession.d.ts +50 -0
- package/dist/hooks/useAppearanceSession.d.ts.map +1 -0
- package/dist/hooks/useAppearanceSession.js +91 -0
- package/dist/hooks/useAppearanceSession.js.map +1 -0
- package/dist/hooks/useThemeTranslations.d.ts +13 -0
- package/dist/hooks/useThemeTranslations.d.ts.map +1 -0
- package/dist/hooks/useThemeTranslations.js +22 -0
- package/dist/hooks/useThemeTranslations.js.map +1 -0
- package/dist/i18n.d.ts +53 -0
- package/dist/i18n.d.ts.map +1 -0
- package/dist/i18n.js +53 -0
- package/dist/i18n.js.map +1 -0
- package/dist/index.d.ts +10 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +130 -32
- package/dist/index.js.map +1 -1
- package/dist/payload-types.d.ts +24 -0
- package/dist/payload-types.d.ts.map +1 -1
- package/dist/payload-types.js.map +1 -1
- package/dist/presets.d.ts +8 -0
- package/dist/presets.d.ts.map +1 -1
- package/dist/presets.js.map +1 -1
- package/dist/providers/Theme/index.d.ts.map +1 -1
- package/dist/providers/Theme/index.js +75 -11
- package/dist/providers/Theme/index.js.map +1 -1
- package/dist/providers/Theme/themeConfig.d.ts.map +1 -1
- package/dist/providers/Theme/themeConfig.js +104 -0
- package/dist/providers/Theme/themeConfig.js.map +1 -1
- package/dist/providers/Theme/types.d.ts +1 -1
- package/dist/providers/Theme/types.d.ts.map +1 -1
- package/dist/providers/Theme/types.js +10 -1
- package/dist/providers/Theme/types.js.map +1 -1
- package/dist/style-presets.d.ts +66 -0
- package/dist/style-presets.d.ts.map +1 -0
- package/dist/style-presets.js +556 -0
- package/dist/style-presets.js.map +1 -0
- package/dist/translations.d.ts +159 -1
- package/dist/translations.d.ts.map +1 -1
- package/dist/translations.js +310 -9
- package/dist/translations.js.map +1 -1
- package/dist/tweakcn-special-themes.d.ts.map +1 -1
- package/dist/tweakcn-special-themes.js +585 -9
- package/dist/tweakcn-special-themes.js.map +1 -1
- package/dist/types/css.d.js +3 -0
- package/dist/types/css.d.js.map +1 -0
- package/dist/types.d.ts +30 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utilities/getThemeSettings.d.ts.map +1 -1
- package/dist/utilities/getThemeSettings.js +2 -14
- package/dist/utilities/getThemeSettings.js.map +1 -1
- package/dist/utils/contrast.d.ts +63 -0
- package/dist/utils/contrast.d.ts.map +1 -0
- package/dist/utils/contrast.js +158 -0
- package/dist/utils/contrast.js.map +1 -0
- package/dist/utils/exportTokens.d.ts +30 -0
- package/dist/utils/exportTokens.d.ts.map +1 -0
- package/dist/utils/exportTokens.js +183 -0
- package/dist/utils/exportTokens.js.map +1 -0
- package/dist/utils/generatePalette.d.ts +46 -0
- package/dist/utils/generatePalette.d.ts.map +1 -0
- package/dist/utils/generatePalette.js +127 -0
- package/dist/utils/generatePalette.js.map +1 -0
- package/dist/utils/generateThemeCSS.d.ts.map +1 -1
- package/dist/utils/generateThemeCSS.js +2 -40
- package/dist/utils/generateThemeCSS.js.map +1 -1
- package/dist/utils/livePreviewThemeRuntime.d.ts +16 -2
- package/dist/utils/livePreviewThemeRuntime.d.ts.map +1 -1
- package/dist/utils/livePreviewThemeRuntime.js +37 -14
- package/dist/utils/livePreviewThemeRuntime.js.map +1 -1
- package/dist/utils/localizedText.d.ts +8 -0
- package/dist/utils/localizedText.d.ts.map +1 -0
- package/dist/utils/localizedText.js +21 -0
- package/dist/utils/localizedText.js.map +1 -0
- package/dist/utils/resolveThemeConfiguration.d.ts +45 -1
- package/dist/utils/resolveThemeConfiguration.d.ts.map +1 -1
- package/dist/utils/resolveThemeConfiguration.js +12 -5
- package/dist/utils/resolveThemeConfiguration.js.map +1 -1
- package/dist/utils/themeColors.d.ts +3 -0
- package/dist/utils/themeColors.d.ts.map +1 -1
- package/dist/utils/themeColors.js +30 -1
- package/dist/utils/themeColors.js.map +1 -1
- package/dist/utils/themeHtmlAttributes.d.ts +32 -12
- package/dist/utils/themeHtmlAttributes.d.ts.map +1 -1
- package/dist/utils/themeHtmlAttributes.js +38 -5
- package/dist/utils/themeHtmlAttributes.js.map +1 -1
- package/dist/utils/themeUtils.d.ts +3 -5
- package/dist/utils/themeUtils.d.ts.map +1 -1
- package/dist/utils/themeUtils.js +416 -6
- package/dist/utils/themeUtils.js.map +1 -1
- package/dist/utils/tweakcnConverter.d.ts +1 -3
- package/dist/utils/tweakcnConverter.d.ts.map +1 -1
- package/dist/utils/tweakcnConverter.js +1 -3
- package/dist/utils/tweakcnConverter.js.map +1 -1
- package/package.json +11 -5
- package/dist/components/ThemePreview.d.ts +0 -3
- package/dist/components/ThemePreview.d.ts.map +0 -1
- package/dist/components/ThemePreview.js +0 -321
- package/dist/components/ThemePreview.js.map +0 -1
- package/dist/plugin.d.ts +0 -2
- package/dist/plugin.d.ts.map +0 -1
- package/dist/plugin.js +0 -3
- package/dist/plugin.js.map +0 -1
|
@@ -74,6 +74,18 @@ const COLOR_VARIABLE_MAP = [
|
|
|
74
74
|
{
|
|
75
75
|
key: 'ring',
|
|
76
76
|
variable: '--ring'
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
key: 'gradientFrom',
|
|
80
|
+
variable: '--gradient-from'
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
key: 'gradientVia',
|
|
84
|
+
variable: '--gradient-via'
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
key: 'gradientTo',
|
|
88
|
+
variable: '--gradient-to'
|
|
77
89
|
}
|
|
78
90
|
];
|
|
79
91
|
export function hexToHsl(hex) {
|
|
@@ -116,7 +128,7 @@ export function generateColorModeCss(colors, options = {}) {
|
|
|
116
128
|
const cssVariables = COLOR_VARIABLE_MAP.reduce((acc, { key, variable })=>{
|
|
117
129
|
const value = normalizeColor(colors[key]);
|
|
118
130
|
if (!value) return acc;
|
|
119
|
-
acc.push(`${variable}:
|
|
131
|
+
acc.push(`${variable}: ${normalizeToCssColor(value)};`);
|
|
120
132
|
return acc;
|
|
121
133
|
}, []);
|
|
122
134
|
if (cssVariables.length === 0) return '';
|
|
@@ -161,5 +173,22 @@ function normalizeColor(value) {
|
|
|
161
173
|
const trimmed = value.trim();
|
|
162
174
|
return trimmed.length === 0 ? null : trimmed;
|
|
163
175
|
}
|
|
176
|
+
/**
|
|
177
|
+
* Convert any color value to a valid CSS color string.
|
|
178
|
+
* - oklch(...), hsl(...), rgb(...), etc. → pass through as-is
|
|
179
|
+
* - var(...) CSS variable references → pass through as-is
|
|
180
|
+
* - Hex (#rgb, #rrggbb) → convert to hsl(H S% L%)
|
|
181
|
+
*/ function normalizeToCssColor(value) {
|
|
182
|
+
// Already a complete CSS color function — pass through unchanged
|
|
183
|
+
if (/^(hsl|hsla|rgb|rgba|oklch|oklab|lch|lab|color|hwb)\s*\(/i.test(value)) {
|
|
184
|
+
return value;
|
|
185
|
+
}
|
|
186
|
+
// CSS variable reference — pass through
|
|
187
|
+
if (/^var\s*\(/i.test(value)) {
|
|
188
|
+
return value;
|
|
189
|
+
}
|
|
190
|
+
// Hex color (#rgb or #rrggbb) — convert to hsl()
|
|
191
|
+
return `hsl(${hexToHsl(value)})`;
|
|
192
|
+
}
|
|
164
193
|
|
|
165
194
|
//# sourceMappingURL=themeColors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/themeColors.ts"],"sourcesContent":["interface ColorMode {\n background?: string | null\n foreground?: string | null\n card?: string | null\n cardForeground?: string | null\n popover?: string | null\n popoverForeground?: string | null\n primary?: string | null\n primaryForeground?: string | null\n secondary?: string | null\n secondaryForeground?: string | null\n muted?: string | null\n mutedForeground?: string | null\n accent?: string | null\n accentForeground?: string | null\n destructive?: string | null\n destructiveForeground?: string | null\n border?: string | null\n input?: string | null\n ring?: string | null\n}\n\nexport interface ThemeColors {\n lightMode?: ColorMode\n darkMode?: ColorMode\n}\n\ninterface GenerateThemeColorsOptions extends ThemeColors {\n themeName?: string\n}\n\nconst COLOR_VARIABLE_MAP: Array<{ key: keyof ColorMode; variable: string }> = [\n { key: 'background', variable: '--background' },\n { key: 'foreground', variable: '--foreground' },\n { key: 'card', variable: '--card' },\n { key: 'cardForeground', variable: '--card-foreground' },\n { key: 'popover', variable: '--popover' },\n { key: 'popoverForeground', variable: '--popover-foreground' },\n { key: 'primary', variable: '--primary' },\n { key: 'primaryForeground', variable: '--primary-foreground' },\n { key: 'secondary', variable: '--secondary' },\n { key: 'secondaryForeground', variable: '--secondary-foreground' },\n { key: 'muted', variable: '--muted' },\n { key: 'mutedForeground', variable: '--muted-foreground' },\n { key: 'accent', variable: '--accent' },\n { key: 'accentForeground', variable: '--accent-foreground' },\n { key: 'destructive', variable: '--destructive' },\n { key: 'destructiveForeground', variable: '--destructive-foreground' },\n { key: 'border', variable: '--border' },\n { key: 'input', variable: '--input' },\n { key: 'ring', variable: '--ring' },\n]\n\nexport function hexToHsl(hex: string): string {\n if (!hex) return '0 0% 0%'\n\n hex = hex.replace('#', '')\n\n if (hex.length === 3) {\n hex = hex\n .split('')\n .map((char) => char + char)\n .join('')\n }\n\n const r = Number.parseInt(hex.substring(0, 2), 16) / 255\n const g = Number.parseInt(hex.substring(2, 4), 16) / 255\n const b = Number.parseInt(hex.substring(4, 6), 16) / 255\n\n const max = Math.max(r, g, b)\n const min = Math.min(r, g, b)\n let h = 0\n let s = 0\n const l = (max + min) / 2\n\n if (max !== min) {\n const d = max - min\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min)\n\n switch (max) {\n case r:\n h = ((g - b) / d + (g < b ? 6 : 0)) / 6\n break\n case g:\n h = ((b - r) / d + 2) / 6\n break\n case b:\n h = ((r - g) / d + 4) / 6\n break\n }\n }\n\n h = Math.round(h * 360)\n s = Math.round(s * 100)\n const lRounded = Math.round(l * 100)\n\n return `${h} ${s}% ${lRounded}%`\n}\n\nexport function generateColorModeCss(\n colors: ColorMode,\n options: { themeName?: string; isDark?: boolean } = {},\n): string {\n if (!colors) return ''\n\n const { themeName, isDark = false } = options\n\n const cssVariables = COLOR_VARIABLE_MAP.reduce<string[]>((acc, { key, variable }) => {\n const value = normalizeColor(colors[key])\n if (!value) return acc\n acc.push(`${variable}:
|
|
1
|
+
{"version":3,"sources":["../../src/utils/themeColors.ts"],"sourcesContent":["interface ColorMode {\n background?: string | null\n foreground?: string | null\n card?: string | null\n cardForeground?: string | null\n popover?: string | null\n popoverForeground?: string | null\n primary?: string | null\n primaryForeground?: string | null\n secondary?: string | null\n secondaryForeground?: string | null\n muted?: string | null\n mutedForeground?: string | null\n accent?: string | null\n accentForeground?: string | null\n destructive?: string | null\n destructiveForeground?: string | null\n border?: string | null\n input?: string | null\n ring?: string | null\n gradientFrom?: string | null\n gradientVia?: string | null\n gradientTo?: string | null\n}\n\nexport interface ThemeColors {\n lightMode?: ColorMode\n darkMode?: ColorMode\n}\n\ninterface GenerateThemeColorsOptions extends ThemeColors {\n themeName?: string\n}\n\nconst COLOR_VARIABLE_MAP: Array<{ key: keyof ColorMode; variable: string }> = [\n { key: 'background', variable: '--background' },\n { key: 'foreground', variable: '--foreground' },\n { key: 'card', variable: '--card' },\n { key: 'cardForeground', variable: '--card-foreground' },\n { key: 'popover', variable: '--popover' },\n { key: 'popoverForeground', variable: '--popover-foreground' },\n { key: 'primary', variable: '--primary' },\n { key: 'primaryForeground', variable: '--primary-foreground' },\n { key: 'secondary', variable: '--secondary' },\n { key: 'secondaryForeground', variable: '--secondary-foreground' },\n { key: 'muted', variable: '--muted' },\n { key: 'mutedForeground', variable: '--muted-foreground' },\n { key: 'accent', variable: '--accent' },\n { key: 'accentForeground', variable: '--accent-foreground' },\n { key: 'destructive', variable: '--destructive' },\n { key: 'destructiveForeground', variable: '--destructive-foreground' },\n { key: 'border', variable: '--border' },\n { key: 'input', variable: '--input' },\n { key: 'ring', variable: '--ring' },\n { key: 'gradientFrom', variable: '--gradient-from' },\n { key: 'gradientVia', variable: '--gradient-via' },\n { key: 'gradientTo', variable: '--gradient-to' },\n]\n\nexport function hexToHsl(hex: string): string {\n if (!hex) return '0 0% 0%'\n\n hex = hex.replace('#', '')\n\n if (hex.length === 3) {\n hex = hex\n .split('')\n .map((char) => char + char)\n .join('')\n }\n\n const r = Number.parseInt(hex.substring(0, 2), 16) / 255\n const g = Number.parseInt(hex.substring(2, 4), 16) / 255\n const b = Number.parseInt(hex.substring(4, 6), 16) / 255\n\n const max = Math.max(r, g, b)\n const min = Math.min(r, g, b)\n let h = 0\n let s = 0\n const l = (max + min) / 2\n\n if (max !== min) {\n const d = max - min\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min)\n\n switch (max) {\n case r:\n h = ((g - b) / d + (g < b ? 6 : 0)) / 6\n break\n case g:\n h = ((b - r) / d + 2) / 6\n break\n case b:\n h = ((r - g) / d + 4) / 6\n break\n }\n }\n\n h = Math.round(h * 360)\n s = Math.round(s * 100)\n const lRounded = Math.round(l * 100)\n\n return `${h} ${s}% ${lRounded}%`\n}\n\nexport function generateColorModeCss(\n colors: ColorMode,\n options: { themeName?: string; isDark?: boolean } = {},\n): string {\n if (!colors) return ''\n\n const { themeName, isDark = false } = options\n\n const cssVariables = COLOR_VARIABLE_MAP.reduce<string[]>((acc, { key, variable }) => {\n const value = normalizeColor(colors[key])\n if (!value) return acc\n acc.push(`${variable}: ${normalizeToCssColor(value)};`)\n return acc\n }, [])\n\n if (cssVariables.length === 0) return ''\n\n const selector = buildSelector(themeName, isDark)\n return `${selector} {\n ${cssVariables.join('\\n ')}\n}`\n}\n\nexport function generateThemeColorsCss(options: GenerateThemeColorsOptions): string {\n const cssBlocks: string[] = []\n const { themeName, lightMode, darkMode } = options\n\n if (lightMode) {\n const lightModeCss = generateColorModeCss(lightMode, { themeName, isDark: false })\n if (lightModeCss) cssBlocks.push(lightModeCss)\n }\n\n if (darkMode) {\n const darkModeCss = generateColorModeCss(darkMode, { themeName, isDark: true })\n if (darkModeCss) cssBlocks.push(darkModeCss)\n }\n\n return cssBlocks.join('\\n\\n')\n}\n\nfunction buildSelector(themeName: string | undefined, isDark: boolean): string {\n if (themeName) {\n if (isDark) {\n return `:root[data-theme='${themeName}'][data-theme-mode='dark'], .dark[data-theme='${themeName}']`\n }\n return `:root[data-theme='${themeName}']`\n }\n\n if (isDark) {\n return \":root[data-theme-mode='dark'], .dark\"\n }\n\n return ':root'\n}\n\nfunction normalizeColor(value: string | null | undefined): string | null {\n if (typeof value !== 'string') return null\n const trimmed = value.trim()\n return trimmed.length === 0 ? null : trimmed\n}\n\n/**\n * Convert any color value to a valid CSS color string.\n * - oklch(...), hsl(...), rgb(...), etc. → pass through as-is\n * - var(...) CSS variable references → pass through as-is\n * - Hex (#rgb, #rrggbb) → convert to hsl(H S% L%)\n */\nfunction normalizeToCssColor(value: string): string {\n // Already a complete CSS color function — pass through unchanged\n if (/^(hsl|hsla|rgb|rgba|oklch|oklab|lch|lab|color|hwb)\\s*\\(/i.test(value)) {\n return value\n }\n // CSS variable reference — pass through\n if (/^var\\s*\\(/i.test(value)) {\n return value\n }\n // Hex color (#rgb or #rrggbb) — convert to hsl()\n return `hsl(${hexToHsl(value)})`\n}\n"],"names":["COLOR_VARIABLE_MAP","key","variable","hexToHsl","hex","replace","length","split","map","char","join","r","Number","parseInt","substring","g","b","max","Math","min","h","s","l","d","round","lRounded","generateColorModeCss","colors","options","themeName","isDark","cssVariables","reduce","acc","value","normalizeColor","push","normalizeToCssColor","selector","buildSelector","generateThemeColorsCss","cssBlocks","lightMode","darkMode","lightModeCss","darkModeCss","trimmed","trim","test"],"mappings":"AAkCA,MAAMA,qBAAwE;IAC5E;QAAEC,KAAK;QAAcC,UAAU;IAAe;IAC9C;QAAED,KAAK;QAAcC,UAAU;IAAe;IAC9C;QAAED,KAAK;QAAQC,UAAU;IAAS;IAClC;QAAED,KAA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AAI,aAAac,IAAI,CAACd,QAAQ;QAC5B,OAAOA;IACT;IACA,iDAAiD;IACjD,OAAO,CAAC,IAAI,EAAE/B,SAAS+B,OAAO,CAAC,CAAC;AAClC"}
|
|
@@ -1,7 +1,35 @@
|
|
|
1
1
|
import type { ResolvedThemeConfiguration } from './resolveThemeConfiguration.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
|
|
3
|
+
* Stable base attributes that are always present on the <html> element.
|
|
4
|
+
*/
|
|
5
|
+
interface BaseThemeHtmlAttributes {
|
|
6
|
+
'data-theme': string;
|
|
7
|
+
'data-theme-mode': string;
|
|
8
|
+
'data-border-radius': string;
|
|
9
|
+
'data-font-scale': string;
|
|
10
|
+
'data-spacing': string;
|
|
11
|
+
'data-animation-level': string;
|
|
12
|
+
'data-allow-color-mode-toggle': string;
|
|
13
|
+
suppressHydrationWarning: true;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Full attribute map: base attributes plus any visual-effect / component-style
|
|
17
|
+
* attributes that were configured. Optional keys are only present when the
|
|
18
|
+
* corresponding value is set, so callers can spread the whole object onto
|
|
19
|
+
* `<html>` without emitting empty attributes.
|
|
20
|
+
*/
|
|
21
|
+
export type ThemeHtmlAttributes = BaseThemeHtmlAttributes & Record<string, string | true>;
|
|
22
|
+
/**
|
|
23
|
+
* Generates HTML attributes for the <html> element based on theme configuration.
|
|
24
|
+
*
|
|
25
|
+
* This ensures the theme is applied before React hydration to prevent FOUC.
|
|
26
|
+
* Crucially, it also emits the `data-effect-style`, `data-card-style`,
|
|
27
|
+
* `data-button-variant`, `data-navbar-style`, `data-card-hover`,
|
|
28
|
+
* `data-border-*`, `data-button-size`, `data-footer-style`, `data-image-style`
|
|
29
|
+
* and `data-link-style` attributes that the CSS produced by `generateThemeCSS`
|
|
30
|
+
* targets. Without them, the visual-effect and component-style rules only
|
|
31
|
+
* activate after client hydration (the `ThemeProvider` syncs them from CSS
|
|
32
|
+
* variables), causing a flash of unstyled content on server-rendered pages.
|
|
5
33
|
*
|
|
6
34
|
* @example
|
|
7
35
|
* ```tsx
|
|
@@ -12,14 +40,6 @@ import type { ResolvedThemeConfiguration } from './resolveThemeConfiguration.js'
|
|
|
12
40
|
* <html {...htmlAttrs} className={yourClassName}>
|
|
13
41
|
* ```
|
|
14
42
|
*/
|
|
15
|
-
export declare function getThemeHtmlAttributes(config: ResolvedThemeConfiguration):
|
|
16
|
-
|
|
17
|
-
'data-theme-mode': string;
|
|
18
|
-
'data-border-radius': string;
|
|
19
|
-
'data-font-scale': string;
|
|
20
|
-
'data-spacing': string;
|
|
21
|
-
'data-animation-level': string;
|
|
22
|
-
'data-allow-color-mode-toggle': string;
|
|
23
|
-
suppressHydrationWarning: true;
|
|
24
|
-
};
|
|
43
|
+
export declare function getThemeHtmlAttributes(config: ResolvedThemeConfiguration): ThemeHtmlAttributes;
|
|
44
|
+
export {};
|
|
25
45
|
//# sourceMappingURL=themeHtmlAttributes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themeHtmlAttributes.d.ts","sourceRoot":"","sources":["../../src/utils/themeHtmlAttributes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAA;AAEhF
|
|
1
|
+
{"version":3,"file":"themeHtmlAttributes.d.ts","sourceRoot":"","sources":["../../src/utils/themeHtmlAttributes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAA;AAEhF;;GAEG;AACH,UAAU,uBAAuB;IAC/B,YAAY,EAAE,MAAM,CAAA;IACpB,iBAAiB,EAAE,MAAM,CAAA;IACzB,oBAAoB,EAAE,MAAM,CAAA;IAC5B,iBAAiB,EAAE,MAAM,CAAA;IACzB,cAAc,EAAE,MAAM,CAAA;IACtB,sBAAsB,EAAE,MAAM,CAAA;IAC9B,8BAA8B,EAAE,MAAM,CAAA;IACtC,wBAAwB,EAAE,IAAI,CAAA;CAC/B;AAED;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG,uBAAuB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAA;AAKzF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,0BAA0B,GAAG,mBAAmB,CAuC9F"}
|
|
@@ -1,17 +1,26 @@
|
|
|
1
|
+
const isNonEmptyString = (value)=>typeof value === 'string' && value.trim().length > 0;
|
|
1
2
|
/**
|
|
2
|
-
* Generates HTML attributes for the <html> element based on theme configuration
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* Generates HTML attributes for the <html> element based on theme configuration.
|
|
4
|
+
*
|
|
5
|
+
* This ensures the theme is applied before React hydration to prevent FOUC.
|
|
6
|
+
* Crucially, it also emits the `data-effect-style`, `data-card-style`,
|
|
7
|
+
* `data-button-variant`, `data-navbar-style`, `data-card-hover`,
|
|
8
|
+
* `data-border-*`, `data-button-size`, `data-footer-style`, `data-image-style`
|
|
9
|
+
* and `data-link-style` attributes that the CSS produced by `generateThemeCSS`
|
|
10
|
+
* targets. Without them, the visual-effect and component-style rules only
|
|
11
|
+
* activate after client hydration (the `ThemeProvider` syncs them from CSS
|
|
12
|
+
* variables), causing a flash of unstyled content on server-rendered pages.
|
|
13
|
+
*
|
|
5
14
|
* @example
|
|
6
15
|
* ```tsx
|
|
7
16
|
* const siteSettings = await payload.findGlobal({ slug: 'site-settings' })
|
|
8
17
|
* const themeConfig = resolveThemeConfiguration(siteSettings?.themeConfiguration)
|
|
9
18
|
* const htmlAttrs = getThemeHtmlAttributes(themeConfig)
|
|
10
|
-
*
|
|
19
|
+
*
|
|
11
20
|
* <html {...htmlAttrs} className={yourClassName}>
|
|
12
21
|
* ```
|
|
13
22
|
*/ export function getThemeHtmlAttributes(config) {
|
|
14
|
-
|
|
23
|
+
const attributes = {
|
|
15
24
|
'data-theme': config.theme,
|
|
16
25
|
'data-theme-mode': config.colorMode,
|
|
17
26
|
'data-border-radius': config.borderRadius,
|
|
@@ -21,6 +30,30 @@
|
|
|
21
30
|
'data-allow-color-mode-toggle': config.allowColorModeToggle ? 'true' : 'false',
|
|
22
31
|
suppressHydrationWarning: true
|
|
23
32
|
};
|
|
33
|
+
const ve = config.visualEffects;
|
|
34
|
+
if (ve) {
|
|
35
|
+
if (isNonEmptyString(ve.effectStyle)) attributes['data-effect-style'] = ve.effectStyle;
|
|
36
|
+
if (isNonEmptyString(ve.shadowIntensity)) attributes['data-shadow-intensity'] = ve.shadowIntensity;
|
|
37
|
+
if (isNonEmptyString(ve.backdropBlur)) attributes['data-backdrop-blur'] = ve.backdropBlur;
|
|
38
|
+
if (isNonEmptyString(ve.borderStyle)) attributes['data-border-style'] = ve.borderStyle;
|
|
39
|
+
if (isNonEmptyString(ve.borderWidth)) attributes['data-border-width'] = ve.borderWidth;
|
|
40
|
+
}
|
|
41
|
+
const cs = config.componentStyles;
|
|
42
|
+
if (cs) {
|
|
43
|
+
if (isNonEmptyString(cs.buttonVariant)) attributes['data-button-variant'] = cs.buttonVariant;
|
|
44
|
+
if (isNonEmptyString(cs.buttonSize)) attributes['data-button-size'] = cs.buttonSize;
|
|
45
|
+
if (isNonEmptyString(cs.cardStyle)) attributes['data-card-style'] = cs.cardStyle;
|
|
46
|
+
if (isNonEmptyString(cs.cardHoverEffect)) attributes['data-card-hover'] = cs.cardHoverEffect;
|
|
47
|
+
if (isNonEmptyString(cs.imageStyle)) attributes['data-image-style'] = cs.imageStyle;
|
|
48
|
+
if (isNonEmptyString(cs.navbarStyle)) attributes['data-navbar-style'] = cs.navbarStyle;
|
|
49
|
+
if (isNonEmptyString(cs.footerStyle)) attributes['data-footer-style'] = cs.footerStyle;
|
|
50
|
+
if (isNonEmptyString(cs.linkStyle)) attributes['data-link-style'] = cs.linkStyle;
|
|
51
|
+
// Booleans: only emit the attribute when explicitly disabled (defaults are "on"),
|
|
52
|
+
// keeping the DOM clean while still letting CSS / consumer JS react to opt-outs.
|
|
53
|
+
if (cs.enableHoverAnimations === false) attributes['data-hover-animations'] = 'off';
|
|
54
|
+
if (cs.enableScrollReveal === false) attributes['data-scroll-reveal'] = 'off';
|
|
55
|
+
}
|
|
56
|
+
return attributes;
|
|
24
57
|
}
|
|
25
58
|
|
|
26
59
|
//# sourceMappingURL=themeHtmlAttributes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/themeHtmlAttributes.ts"],"sourcesContent":["import type { ResolvedThemeConfiguration } from './resolveThemeConfiguration.js'\n\n/**\n * Generates HTML attributes for the <html> element based on theme configuration
|
|
1
|
+
{"version":3,"sources":["../../src/utils/themeHtmlAttributes.ts"],"sourcesContent":["import type { ResolvedThemeConfiguration } from './resolveThemeConfiguration.js'\n\n/**\n * Stable base attributes that are always present on the <html> element.\n */\ninterface BaseThemeHtmlAttributes {\n 'data-theme': string\n 'data-theme-mode': string\n 'data-border-radius': string\n 'data-font-scale': string\n 'data-spacing': string\n 'data-animation-level': string\n 'data-allow-color-mode-toggle': string\n suppressHydrationWarning: true\n}\n\n/**\n * Full attribute map: base attributes plus any visual-effect / component-style\n * attributes that were configured. Optional keys are only present when the\n * corresponding value is set, so callers can spread the whole object onto\n * `<html>` without emitting empty attributes.\n */\nexport type ThemeHtmlAttributes = BaseThemeHtmlAttributes & Record<string, string | true>\n\nconst isNonEmptyString = (value: unknown): value is string =>\n typeof value === 'string' && value.trim().length > 0\n\n/**\n * Generates HTML attributes for the <html> element based on theme configuration.\n *\n * This ensures the theme is applied before React hydration to prevent FOUC.\n * Crucially, it also emits the `data-effect-style`, `data-card-style`,\n * `data-button-variant`, `data-navbar-style`, `data-card-hover`,\n * `data-border-*`, `data-button-size`, `data-footer-style`, `data-image-style`\n * and `data-link-style` attributes that the CSS produced by `generateThemeCSS`\n * targets. Without them, the visual-effect and component-style rules only\n * activate after client hydration (the `ThemeProvider` syncs them from CSS\n * variables), causing a flash of unstyled content on server-rendered pages.\n *\n * @example\n * ```tsx\n * const siteSettings = await payload.findGlobal({ slug: 'site-settings' })\n * const themeConfig = resolveThemeConfiguration(siteSettings?.themeConfiguration)\n * const htmlAttrs = getThemeHtmlAttributes(themeConfig)\n *\n * <html {...htmlAttrs} className={yourClassName}>\n * ```\n */\nexport function getThemeHtmlAttributes(config: ResolvedThemeConfiguration): ThemeHtmlAttributes {\n const attributes: ThemeHtmlAttributes = {\n 'data-theme': config.theme,\n 'data-theme-mode': config.colorMode,\n 'data-border-radius': config.borderRadius,\n 'data-font-scale': config.fontScale,\n 'data-spacing': config.spacing,\n 'data-animation-level': config.animationLevel,\n 'data-allow-color-mode-toggle': config.allowColorModeToggle ? 'true' : 'false',\n suppressHydrationWarning: true,\n }\n\n const ve = config.visualEffects\n if (ve) {\n if (isNonEmptyString(ve.effectStyle)) attributes['data-effect-style'] = ve.effectStyle\n if (isNonEmptyString(ve.shadowIntensity))\n attributes['data-shadow-intensity'] = ve.shadowIntensity\n if (isNonEmptyString(ve.backdropBlur)) attributes['data-backdrop-blur'] = ve.backdropBlur\n if (isNonEmptyString(ve.borderStyle)) attributes['data-border-style'] = ve.borderStyle\n if (isNonEmptyString(ve.borderWidth)) attributes['data-border-width'] = ve.borderWidth\n }\n\n const cs = config.componentStyles\n if (cs) {\n if (isNonEmptyString(cs.buttonVariant)) attributes['data-button-variant'] = cs.buttonVariant\n if (isNonEmptyString(cs.buttonSize)) attributes['data-button-size'] = cs.buttonSize\n if (isNonEmptyString(cs.cardStyle)) attributes['data-card-style'] = cs.cardStyle\n if (isNonEmptyString(cs.cardHoverEffect)) attributes['data-card-hover'] = cs.cardHoverEffect\n if (isNonEmptyString(cs.imageStyle)) attributes['data-image-style'] = cs.imageStyle\n if (isNonEmptyString(cs.navbarStyle)) attributes['data-navbar-style'] = cs.navbarStyle\n if (isNonEmptyString(cs.footerStyle)) attributes['data-footer-style'] = cs.footerStyle\n if (isNonEmptyString(cs.linkStyle)) attributes['data-link-style'] = cs.linkStyle\n // Booleans: only emit the attribute when explicitly disabled (defaults are \"on\"),\n // keeping the DOM clean while still letting CSS / consumer JS react to opt-outs.\n if (cs.enableHoverAnimations === false) attributes['data-hover-animations'] = 'off'\n if (cs.enableScrollReveal === false) attributes['data-scroll-reveal'] = 'off'\n }\n\n return attributes\n}\n"],"names":["isNonEmptyString","value","trim","length","getThemeHtmlAttributes","config","attributes","theme","colorMode","borderRadius","fontScale","spacing","animationLevel","allowColorModeToggle","suppressHydrationWarning","ve","visualEffects","effectStyle","shadowIntensity","backdropBlur","borderStyle","borderWidth","cs","componentStyles","buttonVariant","buttonSize","cardStyle","cardHoverEffect","imageStyle","navbarStyle","footerStyle","linkStyle","enableHoverAnimations","enableScrollReveal"],"mappings":"AAwBA,MAAMA,mBAAmB,CAACC,QACxB,OAAOA,UAAU,YAAYA,MAAMC,IAAI,GAAGC,MAAM,GAAG;AAErD;;;;;;;;;;;;;;;;;;;;CAoBC,GACD,OAAO,SAASC,uBAAuBC,MAAkC;IACvE,MAAMC,aAAkC;QACtC,cAAcD,OAAOE,KAAK;QAC1B,mBAAmBF,OAAOG,SAAS;QACnC,sBAAsBH,OAAOI,YAAY;QACzC,mBAAmBJ,OAAOK,SAAS;QACnC,gBAAgBL,OAAOM,OAAO;QAC9B,wBAAwBN,OAAOO,cAAc;QAC7C,gCAAgCP,OAAOQ,oBAAoB,GAAG,SAAS;QACvEC,0BAA0B;IAC5B;IAEA,MAAMC,KAAKV,OAAOW,aAAa;IAC/B,IAAID,IAAI;QACN,IAAIf,iBAAiBe,GAAGE,WAAW,GAAGX,UAAU,CAAC,oBAAoB,GAAGS,GAAGE,WAAW;QACtF,IAAIjB,iBAAiBe,GAAGG,eAAe,GACrCZ,UAAU,CAAC,wBAAwB,GAAGS,GAAGG,eAAe;QAC1D,IAAIlB,iBAAiBe,GAAGI,YAAY,GAAGb,UAAU,CAAC,qBAAqB,GAAGS,GAAGI,YAAY;QACzF,IAAInB,iBAAiBe,GAAGK,WAAW,GAAGd,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ration } from './resolveThemeConfiguration.js';
|
|
2
|
+
type ThemeConfiguration = Omit<ResolvedThemeConfiguration, 'typography'> & {
|
|
3
|
+
typography?: ResolvedThemeConfiguration['typography'];
|
|
5
4
|
};
|
|
6
|
-
type ThemeConfiguration = Omit<NonNullable<SiteSetting['themeConfiguration']>, 'typography'> & ThemeTypographyConfiguration;
|
|
7
5
|
/**
|
|
8
6
|
* Generates CSS custom properties from theme configuration
|
|
9
7
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themeUtils.d.ts","sourceRoot":"","sources":["../../src/utils/themeUtils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"themeUtils.d.ts","sourceRoot":"","sources":["../../src/utils/themeUtils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAA;AAEhF,KAAK,kBAAkB,GAAG,IAAI,CAAC,0BAA0B,EAAE,YAAY,CAAC,GAAG;IACzE,UAAU,CAAC,EAAE,0BAA0B,CAAC,YAAY,CAAC,CAAA;CACtD,CAAA;AAaD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,CA8BnE;AAiBD;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,kBAAkB,0BAQxD"}
|