jpf 5.0.66 → 5.0.67
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/dist/framework/element.d.ts +2 -2
- package/dist/framework/element.js +2 -2
- package/dist/index.d.ts +0 -2
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/framework/element.ts +5 -5
- package/src/index.ts +0 -2
- package/src/framework/root.ts +0 -45
|
@@ -50,7 +50,7 @@ export interface IElementOptions<TElementProperties> {
|
|
|
50
50
|
}
|
|
51
51
|
export interface IElement {
|
|
52
52
|
render(): HTMLElement;
|
|
53
|
-
|
|
53
|
+
dispose(): void;
|
|
54
54
|
}
|
|
55
55
|
export declare class Element<TElementProperties = IElementProperties> implements IElement {
|
|
56
56
|
constructor(options: IElementOptions<TElementProperties>, children?: Array<IElement> | ISubscribable<Array<IElement>>);
|
|
@@ -67,7 +67,7 @@ export declare class Element<TElementProperties = IElementProperties> implements
|
|
|
67
67
|
protected setChildren(...children: Array<IElement>): Element<TElementProperties>;
|
|
68
68
|
protected empty(): void;
|
|
69
69
|
render(): HTMLElement;
|
|
70
|
-
|
|
70
|
+
dispose(): void;
|
|
71
71
|
focus(options?: FocusOptions): void;
|
|
72
72
|
}
|
|
73
73
|
export declare abstract class ElementProperties implements IElementProperties {
|
|
@@ -119,12 +119,12 @@ class Element {
|
|
|
119
119
|
}
|
|
120
120
|
throw "The build method of this UiElement has not been defined";
|
|
121
121
|
}
|
|
122
|
-
|
|
122
|
+
dispose() {
|
|
123
123
|
const properties = this.properties;
|
|
124
124
|
console.log("Unmount element " + properties.elementType);
|
|
125
125
|
if (this.children) {
|
|
126
126
|
for (const child of this.children) {
|
|
127
|
-
child.
|
|
127
|
+
child.dispose();
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
for (const disposer of this.disposers) {
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ import * as css from "./framework/css";
|
|
|
4
4
|
import * as element from "./framework/element";
|
|
5
5
|
import * as event from "./framework/event";
|
|
6
6
|
import * as observable from "./framework/observable";
|
|
7
|
-
import * as root from "./framework/root";
|
|
8
7
|
import * as style from "./framework/style";
|
|
9
8
|
import * as utilities from "./utilities/index";
|
|
10
9
|
export { controls };
|
|
@@ -13,6 +12,5 @@ export { css };
|
|
|
13
12
|
export { element };
|
|
14
13
|
export { observable };
|
|
15
14
|
export { event };
|
|
16
|
-
export { root };
|
|
17
15
|
export { style };
|
|
18
16
|
export { utilities };
|
package/dist/index.js
CHANGED
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.utilities = exports.style = exports.
|
|
36
|
+
exports.utilities = exports.style = exports.event = exports.observable = exports.element = exports.css = exports.attributes = exports.controls = void 0;
|
|
37
37
|
const controls = __importStar(require("./controls/index"));
|
|
38
38
|
exports.controls = controls;
|
|
39
39
|
const attributes = __importStar(require("./framework/attributes"));
|
|
@@ -46,8 +46,6 @@ const event = __importStar(require("./framework/event"));
|
|
|
46
46
|
exports.event = event;
|
|
47
47
|
const observable = __importStar(require("./framework/observable"));
|
|
48
48
|
exports.observable = observable;
|
|
49
|
-
const root = __importStar(require("./framework/root"));
|
|
50
|
-
exports.root = root;
|
|
51
49
|
const style = __importStar(require("./framework/style"));
|
|
52
50
|
exports.style = style;
|
|
53
51
|
const utilities = __importStar(require("./utilities/index"));
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2DAA6C;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2DAA6C;AAcpC,4BAAQ;AAXjB,mEAAqD;AAc5C,gCAAU;AAbnB,qDAAuC;AAc9B,kBAAG;AAbZ,6DAA+C;AActC,0BAAO;AAbhB,yDAA2C;AAelC,sBAAK;AAdd,mEAAqD;AAa5C,gCAAU;AAZnB,yDAA2C;AAclC,sBAAK;AAXd,6DAA+C;AActC,8BAAS"}
|
package/package.json
CHANGED
package/src/framework/element.ts
CHANGED
|
@@ -68,7 +68,7 @@ export interface IElementOptions<TElementProperties> {
|
|
|
68
68
|
//public interface of an Element
|
|
69
69
|
export interface IElement {
|
|
70
70
|
render(): HTMLElement;
|
|
71
|
-
|
|
71
|
+
dispose(): void;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
// #endregion
|
|
@@ -195,18 +195,18 @@ export class Element<TElementProperties = IElementProperties> implements IElemen
|
|
|
195
195
|
|
|
196
196
|
|
|
197
197
|
//This method is used to dispose subscriptions before removing the element from the DOM to prevent memory leaks
|
|
198
|
-
|
|
198
|
+
dispose(): void {
|
|
199
199
|
const properties = this.properties as IElementProperties;
|
|
200
200
|
console.log("Unmount element " + properties.elementType);
|
|
201
201
|
|
|
202
|
-
//If the element has childeren then we
|
|
202
|
+
//If the element has childeren then we dispose the children
|
|
203
203
|
if (this.children) {
|
|
204
204
|
for (const child of this.children) {
|
|
205
|
-
child.
|
|
205
|
+
child.dispose();
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
-
//If the element has subscriptions on observable we dispose the
|
|
209
|
+
//If the element has subscriptions on observable we dispose the subscription
|
|
210
210
|
for (const disposer of this.disposers) {
|
|
211
211
|
disposer();
|
|
212
212
|
}
|
package/src/index.ts
CHANGED
|
@@ -7,7 +7,6 @@ import * as css from "./framework/css";
|
|
|
7
7
|
import * as element from "./framework/element";
|
|
8
8
|
import * as event from "./framework/event";
|
|
9
9
|
import * as observable from "./framework/observable";
|
|
10
|
-
import * as root from "./framework/root";
|
|
11
10
|
import * as style from "./framework/style";
|
|
12
11
|
|
|
13
12
|
//import the utilities modules
|
|
@@ -22,7 +21,6 @@ export { css };
|
|
|
22
21
|
export { element };
|
|
23
22
|
export { observable };
|
|
24
23
|
export { event };
|
|
25
|
-
export { root };
|
|
26
24
|
export { style };
|
|
27
25
|
|
|
28
26
|
//export the utilities modules
|
package/src/framework/root.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { Element } from "./element";
|
|
2
|
-
|
|
3
|
-
export class Root {
|
|
4
|
-
constructor(rootElement: HTMLElement | string) {
|
|
5
|
-
if (rootElement instanceof HTMLElement) {
|
|
6
|
-
this.rootElement = rootElement;
|
|
7
|
-
} else {
|
|
8
|
-
rootElement = document.getElementById(rootElement);
|
|
9
|
-
if (rootElement) {
|
|
10
|
-
this.rootElement = rootElement as unknown as HTMLElement;
|
|
11
|
-
} else {
|
|
12
|
-
throw "RootElement with id " + rootElement + "not found";
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
private readonly rootElement: HTMLElement;
|
|
19
|
-
private view: Element;
|
|
20
|
-
|
|
21
|
-
render(view: Element) {
|
|
22
|
-
this.unmount();
|
|
23
|
-
|
|
24
|
-
this.view = view;
|
|
25
|
-
this.rootElement.appendChild(view.render());
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
unmount() {
|
|
29
|
-
if (this.view) {
|
|
30
|
-
this.view.unmount();
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
//Remove all children from the root
|
|
34
|
-
if (this.rootElement) {
|
|
35
|
-
this.rootElement.innerHTML = "";
|
|
36
|
-
while (this.rootElement.firstChild) {
|
|
37
|
-
this.rootElement.removeChild(this.rootElement.firstChild);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export function createRoot(rootElement: HTMLElement | string): Root {
|
|
44
|
-
return new Root(rootElement);
|
|
45
|
-
}
|