Skip to content

Commit

Permalink
Support for directives
Browse files Browse the repository at this point in the history
  • Loading branch information
cagataycivici committed Dec 28, 2024
1 parent b9b026d commit 121b8fc
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
14 changes: 12 additions & 2 deletions apps/showcase/components/layout/designer/editor/DesignEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand All @@ -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];
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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']
};
},
Expand Down

0 comments on commit 121b8fc

Please sign in to comment.