fix(core): update

This commit is contained in:
Philipp Kunz 2020-05-25 15:57:47 +00:00
parent e3939865aa
commit 710e99a69a
8 changed files with 223 additions and 140 deletions

154
package-lock.json generated
View File

@ -106,16 +106,15 @@
}
},
"@pushrocks/lik": {
"version": "3.0.19",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-3.0.19.tgz",
"integrity": "sha512-N9uTtQmTJ/iZ/V7LMCKbVx/ZAmP+b8uId0pxV9Au9T0Ulu9wcg3vNpyTQARgdWfG+tI9Qc0NHgOEa9H5mbDcDA==",
"dev": true,
"version": "4.0.2",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-4.0.2.tgz",
"integrity": "sha512-m0fZNUOE2lQNLzAZ/OhJ5ppnCLWZf/63MmJk0qIVxehzx7UEMMhZJMxxx9YDD+IXNLf5eju35OcRuUNxxjthpA==",
"requires": {
"@pushrocks/smartdelay": "^2.0.6",
"@pushrocks/smartpromise": "^3.0.6",
"@pushrocks/smartrx": "^2.0.5",
"@pushrocks/smarttime": "^3.0.12",
"@pushrocks/smartunique": "^3.0.1",
"@pushrocks/smartunique": "^3.0.3",
"@types/minimatch": "^3.0.3",
"minimatch": "^3.0.4",
"symbol-tree": "^3.2.4"
@ -134,13 +133,30 @@
"@types/yargs": "^15.0.4",
"rxjs": "^6.5.5",
"yargs": "^15.3.1"
},
"dependencies": {
"@pushrocks/lik": {
"version": "3.0.19",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-3.0.19.tgz",
"integrity": "sha512-N9uTtQmTJ/iZ/V7LMCKbVx/ZAmP+b8uId0pxV9Au9T0Ulu9wcg3vNpyTQARgdWfG+tI9Qc0NHgOEa9H5mbDcDA==",
"dev": true,
"requires": {
"@pushrocks/smartdelay": "^2.0.6",
"@pushrocks/smartpromise": "^3.0.6",
"@pushrocks/smartrx": "^2.0.5",
"@pushrocks/smarttime": "^3.0.12",
"@pushrocks/smartunique": "^3.0.1",
"@types/minimatch": "^3.0.3",
"minimatch": "^3.0.4",
"symbol-tree": "^3.2.4"
}
}
}
},
"@pushrocks/smartdelay": {
"version": "2.0.6",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartdelay/-/smartdelay-2.0.6.tgz",
"integrity": "sha512-4wUnzWNhRPODpaaL5GuRaje/C5dg+TMhBxmr57PKc2fqYpy6azWJwonf/s5xpcbJLCPJRbj1x8M5MqgCFq2uvg==",
"dev": true,
"requires": {
"@pushrocks/smartpromise": "^3.0.6"
}
@ -149,7 +165,6 @@
"version": "2.0.5",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartevent/-/smartevent-2.0.5.tgz",
"integrity": "sha512-2cromUAgMFOLxi9IuAhDesWV4FGmsdNQV6k2OQZbH/0bMYeaCT5Q4IcMxb8J5F0S820XCXlwGdy5VP5M6L+hAA==",
"dev": true,
"requires": {
"@pushrocks/smartpromise": "^3.0.6",
"@pushrocks/smartrx": "^2.0.5"
@ -164,6 +179,24 @@
"@pushrocks/lik": "^3.0.5",
"@pushrocks/smartdelay": "^2.0.3",
"@pushrocks/smartlog-source-ora": "^1.0.7"
},
"dependencies": {
"@pushrocks/lik": {
"version": "3.0.19",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-3.0.19.tgz",
"integrity": "sha512-N9uTtQmTJ/iZ/V7LMCKbVx/ZAmP+b8uId0pxV9Au9T0Ulu9wcg3vNpyTQARgdWfG+tI9Qc0NHgOEa9H5mbDcDA==",
"dev": true,
"requires": {
"@pushrocks/smartdelay": "^2.0.6",
"@pushrocks/smartpromise": "^3.0.6",
"@pushrocks/smartrx": "^2.0.5",
"@pushrocks/smarttime": "^3.0.12",
"@pushrocks/smartunique": "^3.0.1",
"@types/minimatch": "^3.0.3",
"minimatch": "^3.0.4",
"symbol-tree": "^3.2.4"
}
}
}
},
"@pushrocks/smartfile": {
@ -282,12 +315,28 @@
"version": "2.0.5",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartrx/-/smartrx-2.0.5.tgz",
"integrity": "sha512-BOlIJmnCO8pxqu9f18D9UV5rIsyrmKeK/mWNMiAe/NH2OTeRPNLpgmhZBkXSKNVD8tSsD8aazs4BcACgYOg1FQ==",
"dev": true,
"requires": {
"@pushrocks/lik": "^3.0.11",
"@pushrocks/smartevent": "^2.0.3",
"@pushrocks/smartpromise": "^3.0.2",
"rxjs": "^6.5.3"
},
"dependencies": {
"@pushrocks/lik": {
"version": "3.0.19",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-3.0.19.tgz",
"integrity": "sha512-N9uTtQmTJ/iZ/V7LMCKbVx/ZAmP+b8uId0pxV9Au9T0Ulu9wcg3vNpyTQARgdWfG+tI9Qc0NHgOEa9H5mbDcDA==",
"requires": {
"@pushrocks/smartdelay": "^2.0.6",
"@pushrocks/smartpromise": "^3.0.6",
"@pushrocks/smartrx": "^2.0.5",
"@pushrocks/smarttime": "^3.0.12",
"@pushrocks/smartunique": "^3.0.1",
"@types/minimatch": "^3.0.3",
"minimatch": "^3.0.4",
"symbol-tree": "^3.2.4"
}
}
}
},
"@pushrocks/smartshell": {
@ -304,11 +353,37 @@
"which": "^1.3.1"
}
},
"@pushrocks/smartstate": {
"version": "1.0.15",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartstate/-/smartstate-1.0.15.tgz",
"integrity": "sha512-LuqA8othfyd6Ne/DaFt42K/mS7MUa9twbsFboOuXSUi/S6DNWy7Z62EHIsftrVHtgrenBeF+JZaJ8lLCVMHcng==",
"requires": {
"@pushrocks/lik": "^4.0.0",
"@pushrocks/smartpromise": "^3.0.6",
"rxjs": "^6.5.5"
},
"dependencies": {
"@pushrocks/lik": {
"version": "4.0.0",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-4.0.0.tgz",
"integrity": "sha512-M1IabZQIZZdxxx1AQiOu34nU2W/RCWvYPdobzLzSiVJVRxshpmNF/u7dTnj9eyt9hwNXDeRbjkYXn77Bt3+HuQ==",
"requires": {
"@pushrocks/smartdelay": "^2.0.6",
"@pushrocks/smartpromise": "^3.0.6",
"@pushrocks/smartrx": "^2.0.5",
"@pushrocks/smarttime": "^3.0.12",
"@pushrocks/smartunique": "^3.0.1",
"@types/minimatch": "^3.0.3",
"minimatch": "^3.0.4",
"symbol-tree": "^3.2.4"
}
}
}
},
"@pushrocks/smarttime": {
"version": "3.0.12",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmarttime/-/smarttime-3.0.12.tgz",
"integrity": "sha512-NoMt1NUhNqcF5y7fCTHoC3d/+MobzgNUg6yHbSGxFRaentQzCrMPNahQIVLbrAStf03LUUBePUjSRdPYucP1gw==",
"dev": true,
"requires": {
"@pushrocks/smartpromise": "^3.0.2",
"@types/cron": "^1.7.1",
@ -321,7 +396,6 @@
"version": "3.0.3",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartunique/-/smartunique-3.0.3.tgz",
"integrity": "sha512-f+c3s2WzzjASoRHyYTLU0kHDVWREg4sZVdi5L42bTA3CTUWNrcGUC62h4wP4U4BiPl3bopTr3LPhClZHJ738oA==",
"dev": true,
"requires": {
"@types/shortid": "0.0.29",
"@types/uuid": "^7.0.0",
@ -376,7 +450,6 @@
"version": "1.7.2",
"resolved": "https://verdaccio.lossless.one/@types%2fcron/-/cron-1.7.2.tgz",
"integrity": "sha512-AEpNLRcsVSc5AdseJKNHpz0d4e8+ow+abTaC0fKDbAU86rF1evoFF0oC2fV9FdqtfVXkG2LKshpLTJCFOpyvTg==",
"dev": true,
"requires": {
"@types/node": "*",
"moment": ">=2.14.0"
@ -418,8 +491,7 @@
"@types/luxon": {
"version": "1.24.0",
"resolved": "https://verdaccio.lossless.one/@types%2fluxon/-/luxon-1.24.0.tgz",
"integrity": "sha512-OCTdVRQf/ge2ULlGqVKRI/HwyWoKpLV3ppLt6H27yzK/qdYNJ60Sz5tUxy3Jt1RD9K4Iz1tcDWPFJArBFZNAWQ==",
"dev": true
"integrity": "sha512-OCTdVRQf/ge2ULlGqVKRI/HwyWoKpLV3ppLt6H27yzK/qdYNJ60Sz5tUxy3Jt1RD9K4Iz1tcDWPFJArBFZNAWQ=="
},
"@types/mime-types": {
"version": "2.1.0",
@ -430,20 +502,17 @@
"@types/minimatch": {
"version": "3.0.3",
"resolved": "https://verdaccio.lossless.one/@types%2fminimatch/-/minimatch-3.0.3.tgz",
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==",
"dev": true
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA=="
},
"@types/node": {
"version": "10.17.24",
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-10.17.24.tgz",
"integrity": "sha512-5SCfvCxV74kzR3uWgTYiGxrd69TbT1I6+cMx1A5kEly/IVveJBimtAMlXiEyVFn5DvUFewQWxOOiJhlxeQwxgA==",
"dev": true
"version": "14.0.5",
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-14.0.5.tgz",
"integrity": "sha512-90hiq6/VqtQgX8Sp0EzeIsv3r+ellbGj4URKj5j30tLlZvRUpnAe9YbYnjl3pJM93GyXU0tghHhvXHq+5rnCKA=="
},
"@types/shortid": {
"version": "0.0.29",
"resolved": "https://verdaccio.lossless.one/@types%2fshortid/-/shortid-0.0.29.tgz",
"integrity": "sha1-gJPuBBam4r8qpjOBCRFLP7/6Dps=",
"dev": true
"integrity": "sha1-gJPuBBam4r8qpjOBCRFLP7/6Dps="
},
"@types/through2": {
"version": "2.0.36",
@ -457,8 +526,7 @@
"@types/uuid": {
"version": "7.0.4",
"resolved": "https://verdaccio.lossless.one/@types%2fuuid/-/uuid-7.0.4.tgz",
"integrity": "sha512-WGZCqBZZ0mXN2RxvLHL6/7RCu+OWs28jgQMP04LWfpyJlQUMTR6YU9CNJAKDgbw+EV/u687INXuLUc7FuML/4g==",
"dev": true
"integrity": "sha512-WGZCqBZZ0mXN2RxvLHL6/7RCu+OWs28jgQMP04LWfpyJlQUMTR6YU9CNJAKDgbw+EV/u687INXuLUc7FuML/4g=="
},
"@types/which": {
"version": "1.3.2",
@ -544,14 +612,12 @@
"balanced-match": {
"version": "1.0.0",
"resolved": "https://verdaccio.lossless.one/balanced-match/-/balanced-match-1.0.0.tgz",
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
"dev": true
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
},
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://verdaccio.lossless.one/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@ -712,14 +778,12 @@
"concat-map": {
"version": "0.0.1",
"resolved": "https://verdaccio.lossless.one/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
"dev": true
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
},
"cron": {
"version": "1.8.2",
"resolved": "https://verdaccio.lossless.one/cron/-/cron-1.8.2.tgz",
"integrity": "sha512-Gk2c4y6xKEO8FSAUTklqtfSr7oTq0CiPQeLBG5Fl0qoXpZyMcj1SG59YL+hqq04bu6/IuEA7lMkYDAplQNKkyg==",
"dev": true,
"requires": {
"moment-timezone": "^0.5.x"
}
@ -992,8 +1056,7 @@
"luxon": {
"version": "1.24.1",
"resolved": "https://verdaccio.lossless.one/luxon/-/luxon-1.24.1.tgz",
"integrity": "sha512-CgnIMKAWT0ghcuWFfCWBnWGOddM0zu6c4wZAWmD0NN7MZTnro0+833DF6tJep+xlxRPg4KtsYEHYLfTMBQKwYg==",
"dev": true
"integrity": "sha512-CgnIMKAWT0ghcuWFfCWBnWGOddM0zu6c4wZAWmD0NN7MZTnro0+833DF6tJep+xlxRPg4KtsYEHYLfTMBQKwYg=="
},
"make-error": {
"version": "1.3.6",
@ -1026,7 +1089,6 @@
"version": "3.0.4",
"resolved": "https://verdaccio.lossless.one/minimatch/-/minimatch-3.0.4.tgz",
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"dev": true,
"requires": {
"brace-expansion": "^1.1.7"
}
@ -1049,14 +1111,12 @@
"moment": {
"version": "2.26.0",
"resolved": "https://verdaccio.lossless.one/moment/-/moment-2.26.0.tgz",
"integrity": "sha512-oIixUO+OamkUkwjhAVE18rAMfRJNsNe/Stid/gwHSOfHrOtw9EhAY2AHvdKZ/k/MggcYELFCJz/Sn2pL8b8JMw==",
"dev": true
"integrity": "sha512-oIixUO+OamkUkwjhAVE18rAMfRJNsNe/Stid/gwHSOfHrOtw9EhAY2AHvdKZ/k/MggcYELFCJz/Sn2pL8b8JMw=="
},
"moment-timezone": {
"version": "0.5.31",
"resolved": "https://verdaccio.lossless.one/moment-timezone/-/moment-timezone-0.5.31.tgz",
"integrity": "sha512-+GgHNg8xRhMXfEbv81iDtrVeTcWt0kWmTEY1XQK14dICTXnWJnT0dxdlPspwqF3keKMVPXwayEsk1DI0AA/jdA==",
"dev": true,
"requires": {
"moment": ">= 2.9.0"
}
@ -1070,8 +1130,7 @@
"nanoid": {
"version": "2.1.11",
"resolved": "https://verdaccio.lossless.one/nanoid/-/nanoid-2.1.11.tgz",
"integrity": "sha512-s/snB+WGm6uwi0WjsZdaVcuf3KJXlfGl2LcxgwkEwJF0D/BWzVWAZW/XY4bFaiR7s0Jk3FPvlnepg1H1b1UwlA==",
"dev": true
"integrity": "sha512-s/snB+WGm6uwi0WjsZdaVcuf3KJXlfGl2LcxgwkEwJF0D/BWzVWAZW/XY4bFaiR7s0Jk3FPvlnepg1H1b1UwlA=="
},
"once": {
"version": "1.4.0",
@ -1216,7 +1275,6 @@
"version": "6.5.5",
"resolved": "https://verdaccio.lossless.one/rxjs/-/rxjs-6.5.5.tgz",
"integrity": "sha512-WfQI+1gohdf0Dai/Bbmk5L5ItH5tYqm3ki2c5GdWhKjalzjg93N3avFjVStyZZz+A2Em+ZxKH5bNghw9UeylGQ==",
"dev": true,
"requires": {
"tslib": "^1.9.0"
}
@ -1243,7 +1301,6 @@
"version": "2.2.15",
"resolved": "https://verdaccio.lossless.one/shortid/-/shortid-2.2.15.tgz",
"integrity": "sha512-5EaCy2mx2Jgc/Fdn9uuDuNIIfWBpzY4XIlhoqtXF6qsf+/+SGZ+FxDdX/ZsMZiWupIWNqAEmiNY4RC+LSmCeOw==",
"dev": true,
"requires": {
"nanoid": "^2.1.0"
}
@ -1331,8 +1388,7 @@
"symbol-tree": {
"version": "3.2.4",
"resolved": "https://verdaccio.lossless.one/symbol-tree/-/symbol-tree-3.2.4.tgz",
"integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==",
"dev": true
"integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw=="
},
"through2": {
"version": "3.0.1",
@ -1365,13 +1421,12 @@
"tslib": {
"version": "1.13.0",
"resolved": "https://verdaccio.lossless.one/tslib/-/tslib-1.13.0.tgz",
"integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==",
"dev": true
"integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q=="
},
"tslint": {
"version": "5.20.1",
"resolved": "https://verdaccio.lossless.one/tslint/-/tslint-5.20.1.tgz",
"integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==",
"version": "6.1.2",
"resolved": "https://verdaccio.lossless.one/tslint/-/tslint-6.1.2.tgz",
"integrity": "sha512-UyNrLdK3E0fQG/xWNqAFAC5ugtFyPO4JJR1KyyfQAyzR8W0fTRrC91A8Wej4BntFzcvETdCSDa/4PnNYJQLYiA==",
"dev": true,
"requires": {
"@babel/code-frame": "^7.0.0",
@ -1382,10 +1437,10 @@
"glob": "^7.1.1",
"js-yaml": "^3.13.1",
"minimatch": "^3.0.4",
"mkdirp": "^0.5.1",
"mkdirp": "^0.5.3",
"resolve": "^1.3.2",
"semver": "^5.3.0",
"tslib": "^1.8.0",
"tslib": "^1.10.0",
"tsutils": "^2.29.0"
}
},
@ -1431,8 +1486,7 @@
"uuid": {
"version": "7.0.3",
"resolved": "https://verdaccio.lossless.one/uuid/-/uuid-7.0.3.tgz",
"integrity": "sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg==",
"dev": true
"integrity": "sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg=="
},
"wcwidth": {
"version": "1.0.1",

View File

@ -16,12 +16,14 @@
"@gitzone/tsbuild": "^2.0.22",
"@gitzone/tstest": "^1.0.15",
"@pushrocks/tapbundle": "^3.0.7",
"@types/node": "^10.11.7",
"tslint": "^5.11.0",
"@types/node": "^14.0.5",
"tslint": "^6.1.2",
"tslint-config-prettier": "^1.15.0"
},
"dependencies": {
"@pushrocks/lik": "^4.0.2",
"@pushrocks/smartpromise": "^3.0.6",
"@pushrocks/smartstate": "^1.0.15",
"lit-element": "^2.3.1"
},
"files": [

View File

@ -1,5 +1,61 @@
export class DeesDomTools {
public static createDomTools = () => {
globalThis.deesDomTools = new DeesDomTools();
import * as plugins from './domtools.plugins';
import { Stringmap, FastMap } from '@pushrocks/lik';
export class DomTools {
public static async setupDomTools() {
let domToolsInstance: DomTools;
if (!globalThis.deesDomTools) {
globalThis.deesDomTools = new DomTools();
domToolsInstance = globalThis.deesDomTools;
// lets make sure the dom is ready
const readyStateChangedFunc = () => {
if (document.readyState === 'interactive' || document.readyState === 'complete') {
domToolsInstance.headElement = document.querySelector('head');
domToolsInstance.bodyElement = document.querySelector('body');
domToolsInstance.domReady.resolve();
}
};
document.addEventListener('readystatechange', readyStateChangedFunc);
domToolsInstance.domToolsReady.resolve();
} else {
domToolsInstance = globalThis.deesDomTools;
}
await domToolsInstance.domToolsReady.promise;
return domToolsInstance;
}
public domToolsReady = plugins.smartpromise.defer();
public domReady = plugins.smartpromise.defer();
public globalStylesReady = plugins.smartpromise.defer();
// elements
public headElement: HTMLElement;
public bodyElement: HTMLElement;
public async setGlobalStyles(stylesText: string) {
await this.domReady.promise;
const styleElement = document.createElement('style');
styleElement.type = 'text/css';
styleElement.appendChild(document.createTextNode(stylesText));
this.headElement.appendChild(styleElement);
}
private runOnceTrackerStringMap = new Stringmap();
private runOnceResultMap = new FastMap();
public async runOnce<T>(identifierArg: string, funcArg: () => Promise<T>) {
const runningId = `${identifierArg}+runningCheck`;
if(!this.runOnceTrackerStringMap.checkString(identifierArg)) {
this.runOnceTrackerStringMap.addString(identifierArg);
this.runOnceTrackerStringMap.addString(runningId);
const result = await funcArg();
this.runOnceResultMap.addToMap(identifierArg, result);
this.runOnceTrackerStringMap.removeString(runningId);
}
return await this.runOnceTrackerStringMap.registerUntilTrue(stringMap => {
return !stringMap.includes(runningId);
}, () => {
return this.runOnceResultMap.getByKey(identifierArg);
});
}
}

View File

@ -0,0 +1,47 @@
import * as plugins from './domtools.plugins';
import { DomTools } from './domtools.classes.domtools';
import { html } from 'lit-element';
export const styles = html`
<style>
* {
font-family: 'Roboto', sans-serif;
box-sizing: border-box;
}
</style>
`;
/**
* a basic setup for elements
* makes sure everything is in check
*/
export const setup = async () => {
const domTools = await DomTools.setupDomTools();
domTools.runOnce('elementBasicSetup', async () => {
// bodyStyles
domTools.setGlobalStyles(`
body {
margin: 0px;
font-family: 'Roboto', sans-serif;
box-sizing: border-box;
}
`);
// material font
domTools.setGlobalStyles(`
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url(https://fonts.gstatic.com/s/materialicons/v42/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.woff2) format('woff2');
}
`);
// Roboto Font
domTools.setGlobalStyles(`
@import url('https://fonts.googleapis.com/css?family=Roboto');
`);
});
};

View File

@ -1,69 +0,0 @@
import { defer } from '@pushrocks/smartpromise';
const createStyleElement = (headElement: HTMLElement, styleText: string) => {
const styleElement = document.createElement('style');
styleElement.type = 'text/css';
styleElement.appendChild(document.createTextNode(styleText));
headElement.appendChild(styleElement);
};
/**
* a basic setup for elements
* makes sure everything is in check
*/
export const elementBasicSetup = async () => {
if (globalThis.deesCssToolsReady) {
await globalThis.deesCssToolsReady.promise;
} else {
// lets prevent double execution
globalThis.deesCssToolsReady = defer();
// lets make sure the dom is ready
const documentReady = defer();
const readyStateChangedFunc = () => {
if (document.readyState === 'interactive' || document.readyState === 'complete') {
console.log('elementBasicSetup: element basic setup complete')
documentReady.resolve();
} else {
console.log('elementBasicSetup: document not yet ready');
}
};
document.addEventListener('readystatechange', readyStateChangedFunc);
console.log('elementBasicSetup: waiting for document to be ready');
await documentReady.promise;
console.log('elementBasicSetup: document ready!');
// lets get started
const head = document.querySelector('head');
const body = document.querySelector('body');
// bodyStyles
const bodyStyles = `
body {
margin: 0px;
font-family: 'Roboto', sans-serif;
box-sizing: border-box;
}
`;
createStyleElement(head, bodyStyles);
// material font
const materialFontStyles = `
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url(https://fonts.gstatic.com/s/materialicons/v42/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.woff2) format('woff2');
}
`;
createStyleElement(head, materialFontStyles);
// Roboto Font
const robotoFontCss = `
@import url('https://fonts.googleapis.com/css?family=Roboto');
`;
createStyleElement(head, robotoFontCss);
globalThis.deesCssToolsReady.resolve();
}
};

View File

@ -1,9 +0,0 @@
import { html } from 'lit-element';
export const elementBasicStyles = html`
<style>
* {
font-family: 'Roboto', sans-serif;
box-sizing: border-box;
}
</style>
`;

8
ts/domtools.plugins.ts Normal file
View File

@ -0,0 +1,8 @@
// pushrocks scope
import * as smartpromise from '@pushrocks/smartpromise';
import * as smartstate from '@pushrocks/smartstate';
export {
smartpromise,
smartstate
};

View File

@ -1,15 +1,9 @@
export * from './domtools.colors';
import * as elementBasicSetup from './domtools.elementbasicsetup';
import * as elementBasicStyles from './domtools.elementbasicstyles';
import * as elementBasic from './domtools.elementbasic';
import * as breakpoints from './domtools.breakpoints';
import * as css from './domtools.css';
const elementBasic = {
setup: elementBasicSetup.elementBasicSetup,
styles: elementBasicStyles.elementBasicStyles
};
export {
css,
breakpoints,