Compare commits

...

63 Commits

Author SHA1 Message Date
d75e66ba78 1.0.65 2020-11-23 20:41:27 +00:00
7c805a075e fix(core): update 2020-11-23 20:41:26 +00:00
5e1a44ad88 1.0.64 2020-11-21 16:50:14 +00:00
093eae2c97 fix(core): update 2020-11-21 16:50:13 +00:00
991d318de6 1.0.63 2020-11-06 01:27:47 +00:00
c7c3650fe9 fix(core): update 2020-11-06 01:27:46 +00:00
8d355f234f 1.0.62 2020-11-05 20:08:07 +00:00
a5c22ec1db fix(core): update 2020-11-05 20:08:07 +00:00
f5263a0cc4 1.0.61 2020-11-05 18:50:28 +00:00
4a022a7d1d fix(core): update 2020-11-05 18:50:28 +00:00
bd6ba6d6db 1.0.60 2020-11-05 18:08:42 +00:00
317bc63bc7 fix(core): update 2020-11-05 18:08:42 +00:00
22eeb7809b 1.0.59 2020-11-05 17:37:45 +00:00
fdd550ec21 fix(core): update 2020-11-05 17:37:45 +00:00
9db1f92ba3 1.0.58 2020-11-05 17:20:01 +00:00
772d0b0b97 fix(core): update 2020-11-05 17:20:01 +00:00
a68e9e1bf9 1.0.57 2020-11-05 15:40:35 +00:00
f9507b0dbd fix(core): update 2020-11-05 15:40:35 +00:00
f8c1a0135a 1.0.56 2020-11-04 18:35:46 +00:00
7d884f6556 fix(core): update 2020-11-04 18:35:45 +00:00
8a8ee5cd7b 1.0.55 2020-10-07 13:13:22 +00:00
1660381be6 fix(core): update 2020-10-07 13:13:21 +00:00
f0ad441415 1.0.54 2020-10-06 22:08:27 +00:00
27c087b693 fix(core): update 2020-10-06 22:08:26 +00:00
63463a751c 1.0.53 2020-09-16 15:10:53 +00:00
a01f5a5b8a fix(core): update 2020-09-16 15:10:52 +00:00
bb1ad4e037 1.0.52 2020-09-16 13:57:16 +00:00
eb871161f9 fix(core): update 2020-09-16 13:57:16 +00:00
090e5b4d42 1.0.51 2020-09-16 11:29:27 +00:00
8168dd1a0c fix(core): update 2020-09-16 11:29:26 +00:00
de15bc0d1c 1.0.50 2020-09-16 10:06:23 +00:00
13fa3d655e fix(core): update 2020-09-16 10:06:22 +00:00
18b93b860d 1.0.49 2020-09-15 20:56:34 +00:00
e8e6416b6f fix(core): update 2020-09-15 20:56:33 +00:00
fbe2f381c9 1.0.48 2020-09-15 20:24:12 +00:00
3cb0aceaad fix(core): update 2020-09-15 20:24:11 +00:00
6d6c92eee4 1.0.47 2020-09-13 15:53:31 +00:00
4385909677 fix(core): update 2020-09-13 15:53:30 +00:00
2dc36d8170 1.0.46 2020-09-13 14:58:27 +00:00
ffbde62744 fix(core): update 2020-09-13 14:58:26 +00:00
7bde843e43 1.0.45 2020-09-13 14:57:31 +00:00
faa7adcffe fix(core): update 2020-09-13 14:57:30 +00:00
7977538c05 1.0.44 2020-09-12 14:00:12 +00:00
afaa88047c 1.0.43 2020-09-12 13:14:17 +00:00
8aabe2820e fix(core): update 2020-09-12 13:14:17 +00:00
570d370c97 1.0.42 2020-09-12 13:11:11 +00:00
73552ad80f fix(core): update 2020-09-12 13:11:10 +00:00
537902aa53 1.0.41 2020-07-29 17:32:28 +00:00
e033bfa5b3 fix(core): update 2020-07-29 17:32:28 +00:00
4983e1ed90 1.0.40 2020-07-27 18:23:48 +00:00
899775b050 fix(core): update 2020-07-27 18:23:47 +00:00
7655fc0348 1.0.39 2020-07-27 17:11:01 +00:00
8aa5576318 fix(core): update 2020-07-27 17:11:00 +00:00
1ff54b0fcd 1.0.38 2020-07-15 18:58:40 +00:00
3901258272 fix(core): update 2020-07-15 18:58:40 +00:00
27380d1483 1.0.37 2020-07-15 18:12:27 +00:00
e2f9991f96 fix(core): update 2020-07-15 18:12:27 +00:00
133ce80b0a 1.0.36 2020-06-30 14:08:35 +00:00
cf12f45c9b fix(core): update 2020-06-30 14:08:35 +00:00
6cc5ec315e 1.0.35 2020-06-28 21:26:57 +00:00
88810bae2c fix(core): update 2020-06-28 21:26:57 +00:00
21369d8da5 1.0.34 2020-06-28 18:03:23 +00:00
a5973944ee fix(core): update 2020-06-28 18:03:22 +00:00
14 changed files with 9188 additions and 1075 deletions

