fix(build,types): migrate smart config filename and tighten TypeScript null handling
This commit is contained in:
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@design.estate/dees-domtools',
|
||||
version: '2.5.1',
|
||||
version: '2.5.2',
|
||||
description: 'A package providing tools to simplify complex CSS structures and web development tasks, featuring TypeScript support and integration with various web technologies.'
|
||||
}
|
||||
|
||||
@@ -84,8 +84,8 @@ export class DomTools {
|
||||
// ========
|
||||
// elements
|
||||
public elements: {
|
||||
headElement: HTMLElement;
|
||||
bodyElement: HTMLElement;
|
||||
headElement: HTMLElement | null;
|
||||
bodyElement: HTMLElement | null;
|
||||
} = {
|
||||
headElement: null,
|
||||
bodyElement: null,
|
||||
@@ -100,7 +100,7 @@ export class DomTools {
|
||||
public smartstate = new plugins.smartstate.Smartstate();
|
||||
public domToolsStatePart = this.smartstate.getStatePart<IDomToolsState>('domtools', {
|
||||
virtualViewport: 'native',
|
||||
jwt: null,
|
||||
jwt: '' as string,
|
||||
});
|
||||
|
||||
public router = new plugins.smartrouter.SmartRouter({
|
||||
@@ -117,7 +117,7 @@ export class DomTools {
|
||||
public deesComms = new plugins.deesComms.DeesComms();
|
||||
public scroller = new Scroller(this);
|
||||
public themeManager = new ThemeManager(this);
|
||||
public keyboard: Keyboard = null; // Initialized after DOM ready to avoid accessing document.body before it exists
|
||||
public keyboard: Keyboard | null = null; // Initialized after DOM ready to avoid accessing document.body before it exists
|
||||
|
||||
public domToolsReady = plugins.smartpromise.defer();
|
||||
public domReady = plugins.smartpromise.defer();
|
||||
@@ -151,8 +151,8 @@ export class DomTools {
|
||||
}
|
||||
}
|
||||
return await this.runOnceTrackerStringMap.registerUntilTrue(
|
||||
(stringMap) => {
|
||||
return !stringMap.includes(runningId);
|
||||
(stringMap?: string[]) => {
|
||||
return !stringMap?.includes(runningId);
|
||||
},
|
||||
() => {
|
||||
// Check if there was an error and re-throw it
|
||||
@@ -175,7 +175,7 @@ export class DomTools {
|
||||
const styleElement = document.createElement('style');
|
||||
styleElement.type = 'text/css';
|
||||
styleElement.appendChild(document.createTextNode(stylesText));
|
||||
this.elements.headElement.appendChild(styleElement);
|
||||
this.elements.headElement!.appendChild(styleElement);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -155,13 +155,13 @@ export class Keyboard {
|
||||
}
|
||||
|
||||
public startListening() {
|
||||
this.domNode.addEventListener('keydown', this.handleKeyDown);
|
||||
this.domNode.addEventListener('keyup', this.handleKeyUp);
|
||||
this.domNode.addEventListener('keydown', this.handleKeyDown as EventListener);
|
||||
this.domNode.addEventListener('keyup', this.handleKeyUp as EventListener);
|
||||
}
|
||||
|
||||
public stopListening() {
|
||||
this.domNode.removeEventListener('keydown', this.handleKeyDown);
|
||||
this.domNode.removeEventListener('keyup', this.handleKeyUp);
|
||||
this.domNode.removeEventListener('keydown', this.handleKeyDown as EventListener);
|
||||
this.domNode.removeEventListener('keyup', this.handleKeyUp as EventListener);
|
||||
}
|
||||
|
||||
public clear() {
|
||||
|
||||
@@ -35,7 +35,9 @@ export class Scroller {
|
||||
optionsArg: Parameters<typeof this.sweetScroller.toElement>[1]
|
||||
) {
|
||||
this.sweetScroller.toElement(elementArg, optionsArg);
|
||||
await plugins.smartdelay.delayFor(optionsArg.duration);
|
||||
if (optionsArg?.duration) {
|
||||
await plugins.smartdelay.delayFor(optionsArg.duration);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user