Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
06dbacb74d | |||
5fc730eeb2 | |||
1bdab82d0e | |||
76841a6b25 | |||
6dd5277f9e | |||
4cbbf941c0 | |||
61de38cb4d | |||
a3ab19e5db |
18
package-lock.json
generated
18
package-lock.json
generated
@ -1,15 +1,15 @@
|
||||
{
|
||||
"name": "@designestate/dees-element",
|
||||
"version": "2.0.8",
|
||||
"version": "2.0.12",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@designestate/dees-element",
|
||||
"version": "2.0.8",
|
||||
"version": "2.0.12",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@designestate/dees-domtools": "^2.0.6",
|
||||
"@designestate/dees-domtools": "^2.0.16",
|
||||
"@pushrocks/isounique": "^1.0.5",
|
||||
"@pushrocks/smartrx": "^2.0.25",
|
||||
"lit": "^2.2.2"
|
||||
@ -1819,9 +1819,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@designestate/dees-domtools": {
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://verdaccio.lossless.one/@designestate%2fdees-domtools/-/dees-domtools-2.0.6.tgz",
|
||||
"integrity": "sha512-3fWYAh4h6LB3poUd5HtAd17GO1EzZPi/wApAZHTcIgdDHymMe03OZExVjYQLPZtosEbFQnvctXx8dbaOeP/mUA==",
|
||||
"version": "2.0.16",
|
||||
"resolved": "https://verdaccio.lossless.one/@designestate%2fdees-domtools/-/dees-domtools-2.0.16.tgz",
|
||||
"integrity": "sha512-RLE9zsrIV/YP0+UpPkSFUXa8gk6Bu1NMQSqB11CsK5GmVu1j19smqIwtynb8OlHT2Z4ZH/HZONPhUNQBpVP3sQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@apiglobal/typedrequest": "^2.0.3",
|
||||
@ -12632,9 +12632,9 @@
|
||||
}
|
||||
},
|
||||
"@designestate/dees-domtools": {
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://verdaccio.lossless.one/@designestate%2fdees-domtools/-/dees-domtools-2.0.6.tgz",
|
||||
"integrity": "sha512-3fWYAh4h6LB3poUd5HtAd17GO1EzZPi/wApAZHTcIgdDHymMe03OZExVjYQLPZtosEbFQnvctXx8dbaOeP/mUA==",
|
||||
"version": "2.0.16",
|
||||
"resolved": "https://verdaccio.lossless.one/@designestate%2fdees-domtools/-/dees-domtools-2.0.16.tgz",
|
||||
"integrity": "sha512-RLE9zsrIV/YP0+UpPkSFUXa8gk6Bu1NMQSqB11CsK5GmVu1j19smqIwtynb8OlHT2Z4ZH/HZONPhUNQBpVP3sQ==",
|
||||
"requires": {
|
||||
"@apiglobal/typedrequest": "^2.0.3",
|
||||
"@designestate/dees-comms": "^1.0.22",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@designestate/dees-element",
|
||||
"version": "2.0.8",
|
||||
"version": "2.0.12",
|
||||
"private": false,
|
||||
"description": "a custom element class extending lit element class",
|
||||
"main": "dist_ts/index.js",
|
||||
@ -22,7 +22,7 @@
|
||||
"tslint-config-prettier": "^1.18.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@designestate/dees-domtools": "^2.0.6",
|
||||
"@designestate/dees-domtools": "^2.0.16",
|
||||
"@pushrocks/isounique": "^1.0.5",
|
||||
"@pushrocks/smartrx": "^2.0.25",
|
||||
"lit": "^2.2.2"
|
||||
|
@ -32,6 +32,14 @@ export class CssManager {
|
||||
return domtools.elementBasic.staticStyles;
|
||||
}
|
||||
|
||||
public cssForDesktop(contentArg: CSSResult) {
|
||||
return unsafeCSS(domtools.breakpoints.cssForDesktop(contentArg));
|
||||
}
|
||||
|
||||
public cssForNotebook(contentArg: CSSResult) {
|
||||
return unsafeCSS(domtools.breakpoints.cssForNotebook(contentArg));
|
||||
}
|
||||
|
||||
public cssForTablet(contentArg: CSSResult) {
|
||||
return unsafeCSS(domtools.breakpoints.cssForTablet(contentArg));
|
||||
}
|
||||
@ -46,6 +54,16 @@ export class CssManager {
|
||||
|
||||
public bdTheme(brightValueArg: string, darkValueArg: string): CSSResult {
|
||||
let returnCssVar: string;
|
||||
|
||||
// lets determine the default value for quick page rendering.
|
||||
let defaultValue: string;
|
||||
if (domtools.DomTools.getGlobalDomToolsSync()) {
|
||||
defaultValue = domtools.DomTools.getGlobalDomToolsSync().themeManager.goBrightBoolean ? brightValueArg : darkValueArg;
|
||||
} else {
|
||||
defaultValue = darkValueArg
|
||||
}
|
||||
|
||||
|
||||
const existingTriplet = this.bdVarTripletStore.find(
|
||||
(tripletArg) =>
|
||||
tripletArg.darkValue === darkValueArg && tripletArg.brightValue === brightValueArg
|
||||
@ -59,16 +77,17 @@ export class CssManager {
|
||||
darkValue: darkValueArg,
|
||||
};
|
||||
this.bdVarTripletStore.push(newTriplet);
|
||||
|
||||
this.domtoolsPromise.then(async (domtoolsArg) => {
|
||||
await domtoolsArg.domReady.promise;
|
||||
document.body.style.setProperty(
|
||||
newTriplet.cssVarName,
|
||||
domtoolsArg.themeManager.goBrightBoolean ? newTriplet.brightValue : newTriplet.darkValue
|
||||
defaultValue
|
||||
);
|
||||
});
|
||||
returnCssVar = newTriplet.cssVarName;
|
||||
}
|
||||
return plugins.lit.unsafeCSS(`var(${returnCssVar}, ${darkValueArg})`);
|
||||
return plugins.lit.unsafeCSS(`var(${returnCssVar}, ${defaultValue})`);
|
||||
}
|
||||
|
||||
public cssGridColumns = (amountOfColumnsArg: number, gapSizeArg: number): CSSResult => {
|
||||
|
@ -6,7 +6,7 @@ export class DeesElement extends plugins.lit.LitElement {
|
||||
public goBright: boolean = false;
|
||||
|
||||
// domtools
|
||||
public domtoolsPromise = plugins.domtools.elementBasic.setup(this);
|
||||
public domtoolsPromise: Promise<plugins.domtools.DomTools>;
|
||||
|
||||
@plugins.lit.property()
|
||||
domtools?: plugins.domtools.DomTools;
|
||||
@ -16,8 +16,9 @@ export class DeesElement extends plugins.lit.LitElement {
|
||||
private elementDomReadyDeferred = plugins.domtools.plugins.smartpromise.defer();
|
||||
public elementDomReady = this.elementDomReadyDeferred.promise;
|
||||
|
||||
constructor() {
|
||||
constructor(optionsArg: plugins.domtools.IDomToolsContructorOptions = {}) {
|
||||
super();
|
||||
this.domtoolsPromise = plugins.domtools.elementBasic.setup(this, optionsArg);
|
||||
this.domtoolsPromise.then((domtoolsArg) => {
|
||||
this.domtools = domtoolsArg;
|
||||
});
|
||||
|
Reference in New Issue
Block a user