vsn 0.1.136 → 0.1.138
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/demo/resources/xhr-memory-leak-test.html +1 -0
- package/demo/vsn.js +2 -2
- package/dist/Attribute.d.ts +3 -1
- package/dist/Attribute.js +10 -0
- package/dist/Attribute.js.map +1 -1
- package/dist/Scope.js +30 -13
- package/dist/Scope.js.map +1 -1
- package/dist/Tag.d.ts +1 -1
- package/dist/Tag.js +6 -0
- package/dist/Tag.js.map +1 -1
- package/dist/attributes/Bind.d.ts +1 -0
- package/dist/attributes/Bind.js +14 -0
- package/dist/attributes/Bind.js.map +1 -1
- package/dist/attributes/ScopeChange.d.ts +1 -0
- package/dist/attributes/ScopeChange.js +23 -0
- package/dist/attributes/ScopeChange.js.map +1 -1
- package/dist/attributes/StandardAttribute.d.ts +1 -0
- package/dist/attributes/StandardAttribute.js +15 -1
- package/dist/attributes/StandardAttribute.js.map +1 -1
- package/dist/attributes/StyleAttribute.d.ts +1 -0
- package/dist/attributes/StyleAttribute.js +14 -0
- package/dist/attributes/StyleAttribute.js.map +1 -1
- package/dist/attributes/StyleVarAttribute.d.ts +1 -0
- package/dist/attributes/StyleVarAttribute.js +14 -0
- package/dist/attributes/StyleVarAttribute.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/src/Attribute.ts +7 -1
- package/src/Scope.ts +9 -1
- package/src/Tag.ts +4 -0
- package/src/attributes/Bind.ts +5 -0
- package/src/attributes/ScopeChange.ts +7 -0
- package/src/attributes/StandardAttribute.ts +6 -1
- package/src/attributes/StyleAttribute.ts +5 -0
- package/src/attributes/StyleVarAttribute.ts +5 -0
- package/src/version.ts +1 -1
|
@@ -97,6 +97,20 @@ var StyleVarAttribute = /** @class */ (function (_super) {
|
|
|
97
97
|
});
|
|
98
98
|
});
|
|
99
99
|
};
|
|
100
|
+
StyleVarAttribute.prototype.disconnect = function () {
|
|
101
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
102
|
+
return __generator(this, function (_a) {
|
|
103
|
+
switch (_a.label) {
|
|
104
|
+
case 0:
|
|
105
|
+
this.boundScope.offWithContext("change:" + this.key, this);
|
|
106
|
+
return [4 /*yield*/, _super.prototype.disconnect.call(this)];
|
|
107
|
+
case 1:
|
|
108
|
+
_a.sent();
|
|
109
|
+
return [2 /*return*/];
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
};
|
|
100
114
|
StyleVarAttribute.prototype.update = function (e) {
|
|
101
115
|
this.tag.element.style.setProperty("--" + this.styleVar, e.value);
|
|
102
116
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StyleVarAttribute.js","sourceRoot":"","sources":["../../src/attributes/StyleVarAttribute.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wCAAqC;AACrC,0CAAuC;AAMvC;IAAuC,qCAAS;IAAhD;;
|
|
1
|
+
{"version":3,"file":"StyleVarAttribute.js","sourceRoot":"","sources":["../../src/attributes/StyleVarAttribute.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wCAAqC;AACrC,0CAAuC;AAMvC;IAAuC,qCAAS;IAAhD;;IAgCA,CAAC;IA1BgB,mCAAO,GAApB;;;;;;wBACQ,QAAQ,GAAW,IAAI,CAAC,iBAAiB,EAAE,CAAC;wBAEhD,IAAI;4BACA,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;yBAC/C;wBAAC,OAAO,CAAC,EAAE;4BACR,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;4BAC1B,sBAAO;yBACV;wBAED,KAAA,IAAI,CAAA;wBAAO,qBAAM,GAAG,CAAC,MAAM,EAAE,EAAA;;wBAA7B,GAAK,GAAG,GAAG,SAAkB,CAAC;wBAC9B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,mBAAmB,EAAE,CAAC;wBAC3C,KAAA,IAAI,CAAA;wBAAc,qBAAM,GAAG,CAAC,QAAQ,EAAE,EAAA;;wBAAtC,GAAK,UAAU,GAAG,SAAoB,CAAC;wBACvC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,YAAU,IAAI,CAAC,GAAK,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;wBAE5D,qBAAM,iBAAM,OAAO,WAAE,EAAA;;wBAArB,SAAqB,CAAC;;;;;KACzB;IAEY,sCAAU,GAAvB;;;;;wBACI,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,YAAU,IAAI,CAAC,GAAK,EAAE,IAAI,CAAC,CAAC;wBAC3D,qBAAM,iBAAM,UAAU,WAAE,EAAA;;wBAAxB,SAAwB,CAAC;;;;;KAC5B;IAED,kCAAM,GAAN,UAAO,CAAC;QACJ,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,OAAK,IAAI,CAAC,QAAU,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;IACtE,CAAC;IA9BsB,0BAAQ,GAAY,KAAK,CAAC;IADxC,iBAAiB;QAD7B,mBAAQ,CAAC,SAAS,CAAC,eAAe,CAAC;OACvB,iBAAiB,CAgC7B;IAAD,wBAAC;CAAA,AAhCD,CAAuC,qBAAS,GAgC/C;AAhCY,8CAAiB"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.1.
|
|
1
|
+
export declare const VERSION = "0.1.138";
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
package/src/Attribute.ts
CHANGED
|
@@ -9,7 +9,8 @@ export enum AttributeState {
|
|
|
9
9
|
Setup,
|
|
10
10
|
Extracted,
|
|
11
11
|
Connected,
|
|
12
|
-
Built
|
|
12
|
+
Built,
|
|
13
|
+
Disconnected
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
export abstract class Attribute extends EventDispatcher {
|
|
@@ -64,6 +65,10 @@ export abstract class Attribute extends EventDispatcher {
|
|
|
64
65
|
this.setState(AttributeState.Built);
|
|
65
66
|
}
|
|
66
67
|
|
|
68
|
+
public async disconnect() {
|
|
69
|
+
this.setState(AttributeState.Disconnected);
|
|
70
|
+
}
|
|
71
|
+
|
|
67
72
|
public async evaluate() {}
|
|
68
73
|
|
|
69
74
|
public getAttributeValue(fallback: any = null) {
|
|
@@ -113,6 +118,7 @@ export abstract class Attribute extends EventDispatcher {
|
|
|
113
118
|
}
|
|
114
119
|
|
|
115
120
|
public deconstruct() {
|
|
121
|
+
this.disconnect();
|
|
116
122
|
super.deconstruct();
|
|
117
123
|
(this as any).tag = null;
|
|
118
124
|
(this as any).slot = null;
|
package/src/Scope.ts
CHANGED
|
@@ -33,8 +33,16 @@ export class Scope extends ScopeAbstract {
|
|
|
33
33
|
if (this._data)
|
|
34
34
|
this._data.deconstruct();
|
|
35
35
|
this._data = null;
|
|
36
|
+
|
|
37
|
+
for (const child of this.children) {
|
|
38
|
+
child.deconstruct();
|
|
39
|
+
}
|
|
36
40
|
this.children.length = 0;
|
|
37
|
-
|
|
41
|
+
|
|
42
|
+
if (this._parentScope) {
|
|
43
|
+
this._parentScope.removeChild(this);
|
|
44
|
+
this._parentScope = null;
|
|
45
|
+
}
|
|
38
46
|
}
|
|
39
47
|
|
|
40
48
|
public get data(): ScopeData {
|
package/src/Tag.ts
CHANGED
|
@@ -412,6 +412,7 @@ export class Tag extends DOMObject {
|
|
|
412
412
|
}
|
|
413
413
|
|
|
414
414
|
public setElementAttribute(key: string, value: any) {
|
|
415
|
+
if (!this.element) return null;
|
|
415
416
|
if (this.isMagicAttribute(key)) {
|
|
416
417
|
if (key === '@text')
|
|
417
418
|
this.element.innerText = value;
|
|
@@ -441,6 +442,7 @@ export class Tag extends DOMObject {
|
|
|
441
442
|
}
|
|
442
443
|
|
|
443
444
|
public getElementAttribute(key: string): any {
|
|
445
|
+
if (!this.element) return null;
|
|
444
446
|
if (this.isMagicAttribute(key)) {
|
|
445
447
|
if (key === '@text')
|
|
446
448
|
return this.element.innerText;
|
|
@@ -660,6 +662,8 @@ export class Tag extends DOMObject {
|
|
|
660
662
|
handler.handler.call(handler.context, e);
|
|
661
663
|
}
|
|
662
664
|
}
|
|
665
|
+
this.scope.remove('$event');
|
|
666
|
+
this.scope.remove('$value');
|
|
663
667
|
}
|
|
664
668
|
|
|
665
669
|
public hasModifier(attribute: string, modifier: string): boolean {
|
package/src/attributes/Bind.ts
CHANGED
|
@@ -55,6 +55,11 @@ export class Bind extends Attribute {
|
|
|
55
55
|
await super.connect();
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
public async disconnect() {
|
|
59
|
+
this.boundScope.offWithContext(`change:${this.key}`, this);
|
|
60
|
+
await super.disconnect();
|
|
61
|
+
}
|
|
62
|
+
|
|
58
63
|
public async evaluate() {
|
|
59
64
|
const elementValue = this.valueFromElement;
|
|
60
65
|
if (!!elementValue)
|
|
@@ -22,6 +22,13 @@ export abstract class ScopeChange extends Attribute {
|
|
|
22
22
|
await super.connect();
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
public async disconnect() {
|
|
26
|
+
const binding = this.getAttributeBinding();
|
|
27
|
+
const ref: ScopeReference = this.tag.scope.getReference(binding, false);
|
|
28
|
+
(await ref.getScope()).offWithContext(`change:${await ref.getKey()}`, this);
|
|
29
|
+
await super.disconnect();
|
|
30
|
+
}
|
|
31
|
+
|
|
25
32
|
async handleEvent(e) {
|
|
26
33
|
await this.handler.evaluate(this.tag.scope, this.tag.dom, this.tag);
|
|
27
34
|
}
|
|
@@ -16,10 +16,15 @@ export class StandardAttribute extends Attribute {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
public async connect() {
|
|
19
|
-
this.tag.scope.on(`change:${this.key}`, this.updateTo
|
|
19
|
+
this.tag.scope.on(`change:${this.key}`, this.updateTo, this);
|
|
20
20
|
await super.connect();
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
public async disconnect() {
|
|
24
|
+
this.tag.scope.offWithContext(`change:${this.key}`, this);
|
|
25
|
+
await super.disconnect();
|
|
26
|
+
}
|
|
27
|
+
|
|
23
28
|
public mutate(mutation: MutationRecord) {
|
|
24
29
|
super.mutate(mutation);
|
|
25
30
|
this.updateFrom();
|
|
@@ -33,6 +33,11 @@ export class StyleAttribute extends Attribute {
|
|
|
33
33
|
await super.connect();
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
public async disconnect() {
|
|
37
|
+
this.styleScope.offWithContext(`change`, this);
|
|
38
|
+
await super.disconnect();
|
|
39
|
+
}
|
|
40
|
+
|
|
36
41
|
public async extract() {
|
|
37
42
|
this.updateFrom();
|
|
38
43
|
this.updateTo();
|
|
@@ -29,6 +29,11 @@ export class StyleVarAttribute extends Attribute {
|
|
|
29
29
|
await super.connect();
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
public async disconnect() {
|
|
33
|
+
this.boundScope.offWithContext(`change:${this.key}`, this);
|
|
34
|
+
await super.disconnect();
|
|
35
|
+
}
|
|
36
|
+
|
|
32
37
|
update(e) {
|
|
33
38
|
this.tag.element.style.setProperty(`--${this.styleVar}`, e.value);
|
|
34
39
|
}
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.1.
|
|
1
|
+
export const VERSION = '0.1.138';
|
|
2
2
|
|