vasille 2.0.1 → 2.0.5
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/README.md +42 -10
- package/cdn/es2015.js +3175 -0
- package/cdn/es5.js +3632 -0
- package/flow-typed/vasille.js +208 -205
- package/lib/binding/attribute.js +6 -12
- package/lib/binding/binding.js +9 -19
- package/lib/binding/class.js +34 -42
- package/lib/binding/style.js +5 -11
- package/lib/core/core.js +33 -29
- package/lib/core/destroyable.js +2 -2
- package/lib/core/ivalue.js +15 -13
- package/lib/node/app.js +6 -5
- package/lib/node/interceptor.js +3 -3
- package/lib/node/node.js +313 -305
- package/lib/node/watch.js +8 -8
- package/lib/value/expression.js +3 -3
- package/lib/value/mirror.js +6 -8
- package/lib/value/reference.js +3 -7
- package/lib/views/array-view.js +4 -6
- package/lib/views/base-view.js +6 -6
- package/lib/views/map-view.js +4 -5
- package/lib/views/object-view.js +4 -5
- package/lib/views/repeat-node.js +16 -44
- package/lib/views/repeater.js +7 -7
- package/lib/views/set-view.js +5 -6
- package/package.json +13 -7
- package/types/binding/attribute.d.ts +0 -6
- package/types/binding/binding.d.ts +4 -13
- package/types/binding/class.d.ts +7 -19
- package/types/binding/style.d.ts +0 -6
- package/types/core/core.d.ts +35 -31
- package/types/core/destroyable.d.ts +2 -2
- package/types/core/ivalue.d.ts +13 -11
- package/types/core/slot.d.ts +4 -4
- package/types/models/array-model.d.ts +2 -2
- package/types/models/map-model.d.ts +2 -2
- package/types/models/model.d.ts +3 -1
- package/types/models/object-model.d.ts +2 -2
- package/types/models/set-model.d.ts +2 -2
- package/types/node/app.d.ts +7 -2
- package/types/node/interceptor.d.ts +3 -3
- package/types/node/node.d.ts +137 -139
- package/types/node/watch.d.ts +3 -3
- package/types/value/expression.d.ts +1 -1
- package/types/value/mirror.d.ts +3 -3
- package/types/value/reference.d.ts +5 -5
- package/types/views/array-view.d.ts +2 -2
- package/types/views/base-view.d.ts +4 -4
- package/types/views/map-view.d.ts +2 -2
- package/types/views/object-view.d.ts +2 -2
- package/types/views/repeat-node.d.ts +2 -2
- package/types/views/repeater.d.ts +3 -3
- package/types/views/set-view.d.ts +2 -2
package/lib/node/watch.js
CHANGED
|
@@ -9,19 +9,19 @@ export class Watch extends Fragment {
|
|
|
9
9
|
constructor() {
|
|
10
10
|
super();
|
|
11
11
|
this.slot = new Slot;
|
|
12
|
-
this.model = this
|
|
13
|
-
this
|
|
12
|
+
this.model = this.ref(null);
|
|
13
|
+
this.seal();
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
this
|
|
17
|
-
this
|
|
18
|
-
child
|
|
15
|
+
createWatchers() {
|
|
16
|
+
this.watch((value) => {
|
|
17
|
+
this.children.forEach(child => {
|
|
18
|
+
child.destroy();
|
|
19
19
|
});
|
|
20
|
-
this
|
|
20
|
+
this.children.clear();
|
|
21
21
|
this.slot.release(this, value);
|
|
22
22
|
}, this.model);
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
compose() {
|
|
25
25
|
this.slot.release(this, this.model.$);
|
|
26
26
|
}
|
|
27
27
|
}
|
package/lib/value/expression.js
CHANGED
|
@@ -37,7 +37,7 @@ export class Expression extends IValue {
|
|
|
37
37
|
else {
|
|
38
38
|
handler();
|
|
39
39
|
}
|
|
40
|
-
this
|
|
40
|
+
this.seal();
|
|
41
41
|
}
|
|
42
42
|
get $() {
|
|
43
43
|
return this.sync.$;
|
|
@@ -73,11 +73,11 @@ export class Expression extends IValue {
|
|
|
73
73
|
}
|
|
74
74
|
return this;
|
|
75
75
|
}
|
|
76
|
-
|
|
76
|
+
destroy() {
|
|
77
77
|
this.disable();
|
|
78
78
|
this.values.splice(0);
|
|
79
79
|
this.valuesCache.splice(0);
|
|
80
80
|
this.linkedFunc.splice(0);
|
|
81
|
-
super
|
|
81
|
+
super.destroy();
|
|
82
82
|
}
|
|
83
83
|
}
|
package/lib/value/mirror.js
CHANGED
|
@@ -19,7 +19,7 @@ export class Mirror extends Reference {
|
|
|
19
19
|
this.pointedValue = value;
|
|
20
20
|
this.forwardOnly = forwardOnly;
|
|
21
21
|
value.on(this.handler);
|
|
22
|
-
this
|
|
22
|
+
this.seal();
|
|
23
23
|
}
|
|
24
24
|
get $() {
|
|
25
25
|
// this is a ts bug
|
|
@@ -28,13 +28,13 @@ export class Mirror extends Reference {
|
|
|
28
28
|
return super.$;
|
|
29
29
|
}
|
|
30
30
|
set $(v) {
|
|
31
|
+
if (!this.forwardOnly) {
|
|
32
|
+
this.pointedValue.$ = v;
|
|
33
|
+
}
|
|
31
34
|
// this is a ts bug
|
|
32
35
|
// eslint-disable-next-line
|
|
33
36
|
// @ts-ignore
|
|
34
37
|
super.$ = v;
|
|
35
|
-
if (!this.forwardOnly) {
|
|
36
|
-
this.pointedValue.$ = v;
|
|
37
|
-
}
|
|
38
38
|
}
|
|
39
39
|
enable() {
|
|
40
40
|
if (!this.isEnabled) {
|
|
@@ -42,17 +42,15 @@ export class Mirror extends Reference {
|
|
|
42
42
|
this.pointedValue.on(this.handler);
|
|
43
43
|
this.$ = this.pointedValue.$;
|
|
44
44
|
}
|
|
45
|
-
return this;
|
|
46
45
|
}
|
|
47
46
|
disable() {
|
|
48
47
|
if (this.isEnabled) {
|
|
49
48
|
this.pointedValue.off(this.handler);
|
|
50
49
|
this.isEnabled = false;
|
|
51
50
|
}
|
|
52
|
-
return this;
|
|
53
51
|
}
|
|
54
|
-
|
|
52
|
+
destroy() {
|
|
55
53
|
this.disable();
|
|
56
|
-
super
|
|
54
|
+
super.destroy();
|
|
57
55
|
}
|
|
58
56
|
}
|
package/lib/value/reference.js
CHANGED
|
@@ -12,7 +12,7 @@ export class Reference extends IValue {
|
|
|
12
12
|
super(true);
|
|
13
13
|
this.value = value;
|
|
14
14
|
this.onchange = new Set;
|
|
15
|
-
this
|
|
15
|
+
this.seal();
|
|
16
16
|
}
|
|
17
17
|
get $() {
|
|
18
18
|
return this.value;
|
|
@@ -34,22 +34,18 @@ export class Reference extends IValue {
|
|
|
34
34
|
});
|
|
35
35
|
this.isEnabled = true;
|
|
36
36
|
}
|
|
37
|
-
return this;
|
|
38
37
|
}
|
|
39
38
|
disable() {
|
|
40
39
|
this.isEnabled = false;
|
|
41
|
-
return this;
|
|
42
40
|
}
|
|
43
41
|
on(handler) {
|
|
44
42
|
this.onchange.add(handler);
|
|
45
|
-
return this;
|
|
46
43
|
}
|
|
47
44
|
off(handler) {
|
|
48
45
|
this.onchange.delete(handler);
|
|
49
|
-
return this;
|
|
50
46
|
}
|
|
51
|
-
|
|
52
|
-
super
|
|
47
|
+
destroy() {
|
|
48
|
+
super.destroy();
|
|
53
49
|
this.onchange.clear();
|
|
54
50
|
}
|
|
55
51
|
}
|
package/lib/views/array-view.js
CHANGED
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
import { BaseView } from "./base-view";
|
|
2
|
-
import { ArrayModel } from "../models/array-model";
|
|
3
2
|
/**
|
|
4
3
|
* Represents a view of an array model
|
|
5
4
|
* @class ArrayView
|
|
6
5
|
* @extends BaseView
|
|
7
6
|
*/
|
|
8
7
|
export class ArrayView extends BaseView {
|
|
9
|
-
constructor() {
|
|
8
|
+
constructor(model) {
|
|
10
9
|
super();
|
|
11
|
-
this.model =
|
|
12
|
-
this.$seal();
|
|
10
|
+
this.model = model;
|
|
13
11
|
}
|
|
14
12
|
createChild(id, item, before) {
|
|
15
13
|
super.createChild(item, item, before || this.$.nodes.get(id));
|
|
16
14
|
}
|
|
17
|
-
|
|
15
|
+
ready() {
|
|
18
16
|
this.model.forEach(item => {
|
|
19
17
|
this.createChild(item, item);
|
|
20
18
|
});
|
|
21
|
-
super
|
|
19
|
+
super.ready();
|
|
22
20
|
}
|
|
23
21
|
}
|
package/lib/views/base-view.js
CHANGED
|
@@ -7,7 +7,7 @@ import { RepeatNode, RepeatNodePrivate } from "./repeat-node";
|
|
|
7
7
|
export class BaseViewPrivate extends RepeatNodePrivate {
|
|
8
8
|
constructor() {
|
|
9
9
|
super();
|
|
10
|
-
this
|
|
10
|
+
this.seal();
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
@@ -26,24 +26,24 @@ export class BaseView extends RepeatNode {
|
|
|
26
26
|
$.removeHandler = (id, item) => {
|
|
27
27
|
this.destroyChild(id, item);
|
|
28
28
|
};
|
|
29
|
-
this
|
|
29
|
+
this.seal();
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* Handle ready event
|
|
33
33
|
*/
|
|
34
|
-
|
|
34
|
+
ready() {
|
|
35
35
|
const $ = this.$;
|
|
36
36
|
this.model.listener.onAdd($.addHandler);
|
|
37
37
|
this.model.listener.onRemove($.removeHandler);
|
|
38
|
-
super
|
|
38
|
+
super.ready();
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* Handles destroy event
|
|
42
42
|
*/
|
|
43
|
-
|
|
43
|
+
destroy() {
|
|
44
44
|
const $ = this.$;
|
|
45
45
|
this.model.listener.offAdd($.addHandler);
|
|
46
46
|
this.model.listener.offRemove($.removeHandler);
|
|
47
|
-
super
|
|
47
|
+
super.destroy();
|
|
48
48
|
}
|
|
49
49
|
}
|
package/lib/views/map-view.js
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import { BaseView } from "./base-view";
|
|
2
|
-
import { MapModel } from "../models/map-model";
|
|
3
2
|
/**
|
|
4
3
|
* Create a children pack for each map value
|
|
5
4
|
* @class MapView
|
|
6
5
|
* @extends BaseView
|
|
7
6
|
*/
|
|
8
7
|
export class MapView extends BaseView {
|
|
9
|
-
constructor() {
|
|
8
|
+
constructor(model) {
|
|
10
9
|
super();
|
|
11
|
-
this.model =
|
|
10
|
+
this.model = model;
|
|
12
11
|
}
|
|
13
|
-
|
|
12
|
+
ready() {
|
|
14
13
|
const map = this.model;
|
|
15
14
|
map.forEach((value, key) => {
|
|
16
15
|
this.createChild(key, value);
|
|
17
16
|
});
|
|
18
|
-
super
|
|
17
|
+
super.ready();
|
|
19
18
|
}
|
|
20
19
|
}
|
package/lib/views/object-view.js
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import { BaseView } from "./base-view";
|
|
2
|
-
import { ObjectModel } from "../models/object-model";
|
|
3
2
|
/**
|
|
4
3
|
* Create a children pack for each object field
|
|
5
4
|
* @class ObjectView
|
|
6
5
|
* @extends BaseView
|
|
7
6
|
*/
|
|
8
7
|
export class ObjectView extends BaseView {
|
|
9
|
-
constructor() {
|
|
8
|
+
constructor(model) {
|
|
10
9
|
super();
|
|
11
|
-
this.model =
|
|
10
|
+
this.model = model;
|
|
12
11
|
}
|
|
13
|
-
|
|
12
|
+
ready() {
|
|
14
13
|
const obj = this.model;
|
|
15
14
|
for (const key in obj) {
|
|
16
15
|
this.createChild(key, obj[key]);
|
|
17
16
|
}
|
|
18
|
-
super
|
|
17
|
+
super.ready();
|
|
19
18
|
}
|
|
20
19
|
}
|
package/lib/views/repeat-node.js
CHANGED
|
@@ -14,11 +14,11 @@ export class RepeatNodePrivate extends INodePrivate {
|
|
|
14
14
|
* @type {Map}
|
|
15
15
|
*/
|
|
16
16
|
this.nodes = new Map();
|
|
17
|
-
this
|
|
17
|
+
this.seal();
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
destroy() {
|
|
20
20
|
this.nodes.clear();
|
|
21
|
-
super
|
|
21
|
+
super.destroy();
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
@@ -38,43 +38,27 @@ export class RepeatNode extends Fragment {
|
|
|
38
38
|
createChild(id, item, before) {
|
|
39
39
|
// TODO: Refactor: remove @ts-ignore
|
|
40
40
|
const node = new Fragment();
|
|
41
|
-
// eslint-disable-next-line
|
|
42
|
-
// @ts-ignore
|
|
43
|
-
const $ = node.$;
|
|
44
41
|
this.destroyChild(id, item);
|
|
45
42
|
if (before) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
// @ts-ignore
|
|
49
|
-
$.prev = before.$.prev;
|
|
50
|
-
// eslint-disable-next-line
|
|
51
|
-
// @ts-ignore
|
|
52
|
-
before.$.prev = node;
|
|
53
|
-
if ($.prev) {
|
|
54
|
-
// eslint-disable-next-line
|
|
55
|
-
// @ts-ignore
|
|
56
|
-
$.prev.$.next = node;
|
|
57
|
-
}
|
|
58
|
-
this.$children.splice(this.$children.indexOf(before), 0, node);
|
|
43
|
+
this.children.add(node);
|
|
44
|
+
before.insertBefore(node);
|
|
59
45
|
}
|
|
60
46
|
else {
|
|
61
|
-
const lastChild = this
|
|
47
|
+
const lastChild = this.lastChild;
|
|
62
48
|
if (lastChild) {
|
|
63
|
-
|
|
64
|
-
// @ts-ignore
|
|
65
|
-
lastChild.$.next = node;
|
|
49
|
+
lastChild.insertAfter(node);
|
|
66
50
|
}
|
|
67
|
-
|
|
68
|
-
this.$children.push(node);
|
|
51
|
+
this.children.add(node);
|
|
69
52
|
}
|
|
70
|
-
|
|
71
|
-
node
|
|
53
|
+
this.lastChild = node;
|
|
54
|
+
node.preinit(this.$.app, this);
|
|
55
|
+
node.init();
|
|
72
56
|
const callback = () => {
|
|
73
57
|
this.slot.release(node, item, id);
|
|
74
|
-
node
|
|
58
|
+
node.ready();
|
|
75
59
|
};
|
|
76
60
|
if (this.freezeUi) {
|
|
77
|
-
this.$.app
|
|
61
|
+
this.$.app.run.callCallback(callback);
|
|
78
62
|
}
|
|
79
63
|
else {
|
|
80
64
|
timeoutExecutor.callCallback(callback);
|
|
@@ -85,22 +69,10 @@ export class RepeatNode extends Fragment {
|
|
|
85
69
|
const $ = this.$;
|
|
86
70
|
const child = $.nodes.get(id);
|
|
87
71
|
if (child) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
const $ = child.$;
|
|
91
|
-
if ($.prev) {
|
|
92
|
-
// eslint-disable-next-line
|
|
93
|
-
// @ts-ignore
|
|
94
|
-
$.prev.$.next = $.next;
|
|
95
|
-
}
|
|
96
|
-
if ($.next) {
|
|
97
|
-
// eslint-disable-next-line
|
|
98
|
-
// @ts-ignore
|
|
99
|
-
$.next.$.prev = $.prev;
|
|
100
|
-
}
|
|
101
|
-
child.$destroy();
|
|
72
|
+
child.remove();
|
|
73
|
+
child.destroy();
|
|
102
74
|
this.$.nodes.delete(id);
|
|
103
|
-
this
|
|
75
|
+
this.children.delete(child);
|
|
104
76
|
}
|
|
105
77
|
}
|
|
106
78
|
}
|
package/lib/views/repeater.js
CHANGED
|
@@ -12,7 +12,7 @@ export class RepeaterPrivate extends RepeatNodePrivate {
|
|
|
12
12
|
* Current count of child nodes
|
|
13
13
|
*/
|
|
14
14
|
this.currentCount = 0;
|
|
15
|
-
this
|
|
15
|
+
this.seal();
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
@@ -27,7 +27,7 @@ export class Repeater extends RepeatNode {
|
|
|
27
27
|
* The count of children
|
|
28
28
|
*/
|
|
29
29
|
this.count = new Reference(0);
|
|
30
|
-
this
|
|
30
|
+
this.seal();
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* Changes the children count
|
|
@@ -46,18 +46,18 @@ export class Repeater extends RepeatNode {
|
|
|
46
46
|
}
|
|
47
47
|
$.currentCount = number;
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
created() {
|
|
50
50
|
const $ = this.$;
|
|
51
|
-
super
|
|
51
|
+
super.created();
|
|
52
52
|
$.updateHandler = this.changeCount.bind(this);
|
|
53
53
|
this.count.on($.updateHandler);
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
ready() {
|
|
56
56
|
this.changeCount(this.count.$);
|
|
57
57
|
}
|
|
58
|
-
|
|
58
|
+
destroy() {
|
|
59
59
|
const $ = this.$;
|
|
60
|
-
super
|
|
60
|
+
super.destroy();
|
|
61
61
|
this.count.off($.updateHandler);
|
|
62
62
|
}
|
|
63
63
|
}
|
package/lib/views/set-view.js
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
import { BaseView } from "./base-view";
|
|
2
|
-
import { SetModel } from "../models/set-model";
|
|
3
2
|
/**
|
|
4
3
|
* Create a children pack for each set value
|
|
5
4
|
* @class SetView
|
|
6
5
|
* @extends BaseView
|
|
7
6
|
*/
|
|
8
7
|
export class SetView extends BaseView {
|
|
9
|
-
constructor() {
|
|
8
|
+
constructor(model) {
|
|
10
9
|
super();
|
|
11
|
-
this.model =
|
|
10
|
+
this.model = model;
|
|
12
11
|
}
|
|
13
|
-
|
|
12
|
+
ready() {
|
|
14
13
|
const $ = this.$;
|
|
15
14
|
const set = this.model;
|
|
16
15
|
set.forEach(item => {
|
|
17
|
-
$.app
|
|
16
|
+
$.app.run.callCallback(() => {
|
|
18
17
|
this.createChild(item, item);
|
|
19
18
|
});
|
|
20
19
|
});
|
|
21
|
-
super
|
|
20
|
+
super.ready();
|
|
22
21
|
}
|
|
23
22
|
}
|
package/package.json
CHANGED
|
@@ -3,27 +3,32 @@
|
|
|
3
3
|
"description": "Vasille - Safe. Fast. Powerful.",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "types/index.d.ts",
|
|
6
|
-
"version": "2.0.
|
|
6
|
+
"version": "2.0.5",
|
|
7
7
|
"exports": {
|
|
8
8
|
"import": "./lib/index.js",
|
|
9
9
|
"browser": "./lib/index.js"
|
|
10
10
|
},
|
|
11
|
+
"unpkg": "./cdn/es2015.js",
|
|
11
12
|
"scripts": {
|
|
12
|
-
"prepack": "tsc --build tsconfig-build.json",
|
|
13
13
|
"build": "tsc --build tsconfig-build.json",
|
|
14
|
+
"build-es5": "tsc --build tsconfig-build-es5.json",
|
|
14
15
|
"test": "jest",
|
|
15
16
|
"test-coverage": "jest --coverage",
|
|
16
|
-
"update-types": "tsc --build tsconfig-types.json"
|
|
17
|
+
"update-types": "tsc --build tsconfig-types.json",
|
|
18
|
+
"cdn-create": "node cdn/create.js",
|
|
19
|
+
"es5-check": "es-check es5 cdn/*es5.js"
|
|
17
20
|
},
|
|
18
21
|
"repository": {
|
|
19
22
|
"type": "git",
|
|
20
23
|
"url": "https://gitlab.com/vasille-js/vasille-js.git"
|
|
21
24
|
},
|
|
22
25
|
"keywords": [
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
26
|
+
"front-end",
|
|
27
|
+
"web",
|
|
28
|
+
"app",
|
|
29
|
+
"safe",
|
|
30
|
+
"fast",
|
|
31
|
+
"poweful"
|
|
27
32
|
],
|
|
28
33
|
"author": "Vasile Lixcode <lixcode@vivaldi.net> (https://t.me/lixcode)",
|
|
29
34
|
"license": "MIT",
|
|
@@ -38,6 +43,7 @@
|
|
|
38
43
|
"@types/node": "latest",
|
|
39
44
|
"@typescript-eslint/eslint-plugin": "latest",
|
|
40
45
|
"@typescript-eslint/parser": "latest",
|
|
46
|
+
"es-check": "latest",
|
|
41
47
|
"eslint": "latest",
|
|
42
48
|
"jest": "latest",
|
|
43
49
|
"jsdom": "latest",
|
|
@@ -14,10 +14,4 @@ export declare class AttributeBinding extends Binding<string> {
|
|
|
14
14
|
* @param value {IValue} value to bind
|
|
15
15
|
*/
|
|
16
16
|
constructor(node: INode, name: string, value: IValue<string>);
|
|
17
|
-
/**
|
|
18
|
-
* Generates a function which updates the attribute value
|
|
19
|
-
* @param name {String} The name of attribute
|
|
20
|
-
* @returns {Function} a function which will update attribute value
|
|
21
|
-
*/
|
|
22
|
-
protected bound(name: string): (node: INode, value: string) => void;
|
|
23
17
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Destroyable } from "../core/destroyable";
|
|
2
2
|
import type { IValue } from "../core/ivalue";
|
|
3
|
-
import type { INode } from "../node/node";
|
|
4
3
|
/**
|
|
5
4
|
* Describe a common binding logic
|
|
6
5
|
* @class Binding
|
|
@@ -8,23 +7,15 @@ import type { INode } from "../node/node";
|
|
|
8
7
|
*/
|
|
9
8
|
export declare class Binding<T> extends Destroyable {
|
|
10
9
|
private binding;
|
|
11
|
-
private
|
|
10
|
+
private func;
|
|
12
11
|
/**
|
|
13
12
|
* Constructs a common binding logic
|
|
14
|
-
* @param node {INode} the vasille node
|
|
15
|
-
* @param name {String} the name of property/attribute/class
|
|
16
13
|
* @param value {IValue} the value to bind
|
|
17
14
|
*/
|
|
18
|
-
constructor(
|
|
19
|
-
|
|
20
|
-
* Is a virtual function to get the specific bind function
|
|
21
|
-
* @param name {String} the name of attribute/property
|
|
22
|
-
* @returns {Function} a function to update attribute/property value
|
|
23
|
-
* @throws Always throws and must be overloaded in child class
|
|
24
|
-
*/
|
|
25
|
-
protected bound(name: string): (node: INode, value: T) => void;
|
|
15
|
+
constructor(value: IValue<T>);
|
|
16
|
+
protected init(bounded: (v: T) => void): void;
|
|
26
17
|
/**
|
|
27
18
|
* Just clear bindings
|
|
28
19
|
*/
|
|
29
|
-
|
|
20
|
+
destroy(): void;
|
|
30
21
|
}
|
package/types/binding/class.d.ts
CHANGED
|
@@ -1,23 +1,11 @@
|
|
|
1
1
|
import { Binding } from "./binding";
|
|
2
2
|
import type { INode } from "../node/node";
|
|
3
3
|
import type { IValue } from "../core/ivalue";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* Constructs an HTML class binding description
|
|
12
|
-
* @param node {INode} the vasille node
|
|
13
|
-
* @param name {String} the name of class
|
|
14
|
-
* @param value {IValue} the value to bind
|
|
15
|
-
*/
|
|
16
|
-
constructor(node: INode, name: string, value: IValue<string | boolean>);
|
|
17
|
-
/**
|
|
18
|
-
* Generates a function which updates the html class value
|
|
19
|
-
* @param name {String} The name of attribute
|
|
20
|
-
* @returns {Function} a function which will update attribute value
|
|
21
|
-
*/
|
|
22
|
-
protected bound(name: string): (node: INode, value: string | boolean) => void;
|
|
4
|
+
export declare class StaticClassBinding extends Binding<boolean> {
|
|
5
|
+
private current;
|
|
6
|
+
constructor(node: INode, name: string, value: IValue<boolean>);
|
|
7
|
+
}
|
|
8
|
+
export declare class DynamicalClassBinding extends Binding<string> {
|
|
9
|
+
private current;
|
|
10
|
+
constructor(node: INode, value: IValue<string>);
|
|
23
11
|
}
|
package/types/binding/style.d.ts
CHANGED
|
@@ -14,10 +14,4 @@ export declare class StyleBinding extends Binding<string> {
|
|
|
14
14
|
* @param value {IValue} the value to bind
|
|
15
15
|
*/
|
|
16
16
|
constructor(node: INode, name: string, value: IValue<string>);
|
|
17
|
-
/**
|
|
18
|
-
* Generates a function to update style property value
|
|
19
|
-
* @param name {string}
|
|
20
|
-
* @returns {Function} a function to update style property
|
|
21
|
-
*/
|
|
22
|
-
protected bound(name: string): (node: INode, value: string) => void;
|
|
23
17
|
}
|