fix(core): update
This commit is contained in:
parent
a0cad2f4bc
commit
d697fa2437
@ -12,21 +12,24 @@ export class CssManager {
|
||||
public dbVarTripletStore: IDbVarTriplet[] = [];
|
||||
|
||||
public dbTheme(darkValueArg: string, brightValueArg: string): CSSResult {
|
||||
let returnCssVar: string;
|
||||
const existingTriplet = this.dbVarTripletStore.find(tripletArg => tripletArg.darkValue === darkValueArg && tripletArg.brightValue === brightValueArg);
|
||||
if (existingTriplet) {
|
||||
return plugins.litElement.unsafeCSS(existingTriplet.cssVarName)
|
||||
returnCssVar = existingTriplet.cssVarName;
|
||||
} else {
|
||||
const newTriplet: IDbVarTriplet = {
|
||||
cssVarName: `--${plugins.isounique.uni()}`,
|
||||
brightValue: brightValueArg,
|
||||
darkValue: darkValueArg
|
||||
}
|
||||
this.dbVarTripletStore.push(newTriplet)
|
||||
document.onreadystatechange = () => {
|
||||
document.body?.style?.setProperty(newTriplet.cssVarName, newTriplet.darkValue);
|
||||
}
|
||||
return plugins.litElement.unsafeCSS(newTriplet.cssVarName);
|
||||
};
|
||||
this.dbVarTripletStore.push(newTriplet);
|
||||
domtools.DomTools.setupDomTools().then(async (domtools) => {
|
||||
await domtools.domReady.promise;
|
||||
document.body.style.setProperty(newTriplet.cssVarName, newTriplet.darkValue);
|
||||
});
|
||||
returnCssVar = newTriplet.cssVarName;
|
||||
}
|
||||
return plugins.litElement.unsafeCSS(`var(${returnCssVar})`);
|
||||
}
|
||||
|
||||
public cssGridColumns = (amountOfColumnsArg: number, gapSizeArg: number): CSSResult => {
|
||||
|
Loading…
Reference in New Issue
Block a user