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/lib/node/node.js
CHANGED
|
@@ -14,7 +14,7 @@ import { internalError, userError } from "../core/errors";
|
|
|
14
14
|
export class FragmentPrivate extends ReactivePrivate {
|
|
15
15
|
constructor() {
|
|
16
16
|
super();
|
|
17
|
-
this
|
|
17
|
+
this.$seal();
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* Pre-initializes the base of a fragment
|
|
@@ -28,10 +28,10 @@ export class FragmentPrivate extends ReactivePrivate {
|
|
|
28
28
|
/**
|
|
29
29
|
* Unlinks all bindings
|
|
30
30
|
*/
|
|
31
|
-
destroy() {
|
|
31
|
+
$destroy() {
|
|
32
32
|
this.next = null;
|
|
33
33
|
this.prev = null;
|
|
34
|
-
super
|
|
34
|
+
super.$destroy();
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
@@ -254,14 +254,14 @@ export class Fragment extends Reactive {
|
|
|
254
254
|
$.prev.$.next = $.next;
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
|
-
destroy() {
|
|
258
|
-
this.children.forEach(child => child
|
|
257
|
+
$destroy() {
|
|
258
|
+
this.children.forEach(child => child.$destroy());
|
|
259
259
|
this.children.clear();
|
|
260
260
|
this.lastChild = null;
|
|
261
261
|
if (this.$.parent.lastChild === this) {
|
|
262
262
|
this.$.parent.lastChild = this.$.prev;
|
|
263
263
|
}
|
|
264
|
-
super
|
|
264
|
+
super.$destroy();
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
267
|
const trueIValue = new Reference(true);
|
|
@@ -273,7 +273,7 @@ const trueIValue = new Reference(true);
|
|
|
273
273
|
export class TextNodePrivate extends FragmentPrivate {
|
|
274
274
|
constructor() {
|
|
275
275
|
super();
|
|
276
|
-
this
|
|
276
|
+
this.$seal();
|
|
277
277
|
}
|
|
278
278
|
/**
|
|
279
279
|
* Pre-initializes a text node
|
|
@@ -293,8 +293,8 @@ export class TextNodePrivate extends FragmentPrivate {
|
|
|
293
293
|
/**
|
|
294
294
|
* Clear node data
|
|
295
295
|
*/
|
|
296
|
-
destroy() {
|
|
297
|
-
super
|
|
296
|
+
$destroy() {
|
|
297
|
+
super.$destroy();
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
300
|
/**
|
|
@@ -305,7 +305,7 @@ export class TextNodePrivate extends FragmentPrivate {
|
|
|
305
305
|
export class TextNode extends Fragment {
|
|
306
306
|
constructor($ = new TextNodePrivate()) {
|
|
307
307
|
super({}, $);
|
|
308
|
-
this
|
|
308
|
+
this.$seal();
|
|
309
309
|
}
|
|
310
310
|
preinit(app, parent, text) {
|
|
311
311
|
const $ = this.$;
|
|
@@ -318,10 +318,10 @@ export class TextNode extends Fragment {
|
|
|
318
318
|
findFirstChild() {
|
|
319
319
|
return this.$.node;
|
|
320
320
|
}
|
|
321
|
-
destroy() {
|
|
321
|
+
$destroy() {
|
|
322
322
|
this.$.node.remove();
|
|
323
|
-
this
|
|
324
|
-
super
|
|
323
|
+
this.$.$destroy();
|
|
324
|
+
super.$destroy();
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
327
|
/**
|
|
@@ -337,10 +337,10 @@ export class INodePrivate extends FragmentPrivate {
|
|
|
337
337
|
* @type {boolean}
|
|
338
338
|
*/
|
|
339
339
|
this.unmounted = false;
|
|
340
|
-
this
|
|
340
|
+
this.$seal();
|
|
341
341
|
}
|
|
342
|
-
destroy() {
|
|
343
|
-
super
|
|
342
|
+
$destroy() {
|
|
343
|
+
super.$destroy();
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
346
|
/**
|
|
@@ -356,7 +356,7 @@ export class INode extends Fragment {
|
|
|
356
356
|
*/
|
|
357
357
|
constructor(input, $) {
|
|
358
358
|
super(input, $ || new INodePrivate);
|
|
359
|
-
this
|
|
359
|
+
this.$seal();
|
|
360
360
|
}
|
|
361
361
|
/**
|
|
362
362
|
* Get the bound node
|
|
@@ -599,7 +599,7 @@ export class INode extends Fragment {
|
|
|
599
599
|
export class Tag extends INode {
|
|
600
600
|
constructor(input) {
|
|
601
601
|
super(input);
|
|
602
|
-
this
|
|
602
|
+
this.$seal();
|
|
603
603
|
}
|
|
604
604
|
preinit(app, parent, tagName) {
|
|
605
605
|
if (!tagName || typeof tagName !== "string") {
|
|
@@ -652,9 +652,9 @@ export class Tag extends INode {
|
|
|
652
652
|
/**
|
|
653
653
|
* Runs GC
|
|
654
654
|
*/
|
|
655
|
-
destroy() {
|
|
655
|
+
$destroy() {
|
|
656
656
|
this.node.remove();
|
|
657
|
-
super
|
|
657
|
+
super.$destroy();
|
|
658
658
|
}
|
|
659
659
|
}
|
|
660
660
|
/**
|
|
@@ -677,8 +677,8 @@ export class Extension extends INode {
|
|
|
677
677
|
throw userError("A extension node can be encapsulated only in a tag/extension/component", "virtual-dom");
|
|
678
678
|
}
|
|
679
679
|
}
|
|
680
|
-
destroy() {
|
|
681
|
-
super
|
|
680
|
+
$destroy() {
|
|
681
|
+
super.$destroy();
|
|
682
682
|
}
|
|
683
683
|
}
|
|
684
684
|
/**
|
|
@@ -723,18 +723,18 @@ export class SwitchedNodePrivate extends FragmentPrivate {
|
|
|
723
723
|
* @type {Array<{cond : IValue<boolean>, cb : function(Fragment)}>}
|
|
724
724
|
*/
|
|
725
725
|
this.cases = [];
|
|
726
|
-
this
|
|
726
|
+
this.$seal();
|
|
727
727
|
}
|
|
728
728
|
/**
|
|
729
729
|
* Runs GC
|
|
730
730
|
*/
|
|
731
|
-
destroy() {
|
|
731
|
+
$destroy() {
|
|
732
732
|
this.cases.forEach(c => {
|
|
733
733
|
delete c.cond;
|
|
734
734
|
delete c.cb;
|
|
735
735
|
});
|
|
736
736
|
this.cases.splice(0);
|
|
737
|
-
super
|
|
737
|
+
super.$destroy();
|
|
738
738
|
}
|
|
739
739
|
}
|
|
740
740
|
/**
|
|
@@ -758,7 +758,7 @@ export class SwitchedNode extends Fragment {
|
|
|
758
758
|
return;
|
|
759
759
|
}
|
|
760
760
|
if (this.lastChild) {
|
|
761
|
-
this.lastChild
|
|
761
|
+
this.lastChild.$destroy();
|
|
762
762
|
this.children.clear();
|
|
763
763
|
this.lastChild = null;
|
|
764
764
|
}
|
|
@@ -770,11 +770,11 @@ export class SwitchedNode extends Fragment {
|
|
|
770
770
|
$.index = -1;
|
|
771
771
|
}
|
|
772
772
|
};
|
|
773
|
-
this
|
|
773
|
+
this.$seal();
|
|
774
774
|
}
|
|
775
775
|
addCase(case_) {
|
|
776
776
|
this.$.cases.push(case_);
|
|
777
|
-
case_.cond
|
|
777
|
+
case_.cond.$on(this.$.sync);
|
|
778
778
|
this.$.sync();
|
|
779
779
|
}
|
|
780
780
|
/**
|
|
@@ -792,16 +792,16 @@ export class SwitchedNode extends Fragment {
|
|
|
792
792
|
ready() {
|
|
793
793
|
const $ = this.$;
|
|
794
794
|
$.cases.forEach(c => {
|
|
795
|
-
c.cond
|
|
795
|
+
c.cond.$on($.sync);
|
|
796
796
|
});
|
|
797
797
|
$.sync();
|
|
798
798
|
}
|
|
799
|
-
destroy() {
|
|
799
|
+
$destroy() {
|
|
800
800
|
const $ = this.$;
|
|
801
801
|
$.cases.forEach(c => {
|
|
802
|
-
c.cond
|
|
802
|
+
c.cond.$off($.sync);
|
|
803
803
|
});
|
|
804
|
-
super
|
|
804
|
+
super.$destroy();
|
|
805
805
|
}
|
|
806
806
|
}
|
|
807
807
|
/**
|
|
@@ -810,7 +810,7 @@ export class SwitchedNode extends Fragment {
|
|
|
810
810
|
export class DebugPrivate extends FragmentPrivate {
|
|
811
811
|
constructor() {
|
|
812
812
|
super();
|
|
813
|
-
this
|
|
813
|
+
this.$seal();
|
|
814
814
|
}
|
|
815
815
|
/**
|
|
816
816
|
* Pre-initializes a text node
|
|
@@ -829,9 +829,9 @@ export class DebugPrivate extends FragmentPrivate {
|
|
|
829
829
|
/**
|
|
830
830
|
* Clear node data
|
|
831
831
|
*/
|
|
832
|
-
destroy() {
|
|
832
|
+
$destroy() {
|
|
833
833
|
this.node.remove();
|
|
834
|
-
super
|
|
834
|
+
super.$destroy();
|
|
835
835
|
}
|
|
836
836
|
}
|
|
837
837
|
/**
|
|
@@ -847,7 +847,7 @@ export class DebugNode extends Fragment {
|
|
|
847
847
|
* @type {DebugNode}
|
|
848
848
|
*/
|
|
849
849
|
this.$ = new DebugPrivate();
|
|
850
|
-
this
|
|
850
|
+
this.$seal();
|
|
851
851
|
}
|
|
852
852
|
preinit(app, parent, text) {
|
|
853
853
|
const $ = this.$;
|
|
@@ -859,8 +859,8 @@ export class DebugNode extends Fragment {
|
|
|
859
859
|
/**
|
|
860
860
|
* Runs garbage collector
|
|
861
861
|
*/
|
|
862
|
-
destroy() {
|
|
863
|
-
this
|
|
864
|
-
super
|
|
862
|
+
$destroy() {
|
|
863
|
+
this.$.$destroy();
|
|
864
|
+
super.$destroy();
|
|
865
865
|
}
|
|
866
866
|
}
|
package/lib/node/watch.js
CHANGED
package/lib/v/index.js
CHANGED
|
@@ -16,7 +16,7 @@ export const v = Object.assign(Object.assign({ ref(value) {
|
|
|
16
16
|
tag,
|
|
17
17
|
create }, vx), { merge,
|
|
18
18
|
destructor() {
|
|
19
|
-
return current
|
|
19
|
+
return current.$destroy.bind(current);
|
|
20
20
|
},
|
|
21
21
|
runOnDestroy(callback) {
|
|
22
22
|
current.runOnDestroy(callback);
|
package/lib/value/expression.js
CHANGED
|
@@ -35,12 +35,12 @@ export class Expression extends IValue {
|
|
|
35
35
|
this.values = values;
|
|
36
36
|
this.func = handler;
|
|
37
37
|
if (link) {
|
|
38
|
-
this
|
|
38
|
+
this.$enable();
|
|
39
39
|
}
|
|
40
40
|
else {
|
|
41
41
|
handler();
|
|
42
42
|
}
|
|
43
|
-
this
|
|
43
|
+
this.$seal();
|
|
44
44
|
}
|
|
45
45
|
get $() {
|
|
46
46
|
return this.sync.$;
|
|
@@ -48,18 +48,18 @@ export class Expression extends IValue {
|
|
|
48
48
|
set $(value) {
|
|
49
49
|
this.sync.$ = value;
|
|
50
50
|
}
|
|
51
|
-
on(handler) {
|
|
52
|
-
this.sync
|
|
51
|
+
$on(handler) {
|
|
52
|
+
this.sync.$on(handler);
|
|
53
53
|
return this;
|
|
54
54
|
}
|
|
55
|
-
off(handler) {
|
|
56
|
-
this.sync
|
|
55
|
+
$off(handler) {
|
|
56
|
+
this.sync.$off(handler);
|
|
57
57
|
return this;
|
|
58
58
|
}
|
|
59
|
-
enable() {
|
|
59
|
+
$enable() {
|
|
60
60
|
if (!this.isEnabled) {
|
|
61
61
|
for (let i = 0; i < this.values.length; i++) {
|
|
62
|
-
this.values[i]
|
|
62
|
+
this.values[i].$on(this.linkedFunc[i]);
|
|
63
63
|
this.valuesCache[i] = this.values[i].$;
|
|
64
64
|
}
|
|
65
65
|
this.func();
|
|
@@ -67,20 +67,20 @@ export class Expression extends IValue {
|
|
|
67
67
|
}
|
|
68
68
|
return this;
|
|
69
69
|
}
|
|
70
|
-
disable() {
|
|
70
|
+
$disable() {
|
|
71
71
|
if (this.isEnabled) {
|
|
72
72
|
for (let i = 0; i < this.values.length; i++) {
|
|
73
|
-
this.values[i]
|
|
73
|
+
this.values[i].$off(this.linkedFunc[i]);
|
|
74
74
|
}
|
|
75
75
|
this.isEnabled = false;
|
|
76
76
|
}
|
|
77
77
|
return this;
|
|
78
78
|
}
|
|
79
|
-
destroy() {
|
|
80
|
-
this
|
|
79
|
+
$destroy() {
|
|
80
|
+
this.$disable();
|
|
81
81
|
this.values.splice(0);
|
|
82
82
|
this.valuesCache.splice(0);
|
|
83
83
|
this.linkedFunc.splice(0);
|
|
84
|
-
super
|
|
84
|
+
super.$destroy();
|
|
85
85
|
}
|
|
86
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/base-view.js
CHANGED
package/lib/views/repeat-node.js
CHANGED
|
@@ -12,11 +12,11 @@ export class RepeatNodePrivate extends INodePrivate {
|
|
|
12
12
|
* @type {Map}
|
|
13
13
|
*/
|
|
14
14
|
this.nodes = new Map();
|
|
15
|
-
this
|
|
15
|
+
this.$seal();
|
|
16
16
|
}
|
|
17
|
-
destroy() {
|
|
17
|
+
$destroy() {
|
|
18
18
|
this.nodes.clear();
|
|
19
|
-
super
|
|
19
|
+
super.$destroy();
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
@@ -58,7 +58,7 @@ export class RepeatNode extends Fragment {
|
|
|
58
58
|
const child = $.nodes.get(id);
|
|
59
59
|
if (child) {
|
|
60
60
|
child.remove();
|
|
61
|
-
child
|
|
61
|
+
child.$destroy();
|
|
62
62
|
this.$.nodes.delete(id);
|
|
63
63
|
this.children.delete(child);
|
|
64
64
|
}
|
package/package.json
CHANGED
package/types/core/core.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export declare class ReactivePrivate extends Destroyable {
|
|
|
48
48
|
parent: Reactive;
|
|
49
49
|
onDestroy?: () => void;
|
|
50
50
|
constructor();
|
|
51
|
-
destroy(): void;
|
|
51
|
+
$destroy(): void;
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
54
|
* A reactive object
|
|
@@ -128,5 +128,5 @@ export declare class Reactive<T extends Options = Options> extends Destroyable {
|
|
|
128
128
|
protected composeNow(): void;
|
|
129
129
|
runFunctional<F extends (...args: any) => any>(f: F, ...args: Parameters<F>): ReturnType<F>;
|
|
130
130
|
runOnDestroy(func: () => void): void;
|
|
131
|
-
destroy(): void;
|
|
131
|
+
$destroy(): void;
|
|
132
132
|
}
|
package/types/core/ivalue.d.ts
CHANGED
|
@@ -3,11 +3,11 @@ export declare class Switchable extends Destroyable {
|
|
|
3
3
|
/**
|
|
4
4
|
* Enable update handlers triggering
|
|
5
5
|
*/
|
|
6
|
-
enable(): void;
|
|
6
|
+
$enable(): void;
|
|
7
7
|
/**
|
|
8
8
|
* disable update handlers triggering
|
|
9
9
|
*/
|
|
10
|
-
disable(): void;
|
|
10
|
+
$disable(): void;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* Interface which describes a value
|
|
@@ -38,10 +38,10 @@ export declare class IValue<T> extends Switchable {
|
|
|
38
38
|
* Add a new handler to value change
|
|
39
39
|
* @param handler {function(value : *)} the handler to add
|
|
40
40
|
*/
|
|
41
|
-
on(handler: (value: T) => void): void;
|
|
41
|
+
$on(handler: (value: T) => void): void;
|
|
42
42
|
/**
|
|
43
43
|
* Removes a handler of value change
|
|
44
44
|
* @param handler {function(value : *)} the handler to remove
|
|
45
45
|
*/
|
|
46
|
-
off(handler: (value: T) => void): void;
|
|
46
|
+
$off(handler: (value: T) => void): void;
|
|
47
47
|
}
|
package/types/node/node.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ export declare class FragmentPrivate extends ReactivePrivate {
|
|
|
39
39
|
/**
|
|
40
40
|
* Unlinks all bindings
|
|
41
41
|
*/
|
|
42
|
-
destroy(): void;
|
|
42
|
+
$destroy(): void;
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
45
|
* This class is symbolic
|
|
@@ -150,7 +150,7 @@ export declare class Fragment<T extends Options = Options> extends Reactive {
|
|
|
150
150
|
insertBefore(node: Fragment): void;
|
|
151
151
|
insertAfter(node: Fragment): void;
|
|
152
152
|
remove(): void;
|
|
153
|
-
destroy(): void;
|
|
153
|
+
$destroy(): void;
|
|
154
154
|
}
|
|
155
155
|
/**
|
|
156
156
|
* The private part of a text node
|
|
@@ -170,7 +170,7 @@ export declare class TextNodePrivate extends FragmentPrivate {
|
|
|
170
170
|
/**
|
|
171
171
|
* Clear node data
|
|
172
172
|
*/
|
|
173
|
-
destroy(): void;
|
|
173
|
+
$destroy(): void;
|
|
174
174
|
}
|
|
175
175
|
/**
|
|
176
176
|
* Represents a text node
|
|
@@ -182,7 +182,7 @@ export declare class TextNode extends Fragment {
|
|
|
182
182
|
constructor($?: TextNodePrivate);
|
|
183
183
|
preinit(app: AppNode, parent: Fragment, text?: IValue<string> | string): void;
|
|
184
184
|
protected findFirstChild(): Node;
|
|
185
|
-
destroy(): void;
|
|
185
|
+
$destroy(): void;
|
|
186
186
|
}
|
|
187
187
|
/**
|
|
188
188
|
* The private part of a base node
|
|
@@ -201,7 +201,7 @@ export declare class INodePrivate extends FragmentPrivate {
|
|
|
201
201
|
*/
|
|
202
202
|
node: Element;
|
|
203
203
|
constructor();
|
|
204
|
-
destroy(): void;
|
|
204
|
+
$destroy(): void;
|
|
205
205
|
}
|
|
206
206
|
/**
|
|
207
207
|
* Vasille node which can manipulate an element node
|
|
@@ -308,7 +308,7 @@ export declare class Tag<K extends keyof AcceptedTagsMap> extends INode<TagOptio
|
|
|
308
308
|
/**
|
|
309
309
|
* Runs GC
|
|
310
310
|
*/
|
|
311
|
-
destroy(): void;
|
|
311
|
+
$destroy(): void;
|
|
312
312
|
}
|
|
313
313
|
/**
|
|
314
314
|
* Represents a vasille extension node
|
|
@@ -317,7 +317,7 @@ export declare class Tag<K extends keyof AcceptedTagsMap> extends INode<TagOptio
|
|
|
317
317
|
*/
|
|
318
318
|
export declare class Extension<T extends TagOptions<any> = TagOptions<any>> extends INode<T> {
|
|
319
319
|
preinit(app: AppNode, parent: Fragment): void;
|
|
320
|
-
destroy(): void;
|
|
320
|
+
$destroy(): void;
|
|
321
321
|
}
|
|
322
322
|
/**
|
|
323
323
|
* Node which cas has just a child
|
|
@@ -357,7 +357,7 @@ export declare class SwitchedNodePrivate extends FragmentPrivate {
|
|
|
357
357
|
/**
|
|
358
358
|
* Runs GC
|
|
359
359
|
*/
|
|
360
|
-
destroy(): void;
|
|
360
|
+
$destroy(): void;
|
|
361
361
|
}
|
|
362
362
|
/**
|
|
363
363
|
* Defines a node witch can switch its children conditionally
|
|
@@ -378,7 +378,7 @@ export declare class SwitchedNode extends Fragment {
|
|
|
378
378
|
*/
|
|
379
379
|
createChild(cb: (node: Fragment) => void): void;
|
|
380
380
|
ready(): void;
|
|
381
|
-
destroy(): void;
|
|
381
|
+
$destroy(): void;
|
|
382
382
|
}
|
|
383
383
|
/**
|
|
384
384
|
* The private part of a text node
|
|
@@ -396,7 +396,7 @@ export declare class DebugPrivate extends FragmentPrivate {
|
|
|
396
396
|
/**
|
|
397
397
|
* Clear node data
|
|
398
398
|
*/
|
|
399
|
-
destroy(): void;
|
|
399
|
+
$destroy(): void;
|
|
400
400
|
}
|
|
401
401
|
/**
|
|
402
402
|
* Represents a debug node
|
|
@@ -414,5 +414,5 @@ export declare class DebugNode extends Fragment {
|
|
|
414
414
|
/**
|
|
415
415
|
* Runs garbage collector
|
|
416
416
|
*/
|
|
417
|
-
destroy(): void;
|
|
417
|
+
$destroy(): void;
|
|
418
418
|
}
|
package/types/v/index.d.ts
CHANGED
|
@@ -7,6 +7,10 @@ import { AppOptions } from "../node/app";
|
|
|
7
7
|
import { Reference } from "../value/reference";
|
|
8
8
|
import { merge } from "../functional/merge";
|
|
9
9
|
export { debug, arrayModel, mapModel, objectModel, setModel, expr, forward, mirror, point, ref, setValue, valueOf, watch, Options, TagOptions, AppOptions };
|
|
10
|
+
export declare type VApp<In extends AppOptions<any> = AppOptions<'div'>> = (node: Element, opts: In) => In['return'];
|
|
11
|
+
export declare type VComponent<In extends TagOptions<any>> = (opts: In, callback?: In['slot']) => In['return'];
|
|
12
|
+
export declare type VFragment<In extends Options = Options> = (opts: In, callback?: In['slot']) => In['return'];
|
|
13
|
+
export declare type VExtension<In extends TagOptions<any>> = (opts: In, callback?: In['slot']) => In['return'];
|
|
10
14
|
export declare const v: {
|
|
11
15
|
merge: typeof merge;
|
|
12
16
|
destructor(): any;
|