more predictable styles order, custom styles before builtins
This commit is contained in:
parent
00438e852e
commit
7b56b3f411
|
@ -34,7 +34,8 @@ library.add(
|
||||||
const AppearanceTab = {
|
const AppearanceTab = {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
availableStyles: [],
|
availableThemesV3: [],
|
||||||
|
availableThemesV2: [],
|
||||||
bundledPalettes: [],
|
bundledPalettes: [],
|
||||||
compilationCache: {},
|
compilationCache: {},
|
||||||
fileImporter: newImporter({
|
fileImporter: newImporter({
|
||||||
|
@ -108,13 +109,13 @@ const AppearanceTab = {
|
||||||
updateIndex('style').then(styles => {
|
updateIndex('style').then(styles => {
|
||||||
styles.forEach(([key, stylePromise]) => stylePromise.then(data => {
|
styles.forEach(([key, stylePromise]) => stylePromise.then(data => {
|
||||||
const meta = data.find(x => x.component === '@meta')
|
const meta = data.find(x => x.component === '@meta')
|
||||||
this.availableStyles.push({ key, data, name: meta.directives.name, version: 'v3' })
|
this.availableThemesV3.push({ key, data, name: meta.directives.name, version: 'v3' })
|
||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
|
|
||||||
updateIndex('theme').then(themes => {
|
updateIndex('theme').then(themes => {
|
||||||
themes.forEach(([key, themePromise]) => themePromise.then(data => {
|
themes.forEach(([key, themePromise]) => themePromise.then(data => {
|
||||||
this.availableStyles.push({ key, data, name: data.name, version: 'v2' })
|
this.availableThemesV2.push({ key, data, name: data.name, version: 'v2' })
|
||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -169,6 +170,12 @@ const AppearanceTab = {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
availableStyles () {
|
||||||
|
return [
|
||||||
|
...this.availableThemesV3,
|
||||||
|
...this.availableThemesV2
|
||||||
|
]
|
||||||
|
},
|
||||||
availablePalettes () {
|
availablePalettes () {
|
||||||
return [
|
return [
|
||||||
...this.bundledPalettes,
|
...this.bundledPalettes,
|
||||||
|
|
|
@ -275,7 +275,7 @@ export const getResourcesIndex = async (url, parser = JSON.parse) => {
|
||||||
console.warn(`Custom resources at ${customUrl} unavailable`)
|
console.warn(`Custom resources at ${customUrl} unavailable`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const total = [...builtin, ...custom]
|
const total = [...custom, ...builtin]
|
||||||
if (total.length === 0) {
|
if (total.length === 0) {
|
||||||
return Promise.reject(new Error(`Resource at ${url} and ${customUrl} completely unavailable. Panicking`))
|
return Promise.reject(new Error(`Resource at ${url} and ${customUrl} completely unavailable. Panicking`))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue