palettes/style meta inconsistency

This commit is contained in:
Henry Jameson 2024-11-19 01:16:51 +02:00
commit ca5c24452e
6 changed files with 153 additions and 17 deletions

View file

@ -172,8 +172,8 @@ const AppearanceTab = {
const result = this.mergedConfig.styleCustomData
.filter(x => x.component.startsWith('@palette'))
.map(x => {
const { variant, directives } = x
const {
variant,
bg,
fg,
text,
@ -184,10 +184,10 @@ const AppearanceTab = {
cGreen,
cOrange,
wallpaper
} = x
} = directives
const result = {
name: `${meta.name}: ${variant}`,
name: `${meta.directives.name || this.$t('settings.style.themes3.palette.imported')}: ${variant}`,
bg,
fg,
text,
@ -240,12 +240,12 @@ const AppearanceTab = {
return themeVersion
},
isCustomThemeUsed () {
const { theme } = this.mergedConfig
return theme === 'custom'
const { customTheme, customThemeSource } = this.mergedConfig
return customTheme != null || customThemeSource != null
},
isCustomStyleUsed (name) {
const { style } = this.mergedConfig
return style === 'custom'
const { styleCustomData } = this.mergedConfig
return styleCustomData != null
},
...SharedComputedObject()
},

View file

@ -102,7 +102,7 @@
@click="() => setPaletteCustom(p)"
>
<label>
{{ p.name }}
{{ p.name ?? $t('settings.style.themes3.palette.user') }}
</label>
<span
v-for="c in palettesKeys"

View file

@ -86,7 +86,6 @@ export default {
exports.isActive = computed(() => {
const tabSwitcher = getCurrentInstance().parent.ctx
console.log('TABSW', tabSwitcher)
return tabSwitcher ? tabSwitcher.isActive('style') : false
})
@ -109,10 +108,12 @@ export default {
const metaRule = computed(() => ({
component: '@meta',
name: exports.name.value,
author: exports.author.value,
license: exports.license.value,
website: exports.website.value
directives: {
name: exports.name.value,
author: exports.author.value,
license: exports.license.value,
website: exports.website.value
}
}))
// ## Palette stuff
@ -190,9 +191,9 @@ export default {
return {
component: '@palette',
variant: name,
...Object
directives: Object
.entries(rest)
.filter(([k, v]) => v)
.filter(([k, v]) => v && k)
.reduce((acc, [k, v]) => ({ ...acc, [k]: v }), {})
}
})
@ -203,6 +204,7 @@ export default {
return palettes.map(({ name, ...palette }) => {
const entries = Object
.entries(palette)
.filter(([k, v]) => v && k)
.map(([slot, data]) => ` ${slot}: ${data};`)
.join('\n')
@ -561,7 +563,9 @@ export default {
const virtualDirectivesOut = computed(() => {
return [
'Root {',
...virtualDirectives.value.map(vd => ` --${vd.name}: ${vd.valType} | ${vd.value};`),
...virtualDirectives.value
.filter(vd => vd.name && vd.valType && vd.value)
.map(vd => ` --${vd.name}: ${vd.valType} | ${vd.value};`),
'}'
].join('\n')
})

View file

@ -750,6 +750,7 @@
"more_settings": "More settings",
"style": {
"custom_theme_used": "(Custom theme)",
"custom_style_used": "(Custom style)",
"stock_theme_used": "(Stock theme)",
"themes2_outdated": "Editor for Themes V2 is being phased out and will eventually be replaced with a new one that takes advantage of new Themes V3 engine. It should still work but experience might be degraded and inconsistent.",
"appearance_tab_note": "Changes on this tab do not affect the theme used, so exported theme will be different from what seen in the UI",
@ -775,7 +776,8 @@
"v2_unsupported": "Older v2 themes don't support palettes. Switch to v3 theme to make use of palettes",
"bundled": "Bundled palettes",
"style": "Palettes provided by selected style",
"user": "Custom palette"
"user": "Custom palette",
"imported": "Imported"
},
"editor": {
"title": "Style",