Theming API: Refactor layers

pull/5507/head
mertsincan 2024-03-18 12:37:07 +00:00
parent 5318a081e5
commit 72f211a86d
1 changed files with 6 additions and 6 deletions

View File

@ -70,7 +70,7 @@ export default {
return [...this._layerNames];
},
setLayerNames(layerName) {
this._layerNames.add(layerName);
this._layerNames?.add(layerName);
},
applyColorScheme() {
const newColorScheme = ThemeUtils.applyColorScheme(this.options, this.getCurrentColorScheme(), this.defaults);
@ -87,10 +87,10 @@ export default {
return newColorScheme;
},
getCommonCSS(name = '', theme, params) {
return ThemeUtils.getCommon({ name, theme: theme || this.theme, params, defaults: this.defaults, set: { layerNames: this.setLayerNames } });
return ThemeUtils.getCommon({ name, theme: theme || this.theme, params, defaults: this.defaults, set: { layerNames: this.setLayerNames.bind(this) } });
},
getComponentCSS(name = '', theme, params) {
const options = { name, theme: theme || this.theme, params, defaults: this.defaults, set: { layerNames: this.setLayerNames } };
const options = { name, theme: theme || this.theme, params, defaults: this.defaults, set: { layerNames: this.setLayerNames.bind(this) } };
return {
style: ThemeUtils.getBaseC(options),
@ -98,7 +98,7 @@ export default {
};
},
getDirectiveCSS(name = '', theme, params) {
const options = { name, theme: theme || this.theme, params, defaults: this.defaults, set: { layerNames: this.setLayerNames } };
const options = { name, theme: theme || this.theme, params, defaults: this.defaults, set: { layerNames: this.setLayerNames.bind(this) } };
return {
style: ThemeUtils.getBaseD(options),
@ -109,9 +109,9 @@ export default {
return ThemeUtils.getLayerOrder(name, this.options, { names: this.getLayerNames() });
},
getCommonStyleSheet(name = '', theme, params, props = {}) {
return ThemeUtils.getCommonStyleSheet({ name, theme, params, props, defaults: this.defaults, set: { layerNames: this.setLayerNames } });
return ThemeUtils.getCommonStyleSheet({ name, theme, params, props, defaults: this.defaults, set: { layerNames: this.setLayerNames.bind(this) } });
},
getStyleSheet(name, theme = {}, params, props = {}) {
return ThemeUtils.getStyleSheet({ name, theme, params, props, defaults: this.defaults, set: { layerNames: this.setLayerNames } });
return ThemeUtils.getStyleSheet({ name, theme, params, props, defaults: this.defaults, set: { layerNames: this.setLayerNames.bind(this) } });
}
};