From c83ddb0b2b824fb3c0e3bb596552e98c162c78d3 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 27 Feb 2024 17:03:39 +0200 Subject: [PATCH 01/13] better v1 detection, better menu-item consistency --- src/components/menu_item.style.js | 35 ++++++++++++++++--- .../navigation/navigation_entry.vue | 14 +++++++- .../tabs/theme_tab/theme_tab.js | 2 ++ src/services/style_setter/style_setter.js | 8 ++--- src/services/theme_data/css_utils.js | 2 +- .../theme_data/theme_data_3.service.js | 8 +++-- 6 files changed, 57 insertions(+), 12 deletions(-) diff --git a/src/components/menu_item.style.js b/src/components/menu_item.style.js index 3c70bd9f4..3812f894a 100644 --- a/src/components/menu_item.style.js +++ b/src/components/menu_item.style.js @@ -30,17 +30,44 @@ export default { { state: ['active'], directives: { - background: '$mod(--bg, 5)', + background: '$mod(--bg, 10)', + opacity: 1 + } + }, + { + state: ['active', 'hover'], + directives: { + background: '$mod(--bg, 15)', opacity: 1 } }, { component: 'Text', - variant: 'normal', parent: { component: 'MenuItem', - state: ['normal', 'hover'], - variant: 'normal' + state: ['hover'] + }, + directives: { + textColor: '--link', + textAuto: 'no-preserve' + } + }, + { + component: 'Text', + parent: { + component: 'MenuItem', + state: ['active'] + }, + directives: { + textColor: '--link', + textAuto: 'no-preserve' + } + }, + { + component: 'Icon', + parent: { + component: 'MenuItem', + state: ['active'] }, directives: { textColor: '--link', diff --git a/src/components/navigation/navigation_entry.vue b/src/components/navigation/navigation_entry.vue index 1189f76d2..ac4a0c477 100644 --- a/src/components/navigation/navigation_entry.vue +++ b/src/components/navigation/navigation_entry.vue @@ -10,7 +10,7 @@ > @@ -84,11 +84,23 @@ } .main-link { + background: none; + border: none; + outline: none; + display: inline; + text-align: initial; + font-size: 100%; + font-family: inherit; + line-height: unset; + cursor: pointer; + box-sizing: content-box; + color: var(--text); flex: 1; padding: 0 1em; } .menu-icon { + color: var(--icon); margin-right: 0.8em; } diff --git a/src/components/settings_modal/tabs/theme_tab/theme_tab.js b/src/components/settings_modal/tabs/theme_tab/theme_tab.js index dd5259200..11c90b034 100644 --- a/src/components/settings_modal/tabs/theme_tab/theme_tab.js +++ b/src/components/settings_modal/tabs/theme_tab/theme_tab.js @@ -514,6 +514,7 @@ export default { this.$store.dispatch('setOption', { name: 'customTheme', value: { + themeFileVersion: this.selectedVersion, themeEngineVersion: CURRENT_VERSION, ...this.previewTheme } @@ -521,6 +522,7 @@ export default { this.$store.dispatch('setOption', { name: 'customThemeSource', value: { + themeFileVersion: this.selectedVersion, themeEngineVersion: CURRENT_VERSION, shadows: this.shadowsLocal, fonts: this.fontsLocal, diff --git a/src/services/style_setter/style_setter.js b/src/services/style_setter/style_setter.js index 52cf06edb..74d745f05 100644 --- a/src/services/style_setter/style_setter.js +++ b/src/services/style_setter/style_setter.js @@ -8,11 +8,11 @@ import { chunk } from 'lodash' export const applyTheme = async (input) => { let extraRules - if (input.themeType !== 1) { + if (input.themeFileVersion === 1) { + extraRules = convertTheme2To3(input) + } else { const { theme } = generatePreset(input) extraRules = convertTheme2To3(theme) - } else { - extraRules = convertTheme2To3(input) } const themes3 = init(extraRules, '#FFFFFF') @@ -125,7 +125,7 @@ export const getPreset = (val) => { .then((themes) => themes[val] ? themes[val] : themes['pleroma-dark']) .then((theme) => { const isV1 = Array.isArray(theme) - const data = isV1 ? { themeType: 1 } : theme.theme + const data = isV1 ? {} : theme.theme if (isV1) { const bg = hex2rgb(theme[1]) diff --git a/src/services/theme_data/css_utils.js b/src/services/theme_data/css_utils.js index f04fed425..321bc3e5a 100644 --- a/src/services/theme_data/css_utils.js +++ b/src/services/theme_data/css_utils.js @@ -155,7 +155,7 @@ export const getCssRules = (rules) => rules.map(rule => { return [ header, directives + ';', - (!rule.virtual && rule.directives.textNoCssColor !== 'yes') ? ' color: var(--text);' : '', + (rule.component === 'Text' && rule.directives.textNoCssColor !== 'yes') ? ' color: var(--text);' : '', '', virtualDirectives, footer diff --git a/src/services/theme_data/theme_data_3.service.js b/src/services/theme_data/theme_data_3.service.js index b3c4abf1e..5fd16f194 100644 --- a/src/services/theme_data/theme_data_3.service.js +++ b/src/services/theme_data/theme_data_3.service.js @@ -275,8 +275,12 @@ export const init = (extraRuleset, ultimateBackgroundColor) => { selector: cssSelector.split(/ /g).slice(0, -1).join(' '), ...combination, directives: {}, - virtualDirectives, - virtualDirectivesRaw + virtualDirectives: { + [virtualName]: getTextColorAlpha(newTextRule.directives, textColor, dynamicVars) + }, + virtualDirectivesRaw: { + [virtualName]: textColor + } } } else { computed[selector] = computed[selector] || {} From d134b691cc92d22f27efc432d77e1971cc840d42 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 27 Feb 2024 17:04:56 +0200 Subject: [PATCH 02/13] remove button-unstyled from video attachments --- src/components/attachment/attachment.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/attachment/attachment.vue b/src/components/attachment/attachment.vue index 39b1a4094..9abc26271 100644 --- a/src/components/attachment/attachment.vue +++ b/src/components/attachment/attachment.vue @@ -175,7 +175,6 @@ :is="videoTag" v-if="type === 'video' && !hidden" class="video-container" - :class="{ 'button-unstyled': 'isModal' }" :href="attachment.url" @click.stop.prevent="openModal" > From eab3bfaf0d1e99879f53ead8319892b559ab8ca6 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 27 Feb 2024 21:43:25 +0200 Subject: [PATCH 03/13] remove fallbacks from shadow control --- src/components/shadow_control/shadow_control.vue | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/components/shadow_control/shadow_control.vue b/src/components/shadow_control/shadow_control.vue index 10e6476fd..c3b956cda 100644 --- a/src/components/shadow_control/shadow_control.vue +++ b/src/components/shadow_control/shadow_control.vue @@ -219,8 +219,6 @@ diff --git a/src/components/root.style.js b/src/components/root.style.js index 97289236a..e4d330516 100644 --- a/src/components/root.style.js +++ b/src/components/root.style.js @@ -9,6 +9,7 @@ export default { 'Scrollbar', 'ScrollbarElement', 'MobileDrawer', + 'Alert', 'Button' // mobile post button ], defaultRules: [ diff --git a/src/components/underlay.style.js b/src/components/underlay.style.js index 3ed871cca..3e0e1bf1d 100644 --- a/src/components/underlay.style.js +++ b/src/components/underlay.style.js @@ -6,8 +6,7 @@ export default { // we are searching for underlay specifically or for whatever is laid on top of it. outOfTreeSelector: '.underlay', validInnerComponents: [ - 'Panel', - 'Alert' + 'Panel' ], defaultRules: [ { diff --git a/src/services/theme_data/css_utils.js b/src/services/theme_data/css_utils.js index 321bc3e5a..6f1fd0c2f 100644 --- a/src/services/theme_data/css_utils.js +++ b/src/services/theme_data/css_utils.js @@ -155,7 +155,7 @@ export const getCssRules = (rules) => rules.map(rule => { return [ header, directives + ';', - (rule.component === 'Text' && rule.directives.textNoCssColor !== 'yes') ? ' color: var(--text);' : '', + (rule.component === 'Text' && rule.state.indexOf('faint') < 0 && rule.directives.textNoCssColor !== 'yes') ? ' color: var(--text);' : '', '', virtualDirectives, footer From ec2afce97e4fa769ccf1088ae19b95fb94510930 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 27 Feb 2024 22:02:44 +0200 Subject: [PATCH 05/13] improve performance a bit and use better "worst case" color --- src/services/style_setter/style_setter.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/services/style_setter/style_setter.js b/src/services/style_setter/style_setter.js index 74d745f05..1e16d3b5e 100644 --- a/src/services/style_setter/style_setter.js +++ b/src/services/style_setter/style_setter.js @@ -15,7 +15,8 @@ export const applyTheme = async (input) => { extraRules = convertTheme2To3(theme) } - const themes3 = init(extraRules, '#FFFFFF') + // Assuming that "worst case scenario background" is panel background since it's the most likely one + const themes3 = init(extraRules, extraRules[0].directives['--bg'].split('|')[1].trim()) const head = document.head const body = document.body body.classList.add('hidden') @@ -54,7 +55,7 @@ export const applyTheme = async (input) => { styleSheet.insertRule(rule, 'index-max') }) }) - }, 50) + }, 200) }) return Promise.resolve() From f4d48e401abd7789968e0b3decd50fc62bd7bc29 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 27 Feb 2024 22:20:41 +0200 Subject: [PATCH 06/13] fix reply link being faint (didn't work before, no reason to keep it "faint" imo) --- src/components/status/status.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/status/status.vue b/src/components/status/status.vue index 7c56430f2..2a46c5b9b 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -450,7 +450,7 @@ >