vasille 2.0.5 → 2.2.2
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 +4 -0
- package/cdn/es2015.js +827 -827
- package/cdn/es5.js +909 -829
- package/flow-typed/vasille.js +2647 -835
- package/lib/binding/attribute.js +8 -3
- package/lib/binding/binding.js +5 -5
- package/lib/binding/class.js +4 -4
- package/lib/binding/style.js +2 -2
- package/lib/core/core.js +73 -17
- package/lib/core/destroyable.js +2 -2
- package/lib/core/ivalue.js +4 -4
- package/lib/functional/components.js +17 -0
- package/lib/functional/merge.js +41 -0
- package/lib/functional/models.js +26 -0
- package/lib/functional/options.js +1 -0
- package/lib/functional/reactivity.js +33 -0
- package/lib/functional/stack.js +127 -0
- package/lib/index.js +2 -7
- package/lib/models/array-model.js +9 -0
- package/lib/models/object-model.js +28 -14
- package/lib/node/app.js +21 -12
- package/lib/node/node.js +229 -573
- package/lib/node/watch.js +6 -14
- package/lib/spec/html.js +1 -0
- package/lib/spec/react.js +1 -0
- package/lib/spec/svg.js +1 -0
- package/lib/v/index.js +23 -0
- package/lib/value/expression.js +21 -18
- package/lib/value/mirror.js +15 -15
- package/lib/value/pointer.js +5 -5
- package/lib/value/reference.js +18 -18
- package/lib/views/array-view.js +6 -10
- package/lib/views/base-view.js +12 -23
- package/lib/views/map-view.js +4 -9
- package/lib/views/object-view.js +4 -7
- package/lib/views/repeat-node.js +10 -22
- package/lib/views/set-view.js +4 -11
- package/package.json +3 -1
- package/types/binding/attribute.d.ts +2 -2
- package/types/binding/binding.d.ts +1 -1
- package/types/core/core.d.ts +31 -43
- package/types/core/destroyable.d.ts +2 -2
- package/types/core/ivalue.d.ts +4 -4
- package/types/functional/components.d.ts +4 -0
- package/types/functional/merge.d.ts +1 -0
- package/types/functional/models.d.ts +10 -0
- package/types/functional/options.d.ts +23 -0
- package/types/functional/reactivity.d.ts +11 -0
- package/types/functional/stack.d.ts +24 -0
- package/types/index.d.ts +3 -7
- package/types/models/array-model.d.ts +1 -0
- package/types/models/object-model.d.ts +2 -0
- package/types/node/app.d.ts +19 -17
- package/types/node/node.d.ts +67 -388
- package/types/node/watch.d.ts +9 -15
- package/types/spec/html.d.ts +975 -0
- package/types/spec/react.d.ts +4 -0
- package/types/spec/svg.d.ts +314 -0
- package/types/v/index.d.ts +36 -0
- package/types/value/expression.d.ts +11 -24
- package/types/value/mirror.d.ts +6 -6
- package/types/value/pointer.d.ts +1 -1
- package/types/value/reference.d.ts +7 -7
- package/types/views/array-view.d.ts +3 -4
- package/types/views/base-view.d.ts +8 -16
- package/types/views/map-view.d.ts +2 -3
- package/types/views/object-view.d.ts +2 -3
- package/types/views/repeat-node.d.ts +8 -9
- package/types/views/set-view.d.ts +2 -3
- package/types/core/executor.d.ts +0 -87
- package/types/core/signal.d.ts +0 -35
- package/types/core/slot.d.ts +0 -45
- package/types/node/interceptor.d.ts +0 -50
- package/types/views/repeater.d.ts +0 -38
package/lib/node/watch.js
CHANGED
|
@@ -1,27 +1,19 @@
|
|
|
1
1
|
import { Fragment } from "./node";
|
|
2
|
-
import { Slot } from "../core/slot";
|
|
3
2
|
/**
|
|
4
3
|
* Watch Node
|
|
5
4
|
* @class Watch
|
|
6
5
|
* @extends Fragment
|
|
7
6
|
*/
|
|
8
7
|
export class Watch extends Fragment {
|
|
9
|
-
|
|
10
|
-
super();
|
|
11
|
-
this.slot = new Slot;
|
|
12
|
-
this.model = this.ref(null);
|
|
13
|
-
this.seal();
|
|
14
|
-
}
|
|
15
|
-
createWatchers() {
|
|
8
|
+
compose(input) {
|
|
16
9
|
this.watch((value) => {
|
|
17
10
|
this.children.forEach(child => {
|
|
18
|
-
child
|
|
11
|
+
child.$destroy();
|
|
19
12
|
});
|
|
20
13
|
this.children.clear();
|
|
21
|
-
this.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
this.slot.release(this, this.model.$);
|
|
14
|
+
this.lastChild = null;
|
|
15
|
+
input.slot && input.slot(this, value);
|
|
16
|
+
}, input.model);
|
|
17
|
+
input.slot(this, input.model.$);
|
|
26
18
|
}
|
|
27
19
|
}
|
package/lib/spec/html.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/spec/svg.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/v/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { debug, text } from "../functional/components";
|
|
2
|
+
import { arrayModel, mapModel, objectModel, setModel } from "../functional/models";
|
|
3
|
+
import { expr, forward, mirror, point, ref, setValue, valueOf, watch } from "../functional/reactivity";
|
|
4
|
+
import { app, component, create, extension, fragment, tag, vx } from "../functional/stack";
|
|
5
|
+
import { current } from "../core/core";
|
|
6
|
+
import { Reference } from "../value/reference";
|
|
7
|
+
import { merge } from "../functional/merge";
|
|
8
|
+
export { debug, arrayModel, mapModel, objectModel, setModel, expr, forward, mirror, point, ref, setValue, valueOf, watch };
|
|
9
|
+
export const v = Object.assign(Object.assign({ ref(value) {
|
|
10
|
+
return current.ref(value);
|
|
11
|
+
}, expr: expr, of: valueOf, sv: setValue, alwaysFalse: new Reference(false), app,
|
|
12
|
+
component,
|
|
13
|
+
fragment,
|
|
14
|
+
extension,
|
|
15
|
+
text,
|
|
16
|
+
tag,
|
|
17
|
+
create }, vx), { merge,
|
|
18
|
+
destructor() {
|
|
19
|
+
return current.$destroy.bind(current);
|
|
20
|
+
},
|
|
21
|
+
runOnDestroy(callback) {
|
|
22
|
+
current.runOnDestroy(callback);
|
|
23
|
+
} });
|
package/lib/value/expression.js
CHANGED
|
@@ -6,13 +6,18 @@ import { IValue } from "../core/ivalue";
|
|
|
6
6
|
* @extends IValue
|
|
7
7
|
*/
|
|
8
8
|
export class Expression extends IValue {
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Creates a function bounded to N values
|
|
11
|
+
* @param func {Function} the function to bound
|
|
12
|
+
* @param values
|
|
13
|
+
* @param link {Boolean} links immediately if true
|
|
14
|
+
*/
|
|
15
|
+
constructor(func, link, ...values) {
|
|
10
16
|
super(false);
|
|
11
17
|
/**
|
|
12
18
|
* Expression will link different handler for each value of list
|
|
13
19
|
*/
|
|
14
20
|
this.linkedFunc = [];
|
|
15
|
-
const values = [v1, v2, v3, v4, v5, v6, v7, v8, v9].filter(v => v instanceof IValue);
|
|
16
21
|
const handler = (i) => {
|
|
17
22
|
if (i != null) {
|
|
18
23
|
this.valuesCache[i] = this.values[i].$;
|
|
@@ -21,23 +26,21 @@ export class Expression extends IValue {
|
|
|
21
26
|
};
|
|
22
27
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
23
28
|
// @ts-ignore
|
|
24
|
-
this.valuesCache = values.map(
|
|
29
|
+
this.valuesCache = values.map(item => item.$);
|
|
25
30
|
this.sync = new Reference(func.apply(this, this.valuesCache));
|
|
26
31
|
let i = 0;
|
|
27
32
|
values.forEach(() => {
|
|
28
33
|
this.linkedFunc.push(handler.bind(this, Number(i++)));
|
|
29
34
|
});
|
|
30
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
31
|
-
// @ts-ignore
|
|
32
35
|
this.values = values;
|
|
33
36
|
this.func = handler;
|
|
34
37
|
if (link) {
|
|
35
|
-
this
|
|
38
|
+
this.$enable();
|
|
36
39
|
}
|
|
37
40
|
else {
|
|
38
41
|
handler();
|
|
39
42
|
}
|
|
40
|
-
this
|
|
43
|
+
this.$seal();
|
|
41
44
|
}
|
|
42
45
|
get $() {
|
|
43
46
|
return this.sync.$;
|
|
@@ -45,18 +48,18 @@ export class Expression extends IValue {
|
|
|
45
48
|
set $(value) {
|
|
46
49
|
this.sync.$ = value;
|
|
47
50
|
}
|
|
48
|
-
on(handler) {
|
|
49
|
-
this.sync
|
|
51
|
+
$on(handler) {
|
|
52
|
+
this.sync.$on(handler);
|
|
50
53
|
return this;
|
|
51
54
|
}
|
|
52
|
-
off(handler) {
|
|
53
|
-
this.sync
|
|
55
|
+
$off(handler) {
|
|
56
|
+
this.sync.$off(handler);
|
|
54
57
|
return this;
|
|
55
58
|
}
|
|
56
|
-
enable() {
|
|
59
|
+
$enable() {
|
|
57
60
|
if (!this.isEnabled) {
|
|
58
61
|
for (let i = 0; i < this.values.length; i++) {
|
|
59
|
-
this.values[i]
|
|
62
|
+
this.values[i].$on(this.linkedFunc[i]);
|
|
60
63
|
this.valuesCache[i] = this.values[i].$;
|
|
61
64
|
}
|
|
62
65
|
this.func();
|
|
@@ -64,20 +67,20 @@ export class Expression extends IValue {
|
|
|
64
67
|
}
|
|
65
68
|
return this;
|
|
66
69
|
}
|
|
67
|
-
disable() {
|
|
70
|
+
$disable() {
|
|
68
71
|
if (this.isEnabled) {
|
|
69
72
|
for (let i = 0; i < this.values.length; i++) {
|
|
70
|
-
this.values[i]
|
|
73
|
+
this.values[i].$off(this.linkedFunc[i]);
|
|
71
74
|
}
|
|
72
75
|
this.isEnabled = false;
|
|
73
76
|
}
|
|
74
77
|
return this;
|
|
75
78
|
}
|
|
76
|
-
destroy() {
|
|
77
|
-
this
|
|
79
|
+
$destroy() {
|
|
80
|
+
this.$disable();
|
|
78
81
|
this.values.splice(0);
|
|
79
82
|
this.valuesCache.splice(0);
|
|
80
83
|
this.linkedFunc.splice(0);
|
|
81
|
-
super
|
|
84
|
+
super.$destroy();
|
|
82
85
|
}
|
|
83
86
|
}
|
package/lib/value/mirror.js
CHANGED
|
@@ -13,13 +13,13 @@ export class Mirror extends Reference {
|
|
|
13
13
|
*/
|
|
14
14
|
constructor(value, forwardOnly = false) {
|
|
15
15
|
super(value.$);
|
|
16
|
-
this
|
|
16
|
+
this.$handler = (v) => {
|
|
17
17
|
this.$ = v;
|
|
18
18
|
};
|
|
19
|
-
this
|
|
20
|
-
this
|
|
21
|
-
value
|
|
22
|
-
this
|
|
19
|
+
this.$pointedValue = value;
|
|
20
|
+
this.$forwardOnly = forwardOnly;
|
|
21
|
+
value.$on(this.$handler);
|
|
22
|
+
this.$seal();
|
|
23
23
|
}
|
|
24
24
|
get $() {
|
|
25
25
|
// this is a ts bug
|
|
@@ -28,29 +28,29 @@ export class Mirror extends Reference {
|
|
|
28
28
|
return super.$;
|
|
29
29
|
}
|
|
30
30
|
set $(v) {
|
|
31
|
-
if (!this
|
|
32
|
-
this
|
|
31
|
+
if (!this.$forwardOnly) {
|
|
32
|
+
this.$pointedValue.$ = v;
|
|
33
33
|
}
|
|
34
34
|
// this is a ts bug
|
|
35
35
|
// eslint-disable-next-line
|
|
36
36
|
// @ts-ignore
|
|
37
37
|
super.$ = v;
|
|
38
38
|
}
|
|
39
|
-
enable() {
|
|
39
|
+
$enable() {
|
|
40
40
|
if (!this.isEnabled) {
|
|
41
41
|
this.isEnabled = true;
|
|
42
|
-
this
|
|
43
|
-
this.$ = this
|
|
42
|
+
this.$pointedValue.$on(this.$handler);
|
|
43
|
+
this.$ = this.$pointedValue.$;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
disable() {
|
|
46
|
+
$disable() {
|
|
47
47
|
if (this.isEnabled) {
|
|
48
|
-
this
|
|
48
|
+
this.$pointedValue.$off(this.$handler);
|
|
49
49
|
this.isEnabled = false;
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
destroy() {
|
|
53
|
-
this
|
|
54
|
-
super
|
|
52
|
+
$destroy() {
|
|
53
|
+
this.$disable();
|
|
54
|
+
super.$destroy();
|
|
55
55
|
}
|
|
56
56
|
}
|
package/lib/value/pointer.js
CHANGED
|
@@ -16,11 +16,11 @@ export class Pointer extends Mirror {
|
|
|
16
16
|
* Point a new ivalue
|
|
17
17
|
* @param value {IValue} value to point
|
|
18
18
|
*/
|
|
19
|
-
|
|
20
|
-
if (this
|
|
21
|
-
this
|
|
22
|
-
this
|
|
23
|
-
this
|
|
19
|
+
set $$(value) {
|
|
20
|
+
if (this.$pointedValue !== value) {
|
|
21
|
+
this.$disable();
|
|
22
|
+
this.$pointedValue = value;
|
|
23
|
+
this.$enable();
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
}
|
package/lib/value/reference.js
CHANGED
|
@@ -10,42 +10,42 @@ export class Reference extends IValue {
|
|
|
10
10
|
*/
|
|
11
11
|
constructor(value) {
|
|
12
12
|
super(true);
|
|
13
|
-
this
|
|
14
|
-
this
|
|
15
|
-
this
|
|
13
|
+
this.$value = value;
|
|
14
|
+
this.$onchange = new Set;
|
|
15
|
+
this.$seal();
|
|
16
16
|
}
|
|
17
17
|
get $() {
|
|
18
|
-
return this
|
|
18
|
+
return this.$value;
|
|
19
19
|
}
|
|
20
20
|
set $(value) {
|
|
21
|
-
if (this
|
|
22
|
-
this
|
|
21
|
+
if (this.$value !== value) {
|
|
22
|
+
this.$value = value;
|
|
23
23
|
if (this.isEnabled) {
|
|
24
|
-
this
|
|
24
|
+
this.$onchange.forEach(handler => {
|
|
25
25
|
handler(value);
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
enable() {
|
|
30
|
+
$enable() {
|
|
31
31
|
if (!this.isEnabled) {
|
|
32
|
-
this
|
|
33
|
-
handler(this
|
|
32
|
+
this.$onchange.forEach(handler => {
|
|
33
|
+
handler(this.$value);
|
|
34
34
|
});
|
|
35
35
|
this.isEnabled = true;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
disable() {
|
|
38
|
+
$disable() {
|
|
39
39
|
this.isEnabled = false;
|
|
40
40
|
}
|
|
41
|
-
on(handler) {
|
|
42
|
-
this
|
|
41
|
+
$on(handler) {
|
|
42
|
+
this.$onchange.add(handler);
|
|
43
43
|
}
|
|
44
|
-
off(handler) {
|
|
45
|
-
this
|
|
44
|
+
$off(handler) {
|
|
45
|
+
this.$onchange.delete(handler);
|
|
46
46
|
}
|
|
47
|
-
destroy() {
|
|
48
|
-
super
|
|
49
|
-
this
|
|
47
|
+
$destroy() {
|
|
48
|
+
super.$destroy();
|
|
49
|
+
this.$onchange.clear();
|
|
50
50
|
}
|
|
51
51
|
}
|
package/lib/views/array-view.js
CHANGED
|
@@ -5,17 +5,13 @@ import { BaseView } from "./base-view";
|
|
|
5
5
|
* @extends BaseView
|
|
6
6
|
*/
|
|
7
7
|
export class ArrayView extends BaseView {
|
|
8
|
-
|
|
9
|
-
super();
|
|
10
|
-
this.model = model;
|
|
8
|
+
createChild(input, id, item, before) {
|
|
9
|
+
super.createChild(input, item, item, before || this.$.nodes.get(id));
|
|
11
10
|
}
|
|
12
|
-
|
|
13
|
-
super.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
this.model.forEach(item => {
|
|
17
|
-
this.createChild(item, item);
|
|
11
|
+
compose(input) {
|
|
12
|
+
super.compose(input);
|
|
13
|
+
input.model.forEach(item => {
|
|
14
|
+
this.createChild(input, item, item);
|
|
18
15
|
});
|
|
19
|
-
super.ready();
|
|
20
16
|
}
|
|
21
17
|
}
|
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
|
/**
|
|
@@ -17,33 +17,22 @@ export class BaseViewPrivate extends RepeatNodePrivate {
|
|
|
17
17
|
* @implements IModel
|
|
18
18
|
*/
|
|
19
19
|
export class BaseView extends RepeatNode {
|
|
20
|
-
constructor($
|
|
21
|
-
super($
|
|
20
|
+
constructor(input, $) {
|
|
21
|
+
super(input, $ || new BaseViewPrivate);
|
|
22
|
+
}
|
|
23
|
+
compose(input) {
|
|
22
24
|
const $ = this.$;
|
|
23
25
|
$.addHandler = (id, item) => {
|
|
24
|
-
this.createChild(id, item);
|
|
26
|
+
this.createChild(input, id, item);
|
|
25
27
|
};
|
|
26
28
|
$.removeHandler = (id, item) => {
|
|
27
29
|
this.destroyChild(id, item);
|
|
28
30
|
};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const $ = this.$;
|
|
36
|
-
this.model.listener.onAdd($.addHandler);
|
|
37
|
-
this.model.listener.onRemove($.removeHandler);
|
|
38
|
-
super.ready();
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Handles destroy event
|
|
42
|
-
*/
|
|
43
|
-
destroy() {
|
|
44
|
-
const $ = this.$;
|
|
45
|
-
this.model.listener.offAdd($.addHandler);
|
|
46
|
-
this.model.listener.offRemove($.removeHandler);
|
|
47
|
-
super.destroy();
|
|
31
|
+
input.model.listener.onAdd($.addHandler);
|
|
32
|
+
input.model.listener.onRemove($.removeHandler);
|
|
33
|
+
this.runOnDestroy(() => {
|
|
34
|
+
input.model.listener.offAdd($.addHandler);
|
|
35
|
+
input.model.listener.offRemove($.removeHandler);
|
|
36
|
+
});
|
|
48
37
|
}
|
|
49
38
|
}
|
package/lib/views/map-view.js
CHANGED
|
@@ -5,15 +5,10 @@ import { BaseView } from "./base-view";
|
|
|
5
5
|
* @extends BaseView
|
|
6
6
|
*/
|
|
7
7
|
export class MapView extends BaseView {
|
|
8
|
-
|
|
9
|
-
super();
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
ready() {
|
|
13
|
-
const map = this.model;
|
|
14
|
-
map.forEach((value, key) => {
|
|
15
|
-
this.createChild(key, value);
|
|
8
|
+
compose(input) {
|
|
9
|
+
super.compose(input);
|
|
10
|
+
input.model.forEach((value, key) => {
|
|
11
|
+
this.createChild(input, key, value);
|
|
16
12
|
});
|
|
17
|
-
super.ready();
|
|
18
13
|
}
|
|
19
14
|
}
|
package/lib/views/object-view.js
CHANGED
|
@@ -5,14 +5,11 @@ import { BaseView } from "./base-view";
|
|
|
5
5
|
* @extends BaseView
|
|
6
6
|
*/
|
|
7
7
|
export class ObjectView extends BaseView {
|
|
8
|
-
|
|
9
|
-
super();
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
ready() {
|
|
13
|
-
const obj = this.model;
|
|
8
|
+
compose(input) {
|
|
9
|
+
super.compose(input);
|
|
10
|
+
const obj = input.model.proxy();
|
|
14
11
|
for (const key in obj) {
|
|
15
|
-
this.createChild(key, obj[key]);
|
|
12
|
+
this.createChild(input, key, obj[key]);
|
|
16
13
|
}
|
|
17
14
|
super.ready();
|
|
18
15
|
}
|
package/lib/views/repeat-node.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { Fragment, INodePrivate } from "../node/node";
|
|
2
|
-
import { Slot } from "../core/slot";
|
|
3
|
-
import { timeoutExecutor } from "../core/executor";
|
|
4
2
|
/**
|
|
5
3
|
* Private part of repeat node
|
|
6
4
|
* @class RepeatNodePrivate
|
|
@@ -14,11 +12,11 @@ export class RepeatNodePrivate extends INodePrivate {
|
|
|
14
12
|
* @type {Map}
|
|
15
13
|
*/
|
|
16
14
|
this.nodes = new Map();
|
|
17
|
-
this
|
|
15
|
+
this.$seal();
|
|
18
16
|
}
|
|
19
|
-
destroy() {
|
|
17
|
+
$destroy() {
|
|
20
18
|
this.nodes.clear();
|
|
21
|
-
super
|
|
19
|
+
super.$destroy();
|
|
22
20
|
}
|
|
23
21
|
}
|
|
24
22
|
/**
|
|
@@ -27,17 +25,15 @@ export class RepeatNodePrivate extends INodePrivate {
|
|
|
27
25
|
* @extends Fragment
|
|
28
26
|
*/
|
|
29
27
|
export class RepeatNode extends Fragment {
|
|
30
|
-
constructor($) {
|
|
31
|
-
super($
|
|
28
|
+
constructor(input, $) {
|
|
29
|
+
super(input, $);
|
|
32
30
|
/**
|
|
33
31
|
* If false will use timeout executor, otherwise the app executor
|
|
34
32
|
*/
|
|
35
33
|
this.freezeUi = true;
|
|
36
|
-
this.slot = new Slot;
|
|
37
34
|
}
|
|
38
|
-
createChild(id, item, before) {
|
|
39
|
-
|
|
40
|
-
const node = new Fragment();
|
|
35
|
+
createChild(opts, id, item, before) {
|
|
36
|
+
const node = new Fragment({});
|
|
41
37
|
this.destroyChild(id, item);
|
|
42
38
|
if (before) {
|
|
43
39
|
this.children.add(node);
|
|
@@ -53,16 +49,8 @@ export class RepeatNode extends Fragment {
|
|
|
53
49
|
this.lastChild = node;
|
|
54
50
|
node.preinit(this.$.app, this);
|
|
55
51
|
node.init();
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
node.ready();
|
|
59
|
-
};
|
|
60
|
-
if (this.freezeUi) {
|
|
61
|
-
this.$.app.run.callCallback(callback);
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
timeoutExecutor.callCallback(callback);
|
|
65
|
-
}
|
|
52
|
+
opts.slot && opts.slot(node, item, id);
|
|
53
|
+
node.ready();
|
|
66
54
|
this.$.nodes.set(id, node);
|
|
67
55
|
}
|
|
68
56
|
destroyChild(id, item) {
|
|
@@ -70,7 +58,7 @@ export class RepeatNode extends Fragment {
|
|
|
70
58
|
const child = $.nodes.get(id);
|
|
71
59
|
if (child) {
|
|
72
60
|
child.remove();
|
|
73
|
-
child
|
|
61
|
+
child.$destroy();
|
|
74
62
|
this.$.nodes.delete(id);
|
|
75
63
|
this.children.delete(child);
|
|
76
64
|
}
|
package/lib/views/set-view.js
CHANGED
|
@@ -5,18 +5,11 @@ import { BaseView } from "./base-view";
|
|
|
5
5
|
* @extends BaseView
|
|
6
6
|
*/
|
|
7
7
|
export class SetView extends BaseView {
|
|
8
|
-
|
|
9
|
-
super();
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
ready() {
|
|
13
|
-
const $ = this.$;
|
|
14
|
-
const set = this.model;
|
|
8
|
+
compose(input) {
|
|
9
|
+
super.compose(input);
|
|
10
|
+
const set = input.model;
|
|
15
11
|
set.forEach(item => {
|
|
16
|
-
|
|
17
|
-
this.createChild(item, item);
|
|
18
|
-
});
|
|
12
|
+
this.createChild(input, item, item);
|
|
19
13
|
});
|
|
20
|
-
super.ready();
|
|
21
14
|
}
|
|
22
15
|
}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Vasille - Safe. Fast. Powerful.",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "types/index.d.ts",
|
|
6
|
-
"version": "2.
|
|
6
|
+
"version": "2.2.2",
|
|
7
7
|
"exports": {
|
|
8
8
|
"import": "./lib/index.js",
|
|
9
9
|
"browser": "./lib/index.js"
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"test": "jest",
|
|
16
16
|
"test-coverage": "jest --coverage",
|
|
17
17
|
"update-types": "tsc --build tsconfig-types.json",
|
|
18
|
+
"update-flowjs": "node flow-typed/create.js",
|
|
18
19
|
"cdn-create": "node cdn/create.js",
|
|
19
20
|
"es5-check": "es-check es5 cdn/*es5.js"
|
|
20
21
|
},
|
|
@@ -45,6 +46,7 @@
|
|
|
45
46
|
"@typescript-eslint/parser": "latest",
|
|
46
47
|
"es-check": "latest",
|
|
47
48
|
"eslint": "latest",
|
|
49
|
+
"flow-bin": "latest",
|
|
48
50
|
"jest": "latest",
|
|
49
51
|
"jsdom": "latest",
|
|
50
52
|
"ts-jest": "latest",
|
|
@@ -6,12 +6,12 @@ import type { IValue } from "../core/ivalue";
|
|
|
6
6
|
* @class AttributeBinding
|
|
7
7
|
* @extends Binding
|
|
8
8
|
*/
|
|
9
|
-
export declare class AttributeBinding extends Binding<string> {
|
|
9
|
+
export declare class AttributeBinding extends Binding<string | number | boolean | null> {
|
|
10
10
|
/**
|
|
11
11
|
* Constructs an attribute binding description
|
|
12
12
|
* @param node {INode} the vasille node
|
|
13
13
|
* @param name {String} the name of attribute
|
|
14
14
|
* @param value {IValue} value to bind
|
|
15
15
|
*/
|
|
16
|
-
constructor(node: INode, name: string, value: IValue<string>);
|
|
16
|
+
constructor(node: INode, name: string, value: IValue<string | number | boolean | null>);
|
|
17
17
|
}
|