aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/App.scss10
-rw-r--r--src/boot/after_store.js10
-rw-r--r--src/components/emoji_reactions/emoji_reactions.vue2
-rw-r--r--src/components/mobile_nav/mobile_nav.vue8
-rw-r--r--src/components/navigation/navigation_pins.vue1
-rw-r--r--src/components/notification/notification.style.js3
-rw-r--r--src/components/settings_modal/helpers/setting.js10
-rw-r--r--src/components/settings_modal/helpers/unit_setting.js24
-rw-r--r--src/components/settings_modal/helpers/unit_setting.vue2
-rw-r--r--src/components/settings_modal/settings_modal.js3
-rw-r--r--src/components/settings_modal/settings_modal.vue12
-rw-r--r--src/components/settings_modal/settings_modal_user_content.js2
-rw-r--r--src/components/settings_modal/settings_modal_user_content.vue7
-rw-r--r--src/components/settings_modal/tabs/appearance_tab.js72
-rw-r--r--src/components/settings_modal/tabs/appearance_tab.vue180
-rw-r--r--src/components/settings_modal/tabs/general_tab.js33
-rw-r--r--src/components/settings_modal/tabs/general_tab.vue83
-rw-r--r--src/i18n/en.json19
-rw-r--r--src/modules/config.js53
-rw-r--r--src/modules/instance.js12
-rw-r--r--src/modules/interface.js14
-rw-r--r--src/panel.scss7
-rw-r--r--src/services/style_setter/style_setter.js78
-rw-r--r--src/services/theme_data/css_utils.js12
-rw-r--r--src/services/theme_data/theme2_to_theme3.js20
-rw-r--r--src/services/theme_data/theme_data_3.service.js4
26 files changed, 506 insertions, 175 deletions
diff --git a/src/App.scss b/src/App.scss
index 6e0aabca..6b8875bf 100644
--- a/src/App.scss
+++ b/src/App.scss
@@ -3,9 +3,9 @@
@import "./panel";
:root {
- --font-size: 14px;
+ --fontSize: 14px;
--status-margin: 0.75em;
- --navbar-height: 3.5rem;
+ --navbar-height: var(--navbarSize, 3.5rem);
--post-line-height: 1.4;
// Z-Index stuff
--ZI_media_modal: 9000;
@@ -20,7 +20,10 @@
}
html {
- font-size: var(--font-size);
+ font-size: var(--textSize);
+
+ --navbar-height: var(--navbarSize, 3.5rem);
+ --emoji-size: var(--emojiSize, 32px);
// overflow-x: clip causes my browser's tab to crash with SIGILL lul
}
@@ -156,6 +159,7 @@ nav {
box-shadow: var(--shadow);
box-sizing: border-box;
height: var(--navbar-height);
+ font-size: calc(var(--navbar-height) / 3.5);
position: fixed;
}
diff --git a/src/boot/after_store.js b/src/boot/after_store.js
index bcab7a66..b93e28a3 100644
--- a/src/boot/after_store.js
+++ b/src/boot/after_store.js
@@ -353,18 +353,20 @@ const afterStoreSetup = async ({ store, i18n }) => {
await setConfig({ store })
- const { customTheme, customThemeSource, forceThemeRecompilation } = store.state.config
+ const { customTheme, customThemeSource, forceThemeRecompilation, themeDebug } = store.state.config
const { theme } = store.state.instance
const customThemePresent = customThemeSource || customTheme
- if (!forceThemeRecompilation && tryLoadCache()) {
+ console.log('DEBUG INITIAL', themeDebug, forceThemeRecompilation)
+
+ if (!forceThemeRecompilation && !themeDebug && tryLoadCache()) {
store.commit('setThemeApplied')
} else {
if (customThemePresent) {
if (customThemeSource && customThemeSource.themeEngineVersion === CURRENT_VERSION) {
- applyTheme(customThemeSource)
+ applyTheme(customThemeSource, () => {}, themeDebug)
} else {
- applyTheme(customTheme)
+ applyTheme(customTheme, () => {}, themeDebug)
}
store.commit('setThemeApplied')
} else if (theme) {
diff --git a/src/components/emoji_reactions/emoji_reactions.vue b/src/components/emoji_reactions/emoji_reactions.vue
index ad4a3c0b..3ab4c125 100644
--- a/src/components/emoji_reactions/emoji_reactions.vue
+++ b/src/components/emoji_reactions/emoji_reactions.vue
@@ -79,7 +79,7 @@
margin-top: 0.25em;
flex-wrap: wrap;
- --emoji-size: calc(1.25em * var(--emojiReactionsScale, 1));
+ --emoji-size: calc(var(--emojiSize, 1.25em) * var(--emojiReactionsScale, 1));
.emoji-reaction-container {
display: flex;
diff --git a/src/components/mobile_nav/mobile_nav.vue b/src/components/mobile_nav/mobile_nav.vue
index 6e134ef2..76a90d3e 100644
--- a/src/components/mobile_nav/mobile_nav.vue
+++ b/src/components/mobile_nav/mobile_nav.vue
@@ -129,7 +129,7 @@
.mobile-nav {
display: grid;
line-height: var(--navbar-height);
- grid-template-rows: 50px;
+ grid-template-rows: var(--navbar-height);
grid-template-columns: 2fr auto;
width: 100%;
box-sizing: border-box;
@@ -190,8 +190,8 @@
justify-content: space-between;
z-index: calc(var(--ZI_navbar) + 100);
width: 100%;
- height: 50px;
- line-height: 50px;
+ height: 3.5em;
+ line-height: 3.5em;
position: absolute;
box-shadow: var(--shadow);
@@ -214,7 +214,7 @@
}
.mobile-notifications {
- margin-top: 50px;
+ margin-top: 3.5em;
width: 100vw;
height: calc(100vh - var(--navbar-height));
overflow-x: hidden;
diff --git a/src/components/navigation/navigation_pins.vue b/src/components/navigation/navigation_pins.vue
index 36eb1ebe..decd1c04 100644
--- a/src/components/navigation/navigation_pins.vue
+++ b/src/components/navigation/navigation_pins.vue
@@ -49,6 +49,7 @@
}
&.toggled {
+ margin-bottom: -4px;
border-bottom: 4px solid;
}
}
diff --git a/src/components/notification/notification.style.js b/src/components/notification/notification.style.js
index 0d36760a..c6d317d1 100644
--- a/src/components/notification/notification.style.js
+++ b/src/components/notification/notification.style.js
@@ -11,7 +11,8 @@ export default {
'RichContent',
'Input',
'Avatar',
- 'Attachment'
+ 'Attachment',
+ 'PollGraph'
],
defaultRules: []
}
diff --git a/src/components/settings_modal/helpers/setting.js b/src/components/settings_modal/helpers/setting.js
index abf9cfdf..3b3e6268 100644
--- a/src/components/settings_modal/helpers/setting.js
+++ b/src/components/settings_modal/helpers/setting.js
@@ -48,6 +48,10 @@ export default {
draftMode: {
type: Boolean,
default: undefined
+ },
+ timedApplyMode: {
+ type: Boolean,
+ default: false
}
},
inject: {
@@ -161,7 +165,11 @@ export default {
case 'admin':
return (k, v) => this.$store.dispatch('pushAdminSetting', { path: k, value: v })
default:
- return (k, v) => this.$store.dispatch('setOption', { name: k, value: v })
+ if (this.timedApplyMode) {
+ return (k, v) => this.$store.dispatch('setOptionTemporarily', { name: k, value: v })
+ } else {
+ return (k, v) => this.$store.dispatch('setOption', { name: k, value: v })
+ }
}
},
defaultState () {
diff --git a/src/components/settings_modal/helpers/unit_setting.js b/src/components/settings_modal/helpers/unit_setting.js
index c9c23cb0..daeddd81 100644
--- a/src/components/settings_modal/helpers/unit_setting.js
+++ b/src/components/settings_modal/helpers/unit_setting.js
@@ -21,15 +21,23 @@ export default {
unitSet: {
type: String,
default: 'none'
+ },
+ step: {
+ type: Number,
+ default: 1
+ },
+ resetDefault: {
+ type: Object,
+ default: null
}
},
computed: {
...Setting.computed,
stateUnit () {
- return this.state.replace(/\d+/, '')
+ return typeof this.state === 'string' ? this.state.replace(/[0-9,.]+/, '') : ''
},
stateValue () {
- return this.state.replace(/\D+/, '')
+ return typeof this.state === 'string' ? this.state.replace(/[^0-9,.]+/, '') : ''
}
},
methods: {
@@ -39,10 +47,18 @@ export default {
return this.$t(['settings', 'units', this.unitSet, value].join('.'))
},
updateValue (e) {
- this.configSink(this.path, parseInt(e.target.value) + this.stateUnit)
+ this.configSink(this.path, parseFloat(e.target.value) + this.stateUnit)
},
updateUnit (e) {
- this.configSink(this.path, this.stateValue + e.target.value)
+ let value = this.stateValue
+ const newUnit = e.target.value
+ if (this.resetDefault) {
+ const replaceValue = this.resetDefault[newUnit]
+ if (replaceValue != null) {
+ value = replaceValue
+ }
+ }
+ this.configSink(this.path, value + newUnit)
}
}
}
diff --git a/src/components/settings_modal/helpers/unit_setting.vue b/src/components/settings_modal/helpers/unit_setting.vue
index 68f52b1c..86798e04 100644
--- a/src/components/settings_modal/helpers/unit_setting.vue
+++ b/src/components/settings_modal/helpers/unit_setting.vue
@@ -13,7 +13,7 @@
:id="path"
class="input number-input"
type="number"
- step="1"
+ step="step"
:disabled="disabled"
:min="min || 0"
:value="stateValue"
diff --git a/src/components/settings_modal/settings_modal.js b/src/components/settings_modal/settings_modal.js
index ff58f2c3..63c9b24a 100644
--- a/src/components/settings_modal/settings_modal.js
+++ b/src/components/settings_modal/settings_modal.js
@@ -4,6 +4,7 @@ import AsyncComponentError from 'src/components/async_component_error/async_comp
import getResettableAsyncComponent from 'src/services/resettable_async_component.js'
import Popover from '../popover/popover.vue'
import Checkbox from 'src/components/checkbox/checkbox.vue'
+import ConfirmModal from 'src/components/confirm_modal/confirm_modal.vue'
import { library } from '@fortawesome/fontawesome-svg-core'
import { cloneDeep, isEqual } from 'lodash'
import {
@@ -53,6 +54,7 @@ const SettingsModal = {
Modal,
Popover,
Checkbox,
+ ConfirmModal,
SettingsModalUserContent: getResettableAsyncComponent(
() => import('./settings_modal_user_content.vue'),
{
@@ -165,6 +167,7 @@ const SettingsModal = {
},
computed: {
currentSaveStateNotice () {
+ console.log(this.$store.state.interface.settings.currentSaveStateNotice)
return this.$store.state.interface.settings.currentSaveStateNotice
},
modalActivated () {
diff --git a/src/components/settings_modal/settings_modal.vue b/src/components/settings_modal/settings_modal.vue
index 50859c94..90dbbde0 100644
--- a/src/components/settings_modal/settings_modal.vue
+++ b/src/components/settings_modal/settings_modal.vue
@@ -147,6 +147,18 @@
</span>
</div>
</div>
+ <teleport to="#modal">
+ <ConfirmModal
+ v-if="$store.state.interface.temporaryChangesTimeoutId"
+ :title="$t('settings.confirm_new_setting')"
+ :cancel-text="$t('settings.revert')"
+ :confirm-text="$t('settings.confirm')"
+ @cancelled="$store.state.interface.temporaryChangesRevert"
+ @accepted="$store.state.interface.temporaryChangesConfirm"
+ >
+ {{ $t('settings.confirm_new_question') }}
+ </ConfirmModal>
+ </teleport>
</Modal>
</template>
diff --git a/src/components/settings_modal/settings_modal_user_content.js b/src/components/settings_modal/settings_modal_user_content.js
index 9ac0301f..ac119006 100644
--- a/src/components/settings_modal/settings_modal_user_content.js
+++ b/src/components/settings_modal/settings_modal_user_content.js
@@ -7,6 +7,7 @@ import FilteringTab from './tabs/filtering_tab.vue'
import SecurityTab from './tabs/security_tab/security_tab.vue'
import ProfileTab from './tabs/profile_tab.vue'
import GeneralTab from './tabs/general_tab.vue'
+import AppearanceTab from './tabs/appearance_tab.vue'
import VersionTab from './tabs/version_tab.vue'
import ThemeTab from './tabs/theme_tab/theme_tab.vue'
@@ -44,6 +45,7 @@ const SettingsModalContent = {
SecurityTab,
ProfileTab,
GeneralTab,
+ AppearanceTab,
VersionTab,
ThemeTab
},
diff --git a/src/components/settings_modal/settings_modal_user_content.vue b/src/components/settings_modal/settings_modal_user_content.vue
index 0221cccb..da99f340 100644
--- a/src/components/settings_modal/settings_modal_user_content.vue
+++ b/src/components/settings_modal/settings_modal_user_content.vue
@@ -22,6 +22,13 @@
<ProfileTab />
</div>
<div
+ :label="$t('settings.appearance')"
+ icon="paint-brush"
+ data-tab-name="appearance"
+ >
+ <AppearanceTab />
+ </div>
+ <div
v-if="isLoggedIn"
:label="$t('settings.security_tab')"
icon="lock"
diff --git a/src/components/settings_modal/tabs/appearance_tab.js b/src/components/settings_modal/tabs/appearance_tab.js
new file mode 100644
index 00000000..d9a0429a
--- /dev/null
+++ b/src/components/settings_modal/tabs/appearance_tab.js
@@ -0,0 +1,72 @@
+import BooleanSetting from '../helpers/boolean_setting.vue'
+import ChoiceSetting from '../helpers/choice_setting.vue'
+import IntegerSetting from '../helpers/integer_setting.vue'
+import FloatSetting from '../helpers/float_setting.vue'
+import UnitSetting, { defaultHorizontalUnits } from '../helpers/unit_setting.vue'
+
+import SharedComputedObject from '../helpers/shared_computed_object.js'
+import ProfileSettingIndicator from '../helpers/profile_setting_indicator.vue'
+import { library } from '@fortawesome/fontawesome-svg-core'
+import {
+ faGlobe
+} from '@fortawesome/free-solid-svg-icons'
+
+library.add(
+ faGlobe
+)
+
+const AppearanceTab = {
+ data () {
+ return {
+ thirdColumnModeOptions: ['none', 'notifications', 'postform'].map(mode => ({
+ key: mode,
+ value: mode,
+ label: this.$t(`settings.third_column_mode_${mode}`)
+ })),
+ forcedRoundnessOptions: ['disabled', 'sharp', 'nonsharp', 'round'].map((mode, i) => ({
+ key: mode,
+ value: i - 1,
+ label: this.$t(`settings.forced_roundness_mode_${mode}`)
+ }))
+ }
+ },
+ components: {
+ BooleanSetting,
+ ChoiceSetting,
+ IntegerSetting,
+ FloatSetting,
+ UnitSetting,
+ ProfileSettingIndicator
+ },
+ computed: {
+ horizontalUnits () {
+ return defaultHorizontalUnits
+ },
+ columns () {
+ const mode = this.$store.getters.mergedConfig.thirdColumnMode
+
+ const notif = mode === 'none' ? [] : ['notifs']
+
+ if (this.$store.getters.mergedConfig.sidebarRight || mode === 'postform') {
+ return [...notif, 'content', 'sidebar']
+ } else {
+ return ['sidebar', 'content', ...notif]
+ }
+ },
+ instanceSpecificPanelPresent () { return this.$store.state.instance.showInstanceSpecificPanel },
+ instanceWallpaperUsed () {
+ return this.$store.state.instance.background &&
+ !this.$store.state.users.currentUser.background_image
+ },
+ instanceShoutboxPresent () { return this.$store.state.instance.shoutAvailable },
+ language: {
+ get: function () { return this.$store.getters.mergedConfig.interfaceLanguage },
+ set: function (val) {
+ this.$store.dispatch('setOption', { name: 'interfaceLanguage', value: val })
+ }
+ },
+ ...SharedComputedObject()
+ }
+}
+
+export default AppearanceTab
diff --git a/src/components/settings_modal/tabs/appearance_tab.vue b/src/components/settings_modal/tabs/appearance_tab.vue
new file mode 100644
index 00000000..5356292e
--- /dev/null
+++ b/src/components/settings_modal/tabs/appearance_tab.vue
@@ -0,0 +1,180 @@
+<template>
+ <div :label="$t('settings.general')">
+ <div class="setting-item">
+ <h2>{{ $t('settings.scale_and_layout') }}</h2>
+ <ul class="setting-list">
+ <li>
+ <UnitSetting
+ path="textSize"
+ step="0.1"
+ :units="['px', 'rem']"
+ :reset-default="{ 'px': 14, 'rem': 1 }"
+ timed-apply-mode
+ >
+ {{ $t('settings.text_size') }}
+ </UnitSetting>
+ <div>
+ <small>
+ <i18n-t
+ scope="global"
+ keypath="settings.text_size_tip"
+ tag="span"
+ >
+ <code>px</code>
+ <code>rem</code>
+ </i18n-t>
+ <br/>
+ <i18n-t
+ scope="global"
+ keypath="settings.text_size_tip2"
+ tag="span"
+ >
+ <code>14px</code>
+ </i18n-t>
+ </small>
+ </div>
+ </li>
+ <li>
+ <UnitSetting
+ path="emojiSize"
+ step="0.1"
+ :units="['px', 'rem']"
+ :reset-default="{ 'px': 32, 'rem': 2.2 }"
+ >
+ {{ $t('settings.emoji_size') }}
+ </UnitSetting>
+ <ul
+ class="setting-list suboptions"
+ >
+ <li>
+ <FloatSetting
+ v-if="user"
+ path="emojiReactionsScale"
+ expert="1"
+ >
+ {{ $t('settings.emoji_reactions_scale') }}
+ </FloatSetting>
+ </li>
+ </ul>
+ </li>
+ <li>
+ <UnitSetting
+ path="navbarSize"
+ step="0.1"
+ :units="['px', 'rem']"
+ :reset-default="{ 'px': 55, 'rem': 3.5 }"
+ >
+ {{ $t('settings.navbar_size') }}
+ </UnitSetting>
+ </li>
+ <h3>{{ $t('settings.columns') }}</h3>
+ <li>
+ <UnitSetting
+ path="panelHeaderSize"
+ step="0.1"
+ :units="['px', 'rem']"
+ :reset-default="{ 'px': 52, 'rem': 3.2 }"
+ timed-apply-mode
+ >
+ {{ $t('settings.panel_header_size') }}
+ </UnitSetting>
+ </li>
+ <li>
+ <BooleanSetting path="sidebarRight">
+ {{ $t('settings.right_sidebar') }}
+ </BooleanSetting>
+ </li>
+ <li>
+ <BooleanSetting path="navbarColumnStretch">
+ {{ $t('settings.navbar_column_stretch') }}
+ </BooleanSetting>
+ </li>
+ <li>
+ <ChoiceSetting
+ v-if="user"
+ id="thirdColumnMode"
+ path="thirdColumnMode"
+ :options="thirdColumnModeOptions"
+ >
+ {{ $t('settings.third_column_mode') }}
+ </ChoiceSetting>
+ </li>
+ <li v-if="expertLevel > 0">
+ {{ $t('settings.column_sizes') }}
+ <div class="column-settings">
+ <UnitSetting
+ v-for="column in columns"
+ :key="column"
+ :path="column + 'ColumnWidth'"
+ :units="horizontalUnits"
+ expert="1"
+ >
+ {{ $t('settings.column_sizes_' + column) }}
+ </UnitSetting>
+ </div>
+ </li>
+ <li>
+ <BooleanSetting path="disableStickyHeaders">
+ {{ $t('settings.disable_sticky_headers') }}
+ </BooleanSetting>
+ </li>
+ <li>
+ <BooleanSetting path="showScrollbars">
+ {{ $t('settings.show_scrollbars') }}
+ </BooleanSetting>
+ </li>
+ </ul>
+ </div>
+ <div class="setting-item">
+ <h2>{{ $t('settings.visual_tweaks') }}</h2>
+ <ul class="setting-list">
+ <li>
+ <ChoiceSetting
+ id="forcedRoundness"
+ path="forcedRoundness"
+ :options="forcedRoundnessOptions"
+ >
+ {{ $t('settings.force_interface_roundness') }}
+ </ChoiceSetting>
+ </li>
+ <li v-if="instanceWallpaperUsed">
+ <BooleanSetting path="hideInstanceWallpaper">
+ {{ $t('settings.hide_wallpaper') }}
+ </BooleanSetting>
+ </li>
+ <li>
+ <BooleanSetting
+ path="forceThemeRecompilation"
+ :expert="1"
+ >
+ {{ $t('settings.force_theme_recompilation_debug') }}
+ </BooleanSetting>
+ </li>
+ <li>
+ <BooleanSetting
+ path="themeDebug"
+ :expert="1"
+ >
+ {{ $t('settings.theme_debug') }}
+ </BooleanSetting>
+ </li>
+ </ul>
+ </div>
+ </div>
+</template>
+
+<script src="./appearance_tab.js"></script>
+
+<style lang="scss">
+.column-settings {
+ display: flex;
+ justify-content: space-evenly;
+ flex-wrap: wrap;
+}
+
+.column-settings .size-label {
+ display: block;
+ margin-bottom: 0.5em;
+ margin-top: 0.5em;
+}
+</style>
diff --git a/src/components/settings_modal/tabs/general_tab.js b/src/components/settings_modal/tabs/general_tab.js
index 7d701d34..96caab07 100644
--- a/src/components/settings_modal/tabs/general_tab.js
+++ b/src/components/settings_modal/tabs/general_tab.js
@@ -3,7 +3,7 @@ import ChoiceSetting from '../helpers/choice_setting.vue'
import ScopeSelector from 'src/components/scope_selector/scope_selector.vue'
import IntegerSetting from '../helpers/integer_setting.vue'
import FloatSetting from '../helpers/float_setting.vue'
-import UnitSetting, { defaultHorizontalUnits } from '../helpers/unit_setting.vue'
+import UnitSetting from '../helpers/unit_setting.vue'
import InterfaceLanguageSwitcher from 'src/components/interface_language_switcher/interface_language_switcher.vue'
import SharedComputedObject from '../helpers/shared_computed_object.js'
@@ -40,11 +40,6 @@ const GeneralTab = {
value: mode,
label: this.$t(`settings.mention_link_display_${mode}`)
})),
- thirdColumnModeOptions: ['none', 'notifications', 'postform'].map(mode => ({
- key: mode,
- value: mode,
- label: this.$t(`settings.third_column_mode_${mode}`)
- })),
userPopoverAvatarActionOptions: ['close', 'zoom', 'open'].map(mode => ({
key: mode,
value: mode,
@@ -70,9 +65,6 @@ const GeneralTab = {
ProfileSettingIndicator
},
computed: {
- horizontalUnits () {
- return defaultHorizontalUnits
- },
postFormats () {
return this.$store.state.instance.postFormats || []
},
@@ -83,29 +75,6 @@ const GeneralTab = {
label: this.$t(`post_status.content_type["${format}"]`)
}))
},
- columns () {
- const mode = this.$store.getters.mergedConfig.thirdColumnMode
-
- const notif = mode === 'none' ? [] : ['notifs']
-
- if (this.$store.getters.mergedConfig.sidebarRight || mode === 'postform') {
- return [...notif, 'content', 'sidebar']
- } else {
- return ['sidebar', 'content', ...notif]
- }
- },
- instanceSpecificPanelPresent () { return this.$store.state.instance.showInstanceSpecificPanel },
- instanceWallpaperUsed () {
- return this.$store.state.instance.background &&
- !this.$store.state.users.currentUser.background_image
- },
- instanceShoutboxPresent () { return this.$store.state.instance.shoutAvailable },
- language: {
- get: function () { return this.$store.getters.mergedConfig.interfaceLanguage },
- set: function (val) {
- this.$store.dispatch('setOption', { name: 'interfaceLanguage', value: val })
- }
- },
...SharedComputedObject()
},
methods: {
diff --git a/src/components/settings_modal/tabs/general_tab.vue b/src/components/settings_modal/tabs/general_tab.vue
index 208c49ee..4ece6cf4 100644
--- a/src/components/settings_modal/tabs/general_tab.vue
+++ b/src/components/settings_modal/tabs/general_tab.vue
@@ -15,11 +15,6 @@
{{ $t('settings.hide_isp') }}
</BooleanSetting>
</li>
- <li v-if="instanceWallpaperUsed">
- <BooleanSetting path="hideInstanceWallpaper">
- {{ $t('settings.hide_wallpaper') }}
- </BooleanSetting>
- </li>
<li>
<BooleanSetting path="stopGifs">
{{ $t('settings.stop_gifs') }}
@@ -98,53 +93,6 @@
{{ $t('settings.hide_shoutbox') }}
</BooleanSetting>
</li>
- <li>
- <h3>{{ $t('settings.columns') }}</h3>
- </li>
- <li>
- <BooleanSetting path="disableStickyHeaders">
- {{ $t('settings.disable_sticky_headers') }}
- </BooleanSetting>
- </li>
- <li>
- <BooleanSetting path="showScrollbars">
- {{ $t('settings.show_scrollbars') }}
- </BooleanSetting>
- </li>
- <li>
- <BooleanSetting path="sidebarRight">
- {{ $t('settings.right_sidebar') }}
- </BooleanSetting>
- </li>
- <li>
- <BooleanSetting path="navbarColumnStretch">
- {{ $t('settings.navbar_column_stretch') }}
- </BooleanSetting>
- </li>
- <li>
- <ChoiceSetting
- v-if="user"
- id="thirdColumnMode"
- path="thirdColumnMode"
- :options="thirdColumnModeOptions"
- >
- {{ $t('settings.third_column_mode') }}
- </ChoiceSetting>
- </li>
- <li v-if="expertLevel > 0">
- {{ $t('settings.column_sizes') }}
- <div class="column-settings">
- <UnitSetting
- v-for="column in columns"
- :key="column"
- :path="column + 'ColumnWidth'"
- :units="horizontalUnits"
- expert="1"
- >
- {{ $t('settings.column_sizes_' + column) }}
- </UnitSetting>
- </div>
- </li>
<li class="select-multiple">
<span class="label">{{ $t('settings.confirm_dialogs') }}</span>
<ul class="option-list">
@@ -201,14 +149,6 @@
<h2>{{ $t('settings.post_look_feel') }}</h2>
<ul class="setting-list">
<li>
- <BooleanSetting
- path="forceThemeRecompilation"
- :expert="1"
- >
- {{ $t('settings.force_theme_recompilation_debug') }}
- </BooleanSetting>
- </li>
- <li>
<ChoiceSetting
id="conversationDisplay"
path="conversationDisplay"
@@ -277,15 +217,6 @@
{{ $t('settings.no_rich_text_description') }}
</BooleanSetting>
</li>
- <li>
- <FloatSetting
- v-if="user"
- path="emojiReactionsScale"
- expert="1"
- >
- {{ $t('settings.emoji_reactions_scale') }}
- </FloatSetting>
- </li>
<h3>{{ $t('settings.attachments') }}</h3>
<li>
<BooleanSetting
@@ -528,17 +459,3 @@
</template>
<script src="./general_tab.js"></script>
-
-<style lang="scss">
-.column-settings {
- display: flex;
- justify-content: space-evenly;
- flex-wrap: wrap;
-}
-
-.column-settings .size-label {
- display: block;
- margin-bottom: 0.5em;
- margin-top: 0.5em;
-}
-</style>
diff --git a/src/i18n/en.json b/src/i18n/en.json
index f626e933..3116843d 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -374,6 +374,25 @@
"enter_current_password_to_confirm": "Enter your current password to confirm your identity",
"post_look_feel": "Posts Look & Feel",
"mention_links": "Mention links",
+ "appearance": "Appearance",
+ "confirm_new_setting": "Confirm new setting?",
+ "confirm_new_question": "Does this look ok? Setting will be reverted in 10 seconds.",
+ "revert": "Revert",
+ "confirm": "Confirm",
+ "text_size": "Text and interface size",
+ "text_size_tip": "Use {0} for absolute values, {1} will scale with browser default text size.",
+ "text_size_tip2": "Values other than {0} might break some things and themes",
+ "emoji_size": "Emoji size",
+ "navbar_size": "Top bar size",
+ "panel_header_size": "Panel header size",
+ "visual_tweaks": "Minor visual tweaks",
+ "force_interface_roundness": "Override interface roundness/sharpness",
+ "forced_roundness_mode_disabled": "Use theme defaults",
+ "forced_roundness_mode_sharp": "Force sharp edges",
+ "forced_roundness_mode_nonsharp": "Force not-so-sharp (1px roundness) edges",
+ "forced_roundness_mode_round": "Force round edges",
+ "theme_debug": "Show what background theme engine assumes when dealing with transparancy (DEBUG)",
+ "scale_and_layout": "Interface scale and layout",
"mfa": {
"otp": "OTP",
"setup_otp": "Setup OTP",
diff --git a/src/modules/config.js b/src/modules/config.js
index 8001b854..a977c9c5 100644
--- a/src/modules/config.js
+++ b/src/modules/config.js
@@ -115,7 +115,12 @@ export const defaultState = {
sidebarColumnWidth: '25rem',
contentColumnWidth: '45rem',
notifsColumnWidth: '25rem',
- emojiReactionsScale: 1.0,
+ emojiReactionsScale: undefined,
+ textSize: undefined, // instance default
+ emojiSize: undefined, // instance default
+ navbarSize: undefined, // instance default
+ panelHeaderSize: undefined, // instance default
+ forcedRoundness: undefined, // instance default
navbarColumnStretch: false,
greentext: undefined, // instance default
useAtIcon: undefined, // instance default
@@ -142,6 +147,7 @@ export const defaultState = {
maxDepthInThread: undefined, // instance default
autocompleteSelect: undefined, // instance default
closingDrawerMarksAsSeen: undefined, // instance default
+ themeDebug: false,
unseenAtTop: undefined, // instance default
ignoreInactionableSeen: undefined // instance default
}
@@ -173,6 +179,10 @@ const config = {
}
},
mutations: {
+ setOptionTemporarily (state, { name, value }) {
+ set(state, name, value)
+ applyConfig(state)
+ },
setOption (state, { name, value }) {
set(state, name, value)
},
@@ -203,6 +213,31 @@ const config = {
setHighlight ({ commit, dispatch }, { user, color, type }) {
commit('setHighlight', { user, color, type })
},
+ setOptionTemporarily ({ commit, dispatch, state, rootState }, { name, value }) {
+ if (rootState.interface.temporaryChangesTimeoutId !== null) {
+ console.warn('Can\'t track more than one temporary change')
+ return
+ }
+ const oldValue = state[name]
+
+ commit('setOptionTemporarily', { name, value })
+
+ const confirm = () => {
+ dispatch('setOption', { name, value })
+ commit('clearTemporaryChanges')
+ }
+
+ const revert = () => {
+ commit('setOptionTemporarily', { name, value: oldValue })
+ commit('clearTemporaryChanges')
+ }
+
+ commit('setTemporaryChanges', {
+ timeoutId: setTimeout(revert, 10000),
+ confirm,
+ revert
+ })
+ },
setOption ({ commit, dispatch, state }, { name, value }) {
const exceptions = new Set([
'useStreamingApi'
@@ -231,13 +266,25 @@ const config = {
case 'sidebarColumnWidth':
case 'contentColumnWidth':
case 'notifsColumnWidth':
+ case 'textSize':
+ case 'navbarSize':
+ case 'panelHeaderSize':
+ case 'forcedRoundness':
+ case 'emojiSize':
case 'emojiReactionsScale':
applyConfig(state)
break
case 'customTheme':
- case 'customThemeSource':
- applyTheme(value)
+ case 'customThemeSource': {
+ const { themeDebug } = state
+ applyTheme(value, () => {}, themeDebug)
break
+ }
+ case 'themeDebug': {
+ const { customTheme, customThemeSource } = state
+ applyTheme(customTheme || customThemeSource, () => {}, value)
+ break
+ }
case 'interfaceLanguage':
messages.setLanguage(this.getters.i18n, value)
dispatch('loadUnicodeEmojiData', value)
diff --git a/src/modules/instance.js b/src/modules/instance.js
index 0a5c1ae7..6997e75d 100644
--- a/src/modules/instance.js
+++ b/src/modules/instance.js
@@ -98,6 +98,12 @@ const defaultState = {
sidebarRight: false,
subjectLineBehavior: 'email',
theme: 'pleroma-dark',
+ emojiReactionsScale: 0.5,
+ textSize: '14px',
+ emojiSize: '2.2rem',
+ navbarSize: '3.5rem',
+ panelHeaderSize: '3.2rem',
+ forcedRoundness: -1,
virtualScrolling: true,
sensitiveByDefault: false,
conversationDisplay: 'linear',
@@ -377,16 +383,16 @@ const instance = {
.then(themeData => {
commit('setInstanceOption', { name: 'themeData', value: themeData })
// No need to apply theme if there's user theme already
- const { customTheme } = rootState.config
+ const { customTheme, themeDebug } = rootState.config
const { themeApplied } = rootState.interface
if (customTheme || themeApplied) return
// New theme presets don't have 'theme' property, they use 'source'
const themeSource = themeData.source
if (!themeData.theme || (themeSource && themeSource.themeEngineVersion === CURRENT_VERSION)) {
- applyTheme(themeSource)
+ applyTheme(themeSource, null, themeDebug)
} else {
- applyTheme(themeData.theme)
+ applyTheme(themeData.theme, null, themeDebug)
}
commit('setThemeApplied')
})
diff --git a/src/modules/interface.js b/src/modules/interface.js
index 39242b9d..e21b4204 100644
--- a/src/modules/interface.js
+++ b/src/modules/interface.js
@@ -1,5 +1,8 @@
const defaultState = {
themeApplied: false,
+ temporaryChangesTimeoutId: null, // used for temporary options that revert after a timeout
+ temporaryChangesConfirm: () => {}, // used for applying temporary options
+ temporaryChangesRevert: () => {}, // used for reverting temporary options
settingsModalState: 'hidden',
settingsModalLoadedUser: false,
settingsModalLoadedAdmin: false,
@@ -36,6 +39,17 @@ const interfaceMod = {
state.settings.currentSaveStateNotice = { error: true, errorData: error }
}
},
+ setTemporaryChanges (state, { timeoutId, confirm, revert }) {
+ state.temporaryChangesTimeoutId = timeoutId
+ state.temporaryChangesConfirm = confirm
+ state.temporaryChangesRevert = revert
+ },
+ clearTemporaryChanges (state) {
+ clearTimeout(state.temporaryChangesTimeoutId)
+ state.temporaryChangesTimeoutId = null
+ state.temporaryChangesConfirm = () => {}
+ state.temporaryChangesRevert = () => {}
+ },
setThemeApplied (state) {
state.themeApplied = true
},
diff --git a/src/panel.scss b/src/panel.scss
index 833e4208..6543465e 100644
--- a/src/panel.scss
+++ b/src/panel.scss
@@ -60,11 +60,12 @@
.panel-heading,
.panel-footer {
- --panel-heading-height-padding: 0.6em;
- --__panel-heading-gap: 0.5em;
- --__panel-heading-height: 3.2em;
+ --panel-heading-height-padding: calc(var(--panelHeaderSize, 3.2rem) * 0.2);
+ --__panel-heading-gap: calc(var(--panelHeaderSize) * 0.1);
+ --__panel-heading-height: var(--panelHeaderSize, 3.2em);
--__panel-heading-height-inner: calc(var(--__panel-heading-height) - 2 * var(--panel-heading-height-padding, 0));
+ font-size: calc(var(--panelHeaderSize) / 3.2);
backdrop-filter: var(--__panel-backdrop-filter);
position: relative;
box-sizing: border-box;
diff --git a/src/services/style_setter/style_setter.js b/src/services/style_setter/style_setter.js
index 83faa0b3..9e068a1e 100644
--- a/src/services/style_setter/style_setter.js
+++ b/src/services/style_setter/style_setter.js
@@ -45,7 +45,7 @@ const adoptStyleSheets = (styles) => {
// is nothing to do here.
}
-export const generateTheme = async (input, callbacks) => {
+export const generateTheme = async (input, callbacks, debug) => {
const {
onNewRule = (rule, isLazy) => {},
onLazyFinished = () => {},
@@ -61,9 +61,11 @@ export const generateTheme = async (input, callbacks) => {
}
// 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 themes3 = init(extraRules, extraRules[0].directives['--bg'].split('|')[1].trim(), debug)
- getCssRules(themes3.eager, themes3.staticVars).forEach(rule => {
+ console.log('DEBUG 2 IS', debug)
+
+ getCssRules(themes3.eager, debug).forEach(rule => {
// Hacks to support multiple selectors on same component
if (rule.match(/::-webkit-scrollbar-button/)) {
const parts = rule.split(/[{}]/g)
@@ -93,7 +95,7 @@ export const generateTheme = async (input, callbacks) => {
const processChunk = () => {
const chunk = chunks[counter]
Promise.all(chunk.map(x => x())).then(result => {
- getCssRules(result.filter(x => x), themes3.staticVars).forEach(rule => {
+ getCssRules(result.filter(x => x), debug).forEach(rule => {
if (rule.match(/\.modal-view/)) {
const parts = rule.split(/[{}]/g)
const newRule = [
@@ -152,10 +154,12 @@ export const tryLoadCache = () => {
}
}
-export const applyTheme = async (input, onFinish = (data) => {}) => {
+export const applyTheme = async (input, onFinish = (data) => {}, debug) => {
const eagerStyles = createStyleSheet(EAGER_STYLE_ID)
const lazyStyles = createStyleSheet(LAZY_STYLE_ID)
+ console.log('DEBUG IS', debug)
+
const { lazyProcessFunc } = await generateTheme(
input,
{
@@ -177,7 +181,8 @@ export const applyTheme = async (input, onFinish = (data) => {}) => {
onFinish(cache)
localStorage.setItem('pleroma-fe-theme-cache', JSON.stringify(cache))
}
- }
+ },
+ debug
)
setTimeout(lazyProcessFunc, 0)
@@ -185,15 +190,53 @@ export const applyTheme = async (input, onFinish = (data) => {}) => {
return Promise.resolve()
}
-const configColumns = ({ sidebarColumnWidth, contentColumnWidth, notifsColumnWidth, emojiReactionsScale }) =>
- ({ sidebarColumnWidth, contentColumnWidth, notifsColumnWidth, emojiReactionsScale })
+const extractStyleConfig = ({
+ sidebarColumnWidth,
+ contentColumnWidth,
+ notifsColumnWidth,
+ emojiReactionsScale,
+ emojiSize,
+ navbarSize,
+ panelHeaderSize,
+ textSize,
+ forcedRoundness
+}) => {
+ const result = {
+ sidebarColumnWidth,
+ contentColumnWidth,
+ notifsColumnWidth,
+ emojiReactionsScale,
+ emojiSize,
+ navbarSize,
+ panelHeaderSize,
+ textSize
+ }
-const defaultConfigColumns = configColumns(defaultState)
+ console.log(forcedRoundness)
+ switch (forcedRoundness) {
+ case 'disable':
+ break
+ case '0':
+ result.forcedRoundness = '0'
+ break
+ case '1':
+ result.forcedRoundness = '1px'
+ break
+ case '2':
+ result.forcedRoundness = '0.4rem'
+ break
+ default:
+ }
-export const applyConfig = (config) => {
- const columns = configColumns(config)
+ return result
+}
- if (columns === defaultConfigColumns) {
+const defaultStyleConfig = extractStyleConfig(defaultState)
+
+export const applyConfig = (input) => {
+ const config = extractStyleConfig(input)
+
+ if (config === defaultStyleConfig) {
return
}
@@ -202,16 +245,25 @@ export const applyConfig = (config) => {
body.classList.add('hidden')
const rules = Object
- .entries(columns)
+ .entries(config)
.filter(([k, v]) => v)
.map(([k, v]) => `--${k}: ${v}`).join(';')
+ document.getElementById('style-config')?.remove()
const styleEl = document.createElement('style')
+ styleEl.id = 'style-config'
head.appendChild(styleEl)
const styleSheet = styleEl.sheet
styleSheet.toString()
styleSheet.insertRule(`:root { ${rules} }`, 'index-max')
+
+ if (Object.prototype.hasOwnProperty.call(config, 'forcedRoundness')) {
+ styleSheet.insertRule(` * {
+ --roundness: var(--forcedRoundness) !important;
+ }`, 'index-max')
+ }
+
body.classList.remove('hidden')
}
diff --git a/src/services/theme_data/css_utils.js b/src/services/theme_data/css_utils.js
index a89eac3b..8423e8ac 100644
--- a/src/services/theme_data/css_utils.js
+++ b/src/services/theme_data/css_utils.js
@@ -2,11 +2,6 @@ import { convert } from 'chromatism'
import { hex2rgb, rgba2css } from '../color_convert/color_convert.js'
-// This changes what backgrounds are used to "stacked" solid colors so you can see
-// what theme engine "thinks" is actual background color is for purposes of text color
-// generation and for when --stacked variable is used
-const DEBUG = false
-
export const parseCssShadow = (text) => {
const dimensions = /(\d[a-z]*\s?){2,4}/.exec(text)?.[0]
const inset = /inset/.exec(text)?.[0]
@@ -66,7 +61,10 @@ export const getCssShadowFilter = (input) => {
.join(' ')
}
-export const getCssRules = (rules) => rules.map(rule => {
+// `debug` changes what backgrounds are used to "stacked" solid colors so you can see
+// what theme engine "thinks" is actual background color is for purposes of text color
+// generation and for when --stacked variable is used
+export const getCssRules = (rules, debug) => rules.map(rule => {
let selector = rule.selector
if (!selector) {
selector = 'html'
@@ -93,7 +91,7 @@ export const getCssRules = (rules) => rules.map(rule => {
].join(';\n ')
}
case 'background': {
- if (DEBUG) {
+ if (debug) {
return `
--background: ${getCssColorString(rule.dynamicVars.stacked)};
background-color: ${getCssColorString(rule.dynamicVars.stacked)};
diff --git a/src/services/theme_data/theme2_to_theme3.js b/src/services/theme_data/theme2_to_theme3.js
index 6ea12836..2c97d18b 100644
--- a/src/services/theme_data/theme2_to_theme3.js
+++ b/src/services/theme_data/theme2_to_theme3.js
@@ -138,7 +138,7 @@ export const convertTheme2To3 = (data) => {
Object.keys(data.opacity || {}).forEach(key => {
if (!opacityKeys.has(key) || data.opacity[key] === undefined) return null
const originalOpacity = data.opacity[key]
- const rule = {}
+ const rule = { source: '2to3' }
switch (key) {
case 'alert':
@@ -213,7 +213,7 @@ export const convertTheme2To3 = (data) => {
Object.keys(data.radii || {}).forEach(key => {
if (!radiiKeys.has(key) || data.radii[key] === undefined) return null
const originalRadius = data.radii[key]
- const rule = {}
+ const rule = { source: '2to3' }
switch (key) {
case 'btn':
@@ -266,7 +266,7 @@ export const convertTheme2To3 = (data) => {
Object.keys(data.fonts || {}).forEach(key => {
if (!fontsKeys.has(key)) return
const originalFont = data.fonts[key].family
- const rule = {}
+ const rule = { source: '2to3' }
switch (key) {
case 'interface':
@@ -300,7 +300,7 @@ export const convertTheme2To3 = (data) => {
Object.keys(data.shadows || {}).forEach(key => {
if (!shadowsKeys.has(key)) return
const originalShadow = data.shadows[key]
- const rule = {}
+ const rule = { source: '2to3' }
switch (key) {
case 'panel':
@@ -369,7 +369,7 @@ export const convertTheme2To3 = (data) => {
const extendedRules = Object.entries(extendedBaseKeys).map(([prefix, keys]) => {
if (nonComponentPrefixes.has(prefix)) return null
- const rule = {}
+ const rule = { source: '2to3' }
if (prefix === 'alertPopup') {
rule.component = 'Alert'
rule.parent = { component: 'Popover' }
@@ -402,7 +402,7 @@ export const convertTheme2To3 = (data) => {
const leftoverKey = key.replace(prefix, '')
const parts = (leftoverKey || 'Bg').match(/[A-Z][a-z]*/g)
const last = parts.slice(-1)[0]
- let newRule = { directives: {} }
+ let newRule = { source: '2to3', directives: {} }
let variantArray = []
switch (last) {
@@ -462,12 +462,12 @@ export const convertTheme2To3 = (data) => {
if (prefix === 'popover' && variantArray[0] === 'Post') {
newRule.component = 'Post'
- newRule.parent = { component: 'Popover' }
+ newRule.parent = { source: '2to3hack', component: 'Popover' }
variantArray = variantArray.filter(x => x !== 'Post')
}
if (prefix === 'selectedMenu' && variantArray[0] === 'Popover') {
- newRule.parent = { component: 'Popover' }
+ newRule.parent = { source: '2to3hack', component: 'Popover' }
variantArray = variantArray.filter(x => x !== 'Popover')
}
@@ -477,12 +477,12 @@ export const convertTheme2To3 = (data) => {
case 'alert': {
const hasPanel = variantArray.find(x => x === 'Panel')
if (hasPanel) {
- newRule.parent = { component: 'PanelHeader' }
+ newRule.parent = { source: '2to3hack', component: 'PanelHeader', parent: newRule.parent }
variantArray = variantArray.filter(x => x !== 'Panel')
}
const hasTop = variantArray.find(x => x === 'Top') // TopBar
if (hasTop) {
- newRule.parent = { component: 'TopBar' }
+ newRule.parent = { source: '2to3hack', component: 'TopBar', parent: newRule.parent }
variantArray = variantArray.filter(x => x !== 'Top' && x !== 'Bar')
}
break
diff --git a/src/services/theme_data/theme_data_3.service.js b/src/services/theme_data/theme_data_3.service.js
index 047ba8a2..d1043c52 100644
--- a/src/services/theme_data/theme_data_3.service.js
+++ b/src/services/theme_data/theme_data_3.service.js
@@ -149,14 +149,14 @@ const ruleToSelector = genericRuleToSelector(components)
export const getEngineChecksum = () => engineChecksum
-export const init = (extraRuleset, ultimateBackgroundColor) => {
+export const init = (extraRuleset, ultimateBackgroundColor, debug) => {
const staticVars = {}
const stacked = {}
const computed = {}
const rulesetUnsorted = [
...Object.values(components)
- .map(c => (c.defaultRules || []).map(r => ({ component: c.name, ...r })))
+ .map(c => (c.defaultRules || []).map(r => ({ component: c.name, ...r, source: 'Built-in' })))
.reduce((acc, arr) => [...acc, ...arr], []),
...extraRuleset
].map(rule => {