diff --git a/src/components/button.style.js b/src/components/button.style.js
index 747cfd5eb..248da8bbd 100644
--- a/src/components/button.style.js
+++ b/src/components/button.style.js
@@ -89,13 +89,6 @@ export default {
shadow: ['--buttonDefaultHoverGlow', '--buttonPressedBevel']
}
},
- {
- state: ['toggled', 'disabled'],
- directives: {
- background: '$blend(--inheritedBackground 0.25 --parent)',
- shadow: ['--buttonPressedBevel']
- }
- },
{
state: ['disabled'],
directives: {
diff --git a/src/components/settings_modal/tabs/appearance_tab.js b/src/components/settings_modal/tabs/appearance_tab.js
index 711b1961b..b4b401574 100644
--- a/src/components/settings_modal/tabs/appearance_tab.js
+++ b/src/components/settings_modal/tabs/appearance_tab.js
@@ -16,7 +16,6 @@ import {
getCssRules,
getScopedVersion
} from 'src/services/theme_data/css_utils.js'
-import { deserialize } from 'src/services/theme_data/iss_deserializer.js'
import SharedComputedObject from '../helpers/shared_computed_object.js'
import ProfileSettingIndicator from '../helpers/profile_setting_indicator.vue'
@@ -36,12 +35,10 @@ const AppearanceTab = {
return {
availableStyles: [],
bundledPalettes: [],
- compilationCache: {},
fileImporter: newImporter({
accept: '.json, .piss',
validator: this.importValidator,
onImport: this.onImport,
- parser: this.importParser,
onImportFailure: this.onImportFailure
}),
palettesKeys: [
@@ -85,8 +82,6 @@ const AppearanceTab = {
PaletteEditor
},
mounted () {
- this.$store.dispatch('getThemeData')
-
const updateIndex = (resource) => {
const capitalizedResource = resource[0].toUpperCase() + resource.slice(1)
const currentIndex = this.$store.state.instance[`${resource}sIndex`]
@@ -105,13 +100,6 @@ const AppearanceTab = {
})
}
- updateIndex('style').then(styles => {
- styles.forEach(([key, stylePromise]) => stylePromise.then(data => {
- const meta = data.find(x => x.component === '@meta')
- this.availableStyles.push({ key, data, name: meta.directives.name, version: 'v3' })
- }))
- })
-
updateIndex('theme').then(themes => {
themes.forEach(([key, themePromise]) => themePromise.then(data => {
this.availableStyles.push({ key, data, name: data.name, version: 'v2' })
@@ -176,18 +164,14 @@ const AppearanceTab = {
]
},
stylePalettes () {
- const ruleset = this.$store.state.interface.styleDataUsed || []
- console.log(
- 'ASR',
- this.$store.state.interface.paletteDataUsed,
- this.$store.state.interface.styleDataUsed
- )
- if (!ruleset && ruleset.length === 0) return
- const meta = ruleset.find(x => x.component === '@meta')
- const result = ruleset.filter(x => x.component.startsWith('@palette'))
+ if (!this.mergedConfig.styleCustomData) return
+ const meta = this.mergedConfig.styleCustomData
+ .find(x => x.component === '@meta')
+ const result = this.mergedConfig.styleCustomData
+ .filter(x => x.component.startsWith('@palette'))
.map(x => {
- const { variant, directives } = x
const {
+ variant,
bg,
fg,
text,
@@ -198,10 +182,10 @@ const AppearanceTab = {
cGreen,
cOrange,
wallpaper
- } = directives
+ } = x
const result = {
- name: `${meta.directives.name || this.$t('settings.style.themes3.palette.imported')}: ${variant}`,
+ name: `${meta.name}: ${variant}`,
bg,
fg,
text,
@@ -254,12 +238,12 @@ const AppearanceTab = {
return themeVersion
},
isCustomThemeUsed () {
- const { customTheme, customThemeSource } = this.mergedConfig
- return customTheme != null || customThemeSource != null
+ const { theme } = this.mergedConfig
+ return theme === 'custom'
},
isCustomStyleUsed (name) {
- const { styleCustomData } = this.mergedConfig
- return styleCustomData != null
+ const { style } = this.mergedConfig
+ return style === 'custom'
},
...SharedComputedObject()
},
@@ -279,33 +263,21 @@ const AppearanceTab = {
importFile () {
this.fileImporter.importData()
},
- importParser (file, filename) {
- if (filename.endsWith('.json')) {
- return JSON.parse(file)
- } else if (filename.endsWith('.piss')) {
- return deserialize(file)
- }
- },
onImport (parsed, filename) {
if (filename.endsWith('.json')) {
this.$store.dispatch('setThemeCustom', parsed.source || parsed.theme)
- } else if (filename.endsWith('.piss')) {
- this.$store.dispatch('setStyleCustom', parsed)
+ this.$store.dispatch('applyTheme')
}
+
+ // this.loadTheme(parsed, 'file', forceSource)
},
onImportFailure (result) {
- console.error('Failure importing theme:', result)
this.$store.dispatch('pushGlobalNotice', { messageKey: 'settings.invalid_theme_imported', level: 'error' })
},
importValidator (parsed, filename) {
if (filename.endsWith('.json')) {
const version = parsed._pleroma_theme_version
return version >= 1 || version <= 2
- } else if (filename.endsWith('.piss')) {
- if (!Array.isArray(parsed)) return false
- if (parsed.length < 1) return false
- if (parsed.find(x => x.component === '@meta') == null) return false
- return true
}
},
isThemeActive (key) {
@@ -321,7 +293,7 @@ const AppearanceTab = {
return key === palette
},
setStyle (name) {
- this.$store.dispatch('setStyle', name)
+ this.$store.dispatch('setTheme', name)
},
setTheme (name) {
this.$store.dispatch('setTheme', name)
@@ -337,30 +309,18 @@ const AppearanceTab = {
resetTheming (name) {
this.$store.dispatch('setStyle', 'stock')
},
- previewTheme (key, version, input) {
+ previewTheme (key, input) {
let theme3
- if (this.compilationCache[key]) {
- theme3 = this.compilationCache[key]
- } else if (input) {
- if (version === 'v2') {
- const style = normalizeThemeData(input)
- const theme2 = convertTheme2To3(style)
- theme3 = init({
- inputRuleset: theme2,
- ultimateBackgroundColor: '#000000',
- liteMode: true,
- debug: true,
- onlyNormalState: true
- })
- } else if (version === 'v3') {
- theme3 = init({
- inputRuleset: input,
- ultimateBackgroundColor: '#000000',
- liteMode: true,
- debug: true,
- onlyNormalState: true
- })
- }
+ if (input) {
+ const style = normalizeThemeData(input)
+ const theme2 = convertTheme2To3(style)
+ theme3 = init({
+ inputRuleset: theme2,
+ ultimateBackgroundColor: '#000000',
+ liteMode: true,
+ debug: true,
+ onlyNormalState: true
+ })
} else {
theme3 = init({
inputRuleset: [],
@@ -371,10 +331,6 @@ const AppearanceTab = {
})
}
- if (!this.compilationCache[key]) {
- this.compilationCache[key] = theme3
- }
-
return getScopedVersion(
getCssRules(theme3.eager),
'#theme-preview-' + key
diff --git a/src/components/settings_modal/tabs/appearance_tab.vue b/src/components/settings_modal/tabs/appearance_tab.vue
index 547b72c07..6ec84eb28 100644
--- a/src/components/settings_modal/tabs/appearance_tab.vue
+++ b/src/components/settings_modal/tabs/appearance_tab.vue
@@ -18,7 +18,7 @@
@@ -30,7 +30,7 @@
-