@lexriver/dome 1.5.11 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/{AnimatedArray.d.ts → src/AnimatedArray.d.mts} +29 -29
- package/out/{AnimatedArray.js → src/AnimatedArray.mjs} +52 -51
- package/out/{AnimatedTable.d.ts → src/AnimatedTable.d.mts} +38 -38
- package/out/{AnimatedTable.js → src/AnimatedTable.mjs} +88 -91
- package/out/{AnimatedText.d.ts → src/AnimatedText.d.mts} +13 -13
- package/out/{AnimatedText.js → src/AnimatedText.mjs} +24 -24
- package/out/{Animation.d.ts → src/Animation.d.mts} +4 -4
- package/out/{temp-test.d.ts → src/Animation.mjs} +1 -1
- package/out/{Dome.d.ts → src/Dome.d.mts} +9 -9
- package/out/{Dome.js → src/Dome.mjs} +291 -295
- package/out/{DomeComponent.d.ts → src/DomeComponent.d.mts} +22 -19
- package/out/{DomeComponent.js → src/DomeComponent.mjs} +47 -44
- package/out/{DomeManipulator.d.ts → src/DomeManipulator.d.mts} +48 -48
- package/out/{DomeManipulator.js → src/DomeManipulator.mjs} +329 -329
- package/out/src/DomeRouter.console-test.d.mts +1 -0
- package/out/{DomeRouter.console-test.js → src/DomeRouter.console-test.mjs} +44 -44
- package/out/{DomeRouter.d.ts → src/DomeRouter.d.mts} +30 -30
- package/out/{DomeRouter.js → src/DomeRouter.mjs} +236 -237
- package/out/{LongestCommonSubsequence.d.ts → src/LongestCommonSubsequence.d.mts} +15 -15
- package/out/{LongestCommonSubsequence.js → src/LongestCommonSubsequence.mjs} +164 -164
- package/out/src/index.d.mts +11 -0
- package/out/src/index.mjs +11 -0
- package/out/src/temp-test.d.mts +1 -0
- package/out/{temp-test.js → src/temp-test.mjs} +20 -20
- package/out/vitest.config.d.ts +2 -0
- package/out/vitest.config.js +9 -0
- package/package.json +16 -14
- package/src/{AnimatedArray.ts → AnimatedArray.mts} +3 -3
- package/src/{AnimatedTable.ts → AnimatedTable.mts} +6 -6
- package/src/{AnimatedText.ts → AnimatedText.mts} +4 -4
- package/src/{Dome.ts → Dome.mts} +7 -11
- package/src/{DomeComponent.ts → DomeComponent.mts} +3 -3
- package/src/{DomeManipulator.ts → DomeManipulator.mts} +5 -5
- package/src/{DomeRouter.ts → DomeRouter.mts} +3 -3
- package/src/index.mts +12 -0
- package/src/{temp-test.ts → temp-test.mts} +1 -1
- package/tsconfig.json +57 -60
- package/vitest.config.ts +10 -0
- package/jest.config.js +0 -22
- package/out/Animation.js +0 -0
- package/out/DomeRouter.console-test.d.ts +0 -0
- package/out/index.d.ts +0 -12
- package/out/index.js +0 -14
- package/src/index.ts +0 -14
- /package/src/{Animation.ts → Animation.mts} +0 -0
- /package/src/{DomeRouter.console-test.ts → DomeRouter.console-test.mts} +0 -0
- /package/src/{LongestCommonSubsequence.ts → LongestCommonSubsequence.mts} +0 -0
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import { Animation } from './Animation';
|
|
2
|
-
interface InternalAttrs {
|
|
3
|
-
ref?: (ref: any) => void;
|
|
4
|
-
onShowAnimation?: Animation;
|
|
5
|
-
onHideAnimation?: Animation;
|
|
6
|
-
}
|
|
7
|
-
export declare abstract class DomeComponent<Attrs> {
|
|
8
|
-
attrs: Attrs & InternalAttrs;
|
|
9
|
-
children: any;
|
|
10
|
-
rootElement: Element | HTMLElement;
|
|
11
|
-
constructor(attrs: Attrs & InternalAttrs, children: any);
|
|
12
|
-
protected init(): void;
|
|
13
|
-
protected abstract render(): HTMLElement;
|
|
14
|
-
protected afterRender(): void;
|
|
15
|
-
updateAsync(): Promise<void>;
|
|
16
|
-
scheduleUpdate:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import { Animation } from './Animation.mjs';
|
|
2
|
+
interface InternalAttrs {
|
|
3
|
+
ref?: (ref: any) => void;
|
|
4
|
+
onShowAnimation?: Animation;
|
|
5
|
+
onHideAnimation?: Animation;
|
|
6
|
+
}
|
|
7
|
+
export declare abstract class DomeComponent<Attrs> {
|
|
8
|
+
attrs: Attrs & InternalAttrs;
|
|
9
|
+
children: any;
|
|
10
|
+
rootElement: Element | HTMLElement;
|
|
11
|
+
constructor(attrs: Attrs & InternalAttrs, children: any);
|
|
12
|
+
protected init(): void;
|
|
13
|
+
protected abstract render(): HTMLElement;
|
|
14
|
+
protected afterRender(): void;
|
|
15
|
+
updateAsync(): Promise<void>;
|
|
16
|
+
scheduleUpdate: {
|
|
17
|
+
(this: unknown, ...args: [] & any[]): Promise<void>;
|
|
18
|
+
cancel: (reason?: any) => void;
|
|
19
|
+
};
|
|
20
|
+
protected afterUpdate(): void;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -1,44 +1,47 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export class DomeComponent {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
this.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
//abstract render(attrs:Attrs, children:any):HTMLElement
|
|
13
|
-
init() { }
|
|
14
|
-
afterRender() {
|
|
15
|
-
//console.log('afterRender(), el=', this.el)
|
|
16
|
-
}
|
|
17
|
-
// protected onMount(){
|
|
18
|
-
// }
|
|
19
|
-
async updateAsync() {
|
|
20
|
-
//console.log('DomeComponent: calling native update() method!') //TODO: remove this
|
|
21
|
-
if (!this.rootElement) {
|
|
22
|
-
console.error('DomeComponent: unable to update, no rootElement', 'this=', this);
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
if (!this.rootElement.parentNode) {
|
|
26
|
-
console.error('DomeComponent: unable to update, no parent for rootElement, not mounted?', 'this=', this);
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
//console.time('browser')
|
|
30
|
-
const newEl = this.render();
|
|
31
|
-
//console.log('DomeComponent: update() newEl=', newEl) //TODO: remove this
|
|
32
|
-
//DomeManipulator.unhideElement(this.el) // if was null before
|
|
33
|
-
await DomeManipulator.replaceAsync(this.rootElement, newEl, this.attrs.onHideAnimation, this.attrs.onShowAnimation);
|
|
34
|
-
this.rootElement = newEl;
|
|
35
|
-
//console.timeEnd('browser')
|
|
36
|
-
this.afterUpdate();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
1
|
+
import { debounce } from 'ts-debounce';
|
|
2
|
+
import { DomeManipulator } from "./DomeManipulator.mjs";
|
|
3
|
+
export class DomeComponent {
|
|
4
|
+
attrs;
|
|
5
|
+
children;
|
|
6
|
+
rootElement;
|
|
7
|
+
constructor(attrs, children) {
|
|
8
|
+
//this.init()
|
|
9
|
+
this.attrs = attrs;
|
|
10
|
+
this.children = children;
|
|
11
|
+
}
|
|
12
|
+
//abstract render(attrs:Attrs, children:any):HTMLElement
|
|
13
|
+
init() { }
|
|
14
|
+
afterRender() {
|
|
15
|
+
//console.log('afterRender(), el=', this.el)
|
|
16
|
+
}
|
|
17
|
+
// protected onMount(){
|
|
18
|
+
// }
|
|
19
|
+
async updateAsync() {
|
|
20
|
+
//console.log('DomeComponent: calling native update() method!') //TODO: remove this
|
|
21
|
+
if (!this.rootElement) {
|
|
22
|
+
console.error('DomeComponent: unable to update, no rootElement', 'this=', this);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (!this.rootElement.parentNode) {
|
|
26
|
+
console.error('DomeComponent: unable to update, no parent for rootElement, not mounted?', 'this=', this);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
//console.time('browser')
|
|
30
|
+
const newEl = this.render();
|
|
31
|
+
//console.log('DomeComponent: update() newEl=', newEl) //TODO: remove this
|
|
32
|
+
//DomeManipulator.unhideElement(this.el) // if was null before
|
|
33
|
+
await DomeManipulator.replaceAsync(this.rootElement, newEl, this.attrs.onHideAnimation, this.attrs.onShowAnimation);
|
|
34
|
+
this.rootElement = newEl;
|
|
35
|
+
//console.timeEnd('browser')
|
|
36
|
+
this.afterUpdate();
|
|
37
|
+
}
|
|
38
|
+
scheduleUpdate = debounce(() => {
|
|
39
|
+
this.updateAsync();
|
|
40
|
+
}, 5);
|
|
41
|
+
afterUpdate() {
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
DomeComponent.prototype['__DomeComponent'] = true;
|
|
45
|
+
// export interface DomeComponent<Attrs>{
|
|
46
|
+
// render:(attrs:Attrs)=>HTMLElement
|
|
47
|
+
// }
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Animation } from './Animation';
|
|
3
|
-
export
|
|
4
|
-
[key: string]: boolean |
|
|
5
|
-
} | string[] | string;
|
|
6
|
-
export declare
|
|
7
|
-
function hideElementAsync(element: Element, animation?: Animation): Promise<void>;
|
|
8
|
-
function unhideElementAsync(element: Element, animation?: Animation): Promise<void>;
|
|
9
|
-
function insertAsFirstChildAsync(elementToInsert: Element, parentElement: Element | DocumentFragment, animation?: Animation): Promise<void>;
|
|
10
|
-
function insertBeforeAsync(elementToInsert: Element, refElement: Element | null, parentElement: Element | DocumentFragment, animation?: Animation): Promise<void>;
|
|
11
|
-
function insertAfterAsync(elementToInsert: Element, refElement: Element | null | undefined, parentElement: Element | DocumentFragment, animation?: Animation): Promise<void>;
|
|
12
|
-
function insertByIndexAsync(elementToInsert: Element, index: number, parentElement: Element | DocumentFragment, animation?: Animation): Promise<void>;
|
|
13
|
-
function replaceAsync(oldElement: Element, newElement: Element, animationHide?: Animation, animationShow?: Animation): Promise<Element>;
|
|
14
|
-
function removeElementAsync(element: Element, animation?: Animation): Promise<void>;
|
|
15
|
-
function forEachChildrenOf(element: Element, action: (child: ChildNode) => void): void;
|
|
16
|
-
function removeAllChildrenAsync(element: Element, animation?: Animation): Promise<void>;
|
|
17
|
-
function appendChildAsync(containerElement: Element, child: Element, animation?: Animation): Promise<void>;
|
|
18
|
-
function appendChildrenAsync(containerElement: Element, children: Element | Element[] | DocumentFragment | Text | string | null | undefined, animation?: Animation): Promise<void>;
|
|
19
|
-
function replaceAllChildrenAsync(containerElement: Element, childrenToInsert: Element | Element[] | DocumentFragment | Text | string | null | undefined, animationForHide?: Animation, animationForShow?: Animation): Promise<void>;
|
|
20
|
-
function isInDom(el: Element | undefined): boolean;
|
|
21
|
-
function isOnScreen(el: Element | undefined): boolean;
|
|
22
|
-
function addCssClassAsync(element: Element, cssClassName: string, removeAfterMs?: number): Promise<void>;
|
|
23
|
-
function addCssClassesAsync(element: Element, cssClassNames: string[], removeAfterMs?: number): Promise<void>;
|
|
24
|
-
function removeCssClass(element: Element, cssClassName: string): void;
|
|
25
|
-
function removeCssClasses(element: Element, cssClassNames: string[]): void;
|
|
26
|
-
/**
|
|
27
|
-
* set css classes by array ['class1', 'class2'] or
|
|
28
|
-
* by object {class1:true, class2:false} or
|
|
29
|
-
* by Observable<boolean> {class1:true, class2:myVarO} or
|
|
30
|
-
* by string
|
|
31
|
-
* this function will replace class attribute so all classes that are not in params will be removed
|
|
32
|
-
* @param value
|
|
33
|
-
* @param element
|
|
34
|
-
*/
|
|
35
|
-
function setCssClasses(element: Element, value: CssClass): void;
|
|
36
|
-
function setAttribute(element: Element, name: string, value: any): void;
|
|
37
|
-
function hasFocus(el: Element): boolean;
|
|
38
|
-
function scrollIntoView(element: Element, paddingFromTop?: number): void;
|
|
39
|
-
const scrollToTop: () => void;
|
|
40
|
-
function getCurrentScrollPosition(): number;
|
|
41
|
-
function scrollToAsync(p: {
|
|
42
|
-
pxFromTop?: number;
|
|
43
|
-
pxFromLeft?: number;
|
|
44
|
-
smooth?: boolean;
|
|
45
|
-
msStep?: number;
|
|
46
|
-
maxMsToWait?: number;
|
|
47
|
-
}): Promise<void>;
|
|
48
|
-
}
|
|
1
|
+
import { ObservableVariable } from "@lexriver/observable";
|
|
2
|
+
import { Animation } from './Animation.mjs';
|
|
3
|
+
export type CssClass = {
|
|
4
|
+
[key: string]: boolean | ObservableVariable<boolean>;
|
|
5
|
+
} | string[] | string;
|
|
6
|
+
export declare namespace DomeManipulator {
|
|
7
|
+
function hideElementAsync(element: Element, animation?: Animation): Promise<void>;
|
|
8
|
+
function unhideElementAsync(element: Element, animation?: Animation): Promise<void>;
|
|
9
|
+
function insertAsFirstChildAsync(elementToInsert: Element, parentElement: Element | DocumentFragment, animation?: Animation): Promise<void>;
|
|
10
|
+
function insertBeforeAsync(elementToInsert: Element, refElement: Element | null, parentElement: Element | DocumentFragment, animation?: Animation): Promise<void>;
|
|
11
|
+
function insertAfterAsync(elementToInsert: Element, refElement: Element | null | undefined, parentElement: Element | DocumentFragment, animation?: Animation): Promise<void>;
|
|
12
|
+
function insertByIndexAsync(elementToInsert: Element, index: number, parentElement: Element | DocumentFragment, animation?: Animation): Promise<void>;
|
|
13
|
+
function replaceAsync(oldElement: Element, newElement: Element, animationHide?: Animation, animationShow?: Animation): Promise<Element>;
|
|
14
|
+
function removeElementAsync(element: Element, animation?: Animation): Promise<void>;
|
|
15
|
+
function forEachChildrenOf(element: Element, action: (child: ChildNode) => void): void;
|
|
16
|
+
function removeAllChildrenAsync(element: Element, animation?: Animation): Promise<void>;
|
|
17
|
+
function appendChildAsync(containerElement: Element, child: Element, animation?: Animation): Promise<void>;
|
|
18
|
+
function appendChildrenAsync(containerElement: Element, children: Element | Element[] | DocumentFragment | Text | string | null | undefined, animation?: Animation): Promise<void>;
|
|
19
|
+
function replaceAllChildrenAsync(containerElement: Element, childrenToInsert: Element | Element[] | DocumentFragment | Text | string | null | undefined, animationForHide?: Animation, animationForShow?: Animation): Promise<void>;
|
|
20
|
+
function isInDom(el: Element | undefined): boolean;
|
|
21
|
+
function isOnScreen(el: Element | undefined): boolean;
|
|
22
|
+
function addCssClassAsync(element: Element, cssClassName: string, removeAfterMs?: number): Promise<void>;
|
|
23
|
+
function addCssClassesAsync(element: Element, cssClassNames: string[], removeAfterMs?: number): Promise<void>;
|
|
24
|
+
function removeCssClass(element: Element, cssClassName: string): void;
|
|
25
|
+
function removeCssClasses(element: Element, cssClassNames: string[]): void;
|
|
26
|
+
/**
|
|
27
|
+
* set css classes by array ['class1', 'class2'] or
|
|
28
|
+
* by object {class1:true, class2:false} or
|
|
29
|
+
* by Observable<boolean> {class1:true, class2:myVarO} or
|
|
30
|
+
* by string
|
|
31
|
+
* this function will replace class attribute so all classes that are not in params will be removed
|
|
32
|
+
* @param value
|
|
33
|
+
* @param element
|
|
34
|
+
*/
|
|
35
|
+
function setCssClasses(element: Element, value: CssClass): void;
|
|
36
|
+
function setAttribute(element: Element, name: string, value: any): void;
|
|
37
|
+
function hasFocus(el: Element): boolean;
|
|
38
|
+
function scrollIntoView(element: Element, paddingFromTop?: number): void;
|
|
39
|
+
const scrollToTop: () => void;
|
|
40
|
+
function getCurrentScrollPosition(): number;
|
|
41
|
+
function scrollToAsync(p: {
|
|
42
|
+
pxFromTop?: number;
|
|
43
|
+
pxFromLeft?: number;
|
|
44
|
+
smooth?: boolean;
|
|
45
|
+
msStep?: number;
|
|
46
|
+
maxMsToWait?: number;
|
|
47
|
+
}): Promise<void>;
|
|
48
|
+
}
|