fix(core): update

This commit is contained in:
Philipp Kunz 2020-06-03 09:07:31 +00:00
parent bd0b279fc2
commit 05a22599b8
6 changed files with 34 additions and 14 deletions

5
package-lock.json generated
View File

@ -3169,6 +3169,11 @@
"has-flag": "^3.0.0" "has-flag": "^3.0.0"
} }
}, },
"sweet-scroll": {
"version": "4.0.0",
"resolved": "https://verdaccio.lossless.one/sweet-scroll/-/sweet-scroll-4.0.0.tgz",
"integrity": "sha512-mR6fRsAQANtm3zpzhUE73KAOt2aT4ZsWzNSggiEsSqdO6Zh4gM7ioJG81EngrZEl0XAc3ZvzEfhxggOoEBc8jA=="
},
"symbol-tree": { "symbol-tree": {
"version": "3.2.4", "version": "3.2.4",
"resolved": "https://verdaccio.lossless.one/symbol-tree/-/symbol-tree-3.2.4.tgz", "resolved": "https://verdaccio.lossless.one/symbol-tree/-/symbol-tree-3.2.4.tgz",

View File

@ -25,7 +25,8 @@
"@pushrocks/lik": "^4.0.13", "@pushrocks/lik": "^4.0.13",
"@pushrocks/smartpromise": "^3.0.6", "@pushrocks/smartpromise": "^3.0.6",
"@pushrocks/smartstate": "^1.0.16", "@pushrocks/smartstate": "^1.0.16",
"lit-element": "^2.3.1" "lit-element": "^2.3.1",
"sweet-scroll": "^4.0.0"
}, },
"files": [ "files": [
"ts/**/*", "ts/**/*",

View File

@ -1,8 +1,8 @@
import { DomTools } from './domtools.classes.domtools'; import { DomTools } from './domtools.classes.domtools';
export const desktop = 1240; export const desktop = 1240;
export const tablet = 700; export const tablet = 1024;
export const phablet = 500; export const phablet = 600;
export const phone = 400; export const phone = 400;
export type TViewport = 'native' | 'desktop' | 'tablet' | 'phablet' | 'phone'; export type TViewport = 'native' | 'desktop' | 'tablet' | 'phablet' | 'phone';

View File

@ -2,12 +2,19 @@ import * as plugins from './domtools.plugins';
import { Stringmap } from '@pushrocks/lik/dist_ts/lik.stringmap'; import { Stringmap } from '@pushrocks/lik/dist_ts/lik.stringmap';
import { FastMap } from '@pushrocks/lik/dist_ts/lik.fastmap'; import { FastMap } from '@pushrocks/lik/dist_ts/lik.fastmap';
import { TViewport } from './domtools.breakpoints'; import { TViewport } from './domtools.breakpoints';
import { DomToolsRouter } from './domtools.classes.router';
export interface IDomToolsState { export interface IDomToolsState {
virtualViewport: TViewport; virtualViewport: TViewport;
} }
export class DomTools { export class DomTools {
// ======
// STATIC
// ======
/**
* setups domtools
*/
public static async setupDomTools() { public static async setupDomTools() {
let domToolsInstance: DomTools; let domToolsInstance: DomTools;
if (!globalThis.deesDomTools) { if (!globalThis.deesDomTools) {
@ -30,17 +37,26 @@ export class DomTools {
return domToolsInstance; return domToolsInstance;
} }
// ========
// INSTANCE
// ========
public smartstate = new plugins.smartstate.Smartstate(); public smartstate = new plugins.smartstate.Smartstate();
public domToolsStatePart = this.smartstate.getStatePart<IDomToolsState>('domtools', { public domToolsStatePart = this.smartstate.getStatePart<IDomToolsState>('domtools', {
virtualViewport: 'native' virtualViewport: 'native',
}); });
public actionSetVirtualViewport = this.domToolsStatePart.createAction<TViewport>(async (statePart, payload) => { public router = new DomToolsRouter({
const currentState = statePart.getState(); debug: false
currentState.virtualViewport = payload;
return currentState;
}); });
private actionSetVirtualViewport = this.domToolsStatePart.createAction<TViewport>(
async (statePart, payload) => {
const currentState = statePart.getState();
currentState.virtualViewport = payload;
return currentState;
}
);
public domToolsReady = plugins.smartpromise.defer(); public domToolsReady = plugins.smartpromise.defer();
public domReady = plugins.smartpromise.defer(); public domReady = plugins.smartpromise.defer();
public globalStylesReady = plugins.smartpromise.defer(); public globalStylesReady = plugins.smartpromise.defer();
@ -51,12 +67,10 @@ export class DomTools {
bodyElement: HTMLElement; bodyElement: HTMLElement;
} = { } = {
headElement: null, headElement: null,
bodyElement: null bodyElement: null,
}; };
constructor() { constructor() {}
}
public async setGlobalStyles(stylesText: string) { public async setGlobalStyles(stylesText: string) {
await this.domReady.promise; await this.domReady.promise;
@ -83,7 +97,7 @@ export class DomTools {
this.runOnceTrackerStringMap.removeString(runningId); this.runOnceTrackerStringMap.removeString(runningId);
} }
return await this.runOnceTrackerStringMap.registerUntilTrue( return await this.runOnceTrackerStringMap.registerUntilTrue(
stringMap => { (stringMap) => {
return !stringMap.includes(runningId); return !stringMap.includes(runningId);
}, },
() => { () => {

View File

@ -1 +0,0 @@
import * as plugins from './domtools.plugins';

1
ts/domtools.move.ts Normal file
View File

@ -0,0 +1 @@
import * as plugins from './domtools.plugins';