Compare commits
17 Commits
Author | SHA1 | Date | |
---|---|---|---|
e3939865aa | |||
ba20508642 | |||
bef4ea7bed | |||
17a8151b2f | |||
5aee15a23b | |||
38d78b4e12 | |||
ec36a516c0 | |||
1c844d35ca | |||
ecb387f59e | |||
9b3c92fef5 | |||
74cf94a69e | |||
9f76d4e920 | |||
082ef21078 | |||
4db0e6f5fc | |||
40b8c5010d | |||
16297dc630 | |||
7c3d131b46 |
@ -4,9 +4,9 @@
|
|||||||
"module": {
|
"module": {
|
||||||
"githost": "gitlab.com",
|
"githost": "gitlab.com",
|
||||||
"gitscope": "designestate",
|
"gitscope": "designestate",
|
||||||
"gitrepo": "dees-csstools",
|
"gitrepo": "dees-domtools",
|
||||||
"shortDescription": "tools to simplify complex css structures",
|
"shortDescription": "tools to simplify complex css structures",
|
||||||
"npmPackagename": "@designestate/dees-csstools",
|
"npmPackagename": "@designestate/dees-domtools",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"projectDomain": "design.estate"
|
"projectDomain": "design.estate"
|
||||||
}
|
}
|
||||||
|
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@designestate/dees-csstools",
|
"name": "@designestate/dees-domtools",
|
||||||
"version": "1.0.4",
|
"version": "1.0.13",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@designestate/dees-csstools",
|
"name": "@designestate/dees-domtools",
|
||||||
"version": "1.0.4",
|
"version": "1.0.13",
|
||||||
"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",
|
||||||
|
18
readme.md
18
readme.md
@ -1,17 +1,17 @@
|
|||||||
# @designestate/dees-csstools
|
# @designestate/dees-domtools
|
||||||
tools to simplify complex css structures
|
tools to simplify complex css structures
|
||||||
|
|
||||||
## Availabililty and Links
|
## Availabililty and Links
|
||||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@designestate/dees-csstools)
|
* [npmjs.org (npm package)](https://www.npmjs.com/package/@designestate/dees-domtools)
|
||||||
* [gitlab.com (source)](https://gitlab.com/designestate/dees-csstools)
|
* [gitlab.com (source)](https://gitlab.com/designestate/dees-domtools)
|
||||||
* [github.com (source mirror)](https://github.com/designestate/dees-csstools)
|
* [github.com (source mirror)](https://github.com/designestate/dees-domtools)
|
||||||
* [docs (typedoc)](https://designestate.gitlab.io/dees-csstools/)
|
* [docs (typedoc)](https://designestate.gitlab.io/dees-domtools/)
|
||||||
|
|
||||||
## Status for master
|
## Status for master
|
||||||
[](https://gitlab.com/designestate/dees-csstools/commits/master)
|
[](https://gitlab.com/designestate/dees-domtools/commits/master)
|
||||||
[](https://gitlab.com/designestate/dees-csstools/commits/master)
|
[](https://gitlab.com/designestate/dees-domtools/commits/master)
|
||||||
[](https://www.npmjs.com/package/@designestate/dees-csstools)
|
[](https://www.npmjs.com/package/@designestate/dees-domtools)
|
||||||
[](https://snyk.io/test/npm/@designestate/dees-csstools)
|
[](https://snyk.io/test/npm/@designestate/dees-domtools)
|
||||||
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||||
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||||
[](https://prettier.io/)
|
[](https://prettier.io/)
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
import { defer } from '@pushrocks/smartpromise';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* a basic setup for elements
|
|
||||||
* makes sure everything is in check
|
|
||||||
*/
|
|
||||||
export const elementBasicSetup = async () => {
|
|
||||||
if (globalThis.deesCssToolsReady) {
|
|
||||||
await globalThis.deesCssToolsReady.promise;
|
|
||||||
} else {
|
|
||||||
globalThis.deesCssToolsReady = defer();
|
|
||||||
globalThis.deesCssToolsReady.resolve();
|
|
||||||
}
|
|
||||||
};
|
|
5
ts/domtools.classes.domtools.ts
Normal file
5
ts/domtools.classes.domtools.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
export class DeesDomTools {
|
||||||
|
public static createDomTools = () => {
|
||||||
|
globalThis.deesDomTools = new DeesDomTools();
|
||||||
|
}
|
||||||
|
}
|
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;
|
||||||
|
}
|
7
ts/domtools.css.ts
Normal file
7
ts/domtools.css.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
export const cssGridColumns = (amountOfColumnsArg: number, gapSizeArg: number) => {
|
||||||
|
let returnString = ``;
|
||||||
|
for (let i = 0; i < amountOfColumnsArg; i++) {
|
||||||
|
returnString += ` calc((100%/${amountOfColumnsArg}) - (${gapSizeArg * (amountOfColumnsArg - 1)}px/${amountOfColumnsArg}))`;
|
||||||
|
}
|
||||||
|
return returnString;
|
||||||
|
};
|
69
ts/domtools.elementbasicsetup.ts
Normal file
69
ts/domtools.elementbasicsetup.ts
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
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();
|
||||||
|
}
|
||||||
|
};
|
17
ts/index.ts
17
ts/index.ts
@ -1,8 +1,17 @@
|
|||||||
export * from './csstools.elementbasicsetup';
|
export * from './domtools.colors';
|
||||||
export * from './csstools.elementbasicstyles';
|
|
||||||
|
|
||||||
import * as breakpoints from './csstools.breakpoints';
|
import * as elementBasicSetup from './domtools.elementbasicsetup';
|
||||||
|
import * as elementBasicStyles from './domtools.elementbasicstyles';
|
||||||
|
import * as breakpoints from './domtools.breakpoints';
|
||||||
|
import * as css from './domtools.css';
|
||||||
|
|
||||||
|
const elementBasic = {
|
||||||
|
setup: elementBasicSetup.elementBasicSetup,
|
||||||
|
styles: elementBasicStyles.elementBasicStyles
|
||||||
|
};
|
||||||
|
|
||||||
export {
|
export {
|
||||||
breakpoints
|
css,
|
||||||
|
breakpoints,
|
||||||
|
elementBasic
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user