fix(core): update
This commit is contained in:
parent
bd0b279fc2
commit
05a22599b8
5
package-lock.json
generated
5
package-lock.json
generated
@ -3169,6 +3169,11 @@
|
||||
"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": {
|
||||
"version": "3.2.4",
|
||||
"resolved": "https://verdaccio.lossless.one/symbol-tree/-/symbol-tree-3.2.4.tgz",
|
||||
|
@ -25,7 +25,8 @@
|
||||
"@pushrocks/lik": "^4.0.13",
|
||||
"@pushrocks/smartpromise": "^3.0.6",
|
||||
"@pushrocks/smartstate": "^1.0.16",
|
||||
"lit-element": "^2.3.1"
|
||||
"lit-element": "^2.3.1",
|
||||
"sweet-scroll": "^4.0.0"
|
||||
},
|
||||
"files": [
|
||||
"ts/**/*",
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { DomTools } from './domtools.classes.domtools';
|
||||
|
||||
export const desktop = 1240;
|
||||
export const tablet = 700;
|
||||
export const phablet = 500;
|
||||
export const tablet = 1024;
|
||||
export const phablet = 600;
|
||||
export const phone = 400;
|
||||
|
||||
export type TViewport = 'native' | 'desktop' | 'tablet' | 'phablet' | 'phone';
|
||||
|
@ -2,12 +2,19 @@ import * as plugins from './domtools.plugins';
|
||||
import { Stringmap } from '@pushrocks/lik/dist_ts/lik.stringmap';
|
||||
import { FastMap } from '@pushrocks/lik/dist_ts/lik.fastmap';
|
||||
import { TViewport } from './domtools.breakpoints';
|
||||
import { DomToolsRouter } from './domtools.classes.router';
|
||||
|
||||
export interface IDomToolsState {
|
||||
virtualViewport: TViewport;
|
||||
}
|
||||
|
||||
export class DomTools {
|
||||
// ======
|
||||
// STATIC
|
||||
// ======
|
||||
/**
|
||||
* setups domtools
|
||||
*/
|
||||
public static async setupDomTools() {
|
||||
let domToolsInstance: DomTools;
|
||||
if (!globalThis.deesDomTools) {
|
||||
@ -30,17 +37,26 @@ export class DomTools {
|
||||
return domToolsInstance;
|
||||
}
|
||||
|
||||
// ========
|
||||
// INSTANCE
|
||||
// ========
|
||||
public smartstate = new plugins.smartstate.Smartstate();
|
||||
public domToolsStatePart = this.smartstate.getStatePart<IDomToolsState>('domtools', {
|
||||
virtualViewport: 'native'
|
||||
virtualViewport: 'native',
|
||||
});
|
||||
|
||||
public actionSetVirtualViewport = this.domToolsStatePart.createAction<TViewport>(async (statePart, payload) => {
|
||||
const currentState = statePart.getState();
|
||||
currentState.virtualViewport = payload;
|
||||
return currentState;
|
||||
public router = new DomToolsRouter({
|
||||
debug: false
|
||||
});
|
||||
|
||||
private actionSetVirtualViewport = this.domToolsStatePart.createAction<TViewport>(
|
||||
async (statePart, payload) => {
|
||||
const currentState = statePart.getState();
|
||||
currentState.virtualViewport = payload;
|
||||
return currentState;
|
||||
}
|
||||
);
|
||||
|
||||
public domToolsReady = plugins.smartpromise.defer();
|
||||
public domReady = plugins.smartpromise.defer();
|
||||
public globalStylesReady = plugins.smartpromise.defer();
|
||||
@ -51,12 +67,10 @@ export class DomTools {
|
||||
bodyElement: HTMLElement;
|
||||
} = {
|
||||
headElement: null,
|
||||
bodyElement: null
|
||||
bodyElement: null,
|
||||
};
|
||||
|
||||
constructor() {
|
||||
|
||||
}
|
||||
constructor() {}
|
||||
|
||||
public async setGlobalStyles(stylesText: string) {
|
||||
await this.domReady.promise;
|
||||
@ -83,7 +97,7 @@ export class DomTools {
|
||||
this.runOnceTrackerStringMap.removeString(runningId);
|
||||
}
|
||||
return await this.runOnceTrackerStringMap.registerUntilTrue(
|
||||
stringMap => {
|
||||
(stringMap) => {
|
||||
return !stringMap.includes(runningId);
|
||||
},
|
||||
() => {
|
||||
|
@ -1 +0,0 @@
|
||||
import * as plugins from './domtools.plugins';
|
1
ts/domtools.move.ts
Normal file
1
ts/domtools.move.ts
Normal file
@ -0,0 +1 @@
|
||||
import * as plugins from './domtools.plugins';
|
Loading…
Reference in New Issue
Block a user