Compare commits
61 Commits
Author | SHA1 | Date | |
---|---|---|---|
537902aa53 | |||
e033bfa5b3 | |||
4983e1ed90 | |||
899775b050 | |||
7655fc0348 | |||
8aa5576318 | |||
1ff54b0fcd | |||
3901258272 | |||
27380d1483 | |||
e2f9991f96 | |||
133ce80b0a | |||
cf12f45c9b | |||
6cc5ec315e | |||
88810bae2c | |||
21369d8da5 | |||
a5973944ee | |||
ad3f4b31fa | |||
91b50ecde5 | |||
45fecfbde8 | |||
e3e6d06969 | |||
50ace4c236 | |||
90f68965bb | |||
6c92a9cdf8 | |||
d4e24d615a | |||
37b7dca212 | |||
7d9dc1ad65 | |||
20f06e5935 | |||
d3fa33f0cc | |||
aa91dad272 | |||
05a22599b8 | |||
bd0b279fc2 | |||
8276a5b09b | |||
a9200859ec | |||
210a0ad8a1 | |||
2756a3cb68 | |||
acf0ea3874 | |||
284d2be0e3 | |||
dfb9175613 | |||
16a213f536 | |||
9869b0c6aa | |||
e63cb9669b | |||
06766c6895 | |||
48f1b02f0b | |||
f41550fa22 | |||
ac18ed0684 | |||
0ed59e850e | |||
fb36c641a9 | |||
ae74e0b4f2 | |||
d2a330e5d9 | |||
f40287fbb6 | |||
e27bd8a53f | |||
d6fc173a5b | |||
52c245d655 | |||
c2e0c0ab19 | |||
455d68338b | |||
710e99a69a | |||
e3939865aa | |||
ba20508642 | |||
bef4ea7bed | |||
17a8151b2f | |||
5aee15a23b |
9988
package-lock.json
generated
9988
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
26
package.json
26
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@designestate/dees-domtools",
|
"name": "@designestate/dees-domtools",
|
||||||
"version": "1.0.10",
|
"version": "1.0.41",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "tools to simplify complex css structures",
|
"description": "tools to simplify complex css structures",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
@ -9,20 +9,29 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/ --web)",
|
"test": "(tstest test/ --web)",
|
||||||
"build": "(tsbuild --web)",
|
"build": "(tsbuild --web && tsbundle npm)",
|
||||||
"format": "(gitzone format)"
|
"format": "(gitzone format)"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.0.22",
|
"@gitzone/tsbuild": "^2.0.22",
|
||||||
"@gitzone/tstest": "^1.0.15",
|
"@gitzone/tsbundle": "^1.0.72",
|
||||||
"@pushrocks/tapbundle": "^3.0.7",
|
"@gitzone/tstest": "^1.0.43",
|
||||||
"@types/node": "^10.11.7",
|
"@pushrocks/tapbundle": "^3.2.9",
|
||||||
"tslint": "^5.11.0",
|
"@types/node": "^14.0.26",
|
||||||
|
"tslint": "^6.1.2",
|
||||||
"tslint-config-prettier": "^1.15.0"
|
"tslint-config-prettier": "^1.15.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@apiglobal/typedrequest": "^1.0.41",
|
||||||
|
"@pushrocks/lik": "^4.0.17",
|
||||||
|
"@pushrocks/smartdelay": "^2.0.10",
|
||||||
"@pushrocks/smartpromise": "^3.0.6",
|
"@pushrocks/smartpromise": "^3.0.6",
|
||||||
"lit-element": "^2.3.1"
|
"@pushrocks/smartrouter": "^1.0.4",
|
||||||
|
"@pushrocks/smartstate": "^1.0.17",
|
||||||
|
"@pushrocks/webrequest": "^2.0.10",
|
||||||
|
"@pushrocks/websetup": "^2.0.18",
|
||||||
|
"lit-element": "^2.3.1",
|
||||||
|
"sweet-scroll": "^4.0.0"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"ts/**/*",
|
"ts/**/*",
|
||||||
@ -35,5 +44,8 @@
|
|||||||
"cli.js",
|
"cli.js",
|
||||||
"npmextra.json",
|
"npmextra.json",
|
||||||
"readme.md"
|
"readme.md"
|
||||||
|
],
|
||||||
|
"browserslist": [
|
||||||
|
"last 1 chrome versions"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
21
readme.md
21
readme.md
@ -8,13 +8,20 @@ tools to simplify complex css structures
|
|||||||
* [docs (typedoc)](https://designestate.gitlab.io/dees-domtools/)
|
* [docs (typedoc)](https://designestate.gitlab.io/dees-domtools/)
|
||||||
|
|
||||||
## Status for master
|
## Status for master
|
||||||
[](https://gitlab.com/designestate/dees-domtools/commits/master)
|
|
||||||
[](https://gitlab.com/designestate/dees-domtools/commits/master)
|
Status Category | Status Badge
|
||||||
[](https://www.npmjs.com/package/@designestate/dees-domtools)
|
-- | --
|
||||||
[](https://snyk.io/test/npm/@designestate/dees-domtools)
|
GitLab Pipelines | [](https://lossless.cloud)
|
||||||
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
GitLab Pipline Test Coverage | [](https://lossless.cloud)
|
||||||
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
npm | [](https://lossless.cloud)
|
||||||
[](https://prettier.io/)
|
Snyk | [](https://lossless.cloud)
|
||||||
|
TypeScript Support | [](https://lossless.cloud)
|
||||||
|
node Support | [](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||||
|
Code Style | [](https://lossless.cloud)
|
||||||
|
PackagePhobia (total standalone install weight) | [](https://lossless.cloud)
|
||||||
|
PackagePhobia (package size on registry) | [](https://lossless.cloud)
|
||||||
|
BundlePhobia (total size when bundled) | [](https://lossless.cloud)
|
||||||
|
Platform support | [](https://lossless.cloud) [](https://lossless.cloud)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
9
test/test.browser.ts
Normal file
9
test/test.browser.ts
Normal 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();
|
@ -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();
|
|
@ -1,24 +1,35 @@
|
|||||||
|
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 = 340;
|
export const phone = 400;
|
||||||
|
|
||||||
export type TEnvironment = 'native' | 'desktop' | 'tablet' | 'phablet' | 'phone';
|
export type TViewport = 'native' | 'desktop' | 'tablet' | 'phablet' | 'phone';
|
||||||
|
|
||||||
let environment: TEnvironment = 'native';
|
export const getEnvironment = (): TViewport => {
|
||||||
|
if (
|
||||||
export const setEnvironment = envArg => {
|
globalThis.deesDomTools &&
|
||||||
environment = envArg;
|
globalThis.deesDomTools.domToolsStatePart.getState().virtualViewport
|
||||||
|
) {
|
||||||
|
return globalThis.deesDomTools.domToolsStatePart.getState().virtualViewport;
|
||||||
|
} else {
|
||||||
|
return 'native';
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const cssForTablet = (contentArg) => {
|
export const cssForTablet = (contentArg) => {
|
||||||
if (environment === 'native' || environment === 'desktop') {
|
if (getEnvironment() === 'native' || getEnvironment() === 'desktop') {
|
||||||
return `
|
return `
|
||||||
@media (max-width: ${tablet}px) {
|
@media (max-width: ${tablet}px) {
|
||||||
${contentArg}
|
${contentArg}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
} else if (environment === 'tablet' || environment === 'phablet' || environment === 'phone') {
|
} else if (
|
||||||
|
getEnvironment() === 'tablet' ||
|
||||||
|
getEnvironment() === 'phablet' ||
|
||||||
|
getEnvironment() === 'phone'
|
||||||
|
) {
|
||||||
return `
|
return `
|
||||||
@media (min-width: 0px) {
|
@media (min-width: 0px) {
|
||||||
${contentArg}
|
${contentArg}
|
||||||
@ -28,13 +39,13 @@ export const cssForTablet = (contentArg) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const cssForPhablet = (contentArg) => {
|
export const cssForPhablet = (contentArg) => {
|
||||||
if (environment === 'native' || environment === 'desktop') {
|
if (getEnvironment() === 'native' || getEnvironment() === 'desktop') {
|
||||||
return `
|
return `
|
||||||
@media (max-width: ${phablet}px) {
|
@media (max-width: ${phablet}px) {
|
||||||
${contentArg}
|
${contentArg}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
} else if (environment === 'phablet' || environment === 'phone') {
|
} else if (getEnvironment() === 'phablet' || getEnvironment() === 'phone') {
|
||||||
return `
|
return `
|
||||||
@media (min-width: 0px) {
|
@media (min-width: 0px) {
|
||||||
${contentArg}
|
${contentArg}
|
||||||
@ -44,13 +55,13 @@ export const cssForPhablet = (contentArg) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const cssForPhone = (contentArg) => {
|
export const cssForPhone = (contentArg) => {
|
||||||
if (environment === 'native' || environment === 'desktop') {
|
if (getEnvironment() === 'native' || getEnvironment() === 'desktop') {
|
||||||
return `
|
return `
|
||||||
@media (max-width: ${phone}px) {
|
@media (max-width: ${phone}px) {
|
||||||
${contentArg}
|
${contentArg}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
} else if (environment === 'phone') {
|
} else if (getEnvironment() === 'phone') {
|
||||||
return `
|
return `
|
||||||
@media (min-width: 0px) {
|
@media (min-width: 0px) {
|
||||||
${contentArg}
|
${contentArg}
|
||||||
|
@ -1,5 +1,145 @@
|
|||||||
export class DeesDomTools {
|
import * as plugins from './domtools.plugins';
|
||||||
public static createDomTools = () => {
|
import { Stringmap } from '@pushrocks/lik/dist_ts/lik.stringmap';
|
||||||
globalThis.deesDomTools = new DeesDomTools();
|
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';
|
||||||
|
|
||||||
|
export interface IDomToolsState {
|
||||||
|
virtualViewport: TViewport;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class DomTools {
|
||||||
|
// ======
|
||||||
|
// STATIC
|
||||||
|
// ======
|
||||||
|
/**
|
||||||
|
* setups domtools
|
||||||
|
*/
|
||||||
|
public static async setupDomTools() {
|
||||||
|
let domToolsInstance: 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') {
|
||||||
|
domToolsInstance.elements.headElement = document.querySelector('head');
|
||||||
|
domToolsInstance.elements.bodyElement = document.querySelector('body');
|
||||||
|
domToolsInstance.domReady.resolve();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
document.addEventListener('readystatechange', readyStateChangedFunc);
|
||||||
|
domToolsInstance.domToolsReady.resolve();
|
||||||
|
} else {
|
||||||
|
domToolsInstance = globalThis.deesDomTools;
|
||||||
|
}
|
||||||
|
await domToolsInstance.domToolsReady.promise;
|
||||||
|
return domToolsInstance;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
|
* if you can, use the static asysnc .setupDomTools() function instead since it is safer to use.
|
||||||
|
*/
|
||||||
|
public static getGlobalDomToolsSync() {
|
||||||
|
const globalDomTools: DomTools = globalThis.deesDomTools;
|
||||||
|
if (!globalDomTools) {
|
||||||
|
throw new Error('You tried to access domtools synchronously too early');
|
||||||
|
}
|
||||||
|
return globalThis.deesDomTools;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ========
|
||||||
|
// INSTANCE
|
||||||
|
// ========
|
||||||
|
// elements
|
||||||
|
public elements: {
|
||||||
|
headElement: HTMLElement;
|
||||||
|
bodyElement: HTMLElement;
|
||||||
|
} = {
|
||||||
|
headElement: null,
|
||||||
|
bodyElement: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
public smartstate = new plugins.smartstate.Smartstate();
|
||||||
|
public domToolsStatePart = this.smartstate.getStatePart<IDomToolsState>('domtools', {
|
||||||
|
virtualViewport: 'native',
|
||||||
|
});
|
||||||
|
|
||||||
|
public router = new plugins.smartrouter.SmartRouter({
|
||||||
|
debug: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
public convenience = {
|
||||||
|
smartdelay: plugins.smartdelay
|
||||||
|
};
|
||||||
|
|
||||||
|
public scroller: plugins.SweetScroll;
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
// lets care about third party stuff
|
||||||
|
this.domToolsReady.promise.then(() => {
|
||||||
|
this.scroller = new plugins.SweetScroll({
|
||||||
|
/* some options */
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private runOnceTrackerStringMap = new Stringmap();
|
||||||
|
private runOnceResultMap = new FastMap();
|
||||||
|
/**
|
||||||
|
* run a function once and always get the Promise of the first execution
|
||||||
|
* @param identifierArg the indentifier arg identifies functions. functions with the same identifier are considered equal
|
||||||
|
* @param funcArg the actual func arg to run
|
||||||
|
*/
|
||||||
|
public async runOnce<T>(identifierArg: string, funcArg: () => Promise<T>) {
|
||||||
|
const runningId = `${identifierArg}+runningCheck`;
|
||||||
|
if (!this.runOnceTrackerStringMap.checkString(identifierArg)) {
|
||||||
|
this.runOnceTrackerStringMap.addString(identifierArg);
|
||||||
|
this.runOnceTrackerStringMap.addString(runningId);
|
||||||
|
const result = await funcArg();
|
||||||
|
this.runOnceResultMap.addToMap(identifierArg, result);
|
||||||
|
this.runOnceTrackerStringMap.removeString(runningId);
|
||||||
|
}
|
||||||
|
return await this.runOnceTrackerStringMap.registerUntilTrue(
|
||||||
|
(stringMap) => {
|
||||||
|
return !stringMap.includes(runningId);
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
return this.runOnceResultMap.getByKey(identifierArg);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// setStuff
|
||||||
|
|
||||||
|
public async setGlobalStyles(stylesText: string) {
|
||||||
|
await this.domReady.promise;
|
||||||
|
const styleElement = document.createElement('style');
|
||||||
|
styleElement.type = 'text/css';
|
||||||
|
styleElement.appendChild(document.createTextNode(stylesText));
|
||||||
|
this.elements.headElement.appendChild(styleElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
public setVirtualViewport(environmentArg: TViewport) {
|
||||||
|
this.domToolsStatePart.dispatchAction(this.actionSetVirtualViewport, environmentArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async setWebsiteInfo(optionsArg: plugins.websetup.IWebSetupConstructorOptions) {
|
||||||
|
const websetup = new plugins.websetup.WebSetup(optionsArg);
|
||||||
|
await websetup.setup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
5
ts/domtools.classes.scroller.ts
Normal file
5
ts/domtools.classes.scroller.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import * as plugins from './domtools.plugins';
|
||||||
|
|
||||||
|
export class Scroller {
|
||||||
|
// TODO: move sweet scroll over to here;
|
||||||
|
}
|
6
ts/domtools.colors.ts
Normal file
6
ts/domtools.colors.ts
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
export interface IDeesColorSet {
|
||||||
|
primaryAccent: string;
|
||||||
|
secondaryAccent: string;
|
||||||
|
primaryBackground: string;
|
||||||
|
secondaryBackground: string;
|
||||||
|
}
|
@ -1,7 +1,9 @@
|
|||||||
export const cssGridColumns = (amountOfColumnsArg: number, gapSizeArg: number) => {
|
export const cssGridColumns = (amountOfColumnsArg: number, gapSizeArg: number) => {
|
||||||
let returnString = ``;
|
let returnString = ``;
|
||||||
for (let i = 0; i < amountOfColumnsArg; i++) {
|
for (let i = 0; i < amountOfColumnsArg; i++) {
|
||||||
returnString += ` calc((100%/${amountOfColumnsArg}) - (${gapSizeArg * (amountOfColumnsArg - 1)}px/${amountOfColumnsArg}))`;
|
returnString += ` calc((100%/${amountOfColumnsArg}) - (${
|
||||||
|
gapSizeArg * (amountOfColumnsArg - 1)
|
||||||
|
}px/${amountOfColumnsArg}))`;
|
||||||
}
|
}
|
||||||
return returnString;
|
return returnString;
|
||||||
};
|
};
|
||||||
|
45
ts/domtools.elementbasic.ts
Normal file
45
ts/domtools.elementbasic.ts
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
import * as plugins from './domtools.plugins';
|
||||||
|
import { DomTools } from './domtools.classes.domtools';
|
||||||
|
|
||||||
|
import { html } from 'lit-element';
|
||||||
|
export const styles = html`
|
||||||
|
<style>
|
||||||
|
* {
|
||||||
|
font-family: 'Roboto', sans-serif;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
`;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* a basic setup for elements
|
||||||
|
* makes sure everything is in check
|
||||||
|
*/
|
||||||
|
export const setup = async () => {
|
||||||
|
const domTools = await DomTools.setupDomTools();
|
||||||
|
domTools.runOnce('elementBasicSetup', async () => {
|
||||||
|
// bodyStyles
|
||||||
|
domTools.setGlobalStyles(`
|
||||||
|
body {
|
||||||
|
margin: 0px;
|
||||||
|
font-family: 'Roboto', sans-serif;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
`);
|
||||||
|
|
||||||
|
// material font
|
||||||
|
domTools.setGlobalStyles(`
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Material Icons';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 400;
|
||||||
|
src: url(https://fonts.gstatic.com/s/materialicons/v42/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.woff2) format('woff2');
|
||||||
|
}
|
||||||
|
`);
|
||||||
|
|
||||||
|
// Roboto Font
|
||||||
|
domTools.setGlobalStyles(`
|
||||||
|
@import url('https://fonts.googleapis.com/css?family=Roboto');
|
||||||
|
`);
|
||||||
|
});
|
||||||
|
};
|
@ -1,69 +0,0 @@
|
|||||||
import { defer } from '@pushrocks/smartpromise';
|
|
||||||
|
|
||||||
const createStyleElement = (headElement: HTMLElement, styleText: string) => {
|
|
||||||
const styleElement = document.createElement('style');
|
|
||||||
styleElement.type = 'text/css';
|
|
||||||
styleElement.appendChild(document.createTextNode(styleText));
|
|
||||||
headElement.appendChild(styleElement);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* a basic setup for elements
|
|
||||||
* makes sure everything is in check
|
|
||||||
*/
|
|
||||||
export const elementBasicSetup = async () => {
|
|
||||||
if (globalThis.deesCssToolsReady) {
|
|
||||||
await globalThis.deesCssToolsReady.promise;
|
|
||||||
} else {
|
|
||||||
// lets prevent double execution
|
|
||||||
globalThis.deesCssToolsReady = defer();
|
|
||||||
|
|
||||||
// lets make sure the dom is ready
|
|
||||||
const documentReady = defer();
|
|
||||||
const readyStateChangedFunc = () => {
|
|
||||||
if (document.readyState === 'interactive' || document.readyState === 'complete') {
|
|
||||||
console.log('elementBasicSetup: element basic setup complete')
|
|
||||||
documentReady.resolve();
|
|
||||||
} else {
|
|
||||||
console.log('elementBasicSetup: document not yet ready');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
document.addEventListener('readystatechange', readyStateChangedFunc);
|
|
||||||
console.log('elementBasicSetup: waiting for document to be ready');
|
|
||||||
await documentReady.promise;
|
|
||||||
console.log('elementBasicSetup: document ready!');
|
|
||||||
|
|
||||||
// lets get started
|
|
||||||
const head = document.querySelector('head');
|
|
||||||
const body = document.querySelector('body');
|
|
||||||
|
|
||||||
// bodyStyles
|
|
||||||
const bodyStyles = `
|
|
||||||
body {
|
|
||||||
margin: 0px;
|
|
||||||
font-family: 'Roboto', sans-serif;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
createStyleElement(head, bodyStyles);
|
|
||||||
|
|
||||||
// material font
|
|
||||||
const materialFontStyles = `
|
|
||||||
@font-face {
|
|
||||||
font-family: 'Material Icons';
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 400;
|
|
||||||
src: url(https://fonts.gstatic.com/s/materialicons/v42/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.woff2) format('woff2');
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
createStyleElement(head, materialFontStyles);
|
|
||||||
|
|
||||||
// Roboto Font
|
|
||||||
const robotoFontCss = `
|
|
||||||
@import url('https://fonts.googleapis.com/css?family=Roboto');
|
|
||||||
`;
|
|
||||||
createStyleElement(head, robotoFontCss);
|
|
||||||
|
|
||||||
globalThis.deesCssToolsReady.resolve();
|
|
||||||
}
|
|
||||||
};
|
|
@ -1,9 +0,0 @@
|
|||||||
import { html } from 'lit-element';
|
|
||||||
export const elementBasicStyles = html`
|
|
||||||
<style>
|
|
||||||
* {
|
|
||||||
font-family: 'Roboto', sans-serif;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
`;
|
|
19
ts/domtools.plugins.ts
Normal file
19
ts/domtools.plugins.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// api glbal 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';
|
||||||
|
|
||||||
|
export { smartdelay, smartpromise, smartrouter, smartstate, webrequest, websetup };
|
||||||
|
|
||||||
|
// third party scope
|
||||||
|
import SweetScroll from 'sweet-scroll';
|
||||||
|
|
||||||
|
export { SweetScroll };
|
15
ts/index.ts
15
ts/index.ts
@ -1,10 +1,15 @@
|
|||||||
export * from './domtools.elementbasicsetup';
|
export * from './domtools.colors';
|
||||||
export * from './domtools.elementbasicstyles';
|
|
||||||
|
|
||||||
|
import * as elementBasic from './domtools.elementbasic';
|
||||||
import * as breakpoints from './domtools.breakpoints';
|
import * as breakpoints from './domtools.breakpoints';
|
||||||
import * as css from './domtools.css';
|
import * as css from './domtools.css';
|
||||||
|
|
||||||
export {
|
export { css, breakpoints, elementBasic };
|
||||||
css,
|
export { DomTools } from './domtools.classes.domtools';
|
||||||
breakpoints
|
export { TypedRequest } from '@apiglobal/typedrequest';
|
||||||
|
|
||||||
|
import * as allPlugins from './domtools.plugins';
|
||||||
|
|
||||||
|
export const plugins = {
|
||||||
|
smartpromise: allPlugins.smartpromise,
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user