Support for directives

pull/7024/head
Cagatay Civici 2024-12-28 21:47:48 +03:00
parent b9b026df1a
commit 121b8fcb24
4 changed files with 22 additions and 9 deletions

View File

@ -82,6 +82,15 @@ export default {
}
},
inject: ['designerService'],
watch: {
$route: {
handler() {
if (!this.isComponentRoute && this.$appState.designer.activeTab === '2') {
this.$appState.designer.activeTab = '0';
}
}
}
},
methods: {
onKeyDown(event) {
if (event.code === 'Enter' || event.code === 'NumpadEnter') {
@ -92,9 +101,10 @@ export default {
},
computed: {
isComponentRoute() {
const components = this.$appState.designer.theme?.preset?.components;
const components = this.$appState.designer.theme.preset.components;
const directives = this.$appState.designer.theme.preset.directives;
return components ? components[this.$route.name] != null : false;
return components[this.$route.name] != null || directives[this.$route.name];
}
}
};

View File

@ -32,18 +32,19 @@ export default {
return this.$route.name;
},
isComponentRoute() {
const components = this.$appState.designer.theme?.preset?.components;
const components = this.$appState.designer.theme.preset.components;
const directives = this.$appState.designer.theme.preset.directives;
return components ? components[this.componentKey] != null : false;
return components[this.componentKey] != null || directives[this.componentKey] != null;
},
tokens() {
return this.$appState.designer.theme?.preset?.components[this.componentKey];
return this.$appState.designer.theme.preset.components[this.componentKey] || this.$appState.designer.theme.preset.directives[this.componentKey];
},
lightTokens() {
return this.$appState.designer.theme?.preset?.components[this.componentKey].colorScheme.light;
return this.tokens.colorScheme?.light;
},
darkTokens() {
return this.$appState.designer.theme?.preset?.components[this.componentKey].colorScheme.dark;
return this.tokens.colorScheme?.dark;
},
hasColorScheme() {
return this.tokens.colorScheme != undefined;

View File

@ -66,7 +66,9 @@ export default {
.join(' ');
},
tokens() {
return this.getObjectProperty(this.$appState.designer.theme.preset.components[this.componentKey], this.path);
const source = this.$appState.designer.theme.preset.components[this.componentKey] || this.$appState.designer.theme.preset.directives[this.componentKey];
return this.getObjectProperty(source, this.path);
},
nestedTokens() {
const groups = {};

View File

@ -38,7 +38,7 @@ export default {
inject: ['designerService'],
data() {
return {
fontSizes: ['12px', '13px', '14px', '15px', '16px', '17px', '18px'],
fontSizes: ['12px', '13px', '14px', '15px', '16px'],
fonts: ['DM Sans', 'Inter var', 'Figtree', 'Lato', 'Lexend', 'Poppins', 'Public Sans', 'Raleway', 'Roboto', 'Open Sans', 'Quicksand']
};
},