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