Compare commits

..

12 commits

Author SHA1 Message Date
Henry Jameson
76059fbd40 Merge branch 'appearance-tab' into shigusegubu-themes3 2024-07-22 00:00:16 +03:00
Henry Jameson
c966364d1c changelogs 2024-07-22 00:00:07 +03:00
Henry Jameson
df22cc4bdd update icon 2024-07-21 23:53:24 +03:00
Henry Jameson
837f53a5c1 Merge branch 'appearance-tab' into shigusegubu-themes3 2024-07-21 23:50:13 +03:00
Henry Jameson
55d7ec4130 remove unused files 2024-07-21 23:49:37 +03:00
Henry Jameson
e984004c42 localization file fix 2024-07-21 23:49:13 +03:00
Henry Jameson
041da0cdff fix step not working in unit input 2024-07-21 23:46:54 +03:00
Henry Jameson
72b252c803 cleanup 2024-07-21 23:46:01 +03:00
Henry Jameson
4d3d075151 fix font selector losing list of local fonts when selecting one 2024-07-21 23:45:21 +03:00
Henry Jameson
665faf892a font overrides + fixes for font component 2024-07-21 23:27:11 +03:00
Henry Jameson
895261e112 comment out toposort console debug 2024-07-21 22:55:59 +03:00
Henry Jameson
c87d85edd8 cleanup console logs 2024-07-21 22:55:28 +03:00
17 changed files with 87 additions and 26 deletions

View file

@ -0,0 +1 @@
Reorganized Settings modal to move out visual stuff into Appearance tab

View file

@ -0,0 +1 @@
Ability to change size of emoji

View file

@ -0,0 +1 @@
Bug with firefox and redmond themes

View file

@ -0,0 +1 @@
Theme selector with visual previews of the theme

1
changelog.d/ui-scale.add Normal file
View file

@ -0,0 +1 @@
Ability to resize UI (and certain components) scale independent of browser/text scale

View file

@ -0,0 +1 @@
Ability to override certain aspects of UI style independent of theme used (UI roundness, fonts, underlay)

View file

@ -50,10 +50,10 @@ export default {
return typeof this.modelValue !== 'undefined' return typeof this.modelValue !== 'undefined'
}, },
localFontsList () { localFontsList () {
return this.$store.state.interface.localFonts?.values() return this.$store.state.interface.localFonts
}, },
localFontsSize () { localFontsSize () {
return this.$store.state.interface.localFonts?.size return this.$store.state.interface.localFonts?.length
} }
} }
} }

View file

@ -82,9 +82,9 @@
</button> </button>
<Select <Select
:id="name + '-local-font-switcher'" :id="name + '-local-font-switcher'"
:model-value="modelValue.family" :model-value="modelValue?.family"
class="custom-font" class="custom-font"
@update:modelValue="$emit('update:modelValue', { ...(modelValue || {}), family: $event.target.value })" @update:modelValue="v => $emit('update:modelValue', { ...(modelValue || {}), family: v })"
> >
<optgroup <optgroup
:label="$t('settings.style.themes3.font.group-builtin')" :label="$t('settings.style.themes3.font.group-builtin')"

View file

@ -13,7 +13,7 @@
:id="path" :id="path"
class="input number-input" class="input number-input"
type="number" type="number"
step="step" :step="step"
:disabled="disabled" :disabled="disabled"
:min="min || 0" :min="min || 0"
:value="stateValue" :value="stateValue"

View file

