Merge branch 'small-fixes-and-improvements' into shigusegubu-themes3
This commit is contained in:
commit
cd8d141be1
10 changed files with 66 additions and 45 deletions
|
|
@ -23,7 +23,7 @@
|
||||||
</div>
|
</div>
|
||||||
{{ ' ' }}
|
{{ ' ' }}
|
||||||
<div
|
<div
|
||||||
v-if="modelValue?.family"
|
v-if="modelValue"
|
||||||
class="font-input setting-item"
|
class="font-input setting-item"
|
||||||
>
|
>
|
||||||
<label
|
<label
|
||||||
|
|
@ -67,10 +67,10 @@
|
||||||
</button>
|
</button>
|
||||||
<input
|
<input
|
||||||
:id="name"
|
:id="name"
|
||||||
:model-value="modelValue.family"
|
:model-value="modelValue"
|
||||||
class="input custom-font"
|
class="input custom-font"
|
||||||
type="text"
|
type="text"
|
||||||
@update:modelValue="$emit('update:modelValue', { ...(modelValue || {}), family: $event.target.value })"
|
@update:modelValue="$emit('update:modelValue', $event.target.value)"
|
||||||
>
|
>
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
|
|
@ -89,9 +89,9 @@
|
||||||
</button>
|
</button>
|
||||||
<Select
|
<Select
|
||||||
:id="name + '-local-font-switcher'"
|
:id="name + '-local-font-switcher'"
|
||||||
:model-value="modelValue?.family"
|
:model-value="modelValue"
|
||||||
class="custom-font"
|
class="custom-font"
|
||||||
@update:model-value="v => $emit('update:modelValue', { ...(modelValue || {}), family: v })"
|
@update:model-value="v => $emit('update:modelValue', v)"
|
||||||
>
|
>
|
||||||
<optgroup
|
<optgroup
|
||||||
:label="$t('settings.style.themes3.font.group-builtin')"
|
:label="$t('settings.style.themes3.font.group-builtin')"
|
||||||
|
|
|
||||||
|
|
@ -6,19 +6,24 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: baseline;
|
align-items: baseline;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: 1.5em;
|
border: 2px solid transparent;
|
||||||
|
|
||||||
|
.chevron-popover {
|
||||||
|
.popover-trigger-button {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.action-counter {
|
.action-counter {
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
margin-left: 1em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.action-button-inner,
|
.action-button-inner,
|
||||||
.extra-button {
|
.extra-button {
|
||||||
margin: -0.5em;
|
|
||||||
padding: 0.5em;
|
padding: 0.5em;
|
||||||
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.separator {
|
.separator {
|
||||||
|
|
@ -26,27 +31,12 @@
|
||||||
align-self: stretch;
|
align-self: stretch;
|
||||||
width: 1px;
|
width: 1px;
|
||||||
background-color: var(--icon);
|
background-color: var(--icon);
|
||||||
margin-left: 0.75em;
|
margin: 0.5em 0;
|
||||||
margin-right: 0.125em;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.-pin {
|
|
||||||
margin: calc(-2px - 0.25em);
|
|
||||||
padding: 0.25em;
|
|
||||||
border: 2px dashed var(--icon);
|
|
||||||
border-radius: var(--roundness);
|
|
||||||
grid-template-columns: minmax(max-content, 1fr) auto;
|
|
||||||
|
|
||||||
.chevron-icon,
|
|
||||||
.extra-button,
|
|
||||||
.separator {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.action-button-inner {
|
.action-button-inner {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-gap: 1em;
|
grid-gap: 0.125em;
|
||||||
grid-template-columns: max-content;
|
grid-template-columns: max-content;
|
||||||
grid-auto-flow: column;
|
grid-auto-flow: column;
|
||||||
grid-auto-columns: max-content;
|
grid-auto-columns: max-content;
|
||||||
|
|
@ -72,6 +62,32 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.-pin {
|
||||||
|
border: 2px dashed var(--icon);
|
||||||
|
border-radius: var(--roundness);
|
||||||
|
grid-template-columns: minmax(max-content, 1fr) auto;
|
||||||
|
|
||||||
|
.action-button-inner {
|
||||||
|
opacity: 0.8;
|
||||||
|
padding-right: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chevron-icon,
|
||||||
|
.extra-button,
|
||||||
|
.separator {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.-with-extra {
|
||||||
|
.action-button-inner,
|
||||||
|
.extra-button {
|
||||||
|
padding-left: 0.2em;
|
||||||
|
padding-right: 0.25em;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.action-button {
|
.action-button {
|
||||||
|
|
@ -106,7 +122,7 @@
|
||||||
&.-extra {
|
&.-extra {
|
||||||
.action-counter {
|
.action-counter {
|
||||||
justify-self: end;
|
justify-self: end;
|
||||||
margin-right: 1em;
|
margin-left: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chevron-icon {
|
.chevron-icon {
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,6 @@
|
||||||
<FAIcon
|
<FAIcon
|
||||||
v-if="button.dropdown?.()"
|
v-if="button.dropdown?.()"
|
||||||
class="chevron-icon"
|
class="chevron-icon"
|
||||||
size="lg"
|
|
||||||
:icon="extra ? 'chevron-right' : 'chevron-up'"
|
:icon="extra ? 'chevron-right' : 'chevron-up'"
|
||||||
fixed-width
|
fixed-width
|
||||||
/>
|
/>
|
||||||
|
|
@ -71,6 +70,7 @@
|
||||||
/>
|
/>
|
||||||
<Popover
|
<Popover
|
||||||
v-if="button.name === 'bookmark'"
|
v-if="button.name === 'bookmark'"
|
||||||
|
class="chevron-popover"
|
||||||
:trigger="extra ? 'hover' : 'click'"
|
:trigger="extra ? 'hover' : 'click'"
|
||||||
:placement="extra ? 'right' : 'top'"
|
:placement="extra ? 'right' : 'top'"
|
||||||
:offset="extra ? { x: 10 } : { y: 10 }"
|
:offset="extra ? { x: 10 } : { y: 10 }"
|
||||||
|
|
@ -79,7 +79,6 @@
|
||||||
<template #trigger>
|
<template #trigger>
|
||||||
<FAIcon
|
<FAIcon
|
||||||
class="chevron-icon"
|
class="chevron-icon"
|
||||||
size="lg"
|
|
||||||
:icon="extra ? 'chevron-right' : 'chevron-up'"
|
:icon="extra ? 'chevron-right' : 'chevron-up'"
|
||||||
fixed-width
|
fixed-width
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -3,16 +3,19 @@
|
||||||
.StatusActionButtons {
|
.StatusActionButtons {
|
||||||
.quick-action-buttons {
|
.quick-action-buttons {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(auto-fill, minmax(10%, 3em));
|
margin-left: -0.5em;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(3.5em, 10%));
|
||||||
grid-auto-flow: row dense;
|
grid-auto-flow: row dense;
|
||||||
grid-auto-rows: 1fr;
|
grid-auto-rows: 1fr;
|
||||||
grid-gap: 1.25em 0;
|
grid-gap: 0.5em 0.1em;
|
||||||
margin-top: var(--status-margin);
|
margin-top: var(--status-margin);
|
||||||
}
|
}
|
||||||
|
|
||||||
.pin-action-button {
|
.pin-action-button {
|
||||||
margin: -0.5em;
|
display: flex;
|
||||||
|
z-index: 1;
|
||||||
padding: 0.5em;
|
padding: 0.5em;
|
||||||
|
margin: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// popover
|
// popover
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,14 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="StatusActionButtons">
|
<div class="StatusActionButtons">
|
||||||
<span class="quick-action-buttons">
|
<span
|
||||||
|
class="quick-action-buttons"
|
||||||
|
:class="{ '-pin': showPin }"
|
||||||
|
>
|
||||||
<span
|
<span
|
||||||
v-for="button in quickButtons"
|
v-for="button in quickButtons"
|
||||||
:key="button.name"
|
:key="button.name"
|
||||||
class="quick-action"
|
class="quick-action"
|
||||||
:class="{ '-pin': showPin, '-toggle': button.dropdown?.() }"
|
:class="{ '-pin': showPin, '-toggle': button.dropdown?.(), '-with-extra': button.name === 'bookmark' }"
|
||||||
>
|
>
|
||||||
<ActionButtonContainer
|
<ActionButtonContainer
|
||||||
:class="{ '-pin': showPin }"
|
:class="{ '-pin': showPin }"
|
||||||
|
|
@ -30,7 +33,6 @@
|
||||||
<FAIcon
|
<FAIcon
|
||||||
v-if="showPin && currentUser"
|
v-if="showPin && currentUser"
|
||||||
fixed-width
|
fixed-width
|
||||||
class="fa-scale-110"
|
|
||||||
icon="thumbtack"
|
icon="thumbtack"
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -38,6 +40,7 @@
|
||||||
<Popover
|
<Popover
|
||||||
trigger="click"
|
trigger="click"
|
||||||
:trigger-attrs="triggerAttrs"
|
:trigger-attrs="triggerAttrs"
|
||||||
|
class="quick-action"
|
||||||
:tabindex="0"
|
:tabindex="0"
|
||||||
placement="top"
|
placement="top"
|
||||||
:offset="{ y: 5 }"
|
:offset="{ y: 5 }"
|
||||||
|
|
@ -46,7 +49,7 @@
|
||||||
>
|
>
|
||||||
<template #trigger>
|
<template #trigger>
|
||||||
<FAIcon
|
<FAIcon
|
||||||
class="fa-scale-110 "
|
class="action-button-inner"
|
||||||
icon="ellipsis-h"
|
icon="ellipsis-h"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -635,22 +635,22 @@ export const LOCAL_DEFAULT_CONFIG_DEFINITIONS = {
|
||||||
},
|
},
|
||||||
fontInterface: {
|
fontInterface: {
|
||||||
description: 'Interface font override',
|
description: 'Interface font override',
|
||||||
type: 'object',
|
type: 'string',
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
fontInput: {
|
fontInput: {
|
||||||
description: 'Input font override',
|
description: 'Input font override',
|
||||||
type: 'object',
|
type: 'string',
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
fontPosts: {
|
fontPosts: {
|
||||||
description: 'Post font override',
|
description: 'Post font override',
|
||||||
type: 'object',
|
type: 'string',
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
fontMonospace: {
|
fontMonospace: {
|
||||||
description: 'Monospace font override',
|
description: 'Monospace font override',
|
||||||
type: 'object',
|
type: 'string',
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
themeDebug: {
|
themeDebug: {
|
||||||
|
|
|
||||||
|
|
@ -262,7 +262,7 @@ export const convertTheme2To3 = (data) => {
|
||||||
Object.keys(data.fonts || {}).forEach((key) => {
|
Object.keys(data.fonts || {}).forEach((key) => {
|
||||||
if (!fontsKeys.has(key)) return
|
if (!fontsKeys.has(key)) return
|
||||||
if (!data.fonts[key]) return
|
if (!data.fonts[key]) return
|
||||||
const originalFont = data.fonts[key].family
|
const originalFont = data.fonts[key]
|
||||||
const rule = { source: '2to3' }
|
const rule = { source: '2to3' }
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
|
|
|
||||||
|
|
@ -619,7 +619,7 @@ export const generateFonts = (input) => {
|
||||||
rules: {
|
rules: {
|
||||||
fonts: Object.entries(fonts)
|
fonts: Object.entries(fonts)
|
||||||
.filter(([, v]) => v)
|
.filter(([, v]) => v)
|
||||||
.map(([k, v]) => `--${k}Font: ${v.family}`)
|
.map(([k, v]) => `--${k}Font: ${v}`)
|
||||||
.join(';'),
|
.join(';'),
|
||||||
},
|
},
|
||||||
theme: {
|
theme: {
|
||||||
|
|
|
||||||
|
|
@ -196,7 +196,7 @@ export const useInterfaceStore = defineStore('interface', {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setFontsList(value) {
|
setFontsList(value) {
|
||||||
this.localFonts = [...new Set(value.map((font) => font.family)).values()]
|
this.localFonts = [...new Set(value.map((font) => font)).values()]
|
||||||
},
|
},
|
||||||
queryLocalFonts() {
|
queryLocalFonts() {
|
||||||
if (this.localFonts !== null) return
|
if (this.localFonts !== null) return
|
||||||
|
|
@ -654,7 +654,7 @@ export const useInterfaceStore = defineStore('interface', {
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.entries(fontMap).forEach(([font, component]) => {
|
Object.entries(fontMap).forEach(([font, component]) => {
|
||||||
const family = mergedConfig[`font${font}`]?.family
|
const family = mergedConfig[`font${font}`]
|
||||||
const variable = font === 'Monospace' ? '--monoFont' : '--font'
|
const variable = font === 'Monospace' ? '--monoFont' : '--font'
|
||||||
if (family) {
|
if (family) {
|
||||||
hacks.push({
|
hacks.push({
|
||||||
|
|
|
||||||
|
|
@ -238,8 +238,8 @@ describe('The SyncConfig store', () => {
|
||||||
store.pushSyncConfig = () => {
|
store.pushSyncConfig = () => {
|
||||||
/* no-op */
|
/* no-op */
|
||||||
}
|
}
|
||||||
store.setPreference({ path: 'simple.fontInput.family', value: 'test' })
|
store.setPreference({ path: 'simple.fontInput', value: 'test' })
|
||||||
store.unsetPreference({ path: 'simple.fontInput.family' })
|
store.unsetPreference({ path: 'simple.fontInput' })
|
||||||
store.updateCache(store, { username: 'test' })
|
store.updateCache(store, { username: 'test' })
|
||||||
expect(store.prefsStorage.simple.fontInput).to.not.have.property(
|
expect(store.prefsStorage.simple.fontInput).to.not.have.property(
|
||||||
'family',
|
'family',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue