Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
472ec3158e | |||
9a0d09d9de | |||
5975ca7320 | |||
97583c650d | |||
f5fd0662d3 | |||
14c91ed81f |
46
package-lock.json
generated
46
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@designestate/dees-domtools",
|
||||
"version": "1.0.99",
|
||||
"version": "1.0.102",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@designestate/dees-domtools",
|
||||
"version": "1.0.99",
|
||||
"version": "1.0.102",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@apiglobal/typedrequest": "^1.0.65",
|
||||
@ -20,7 +20,7 @@
|
||||
"@pushrocks/webrequest": "^2.0.13",
|
||||
"@pushrocks/websetup": "^3.0.15",
|
||||
"@pushrocks/webstore": "^1.0.16",
|
||||
"lit-element": "^3.0.2",
|
||||
"lit": "^2.0.2",
|
||||
"sweet-scroll": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -9217,6 +9217,17 @@
|
||||
"node": ">= 0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/lit": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://verdaccio.lossless.one/lit/-/lit-2.0.2.tgz",
|
||||
"integrity": "sha512-hKA/1YaSB+P+DvKWuR2q1Xzy/iayhNrJ3aveD0OQ9CKn6wUjsdnF/7LavDOJsKP/K5jzW/kXsuduPgRvTFrFJw==",
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"@lit/reactive-element": "^1.0.0",
|
||||
"lit-element": "^3.0.0",
|
||||
"lit-html": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/lit-element": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://verdaccio.lossless.one/lit-element/-/lit-element-3.0.2.tgz",
|
||||
@ -9242,6 +9253,15 @@
|
||||
"integrity": "sha512-B9btcSgPYb1q4oSOb/PrOT6Z/H+r6xuNzfH4lFli/AWhYwdtrgQkQWBbIc6mdnf6E2IL3gDXdkkqNktpU0OZQA==",
|
||||
"license": "BSD-3-Clause"
|
||||
},
|
||||
"node_modules/lit/node_modules/lit-html": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://verdaccio.lossless.one/lit-html/-/lit-html-2.0.2.tgz",
|
||||
"integrity": "sha512-dON7Zg8btb14/fWohQLQBdSgkoiQA4mIUy87evmyJHtxRq7zS6LlC32bT5EPWiof5PUQaDpF45v2OlrxHA5Clg==",
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"@types/trusted-types": "^2.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/locate-path": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://verdaccio.lossless.one/locate-path/-/locate-path-5.0.0.tgz",
|
||||
@ -22474,6 +22494,26 @@
|
||||
"type-check": "~0.3.2"
|
||||
}
|
||||
},
|
||||
"lit": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://verdaccio.lossless.one/lit/-/lit-2.0.2.tgz",
|
||||
"integrity": "sha512-hKA/1YaSB+P+DvKWuR2q1Xzy/iayhNrJ3aveD0OQ9CKn6wUjsdnF/7LavDOJsKP/K5jzW/kXsuduPgRvTFrFJw==",
|
||||
"requires": {
|
||||
"@lit/reactive-element": "^1.0.0",
|
||||
"lit-element": "^3.0.0",
|
||||
"lit-html": "^2.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"lit-html": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://verdaccio.lossless.one/lit-html/-/lit-html-2.0.2.tgz",
|
||||
"integrity": "sha512-dON7Zg8btb14/fWohQLQBdSgkoiQA4mIUy87evmyJHtxRq7zS6LlC32bT5EPWiof5PUQaDpF45v2OlrxHA5Clg==",
|
||||
"requires": {
|
||||
"@types/trusted-types": "^2.0.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"lit-element": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://verdaccio.lossless.one/lit-element/-/lit-element-3.0.2.tgz",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@designestate/dees-domtools",
|
||||
"version": "1.0.99",
|
||||
"version": "1.0.102",
|
||||
"private": false,
|
||||
"description": "tools to simplify complex css structures",
|
||||
"main": "dist_ts/index.js",
|
||||
@ -33,7 +33,7 @@
|
||||
"@pushrocks/webrequest": "^2.0.13",
|
||||
"@pushrocks/websetup": "^3.0.15",
|
||||
"@pushrocks/webstore": "^1.0.16",
|
||||
"lit-element": "^3.0.2",
|
||||
"lit": "^2.0.2",
|
||||
"sweet-scroll": "^4.0.0"
|
||||
},
|
||||
"files": [
|
||||
|
@ -1,7 +1,7 @@
|
||||
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 { TViewport } from './domtools.css.breakpoints';
|
||||
|
||||
import { Scroller } from './domtools.classes.scroller';
|
||||
import { WebSetup } from '@pushrocks/websetup';
|
||||
@ -110,6 +110,7 @@ export class DomTools {
|
||||
|
||||
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
|
||||
@ -135,7 +136,10 @@ export class DomTools {
|
||||
}
|
||||
|
||||
// setStuff
|
||||
|
||||
/**
|
||||
* allows to set global styles
|
||||
* @param stylesText the css text you want to set
|
||||
*/
|
||||
public async setGlobalStyles(stylesText: string) {
|
||||
await this.domReady.promise;
|
||||
const styleElement = document.createElement('style');
|
||||
@ -144,6 +148,10 @@ export class DomTools {
|
||||
this.elements.headElement.appendChild(styleElement);
|
||||
}
|
||||
|
||||
/**
|
||||
* allows setting external css files
|
||||
* @param cssLinkArg a url to an external stylesheet
|
||||
*/
|
||||
public async setExternalCss(cssLinkArg: string) {
|
||||
const cssTag = document.createElement('link');
|
||||
cssTag.rel = 'stylesheet';
|
||||
@ -152,8 +160,10 @@ export class DomTools {
|
||||
document.head.append(cssTag);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* allows setting of website infos
|
||||
* @param optionsArg the website info
|
||||
*/
|
||||
public async setWebsiteInfo(optionsArg: plugins.websetup.IWebSetupConstructorOptions) {
|
||||
await this.websetup.setup(optionsArg);
|
||||
await this.websetup.readyPromise;
|
||||
|
@ -1,4 +1,3 @@
|
||||
import { LitElement } from 'lit-element';
|
||||
import { DomTools } from './domtools.classes.domtools';
|
||||
import * as plugins from './domtools.plugins';
|
||||
|
||||
@ -29,16 +28,25 @@ export class ThemeManager {
|
||||
this.themeObservable.next(this.goBrightBoolean);
|
||||
}
|
||||
|
||||
/**
|
||||
* set the theme of the website to bright
|
||||
*/
|
||||
public goBright() {
|
||||
this.goBrightBoolean = true;
|
||||
this.updateAllConnectedElements();
|
||||
}
|
||||
|
||||
/**
|
||||
* set the theme of the website to dark
|
||||
*/
|
||||
public goDark() {
|
||||
this.goBrightBoolean = false;
|
||||
this.updateAllConnectedElements();
|
||||
}
|
||||
|
||||
/**
|
||||
* simply toggle between bright and dark
|
||||
*/
|
||||
public toggleDarkBright() {
|
||||
this.goBrightBoolean = !this.goBrightBoolean;
|
||||
this.updateAllConnectedElements();
|
||||
|
59
ts/domtools.css.basestyles.ts
Normal file
59
ts/domtools.css.basestyles.ts
Normal file
@ -0,0 +1,59 @@
|
||||
import { DomTools } from './domtools.classes.domtools';
|
||||
|
||||
import { css, unsafeCSS } from 'lit';
|
||||
|
||||
/**
|
||||
* changes scrollbar styles to be consistent across OS borders
|
||||
*/
|
||||
export const scrollBarStyles: string = (() => {
|
||||
const returnStyles =
|
||||
navigator.userAgent.indexOf('Mac OS X') !== -1
|
||||
? css`
|
||||
/* width */
|
||||
::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
}
|
||||
|
||||
/* Track */
|
||||
::-webkit-scrollbar-track {
|
||||
background: #111;
|
||||
}
|
||||
|
||||
/* Handle */
|
||||
::-webkit-scrollbar-thumb {
|
||||
background: #666;
|
||||
}
|
||||
|
||||
/* Handle on hover */
|
||||
::-webkit-scrollbar-thumb:hover {
|
||||
background: #777;
|
||||
}
|
||||
`.cssText
|
||||
: ``;
|
||||
return returnStyles;
|
||||
})();
|
||||
|
||||
export const globalBaseStyles: string = css`
|
||||
/* global material font */
|
||||
@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 */
|
||||
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;400');
|
||||
@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@100;300;400');
|
||||
|
||||
/* global body styles */
|
||||
body {
|
||||
margin: 0px;
|
||||
font-family: 'Roboto', sans-serif;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* scroll bar styles */
|
||||
${unsafeCSS(scrollBarStyles)}
|
||||
`.cssText;
|
@ -1,6 +1,6 @@
|
||||
import { DomTools } from './domtools.classes.domtools';
|
||||
|
||||
import { CSSResult, unsafeCSS } from 'lit-element';
|
||||
import { CSSResult, unsafeCSS } from 'lit';
|
||||
|
||||
export const desktop = 1240;
|
||||
export const tablet = 1024;
|
||||
@ -11,10 +11,10 @@ export type TViewport = 'native' | 'desktop' | 'tablet' | 'phablet' | 'phone';
|
||||
|
||||
export const cssForTablet = (cssArg: CSSResult) => {
|
||||
return unsafeCSS(`
|
||||
@container wccToolsViewport (min-width: ${tablet}px) {
|
||||
@container wccToolsViewport (max-width: ${tablet}px) {
|
||||
${cssArg.cssText}
|
||||
}
|
||||
@media (min-width: ${tablet}px) {
|
||||
@media (max-width: ${tablet}px) {
|
||||
${cssArg.cssText}
|
||||
}
|
||||
`);
|
||||
@ -22,10 +22,10 @@ export const cssForTablet = (cssArg: CSSResult) => {
|
||||
|
||||
export const cssForPhablet = (cssArg: CSSResult) => {
|
||||
return unsafeCSS(`
|
||||
@container wccToolsViewport (min-width: ${phablet}px) {
|
||||
@container wccToolsViewport (max-width: ${phablet}px) {
|
||||
${cssArg.cssText}
|
||||
}
|
||||
@media (min-width: ${phablet}px) {
|
||||
@media (max-width: ${phablet}px) {
|
||||
${cssArg.cssText}
|
||||
}
|
||||
`);
|
||||
@ -33,10 +33,10 @@ export const cssForPhablet = (cssArg: CSSResult) => {
|
||||
|
||||
export const cssForPhone = (cssArg: CSSResult) => {
|
||||
return unsafeCSS(`
|
||||
@container wccToolsViewport (min-width: ${phone}px) {
|
||||
@container wccToolsViewport (max-width: ${phone}px) {
|
||||
${cssArg.cssText}
|
||||
}
|
||||
@media (min-width: ${phone}px) {
|
||||
@media (max-width: ${phone}px) {
|
||||
${cssArg.cssText}
|
||||
}
|
||||
`);
|
@ -1,31 +0,0 @@
|
||||
import { DomTools } from './domtools.classes.domtools';
|
||||
|
||||
/**
|
||||
* changes scrollbar styles to be consistent across OS borders
|
||||
*/
|
||||
export const scrollBarStyles = (() => {
|
||||
const returnStyles =
|
||||
navigator.userAgent.indexOf('Windows') !== -1
|
||||
? `
|
||||
/* width */
|
||||
::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
}
|
||||
|
||||
/* Track */
|
||||
::-webkit-scrollbar-track {
|
||||
background: #111;
|
||||
}
|
||||
|
||||
/* Handle */
|
||||
::-webkit-scrollbar-thumb {
|
||||
background: #666;
|
||||
}
|
||||
|
||||
/* Handle on hover */
|
||||
::-webkit-scrollbar-thumb:hover {
|
||||
background: #777;
|
||||
}
|
||||
`
|
||||
: ``;
|
||||
})();
|
@ -1,8 +1,8 @@
|
||||
import * as plugins from './domtools.plugins';
|
||||
import { DomTools } from './domtools.classes.domtools';
|
||||
import { scrollBarStyles } from './domtools.css.theme';
|
||||
import { scrollBarStyles, globalBaseStyles } from './domtools.css.basestyles';
|
||||
|
||||
import { html, LitElement, css, unsafeCSS } from 'lit-element';
|
||||
import { html, LitElement, css, unsafeCSS } from 'lit';
|
||||
|
||||
export const staticStyles = css`
|
||||
* {
|
||||
@ -49,34 +49,7 @@ export const setup = async (elementArg?: LitElement): Promise<DomTools> => {
|
||||
|
||||
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/css2?family=Roboto:wght@100;300;400');
|
||||
@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@100;300;400');
|
||||
`);
|
||||
|
||||
// scrollbars
|
||||
domTools.setGlobalStyles(`
|
||||
${scrollBarStyles}
|
||||
`);
|
||||
domTools.setGlobalStyles(globalBaseStyles);
|
||||
});
|
||||
return domTools;
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
export * from './domtools.colors';
|
||||
|
||||
import * as elementBasic from './domtools.elementbasic';
|
||||
import * as breakpoints from './domtools.breakpoints';
|
||||
import * as breakpoints from './domtools.css.breakpoints';
|
||||
import * as css from './domtools.css';
|
||||
|
||||
export { css, breakpoints, elementBasic };
|
||||
|
Reference in New Issue
Block a user