Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
20f06e5935 | |||
d3fa33f0cc | |||
aa91dad272 | |||
05a22599b8 | |||
bd0b279fc2 | |||
8276a5b09b | |||
a9200859ec | |||
210a0ad8a1 | |||
2756a3cb68 | |||
acf0ea3874 |
41
package-lock.json
generated
41
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@designestate/dees-domtools",
|
||||
"version": "1.0.23",
|
||||
"version": "1.0.28",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@ -1072,16 +1072,15 @@
|
||||
}
|
||||
},
|
||||
"@pushrocks/lik": {
|
||||
"version": "4.0.12",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-4.0.12.tgz",
|
||||
"integrity": "sha512-ffd3bJL+kMuhXDulO5VC5OqgfhZR3I4HoVN7IBLlN1z6Dco6j4NFrp+/GKDoPssFPNQY4okv+N4Hm2T/7t+4CQ==",
|
||||
"version": "4.0.13",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-4.0.13.tgz",
|
||||
"integrity": "sha512-Nde8rq1DjaDCREKlGGY/zS8g+eFu4zSU2jrbO4DdtYD+9oiauBMz2jzao3fr8401XpNW1Ex8T8FPdjUW8lUMow==",
|
||||
"requires": {
|
||||
"@pushrocks/smartdelay": "^2.0.9",
|
||||
"@pushrocks/smartmatch": "^1.0.7",
|
||||
"@pushrocks/smartpromise": "^3.0.6",
|
||||
"@pushrocks/smartrx": "^2.0.15",
|
||||
"@pushrocks/smarttime": "^3.0.18",
|
||||
"@pushrocks/smartunique": "^3.0.3",
|
||||
"@types/minimatch": "^3.0.3",
|
||||
"symbol-tree": "^3.2.4"
|
||||
},
|
||||
@ -1338,6 +1337,14 @@
|
||||
"form-data": "^2.5.1"
|
||||
}
|
||||
},
|
||||
"@pushrocks/smartrouter": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartrouter/-/smartrouter-1.0.2.tgz",
|
||||
"integrity": "sha512-G7/Mb03TLOyarpDngfTOeWZqQv3GxMoG2JtoPH4mQ0y7SosQdaminnx++oopmP/CTzyj5mtAPCnWv/qcDBkv7Q==",
|
||||
"requires": {
|
||||
"path-to-regexp": "^6.1.0"
|
||||
}
|
||||
},
|
||||
"@pushrocks/smartrx": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartrx/-/smartrx-2.0.5.tgz",
|
||||
@ -1423,6 +1430,7 @@
|
||||
"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",
|
||||
@ -1643,7 +1651,8 @@
|
||||
"@types/shortid": {
|
||||
"version": "0.0.29",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fshortid/-/shortid-0.0.29.tgz",
|
||||
"integrity": "sha1-gJPuBBam4r8qpjOBCRFLP7/6Dps="
|
||||
"integrity": "sha1-gJPuBBam4r8qpjOBCRFLP7/6Dps=",
|
||||
"dev": true
|
||||
},
|
||||
"@types/through2": {
|
||||
"version": "2.0.36",
|
||||
@ -1674,7 +1683,8 @@
|
||||
"@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=="
|
||||
"integrity": "sha512-WGZCqBZZ0mXN2RxvLHL6/7RCu+OWs28jgQMP04LWfpyJlQUMTR6YU9CNJAKDgbw+EV/u687INXuLUc7FuML/4g==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/which": {
|
||||
"version": "1.3.2",
|
||||
@ -2634,7 +2644,8 @@
|
||||
"nanoid": {
|
||||
"version": "2.1.11",
|
||||
"resolved": "https://verdaccio.lossless.one/nanoid/-/nanoid-2.1.11.tgz",
|
||||
"integrity": "sha512-s/snB+WGm6uwi0WjsZdaVcuf3KJXlfGl2LcxgwkEwJF0D/BWzVWAZW/XY4bFaiR7s0Jk3FPvlnepg1H1b1UwlA=="
|
||||
"integrity": "sha512-s/snB+WGm6uwi0WjsZdaVcuf3KJXlfGl2LcxgwkEwJF0D/BWzVWAZW/XY4bFaiR7s0Jk3FPvlnepg1H1b1UwlA==",
|
||||
"dev": true
|
||||
},
|
||||
"no-case": {
|
||||
"version": "2.3.2",
|
||||
@ -2768,6 +2779,11 @@
|
||||
"integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==",
|
||||
"dev": true
|
||||
},
|
||||
"path-to-regexp": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://verdaccio.lossless.one/path-to-regexp/-/path-to-regexp-6.1.0.tgz",
|
||||
"integrity": "sha512-h9DqehX3zZZDCEm+xbfU0ZmwCGFCAAraPJWMXJ4+v32NjZJilVg3k1TcKsRgIb8IQ/izZSaydDc1OhJCZvs2Dw=="
|
||||
},
|
||||
"pathval": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://verdaccio.lossless.one/pathval/-/pathval-1.1.0.tgz",
|
||||
@ -3057,6 +3073,7 @@
|
||||
"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"
|
||||
}
|
||||
@ -3165,6 +3182,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",
|
||||
@ -3342,7 +3364,8 @@
|
||||
"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=="
|
||||
"integrity": "sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg==",
|
||||
"dev": true
|
||||
},
|
||||
"wcwidth": {
|
||||
"version": "1.0.1",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@designestate/dees-domtools",
|
||||
"version": "1.0.23",
|
||||
"version": "1.0.28",
|
||||
"private": false,
|
||||
"description": "tools to simplify complex css structures",
|
||||
"main": "dist_ts/index.js",
|
||||
@ -22,10 +22,12 @@
|
||||
"tslint-config-prettier": "^1.15.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pushrocks/lik": "^4.0.12",
|
||||
"@pushrocks/lik": "^4.0.13",
|
||||
"@pushrocks/smartpromise": "^3.0.6",
|
||||
"@pushrocks/smartrouter": "^1.0.2",
|
||||
"@pushrocks/smartstate": "^1.0.16",
|
||||
"lit-element": "^2.3.1"
|
||||
"lit-element": "^2.3.1",
|
||||
"sweet-scroll": "^4.0.0"
|
||||
},
|
||||
"files": [
|
||||
"ts/**/*",
|
||||
|
@ -15,6 +15,8 @@ tools to simplify complex css structures
|
||||
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||
[](https://prettier.io/)
|
||||
[](https://prettier.io/)
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { DomTools } from './domtools.classes.domtools';
|
||||
|
||||
export const desktop = 1240;
|
||||
export const tablet = 700;
|
||||
export const phablet = 500;
|
||||
export const phone = 340;
|
||||
export const tablet = 1024;
|
||||
export const phablet = 600;
|
||||
export const phone = 400;
|
||||
|
||||
export type TViewport = 'native' | 'desktop' | 'tablet' | 'phablet' | 'phone';
|
||||
|
||||
@ -15,7 +15,7 @@ export const getEnvironment = (): TViewport => {
|
||||
}
|
||||
};
|
||||
|
||||
export const cssForTablet = async (contentArg) => {
|
||||
export const cssForTablet = (contentArg) => {
|
||||
if (getEnvironment() === 'native' || getEnvironment() === 'desktop') {
|
||||
return `
|
||||
@media (max-width: ${tablet}px) {
|
||||
@ -35,7 +35,7 @@ export const cssForTablet = async (contentArg) => {
|
||||
}
|
||||
};
|
||||
|
||||
export const cssForPhablet = async (contentArg) => {
|
||||
export const cssForPhablet = (contentArg) => {
|
||||
if (getEnvironment() === 'native' || getEnvironment() === 'desktop') {
|
||||
return `
|
||||
@media (max-width: ${phablet}px) {
|
||||
@ -51,7 +51,7 @@ export const cssForPhablet = async (contentArg) => {
|
||||
}
|
||||
};
|
||||
|
||||
export const cssForPhone = async (contentArg) => {
|
||||
export const cssForPhone = (contentArg) => {
|
||||
if (getEnvironment() === 'native' || getEnvironment() === 'desktop') {
|
||||
return `
|
||||
@media (max-width: ${phone}px) {
|
||||
|
@ -8,6 +8,12 @@ export interface IDomToolsState {
|
||||
}
|
||||
|
||||
export class DomTools {
|
||||
// ======
|
||||
// STATIC
|
||||
// ======
|
||||
/**
|
||||
* setups domtools
|
||||
*/
|
||||
public static async setupDomTools() {
|
||||
let domToolsInstance: DomTools;
|
||||
if (!globalThis.deesDomTools) {
|
||||
@ -30,16 +36,25 @@ 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) => {
|
||||
public router = new plugins.smartrouter.SmartRouter({
|
||||
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();
|
||||
@ -51,12 +66,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 +96,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';
|
@ -1,5 +1,6 @@
|
||||
// pushrocks scope
|
||||
import * as smartpromise from '@pushrocks/smartpromise';
|
||||
import * as smartrouter from '@pushrocks/smartrouter';
|
||||
import * as smartstate from '@pushrocks/smartstate';
|
||||
|
||||
export { smartpromise, smartstate };
|
||||
export { smartpromise, smartrouter, smartstate };
|
||||
|
Reference in New Issue
Block a user