biome format --write
This commit is contained in:
parent
8372348148
commit
9262e803ec
415 changed files with 54076 additions and 17419 deletions
|
|
@ -19,7 +19,7 @@ const APPEARANCE_SETTINGS_KEYS = new Set([
|
|||
'panelHeaderSize',
|
||||
'forcedRoundness',
|
||||
'emojiSize',
|
||||
'emojiReactionsScale'
|
||||
'emojiReactionsScale',
|
||||
])
|
||||
|
||||
/* TODO this is a bit messy.
|
||||
|
|
@ -34,7 +34,7 @@ export const multiChoiceProperties = [
|
|||
'conversationOtherRepliesButton', // below | inside
|
||||
'mentionLinkDisplay', // short | full_for_remote | full
|
||||
'userPopoverAvatarAction', // close | zoom | open
|
||||
'unsavedPostAction' // save | discard | confirm
|
||||
'unsavedPostAction', // save | discard | confirm
|
||||
]
|
||||
|
||||
// caching the instance default properties
|
||||
|
|
@ -43,43 +43,48 @@ export const instanceDefaultProperties = Object.keys(instanceDefaultConfig)
|
|||
const config = {
|
||||
state: { ...defaultState },
|
||||
getters: {
|
||||
defaultConfig (state, getters, rootState) {
|
||||
defaultConfig(state, getters, rootState) {
|
||||
const { instance } = rootState
|
||||
return {
|
||||
...defaultState,
|
||||
...Object.fromEntries(
|
||||
instanceDefaultProperties.map(key => [key, instance[key]])
|
||||
)
|
||||
instanceDefaultProperties.map((key) => [key, instance[key]]),
|
||||
),
|
||||
}
|
||||
},
|
||||
mergedConfig (state, getters, rootState, rootGetters) {
|
||||
mergedConfig(state, getters, rootState, rootGetters) {
|
||||
const { defaultConfig } = rootGetters
|
||||
return {
|
||||
...defaultConfig,
|
||||
// Do not override with undefined
|
||||
...Object.fromEntries(Object.entries(state).filter(([, v]) => v !== undefined))
|
||||
...Object.fromEntries(
|
||||
Object.entries(state).filter(([, v]) => v !== undefined),
|
||||
),
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
mutations: {
|
||||
setOptionTemporarily (state, { name, value }) {
|
||||
setOptionTemporarily(state, { name, value }) {
|
||||
set(state, name, value)
|
||||
applyConfig(state)
|
||||
},
|
||||
setOption (state, { name, value }) {
|
||||
setOption(state, { name, value }) {
|
||||
set(state, name, value)
|
||||
},
|
||||
setHighlight (state, { user, color, type }) {
|
||||
setHighlight(state, { user, color, type }) {
|
||||
const data = this.state.config.highlight[user]
|
||||
if (color || type) {
|
||||
state.highlight[user] = { color: color || data.color, type: type || data.type }
|
||||
state.highlight[user] = {
|
||||
color: color || data.color,
|
||||
type: type || data.type,
|
||||
}
|
||||
} else {
|
||||
delete state.highlight[user]
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
loadSettings ({ dispatch }, data) {
|
||||
loadSettings({ dispatch }, data) {
|
||||
const knownKeys = new Set(Object.keys(defaultState))
|
||||
const presentKeys = new Set(Object.keys(data))
|
||||
const intersection = new Set()
|
||||
|
|
@ -89,16 +94,16 @@ const config = {
|
|||
}
|
||||
}
|
||||
|
||||
intersection.forEach(
|
||||
name => dispatch('setOption', { name, value: data[name] })
|
||||
intersection.forEach((name) =>
|
||||
dispatch('setOption', { name, value: data[name] }),
|
||||
)
|
||||
},
|
||||
setHighlight ({ commit }, { user, color, type }) {
|
||||
setHighlight({ commit }, { user, color, type }) {
|
||||
commit('setHighlight', { user, color, type })
|
||||
},
|
||||
setOptionTemporarily ({ commit, dispatch, state }, { name, value }) {
|
||||
setOptionTemporarily({ commit, dispatch, state }, { name, value }) {
|
||||
if (useInterfaceStore().temporaryChangesTimeoutId !== null) {
|
||||
console.warn('Can\'t track more than one temporary change')
|
||||
console.warn("Can't track more than one temporary change")
|
||||
return
|
||||
}
|
||||
const oldValue = state[name]
|
||||
|
|
@ -117,32 +122,35 @@ const config = {
|
|||
|
||||
useInterfaceStore().setTemporaryChanges({
|
||||
confirm,
|
||||
revert
|
||||
revert,
|
||||
})
|
||||
},
|
||||
setThemeV2 ({ commit, dispatch }, { customTheme, customThemeSource }) {
|
||||
setThemeV2({ commit, dispatch }, { customTheme, customThemeSource }) {
|
||||
commit('setOption', { name: 'theme', value: 'custom' })
|
||||
commit('setOption', { name: 'customTheme', value: customTheme })
|
||||
commit('setOption', { name: 'customThemeSource', value: customThemeSource })
|
||||
commit('setOption', {
|
||||
name: 'customThemeSource',
|
||||
value: customThemeSource,
|
||||
})
|
||||
dispatch('setTheme', { themeData: customThemeSource, recompile: true })
|
||||
},
|
||||
setOption ({ commit, dispatch, state }, { name, value }) {
|
||||
const exceptions = new Set([
|
||||
'useStreamingApi'
|
||||
])
|
||||
setOption({ commit, dispatch, state }, { name, value }) {
|
||||
const exceptions = new Set(['useStreamingApi'])
|
||||
|
||||
if (exceptions.has(name)) {
|
||||
switch (name) {
|
||||
case 'useStreamingApi': {
|
||||
const action = value ? 'enableMastoSockets' : 'disableMastoSockets'
|
||||
|
||||
dispatch(action).then(() => {
|
||||
commit('setOption', { name: 'useStreamingApi', value })
|
||||
}).catch((e) => {
|
||||
console.error('Failed starting MastoAPI Streaming socket', e)
|
||||
dispatch('disableMastoSockets')
|
||||
dispatch('setOption', { name: 'useStreamingApi', value: false })
|
||||
})
|
||||
dispatch(action)
|
||||
.then(() => {
|
||||
commit('setOption', { name: 'useStreamingApi', value })
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error('Failed starting MastoAPI Streaming socket', e)
|
||||
dispatch('disableMastoSockets')
|
||||
dispatch('setOption', { name: 'useStreamingApi', value: false })
|
||||
})
|
||||
break
|
||||
}
|
||||
}
|
||||
|
|
@ -157,7 +165,11 @@ const config = {
|
|||
switch (name) {
|
||||
case 'theme':
|
||||
if (value === 'custom') break
|
||||
dispatch('setTheme', { themeName: value, recompile: true, saveData: true })
|
||||
dispatch('setTheme', {
|
||||
themeName: value,
|
||||
recompile: true,
|
||||
saveData: true,
|
||||
})
|
||||
break
|
||||
case 'themeDebug': {
|
||||
dispatch('setTheme', { recompile: true })
|
||||
|
|
@ -168,7 +180,7 @@ const config = {
|
|||
dispatch('loadUnicodeEmojiData', value)
|
||||
Cookies.set(
|
||||
BACKEND_LANGUAGE_COOKIE_NAME,
|
||||
localeService.internalToBackendLocaleMulti(value)
|
||||
localeService.internalToBackendLocaleMulti(value),
|
||||
)
|
||||
break
|
||||
case 'thirdColumnMode':
|
||||
|
|
@ -176,8 +188,8 @@ const config = {
|
|||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
export default config
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue