Compare commits

...

4 Commits

Author SHA1 Message Date
f5fd0662d3 1.0.100 2021-11-26 15:26:16 +01:00
14c91ed81f fix(core): update 2021-11-26 15:26:15 +01:00
1aabacdf87 1.0.99 2021-11-21 16:14:28 +01:00
1747afe04a fix(core): update 2021-11-21 16:14:27 +01:00
4 changed files with 22 additions and 10 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "@designestate/dees-domtools", "name": "@designestate/dees-domtools",
"version": "1.0.98", "version": "1.0.100",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@designestate/dees-domtools", "name": "@designestate/dees-domtools",
"version": "1.0.98", "version": "1.0.100",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@apiglobal/typedrequest": "^1.0.65", "@apiglobal/typedrequest": "^1.0.65",

View File

@ -1,6 +1,6 @@
{ {
"name": "@designestate/dees-domtools", "name": "@designestate/dees-domtools",
"version": "1.0.98", "version": "1.0.100",
"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",

View File

@ -90,7 +90,7 @@ export class DomTools {
}); // TODO: switch to scroller class }); // TODO: switch to scroller class
public themeManager = new ThemeManager(this); public themeManager = new ThemeManager(this);
private actionSetVirtualViewport = this.domToolsStatePart.createAction<TViewport>( /* private actionSetVirtualViewport = this.domToolsStatePart.createAction<TViewport>(
async (statePart, payload) => { async (statePart, payload) => {
const currentState = statePart.getState(); const currentState = statePart.getState();
currentState.virtualViewport = payload; currentState.virtualViewport = payload;
@ -98,6 +98,10 @@ export class DomTools {
} }
); );
public setVirtualViewport(environmentArg: TViewport) {
this.domToolsStatePart.dispatchAction(this.actionSetVirtualViewport, environmentArg);
} */
public domToolsReady = plugins.smartpromise.defer(); public domToolsReady = plugins.smartpromise.defer();
public domReady = plugins.smartpromise.defer(); public domReady = plugins.smartpromise.defer();
public globalStylesReady = plugins.smartpromise.defer(); public globalStylesReady = plugins.smartpromise.defer();
@ -106,6 +110,7 @@ export class DomTools {
private runOnceTrackerStringMap = new Stringmap(); private runOnceTrackerStringMap = new Stringmap();
private runOnceResultMap = new FastMap(); private runOnceResultMap = new FastMap();
/** /**
* run a function once and always get the Promise of the first execution * 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 identifierArg the indentifier arg identifies functions. functions with the same identifier are considered equal
@ -131,7 +136,10 @@ export class DomTools {
} }
// setStuff // setStuff
/**
* allows to set global styles
* @param stylesText the css text you want to set
*/
public async setGlobalStyles(stylesText: string) { public async setGlobalStyles(stylesText: string) {
await this.domReady.promise; await this.domReady.promise;
const styleElement = document.createElement('style'); const styleElement = document.createElement('style');
@ -140,6 +148,10 @@ export class DomTools {
this.elements.headElement.appendChild(styleElement); this.elements.headElement.appendChild(styleElement);
} }
/**
* allows setting external css files
* @param cssLinkArg a url to an external stylesheet
*/
public async setExternalCss(cssLinkArg: string) { public async setExternalCss(cssLinkArg: string) {
const cssTag = document.createElement('link'); const cssTag = document.createElement('link');
cssTag.rel = 'stylesheet'; cssTag.rel = 'stylesheet';
@ -148,10 +160,10 @@ export class DomTools {
document.head.append(cssTag); document.head.append(cssTag);
} }
public setVirtualViewport(environmentArg: TViewport) { /**
this.domToolsStatePart.dispatchAction(this.actionSetVirtualViewport, environmentArg); * allows setting of website infos
} * @param optionsArg the website info
*/
public async setWebsiteInfo(optionsArg: plugins.websetup.IWebSetupConstructorOptions) { public async setWebsiteInfo(optionsArg: plugins.websetup.IWebSetupConstructorOptions) {
await this.websetup.setup(optionsArg); await this.websetup.setup(optionsArg);
await this.websetup.readyPromise; await this.websetup.readyPromise;

View File

@ -5,7 +5,7 @@ import { DomTools } from './domtools.classes.domtools';
*/ */
export const scrollBarStyles = (() => { export const scrollBarStyles = (() => {
const returnStyles = const returnStyles =
navigator.userAgent.indexOf('Windows') !== -1 navigator.userAgent.indexOf('Mac OS X') !== -1
? ` ? `
/* width */ /* width */
::-webkit-scrollbar { ::-webkit-scrollbar {