From 694662621750ba47450a02b71701b1afa4a5c3e9 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Sat, 5 Oct 2024 19:24:32 +0300 Subject: [PATCH 01/54] fix? --- src/modules/interface.js | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/modules/interface.js b/src/modules/interface.js index 917610599..7511d780f 100644 --- a/src/modules/interface.js +++ b/src/modules/interface.js @@ -530,7 +530,7 @@ const interfaceMod = { return result })() - const theme2ruleset = themeDataUsed && convertTheme2To3(generatePreset(themeDataUsed).source) + const theme2ruleset = themeDataUsed && convertTheme2To3(normalizeThemeData(themeDataUsed)) const hacks = [] Object.entries(theme3hacks).forEach(([key, value]) => { @@ -614,19 +614,6 @@ const interfaceMod = { export default interfaceMod export const normalizeThemeData = (input) => { - if (Array.isArray(input)) { - const themeData = { colors: {} } - themeData.colors.bg = input[1] - themeData.colors.fg = input[2] - themeData.colors.text = input[3] - themeData.colors.link = input[4] - themeData.colors.cRed = input[5] - themeData.colors.cGreen = input[6] - themeData.colors.cBlue = input[7] - themeData.colors.cOrange = input[8] - return generatePreset(themeData).source || generatePreset(themeData).theme - } - let themeData, themeSource if (input.themeFileVerison === 1) { From f161cc41130873ba3ec021e3897f9ea6b4048eb9 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Sat, 5 Oct 2024 19:31:04 +0300 Subject: [PATCH 02/54] restore sgsgb palettes --- static/palettes/index.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/static/palettes/index.json b/static/palettes/index.json index 63fbad5a5..96aa0fafd 100644 --- a/static/palettes/index.json +++ b/static/palettes/index.json @@ -1,4 +1,6 @@ { + "sigsegv": [ "シグセグV", "#100f32", "#221548", "#e6fcff", "#fe9df8", "#fd3f3f", "#cafeb8", "#9fd3fe", "#ffe96b" ], + "sigsegv2": [ "SigSeg部", "#003238", "#00616c", "#e8f9fb", "#81ffff", "#ff7b66", "#4ae619", "#00ddff", "#ccef53" ], "pleroma-dark": [ "Pleroma Dark", "#121a24", "#182230", "#b9b9ba", "#d8a070", "#d31014", "#0fa00f", "#0095ff", "#ffa500" ], "pleroma-light": [ "Pleroma Light", "#f2f4f6", "#dbe0e8", "#304055", "#f86f0f", "#d31014", "#0fa00f", "#0095ff", "#ffa500" ], "classic-dark": { From 761cc52be7c96d7417a4f61e01cebfc8ffaaeaed Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Sat, 5 Oct 2024 19:31:57 +0300 Subject: [PATCH 03/54] palette and style for v3 --- static/config.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/static/config.json b/static/config.json index 46a4857d1..49258e4d9 100644 --- a/static/config.json +++ b/static/config.json @@ -25,5 +25,7 @@ "sidebarRight": false, "subjectLineBehavior": "email", "theme": null, + "style": "stock", + "palette": "sigsegv2" "webPushNotifications": false } From 104bc8c86e939f92dd4d4911de56bb566a71b71b Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Sun, 6 Oct 2024 01:57:39 +0300 Subject: [PATCH 04/54] oops --- static/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/config.json b/static/config.json index 49258e4d9..4ab97358c 100644 --- a/static/config.json +++ b/static/config.json @@ -26,6 +26,6 @@ "subjectLineBehavior": "email", "theme": null, "style": "stock", - "palette": "sigsegv2" + "palette": "sigsegv2", "webPushNotifications": false } From 42087a564f0dc4ee84bd42e6ae32fc976ac5cfb2 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 19 Nov 2024 03:18:52 +0200 Subject: [PATCH 05/54] bundling theme now works and so are bundled style's palettes --- src/components/button.style.js | 7 + .../settings_modal/tabs/appearance_tab.js | 64 ++++++-- .../settings_modal/tabs/appearance_tab.vue | 28 +++- src/modules/config.js | 2 + src/modules/interface.js | 153 ++++++++++-------- src/services/style_setter/style_setter.js | 7 +- .../{Redmond DX.json => Redmond DX.piss} | 14 +- static/styles/index.json | 2 +- 8 files changed, 171 insertions(+), 106 deletions(-) rename static/styles/{Redmond DX.json => Redmond DX.piss} (93%) diff --git a/src/components/button.style.js b/src/components/button.style.js index 248da8bbd..747cfd5eb 100644 --- a/src/components/button.style.js +++ b/src/components/button.style.js @@ -89,6 +89,13 @@ 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 076bb995f..711b1961b 100644 --- a/src/components/settings_modal/tabs/appearance_tab.js +++ b/src/components/settings_modal/tabs/appearance_tab.js @@ -36,6 +36,7 @@ const AppearanceTab = { return { availableStyles: [], bundledPalettes: [], + compilationCache: {}, fileImporter: newImporter({ accept: '.json, .piss', validator: this.importValidator, @@ -84,6 +85,8 @@ 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`] @@ -102,6 +105,13 @@ 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' }) @@ -166,11 +176,15 @@ const AppearanceTab = { ] }, stylePalettes () { - 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')) + 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')) .map(x => { const { variant, directives } = x const { @@ -307,7 +321,7 @@ const AppearanceTab = { return key === palette }, setStyle (name) { - this.$store.dispatch('setTheme', name) + this.$store.dispatch('setStyle', name) }, setTheme (name) { this.$store.dispatch('setTheme', name) @@ -323,18 +337,30 @@ const AppearanceTab = { resetTheming (name) { this.$store.dispatch('setStyle', 'stock') }, - previewTheme (key, input) { + previewTheme (key, version, input) { let theme3 - if (input) { - const style = normalizeThemeData(input) - const theme2 = convertTheme2To3(style) - theme3 = init({ - inputRuleset: theme2, - ultimateBackgroundColor: '#000000', - liteMode: true, - debug: true, - onlyNormalState: true - }) + 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 + }) + } } else { theme3 = init({ inputRuleset: [], @@ -345,6 +371,10 @@ 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 32e0a37fa..547b72c07 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 @@ +