Theming API: Refactor on definePreset action
parent
d80a18c052
commit
a7c3bf15e3
|
@ -1,13 +1,8 @@
|
|||
import Theme from 'primevue/themes';
|
||||
import Theme, { SharedUtils } from 'primevue/themes';
|
||||
|
||||
export default (preset1, preset2) => {
|
||||
const [{ primitive: p1, semantic: s1, components: c1, directives: d1 }, { primitive: p2, semantic: s2, components: c2, directives: d2 }] = [preset1, preset2];
|
||||
const newPreset = {
|
||||
primitive: { ...p1, ...p2 },
|
||||
semantic: { ...s1, ...s2 },
|
||||
components: { ...c1, ...c2 },
|
||||
directives: { ...d1, ...d2 }
|
||||
};
|
||||
const VARIABLE = Theme.defaults.variable;
|
||||
const newPreset = SharedUtils.object.mergeKeysByRegex(preset1, preset2, VARIABLE.excludedKeyRegex);
|
||||
|
||||
Theme.setPreset(newPreset);
|
||||
|
||||
|
|
Loading…
Reference in New Issue