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