@kilivi/payloadcms-theme-management 0.5.5 → 0.5.7
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 +34 -38
- package/dist/components/ServerThemeInjector.d.ts.map +1 -1
- package/dist/components/ServerThemeInjector.js +1 -11
- package/dist/components/ServerThemeInjector.js.map +1 -1
- package/dist/components/ThemePreview.d.ts.map +1 -1
- package/dist/components/ThemePreview.js +3 -3
- package/dist/components/ThemePreview.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/dist/providers/Theme/themeConfig.d.ts.map +1 -1
- package/dist/providers/Theme/themeConfig.js +256 -8
- package/dist/providers/Theme/themeConfig.js.map +1 -1
- package/dist/providers/Theme/types.d.ts +5 -3
- package/dist/providers/Theme/types.d.ts.map +1 -1
- package/dist/providers/Theme/types.js +34 -13
- package/dist/providers/Theme/types.js.map +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/dist/utils/generateThemeCSS.d.ts +11 -0
- package/dist/utils/generateThemeCSS.d.ts.map +1 -0
- package/dist/utils/generateThemeCSS.js +309 -0
- package/dist/utils/generateThemeCSS.js.map +1 -0
- package/dist/utils/resolveThemeConfiguration.d.ts +1 -1
- package/dist/utils/resolveThemeConfiguration.d.ts.map +1 -1
- package/dist/utils/resolveThemeConfiguration.js +3 -3
- package/dist/utils/resolveThemeConfiguration.js.map +1 -1
- package/dist/utils/themeAssets.d.ts +7 -0
- package/dist/utils/themeAssets.d.ts.map +1 -1
- package/dist/utils/themeAssets.js +23 -35
- package/dist/utils/themeAssets.js.map +1 -1
- package/dist/utils/themeCSS.d.ts +11 -0
- package/dist/utils/themeCSS.d.ts.map +1 -0
- package/dist/utils/themeCSS.js +32 -0
- package/dist/utils/themeCSS.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { allThemePresets } from '../presets.js';
|
|
2
|
+
import { generateThemeCSS } from './generateThemeCSS.js';
|
|
3
|
+
/**
|
|
4
|
+
* Get dynamically generated CSS for a theme
|
|
5
|
+
* Returns null if theme doesn't exist or doesn't use dynamic CSS
|
|
6
|
+
*/ export function getThemeDynamicCSS(themeName) {
|
|
7
|
+
const preset = allThemePresets.find((p)=>p.name === themeName);
|
|
8
|
+
if (!preset) {
|
|
9
|
+
console.warn(`Theme preset not found: ${themeName}`);
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
try {
|
|
13
|
+
return generateThemeCSS(preset);
|
|
14
|
+
} catch (error) {
|
|
15
|
+
console.error(`Error generating CSS for theme ${themeName}:`, error);
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get CSS for all themes that use dynamic generation
|
|
21
|
+
*/ export function getAllDynamicThemesCSS() {
|
|
22
|
+
return allThemePresets.map((preset)=>{
|
|
23
|
+
try {
|
|
24
|
+
return generateThemeCSS(preset);
|
|
25
|
+
} catch (error) {
|
|
26
|
+
console.error(`Error generating CSS for theme ${preset.name}:`, error);
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
}).filter((css)=>css !== null).join('\n\n');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=themeCSS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/themeCSS.ts"],"sourcesContent":["import { allThemePresets } from '../presets.js'\nimport type { ThemeDefaults } from '../providers/Theme/types.js'\nimport { generateThemeCSS } from './generateThemeCSS.js'\n\n/**\n * Get dynamically generated CSS for a theme\n * Returns null if theme doesn't exist or doesn't use dynamic CSS\n */\nexport function getThemeDynamicCSS(themeName: ThemeDefaults): string | null {\n const preset = allThemePresets.find((p) => p.name === themeName)\n\n if (!preset) {\n console.warn(`Theme preset not found: ${themeName}`)\n return null\n }\n\n try {\n return generateThemeCSS(preset)\n } catch (error) {\n console.error(`Error generating CSS for theme ${themeName}:`, error)\n return null\n }\n}\n\n/**\n * Get CSS for all themes that use dynamic generation\n */\nexport function getAllDynamicThemesCSS(): string {\n return allThemePresets\n .map((preset) => {\n try {\n return generateThemeCSS(preset)\n } catch (error) {\n console.error(`Error generating CSS for theme ${preset.name}:`, error)\n return null\n }\n })\n .filter((css): css is string => css !== null)\n .join('\\n\\n')\n}\n"],"names":["allThemePresets","generateThemeCSS","getThemeDynamicCSS","themeName","preset","find","p","name","console","warn","error","getAllDynamicThemesCSS","map","filter","css","join"],"mappings":"AAAA,SAASA,eAAe,QAAQ,gBAAe;AAE/C,SAASC,gBAAgB,QAAQ,wBAAuB;AAExD;;;CAGC,GACD,OAAO,SAASC,mBAAmBC,SAAwB;IACzD,MAAMC,SAASJ,gBAAgBK,IAAI,CAAC,CAACC,IAAMA,EAAEC,IAAI,KAAKJ;IAEtD,IAAI,CAACC,QAAQ;QACXI,QAAQC,IAAI,CAAC,CAAC,wBAAwB,EAAEN,WAAW;QACnD,OAAO;IACT;IAEA,IAAI;QACF,OAAOF,iBAAiBG;IAC1B,EAAE,OAAOM,OAAO;QACdF,QAAQE,KAAK,CAAC,CAAC,+BAA+B,EAAEP,UAAU,CAAC,CAAC,EAAEO;QAC9D,OAAO;IACT;AACF;AAEA;;CAEC,GACD,OAAO,SAASC;IACd,OAAOX,gBACJY,GAAG,CAAC,CAACR;QACJ,IAAI;YACF,OAAOH,iBAAiBG;QAC1B,EAAE,OAAOM,OAAO;YACdF,QAAQE,KAAK,CAAC,CAAC,+BAA+B,EAAEN,OAAOG,IAAI,CAAC,CAAC,CAAC,EAAEG;YAChE,OAAO;QACT;IACF,GACCG,MAAM,CAAC,CAACC,MAAuBA,QAAQ,MACvCC,IAAI,CAAC;AACV"}
|