fix(core): update
This commit is contained in:
parent
5e1a44ad88
commit
7c805a075e
45
package-lock.json
generated
45
package-lock.json
generated
@ -1392,47 +1392,6 @@
|
||||
"@pushrocks/smarttime": "^3.0.24",
|
||||
"@types/minimatch": "^3.0.3",
|
||||
"symbol-tree": "^3.2.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pushrocks/smartdelay": {
|
||||
"version": "2.0.10",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartdelay/-/smartdelay-2.0.10.tgz",
|
||||
"integrity": "sha512-JOFpEfYiKnqcQYoUrL/jDyBDZUmlgJNm5U30MQQ3f+yci+rlFnMY5VvBBEYn5WgoX0ilwU+E15mtpDWhXcmhzg==",
|
||||
"requires": {
|
||||
"@pushrocks/smartpromise": "^3.0.6"
|
||||
}
|
||||
},
|
||||
"@pushrocks/smartrx": {
|
||||
"version": "2.0.18",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartrx/-/smartrx-2.0.18.tgz",
|
||||
"integrity": "sha512-DqUmtS7mONO6bvWEZmSLy4M9hlxNWysMYc7XOZLr50BMaa0HUNYWI1myUFCMNcbUUOxuQNig01XqR1smfIN69g==",
|
||||
"requires": {
|
||||
"@pushrocks/lik": "^4.0.14",
|
||||
"@pushrocks/smartpromise": "^3.0.6",
|
||||
"rxjs": "^6.6.0"
|
||||
}
|
||||
},
|
||||
"@pushrocks/smarttime": {
|
||||
"version": "3.0.24",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmarttime/-/smarttime-3.0.24.tgz",
|
||||
"integrity": "sha512-c/n0Y3CUnVNa3TnuXZ5aRc0bWj4RX7+XSjPes1J4HidU1yBOd9UOt6l08W8aPH5jMjT9Ei2jH0GsheaTGoVEYA==",
|
||||
"requires": {
|
||||
"@pushrocks/lik": "^4.0.13",
|
||||
"@pushrocks/smartdelay": "^2.0.10",
|
||||
"@pushrocks/smartpromise": "^3.0.2",
|
||||
"croner": "^1.1.23",
|
||||
"dayjs": "^1.8.29",
|
||||
"is-nan": "^1.3.0"
|
||||
}
|
||||
},
|
||||
"rxjs": {
|
||||
"version": "6.6.0",
|
||||
"resolved": "https://verdaccio.lossless.one/rxjs/-/rxjs-6.6.0.tgz",
|
||||
"integrity": "sha512-3HMA8z/Oz61DUHe+SdOiQyzIf4tOx5oQHmMir7IZEu6TMqCLHT4LRcmNaUS0NwOz8VLvmmBduMsoaUvMaIiqzg==",
|
||||
"requires": {
|
||||
"tslib": "^1.9.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@pushrocks/smartbrowser": {
|
||||
@ -2081,7 +2040,6 @@
|
||||
"version": "3.0.37",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmarttime/-/smarttime-3.0.37.tgz",
|
||||
"integrity": "sha512-QhucXSSB8vdQkqVzKP/aX23DwZwXG3aUvF2MJ1EruvLcQypK2xFsCoaToXN5j//jG8EBAI0ybXpGzFdx38XqIQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@pushrocks/lik": "^4.0.17",
|
||||
"@pushrocks/smartdelay": "^2.0.10",
|
||||
@ -2094,8 +2052,7 @@
|
||||
"dayjs": {
|
||||
"version": "1.9.1",
|
||||
"resolved": "https://verdaccio.lossless.one/dayjs/-/dayjs-1.9.1.tgz",
|
||||
"integrity": "sha512-01NCTBg8cuMJG1OQc6PR7T66+AFYiPwgDvdJmvJBn29NGzIG+DIFxPLNjHzwz3cpFIvG+NcwIjP9hSaPVoOaDg==",
|
||||
"dev": true
|
||||
"integrity": "sha512-01NCTBg8cuMJG1OQc6PR7T66+AFYiPwgDvdJmvJBn29NGzIG+DIFxPLNjHzwz3cpFIvG+NcwIjP9hSaPVoOaDg=="
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -6,6 +6,8 @@ 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;
|
||||
@ -66,8 +68,8 @@ export class DomTools {
|
||||
|
||||
public websetup: WebSetup = new WebSetup({
|
||||
metaObject: {
|
||||
title: 'loading...'
|
||||
}
|
||||
title: 'loading...',
|
||||
},
|
||||
});
|
||||
|
||||
public smartstate = new plugins.smartstate.Smartstate();
|
||||
@ -83,9 +85,13 @@ export class DomTools {
|
||||
smartdelay: plugins.smartdelay,
|
||||
};
|
||||
|
||||
public scroller: plugins.SweetScroll;
|
||||
|
||||
|
||||
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) => {
|
||||
@ -99,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();
|
||||
|
26
ts/domtools.classes.elementinstrumenter.ts
Normal file
26
ts/domtools.classes.elementinstrumenter.ts
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
28
ts/domtools.classes.thememanager.ts
Normal file
28
ts/domtools.classes.thememanager.ts
Normal 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;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@ 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
|
||||
@ -22,8 +22,13 @@ export const styles = html`
|
||||
* a basic setup for elements
|
||||
* makes sure everything is in check
|
||||
*/
|
||||
export const setup = async (): Promise<DomTools> => {
|
||||
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(`
|
||||
|
@ -19,7 +19,13 @@ import * as webrequest from '@pushrocks/webrequest';
|
||||
import * as websetup from '@pushrocks/websetup';
|
||||
import * as webstore from '@pushrocks/webstore';
|
||||
|
||||
export { smartdelay, smartpromise, smartrouter, smartstate, webrequest, websetup, webstore };
|
||||
// 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';
|
||||
|
Loading…
Reference in New Issue
Block a user