View File

@ -19,23 +19,35 @@ mirror:
stage: security
script:
- npmci git mirror
only:
- tags
tags:
- lossless
- docker
- notpriv
audit:
auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --production --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=prod --production
tags:
- docker
auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high
- npmci command npm audit --audit-level=high --only=dev
tags:
- lossless
- docker
- notpriv
allow_failure: true
# ====================
# test stage
@ -50,9 +62,7 @@ testStable:
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- lossless
- docker
- priv
testBuild:
stage: test
@ -63,9 +73,7 @@ testBuild:
- npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- lossless
- docker
- notpriv
release:
stage: release
@ -85,6 +93,8 @@ release:
codequality:
stage: metadata
allow_failure: true
only:
- tags
script:
- npmci command npm install -g tslint typescript
- npmci npm prepare

View File

@ -15,7 +15,7 @@
"properties": {
"projectType": {
"type": "string",
"enum": ["website", "element", "service", "npm"]
"enum": ["website", "element", "service", "npm", "wcc"]
}
}
}

9944
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "@designestate/dees-domtools",
"version": "1.0.33",
"version": "1.0.65",
"private": false,
"description": "tools to simplify complex css structures",
"main": "dist_ts/index.js",
@ -13,23 +13,26 @@
"format": "(gitzone format)"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.0.22",
"@gitzone/tsbundle": "^1.0.69",
"@gitzone/tstest": "^1.0.15",
"@pushrocks/tapbundle": "^3.0.7",
"@types/node": "^14.0.5",
"tslint": "^6.1.2",
"@gitzone/tsbuild": "^2.1.25",
"@gitzone/tsbundle": "^1.0.78",
"@gitzone/tstest": "^1.0.52",
"@pushrocks/tapbundle": "^3.2.9",
"@types/node": "^14.14.6",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.15.0"
},
"dependencies": {
"@apiglobal/typedrequest": "^1.0.38",
"@pushrocks/lik": "^4.0.13",
"@pushrocks/smartpromise": "^3.0.6",
"@pushrocks/smartrouter": "^1.0.2",
"@pushrocks/smartstate": "^1.0.16",
"@pushrocks/webrequest": "^2.0.9",
"@pushrocks/websetup": "^2.0.16",
"lit-element": "^2.3.1",
"@apiglobal/typedrequest": "^1.0.54",
"@designestate/dees-comms": "^1.0.7",
"@pushrocks/lik": "^4.0.17",
"@pushrocks/smartdelay": "^2.0.10",
"@pushrocks/smartpromise": "^3.1.3",
"@pushrocks/smartrouter": "^1.0.4",
"@pushrocks/smartstate": "^1.0.17",
"@pushrocks/webrequest": "^2.0.13",
"@pushrocks/websetup": "^3.0.11",
"@pushrocks/webstore": "^1.0.16",
"lit-element": "^2.4.0",
"sweet-scroll": "^4.0.0"
},
"files": [
@ -43,5 +46,8 @@
"cli.js",
"npmextra.json",
"readme.md"
],
"browserslist": [
"last 1 chrome versions"
]
}

9
test/test.browser.ts Normal file
View File

