Merge branch 'loader-fixes' into shigusegubu-themes3
This commit is contained in:
commit
66febc0756
8 changed files with 149 additions and 105 deletions
25
index.html
25
index.html
|
@ -70,6 +70,8 @@
|
||||||
"P P . . ."
|
"P P . . ."
|
||||||
"P P . E E"
|
"P P . E E"
|
||||||
"P P . E E";
|
"P P . E E";
|
||||||
|
|
||||||
|
--logoChunkSize: calc(2em * 0.5 * var(--scale))
|
||||||
}
|
}
|
||||||
|
|
||||||
.chunk {
|
.chunk {
|
||||||
|
@ -99,6 +101,27 @@
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#statusError {
|
||||||
|
display: none;
|
||||||
|
margin-top: 1em;
|
||||||
|
font-size: calc(1vw + 1vh + 1vmin);
|
||||||
|
line-height: 2;
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#statusStack {
|
||||||
|
display: none;
|
||||||
|
margin-top: 1em;
|
||||||
|
font-size: calc((1vw + 1vh + 1vmin) / 2.5);
|
||||||
|
width: calc(100vw - 5em);
|
||||||
|
padding: 1em;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow-x: hidden;
|
||||||
|
text-align: left;
|
||||||
|
line-height: 2;
|
||||||
|
}
|
||||||
|
|
||||||
@media (prefers-reduced-motion) {
|
@media (prefers-reduced-motion) {
|
||||||
#throbber {
|
#throbber {
|
||||||
animation: none !important;
|
animation: none !important;
|
||||||
|
@ -133,6 +156,8 @@
|
||||||
<!-- it's a pseudographic, don't want screenreader read out nonsense -->
|
<!-- it's a pseudographic, don't want screenreader read out nonsense -->
|
||||||
<span aria-hidden="true" class="initial-text">(。>﹏<)</span>
|
<span aria-hidden="true" class="initial-text">(。>﹏<)</span>
|
||||||
</div>
|
</div>
|
||||||
|
<code id="statusError"></code>
|
||||||
|
<pre id="statusStack"></pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="app" class="hidden"></div>
|
<div id="app" class="hidden"></div>
|
||||||
|
|
|
@ -348,12 +348,11 @@ const afterStoreSetup = async ({ store, i18n }) => {
|
||||||
const server = (typeof overrides.target !== 'undefined') ? overrides.target : window.location.origin
|
const server = (typeof overrides.target !== 'undefined') ? overrides.target : window.location.origin
|
||||||
store.dispatch('setInstanceOption', { name: 'server', value: server })
|
store.dispatch('setInstanceOption', { name: 'server', value: server })
|
||||||
|
|
||||||
document.querySelector('#status').textContent = i18n.global.t('splash.settings')
|
|
||||||
await setConfig({ store })
|
await setConfig({ store })
|
||||||
document.querySelector('#status').textContent = i18n.global.t('splash.theme')
|
|
||||||
try {
|
try {
|
||||||
await store.dispatch('applyTheme').catch((e) => { console.error('Error setting theme', e) })
|
await store.dispatch('applyTheme').catch((e) => { console.error('Error setting theme', e) })
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
window.splashError(e)
|
||||||
return Promise.reject(e)
|
return Promise.reject(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,7 +360,6 @@ const afterStoreSetup = async ({ store, i18n }) => {
|
||||||
|
|
||||||
// Now we can try getting the server settings and logging in
|
// Now we can try getting the server settings and logging in
|
||||||
// Most of these are preloaded into the index.html so blocking is minimized
|
// Most of these are preloaded into the index.html so blocking is minimized
|
||||||
document.querySelector('#status').textContent = i18n.global.t('splash.instance')
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
checkOAuthToken({ store }),
|
checkOAuthToken({ store }),
|
||||||
getInstancePanel({ store }),
|
getInstancePanel({ store }),
|
||||||
|
@ -408,7 +406,6 @@ const afterStoreSetup = async ({ store, i18n }) => {
|
||||||
|
|
||||||
// remove after vue 3.3
|
// remove after vue 3.3
|
||||||
app.config.unwrapInjectedRef = true
|
app.config.unwrapInjectedRef = true
|
||||||
document.querySelector('#status').textContent = i18n.global.t('splash.almost')
|
|
||||||
|
|
||||||
app.mount('#app')
|
app.mount('#app')
|
||||||
return app
|
return app
|
||||||
|
|
|
@ -1494,9 +1494,6 @@
|
||||||
"splash": {
|
"splash": {
|
||||||
"loading": "Loading...",
|
"loading": "Loading...",
|
||||||
"theme": "Applying theme, please wait warmly...",
|
"theme": "Applying theme, please wait warmly...",
|
||||||
"instance": "Getting instance info...",
|
|
||||||
"settings": "Applying settings...",
|
|
||||||
"almost": "Reticulating splines...",
|
|
||||||
"fun_1": "Drink more water",
|
"fun_1": "Drink more water",
|
||||||
"fun_2": "Take it easy!",
|
"fun_2": "Take it easy!",
|
||||||
"fun_3": "Suya...",
|
"fun_3": "Suya...",
|
||||||
|
|
|
@ -68,6 +68,15 @@ const persistedStateOptions = {
|
||||||
throbber.classList.add('dead')
|
throbber.classList.add('dead')
|
||||||
document.querySelector('#status').textContent = i18n.global.t('splash.error')
|
document.querySelector('#status').textContent = i18n.global.t('splash.error')
|
||||||
console.error('PleromaFE failed to initialize: ', e)
|
console.error('PleromaFE failed to initialize: ', e)
|
||||||
|
document.querySelector('#statusError').textContent = e
|
||||||
|
document.querySelector('#statusStack').textContent = e.stack
|
||||||
|
document.querySelector('#statusError').style = 'display: block'
|
||||||
|
document.querySelector('#statusStack').style = 'display: block'
|
||||||
|
}
|
||||||
|
|
||||||
|
window.splashError = e => splashError(i18n, e)
|
||||||
|
window.splashUpdate = key => {
|
||||||
|
document.querySelector('#status').textContent = i18n.global.t(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -563,112 +563,118 @@ const interfaceMod = {
|
||||||
if (!forceRecompile && !themeDebug && await tryLoadCache()) {
|
if (!forceRecompile && !themeDebug && await tryLoadCache()) {
|
||||||
return commit('setThemeApplied')
|
return commit('setThemeApplied')
|
||||||
}
|
}
|
||||||
|
window.splashUpdate('splash.theme')
|
||||||
await dispatch('getThemeData')
|
await dispatch('getThemeData')
|
||||||
|
|
||||||
const paletteIss = (() => {
|
try {
|
||||||
if (!state.paletteDataUsed) return null
|
const paletteIss = (() => {
|
||||||
const result = {
|
if (!state.paletteDataUsed) return null
|
||||||
component: 'Root',
|
const result = {
|
||||||
directives: {}
|
component: 'Root',
|
||||||
}
|
directives: {}
|
||||||
|
}
|
||||||
|
|
||||||
Object
|
Object
|
||||||
.entries(state.paletteDataUsed)
|
.entries(state.paletteDataUsed)
|
||||||
.filter(([k]) => k !== 'name')
|
.filter(([k]) => k !== 'name')
|
||||||
.forEach(([k, v]) => {
|
.forEach(([k, v]) => {
|
||||||
let issRootDirectiveName
|
let issRootDirectiveName
|
||||||
switch (k) {
|
switch (k) {
|
||||||
case 'background':
|
case 'background':
|
||||||
issRootDirectiveName = 'bg'
|
issRootDirectiveName = 'bg'
|
||||||
break
|
|
||||||
case 'foreground':
|
|
||||||
issRootDirectiveName = 'fg'
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
issRootDirectiveName = k
|
|
||||||
}
|
|
||||||
result.directives['--' + issRootDirectiveName] = 'color | ' + v
|
|
||||||
})
|
|
||||||
return result
|
|
||||||
})()
|
|
||||||
|
|
||||||
const theme2ruleset = state.themeDataUsed && convertTheme2To3(normalizeThemeData(state.themeDataUsed))
|
|
||||||
const hacks = []
|
|
||||||
|
|
||||||
Object.entries(theme3hacks).forEach(([key, value]) => {
|
|
||||||
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
|
break
|
||||||
case 'input':
|
case 'foreground':
|
||||||
hacks.push({
|
issRootDirectiveName = 'fg'
|
||||||
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
|
||||||
|
default:
|
||||||
|
issRootDirectiveName = k
|
||||||
}
|
}
|
||||||
|
result.directives['--' + issRootDirectiveName] = 'color | ' + v
|
||||||
})
|
})
|
||||||
break
|
return result
|
||||||
}
|
})()
|
||||||
case 'underlay': {
|
|
||||||
if (value !== 'none') {
|
const theme2ruleset = state.themeDataUsed && convertTheme2To3(normalizeThemeData(state.themeDataUsed))
|
||||||
const newRule = {
|
const hacks = []
|
||||||
component: 'Underlay',
|
|
||||||
directives: {}
|
Object.entries(theme3hacks).forEach(([key, value]) => {
|
||||||
}
|
switch (key) {
|
||||||
if (value === 'opaque') {
|
case 'fonts': {
|
||||||
newRule.directives.opacity = 1
|
Object.entries(theme3hacks.fonts).forEach(([fontKey, font]) => {
|
||||||
newRule.directives.background = '--wallpaper'
|
if (!font?.family) return
|
||||||
}
|
switch (fontKey) {
|
||||||
if (value === 'transparent') {
|
case 'interface':
|
||||||
newRule.directives.opacity = 0
|
hacks.push({
|
||||||
}
|
component: 'Root',
|
||||||
hacks.push(newRule)
|
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': {
|
||||||
|
if (value !== 'none') {
|
||||||
|
const newRule = {
|
||||||
|
component: 'Underlay',
|
||||||
|
directives: {}
|
||||||
|
}
|
||||||
|
if (value === 'opaque') {
|
||||||
|
newRule.directives.opacity = 1
|
||||||
|
newRule.directives.background = '--wallpaper'
|
||||||
|
}
|
||||||
|
if (value === 'transparent') {
|
||||||
|
newRule.directives.opacity = 0
|
||||||
|
}
|
||||||
|
hacks.push(newRule)
|
||||||
|
}
|
||||||
|
break
|
||||||
}
|
}
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
})
|
|
||||||
|
|
||||||
const rulesetArray = [
|
const rulesetArray = [
|
||||||
theme2ruleset,
|
theme2ruleset,
|
||||||
state.styleDataUsed,
|
state.styleDataUsed,
|
||||||
paletteIss,
|
paletteIss,
|
||||||
hacks
|
hacks
|
||||||
].filter(x => x)
|
].filter(x => x)
|
||||||
|
|
||||||
return applyTheme(
|
return applyTheme(
|
||||||
rulesetArray.flat(),
|
rulesetArray.flat(),
|
||||||
() => commit('setThemeApplied'),
|
() => commit('setThemeApplied'),
|
||||||
themeDebug
|
() => {},
|
||||||
)
|
themeDebug
|
||||||
|
)
|
||||||
|
} catch (e) {
|
||||||
|
window.splashError(e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,7 @@ export const tryLoadCache = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const applyTheme = (input, onFinish = (data) => {}, debug) => {
|
export const applyTheme = (input, onEagerFinish = data => {}, onFinish = data => {}, debug) => {
|
||||||
const eagerStyles = createStyleSheet(EAGER_STYLE_ID)
|
const eagerStyles = createStyleSheet(EAGER_STYLE_ID)
|
||||||
const lazyStyles = createStyleSheet(LAZY_STYLE_ID)
|
const lazyStyles = createStyleSheet(LAZY_STYLE_ID)
|
||||||
|
|
||||||
|
@ -148,6 +148,7 @@ export const applyTheme = (input, onFinish = (data) => {}, debug) => {
|
||||||
},
|
},
|
||||||
onEagerFinished () {
|
onEagerFinished () {
|
||||||
adoptStyleSheets([eagerStyles])
|
adoptStyleSheets([eagerStyles])
|
||||||
|
onEagerFinish()
|
||||||
},
|
},
|
||||||
onLazyFinished () {
|
onLazyFinished () {
|
||||||
adoptStyleSheets([eagerStyles, lazyStyles])
|
adoptStyleSheets([eagerStyles, lazyStyles])
|
||||||
|
|
|
@ -567,6 +567,7 @@ export const init = ({
|
||||||
lazy,
|
lazy,
|
||||||
eager,
|
eager,
|
||||||
staticVars,
|
staticVars,
|
||||||
engineChecksum
|
engineChecksum,
|
||||||
|
themeChecksum: sum([lazy, eager])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,13 +52,21 @@ Button:hover {
|
||||||
}
|
}
|
||||||
|
|
||||||
Button:toggled {
|
Button:toggled {
|
||||||
background: $blend(--bg 0.8 --accent)
|
background: $blend(--bg 0.3 --accent)
|
||||||
}
|
}
|
||||||
|
|
||||||
Button:pressed {
|
Button:pressed {
|
||||||
background: $blend(--bg 0.8 --accent)
|
background: $blend(--bg 0.8 --accent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Button:pressed:toggled {
|
||||||
|
background: $blend(--bg 0.2 --accent)
|
||||||
|
}
|
||||||
|
|
||||||
|
Button:toggled:hover {
|
||||||
|
background: $blend(--bg 0.3 --accent)
|
||||||
|
}
|
||||||
|
|
||||||
Input {
|
Input {
|
||||||
shadow: --defaultInputBevel
|
shadow: --defaultInputBevel
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue