mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
Use ThemeManifest type
This commit is contained in:
parent
80fb953688
commit
043cc9f12c
@ -33,12 +33,15 @@ export class ThemeBuilder {
|
|||||||
this._platform = platform;
|
this._platform = platform;
|
||||||
}
|
}
|
||||||
|
|
||||||
async populateDerivedTheme(manifest) {
|
async populateDerivedTheme(manifest: ThemeManifest) {
|
||||||
const { manifest: baseManifest, location } = this._idToManifest.get(manifest.extends)!;
|
const { manifest: baseManifest, location } = this._idToManifest.get(manifest.extends!)!;
|
||||||
const { cssLocation, derivedVariables, icons } = this._getsourceData(baseManifest, location);
|
const { cssLocation, derivedVariables, icons } = this._getsourceData(baseManifest, location);
|
||||||
const themeName = manifest.name;
|
const themeName = manifest.name;
|
||||||
|
if (!themeName) {
|
||||||
|
throw new Error(`Theme name not found in manifest!`);
|
||||||
|
}
|
||||||
let defaultDarkVariant: any = {}, defaultLightVariant: any = {};
|
let defaultDarkVariant: any = {}, defaultLightVariant: any = {};
|
||||||
for (const [variant, variantDetails] of Object.entries(manifest.values.variants) as [string, any][]) {
|
for (const [variant, variantDetails] of Object.entries(manifest.values?.variants!) as [string, any][]) {
|
||||||
try {
|
try {
|
||||||
const themeId = `${manifest.id}-${variant}`;
|
const themeId = `${manifest.id}-${variant}`;
|
||||||
const { name: variantName, default: isDefault, dark, variables } = variantDetails;
|
const { name: variantName, default: isDefault, dark, variables } = variantDetails;
|
||||||
|
Loading…
Reference in New Issue
Block a user