vasille 2.2.1 → 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/cdn/es2015.js +516 -516
- package/cdn/es5.js +583 -579
- package/flow-typed/vasille.js +40 -40
- package/lib/binding/attribute.js +1 -1
- package/lib/binding/binding.js +5 -5
- package/lib/binding/class.js +2 -2
- package/lib/binding/style.js +1 -1
- package/lib/core/core.js +12 -12
- package/lib/core/destroyable.js +2 -2
- package/lib/core/ivalue.js +4 -4
- package/lib/functional/reactivity.js +1 -1
- package/lib/node/app.js +3 -3
- package/lib/node/node.js +39 -39
- package/lib/node/watch.js +1 -1
- package/lib/v/index.js +1 -1
- package/lib/value/expression.js +13 -13
- package/lib/value/mirror.js +15 -15
- package/lib/value/pointer.js +5 -5
- package/lib/value/reference.js +18 -18
- package/lib/views/base-view.js +1 -1
- package/lib/views/repeat-node.js +4 -4
- package/package.json +1 -1
- package/types/binding/binding.d.ts +1 -1
- package/types/core/core.d.ts +2 -2
- package/types/core/destroyable.d.ts +2 -2
- package/types/core/ivalue.d.ts +4 -4
- package/types/node/node.d.ts +11 -11
- package/types/v/index.d.ts +4 -0
- package/types/value/expression.d.ts +5 -5
- 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/repeat-node.d.ts +1 -1
package/flow-typed/vasille.js
CHANGED
|
@@ -11,16 +11,16 @@ declare class Mirror<T> extends Reference<T> {
|
|
|
11
11
|
* pointed value
|
|
12
12
|
* @type IValue
|
|
13
13
|
*/
|
|
14
|
-
pointedValue: IValue<T>;
|
|
14
|
+
$pointedValue: IValue<T>;
|
|
15
15
|
/**
|
|
16
16
|
* Collection of handlers
|
|
17
17
|
* @type Set
|
|
18
18
|
*/
|
|
19
|
-
handler
|
|
19
|
+
$handler;
|
|
20
20
|
/**
|
|
21
21
|
* Ensure forward only synchronization
|
|
22
22
|
*/
|
|
23
|
-
forwardOnly: boolean;
|
|
23
|
+
$forwardOnly: boolean;
|
|
24
24
|
/**
|
|
25
25
|
* Constructs a notifiable bind to a value
|
|
26
26
|
* @param value {IValue} is initial value
|
|
@@ -29,9 +29,9 @@ declare class Mirror<T> extends Reference<T> {
|
|
|
29
29
|
constructor(value: IValue<T>, forwardOnly?: boolean): void;
|
|
30
30
|
get $(): T;
|
|
31
31
|
set $(v: T): void;
|
|
32
|
-
enable(): void;
|
|
33
|
-
disable(): void;
|
|
34
|
-
destroy(): void;
|
|
32
|
+
$enable(): void;
|
|
33
|
+
$disable(): void;
|
|
34
|
+
$destroy(): void;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
|
|
@@ -73,11 +73,11 @@ declare class Expression<T,Args> extends IValue<T> {
|
|
|
73
73
|
constructor(func: (...args: Args) => T, link: boolean, ...values: KindOfIValue<Args>): void;
|
|
74
74
|
get $(): T;
|
|
75
75
|
set $(value: T): void;
|
|
76
|
-
on(handler: (value: T) => void): this;
|
|
77
|
-
off(handler: (value: T) => void): this;
|
|
78
|
-
enable(): this;
|
|
79
|
-
disable(): this;
|
|
80
|
-
destroy(): void;
|
|
76
|
+
$on(handler: (value: T) => void): this;
|
|
77
|
+
$off(handler: (value: T) => void): this;
|
|
78
|
+
$enable(): this;
|
|
79
|
+
$disable(): this;
|
|
80
|
+
$destroy(): void;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
|
|
@@ -91,24 +91,24 @@ declare class Reference<T> extends IValue<T> {
|
|
|
91
91
|
* The encapsulated value
|
|
92
92
|
* @type {*}
|
|
93
93
|
*/
|
|
94
|
-
value
|
|
94
|
+
$value;
|
|
95
95
|
/**
|
|
96
96
|
* Array of handlers
|
|
97
97
|
* @type {Set}
|
|
98
98
|
* @readonly
|
|
99
99
|
*/
|
|
100
|
-
onchange
|
|
100
|
+
$onchange;
|
|
101
101
|
/**
|
|
102
102
|
* @param value {any} the initial value
|
|
103
103
|
*/
|
|
104
104
|
constructor(value: T): void;
|
|
105
105
|
get $(): T;
|
|
106
106
|
set $(value: T): void;
|
|
107
|
-
enable(): void;
|
|
108
|
-
disable(): void;
|
|
109
|
-
on(handler: (value: T) => void): void;
|
|
110
|
-
off(handler: (value: T) => void): void;
|
|
111
|
-
destroy(): void;
|
|
107
|
+
$enable(): void;
|
|
108
|
+
$disable(): void;
|
|
109
|
+
$on(handler: (value: T) => void): void;
|
|
110
|
+
$off(handler: (value: T) => void): void;
|
|
111
|
+
$destroy(): void;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
|
|
@@ -127,7 +127,7 @@ declare class Pointer<T> extends Mirror<T> {
|
|
|
127
127
|
* Point a new ivalue
|
|
128
128
|
* @param value {IValue} value to point
|
|
129
129
|
*/
|
|
130
|
-
|
|
130
|
+
set $$(value: IValue<T>): void;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
|
|
@@ -163,7 +163,7 @@ declare class RepeatNodePrivate<IdT> extends INodePrivate {
|
|
|
163
163
|
*/
|
|
164
164
|
nodes: Map<IdT, Fragment>;
|
|
165
165
|
constructor(): void;
|
|
166
|
-
destroy(): void;
|
|
166
|
+
$destroy(): void;
|
|
167
167
|
}
|
|
168
168
|
declare interface RNO<T, IdT> extends Options {
|
|
169
169
|
slot?: (node: Fragment, value: T, index: IdT) => void;
|
|
@@ -602,7 +602,7 @@ declare class FragmentPrivate extends ReactivePrivate {
|
|
|
602
602
|
/**
|
|
603
603
|
* Unlinks all bindings
|
|
604
604
|
*/
|
|
605
|
-
destroy(): void;
|
|
605
|
+
$destroy(): void;
|
|
606
606
|
}
|
|
607
607
|
/**
|
|
608
608
|
* This class is symbolic
|
|
@@ -713,7 +713,7 @@ declare class Fragment<T> extends Reactive {
|
|
|
713
713
|
insertBefore(node: Fragment): void;
|
|
714
714
|
insertAfter(node: Fragment): void;
|
|
715
715
|
remove(): void;
|
|
716
|
-
destroy(): void;
|
|
716
|
+
$destroy(): void;
|
|
717
717
|
}
|
|
718
718
|
/**
|
|
719
719
|
* The part of a text node
|
|
@@ -733,7 +733,7 @@ declare class TextNodePrivate extends FragmentPrivate {
|
|
|
733
733
|
/**
|
|
734
734
|
* Clear node data
|
|
735
735
|
*/
|
|
736
|
-
destroy(): void;
|
|
736
|
+
$destroy(): void;
|
|
737
737
|
}
|
|
738
738
|
/**
|
|
739
739
|
* Represents a text node
|
|
@@ -745,7 +745,7 @@ declare class TextNode extends Fragment {
|
|
|
745
745
|
constructor($?: TextNodePrivate): void;
|
|
746
746
|
preinit(app: AppNode, parent: Fragment, text?: IValue<string> | string): void;
|
|
747
747
|
findFirstChild(): Node;
|
|
748
|
-
destroy(): void;
|
|
748
|
+
$destroy(): void;
|
|
749
749
|
}
|
|
750
750
|
/**
|
|
751
751
|
* The part of a base node
|
|
@@ -764,7 +764,7 @@ declare class INodePrivate extends FragmentPrivate {
|
|
|
764
764
|
*/
|
|
765
765
|
node: Element;
|
|
766
766
|
constructor(): void;
|
|
767
|
-
destroy(): void;
|
|
767
|
+
$destroy(): void;
|
|
768
768
|
}
|
|
769
769
|
/**
|
|
770
770
|
* Vasille node which can manipulate an element node
|
|
@@ -871,7 +871,7 @@ declare class Tag<K> extends INode<TagOptionsWithSlot<K>> {
|
|
|
871
871
|
/**
|
|
872
872
|
* Runs GC
|
|
873
873
|
*/
|
|
874
|
-
destroy(): void;
|
|
874
|
+
$destroy(): void;
|
|
875
875
|
}
|
|
876
876
|
/**
|
|
877
877
|
* Represents a vasille extension node
|
|
@@ -880,7 +880,7 @@ declare class Tag<K> extends INode<TagOptionsWithSlot<K>> {
|
|
|
880
880
|
*/
|
|
881
881
|
declare class Extension<T> extends INode<T> {
|
|
882
882
|
preinit(app: AppNode, parent: Fragment): void;
|
|
883
|
-
destroy(): void;
|
|
883
|
+
$destroy(): void;
|
|
884
884
|
}
|
|
885
885
|
/**
|
|
886
886
|
* Node which cas has just a child
|
|
@@ -920,7 +920,7 @@ declare class SwitchedNodePrivate extends FragmentPrivate {
|
|
|
920
920
|
/**
|
|
921
921
|
* Runs GC
|
|
922
922
|
*/
|
|
923
|
-
destroy(): void;
|
|
923
|
+
$destroy(): void;
|
|
924
924
|
}
|
|
925
925
|
/**
|
|
926
926
|
* Defines a node witch can switch its children conditionally
|
|
@@ -941,7 +941,7 @@ declare class SwitchedNode extends Fragment {
|
|
|
941
941
|
*/
|
|
942
942
|
createChild(cb: (node: Fragment) => void): void;
|
|
943
943
|
ready(): void;
|
|
944
|
-
destroy(): void;
|
|
944
|
+
$destroy(): void;
|
|
945
945
|
}
|
|
946
946
|
/**
|
|
947
947
|
* The part of a text node
|
|
@@ -959,7 +959,7 @@ declare class DebugPrivate extends FragmentPrivate {
|
|
|
959
959
|
/**
|
|
960
960
|
* Clear node data
|
|
961
961
|
*/
|
|
962
|
-
destroy(): void;
|
|
962
|
+
$destroy(): void;
|
|
963
963
|
}
|
|
964
964
|
/**
|
|
965
965
|
* Represents a debug node
|
|
@@ -977,7 +977,7 @@ declare class DebugNode extends Fragment {
|
|
|
977
977
|
/**
|
|
978
978
|
* Runs garbage collector
|
|
979
979
|
*/
|
|
980
|
-
destroy(): void;
|
|
980
|
+
$destroy(): void;
|
|
981
981
|
}
|
|
982
982
|
|
|
983
983
|
|
|
@@ -1041,7 +1041,7 @@ declare class Binding<T> extends Destroyable {
|
|
|
1041
1041
|
/**
|
|
1042
1042
|
* Just clear bindings
|
|
1043
1043
|
*/
|
|
1044
|
-
destroy(): void;
|
|
1044
|
+
$destroy(): void;
|
|
1045
1045
|
}
|
|
1046
1046
|
|
|
1047
1047
|
|
|
@@ -1164,11 +1164,11 @@ declare class Destroyable {
|
|
|
1164
1164
|
* Make object fields non configurable
|
|
1165
1165
|
* @protected
|
|
1166
1166
|
*/
|
|
1167
|
-
seal(): void;
|
|
1167
|
+
$seal(): void;
|
|
1168
1168
|
/**
|
|
1169
1169
|
* Garbage collector method
|
|
1170
1170
|
*/
|
|
1171
|
-
destroy(): void;
|
|
1171
|
+
$destroy(): void;
|
|
1172
1172
|
}
|
|
1173
1173
|
|
|
1174
1174
|
|
|
@@ -1182,11 +1182,11 @@ declare class Switchable extends Destroyable {
|
|
|
1182
1182
|
/**
|
|
1183
1183
|
* Enable update handlers triggering
|
|
1184
1184
|
*/
|
|
1185
|
-
enable(): void;
|
|
1185
|
+
$enable(): void;
|
|
1186
1186
|
/**
|
|
1187
1187
|
* disable update handlers triggering
|
|
1188
1188
|
*/
|
|
1189
|
-
disable(): void;
|
|
1189
|
+
$disable(): void;
|
|
1190
1190
|
}
|
|
1191
1191
|
/**
|
|
1192
1192
|
* Interface which describes a value
|
|
@@ -1217,12 +1217,12 @@ declare class IValue<T> extends Switchable {
|
|
|
1217
1217
|
* Add a new handler to value change
|
|
1218
1218
|
* @param handler {function(value : *)} the handler to add
|
|
1219
1219
|
*/
|
|
1220
|
-
on(handler: (value: T) => void): void;
|
|
1220
|
+
$on(handler: (value: T) => void): void;
|
|
1221
1221
|
/**
|
|
1222
1222
|
* Removes a handler of value change
|
|
1223
1223
|
* @param handler {function(value : *)} the handler to remove
|
|
1224
1224
|
*/
|
|
1225
|
-
off(handler: (value: T) => void): void;
|
|
1225
|
+
$off(handler: (value: T) => void): void;
|
|
1226
1226
|
}
|
|
1227
1227
|
|
|
1228
1228
|
|
|
@@ -1269,7 +1269,7 @@ declare class ReactivePrivate extends Destroyable {
|
|
|
1269
1269
|
parent: Reactive;
|
|
1270
1270
|
onDestroy?: () => void;
|
|
1271
1271
|
constructor(): void;
|
|
1272
|
-
destroy(): void;
|
|
1272
|
+
$destroy(): void;
|
|
1273
1273
|
}
|
|
1274
1274
|
/**
|
|
1275
1275
|
* A reactive object
|
|
@@ -1349,7 +1349,7 @@ declare class Reactive<T> extends Destroyable {
|
|
|
1349
1349
|
composeNow(): void;
|
|
1350
1350
|
runFunctional<F>(f: F, ...args: Parameters<F>): ReturnType<F>;
|
|
1351
1351
|
runOnDestroy(func: () => void): void;
|
|
1352
|
-
destroy(): void;
|
|
1352
|
+
$destroy(): void;
|
|
1353
1353
|
}
|
|
1354
1354
|
|
|
1355
1355
|
|
package/lib/binding/attribute.js
CHANGED
package/lib/binding/binding.js
CHANGED
|
@@ -12,18 +12,18 @@ export class Binding extends Destroyable {
|
|
|
12
12
|
constructor(value) {
|
|
13
13
|
super();
|
|
14
14
|
this.binding = value;
|
|
15
|
-
this
|
|
15
|
+
this.$seal();
|
|
16
16
|
}
|
|
17
17
|
init(bounded) {
|
|
18
18
|
this.func = bounded;
|
|
19
|
-
this.binding
|
|
19
|
+
this.binding.$on(this.func);
|
|
20
20
|
this.func(this.binding.$);
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* Just clear bindings
|
|
24
24
|
*/
|
|
25
|
-
destroy() {
|
|
26
|
-
this.binding
|
|
27
|
-
super
|
|
25
|
+
$destroy() {
|
|
26
|
+
this.binding.$off(this.func);
|
|
27
|
+
super.$destroy();
|
|
28
28
|
}
|
|
29
29
|
}
|
package/lib/binding/class.js
CHANGED
|
@@ -20,7 +20,7 @@ export class StaticClassBinding extends Binding {
|
|
|
20
20
|
this.current = value;
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
|
-
this
|
|
23
|
+
this.$seal();
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
export class DynamicalClassBinding extends Binding {
|
|
@@ -38,6 +38,6 @@ export class DynamicalClassBinding extends Binding {
|
|
|
38
38
|
this.current = value;
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
|
-
this
|
|
41
|
+
this.$seal();
|
|
42
42
|
}
|
|
43
43
|
}
|
package/lib/binding/style.js
CHANGED
package/lib/core/core.js
CHANGED
|
@@ -45,18 +45,18 @@ export class ReactivePrivate extends Destroyable {
|
|
|
45
45
|
* @type {boolean}
|
|
46
46
|
*/
|
|
47
47
|
this.frozen = false;
|
|
48
|
-
this
|
|
48
|
+
this.$seal();
|
|
49
49
|
}
|
|
50
|
-
destroy() {
|
|
51
|
-
this.watch.forEach(value => value
|
|
50
|
+
$destroy() {
|
|
51
|
+
this.watch.forEach(value => value.$destroy());
|
|
52
52
|
this.watch.clear();
|
|
53
|
-
this.bindings.forEach(binding => binding
|
|
53
|
+
this.bindings.forEach(binding => binding.$destroy());
|
|
54
54
|
this.bindings.clear();
|
|
55
55
|
this.models.forEach(model => model.disableReactivity());
|
|
56
56
|
this.models.clear();
|
|
57
|
-
this.freezeExpr && this.freezeExpr
|
|
57
|
+
this.freezeExpr && this.freezeExpr.$destroy();
|
|
58
58
|
this.onDestroy && this.onDestroy();
|
|
59
|
-
super
|
|
59
|
+
super.$destroy();
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
@@ -69,7 +69,7 @@ export class Reactive extends Destroyable {
|
|
|
69
69
|
super();
|
|
70
70
|
this.input = input;
|
|
71
71
|
this.$ = $ || new ReactivePrivate;
|
|
72
|
-
this
|
|
72
|
+
this.$seal();
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
75
|
* Get parent node
|
|
@@ -152,7 +152,7 @@ export class Reactive extends Destroyable {
|
|
|
152
152
|
const $ = this.$;
|
|
153
153
|
if (!$.enabled) {
|
|
154
154
|
$.watch.forEach(watcher => {
|
|
155
|
-
watcher
|
|
155
|
+
watcher.$enable();
|
|
156
156
|
});
|
|
157
157
|
$.models.forEach(model => {
|
|
158
158
|
model.enableReactivity();
|
|
@@ -167,7 +167,7 @@ export class Reactive extends Destroyable {
|
|
|
167
167
|
const $ = this.$;
|
|
168
168
|
if ($.enabled) {
|
|
169
169
|
$.watch.forEach(watcher => {
|
|
170
|
-
watcher
|
|
170
|
+
watcher.$disable();
|
|
171
171
|
});
|
|
172
172
|
$.models.forEach(model => {
|
|
173
173
|
model.disableReactivity();
|
|
@@ -230,9 +230,9 @@ export class Reactive extends Destroyable {
|
|
|
230
230
|
runOnDestroy(func) {
|
|
231
231
|
this.$.onDestroy = func;
|
|
232
232
|
}
|
|
233
|
-
destroy() {
|
|
234
|
-
super
|
|
235
|
-
this
|
|
233
|
+
$destroy() {
|
|
234
|
+
super.$destroy();
|
|
235
|
+
this.$.$destroy();
|
|
236
236
|
this.$ = null;
|
|
237
237
|
}
|
|
238
238
|
}
|
package/lib/core/destroyable.js
CHANGED
|
@@ -7,7 +7,7 @@ export class Destroyable {
|
|
|
7
7
|
* Make object fields non configurable
|
|
8
8
|
* @protected
|
|
9
9
|
*/
|
|
10
|
-
seal() {
|
|
10
|
+
$seal() {
|
|
11
11
|
const $ = this;
|
|
12
12
|
Object.keys($).forEach(i => {
|
|
13
13
|
// eslint-disable-next-line no-prototype-builtins
|
|
@@ -39,7 +39,7 @@ export class Destroyable {
|
|
|
39
39
|
/**
|
|
40
40
|
* Garbage collector method
|
|
41
41
|
*/
|
|
42
|
-
destroy() {
|
|
42
|
+
$destroy() {
|
|
43
43
|
// nothing here
|
|
44
44
|
}
|
|
45
45
|
}
|
package/lib/core/ivalue.js
CHANGED
|
@@ -4,13 +4,13 @@ export class Switchable extends Destroyable {
|
|
|
4
4
|
/**
|
|
5
5
|
* Enable update handlers triggering
|
|
6
6
|
*/
|
|
7
|
-
enable() {
|
|
7
|
+
$enable() {
|
|
8
8
|
throw notOverwritten();
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* disable update handlers triggering
|
|
12
12
|
*/
|
|
13
|
-
disable() {
|
|
13
|
+
$disable() {
|
|
14
14
|
throw notOverwritten();
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -45,14 +45,14 @@ export class IValue extends Switchable {
|
|
|
45
45
|
* Add a new handler to value change
|
|
46
46
|
* @param handler {function(value : *)} the handler to add
|
|
47
47
|
*/
|
|
48
|
-
on(handler) {
|
|
48
|
+
$on(handler) {
|
|
49
49
|
throw notOverwritten();
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
52
|
* Removes a handler of value change
|
|
53
53
|
* @param handler {function(value : *)} the handler to remove
|
|
54
54
|
*/
|
|
55
|
-
off(handler) {
|
|
55
|
+
$off(handler) {
|
|
56
56
|
throw notOverwritten();
|
|
57
57
|
}
|
|
58
58
|
}
|
package/lib/node/app.js
CHANGED
|
@@ -11,7 +11,7 @@ export class AppNode extends INode {
|
|
|
11
11
|
constructor(input) {
|
|
12
12
|
super(input);
|
|
13
13
|
this.debugUi = input.debugUi || false;
|
|
14
|
-
this
|
|
14
|
+
this.$seal();
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
@@ -30,7 +30,7 @@ export class App extends AppNode {
|
|
|
30
30
|
this.$.node = node;
|
|
31
31
|
this.preinit(this, this);
|
|
32
32
|
this.init();
|
|
33
|
-
this
|
|
33
|
+
this.$seal();
|
|
34
34
|
}
|
|
35
35
|
appendNode(node) {
|
|
36
36
|
this.$.node.appendChild(node);
|
|
@@ -40,7 +40,7 @@ export class Portal extends AppNode {
|
|
|
40
40
|
constructor(input) {
|
|
41
41
|
super(input);
|
|
42
42
|
this.$.node = input.node;
|
|
43
|
-
this
|
|
43
|
+
this.$seal();
|
|
44
44
|
}
|
|
45
45
|
appendNode(node) {
|
|
46
46
|
this.$.node.appendChild(node);
|