@kilivi/payloadcms-theme-management 0.1.12 → 0.1.13
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 +15 -0
- package/dist/components/InitTheme.d.ts +12 -0
- package/dist/components/InitTheme.d.ts.map +1 -0
- package/dist/components/InitTheme.js +72 -0
- package/dist/components/InitTheme.js.map +1 -0
- package/dist/components/ServerThemeInjector.d.ts.map +1 -1
- package/dist/components/ServerThemeInjector.js +5 -3
- package/dist/components/ServerThemeInjector.js.map +1 -1
- package/dist/components/ThemePreview.js.map +1 -1
- package/dist/components/typographyPreviewUtils.js.map +1 -1
- package/dist/constants/themeFonts.js.map +1 -1
- package/dist/fields/ColorPickerField.js.map +1 -1
- package/dist/fields/RadiusField.js.map +1 -1
- package/dist/fields/ThemeColorPickerField.css +138 -138
- package/dist/fields/ThemeColorPickerField.js.map +1 -1
- package/dist/fields/ThemePreviewField.js.map +1 -1
- package/dist/fields/ThemeTokenSelectField.js.map +1 -1
- package/dist/fields/colorModeFields.js.map +1 -1
- package/dist/fields/themeConfigurationField.js +3 -3
- package/dist/fields/themeConfigurationField.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/payload-types.js +3 -3
- package/dist/payload-types.js.map +1 -1
- package/dist/plugin.js.map +1 -1
- package/dist/presets.js.map +1 -1
- package/dist/providers/Theme/index.js.map +1 -1
- package/dist/providers/Theme/shared.js.map +1 -1
- package/dist/providers/Theme/themeConfig.js.map +1 -1
- package/dist/providers/Theme/types.js.map +1 -1
- package/dist/server.js.map +1 -1
- package/dist/src/--verbose/dist/fields/ThemeColorPickerField.scss +138 -0
- package/dist/src/dist/fields/ThemeColorPickerField.scss +138 -0
- package/dist/types.js.map +1 -1
- package/dist/utils/resolveThemeConfiguration.d.ts +40 -5
- package/dist/utils/resolveThemeConfiguration.d.ts.map +1 -1
- package/dist/utils/resolveThemeConfiguration.js.map +1 -1
- package/dist/utils/themeAssets.js.map +1 -1
- package/dist/utils/themeColors.js.map +1 -1
- package/dist/utils/themeHtmlAttributes.d.ts +25 -0
- package/dist/utils/themeHtmlAttributes.d.ts.map +1 -0
- package/dist/utils/themeHtmlAttributes.js +26 -0
- package/dist/utils/themeHtmlAttributes.js.map +1 -0
- package/dist/utils/themeUtils.js +6 -6
- package/dist/utils/themeUtils.js.map +1 -1
- package/package.json +1 -1
|
@@ -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'\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: '@payloadcms-plugins/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 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 options: BODY_FONT_OPTIONS.map((option) => ({\n label: option.label,\n value: option.value,\n })),\n admin: {\n width: '50%',\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 options: HEADING_FONT_OPTIONS.map((option) => ({\n label: option.label,\n value: option.value,\n })),\n admin: {\n width: '50%',\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 // Design Customization\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: '@payloadcms-plugins/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\n // Advanced Settings\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 {\n name: 'themeConfiguration',\n type: 'group',\n label: false,\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","option","placeholder","condition","_","siblingData","bodyFont","headingFont","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,sBAA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AAI;gBACN;gBACAF,cAAc;gBACdnB,SAAS;oBACP;wBAAEa,OAAO;4BAAEO,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,OAAO;QACLrB,MAAM;QACNE,MAAM;QACNJ,OAAO;QACPS,OAAO;YACLC,aAAa;gBACXH,IAAI;gBACJC,IAAI;YACN;QACF;QACAL;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../src/fields/themeConfigurationField.ts"],"sourcesContent":["import type { Field } from 'payload'\r\nimport {\r\n BASE_FONT_SIZE_OPTIONS,\r\n BODY_FONT_OPTIONS,\r\n HEADING_FONT_OPTIONS,\r\n LINE_HEIGHT_OPTIONS,\r\n} from '../constants/themeFonts.js'\r\nimport type { ThemePreset } from '../index.js'\r\nimport { darkModeField, lightModeField } from './colorModeFields.js'\r\n\r\ninterface ThemeConfigurationFieldOptions {\r\n themePresets: ThemePreset[]\r\n defaultTheme: string\r\n includeColorModeToggle: boolean\r\n includeCustomCSS: boolean\r\n includeBrandIdentity: boolean\r\n enableAdvancedFeatures?: boolean\r\n}\r\n\r\n/**\r\n * Theme Configuration Field with Theme Selection as default value setter\r\n * Theme Selection populates lightMode/darkMode colors automatically\r\n */\r\nexport function createThemeConfigurationField(options: ThemeConfigurationFieldOptions): Field {\r\n const {\r\n themePresets,\r\n defaultTheme,\r\n includeColorModeToggle,\r\n includeCustomCSS,\r\n enableAdvancedFeatures = true,\r\n } = options\r\n\r\n const themeOptions = themePresets.map((preset) => {\r\n const previewColor = preset.preview?.colors.primary\r\n const label = previewColor ? `${preset.label} • ${previewColor}` : preset.label\r\n return {\r\n label,\r\n value: preset.name,\r\n }\r\n })\r\n\r\n const fields: Field[] = [\r\n {\r\n name: 'theme',\r\n type: 'select',\r\n required: true,\r\n defaultValue: defaultTheme,\r\n options: themeOptions,\r\n label: {\r\n en: '🎨 Theme Selection',\r\n cs: '🎨 Výběr tématu',\r\n },\r\n admin: {\r\n description: {\r\n en: 'Select a theme to auto-populate color values. You can customize colors after selection.',\r\n cs: 'Vyberte téma pro automatické předvyplnění barev. Po výběru můžete barvy upravit.',\r\n },\r\n components: {\r\n Field: '@payloadcms-plugins/theme-management/fields/ThemePreviewField',\r\n },\r\n },\r\n },\r\n ]\r\n\r\n // Color Mode Settings\r\n if (includeColorModeToggle) {\r\n fields.push({\r\n type: 'collapsible',\r\n label: {\r\n en: '🌗 Color Mode Settings',\r\n cs: '🌗 Nastavení barevného režimu',\r\n },\r\n admin: {\r\n initCollapsed: false,\r\n description: {\r\n en: 'Configure light and dark mode colors. Changes here override theme selection.',\r\n cs: 'Nakonfigurujte barvy světlého a tmavého režimu. Změny zde přepíší výběr tématu.',\r\n },\r\n },\r\n fields: [\r\n {\r\n type: 'row',\r\n fields: [\r\n {\r\n name: 'colorMode',\r\n type: 'select',\r\n label: {\r\n en: 'Default Color Mode',\r\n cs: 'Výchozí barevný režim',\r\n },\r\n defaultValue: 'auto',\r\n options: [\r\n {\r\n label: {\r\n en: 'Auto (System)',\r\n cs: 'Automaticky (Systém)',\r\n },\r\n value: 'auto',\r\n },\r\n {\r\n label: { en: 'Light', cs: 'Světlý' },\r\n value: 'light',\r\n },\r\n {\r\n label: { en: 'Dark', cs: 'Tmavý' },\r\n value: 'dark',\r\n },\r\n ],\r\n admin: {\r\n description: {\r\n en: 'Default color mode for visitors',\r\n cs: 'Výchozí barevný režim pro návštěvníky',\r\n },\r\n width: '50%',\r\n },\r\n },\r\n {\r\n name: 'allowColorModeToggle',\r\n type: 'checkbox',\r\n label: {\r\n en: 'Enable Mode Toggle',\r\n cs: 'Povolit přepínač režimu',\r\n },\r\n defaultValue: true,\r\n admin: {\r\n description: {\r\n en: 'Let visitors switch modes',\r\n cs: 'Umožnit návštěvníkům přepínat režimy',\r\n },\r\n width: '50%',\r\n },\r\n },\r\n ],\r\n },\r\n lightModeField,\r\n darkModeField,\r\n ],\r\n })\r\n }\r\n\r\n fields.push({\r\n type: 'collapsible',\r\n label: {\r\n en: '🅰️ Typography',\r\n cs: '🅰️ Typografie',\r\n },\r\n admin: {\r\n initCollapsed: true,\r\n description: {\r\n en: 'Choose font families and base typography settings. Leave fields on \"Use preset\" to inherit the theme defaults.',\r\n cs: 'Zvolte rodiny písem a základní typografické nastavení. Hodnota \"Použít výchozí\" zachová nastavení motivu.',\r\n },\r\n },\r\n fields: [\r\n {\r\n name: 'typography',\r\n type: 'group',\r\n fields: [\r\n {\r\n type: 'row',\r\n fields: [\r\n {\r\n name: 'bodyFont',\r\n type: 'select',\r\n label: {\r\n en: 'Body font',\r\n cs: 'Písmo pro text',\r\n },\r\n defaultValue: 'preset',\r\n options: BODY_FONT_OPTIONS.map((option) => ({\r\n label: option.label,\r\n value: option.value,\r\n })),\r\n admin: {\r\n width: '50%',\r\n },\r\n },\r\n {\r\n name: 'headingFont',\r\n type: 'select',\r\n label: {\r\n en: 'Heading font',\r\n cs: 'Písmo pro nadpisy',\r\n },\r\n defaultValue: 'preset',\r\n options: HEADING_FONT_OPTIONS.map((option) => ({\r\n label: option.label,\r\n value: option.value,\r\n })),\r\n admin: {\r\n width: '50%',\r\n },\r\n },\r\n ],\r\n },\r\n {\r\n type: 'row',\r\n fields: [\r\n {\r\n name: 'bodyFontCustom',\r\n type: 'text',\r\n label: {\r\n en: 'Custom body font stack',\r\n cs: 'Vlastní písmo pro text',\r\n },\r\n admin: {\r\n width: '50%',\r\n placeholder: '\"IBM Plex Sans\", sans-serif',\r\n description: {\r\n en: 'Provide full CSS font-family stack when using a custom font.',\r\n cs: 'Při volbě vlastního písma zadejte celý CSS zápis font-family.',\r\n },\r\n condition: (_, siblingData) => siblingData?.bodyFont === 'custom',\r\n },\r\n },\r\n {\r\n name: 'headingFontCustom',\r\n type: 'text',\r\n label: {\r\n en: 'Custom heading font stack',\r\n cs: 'Vlastní písmo pro nadpisy',\r\n },\r\n admin: {\r\n width: '50%',\r\n placeholder: '\"Cormorant Garamond\", serif',\r\n description: {\r\n en: 'Provide full CSS font-family stack when using a custom heading font.',\r\n cs: 'Při volbě vlastního nadpisového písma zadejte celý CSS zápis font-family.',\r\n },\r\n condition: (_, siblingData) => siblingData?.headingFont === 'custom',\r\n },\r\n },\r\n ],\r\n },\r\n {\r\n type: 'row',\r\n fields: [\r\n {\r\n name: 'baseFontSize',\r\n type: 'select',\r\n label: {\r\n en: 'Base font size',\r\n cs: 'Základní velikost písma',\r\n },\r\n defaultValue: 'preset',\r\n options: BASE_FONT_SIZE_OPTIONS.map((option) => ({\r\n label: option.label,\r\n value: option.value,\r\n })),\r\n admin: {\r\n width: '50%',\r\n },\r\n },\r\n {\r\n name: 'lineHeight',\r\n type: 'select',\r\n label: {\r\n en: 'Line height',\r\n cs: 'Řádkování',\r\n },\r\n defaultValue: 'preset',\r\n options: LINE_HEIGHT_OPTIONS.map((option) => ({\r\n label: option.label,\r\n value: option.value,\r\n })),\r\n admin: {\r\n width: '50%',\r\n },\r\n },\r\n ],\r\n },\r\n ],\r\n },\r\n ],\r\n })\r\n\r\n // Design Customization\r\n fields.push({\r\n type: 'collapsible',\r\n label: {\r\n en: '✨ Design Customization',\r\n cs: '✨ Přizpůsobení designu',\r\n },\r\n admin: {\r\n initCollapsed: true,\r\n },\r\n fields: [\r\n {\r\n name: 'borderRadius',\r\n type: 'select',\r\n label: {\r\n en: 'Border Radius',\r\n cs: 'Zaoblení rohů',\r\n },\r\n defaultValue: 'medium',\r\n options: [\r\n { label: { en: 'None', cs: 'Žádné' }, value: 'none' },\r\n { label: { en: 'Small', cs: 'Malé' }, value: 'small' },\r\n { label: { en: 'Medium', cs: 'Střední' }, value: 'medium' },\r\n { label: { en: 'Large', cs: 'Velké' }, value: 'large' },\r\n { label: { en: 'Full', cs: 'Plné' }, value: 'xl' },\r\n ],\r\n admin: {\r\n components: {\r\n Field: '@payloadcms-plugins/theme-management/fields/RadiusField',\r\n },\r\n width: '33%',\r\n },\r\n },\r\n {\r\n name: 'fontScale',\r\n type: 'select',\r\n label: {\r\n en: 'Font Scale',\r\n cs: 'Velikost písma',\r\n },\r\n defaultValue: 'medium',\r\n options: [\r\n { label: { en: 'Small', cs: 'Malé' }, value: 'small' },\r\n { label: { en: 'Medium', cs: 'Střední' }, value: 'medium' },\r\n { label: { en: 'Large', cs: 'Velké' }, value: 'large' },\r\n ],\r\n admin: {\r\n width: '33%',\r\n },\r\n },\r\n {\r\n name: 'spacing',\r\n type: 'select',\r\n label: {\r\n en: 'Spacing',\r\n cs: 'Mezery',\r\n },\r\n defaultValue: 'medium',\r\n options: [\r\n { label: { en: 'Compact', cs: 'Kompaktní' }, value: 'compact' },\r\n { label: { en: 'Medium', cs: 'Střední' }, value: 'medium' },\r\n { label: { en: 'Spacious', cs: 'Prostorné' }, value: 'spacious' },\r\n ],\r\n admin: {\r\n width: '34%',\r\n },\r\n },\r\n ],\r\n })\r\n\r\n // Advanced Settings\r\n if (enableAdvancedFeatures) {\r\n const advancedFields: Field[] = [\r\n {\r\n name: 'animationLevel',\r\n type: 'select',\r\n label: {\r\n en: 'Animation Level',\r\n cs: 'Úroveň animací',\r\n },\r\n defaultValue: 'medium',\r\n options: [\r\n { label: { en: 'None', cs: 'Žádné' }, value: 'none' },\r\n { label: { en: 'Reduced', cs: 'Snížené' }, value: 'reduced' },\r\n { label: { en: 'Medium', cs: 'Střední' }, value: 'medium' },\r\n { label: { en: 'High', cs: 'Vysoké' }, value: 'high' },\r\n ],\r\n admin: {\r\n description: {\r\n en: 'Control website animations and transitions',\r\n cs: 'Kontrola animací a přechodů na webu',\r\n },\r\n width: '50%',\r\n },\r\n },\r\n ]\r\n\r\n if (includeCustomCSS) {\r\n advancedFields.push({\r\n name: 'customCSS',\r\n type: 'code',\r\n label: {\r\n en: 'Custom CSS',\r\n cs: 'Vlastní CSS',\r\n },\r\n admin: {\r\n language: 'css',\r\n description: {\r\n en: 'Add custom CSS to override default styles',\r\n cs: 'Přidejte vlastní CSS pro přepsání výchozích stylů',\r\n },\r\n // placeholder:\r\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}',\r\n // rows: 8,\r\n },\r\n })\r\n }\r\n\r\n fields.push({\r\n type: 'collapsible',\r\n label: {\r\n en: '⚙️ Advanced Settings',\r\n cs: '⚙️ Pokročilé nastavení',\r\n },\r\n admin: {\r\n initCollapsed: true,\r\n },\r\n fields: advancedFields,\r\n })\r\n }\r\n\r\n return {\r\n name: 'themeConfiguration',\r\n type: 'group',\r\n label: false,\r\n admin: {\r\n description: {\r\n en: 'Configure website appearance and styling',\r\n cs: 'Nakonfigurujte vzhled a stylování webu',\r\n },\r\n },\r\n fields,\r\n }\r\n}\r\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","option","placeholder","condition","_","siblingData","bodyFont","headingFont","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,MAAM;YACNE,MAAM;YACNC,UAAU;YACVC,cAAcjB;YACdF,SAASM;YACTO,OAAO;gBACLO,IAAI;gBACJC,IAAI;YACN;YACAC,OAAO;gBACLC,aAAa;oBACXH,IAAI;oBACJC,IAAI;gBACN;gBACAG,YAAY;oBACVC,OAAO;gBACT;YACF;QACF;KACD;IAED,sBAAsB;IACtB,IAAItB,wBAAwB;QAC1Ba,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;oBACEC,MAAM;oBACND,QAAQ;wBACN;4BACED,MAAM;4BACNE,MAAM;4BACNJ,OAAO;gCACLO,IAAI;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QACNJ,OAAO;QACPS,OAAO;YACLC,aAAa;gBACXH,IAAI;gBACJC,IAAI;YACN;QACF;QACAL;IACF;AACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -11,8 +11,10 @@ export { defaultThemePresets } from './presets.js';
|
|
|
11
11
|
export type { ThemePreset, ThemeTypographyPreset } from './presets.js';
|
|
12
12
|
export type { ThemeManagementPluginOptions, FetchThemeConfigurationOptions } from './types.js';
|
|
13
13
|
export { DEFAULT_THEME_CONFIGURATION, resolveThemeConfiguration, } from './utils/resolveThemeConfiguration.js';
|
|
14
|
+
export type { ResolvedThemeConfiguration } from './utils/resolveThemeConfiguration.js';
|
|
14
15
|
export { generateThemeColorsCss, hexToHsl } from './utils/themeColors.js';
|
|
15
16
|
export { generateThemeCSS, getThemeStyles } from './utils/themeUtils.js';
|
|
17
|
+
export { getThemeHtmlAttributes } from './utils/themeHtmlAttributes.js';
|
|
16
18
|
export type { Mode, ThemeDefaults } from './providers/Theme/types.js';
|
|
17
19
|
export { ThemeProvider } from './providers/Theme/index.js';
|
|
18
20
|
export declare const ThemeManagementPlugin: (options?: ThemeManagementPluginOptions) => Plugin;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmC,MAAM,EAAE,MAAM,SAAS,CAAA;AAEtE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE/C,OAAO,KAAK,EACV,8BAA8B,EAC9B,4BAA4B,EAC7B,MAAM,YAAY,CAAA;AA2BnB,eAAO,MAAM,qBAAqB,GAAI,UAAS,4BAAiC,KAAG,MAqElF,CAAA;AAED,KAAK,iBAAiB,GAAG,MAAM,GAAG,8BAA8B,CAAA;AAEhE,eAAO,MAAM,uBAAuB,GAClC,UAAU,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AAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAClD,YAAY,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AACtE,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;AAE1D,eAAO,MAAM,qBAAqB,aApJa,4BAA4B,KAAQ,MAoJzB,CAAA;AAC1D,oDAAoD;AACpD,eAAO,MAAM,wBAAwB,aAtJU,4BAA4B,KAAQ,MAsJtB,CAAA;AAE7D,eAAe,qBAAqB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -101,6 +101,7 @@ export { defaultThemePresets } from './presets.js';
|
|
|
101
101
|
export { DEFAULT_THEME_CONFIGURATION, resolveThemeConfiguration } from './utils/resolveThemeConfiguration.js';
|
|
102
102
|
export { generateThemeColorsCss, hexToHsl } from './utils/themeColors.js';
|
|
103
103
|
export { generateThemeCSS, getThemeStyles } from './utils/themeUtils.js';
|
|
104
|
+
export { getThemeHtmlAttributes } from './utils/themeHtmlAttributes.js';
|
|
104
105
|
export { ThemeProvider } from './providers/Theme/index.js';
|
|
105
106
|
export const ThemeManagementPlugin = themeManagementPlugin;
|
|
106
107
|
/** @deprecated use {@link themeManagementPlugin} */ export const themeConfigurationPlugin = 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 {\n FetchThemeConfigurationOptions,\n ThemeManagementPluginOptions,\n} 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(\n `🎨 Theme Management Plugin: enhancing collection \"${collection.slug}\"`,\n )\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 =\n typeof options === 'string'\n ? { tenantSlug: options }\n : 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\n\n\nexport { defaultThemePresets } from './presets.js'\nexport type { ThemePreset, ThemeTypographyPreset } from './presets.js'\nexport type { ThemeManagementPluginOptions, FetchThemeConfigurationOptions } from './types.js'\nexport {\n DEFAULT_THEME_CONFIGURATION,\n resolveThemeConfiguration,\n} from './utils/resolveThemeConfiguration.js'\nexport { generateThemeColorsCss, hexToHsl } from './utils/themeColors.js'\nexport { generateThemeCSS, getThemeStyles } from './utils/themeUtils.js'\n\nexport type { Mode, ThemeDefaults } from './providers/Theme/types.js'\nexport { ThemeProvider } from './providers/Theme/index.js'\n\nexport const ThemeManagementPlugin = themeManagementPlugin\n/** @deprecated use {@link themeManagementPlugin} */\nexport const themeConfigurationPlugin = themeManagementPlugin\n\nexport default themeManagementPlugin"],"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","DEFAULT_THEME_CONFIGURATION","resolveThemeConfiguration","generateThemeColorsCss","hexToHsl","generateThemeCSS","getThemeStyles","ThemeProvider","ThemeManagementPlugin","themeConfigurationPlugin"],"mappings":"AACA,SAASA,6BAA6B,QAAQ,sCAAqC;AAGnF,SAASC,mBAAmB,QAAQ,eAAc;AAMlD,MAAMC,mBAAmB;AAEzB,MAAMC,2BAA2B,CAACC,SAAkB,EAAE,GACpDA,OAAOC,MAAM,CAAC,CAACC;QACb,MAAMC,YAAYD;QAClB,OAAOC,WAAWC,SAASN;IAC7B;AAEF,MAAMO,mBAAmB,CACvBL,QACAM,YACAC;IAEA,MAAMC,YAAYT,yBAAyBC,UAAU,EAAE;IAEvD,IAAI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oBqE,IAAI,CAAC,CAACC,SAAWA,OAAO/D,IAAI,KAAK6D,cAAc;AAC5E,EAAC;AAED,OAAO,MAAMG,2BAA2B;IACtC,OAAOvE;AACT,EAAC;AAID,SAASA,mBAAmB,QAAQ,eAAc;AAGlD,SACEwE,2BAA2B,EAC3BC,yBAAyB,QACpB,uCAAsC;AAC7C,SAASC,sBAAsB,EAAEC,QAAQ,QAAQ,yBAAwB;AACzE,SAASC,gBAAgB,EAAEC,cAAc,QAAQ,wBAAuB;AAGxE,SAASC,aAAa,QAAQ,6BAA4B;AAE1D,OAAO,MAAMC,wBAAwB7D,sBAAqB;AAC1D,kDAAkD,GAClD,OAAO,MAAM8D,2BAA2B9D,sBAAqB;AAE7D,eAAeA,sBAAqB"}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { CollectionConfig, Config, Field, Plugin } from 'payload'\r\nimport { createThemeConfigurationField } from './fields/themeConfigurationField.js'\r\nimport type { SiteThemeConfiguration } from './payload-types.js'\r\nimport type { ThemePreset } from './presets.js'\r\nimport { defaultThemePresets } from './presets.js'\r\nimport type {\r\n FetchThemeConfigurationOptions,\r\n ThemeManagementPluginOptions,\r\n} from './types.js'\r\n\r\nconst THEME_FIELD_NAME = 'themeConfiguration'\r\n\r\nconst removeExistingThemeField = (fields: Field[] = []): Field[] =>\r\n fields.filter((field) => {\r\n const candidate = field as { name?: unknown }\r\n return candidate?.name !== THEME_FIELD_NAME\r\n })\r\n\r\nconst upsertThemeField = (\r\n fields: Field[] | undefined,\r\n themeField: Field,\r\n enableLogging: boolean,\r\n): Field[] => {\r\n const sanitized = removeExistingThemeField(fields ?? [])\r\n\r\n if (enableLogging) {\r\n console.log('🎨 Theme Management Plugin: injecting theme configuration field')\r\n }\r\n\r\n return [...sanitized, themeField]\r\n}\r\n\r\nconst ensureCollectionsArray = (collections: Config['collections']): CollectionConfig[] =>\r\n Array.isArray(collections) ? collections : []\r\n\r\nexport const themeManagementPlugin = (options: ThemeManagementPluginOptions = {}): Plugin => {\r\n return (config: Config): Config => {\r\n const {\r\n enabled = true,\r\n targetCollection = 'site-settings',\r\n themePresets = defaultThemePresets,\r\n defaultTheme = 'cool',\r\n includeColorModeToggle = true,\r\n includeCustomCSS = true,\r\n includeBrandIdentity = false,\r\n enableAdvancedFeatures = true,\r\n enableLogging = false,\r\n } = options\r\n\r\n if (!enabled) {\r\n if (enableLogging) {\r\n console.log('🎨 Theme Management Plugin: disabled via options, skipping.')\r\n }\r\n return config\r\n }\r\n\r\n const themeField = createThemeConfigurationField({\r\n themePresets,\r\n defaultTheme,\r\n includeColorModeToggle,\r\n includeCustomCSS,\r\n includeBrandIdentity: includeBrandIdentity ?? false,\r\n enableAdvancedFeatures,\r\n })\r\n\r\n let collectionTouched = false\r\n\r\n const collections = ensureCollectionsArray(config.collections).map((collection) => {\r\n if (collection.slug !== targetCollection) {\r\n return collection\r\n }\r\n\r\n collectionTouched = true\r\n\r\n if (enableLogging) {\r\n console.log(\r\n `🎨 Theme Management Plugin: enhancing collection \"${collection.slug}\"`,\r\n )\r\n }\r\n\r\n const existingFields = Array.isArray(collection.fields) ? collection.fields : []\r\n\r\n const fields = upsertThemeField(existingFields, themeField, enableLogging)\r\n\r\n return {\r\n ...collection,\r\n fields,\r\n }\r\n })\r\n\r\n if (!collectionTouched) {\r\n if (enableLogging) {\r\n console.warn(\r\n `🎨 Theme Management Plugin: collection \"${targetCollection}\" was not found, leaving config untouched.`,\r\n )\r\n }\r\n return config\r\n }\r\n\r\n return {\r\n ...config,\r\n collections,\r\n }\r\n }\r\n}\r\n\r\ntype FetchOptionsInput = string | FetchThemeConfigurationOptions\r\n\r\nexport const fetchThemeConfiguration = async (\r\n options?: FetchOptionsInput,\r\n): Promise<SiteThemeConfiguration | null> => {\r\n const normalizedOptions =\r\n typeof options === 'string'\r\n ? { tenantSlug: options }\r\n : options ?? {}\r\n\r\n const {\r\n tenantSlug,\r\n collectionSlug = 'site-settings',\r\n depth,\r\n locale,\r\n draft,\r\n queryParams = {},\r\n } = normalizedOptions\r\n\r\n const params = new URLSearchParams({ limit: '1' })\r\n\r\n if (typeof depth === 'number') params.set('depth', String(depth))\r\n if (tenantSlug) params.set('tenant', tenantSlug)\r\n if (locale) params.set('locale', locale)\r\n if (draft) params.set('draft', 'true')\r\n\r\n Object.entries(queryParams).forEach(([key, value]) => {\r\n if (value === undefined) return\r\n params.set(key, String(value))\r\n })\r\n\r\n const url = `/api/${collectionSlug}?${params.toString()}`\r\n\r\n try {\r\n const response = await fetch(url)\r\n if (!response.ok) {\r\n throw new Error(`Failed to fetch theme configuration (status ${response.status})`)\r\n }\r\n\r\n const data = (await response.json()) as {\r\n docs?: Array<{ themeConfiguration?: SiteThemeConfiguration }>\r\n }\r\n\r\n const doc = data.docs?.[0]\r\n\r\n return doc?.themeConfiguration ?? null\r\n } catch (error) {\r\n console.warn('Failed to fetch theme configuration:', error)\r\n return null\r\n }\r\n}\r\n\r\nexport const getThemePreset = (themeName: string): ThemePreset | null => {\r\n return defaultThemePresets.find((preset) => preset.name === themeName) || null\r\n}\r\n\r\nexport const getAvailableThemePresets = (): ThemePreset[] => {\r\n return defaultThemePresets\r\n}\r\n\r\n\r\n\r\nexport { defaultThemePresets } from './presets.js'\r\nexport type { ThemePreset, ThemeTypographyPreset } from './presets.js'\r\nexport type { ThemeManagementPluginOptions, FetchThemeConfigurationOptions } from './types.js'\r\nexport {\r\n DEFAULT_THEME_CONFIGURATION,\r\n resolveThemeConfiguration,\r\n} from './utils/resolveThemeConfiguration.js'\r\nexport type { ResolvedThemeConfiguration } from './utils/resolveThemeConfiguration.js'\r\nexport { generateThemeColorsCss, hexToHsl } from './utils/themeColors.js'\r\nexport { generateThemeCSS, getThemeStyles } from './utils/themeUtils.js'\r\nexport { getThemeHtmlAttributes } from './utils/themeHtmlAttributes.js'\r\n\r\nexport type { Mode, ThemeDefaults } from './providers/Theme/types.js'\r\nexport { ThemeProvider } from './providers/Theme/index.js'\r\n\r\nexport const ThemeManagementPlugin = themeManagementPlugin\r\n/** @deprecated use {@link themeManagementPlugin} */\r\nexport const themeConfigurationPlugin = themeManagementPlugin\r\n\r\nexport default themeManagementPlugin"],"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","DEFAULT_THEME_CONFIGURATION","resolveThemeConfiguration","generateThemeColorsCss","hexToHsl","generateThemeCSS","getThemeStyles","getThemeHtmlAttributes","ThemeProvider","ThemeManagementPlugin","themeConfigurationPlugin"],"mappings":"AACA,SAASA,6BAA6B,QAAQ,sCAAqC;AAGnF,SAASC,mBAAmB,QAAQ,eAAc;AAMlD,MAAMC,mBAAmB;AAEzB,MAAMC,2BAA2B,CAACC,SAAkB,EAAE,GACpDA,OAAOC,MAAM,CAAC,CAACC;QACb,MAAMC,YAAYD;QAClB,OAAOC,WAAWC,SAASN;IAC7B;AAEF,MAAMO,mBAAmB,CACvBL,QACAM,YACAC;IAEA,MAAMC,YAAYT,yBAAyBC,UAAU,EAAE;IAEvD,IAAIO,eAAe;QACnBE,QAAQC,GAAG,CAAC;IACZ;IAEA,OAAO;WAAIF;QAAWF;KAAW;AACnC;AAEA,MAAMK,yBAAyB,CAACC,cAC9BC,MAAMC,OAAO,CAACF,eAAeA,cAAc,EAAE;AAE/C,OAAO,MAAMG,wBAAwB,CAACC,UAAwC,CAAC,CAAC;IAC9E,OAAO,CAACC;QACN,MAAM,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C,QAAQ,QAAQ,yBAAwB;AACzE,SAASC,gBAAgB,EAAEC,cAAc,QAAQ,wBAAuB;AACxE,SAASC,sBAAsB,QAAQ,iCAAgC;AAGvE,SAASC,aAAa,QAAQ,6BAA4B;AAE1D,OAAO,MAAMC,wBAAwB9D,sBAAqB;AAC1D,kDAAkD,GAClD,OAAO,MAAM+D,2BAA2B/D,sBAAqB;AAE7D,eAAeA,sBAAqB"}
|
package/dist/payload-types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Payload types for theme configuration
|
|
3
|
-
* These are placeholder types that will be extended in the consuming application
|
|
1
|
+
/**
|
|
2
|
+
* Payload types for theme configuration
|
|
3
|
+
* These are placeholder types that will be extended in the consuming application
|
|
4
4
|
*/ export { };
|
|
5
5
|
|
|
6
6
|
//# sourceMappingURL=payload-types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/payload-types.ts"],"sourcesContent":["/**\n * Payload types for theme configuration\n * These are placeholder types that will be extended in the consuming application\n */\n\nexport interface ThemeColorOverride {\n [token: string]: string | null | undefined;\n primary?: string | null;\n secondary?: string | null;\n accent?: string | null;\n background?: string | null;\n surface?: string | null;\n surfaceVariant?: string | null;\n text?: string | null;\n textSecondary?: string | null;\n border?: string | null;\n success?: string | null;\n warning?: string | null;\n error?: string | null;\n info?: string | null;\n foreground?: string | null;\n card?: string | null;\n cardForeground?: string | null;\n popover?: string | null;\n popoverForeground?: string | null;\n primaryForeground?: string | null;\n secondaryForeground?: string | null;\n muted?: string | null;\n mutedForeground?: string | null;\n accentForeground?: string | null;\n destructive?: string | null;\n destructiveForeground?: string | null;\n input?: string | null;\n ring?: string | null;\n}\n\nexport interface ThemeTypographyOverride {\n bodyFont?:\n | (\n | 'preset'\n | 'system'\n | 'geist-sans'\n | 'inter'\n | 'manrope'\n | 'urbanist'\n | 'outfit'\n | 'lora'\n | 'custom'\n )\n | null;\n headingFont?:\n | (\n | 'preset'\n | 'geist-sans'\n | 'geist-mono'\n | 'outfit'\n | 'playfair'\n | 'lora'\n | 'serif-classic'\n | 'custom'\n )\n | null;\n bodyFontCustom?: string | null;\n headingFontCustom?: string | null;\n baseFontSize?: ('preset' | '14px' | '16px' | '18px' | '20px') | null;\n lineHeight?: ('preset' | '1.4' | '1.5' | '1.6' | '1.75' | '1.9') | null;\n fontWeights?: Partial<\n Record<'light' | 'normal' | 'medium' | 'semibold' | 'bold' | 'black', string | null>\n > | null;\n letterSpacing?: Partial<Record<'tight' | 'normal' | 'wide' | 'wider', string | null>> | null;\n}\n\nexport interface ThemeCustomization {\n primaryColor?: string | null;\n accentColor?: string | null;\n backgroundColor?: string | null;\n textColor?: string | null;\n customCSS?: string | null;\n}\n\nexport interface SiteThemeConfiguration {\n theme?: string | null;\n preset?: string | null;\n colorMode?: 'auto' | 'light' | 'dark' | null;\n allowColorModeToggle?: boolean | null;\n lightMode?: ThemeColorOverride | null;\n darkMode?: ThemeColorOverride | null;\n colors?: ThemeColorOverride | null;\n typography?: ThemeTypographyOverride | null;\n borderRadius?: 'none' | 'small' | 'medium' | 'large' | 'xl' | null;\n fontScale?: 'small' | 'medium' | 'large' | 'xl' | null;\n spacing?: 'compact' | 'medium' | 'spacious' | null;\n animationLevel?: 'none' | 'reduced' | 'medium' | 'high' | null;\n customCSS?: string | null;\n customization?: ThemeCustomization | null;\n radius?: string | null;\n}\n\nexport interface SiteSetting {\n id: string;\n title?: string | null;\n slug?: string | null;\n themeConfiguration: SiteThemeConfiguration | null;\n updatedAt: string;\n createdAt: string;\n}\n\nexport interface Config {\n collections: {\n 'site-settings': SiteSetting;\n };\n globals: Record<string, unknown>;\n}\n"],"names":[],"mappings":"AAAA;;;CAGC,GAwGD,WAKC"}
|
|
1
|
+
{"version":3,"sources":["../src/payload-types.ts"],"sourcesContent":["/**\r\n * Payload types for theme configuration\r\n * These are placeholder types that will be extended in the consuming application\r\n */\r\n\r\nexport interface ThemeColorOverride {\r\n [token: string]: string | null | undefined;\r\n primary?: string | null;\r\n secondary?: string | null;\r\n accent?: string | null;\r\n background?: string | null;\r\n surface?: string | null;\r\n surfaceVariant?: string | null;\r\n text?: string | null;\r\n textSecondary?: string | null;\r\n border?: string | null;\r\n success?: string | null;\r\n warning?: string | null;\r\n error?: string | null;\r\n info?: string | null;\r\n foreground?: string | null;\r\n card?: string | null;\r\n cardForeground?: string | null;\r\n popover?: string | null;\r\n popoverForeground?: string | null;\r\n primaryForeground?: string | null;\r\n secondaryForeground?: string | null;\r\n muted?: string | null;\r\n mutedForeground?: string | null;\r\n accentForeground?: string | null;\r\n destructive?: string | null;\r\n destructiveForeground?: string | null;\r\n input?: string | null;\r\n ring?: string | null;\r\n}\r\n\r\nexport interface ThemeTypographyOverride {\r\n bodyFont?:\r\n | (\r\n | 'preset'\r\n | 'system'\r\n | 'geist-sans'\r\n | 'inter'\r\n | 'manrope'\r\n | 'urbanist'\r\n | 'outfit'\r\n | 'lora'\r\n | 'custom'\r\n )\r\n | null;\r\n headingFont?:\r\n | (\r\n | 'preset'\r\n | 'geist-sans'\r\n | 'geist-mono'\r\n | 'outfit'\r\n | 'playfair'\r\n | 'lora'\r\n | 'serif-classic'\r\n | 'custom'\r\n )\r\n | null;\r\n bodyFontCustom?: string | null;\r\n headingFontCustom?: string | null;\r\n baseFontSize?: ('preset' | '14px' | '16px' | '18px' | '20px') | null;\r\n lineHeight?: ('preset' | '1.4' | '1.5' | '1.6' | '1.75' | '1.9') | null;\r\n fontWeights?: Partial<\r\n Record<'light' | 'normal' | 'medium' | 'semibold' | 'bold' | 'black', string | null>\r\n > | null;\r\n letterSpacing?: Partial<Record<'tight' | 'normal' | 'wide' | 'wider', string | null>> | null;\r\n}\r\n\r\nexport interface ThemeCustomization {\r\n primaryColor?: string | null;\r\n accentColor?: string | null;\r\n backgroundColor?: string | null;\r\n textColor?: string | null;\r\n customCSS?: string | null;\r\n}\r\n\r\nexport interface SiteThemeConfiguration {\r\n theme?: string | null;\r\n preset?: string | null;\r\n colorMode?: 'auto' | 'light' | 'dark' | null;\r\n allowColorModeToggle?: boolean | null;\r\n lightMode?: ThemeColorOverride | null;\r\n darkMode?: ThemeColorOverride | null;\r\n colors?: ThemeColorOverride | null;\r\n typography?: ThemeTypographyOverride | null;\r\n borderRadius?: 'none' | 'small' | 'medium' | 'large' | 'xl' | null;\r\n fontScale?: 'small' | 'medium' | 'large' | 'xl' | null;\r\n spacing?: 'compact' | 'medium' | 'spacious' | null;\r\n animationLevel?: 'none' | 'reduced' | 'medium' | 'high' | null;\r\n customCSS?: string | null;\r\n customization?: ThemeCustomization | null;\r\n radius?: string | null;\r\n}\r\n\r\nexport interface SiteSetting {\r\n id: string;\r\n title?: string | null;\r\n slug?: string | null;\r\n themeConfiguration: SiteThemeConfiguration | null;\r\n updatedAt: string;\r\n createdAt: string;\r\n}\r\n\r\nexport interface Config {\r\n collections: {\r\n 'site-settings': SiteSetting;\r\n };\r\n globals: Record<string, unknown>;\r\n}\r\n"],"names":[],"mappings":"AAAA;;;CAGC,GAwGD,WAKC"}
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugin.ts"],"sourcesContent":["export type { ThemeManagementPluginOptions } from './types.js';\n"],"names":[],"mappings":"AAAA,WAA+D"}
|
|
1
|
+
{"version":3,"sources":["../src/plugin.ts"],"sourcesContent":["export type { ThemeManagementPluginOptions } from './types.js';\r\n"],"names":[],"mappings":"AAAA,WAA+D"}
|
package/dist/presets.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/presets.ts"],"sourcesContent":["export interface ThemeTypographyPreset {\n fontFamily: string\n headingFamily: string\n baseFontSize: string\n lineHeight: string\n fontWeights: {\n light?: string\n normal?: string\n medium?: string\n semibold?: string\n bold?: string\n black?: string\n }\n letterSpacing: {\n tight?: string\n normal?: string\n wide?: string\n wider?: string\n }\n}\n\nexport interface ThemePreset {\n name: string\n label: string\n borderRadius: 'none' | 'small' | 'medium' | 'large' | 'xl'\n cssFile?: string\n preview?: {\n colors: {\n primary: string\n background: string\n accent: string\n }\n }\n theme?: string\n colorMode?: 'auto' | 'light' | 'dark'\n fontScale?: 'small' | 'medium' | 'large'\n spacing?: 'small' | 'medium' | 'large'\n animationLevel?: 'low' | 'medium' | 'high'\n lightMode?: Record<string, string>\n darkMode?: Record<string, string>\n typography?: ThemeTypographyPreset\n}\n\nexport const defaultThemePresets: ThemePreset[] = [\n {\n name: 'cool',\n label: 'Cool & Professional',\n borderRadius: 'medium',\n preview: {\n colors: {\n primary: '#3b82f6',\n background: '#ffffff',\n accent: '#f1f5f9',\n },\n },\n lightMode: {\n background: '#ffffff',\n foreground: '#0a0a0a',\n card: '#ffffff',\n cardForeground: '#0a0a0a',\n popover: '#ffffff',\n popoverForeground: '#0a0a0a',\n primary: '#3b82f6',\n primaryForeground: '#ffffff',\n secondary: '#f1f5f9',\n secondaryForeground: '#0f172a',\n muted: '#f1f5f9',\n mutedForeground: '#64748b',\n accent: '#f1f5f9',\n accentForeground: '#0f172a',\n destructive: '#ef4444',\n destructiveForeground: '#ffffff',\n border: '#e2e8f0',\n input: '#e2e8f0',\n ring: '#3b82f6',\n },\n darkMode: {\n background: '#0a0a0a',\n foreground: '#fafafa',\n card: '#1a1a1a',\n cardForeground: '#fafafa',\n popover: '#1a1a1a',\n popoverForeground: '#fafafa',\n primary: '#60a5fa',\n primaryForeground: '#0a0a0a',\n secondary: '#27272a',\n secondaryForeground: '#fafafa',\n muted: '#27272a',\n mutedForeground: '#a1a1aa',\n accent: '#27272a',\n accentForeground: '#fafafa',\n destructive: '#f87171',\n destructiveForeground: '#0a0a0a',\n border: '#27272a',\n input: '#27272a',\n ring: '#60a5fa',\n },\n typography: {\n fontFamily: 'var(--font-geist-sans)',\n headingFamily: 'var(--font-outfit)',\n baseFontSize: '16px',\n lineHeight: '1.6',\n fontWeights: {\n normal: '400',\n medium: '500',\n semibold: '600',\n bold: '700',\n },\n letterSpacing: {\n tight: '-0.02em',\n normal: '0',\n wide: '0.02em',\n },\n },\n },\n {\n name: 'brutal',\n label: 'Modern Brutalism',\n borderRadius: 'none',\n preview: {\n colors: {\n primary: '#000000',\n background: '#ffffff',\n accent: '#ef4444',\n },\n },\n lightMode: {\n background: '#ffffff',\n foreground: '#000000',\n card: '#ffffff',\n cardForeground: '#000000',\n popover: '#ffffff',\n popoverForeground: '#000000',\n primary: '#000000',\n primaryForeground: '#ffffff',\n secondary: '#f5f5f5',\n secondaryForeground: '#000000',\n muted: '#f5f5f5',\n mutedForeground: '#737373',\n accent: '#ef4444',\n accentForeground: '#ffffff',\n destructive: '#ef4444',\n destructiveForeground: '#ffffff',\n border: '#000000',\n input: '#e5e5e5',\n ring: '#000000',\n },\n darkMode: {\n background: '#000000',\n foreground: '#ffffff',\n card: '#0a0a0a',\n cardForeground: '#ffffff',\n popover: '#0a0a0a',\n popoverForeground: '#ffffff',\n primary: '#ffffff',\n primaryForeground: '#000000',\n secondary: '#262626',\n secondaryForeground: '#ffffff',\n muted: '#262626',\n mutedForeground: '#a3a3a3',\n accent: '#ef4444',\n accentForeground: '#ffffff',\n destructive: '#dc2626',\n destructiveForeground: '#ffffff',\n border: '#ffffff',\n input: '#262626',\n ring: '#ffffff',\n },\n typography: {\n fontFamily: 'var(--font-geist-mono)',\n headingFamily: 'var(--font-geist-mono)',\n baseFontSize: '16px',\n lineHeight: '1.5',\n fontWeights: {\n normal: '400',\n medium: '600',\n semibold: '700',\n bold: '800',\n },\n letterSpacing: {\n tight: '0',\n normal: '0.05em',\n wide: '0.1em',\n },\n },\n },\n {\n name: 'neon',\n label: 'Neon Cyberpunk',\n borderRadius: 'medium',\n preview: {\n colors: {\n primary: '#9333ea',\n background: '#0d0f1a',\n accent: '#00ffff',\n },\n },\n lightMode: {\n background: '#0d0f1a',\n foreground: '#ffffff',\n card: '#12141f',\n cardForeground: '#ffffff',\n popover: '#12141f',\n popoverForeground: '#ffffff',\n primary: '#9333ea',\n primaryForeground: '#ffffff',\n secondary: '#1a1d2e',\n secondaryForeground: '#ffffff',\n muted: '#1a1d2e',\n mutedForeground: '#b3b3cc',\n accent: '#00ffff',\n accentForeground: '#0d0f1a',\n destructive: '#ff0000',\n destructiveForeground: '#ffffff',\n border: '#2d3348',\n input: '#2d3348',\n ring: '#9333ea',\n },\n darkMode: {\n background: '#0d0f1a',\n foreground: '#ffffff',\n card: '#12141f',\n cardForeground: '#ffffff',\n popover: '#12141f',\n popoverForeground: '#ffffff',\n primary: '#9333ea',\n primaryForeground: '#ffffff',\n secondary: '#1a1d2e',\n secondaryForeground: '#ffffff',\n muted: '#1a1d2e',\n mutedForeground: '#b3b3cc',\n accent: '#00ffff',\n accentForeground: '#0d0f1a',\n destructive: '#ff0000',\n destructiveForeground: '#0d0f1a',\n border: '#2d3348',\n input: '#2d3348',\n ring: '#9333ea',\n },\n typography: {\n fontFamily: 'var(--font-geist-sans)',\n headingFamily: 'var(--font-geist-mono)',\n baseFontSize: '16px',\n lineHeight: '1.7',\n fontWeights: {\n normal: '400',\n medium: '500',\n semibold: '700',\n bold: '900',\n },\n letterSpacing: {\n tight: '0',\n normal: '0.05em',\n wide: '0.15em',\n },\n },\n },\n {\n name: 'solar',\n label: 'Solar',\n borderRadius: 'large',\n preview: {\n colors: {\n primary: '#c85a19',\n background: '#fffbf5',\n accent: '#ffcc00',\n },\n },\n lightMode: {\n background: '#fffbf5',\n foreground: '#2d1a09',\n card: '#ffffff',\n cardForeground: '#2d1a09',\n popover: '#ffffff',\n popoverForeground: '#2d1a09',\n primary: '#c85a19',\n primaryForeground: '#ffffff',\n secondary: '#fff7e6',\n secondaryForeground: '#2d1a09',\n muted: '#f5ebe0',\n mutedForeground: '#665544',\n accent: '#ffcc00',\n accentForeground: '#2d1a09',\n destructive: '#e34850',\n destructiveForeground: '#ffffff',\n border: '#e8d4c4',\n input: '#e8d4c4',\n ring: '#c85a19',\n },\n darkMode: {\n background: '#1f1610',\n foreground: '#f0dcc7',\n card: '#271c15',\n cardForeground: '#f0dcc7',\n popover: '#271c15',\n popoverForeground: '#f0dcc7',\n primary: '#e37a3d',\n primaryForeground: '#ffffff',\n secondary: '#3d2f26',\n secondaryForeground: '#f0dcc7',\n muted: '#3d2f26',\n mutedForeground: '#ccb8a6',\n accent: '#ffd633',\n accentForeground: '#1f1610',\n destructive: '#993438',\n destructiveForeground: '#ffffff',\n border: '#453828',\n input: '#453828',\n ring: '#e37a3d',\n },\n typography: {\n fontFamily: 'var(--font-geist-sans)',\n headingFamily: 'var(--font-outfit)',\n baseFontSize: '16px',\n lineHeight: '1.6',\n fontWeights: {\n normal: '400',\n medium: '500',\n semibold: '600',\n bold: '700',\n },\n letterSpacing: {\n tight: '-0.01em',\n normal: '0',\n wide: '0.025em',\n },\n },\n },\n {\n name: 'dealership',\n label: 'Dealership',\n borderRadius: 'medium',\n preview: {\n colors: {\n primary: '#1a2f50',\n background: '#f9fafb',\n accent: '#3b9ad6',\n },\n },\n lightMode: {\n background: '#f9fafb',\n foreground: '#1f2937',\n card: '#ffffff',\n cardForeground: '#1f2937',\n popover: '#ffffff',\n popoverForeground: '#1f2937',\n primary: '#1a2f50',\n primaryForeground: '#ffffff',\n secondary: '#e6ebf0',\n secondaryForeground: '#1f2937',\n muted: '#e6ebf0',\n mutedForeground: '#6b7280',\n accent: '#3b9ad6',\n accentForeground: '#ffffff',\n destructive: '#bc3535',\n destructiveForeground: '#ffffff',\n border: '#d1d5db',\n input: '#d1d5db',\n ring: '#1a2f50',\n },\n darkMode: {\n background: '#111827',\n foreground: '#f3f4f6',\n card: '#1f2937',\n cardForeground: '#f3f4f6',\n popover: '#1f2937',\n popoverForeground: '#f3f4f6',\n primary: '#3b82f6',\n primaryForeground: '#ffffff',\n secondary: '#374151',\n secondaryForeground: '#f3f4f6',\n muted: '#374151',\n mutedForeground: '#9ca3af',\n accent: '#60a5fa',\n accentForeground: '#111827',\n destructive: '#ef4444',\n destructiveForeground: '#ffffff',\n border: '#4b5563',\n input: '#4b5563',\n ring: '#3b82f6',\n },\n typography: {\n fontFamily: 'var(--font-geist-sans)',\n headingFamily: 'var(--font-outfit)',\n baseFontSize: '16px',\n lineHeight: '1.6',\n fontWeights: {\n normal: '400',\n medium: '500',\n semibold: '600',\n bold: '700',\n },\n letterSpacing: {\n tight: '-0.01em',\n normal: '0.01em',\n wide: '0.05em',\n },\n },\n },\n {\n name: 'real-estate',\n label: 'Real Estate Blue',\n borderRadius: 'large',\n preview: {\n colors: {\n primary: '#1e40af',\n background: '#fafbff',\n accent: '#3b9ad6',\n },\n },\n lightMode: {\n background: '#fafbff',\n foreground: '#1e293b',\n card: '#ffffff',\n cardForeground: '#1e293b',\n popover: '#ffffff',\n popoverForeground: '#1e293b',\n primary: '#1e40af',\n primaryForeground: '#ffffff',\n secondary: '#e0ecff',\n secondaryForeground: '#1e293b',\n muted: '#f1f5f9',\n mutedForeground: '#64748b',\n accent: '#3b9ad6',\n accentForeground: '#ffffff',\n destructive: '#dc2626',\n destructiveForeground: '#ffffff',\n border: '#cbd5e1',\n input: '#f1f5f9',\n ring: '#1e40af',\n },\n darkMode: {\n background: '#0f172a',\n foreground: '#f1f5f9',\n card: '#1e293b',\n cardForeground: '#f1f5f9',\n popover: '#1e293b',\n popoverForeground: '#f1f5f9',\n primary: '#3b82f6',\n primaryForeground: '#ffffff',\n secondary: '#334155',\n secondaryForeground: '#f1f5f9',\n muted: '#334155',\n mutedForeground: '#94a3b8',\n accent: '#60a5fa',\n accentForeground: '#0f172a',\n destructive: '#ef4444',\n destructiveForeground: '#ffffff',\n border: '#475569',\n input: '#334155',\n ring: '#3b82f6',\n },\n typography: {\n fontFamily: 'var(--font-geist-sans)',\n headingFamily: 'var(--font-outfit)',\n baseFontSize: '16px',\n lineHeight: '1.75',\n fontWeights: {\n light: '300',\n normal: '400',\n medium: '500',\n semibold: '600',\n bold: '700',\n black: '900',\n },\n letterSpacing: {\n tight: '-0.02em',\n normal: '0',\n wide: '0.025em',\n wider: '0.05em',\n },\n },\n },\n {\n name: 'real-estate-gold',\n label: 'Real Estate Gold',\n borderRadius: 'large',\n preview: {\n colors: {\n primary: '#b8860b',\n background: '#fffbf0',\n accent: '#f5d547',\n },\n },\n lightMode: {\n background: '#fffbf0',\n foreground: '#302618',\n card: '#ffffff',\n cardForeground: '#302618',\n popover: '#ffffff',\n popoverForeground: '#302618',\n primary: '#b8860b',\n primaryForeground: '#fffbf0',\n secondary: '#f7eed6',\n secondaryForeground: '#302618',\n muted: '#f3e9d8',\n mutedForeground: '#6d5d47',\n accent: '#f5d547',\n accentForeground: '#302618',\n destructive: '#dc2f2f',\n destructiveForeground: '#ffffff',\n border: '#e5d9c0',\n input: '#f3e9d8',\n ring: '#b8860b',\n },\n darkMode: {\n background: '#1a1510',\n foreground: '#f5f0e6',\n card: '#262014',\n cardForeground: '#f5f0e6',\n popover: '#262014',\n popoverForeground: '#f5f0e6',\n primary: '#daa520',\n primaryForeground: '#1a1510',\n secondary: '#3d3426',\n secondaryForeground: '#f5f0e6',\n muted: '#3d3426',\n mutedForeground: '#b8a68f',\n accent: '#ffd700',\n accentForeground: '#1a1510',\n destructive: '#ef4444',\n destructiveForeground: '#ffffff',\n border: '#554729',\n input: '#3d3426',\n ring: '#daa520',\n },\n typography: {\n fontFamily: 'var(--font-geist-sans)',\n headingFamily: 'var(--font-outfit)',\n baseFontSize: '16px',\n lineHeight: '1.75',\n fontWeights: {\n light: '300',\n normal: '400',\n medium: '500',\n semibold: '600',\n bold: '700',\n black: '900',\n },\n letterSpacing: {\n tight: '-0.02em',\n normal: '0',\n wide: '0.025em',\n wider: '0.05em',\n },\n },\n },\n {\n name: 'real-estate-neutral',\n label: 'Real Estate Neutral',\n borderRadius: 'large',\n preview: {\n colors: {\n primary: '#57534e',\n background: '#fafaf9',\n accent: '#78716c',\n },\n },\n lightMode: {\n background: '#fafaf9',\n foreground: '#292524',\n card: '#ffffff',\n cardForeground: '#292524',\n popover: '#ffffff',\n popoverForeground: '#292524',\n primary: '#57534e',\n primaryForeground: '#ffffff',\n secondary: '#e7e5e4',\n secondaryForeground: '#292524',\n muted: '#f5f5f4',\n mutedForeground: '#78716c',\n accent: '#78716c',\n accentForeground: '#ffffff',\n destructive: '#dc2626',\n destructiveForeground: '#ffffff',\n border: '#d6d3d1',\n input: '#f5f5f4',\n ring: '#57534e',\n },\n darkMode: {\n background: '#1c1917',\n foreground: '#fafaf9',\n card: '#292524',\n cardForeground: '#fafaf9',\n popover: '#292524',\n popoverForeground: '#fafaf9',\n primary: '#78716c',\n primaryForeground: '#ffffff',\n secondary: '#44403c',\n secondaryForeground: '#fafaf9',\n muted: '#44403c',\n mutedForeground: '#a8a29e',\n accent: '#a8a29e',\n accentForeground: '#1c1917',\n destructive: '#ef4444',\n destructiveForeground: '#ffffff',\n border: '#57534e',\n input: '#44403c',\n ring: '#78716c',\n },\n typography: {\n fontFamily: 'var(--font-geist-sans)',\n headingFamily: 'var(--font-outfit)',\n baseFontSize: '16px',\n lineHeight: '1.75',\n fontWeights: {\n light: '300',\n normal: '400',\n medium: '500',\n semibold: '600',\n bold: '700',\n black: '900',\n },\n letterSpacing: {\n tight: '-0.02em',\n normal: '0',\n wide: '0.025em',\n wider: '0.05em',\n },\n },\n },\n]\n"],"names":["defaultThemePresets","name","label","borderRadius","preview","colors","primary","background","accent","lightMode","foreground","card","cardForeground","popover","popoverForeground","primaryForeground","secondary","secondaryForeground","muted","mutedForeground","accentForeground","destructive","destructiveForeground","border","input","ring","darkMode","typography","fontFamily","headingFamily","baseFontSize","lineHeight","fontWeights","normal","medium","semibold","bold","letterSpacing","tight","wide","light","black","wider"],"mappings":"AA2CA,OAAO,MAAMA,sBAAqC;IAChD;QACEC,MAAM;QACNC,OAAO;QACPC,cAAc;QACdC,SAAS;YACPC,QAAQ;gBACNC,SAAS;gBACTC,YAAY;gBACZC,QAAQ;YACV;QACF;QACAC,WAAW;YACTF,YAAY;YACZG,YAAY;YACZC,MAAM;YACNC,gBAAgB;YAChBC,SAAS;YACTC,mBAAmB;YACnBR,SA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nBC,WAAW;YACXC,qBAAqB;YACrBC,OAAO;YACPC,iBAAiB;YACjBX,QAAQ;YACRY,kBAAkB;YAClBC,aAAa;YACbC,uBAAuB;YACvBC,QAAQ;YACRC,OAAO;YACPC,MAAM;QACR;QACAC,UAAU;YACRnB,YAAY;YACZG,YAAY;YACZC,MAAM;YACNC,gBAAgB;YAChBC,SAAS;YACTC,mBAAmB;YACnBR,SAAS;YACTS,mBAAmB;YACnBC,WAAW;YACXC,qBAAqB;YACrBC,OAAO;YACPC,iBAAiB;YACjBX,QAAQ;YACRY,kBAAkB;YAClBC,aAAa;YACbC,uBAAuB;YACvBC,QAAQ;YACRC,OAAO;YACPC,MAAM;QACR;QACAE,YAAY;YACVC,YAAY;YACZC,eAAe;YACfC,cAAc;YACdC,YAAY;YACZC,aAAa;gBACXQ,OAAO;gBACPP,QAAQ;gBACRC,QAAQ;gBACRC,UAAU;gBACVC,MAAM;gBACNK,OAAO;YACT;YACAJ,eAAe;gBACbC,OAAO;gBACPL,QAAQ;gBACRM,MAAM;gBACNG,OAAO;YACT;QACF;IACF;CACD,CAAA"}
|
|
1
|
+
{"version":3,"sources":["../src/presets.ts"],"sourcesContent":["export interface ThemeTypographyPreset {\r\n fontFamily: string\r\n headingFamily: string\r\n baseFontSize: string\r\n lineHeight: string\r\n fontWeights: {\r\n light?: string\r\n normal?: string\r\n medium?: string\r\n semibold?: string\r\n bold?: string\r\n black?: string\r\n }\r\n letterSpacing: {\r\n tight?: string\r\n normal?: string\r\n wide?: string\r\n wider?: string\r\n }\r\n}\r\n\r\nexport interface ThemePreset {\r\n name: string\r\n label: string\r\n borderRadius: 'none' | 'small' | 'medium' | 'large' | 'xl'\r\n cssFile?: string\r\n preview?: {\r\n colors: {\r\n primary: string\r\n background: string\r\n accent: string\r\n }\r\n }\r\n theme?: string\r\n colorMode?: 'auto' | 'light' | 'dark'\r\n fontScale?: 'small' | 'medium' | 'large'\r\n spacing?: 'small' | 'medium' | 'large'\r\n animationLevel?: 'low' | 'medium' | 'high'\r\n lightMode?: Record<string, string>\r\n darkMode?: Record<string, string>\r\n typography?: ThemeTypographyPreset\r\n}\r\n\r\nexport const defaultThemePresets: ThemePreset[] = [\r\n {\r\n name: 'cool',\r\n label: 'Cool & Professional',\r\n borderRadius: 'medium',\r\n preview: {\r\n colors: {\r\n primary: '#3b82f6',\r\n background: '#ffffff',\r\n accent: '#f1f5f9',\r\n },\r\n },\r\n lightMode: {\r\n background: '#ffffff',\r\n foreground: '#0a0a0a',\r\n card: '#ffffff',\r\n cardForeground: '#0a0a0a',\r\n popover: '#ffffff',\r\n popoverForeground: '#0a0a0a',\r\n primary: '#3b82f6',\r\n primaryForeground: '#ffffff',\r\n secondary: '#f1f5f9',\r\n secondaryForeground: '#0f172a',\r\n muted: '#f1f5f9',\r\n mutedForeground: '#64748b',\r\n accent: '#f1f5f9',\r\n accentForeground: '#0f172a',\r\n destructive: '#ef4444',\r\n destructiveForeground: '#ffffff',\r\n border: '#e2e8f0',\r\n input: '#e2e8f0',\r\n ring: '#3b82f6',\r\n },\r\n darkMode: {\r\n background: '#0a0a0a',\r\n foreground: '#fafafa',\r\n card: '#1a1a1a',\r\n cardForeground: '#fafafa',\r\n popover: '#1a1a1a',\r\n popoverForeground: '#fafafa',\r\n primary: '#60a5fa',\r\n primaryForeground: '#0a0a0a',\r\n secondary: '#27272a',\r\n secondaryForeground: '#fafafa',\r\n muted: '#27272a',\r\n mutedForeground: '#a1a1aa',\r\n accent: '#27272a',\r\n accentForeground: '#fafafa',\r\n destructive: '#f87171',\r\n destructiveForeground: '#0a0a0a',\r\n border: '#27272a',\r\n input: '#27272a',\r\n ring: '#60a5fa',\r\n },\r\n typography: {\r\n fontFamily: 'var(--font-geist-sans)',\r\n headingFamily: 'var(--font-outfit)',\r\n baseFontSize: '16px',\r\n lineHeight: '1.6',\r\n fontWeights: {\r\n normal: '400',\r\n medium: '500',\r\n semibold: '600',\r\n bold: '700',\r\n },\r\n letterSpacing: {\r\n tight: '-0.02em',\r\n normal: '0',\r\n wide: '0.02em',\r\n },\r\n },\r\n },\r\n {\r\n name: 'brutal',\r\n label: 'Modern Brutalism',\r\n borderRadius: 'none',\r\n preview: {\r\n colors: {\r\n primary: '#000000',\r\n background: '#ffffff',\r\n accent: '#ef4444',\r\n },\r\n },\r\n lightMode: {\r\n background: '#ffffff',\r\n foreground: '#000000',\r\n card: '#ffffff',\r\n cardForeground: '#000000',\r\n popover: '#ffffff',\r\n popoverForeground: '#000000',\r\n primary: '#000000',\r\n primaryForeground: '#ffffff',\r\n secondary: '#f5f5f5',\r\n secondaryForeground: '#000000',\r\n muted: '#f5f5f5',\r\n mutedForeground: '#737373',\r\n accent: '#ef4444',\r\n accentForeground: '#ffffff',\r\n destructive: '#ef4444',\r\n destructiveForeground: '#ffffff',\r\n border: '#000000',\r\n input: '#e5e5e5',\r\n ring: '#000000',\r\n },\r\n darkMode: {\r\n background: '#000000',\r\n foreground: '#ffffff',\r\n card: '#0a0a0a',\r\n cardForeground: '#ffffff',\r\n popover: '#0a0a0a',\r\n popoverForeground: '#ffffff',\r\n primary: '#ffffff',\r\n primaryForeground: '#000000',\r\n secondary: '#262626',\r\n secondaryForeground: '#ffffff',\r\n muted: '#262626',\r\n mutedForeground: '#a3a3a3',\r\n accent: '#ef4444',\r\n accentForeground: '#ffffff',\r\n destructive: '#dc2626',\r\n destructiveForeground: '#ffffff',\r\n border: '#ffffff',\r\n input: '#262626',\r\n ring: '#ffffff',\r\n },\r\n typography: {\r\n fontFamily: 'var(--font-geist-mono)',\r\n headingFamily: 'var(--font-geist-mono)',\r\n baseFontSize: '16px',\r\n lineHeight: '1.5',\r\n fontWeights: {\r\n normal: '400',\r\n medium: '600',\r\n semibold: '700',\r\n bold: '800',\r\n },\r\n letterSpacing: {\r\n tight: '0',\r\n normal: '0.05em',\r\n wide: '0.1em',\r\n },\r\n },\r\n },\r\n {\r\n name: 'neon',\r\n label: 'Neon Cyberpunk',\r\n borderRadius: 'medium',\r\n preview: {\r\n colors: {\r\n primary: '#9333ea',\r\n background: '#0d0f1a',\r\n accent: '#00ffff',\r\n },\r\n },\r\n lightMode: {\r\n background: '#0d0f1a',\r\n foreground: '#ffffff',\r\n card: '#12141f',\r\n cardForeground: '#ffffff',\r\n popover: '#12141f',\r\n popoverForeground: '#ffffff',\r\n primary: '#9333ea',\r\n primaryForeground: '#ffffff',\r\n secondary: '#1a1d2e',\r\n secondaryForeground: '#ffffff',\r\n muted: '#1a1d2e',\r\n mutedForeground: '#b3b3cc',\r\n accent: '#00ffff',\r\n accentForeground: '#0d0f1a',\r\n destructive: '#ff0000',\r\n destructiveForeground: '#ffffff',\r\n border: '#2d3348',\r\n input: '#2d3348',\r\n ring: '#9333ea',\r\n },\r\n darkMode: {\r\n background: '#0d0f1a',\r\n foreground: '#ffffff',\r\n card: '#12141f',\r\n cardForeground: '#ffffff',\r\n popover: '#12141f',\r\n popoverForeground: '#ffffff',\r\n primary: '#9333ea',\r\n primaryForeground: '#ffffff',\r\n secondary: '#1a1d2e',\r\n secondaryForeground: '#ffffff',\r\n muted: '#1a1d2e',\r\n mutedForeground: '#b3b3cc',\r\n accent: '#00ffff',\r\n accentForeground: '#0d0f1a',\r\n destructive: '#ff0000',\r\n destructiveForeground: '#0d0f1a',\r\n border: '#2d3348',\r\n input: '#2d3348',\r\n ring: '#9333ea',\r\n },\r\n typography: {\r\n fontFamily: 'var(--font-geist-sans)',\r\n headingFamily: 'var(--font-geist-mono)',\r\n baseFontSize: '16px',\r\n lineHeight: '1.7',\r\n fontWeights: {\r\n normal: '400',\r\n medium: '500',\r\n semibold: '700',\r\n bold: '900',\r\n },\r\n letterSpacing: {\r\n tight: '0',\r\n normal: '0.05em',\r\n wide: '0.15em',\r\n },\r\n },\r\n },\r\n {\r\n name: 'solar',\r\n label: 'Solar',\r\n borderRadius: 'large',\r\n preview: {\r\n colors: {\r\n primary: '#c85a19',\r\n background: '#fffbf5',\r\n accent: '#ffcc00',\r\n },\r\n },\r\n lightMode: {\r\n background: '#fffbf5',\r\n foreground: '#2d1a09',\r\n card: '#ffffff',\r\n cardForeground: '#2d1a09',\r\n popover: '#ffffff',\r\n popoverForeground: '#2d1a09',\r\n primary: '#c85a19',\r\n primaryForeground: '#ffffff',\r\n secondary: '#fff7e6',\r\n secondaryForeground: '#2d1a09',\r\n muted: '#f5ebe0',\r\n mutedForeground: '#665544',\r\n accent: '#ffcc00',\r\n accentForeground: '#2d1a09',\r\n destructive: '#e34850',\r\n destructiveForeground: '#ffffff',\r\n border: '#e8d4c4',\r\n input: '#e8d4c4',\r\n ring: '#c85a19',\r\n },\r\n darkMode: {\r\n background: '#1f1610',\r\n foreground: '#f0dcc7',\r\n card: '#271c15',\r\n cardForeground: '#f0dcc7',\r\n popover: '#271c15',\r\n popoverForeground: '#f0dcc7',\r\n primary: '#e37a3d',\r\n primaryForeground: '#ffffff',\r\n secondary: '#3d2f26',\r\n secondaryForeground: '#f0dcc7',\r\n muted: '#3d2f26',\r\n mutedForeground: '#ccb8a6',\r\n accent: '#ffd633',\r\n accentForeground: '#1f1610',\r\n destructive: '#993438',\r\n destructiveForeground: '#ffffff',\r\n border: '#453828',\r\n input: '#453828',\r\n ring: '#e37a3d',\r\n },\r\n typography: {\r\n fontFamily: 'var(--font-geist-sans)',\r\n headingFamily: 'var(--font-outfit)',\r\n baseFontSize: '16px',\r\n lineHeight: '1.6',\r\n fontWeights: {\r\n normal: '400',\r\n medium: '500',\r\n semibold: '600',\r\n bold: '700',\r\n },\r\n letterSpacing: {\r\n tight: '-0.01em',\r\n normal: '0',\r\n wide: '0.025em',\r\n },\r\n },\r\n },\r\n {\r\n name: 'dealership',\r\n label: 'Dealership',\r\n borderRadius: 'medium',\r\n preview: {\r\n colors: {\r\n primary: '#1a2f50',\r\n background: '#f9fafb',\r\n accent: '#3b9ad6',\r\n },\r\n },\r\n lightMode: {\r\n background: '#f9fafb',\r\n foreground: '#1f2937',\r\n card: '#ffffff',\r\n cardForeground: '#1f2937',\r\n popover: '#ffffff',\r\n popoverForeground: '#1f2937',\r\n primary: '#1a2f50',\r\n primaryForeground: '#ffffff',\r\n secondary: '#e6ebf0',\r\n secondaryForeground: '#1f2937',\r\n muted: '#e6ebf0',\r\n mutedForeground: '#6b7280',\r\n accent: '#3b9ad6',\r\n accentForeground: '#ffffff',\r\n destructive: '#bc3535',\r\n destructiveForeground: '#ffffff',\r\n border: '#d1d5db',\r\n input: '#d1d5db',\r\n ring: '#1a2f50',\r\n },\r\n darkMode: {\r\n background: '#111827',\r\n foreground: '#f3f4f6',\r\n card: '#1f2937',\r\n cardForeground: '#f3f4f6',\r\n popover: '#1f2937',\r\n popoverForeground: '#f3f4f6',\r\n primary: '#3b82f6',\r\n primaryForeground: '#ffffff',\r\n secondary: '#374151',\r\n secondaryForeground: '#f3f4f6',\r\n muted: '#374151',\r\n mutedForeground: '#9ca3af',\r\n accent: '#60a5fa',\r\n accentForeground: '#111827',\r\n destructive: '#ef4444',\r\n destructiveForeground: '#ffffff',\r\n border: '#4b5563',\r\n input: '#4b5563',\r\n ring: '#3b82f6',\r\n },\r\n typography: {\r\n fontFamily: 'var(--font-geist-sans)',\r\n headingFamily: 'var(--font-outfit)',\r\n baseFontSize: '16px',\r\n lineHeight: '1.6',\r\n fontWeights: {\r\n normal: '400',\r\n medium: '500',\r\n semibold: '600',\r\n bold: '700',\r\n },\r\n letterSpacing: {\r\n tight: '-0.01em',\r\n normal: '0.01em',\r\n wide: '0.05em',\r\n },\r\n },\r\n },\r\n {\r\n name: 'real-estate',\r\n label: 'Real Estate Blue',\r\n borderRadius: 'large',\r\n preview: {\r\n colors: {\r\n primary: '#1e40af',\r\n background: '#fafbff',\r\n accent: '#3b9ad6',\r\n },\r\n },\r\n lightMode: {\r\n background: '#fafbff',\r\n foreground: '#1e293b',\r\n card: '#ffffff',\r\n cardForeground: '#1e293b',\r\n popover: '#ffffff',\r\n popoverForeground: '#1e293b',\r\n primary: '#1e40af',\r\n primaryForeground: '#ffffff',\r\n secondary: '#e0ecff',\r\n secondaryForeground: '#1e293b',\r\n muted: '#f1f5f9',\r\n mutedForeground: '#64748b',\r\n accent: '#3b9ad6',\r\n accentForeground: '#ffffff',\r\n destructive: '#dc2626',\r\n destructiveForeground: '#ffffff',\r\n border: '#cbd5e1',\r\n input: '#f1f5f9',\r\n ring: '#1e40af',\r\n },\r\n darkMode: {\r\n background: '#0f172a',\r\n foreground: '#f1f5f9',\r\n card: '#1e293b',\r\n cardForeground: '#f1f5f9',\r\n popover: '#1e293b',\r\n popoverForeground: '#f1f5f9',\r\n primary: '#3b82f6',\r\n primaryForeground: '#ffffff',\r\n secondary: '#334155',\r\n secondaryForeground: '#f1f5f9',\r\n muted: '#334155',\r\n mutedForeground: '#94a3b8',\r\n accent: '#60a5fa',\r\n accentForeground: '#0f172a',\r\n destructive: '#ef4444',\r\n destructiveForeground: '#ffffff',\r\n border: '#475569',\r\n input: '#334155',\r\n ring: '#3b82f6',\r\n },\r\n typography: {\r\n fontFamily: 'var(--font-geist-sans)',\r\n headingFamily: 'var(--font-outfit)',\r\n baseFontSize: '16px',\r\n lineHeight: '1.75',\r\n fontWeights: {\r\n light: '300',\r\n normal: '400',\r\n medium: '500',\r\n semibold: '600',\r\n bold: '700',\r\n black: '900',\r\n },\r\n letterSpacing: {\r\n tight: '-0.02em',\r\n normal: '0',\r\n wide: '0.025em',\r\n wider: '0.05em',\r\n },\r\n },\r\n },\r\n {\r\n name: 'real-estate-gold',\r\n label: 'Real Estate Gold',\r\n borderRadius: 'large',\r\n preview: {\r\n colors: {\r\n primary: '#b8860b',\r\n background: '#fffbf0',\r\n accent: '#f5d547',\r\n },\r\n },\r\n lightMode: {\r\n background: '#fffbf0',\r\n foreground: '#302618',\r\n card: '#ffffff',\r\n cardForeground: '#302618',\r\n popover: '#ffffff',\r\n popoverForeground: '#302618',\r\n primary: '#b8860b',\r\n primaryForeground: '#fffbf0',\r\n secondary: '#f7eed6',\r\n secondaryForeground: '#302618',\r\n muted: '#f3e9d8',\r\n mutedForeground: '#6d5d47',\r\n accent: '#f5d547',\r\n accentForeground: '#302618',\r\n destructive: '#dc2f2f',\r\n destructiveForeground: '#ffffff',\r\n border: '#e5d9c0',\r\n input: '#f3e9d8',\r\n ring: '#b8860b',\r\n },\r\n darkMode: {\r\n background: '#1a1510',\r\n foreground: '#f5f0e6',\r\n card: '#262014',\r\n cardForeground: '#f5f0e6',\r\n popover: '#262014',\r\n popoverForeground: '#f5f0e6',\r\n primary: '#daa520',\r\n primaryForeground: '#1a1510',\r\n secondary: '#3d3426',\r\n secondaryForeground: '#f5f0e6',\r\n muted: '#3d3426',\r\n mutedForeground: '#b8a68f',\r\n accent: '#ffd700',\r\n accentForeground: '#1a1510',\r\n destructive: '#ef4444',\r\n destructiveForeground: '#ffffff',\r\n border: '#554729',\r\n input: '#3d3426',\r\n ring: '#daa520',\r\n },\r\n typography: {\r\n fontFamily: 'var(--font-geist-sans)',\r\n headingFamily: 'var(--font-outfit)',\r\n baseFontSize: '16px',\r\n lineHeight: '1.75',\r\n fontWeights: {\r\n light: '300',\r\n normal: '400',\r\n medium: '500',\r\n semibold: '600',\r\n bold: '700',\r\n black: '900',\r\n },\r\n letterSpacing: {\r\n tight: '-0.02em',\r\n normal: '0',\r\n wide: '0.025em',\r\n wider: '0.05em',\r\n },\r\n },\r\n },\r\n {\r\n name: 'real-estate-neutral',\r\n label: 'Real Estate Neutral',\r\n borderRadius: 'large',\r\n preview: {\r\n colors: {\r\n primary: '#57534e',\r\n background: '#fafaf9',\r\n accent: '#78716c',\r\n },\r\n },\r\n lightMode: {\r\n background: '#fafaf9',\r\n foreground: '#292524',\r\n card: '#ffffff',\r\n cardForeground: '#292524',\r\n popover: '#ffffff',\r\n popoverForeground: '#292524',\r\n primary: '#57534e',\r\n primaryForeground: '#ffffff',\r\n secondary: '#e7e5e4',\r\n secondaryForeground: '#292524',\r\n muted: '#f5f5f4',\r\n mutedForeground: '#78716c',\r\n accent: '#78716c',\r\n accentForeground: '#ffffff',\r\n destructive: '#dc2626',\r\n destructiveForeground: '#ffffff',\r\n border: '#d6d3d1',\r\n input: '#f5f5f4',\r\n ring: '#57534e',\r\n },\r\n darkMode: {\r\n background: '#1c1917',\r\n foreground: '#fafaf9',\r\n card: '#292524',\r\n cardForeground: '#fafaf9',\r\n popover: '#292524',\r\n popoverForeground: '#fafaf9',\r\n primary: '#78716c',\r\n primaryForeground: '#ffffff',\r\n secondary: '#44403c',\r\n secondaryForeground: '#fafaf9',\r\n muted: '#44403c',\r\n mutedForeground: '#a8a29e',\r\n accent: '#a8a29e',\r\n accentForeground: '#1c1917',\r\n destructive: '#ef4444',\r\n destructiveForeground: '#ffffff',\r\n border: '#57534e',\r\n input: '#44403c',\r\n ring: '#78716c',\r\n },\r\n typography: {\r\n fontFamily: 'var(--font-geist-sans)',\r\n headingFamily: 'var(--font-outfit)',\r\n baseFontSize: '16px',\r\n lineHeight: '1.75',\r\n fontWeights: {\r\n light: '300',\r\n normal: '400',\r\n medium: '500',\r\n semibold: '600',\r\n bold: '700',\r\n black: '900',\r\n },\r\n letterSpacing: {\r\n tight: '-0.02em',\r\n normal: '0',\r\n wide: '0.025em',\r\n wider: '0.05em',\r\n },\r\n },\r\n },\r\n]\r\n"],"names":["defaultThemePresets","name","label","borderRadius","preview","colors","primary","background","accent","lightMode","foreground","card","cardForeground","popover","popoverForeground","primaryForeground","secondary","secondaryForeground","muted","mutedForeground","accentForeground","destructive","destructiveForeground","border","input","ring","darkMode","typography","fontFamily","headingFamily","baseFontSize","lineHeight","fontWeights","normal","medium","semibold","bold","letterSpacing","tight","wide","light","black","wider"],"mappings":"AA2CA,OAAO,MAAMA,sBAAqC;IAChD;QACEC,MAAM;QACNC,OAAO;QACPC,cAAc;QACdC,SAAS;YACPC,QAAQ;gBACNC,SAAS;gBACTC,YAAY;gBACZC,QAAQ;YACV;QACF;QACAC,WAAW;YACTF,YAAY;YACZG,YAAY;YACZC,MAAM;YACNC,gBAAgB;YAChBC,SAAS;YACTC,mBAAmB;YACnBR,SAAS;YACTS,mBAA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C,qBAAqB;YACrBC,OAAO;YACPC,iBAAiB;YACjBX,QAAQ;YACRY,kBAAkB;YAClBC,aAAa;YACbC,uBAAuB;YACvBC,QAAQ;YACRC,OAAO;YACPC,MAAM;QACR;QACAC,UAAU;YACRnB,YAAY;YACZG,YAAY;YACZC,MAAM;YACNC,gBAAgB;YAChBC,SAAS;YACTC,mBAAmB;YACnBR,SAAS;YACTS,mBAAmB;YACnBC,WAAW;YACXC,qBAAqB;YACrBC,OAAO;YACPC,iBAAiB;YACjBX,QAAQ;YACRY,kBAAkB;YAClBC,aAAa;YACbC,uBAAuB;YACvBC,QAAQ;YACRC,OAAO;YACPC,MAAM;QACR;QACAE,YAAY;YACVC,YAAY;YACZC,eAAe;YACfC,cAAc;YACdC,YAAY;YACZC,aAAa;gBACXQ,OAAO;gBACPP,QAAQ;gBACRC,QAAQ;gBACRC,UAAU;gBACVC,MAAM;gBACNK,OAAO;YACT;YACAJ,eAAe;gBACbC,OAAO;gBACPL,QAAQ;gBACRM,MAAM;gBACNG,OAAO;YACT;QACF;IACF;CACD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/providers/Theme/index.tsx"],"sourcesContent":["'use client'\n\nimport React, { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react'\nimport { defaultMode, modeLocalStorageKey } from './shared.js'\nimport type { Mode, ThemeContextType, ThemeDefaults } from './types.js'\n\nconst ThemeContext = createContext<ThemeContextType | undefined>(undefined)\n\nexport const useTheme = (): ThemeContextType => {\n const context = useContext(ThemeContext)\n if (!context) {\n throw new Error('useTheme must be used within a ThemeProvider')\n }\n return context\n}\n\ninterface ThemeProviderProps {\n children: React.ReactNode\n initialTheme?: ThemeDefaults\n initialMode?: Mode\n allowColorModeToggle?: boolean\n}\n\nexport const ThemeProvider: React.FC<ThemeProviderProps> = ({\n children,\n initialTheme,\n initialMode,\n allowColorModeToggle = true,\n}) => {\n // State pro light/dark mode switching\n const [mode, setMode] = useState<Mode | null>(initialMode || defaultMode)\n const [theme] = useState<ThemeDefaults | null>(initialTheme || null)\n\n // Funkce pro získání skutečného módu (resolve \"auto\" mode)\n const getResolvedMode = useCallback((currentMode: Mode | null): 'light' | 'dark' => {\n if (currentMode === 'auto' && typeof window !== 'undefined') {\n const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)')\n return mediaQuery.matches ? 'dark' : 'light'\n }\n return currentMode === 'dark' ? 'dark' : 'light'\n }, [])\n\n // Aplikace módu na DOM a CSS variables\n const applyMode = useCallback(\n (currentMode: Mode | null) => {\n if (typeof window !== 'undefined') {\n const resolvedMode = getResolvedMode(currentMode)\n\n // Získej aktuální theme z DOM nebo použij fallback\n const currentTheme =\n document.documentElement.getAttribute('data-theme') ||\n (typeof theme === 'string' ? theme : 'cool')\n\n // Aplikuj data atributy a třídy (kompatibilní s CSS selektory)\n document.documentElement.setAttribute('data-color-mode', resolvedMode)\n document.documentElement.setAttribute('data-theme-mode', resolvedMode)\n document.documentElement.setAttribute('data-theme', currentTheme)\n document.documentElement.classList.remove('light', 'dark', 'auto')\n document.documentElement.classList.add(resolvedMode)\n\n // Force re-computation of CSS custom properties\n document.documentElement.style.setProperty('--color-mode', resolvedMode)\n\n // Force repaint to ensure CSS variables update\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n document.documentElement.offsetHeight\n\n // Dispatch custom event for components that need to react to theme changes\n window.dispatchEvent(\n new CustomEvent('themeChange', {\n detail: { mode: resolvedMode, originalMode: currentMode, theme: currentTheme },\n }),\n )\n }\n },\n [getResolvedMode, theme],\n )\n\n // Uložení light/dark mode do localStorage a aplikace\n const updateMode = useCallback(\n (newMode: Mode | null) => {\n setMode(newMode)\n if (newMode && typeof window !== 'undefined') {\n localStorage.setItem(modeLocalStorageKey, newMode)\n applyMode(newMode)\n }\n },\n [applyMode],\n )\n\n // Načtení mode z localStorage při startu\n useEffect(() => {\n if (typeof window !== 'undefined') {\n const storedMode = localStorage.getItem(modeLocalStorageKey) as Mode | null\n if (storedMode && ['light', 'dark', 'auto'].includes(storedMode)) {\n setMode(storedMode)\n applyMode(storedMode)\n } else {\n // Fallback na default mode\n applyMode(defaultMode)\n }\n }\n }, [applyMode])\n\n // Listener pro změny system preference (pouze při auto mode)\n useEffect(() => {\n if (mode === 'auto' && typeof window !== 'undefined') {\n const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)')\n\n const handleChange = () => {\n applyMode('auto') // Re-resolve auto mode\n }\n\n mediaQuery.addEventListener('change', handleChange)\n\n return () => {\n mediaQuery.removeEventListener('change', handleChange)\n }\n }\n }, [mode, applyMode])\n\n const refreshTheme = useCallback(() => {\n // Refresh theme - aplikuj aktuální mode\n applyMode(mode)\n }, [mode, applyMode])\n\n const contextValue = useMemo(\n () => ({\n theme,\n mode,\n setTheme: () => {}, // Nepoužíváme - theme se nastavuje přes SSR\n setMode: updateMode,\n isColorModeToggleAllowed: allowColorModeToggle,\n refreshTheme,\n }),\n [theme, mode, updateMode, allowColorModeToggle, refreshTheme],\n )\n\n return <ThemeContext.Provider value={contextValue}>{children}</ThemeContext.Provider>\n}\n"],"names":["React","createContext","useCallback","useContext","useEffect","useMemo","useState","defaultMode","modeLocalStorageKey","ThemeContext","undefined","useTheme","context","Error","ThemeProvider","children","initialTheme","initialMode","allowColorModeToggle","mode","setMode","theme","getResolvedMode","currentMode","window","mediaQuery","matchMedia","matches","applyMode","resolvedMode","currentTheme","document","documentElement","getAttribute","setAttribute","classList","remove","add","style","setProperty","offsetHeight","dispatchEvent","CustomEvent","detail","originalMode","updateMode","newMode","localStorage","setItem","storedMode","getItem","includes","handleChange","addEventListener","removeEventListener","refreshTheme","contextValue","setTheme","isColorModeToggleAllowed","Provider","value"],"mappings":"AAAA;;AAEA,OAAOA,SAASC,aAAa,EAAEC,WAAW,EAAEC,UAAU,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAO;AACnG,SAASC,WAAW,EAAEC,mBAAmB,QAAQ,cAAa;AAG9D,MAAMC,6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AAsBqC;KAAa;IAG/D,qBAAO,KAAC9C,aAAakD,QAAQ;QAACC,OAAOJ;kBAAezC;;AACtD,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/providers/Theme/index.tsx"],"sourcesContent":["'use client'\r\n\r\nimport React, { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react'\r\nimport { defaultMode, modeLocalStorageKey } from './shared.js'\r\nimport type { Mode, ThemeContextType, ThemeDefaults } from './types.js'\r\n\r\nconst ThemeContext = createContext<ThemeContextType | undefined>(undefined)\r\n\r\nexport const useTheme = (): ThemeContextType => {\r\n const context = useContext(ThemeContext)\r\n if (!context) {\r\n throw new Error('useTheme must be used within a ThemeProvider')\r\n }\r\n return context\r\n}\r\n\r\ninterface ThemeProviderProps {\r\n children: React.ReactNode\r\n initialTheme?: ThemeDefaults\r\n initialMode?: Mode\r\n allowColorModeToggle?: boolean\r\n}\r\n\r\nexport const ThemeProvider: React.FC<ThemeProviderProps> = ({\r\n children,\r\n initialTheme,\r\n initialMode,\r\n allowColorModeToggle = true,\r\n}) => {\r\n // State pro light/dark mode switching\r\n const [mode, setMode] = useState<Mode | null>(initialMode || defaultMode)\r\n const [theme] = useState<ThemeDefaults | null>(initialTheme || null)\r\n\r\n // Funkce pro získání skutečného módu (resolve \"auto\" mode)\r\n const getResolvedMode = useCallback((currentMode: Mode | null): 'light' | 'dark' => {\r\n if (currentMode === 'auto' && typeof window !== 'undefined') {\r\n const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)')\r\n return mediaQuery.matches ? 'dark' : 'light'\r\n }\r\n return currentMode === 'dark' ? 'dark' : 'light'\r\n }, [])\r\n\r\n // Aplikace módu na DOM a CSS variables\r\n const applyMode = useCallback(\r\n (currentMode: Mode | null) => {\r\n if (typeof window !== 'undefined') {\r\n const resolvedMode = getResolvedMode(currentMode)\r\n\r\n // Získej aktuální theme z DOM nebo použij fallback\r\n const currentTheme =\r\n document.documentElement.getAttribute('data-theme') ||\r\n (typeof theme === 'string' ? theme : 'cool')\r\n\r\n // Aplikuj data atributy a třídy (kompatibilní s CSS selektory)\r\n document.documentElement.setAttribute('data-color-mode', resolvedMode)\r\n document.documentElement.setAttribute('data-theme-mode', resolvedMode)\r\n document.documentElement.setAttribute('data-theme', currentTheme)\r\n document.documentElement.classList.remove('light', 'dark', 'auto')\r\n document.documentElement.classList.add(resolvedMode)\r\n\r\n // Force re-computation of CSS custom properties\r\n document.documentElement.style.setProperty('--color-mode', resolvedMode)\r\n\r\n // Force repaint to ensure CSS variables update\r\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\r\n document.documentElement.offsetHeight\r\n\r\n // Dispatch custom event for components that need to react to theme changes\r\n window.dispatchEvent(\r\n new CustomEvent('themeChange', {\r\n detail: { mode: resolvedMode, originalMode: currentMode, theme: currentTheme },\r\n }),\r\n )\r\n }\r\n },\r\n [getResolvedMode, theme],\r\n )\r\n\r\n // Uložení light/dark mode do localStorage a aplikace\r\n const updateMode = useCallback(\r\n (newMode: Mode | null) => {\r\n setMode(newMode)\r\n if (newMode && typeof window !== 'undefined') {\r\n localStorage.setItem(modeLocalStorageKey, newMode)\r\n applyMode(newMode)\r\n }\r\n },\r\n [applyMode],\r\n )\r\n\r\n // Načtení mode z localStorage při startu\r\n useEffect(() => {\r\n if (typeof window !== 'undefined') {\r\n const storedMode = localStorage.getItem(modeLocalStorageKey) as Mode | null\r\n if (storedMode && ['light', 'dark', 'auto'].includes(storedMode)) {\r\n setMode(storedMode)\r\n applyMode(storedMode)\r\n } else {\r\n // Fallback na default mode\r\n applyMode(defaultMode)\r\n }\r\n }\r\n }, [applyMode])\r\n\r\n // Listener pro změny system preference (pouze při auto mode)\r\n useEffect(() => {\r\n if (mode === 'auto' && typeof window !== 'undefined') {\r\n const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)')\r\n\r\n const handleChange = () => {\r\n applyMode('auto') // Re-resolve auto mode\r\n }\r\n\r\n mediaQuery.addEventListener('change', handleChange)\r\n\r\n return () => {\r\n mediaQuery.removeEventListener('change', handleChange)\r\n }\r\n }\r\n }, [mode, applyMode])\r\n\r\n const refreshTheme = useCallback(() => {\r\n // Refresh theme - aplikuj aktuální mode\r\n applyMode(mode)\r\n }, [mode, applyMode])\r\n\r\n const contextValue = useMemo(\r\n () => ({\r\n theme,\r\n mode,\r\n setTheme: () => {}, // Nepoužíváme - theme se nastavuje přes SSR\r\n setMode: updateMode,\r\n isColorModeToggleAllowed: allowColorModeToggle,\r\n refreshTheme,\r\n }),\r\n [theme, mode, updateMode, allowColorModeToggle, refreshTheme],\r\n )\r\n\r\n return <ThemeContext.Provider value={contextValue}>{children}</ThemeContext.Provider>\r\n}\r\n"],"names":["React","createContext","useCallback","useContext","useEffect","useMemo","useState","defaultMode","modeLocalStorageKey","ThemeContext","undefined","useTheme","context","Error","ThemeProvider","children","initialTheme","initialMode","allowColorModeToggle","mode","setMode","theme","getResolvedMode","currentMode","window","mediaQuery","matchMedia","matches","applyMode","resolvedMode","currentTheme","document","documentElement","getAttribute","setAttribute","classList","remove","add","style","setProperty","offsetHeight","dispatchEvent","CustomEvent","detail","originalMode","updateMode","newMode","localStorage","setItem","storedMode","getItem","includes","handleChange","addEventListener","removeEventListener","refreshTheme","contextValue","setTheme","isColorModeToggleAllowed","Provider","value"],"mappings":"AAAA;;AAEA,OAAOA,SAASC,aAAa,EAAEC,WAAW,EAAEC,UAAU,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAO;AACnG,SAASC,WAAW,EAAEC,mBAAmB,QAAQ,cAAa;AAG9D,MAAMC,6BAAeR,cAA4CS;AAEjE,OAAO,MAAMC,WAAW;IACtB,MAAMC,UAAUT,WAAWM;IAC3B,IAAI,CAACG,SAAS;QACZ,MAAM,IAAIC,MAAM;IAClB;IACA,OAAOD;AACT,EAAC;AASD,OAAO,MAAME,gBAA8C,CAAC,EAC1DC,QAAQ,EACRC,YAAY,EACZC,WAAW,EACXC,uBAAuB,IAAI,EAC5B;IACC,sCAAsC;I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,WAAW,OAAOtB,WAAW,aAAa;YAC5CuB,aAAaC,OAAO,CAACxC,qBAAqBsC;YAC1ClB,UAAUkB;QACZ;IACF,GACA;QAAClB;KAAU;IAGb,yCAAyC;IACzCxB,UAAU;QACR,IAAI,OAAOoB,WAAW,aAAa;YACjC,MAAMyB,aAAaF,aAAaG,OAAO,CAAC1C;YACxC,IAAIyC,cAAc;gBAAC;gBAAS;gBAAQ;aAAO,CAACE,QAAQ,CAACF,aAAa;gBAChE7B,QAAQ6B;gBACRrB,UAAUqB;YACZ,OAAO;gBACL,2BAA2B;gBAC3BrB,UAAUrB;YACZ;QACF;IACF,GAAG;QAACqB;KAAU;IAEd,6DAA6D;IAC7DxB,UAAU;QACR,IAAIe,SAAS,UAAU,OAAOK,WAAW,aAAa;YACpD,MAAMC,aAAaD,OAAOE,UAAU,CAAC;YAErC,MAAM0B,eAAe;gBACnBxB,UAAU,SAAQ,uBAAuB;YAC3C;YAEAH,WAAW4B,gBAAgB,CAAC,UAAUD;YAEtC,OAAO;gBACL3B,WAAW6B,mBAAmB,CAAC,UAAUF;YAC3C;QACF;IACF,GAAG;QAACjC;QAAMS;KAAU;IAEpB,MAAM2B,eAAerD,YAAY;QAC/B,wCAAwC;QACxC0B,UAAUT;IACZ,GAAG;QAACA;QAAMS;KAAU;IAEpB,MAAM4B,eAAenD,QACnB,IAAO,CAAA;YACLgB;YACAF;YACAsC,UAAU,KAAO;YACjBrC,SAASyB;YACTa,0BAA0BxC;YAC1BqC;QACF,CAAA,GACA;QAAClC;QAAOF;QAAM0B;QAAY3B;QAAsBqC;KAAa;IAG/D,qBAAO,KAAC9C,aAAakD,QAAQ;QAACC,OAAOJ;kBAAezC;;AACtD,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/providers/Theme/shared.ts"],"sourcesContent":["import type { Mode, ThemeOption, ThemeDefaults } from './types.js'\n\nexport const themeLocalStorageKey = 'payload-theme'\nexport const modeLocalStorageKey = 'payload-theme-mode'\n\nexport const defaultTheme = 'cool' as ThemeDefaults\nexport const defaultMode = 'auto' as Mode\n\nexport const themeOptions = [\n { label: 'Cool & Professional', value: 'cool' },\n { label: 'Modern Brutalism', value: 'brutal' },\n { label: 'Neon Cyberpunk', value: 'neon' },\n { label: 'Dealership', value: 'dealership' },\n { label: 'Solar', value: 'solar' },\n { label: 'Real Estate Blue', value: 'real-estate' },\n { label: 'Real Estate Gold', value: 'real-estate-gold' },\n { label: 'Real Estate Neutral', value: 'real-estate-neutral' },\n] as ThemeOption[]\n\nexport const getImplicitModePreference = (): Mode | null => {\n const mediaQuery = '(prefers-color-scheme: dark)'\n const mql = window.matchMedia(mediaQuery)\n const hasImplicitPreference = typeof mql.matches === 'boolean'\n\n if (hasImplicitPreference) {\n return mql.matches ? 'dark' : 'light'\n }\n\n return null\n}\n"],"names":["themeLocalStorageKey","modeLocalStorageKey","defaultTheme","defaultMode","themeOptions","label","value","getImplicitModePreference","mediaQuery","mql","window","matchMedia","hasImplicitPreference","matches"],"mappings":"AAEA,OAAO,MAAMA,uBAAuB,gBAAe;AACnD,OAAO,MAAMC,sBAAsB,qBAAoB;AAEvD,OAAO,MAAMC,eAAe,OAAuB;AACnD,OAAO,MAAMC,cAAc,OAAc;AAEzC,OAAO,MAAMC,eAAe;IAC1B;QAAEC,OAAO;QAAuBC,OAAO;IAAO;IAC9C;QAAED,OAAO;QAAoBC,OAAO;IAAS;IAC7C;QAAED,OAAO;QAAkBC,OAAO;IAAO;IACzC;QAAED,OAAO;QAAcC,OAAO;IAAa;IAC3C;QAAED,OAAO;QAASC,OAAO;IAAQ;IACjC;QAAED,OAAO;QAAoBC,OAAO;IAAc;IAClD;QAAED,OAAO;QAAoBC,OAAO;IAAmB;IACvD;QAAED,OAAO;QAAuBC,OAAO;IAAsB;CAC9D,CAAiB;AAElB,OAAO,MAAMC,4BAA4B;IACvC,MAAMC,aAAa;IACnB,MAAMC,MAAMC,OAAOC,UAAU,CAACH;IAC9B,MAAMI,wBAAwB,OAAOH,IAAII,OAAO,KAAK;IAErD,IAAID,uBAAuB;QACzB,OAAOH,IAAII,OAAO,GAAG,SAAS;IAChC;IAEA,OAAO;AACT,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/providers/Theme/shared.ts"],"sourcesContent":["import type { Mode, ThemeOption, ThemeDefaults } from './types.js'\r\n\r\nexport const themeLocalStorageKey = 'payload-theme'\r\nexport const modeLocalStorageKey = 'payload-theme-mode'\r\n\r\nexport const defaultTheme = 'cool' as ThemeDefaults\r\nexport const defaultMode = 'auto' as Mode\r\n\r\nexport const themeOptions = [\r\n { label: 'Cool & Professional', value: 'cool' },\r\n { label: 'Modern Brutalism', value: 'brutal' },\r\n { label: 'Neon Cyberpunk', value: 'neon' },\r\n { label: 'Dealership', value: 'dealership' },\r\n { label: 'Solar', value: 'solar' },\r\n { label: 'Real Estate Blue', value: 'real-estate' },\r\n { label: 'Real Estate Gold', value: 'real-estate-gold' },\r\n { label: 'Real Estate Neutral', value: 'real-estate-neutral' },\r\n] as ThemeOption[]\r\n\r\nexport const getImplicitModePreference = (): Mode | null => {\r\n const mediaQuery = '(prefers-color-scheme: dark)'\r\n const mql = window.matchMedia(mediaQuery)\r\n const hasImplicitPreference = typeof mql.matches === 'boolean'\r\n\r\n if (hasImplicitPreference) {\r\n return mql.matches ? 'dark' : 'light'\r\n }\r\n\r\n return null\r\n}\r\n"],"names":["themeLocalStorageKey","modeLocalStorageKey","defaultTheme","defaultMode","themeOptions","label","value","getImplicitModePreference","mediaQuery","mql","window","matchMedia","hasImplicitPreference","matches"],"mappings":"AAEA,OAAO,MAAMA,uBAAuB,gBAAe;AACnD,OAAO,MAAMC,sBAAsB,qBAAoB;AAEvD,OAAO,MAAMC,eAAe,OAAuB;AACnD,OAAO,MAAMC,cAAc,OAAc;AAEzC,OAAO,MAAMC,eAAe;IAC1B;QAAEC,OAAO;QAAuBC,OAAO;IAAO;IAC9C;QAAED,OAAO;QAAoBC,OAAO;IAAS;IAC7C;QAAED,OAAO;QAAkBC,OAAO;IAAO;IACzC;QAAED,OAAO;QAAcC,OAAO;IAAa;IAC3C;QAAED,OAAO;QAASC,OAAO;IAAQ;IACjC;QAAED,OAAO;QAAoBC,OAAO;IAAc;IAClD;QAAED,OAAO;QAAoBC,OAAO;IAAmB;IACvD;QAAED,OAAO;QAAuBC,OAAO;IAAsB;CAC9D,CAAiB;AAElB,OAAO,MAAMC,4BAA4B;IACvC,MAAMC,aAAa;IACnB,MAAMC,MAAMC,OAAOC,UAAU,CAACH;IAC9B,MAAMI,wBAAwB,OAAOH,IAAII,OAAO,KAAK;IAErD,IAAID,uBAAuB;QACzB,OAAOH,IAAII,OAAO,GAAG,SAAS;IAChC;IAEA,OAAO;AACT,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/providers/Theme/themeConfig.ts"],"sourcesContent":["import type { ThemeConfig, ThemeDefaults } from './types.js'\n\nexport const themeConfigs: Record<ThemeDefaults, ThemeConfig> = {\n cool: {\n name: 'cool',\n label: 'Cool & Professional',\n borderRadius: 'medium',\n cssFile: '/themes/cool.css',\n preview: {\n colors: {\n primary: 'hsl(221 83% 53%)',\n background: 'hsl(0 0% 100%)',\n accent: 'hsl(210 40% 95%)',\n },\n },\n },\n brutal: {\n name: 'brutal',\n label: 'Modern Brutalism',\n borderRadius: 'none',\n cssFile: '/themes/brutal.css',\n preview: {\n colors: {\n primary: 'hsl(0 0% 0%)',\n background: 'hsl(0 0% 100%)',\n accent: 'hsl(0 72% 51%)',\n },\n },\n },\n neon: {\n name: 'neon',\n label: 'Neon Cyberpunk',\n borderRadius: 'medium',\n cssFile: '/themes/neon.css',\n preview: {\n colors: {\n primary: 'hsl(263 90% 51%)',\n background: 'hsl(230 25% 5%)',\n accent: 'hsl(180 100% 50%)',\n },\n },\n },\n solar: {\n name: 'solar',\n label: 'Solar',\n borderRadius: 'large',\n cssFile: '/themes/solar.css',\n preview: {\n colors: {\n primary: 'hsl(20 90% 45%)',\n background: 'hsl(40 30% 95%)',\n accent: 'hsl(40 100% 50%)',\n },\n },\n },\n dealership: {\n name: 'dealership',\n label: 'Dealership',\n borderRadius: 'medium',\n cssFile: '/themes/dealership.css',\n preview: {\n colors: {\n primary: 'hsl(225 25% 25%)',\n background: 'hsl(0 0% 98%)',\n accent: 'hsl(15 85% 55%)',\n },\n },\n },\n 'real-estate': {\n name: 'real-estate',\n label: 'Real Estate Blue',\n borderRadius: 'large',\n cssFile: '/themes/real-estate.css',\n preview: {\n colors: {\n primary: 'hsl(220 90% 48%)',\n background: 'hsl(220 40% 98.5%)',\n accent: 'hsl(210 85% 55%)',\n },\n },\n },\n 'real-estate-gold': {\n name: 'real-estate-gold',\n label: 'Real Estate Gold',\n borderRadius: 'large',\n cssFile: '/themes/real-estate-gold.css',\n preview: {\n colors: {\n primary: 'hsl(38 75% 45%)',\n background: 'hsl(45 25% 97%)',\n accent: 'hsl(42 85% 55%)',\n },\n },\n },\n 'real-estate-neutral': {\n name: 'real-estate-neutral',\n label: 'Real Estate Neutral',\n borderRadius: 'large',\n cssFile: '/themes/real-estate-neutral.css',\n preview: {\n colors: {\n primary: 'hsl(25 35% 25%)',\n background: 'hsl(30 8% 98%)',\n accent: 'hsl(35 25% 45%)',\n },\n },\n },\n}\n\nexport const borderRadiusPresets = {\n none: {\n label: 'None',\n value: 'none',\n css: {\n '--radius-xs': '0',\n '--radius-small': '0',\n '--radius-default': '0',\n '--radius-medium': '0',\n '--radius-large': '0',\n '--radius-xl': '0',\n },\n },\n small: {\n label: 'Small',\n value: 'small',\n css: {\n '--radius-xs': '0.125rem',\n '--radius-small': '0.25rem',\n '--radius-default': '0.375rem',\n '--radius-medium': '0.5rem',\n '--radius-large': '0.75rem',\n '--radius-xl': '1rem',\n },\n },\n medium: {\n label: 'Medium',\n value: 'medium',\n css: {\n '--radius-xs': '0.25rem',\n '--radius-small': '0.5rem',\n '--radius-default': '0.75rem',\n '--radius-medium': '1rem',\n '--radius-large': '1.5rem',\n '--radius-xl': '2rem',\n },\n },\n large: {\n label: 'Large',\n value: 'large',\n css: {\n '--radius-xs': '0.5rem',\n '--radius-small': '0.75rem',\n '--radius-default': '1rem',\n '--radius-medium': '1.5rem',\n '--radius-large': '2rem',\n '--radius-xl': '2.5rem',\n },\n },\n xl: {\n label: 'Extra Large',\n value: 'xl',\n css: {\n '--radius-xs': '0.75rem',\n '--radius-small': '1rem',\n '--radius-default': '1.5rem',\n '--radius-medium': '2rem',\n '--radius-large': '2.5rem',\n '--radius-xl': '3rem',\n },\n },\n} as const\n\nexport function getThemeConfig(theme: ThemeDefaults): ThemeConfig {\n return themeConfigs[theme]\n}\n\nexport function getBorderRadiusConfig(preset: keyof typeof borderRadiusPresets) {\n return borderRadiusPresets[preset]\n}\n"],"names":["themeConfigs","cool","name","label","borderRadius","cssFile","preview","colors","primary","background","accent","brutal","neon","solar","dealership","borderRadiusPresets","none","value","css","small","medium","large","xl","getThemeConfig","theme","getBorderRadiusConfig","preset"],"mappings":"AAEA,OAAO,MAAMA,eAAmD;IAC9DC,MAAM;QACJC,MAAM;QACNC,OAAO;QACPC,cAAc;QACdC,SAAS;QACTC,SAAS;YACPC,QAAQ;gBACNC,SAAS;gBACTC,YAAY;gBACZC,QAAQ;YACV;QACF;IACF;IACAC,QAAQ;QACNT,MAAM;QACNC,OAAO;QACPC,cAAc;QACdC,SAAS;QACTC,SAAS;YACPC,QAAQ;gBACNC,SAAS;gBACTC,YAAY;gBACZC,QAAQ;YACV;QACF;IACF;IACAE,MAAM;QACJV,MAAM;QACNC,OAAO;QACPC,cAAc;QACdC,SAAS;QACTC,SAAS;YACPC,QAAQ;gBACNC,SAAS;gBACTC,YAAY;gBACZC,QAAQ;YACV;QACF;IACF;IACAG,OAAO;QACLX,MAAM;QACNC,OAAO;QACPC,cAAc;QACdC,SAAS;QACTC,SAAS;YACPC,QAAQ;gBACNC,SAAS;gBACTC,YAAY;gBACZC,QAAQ;YACV;QACF;IACF;IACAI,YAAY;QACVZ,M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YACpB,mBAAmB;YACnB,kBAAkB;YAClB,eAAe;QACjB;IACF;AACF,EAAU;AAEV,OAAO,SAASK,eAAeC,KAAoB;IACjD,OAAOxB,YAAY,CAACwB,MAAM;AAC5B;AAEA,OAAO,SAASC,sBAAsBC,MAAwC;IAC5E,OAAOX,mBAAmB,CAACW,OAAO;AACpC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/providers/Theme/themeConfig.ts"],"sourcesContent":["import type { ThemeConfig, ThemeDefaults } from './types.js'\r\n\r\nexport const themeConfigs: Record<ThemeDefaults, ThemeConfig> = {\r\n cool: {\r\n name: 'cool',\r\n label: 'Cool & Professional',\r\n borderRadius: 'medium',\r\n cssFile: '/themes/cool.css',\r\n preview: {\r\n colors: {\r\n primary: 'hsl(221 83% 53%)',\r\n background: 'hsl(0 0% 100%)',\r\n accent: 'hsl(210 40% 95%)',\r\n },\r\n },\r\n },\r\n brutal: {\r\n name: 'brutal',\r\n label: 'Modern Brutalism',\r\n borderRadius: 'none',\r\n cssFile: '/themes/brutal.css',\r\n preview: {\r\n colors: {\r\n primary: 'hsl(0 0% 0%)',\r\n background: 'hsl(0 0% 100%)',\r\n accent: 'hsl(0 72% 51%)',\r\n },\r\n },\r\n },\r\n neon: {\r\n name: 'neon',\r\n label: 'Neon Cyberpunk',\r\n borderRadius: 'medium',\r\n cssFile: '/themes/neon.css',\r\n preview: {\r\n colors: {\r\n primary: 'hsl(263 90% 51%)',\r\n background: 'hsl(230 25% 5%)',\r\n accent: 'hsl(180 100% 50%)',\r\n },\r\n },\r\n },\r\n solar: {\r\n name: 'solar',\r\n label: 'Solar',\r\n borderRadius: 'large',\r\n cssFile: '/themes/solar.css',\r\n preview: {\r\n colors: {\r\n primary: 'hsl(20 90% 45%)',\r\n background: 'hsl(40 30% 95%)',\r\n accent: 'hsl(40 100% 50%)',\r\n },\r\n },\r\n },\r\n dealership: {\r\n name: 'dealership',\r\n label: 'Dealership',\r\n borderRadius: 'medium',\r\n cssFile: '/themes/dealership.css',\r\n preview: {\r\n colors: {\r\n primary: 'hsl(225 25% 25%)',\r\n background: 'hsl(0 0% 98%)',\r\n accent: 'hsl(15 85% 55%)',\r\n },\r\n },\r\n },\r\n 'real-estate': {\r\n name: 'real-estate',\r\n label: 'Real Estate Blue',\r\n borderRadius: 'large',\r\n cssFile: '/themes/real-estate.css',\r\n preview: {\r\n colors: {\r\n primary: 'hsl(220 90% 48%)',\r\n background: 'hsl(220 40% 98.5%)',\r\n accent: 'hsl(210 85% 55%)',\r\n },\r\n },\r\n },\r\n 'real-estate-gold': {\r\n name: 'real-estate-gold',\r\n label: 'Real Estate Gold',\r\n borderRadius: 'large',\r\n cssFile: '/themes/real-estate-gold.css',\r\n preview: {\r\n colors: {\r\n primary: 'hsl(38 75% 45%)',\r\n background: 'hsl(45 25% 97%)',\r\n accent: 'hsl(42 85% 55%)',\r\n },\r\n },\r\n },\r\n 'real-estate-neutral': {\r\n name: 'real-estate-neutral',\r\n label: 'Real Estate Neutral',\r\n borderRadius: 'large',\r\n cssFile: '/themes/real-estate-neutral.css',\r\n preview: {\r\n colors: {\r\n primary: 'hsl(25 35% 25%)',\r\n background: 'hsl(30 8% 98%)',\r\n accent: 'hsl(35 25% 45%)',\r\n },\r\n },\r\n },\r\n}\r\n\r\nexport const borderRadiusPresets = {\r\n none: {\r\n label: 'None',\r\n value: 'none',\r\n css: {\r\n '--radius-xs': '0',\r\n '--radius-small': '0',\r\n '--radius-default': '0',\r\n '--radius-medium': '0',\r\n '--radius-large': '0',\r\n '--radius-xl': '0',\r\n },\r\n },\r\n small: {\r\n label: 'Small',\r\n value: 'small',\r\n css: {\r\n '--radius-xs': '0.125rem',\r\n '--radius-small': '0.25rem',\r\n '--radius-default': '0.375rem',\r\n '--radius-medium': '0.5rem',\r\n '--radius-large': '0.75rem',\r\n '--radius-xl': '1rem',\r\n },\r\n },\r\n medium: {\r\n label: 'Medium',\r\n value: 'medium',\r\n css: {\r\n '--radius-xs': '0.25rem',\r\n '--radius-small': '0.5rem',\r\n '--radius-default': '0.75rem',\r\n '--radius-medium': '1rem',\r\n '--radius-large': '1.5rem',\r\n '--radius-xl': '2rem',\r\n },\r\n },\r\n large: {\r\n label: 'Large',\r\n value: 'large',\r\n css: {\r\n '--radius-xs': '0.5rem',\r\n '--radius-small': '0.75rem',\r\n '--radius-default': '1rem',\r\n '--radius-medium': '1.5rem',\r\n '--radius-large': '2rem',\r\n '--radius-xl': '2.5rem',\r\n },\r\n },\r\n xl: {\r\n label: 'Extra Large',\r\n value: 'xl',\r\n css: {\r\n '--radius-xs': '0.75rem',\r\n '--radius-small': '1rem',\r\n '--radius-default': '1.5rem',\r\n '--radius-medium': '2rem',\r\n '--radius-large': '2.5rem',\r\n '--radius-xl': '3rem',\r\n },\r\n },\r\n} as const\r\n\r\nexport function getThemeConfig(theme: ThemeDefaults): ThemeConfig {\r\n return themeConfigs[theme]\r\n}\r\n\r\nexport function getBorderRadiusConfig(preset: keyof typeof borderRadiusPresets) {\r\n return borderRadiusPresets[preset]\r\n}\r\n"],"names":["themeConfigs","cool","name","label","borderRadius","cssFile","preview","colors","primary","background","accent","brutal","neon","solar","dealership","borderRadiusPresets","none","value","css","small","medium","large","xl","getThemeConfig","theme","getBorderRadiusConfig","preset"],"mappings":"AAEA,OAAO,MAAMA,eAAmD;IAC9DC,MAAM;QACJC,MAAM;QACNC,OAAO;QACPC,cAAc;QACdC,SAAS;QACTC,SAAS;YACPC,QAAQ;gBACNC,SAAS;gBACTC,YAAY;gBACZC,QAAQ;YACV;QACF;IACF;IACAC,QAAQ;QACNT,MAAM;QACNC,OAAO;QACPC,cAAc;QACdC,SAAS;QACTC,SAAS;YACPC,QAAQ;gBACNC,SAAS;gBACTC,YAAY;gBACZC,QAAQ;YACV;QACF;IACF;IACAE,MAAM;QACJV,MAAM;QACNC,OAAO;QACPC,cAAc;QACdC,SAAS;QACTC,SAAS;YACPC,QAAQ;gBACNC,SAAS;gBACTC,YAAY;gBACZC,QAAQ;YACV;QACF;IACF;IACA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kB;YAClB,oBAAoB;YACpB,mBAAmB;YACnB,kBAAkB;YAClB,eAAe;QACjB;IACF;IACAI,IAAI;QACFnB,OAAO;QACPc,OAAO;QACPC,KAAK;YACH,eAAe;YACf,kBAAkB;YAClB,oBAAoB;YACpB,mBAAmB;YACnB,kBAAkB;YAClB,eAAe;QACjB;IACF;AACF,EAAU;AAEV,OAAO,SAASK,eAAeC,KAAoB;IACjD,OAAOxB,YAAY,CAACwB,MAAM;AAC5B;AAEA,OAAO,SAASC,sBAAsBC,MAAwC;IAC5E,OAAOX,mBAAmB,CAACW,OAAO;AACpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/providers/Theme/types.ts"],"sourcesContent":["export type ThemeDefaults =\n | 'cool'\n | 'brutal'\n | 'neon'\n | 'solar'\n | 'dealership'\n | 'real-estate'\n | 'real-estate-gold'\n | 'real-estate-neutral';\n\nexport type Mode = 'dark' | 'light' | 'auto';\n\nexport type BorderRadiusPreset = 'none' | 'small' | 'medium' | 'large' | 'xl';\n\nexport type FontScalePreset = 'small' | 'medium' | 'large' | 'xl';\n\nexport type SpacingPreset = 'compact' | 'medium' | 'spacious';\n\nexport type AnimationLevelPreset = 'none' | 'reduced' | 'medium' | 'high';\n\nexport type ColorModePreset = 'auto' | 'light' | 'dark';\n\nexport interface ThemeConfig {\n name: string;\n label: string;\n borderRadius: BorderRadiusPreset;\n cssFile: string;\n preview?: {\n colors: {\n primary: string;\n background: string;\n accent: string;\n };\n };\n}\n\nexport interface ThemeContextType {\n // Theme management\n theme?: ThemeDefaults | null;\n setTheme?: (theme: ThemeDefaults) => void; // Add setTheme for enhanced functionality\n refreshTheme: () => void; // Refresh theme (now handled server-side)\n\n // Color mode\n mode?: Mode | null;\n setMode: (mode: Mode | null) => void;\n isColorModeToggleAllowed?: boolean; // Whether admin allows color mode changes\n\n // Design controls\n borderRadius?: BorderRadiusPreset;\n setBorderRadius?: (radius: BorderRadiusPreset) => void;\n fontScale?: FontScalePreset;\n setFontScale?: (scale: FontScalePreset) => void;\n spacing?: SpacingPreset;\n setSpacing?: (spacing: SpacingPreset) => void;\n animationLevel?: AnimationLevelPreset;\n setAnimationLevel?: (level: AnimationLevelPreset) => void;\n\n // Theme loading\n preloadTheme?: (theme: ThemeDefaults) => Promise<boolean>;\n isThemeLoaded?: (theme: ThemeDefaults) => boolean;\n\n // Enhanced configuration\n themeConfig?: any; // Enhanced theme configuration from plugin\n}\n\nexport interface ThemeOption {\n label: string;\n value: ThemeDefaults;\n config?: ThemeConfig;\n}\n\nexport function themeIsValid(string: null | string): string is ThemeDefaults {\n return string\n ? [\n 'cool',\n 'brutal',\n 'neon',\n 'solar',\n 'dealership',\n 'real-estate',\n 'real-estate-gold',\n 'real-estate-neutral',\n ].includes(string)\n : false;\n}\n\nexport function modeIsValid(string: null | string): string is Mode {\n return string ? ['dark', 'light'].includes(string) : false;\n}\n"],"names":["themeIsValid","string","includes","modeIsValid"],"mappings":"AAuEA,OAAO,SAASA,aAAaC,MAAqB;IAChD,OAAOA,SACH;QACE;QACA;QACA;QACA;QACA;QACA;QACA;QACA;KACD,CAACC,QAAQ,CAACD,UACX;AACN;AAEA,OAAO,SAASE,YAAYF,MAAqB;IAC/C,OAAOA,SAAS;QAAC;QAAQ;KAAQ,CAACC,QAAQ,CAACD,UAAU;AACvD"}
|
|
1
|
+
{"version":3,"sources":["../../../src/providers/Theme/types.ts"],"sourcesContent":["export type ThemeDefaults =\r\n | 'cool'\r\n | 'brutal'\r\n | 'neon'\r\n | 'solar'\r\n | 'dealership'\r\n | 'real-estate'\r\n | 'real-estate-gold'\r\n | 'real-estate-neutral';\r\n\r\nexport type Mode = 'dark' | 'light' | 'auto';\r\n\r\nexport type BorderRadiusPreset = 'none' | 'small' | 'medium' | 'large' | 'xl';\r\n\r\nexport type FontScalePreset = 'small' | 'medium' | 'large' | 'xl';\r\n\r\nexport type SpacingPreset = 'compact' | 'medium' | 'spacious';\r\n\r\nexport type AnimationLevelPreset = 'none' | 'reduced' | 'medium' | 'high';\r\n\r\nexport type ColorModePreset = 'auto' | 'light' | 'dark';\r\n\r\nexport interface ThemeConfig {\r\n name: string;\r\n label: string;\r\n borderRadius: BorderRadiusPreset;\r\n cssFile: string;\r\n preview?: {\r\n colors: {\r\n primary: string;\r\n background: string;\r\n accent: string;\r\n };\r\n };\r\n}\r\n\r\nexport interface ThemeContextType {\r\n // Theme management\r\n theme?: ThemeDefaults | null;\r\n setTheme?: (theme: ThemeDefaults) => void; // Add setTheme for enhanced functionality\r\n refreshTheme: () => void; // Refresh theme (now handled server-side)\r\n\r\n // Color mode\r\n mode?: Mode | null;\r\n setMode: (mode: Mode | null) => void;\r\n isColorModeToggleAllowed?: boolean; // Whether admin allows color mode changes\r\n\r\n // Design controls\r\n borderRadius?: BorderRadiusPreset;\r\n setBorderRadius?: (radius: BorderRadiusPreset) => void;\r\n fontScale?: FontScalePreset;\r\n setFontScale?: (scale: FontScalePreset) => void;\r\n spacing?: SpacingPreset;\r\n setSpacing?: (spacing: SpacingPreset) => void;\r\n animationLevel?: AnimationLevelPreset;\r\n setAnimationLevel?: (level: AnimationLevelPreset) => void;\r\n\r\n // Theme loading\r\n preloadTheme?: (theme: ThemeDefaults) => Promise<boolean>;\r\n isThemeLoaded?: (theme: ThemeDefaults) => boolean;\r\n\r\n // Enhanced configuration\r\n themeConfig?: any; // Enhanced theme configuration from plugin\r\n}\r\n\r\nexport interface ThemeOption {\r\n label: string;\r\n value: ThemeDefaults;\r\n config?: ThemeConfig;\r\n}\r\n\r\nexport function themeIsValid(string: null | string): string is ThemeDefaults {\r\n return string\r\n ? [\r\n 'cool',\r\n 'brutal',\r\n 'neon',\r\n 'solar',\r\n 'dealership',\r\n 'real-estate',\r\n 'real-estate-gold',\r\n 'real-estate-neutral',\r\n ].includes(string)\r\n : false;\r\n}\r\n\r\nexport function modeIsValid(string: null | string): string is Mode {\r\n return string ? ['dark', 'light'].includes(string) : false;\r\n}\r\n"],"names":["themeIsValid","string","includes","modeIsValid"],"mappings":"AAuEA,OAAO,SAASA,aAAaC,MAAqB;IAChD,OAAOA,SACH;QACE;QACA;QACA;QACA;QACA;QACA;QACA;QACA;KACD,CAACC,QAAQ,CAACD,UACX;AACN;AAEA,OAAO,SAASE,YAAYF,MAAqB;IAC/C,OAAOA,SAAS;QAAC;QAAQ;KAAQ,CAACC,QAAQ,CAACD,UAAU;AACvD"}
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/server.ts"],"sourcesContent":["import 'server-only'\n\nexport { ServerThemeInjector } from './components/ServerThemeInjector.js'\n\nexport {\n createFallbackCriticalCSS,\n generateThemePreloadLinks,\n getThemeCriticalCSS,\n getThemeCSSPath,\n} from './utils/themeAssets.js'\n"],"names":["ServerThemeInjector","createFallbackCriticalCSS","generateThemePreloadLinks","getThemeCriticalCSS","getThemeCSSPath"],"mappings":"AAAA,OAAO,cAAa;AAEpB,SAASA,mBAAmB,QAAQ,sCAAqC;AAEzE,SACEC,yBAAyB,EACzBC,yBAAyB,EACzBC,mBAAmB,EACnBC,eAAe,QACV,yBAAwB"}
|
|
1
|
+
{"version":3,"sources":["../src/server.ts"],"sourcesContent":["import 'server-only'\r\n\r\nexport { ServerThemeInjector } from './components/ServerThemeInjector.js'\r\n\r\nexport {\r\n createFallbackCriticalCSS,\r\n generateThemePreloadLinks,\r\n getThemeCriticalCSS,\r\n getThemeCSSPath,\r\n} from './utils/themeAssets.js'\r\n"],"names":["ServerThemeInjector","createFallbackCriticalCSS","generateThemePreloadLinks","getThemeCriticalCSS","getThemeCSSPath"],"mappings":"AAAA,OAAO,cAAa;AAEpB,SAASA,mBAAmB,QAAQ,sCAAqC;AAEzE,SACEC,yBAAyB,EACzBC,yBAAyB,EACzBC,mBAAmB,EACnBC,eAAe,QACV,yBAAwB"}
|