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'], inject: ['designerService'],
watch: {
$route: {
handler() {
if (!this.isComponentRoute && this.$appState.designer.activeTab === '2') {
this.$appState.designer.activeTab = '0';
}
}
}
},
methods: { methods: {
onKeyDown(event) { onKeyDown(event) {
if (event.code === 'Enter' || event.code === 'NumpadEnter') { if (event.code === 'Enter' || event.code === 'NumpadEnter') {
@ -92,9 +101,10 @@ export default {
}, },
computed: { computed: {
isComponentRoute() { 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; return this.$route.name;
}, },
isComponentRoute() { 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() { 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() { lightTokens() {
return this.$appState.designer.theme?.preset?.components[this.componentKey].colorScheme.light; return this.tokens.colorScheme?.light;
}, },
darkTokens() { darkTokens() {
return this.$appState.designer.theme?.preset?.components[this.componentKey].colorScheme.dark; return this.tokens.colorScheme?.dark;
}, },
hasColorScheme() { hasColorScheme() {
return this.tokens.colorScheme != undefined; return this.tokens.colorScheme != undefined;

View File

@ -66,7 +66,9 @@ export default {
.join(' '); .join(' ');
}, },
tokens() { 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() { nestedTokens() {
const groups = {}; const groups = {};

View File

@ -38,7 +38,7 @@ export default {
inject: ['designerService'], inject: ['designerService'],
data() { data() {
return { 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'] fonts: ['DM Sans', 'Inter var', 'Figtree', 'Lato', 'Lexend', 'Poppins', 'Public Sans', 'Raleway', 'Roboto', 'Open Sans', 'Quicksand']
}; };
}, },