font overrides + fixes for font component
This commit is contained in:
parent
895261e112
commit
665faf892a
|
@ -84,7 +84,7 @@
|
||||||
: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')"
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -52,7 +52,13 @@ export const defaultState = {
|
||||||
palette: null, // not used yet, will be used for V3
|
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
|
badgeColor: null,
|
||||||
|
fonts: {
|
||||||
|
interface: undefined,
|
||||||
|
input: undefined,
|
||||||
|
post: undefined,
|
||||||
|
monospace: undefined
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
hideISP: false,
|
hideISP: false,
|
||||||
|
@ -147,7 +153,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
|
||||||
|
|
|
@ -274,6 +274,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 = {
|
||||||
|
|
Loading…
Reference in a new issue