@ -0,0 +1,9 @@
import { expect, tap } from '@pushrocks/tapbundle';
import * as domtools from '../ts/index';
tap.test('first test', async () => {
const domtoolsInstance = await domtools.DomTools.setupDomTools();
expect(domtoolsInstance).to.be.instanceof(domtools.DomTools);
});
tap.start();

View File

@ -1,8 +0,0 @@
import { expect, tap } from '@pushrocks/tapbundle';
import * as deesCsstools from '../ts/index';
tap.test('first test', async () => {
console.log('hi');
});
tap.start();

View File

@ -4,6 +4,10 @@ import { FastMap } from '@pushrocks/lik/dist_ts/lik.fastmap';
import { TViewport } from './domtools.breakpoints';
import { Scroller } from './domtools.classes.scroller';
import { delayForRandom } from '@pushrocks/smartdelay';
import { WebSetup } from '@pushrocks/websetup';
import { ElementInstrumenter } from './domtools.classes.elementinstrumenter';
import { ThemeManager } from './domtools.classes.thememanager';
export interface IDomToolsState {
virtualViewport: TViewport;
@ -21,6 +25,7 @@ export class 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') {
@ -38,6 +43,17 @@ export class DomTools {
return domToolsInstance;
}
/**
* if you can, use the static asysnc .setupDomTools() function instead since it is safer to use.
*/
public static getGlobalDomToolsSync(): DomTools {
const globalDomTools: DomTools = globalThis.deesDomTools;
if (!globalDomTools) {
throw new Error('You tried to access domtools synchronously too early');
}
return globalThis.deesDomTools;
}
// ========
// INSTANCE
// ========
@ -50,6 +66,12 @@ export class DomTools {
bodyElement: null,
};
public websetup: WebSetup = new WebSetup({
metaObject: {
title: 'loading...',
},
});
public smartstate = new plugins.smartstate.Smartstate();
public domToolsStatePart = this.smartstate.getStatePart<IDomToolsState>('domtools', {
virtualViewport: 'native',
@ -59,7 +81,17 @@ export class DomTools {
debug: false,
});
public scroller: plugins.SweetScroll;
public convenience = {
smartdelay: plugins.smartdelay,
};
public elementInstrumenter = new ElementInstrumenter();
public deesComms = new plugins.deesComms.DeesComms();
public scroller = new plugins.SweetScroll({
/* some options */
}); // TODO: switch to scroller class
public themeManager = new ThemeManager(this);
private actionSetVirtualViewport = this.domToolsStatePart.createAction<TViewport>(
async (statePart, payload) => {
@ -73,14 +105,7 @@ export class DomTools {
public domReady = plugins.smartpromise.defer();
public globalStylesReady = plugins.smartpromise.defer();
constructor() {
// lets care about third party stuff
this.domToolsReady.promise.then(() => {
this.scroller = new plugins.SweetScroll({
/* some options */
});
});
}
constructor() {}
private runOnceTrackerStringMap = new Stringmap();
private runOnceResultMap = new FastMap();
@ -123,7 +148,7 @@ export class DomTools {
}
public async setWebsiteInfo(optionsArg: plugins.websetup.IWebSetupConstructorOptions) {
const websetup = new plugins.websetup.WebSetup(optionsArg);
await websetup.setup();
await this.websetup.setup(optionsArg);
await this.websetup.readyPromise;
}
}

View File

@ -0,0 +1,26 @@
import * as plugins from './domtools.plugins';
import { LitElement } from 'lit-element';
export class ElementInstrumenter {
connectedElements = new plugins.lik.ObjectMap<LitElement>();
public instrumentElement(elementArg: LitElement) {
const originalConnectedCallback = elementArg.connectedCallback;
const originalDisconnectedCallback = elementArg.disconnectedCallback;
elementArg.connectedCallback = () => {
this.connectedElements.add(elementArg);
originalConnectedCallback.apply(elementArg);
};
elementArg.disconnectedCallback = () => {
this.connectedElements.remove(elementArg);
originalDisconnectedCallback.apply(elementArg);
};
}
public async forEachelement(eachFuncArg: (elementArg: LitElement) => Promise<void>) {
for (const elementArg of this.connectedElements.getArray()) {
await eachFuncArg(elementArg);
}
}
}

View File

@ -0,0 +1,28 @@
import { DomTools } from './domtools.classes.domtools';
import * as plugins from './domtools.plugins';
export class ThemeManager {
public domtoolsRef: DomTools;
constructor(domtoolsRefArg: DomTools) {
this.domtoolsRef = domtoolsRefArg;
}
public goBright() {
this.domtoolsRef.elementInstrumenter.forEachelement(async elementArg => {
const goBright = (elementArg as any).goBright;
if (typeof goBright === 'boolean') {
(elementArg as any).goBright = true;
}
});
}
public goDark() {
this.domtoolsRef.elementInstrumenter.forEachelement(async elementArg => {
const goBright = (elementArg as any).goBright;
if (typeof goBright === 'boolean') {
(elementArg as any).goBright = false;
}
});
}
}

28
ts/domtools.css.theme.ts Normal file
View File

@ -0,0 +1,28 @@
import { DomTools } from './domtools.classes.domtools';
/**
* changes scrollbar styles to be consistent across OS borders
*/
export const scrollBarStyles = (() => {
const returnStyles = navigator.userAgent.indexOf("Windows") !== -1 ? `
/* width */
::-webkit-scrollbar {
width: 8px;
}
/* Track */
::-webkit-scrollbar-track {
background: #111;
}
/* Handle */
::-webkit-scrollbar-thumb {
background: #666;
}
/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
background: #777;
}
` : ``;
})();

View File

@ -1,13 +1,20 @@
import * as plugins from './domtools.plugins';
import { DomTools } from './domtools.classes.domtools';
import { scrollBarStyles } from './domtools.css.theme';
import { html } from 'lit-element';
import { html, LitElement } from 'lit-element';
/**
* styles to be included in every webcomponent
*/
export const styles = html`
<style>
* {
font-family: 'Roboto', sans-serif;
box-sizing: border-box;
}
${scrollBarStyles}
</style>
`;
@ -15,8 +22,13 @@ export const styles = html`
* a basic setup for elements
* makes sure everything is in check
*/
export const setup = async () => {
export const setup = async (elementArg?: LitElement): Promise<DomTools> => {
const domTools = await DomTools.setupDomTools();
if (elementArg) {
domTools.elementInstrumenter.instrumentElement(elementArg);
}
domTools.runOnce('elementBasicSetup', async () => {
// bodyStyles
domTools.setGlobalStyles(`
@ -39,7 +51,14 @@ export const setup = async () => {
// Roboto Font
domTools.setGlobalStyles(`
@import url('https://fonts.googleapis.com/css?family=Roboto');
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;400');
@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@100;300;400');
`);
// scrollbars
domTools.setGlobalStyles(`
${scrollBarStyles}
`);
});
return domTools;
};

View File

@ -1,11 +1,31 @@
// designestate scope
import * as deesComms from '@designestate/dees-comms';
export {
deesComms
};
// apiglobal scope
import * as typedrequest from '@apiglobal/typedrequest';
export { typedrequest };
// pushrocks scope
import * as smartdelay from '@pushrocks/smartdelay';
import * as smartpromise from '@pushrocks/smartpromise';
import * as smartrouter from '@pushrocks/smartrouter';
import * as smartstate from '@pushrocks/smartstate';
import * as webrequest from '@pushrocks/webrequest';
import * as websetup from '@pushrocks/websetup';
import * as webstore from '@pushrocks/webstore';
export { smartpromise, smartrouter, smartstate, webrequest, websetup };
// subscope lik
import { ObjectMap } from '@pushrocks/lik/dist_ts/lik.objectmap';
const lik = {
ObjectMap
};
export { lik, smartdelay, smartpromise, smartrouter, smartstate, webrequest, websetup, webstore };
// third party scope
import SweetScroll from 'sweet-scroll';

View File

@ -7,3 +7,9 @@ import * as css from './domtools.css';
export { css, breakpoints, elementBasic };
export { DomTools } from './domtools.classes.domtools';
export { TypedRequest } from '@apiglobal/typedrequest';
import * as allPlugins from './domtools.plugins';
export const plugins = {
smartpromise: allPlugins.smartpromise,
};