@ -20,7 +20,8 @@ import {
faBell, faBell,
faDownload, faDownload,
faEyeSlash, faEyeSlash,
faInfo faInfo,
faWindowRestore
} from '@fortawesome/free-solid-svg-icons' } from '@fortawesome/free-solid-svg-icons'
library.add( library.add(
@ -31,7 +32,8 @@ library.add(
faBell, faBell,
faDownload, faDownload,
faEyeSlash, faEyeSlash,
faInfo faInfo,
faWindowRestore
) )
const SettingsModalContent = { const SettingsModalContent = {

View file

@ -23,7 +23,7 @@
</div> </div>
<div <div
:label="$t('settings.appearance')" :label="$t('settings.appearance')"
icon="paint-brush" icon="window-restore"
data-tab-name="appearance" data-tab-name="appearance"
> >
<AppearanceTab /> <AppearanceTab />

View file

@ -151,9 +151,21 @@ const AppearanceTab = {
...SharedComputedObject() ...SharedComputedObject()
}, },
methods: { methods: {
updateFont (key, value) {
console.log(key, value)
this.$store.dispatch('setOption', {
name: 'theme3hacks',
value: {
...this.mergedConfig.theme3hacks,
fonts: {
...this.mergedConfig.theme3hacks.fonts,
[key]: value
}
}
})
},
isThemeActive (key) { isThemeActive (key) {
const { theme } = this.mergedConfig const { theme } = this.mergedConfig
console.log(key, theme)
return key === theme return key === theme
}, },
setTheme (name) { setTheme (name) {

View file

@ -73,42 +73,42 @@
<ul class="setting-list"> <ul class="setting-list">
<li> <li>
<FontControl <FontControl
:model-value="fontsOverride.interface" :model-value="mergedConfig.theme3hacks.fonts.interface"
name="ui" name="ui"
:label="$t('settings.style.fonts.components.interface')" :label="$t('settings.style.fonts.components.interface')"
:fallback="{ family: 'sans-serif' }" :fallback="{ family: 'sans-serif' }"
no-inherit="1" no-inherit="1"
@update:modelValue="v => $store.dispatch('setOption', { name: 'fontsOverride', value: { ...fontsOverride, interface: v } })" @update:modelValue="v => updateFont('interface', v)"
/> />
</li> </li>
<li> <li>
<FontControl <FontControl
v-if="expertLevel > 0" v-if="expertLevel > 0"
:model-value="fontsOverride.input" :model-value="mergedConfig.theme3hacks.fonts.input"
name="input" name="input"
:fallback="{ family: 'inherit' }" :fallback="{ family: 'inherit' }"
:label="$t('settings.style.fonts.components.input')" :label="$t('settings.style.fonts.components.input')"
@update:modelValue="v => $store.dispatch('setOption', { name: 'fontsOverride', value: { ...fontsOverride, input: v } })" @update:modelValue="v => updateFont('input', v)"
/> />
</li> </li>
<li> <li>
<FontControl <FontControl
v-if="expertLevel > 0" v-if="expertLevel > 0"
:model-value="fontsOverride.post" :model-value="mergedConfig.theme3hacks.fonts.post"
name="post" name="post"
:fallback="{ family: 'inherit' }" :fallback="{ family: 'inherit' }"
:label="$t('settings.style.fonts.components.post')" :label="$t('settings.style.fonts.components.post')"
@update:modelValue="v => $store.dispatch('setOption', { name: 'fontsOverride', value: { ...fontsOverride, post: v } })" @update:modelValue="v => updateFont('post', v)"
/> />
</li> </li>
<li> <li>
<FontControl <FontControl
v-if="expertLevel > 0" v-if="expertLevel > 0"
:model-value="fontsOverride.postCode" :model-value="mergedConfig.theme3hacks.fonts.monospace"
name="postCode" name="postCode"
:fallback="{ family: 'monospace' }" :fallback="{ family: 'monospace' }"
:label="$t('settings.style.fonts.components.postCode')" :label="$t('settings.style.fonts.components.monospace')"
@update:modelValue="v => $store.dispatch('setOption', { name: 'fontsOverride', value: { ...fontsOverride, postCode: v } })" @update:modelValue="v => updateFont('monospace', v)"
/> />
</li> </li>
</ul> </ul>

View file

@ -898,7 +898,7 @@
"interface": "Interface", "interface": "Interface",
"input": "Input fields", "input": "Input fields",
"post": "Post text", "post": "Post text",
"postCode": "Monospaced text in a post (rich text)" "monospace": "Monospaced text"
}, },
"family": "Font name", "family": "Font name",
"size": "Size (in px)", "size": "Size (in px)",

View file

@ -49,10 +49,14 @@ export const defaultState = {
// V3 // V3
themeDebug: false, // debug mode that uses computed backgrounds instead of real ones to debug contrast functions themeDebug: false, // debug mode that uses computed backgrounds instead of real ones to debug contrast functions
forceThemeRecompilation: false, // flag that forces recompilation on boot even if cache exists forceThemeRecompilation: false, // flag that forces recompilation on boot even if cache exists
palette: null, // not used yet, will be used for V3
theme3hacks: { // Hacks, user overrides that are independent of theme used theme3hacks: { // Hacks, user overrides that are independent of theme used
underlay: 'none', underlay: 'none',
badgeColor: null fonts: {
interface: undefined,
input: undefined,
post: undefined,
monospace: undefined
}
}, },
hideISP: false, hideISP: false,
@ -147,7 +151,6 @@ export const defaultState = {
navbarSize: undefined, // instance default navbarSize: undefined, // instance default
panelHeaderSize: undefined, // instance default panelHeaderSize: undefined, // instance default
forcedRoundness: undefined, // instance default forcedRoundness: undefined, // instance default
fontsOverride: undefined, // instance default
navbarColumnStretch: false, navbarColumnStretch: false,
greentext: undefined, // instance default greentext: undefined, // instance default
useAtIcon: undefined, // instance default useAtIcon: undefined, // instance default

View file

@ -112,7 +112,8 @@ const interfaceMod = {
state.lastTimeline = value state.lastTimeline = value
}, },
setFontsList (state, value) { setFontsList (state, value) {
state.localFonts = new Set(value.map(font => font.family)) // Set is used here so that we filter out duplicate fonts (possibly same font but with different weight)
state.localFonts = [...(new Set(value.map(font => font.family))).values()]
} }
}, },
actions: { actions: {
@ -196,7 +197,6 @@ const interfaceMod = {
window window
.queryLocalFonts() .queryLocalFonts()
.then((fonts) => { .then((fonts) => {
console.log(fonts)
commit('setFontsList', fonts) commit('setFontsList', fonts)
}) })
.catch((e) => { .catch((e) => {
@ -275,6 +275,46 @@ const interfaceMod = {
Object.entries(theme3hacks).forEach(([key, value]) => { Object.entries(theme3hacks).forEach(([key, value]) => {
switch (key) { switch (key) {
case 'fonts': {
Object.entries(theme3hacks.fonts).forEach(([fontKey, font]) => {
if (!font?.family) return
switch (fontKey) {
case 'interface':
hacks.push({
component: 'Root',
directives: {
'--font': 'generic | ' + font.family
}
})
break
case 'input':
hacks.push({
component: 'Input',
directives: {
'--font': 'generic | ' + font.family
}
})
break
case 'post':
hacks.push({
component: 'RichContent',
directives: {
'--font': 'generic | ' + font.family
}
})
break
case 'monospace':
hacks.push({
component: 'Root',
directives: {
'--monoFont': 'generic | ' + font.family
}
})
break
}
})
break
}
case 'underlay': { case 'underlay': {
if (value !== 'none') { if (value !== 'none') {
const newRule = { const newRule = {
@ -288,7 +328,6 @@ const interfaceMod = {
if (value === 'transparent') { if (value === 'transparent') {
newRule.directives.opacity = 0 newRule.directives.opacity = 0
} }
console.log('NEW RULE', newRule)
hacks.push(newRule) hacks.push(newRule)
} }
break break

View file

@ -117,7 +117,6 @@ export const topoSort = (
// Put it into the output list // Put it into the output list
output.push(node) output.push(node)
} else if (grays.has(node)) { } else if (grays.has(node)) {
console.debug('Cyclic depenency in topoSort, ignoring')
output.push(node) output.push(node)
} else if (blacks.has(node)) { } else if (blacks.has(node)) {
// do nothing // do nothing