Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
b3deb31ab5 | |||
6ea5482e3d | |||
0ead7215ff | |||
286bb0887a |
14
package-lock.json
generated
14
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@designestate/dees-domtools",
|
||||
"version": "1.0.80",
|
||||
"version": "1.0.82",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@ -1949,9 +1949,9 @@
|
||||
}
|
||||
},
|
||||
"@pushrocks/smartrouter": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartrouter/-/smartrouter-1.0.6.tgz",
|
||||
"integrity": "sha512-aKhZOkHsqOUiPFA3+61vkZvInGb1lQ/68FIfT7dBrrFdHXXPo6tY8cm+GnT4ELUnXLpZBmnNm2rxLa22z6j4dg==",
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartrouter/-/smartrouter-1.0.7.tgz",
|
||||
"integrity": "sha512-ns4ye4uyzjpFUDr/vciOZog4y5QDsFBxwnYmXkSMxCA7hwiL0Fn64lvCexjez05t6Gz54ge5yflWSvyv63X0kA==",
|
||||
"requires": {
|
||||
"path-to-regexp": "^6.1.0"
|
||||
}
|
||||
@ -2134,9 +2134,9 @@
|
||||
}
|
||||
},
|
||||
"@pushrocks/websetup": {
|
||||
"version": "3.0.11",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fwebsetup/-/websetup-3.0.11.tgz",
|
||||
"integrity": "sha512-5nQqrQSiP5/WUv5pLsmjYAkfGosi2DqEH1mNrliOTr6iA8syGQ7bOQk4JY7jApjk64wO5L7l8qBGvKJuZ+p9Dw==",
|
||||
"version": "3.0.12",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fwebsetup/-/websetup-3.0.12.tgz",
|
||||
"integrity": "sha512-/E1IJQF0uG29E+Opb/pm/byq6Gd5P0ZZHuyZ4iVeIzSqMI4QC+W2IxwkXYDtbOLFAXDCe0qsn+6xako+WvAeEA==",
|
||||
"requires": {
|
||||
"@pushrocks/smartdelay": "^2.0.10",
|
||||
"@pushrocks/smartpromise": "^3.1.3",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@designestate/dees-domtools",
|
||||
"version": "1.0.80",
|
||||
"version": "1.0.82",
|
||||
"private": false,
|
||||
"description": "tools to simplify complex css structures",
|
||||
"main": "dist_ts/index.js",
|
||||
@ -27,11 +27,11 @@
|
||||
"@pushrocks/lik": "^4.0.20",
|
||||
"@pushrocks/smartdelay": "^2.0.10",
|
||||
"@pushrocks/smartpromise": "^3.1.3",
|
||||
"@pushrocks/smartrouter": "^1.0.6",
|
||||
"@pushrocks/smartrouter": "^1.0.7",
|
||||
"@pushrocks/smartrx": "^2.0.19",
|
||||
"@pushrocks/smartstate": "^1.0.21",
|
||||
"@pushrocks/webrequest": "^2.0.13",
|
||||
"@pushrocks/websetup": "^3.0.11",
|
||||
"@pushrocks/websetup": "^3.0.12",
|
||||
"@pushrocks/webstore": "^1.0.16",
|
||||
"lit-element": "^2.4.0",
|
||||
"sweet-scroll": "^4.0.0"
|
||||
|
@ -4,7 +4,7 @@ import * as plugins from './domtools.plugins';
|
||||
|
||||
export class ThemeManager {
|
||||
public domtoolsRef: DomTools;
|
||||
|
||||
|
||||
public goBrightBoolean = false;
|
||||
public preferredColorSchemeMediaMatch = window.matchMedia('(prefers-color-scheme: light)');
|
||||
|
||||
@ -15,7 +15,7 @@ export class ThemeManager {
|
||||
|
||||
// lets care
|
||||
this.goBrightBoolean = this.preferredColorSchemeMediaMatch.matches;
|
||||
this.preferredColorSchemeMediaMatch.addEventListener('change', eventArg => {
|
||||
this.preferredColorSchemeMediaMatch.addEventListener('change', (eventArg) => {
|
||||
this.goBrightBoolean = eventArg.matches;
|
||||
this.updateAllConnectedElements();
|
||||
});
|
||||
@ -23,7 +23,9 @@ export class ThemeManager {
|
||||
}
|
||||
|
||||
private async updateAllConnectedElements() {
|
||||
document.body.style.background = this.goBrightBoolean ? '#fff' : '#000';
|
||||
if (document.body && document.body.style) {
|
||||
document.body.style.background = this.goBrightBoolean ? '#fff' : '#000';
|
||||
}
|
||||
this.themeObservable.next(this.goBrightBoolean);
|
||||
}
|
||||
|
||||
@ -41,4 +43,4 @@ export class ThemeManager {
|
||||
this.goBrightBoolean = !this.goBrightBoolean;
|
||||
this.updateAllConnectedElements();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user