vasille 2.2.0 → 2.3.0
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 +34 -28
- package/cdn/es2015.js +548 -548
- package/cdn/es5.js +616 -608
- package/flow-typed/vasille.js +55 -50
- 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 +21 -15
- package/lib/core/destroyable.js +2 -2
- package/lib/core/ivalue.js +4 -4
- package/lib/functional/reactivity.js +1 -1
- package/lib/index.js +2 -3
- package/lib/models/array-model.js +6 -9
- package/lib/models/object-model.js +3 -17
- package/lib/node/app.js +3 -3
- package/lib/node/node.js +53 -42
- 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/object-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 +8 -6
- package/types/core/destroyable.d.ts +2 -2
- package/types/core/ivalue.d.ts +4 -4
- package/types/functional/options.d.ts +2 -2
- package/types/index.d.ts +3 -4
- package/types/models/array-model.d.ts +1 -1
- package/types/models/object-model.d.ts +1 -1
- package/types/node/node.d.ts +18 -15
- package/types/node/watch.d.ts +2 -2
- 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 +3 -3
package/cdn/es5.js
CHANGED
|
@@ -13,7 +13,7 @@ var __spreadArray = function (to, from, pack) {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
var __assign = function(o1, o2) {
|
|
16
|
-
for (
|
|
16
|
+
for (var i in o2) {
|
|
17
17
|
o1[i] = o2[i];
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -182,7 +182,7 @@ window.Reflect = window.Reflect || {
|
|
|
182
182
|
return false;
|
|
183
183
|
},
|
|
184
184
|
ownKeys: function (obj) {
|
|
185
|
-
|
|
185
|
+
var ret = [];
|
|
186
186
|
|
|
187
187
|
for (var i in obj) {
|
|
188
188
|
if (obj.hasOwnProperty(i)) {
|
|
@@ -197,18 +197,6 @@ window.Reflect = window.Reflect || {
|
|
|
197
197
|
window.Proxy = window.Proxy || function (obj) {
|
|
198
198
|
return obj;
|
|
199
199
|
};
|
|
200
|
-
// ./lib-es5/v/index.js
|
|
201
|
-
|
|
202
|
-
var v = __assign(__assign({ ref: function (value) {
|
|
203
|
-
return current.ref(value);
|
|
204
|
-
}, expr: expr, of: valueOf, sv: setValue, alwaysFalse: new Reference(false), app: app, component: component, fragment: fragment, extension: extension, text: text, tag: tag, create: create }, vx), { merge: merge, destructor: function () {
|
|
205
|
-
return current.destroy.bind(current);
|
|
206
|
-
}, runOnDestroy: function (callback) {
|
|
207
|
-
current.runOnDestroy(callback);
|
|
208
|
-
} });
|
|
209
|
-
|
|
210
|
-
window.v = v;
|
|
211
|
-
|
|
212
200
|
// ./lib-es5/models/model.js
|
|
213
201
|
|
|
214
202
|
|
|
@@ -412,6 +400,13 @@ var ObjectModel = /** @class */ (function (_super) {
|
|
|
412
400
|
this.listener.emitAdded(key, this.container[key]);
|
|
413
401
|
return this;
|
|
414
402
|
};
|
|
403
|
+
Object.defineProperty(ObjectModel.prototype, "values", {
|
|
404
|
+
get: function () {
|
|
405
|
+
return this.container;
|
|
406
|
+
},
|
|
407
|
+
enumerable: false,
|
|
408
|
+
configurable: true
|
|
409
|
+
});
|
|
415
410
|
/**
|
|
416
411
|
* Deletes an object property
|
|
417
412
|
* @param key {string} property name
|
|
@@ -422,23 +417,6 @@ var ObjectModel = /** @class */ (function (_super) {
|
|
|
422
417
|
delete this.container[key];
|
|
423
418
|
}
|
|
424
419
|
};
|
|
425
|
-
ObjectModel.prototype.proxy = function () {
|
|
426
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
427
|
-
var ts = this;
|
|
428
|
-
return new Proxy(this.container, {
|
|
429
|
-
get: function (target, p) {
|
|
430
|
-
return ts.get(p);
|
|
431
|
-
},
|
|
432
|
-
set: function (target, p, value) {
|
|
433
|
-
ts.set(p, value);
|
|
434
|
-
return true;
|
|
435
|
-
},
|
|
436
|
-
deleteProperty: function (target, p) {
|
|
437
|
-
ts.delete(p);
|
|
438
|
-
return true;
|
|
439
|
-
}
|
|
440
|
-
});
|
|
441
|
-
};
|
|
442
420
|
ObjectModel.prototype.enableReactivity = function () {
|
|
443
421
|
this.listener.enableReactivity();
|
|
444
422
|
};
|
|
@@ -622,15 +600,6 @@ var ArrayModel = /** @class */ (function (_super) {
|
|
|
622
600
|
}
|
|
623
601
|
return _this;
|
|
624
602
|
}
|
|
625
|
-
// proxy
|
|
626
|
-
ArrayModel.prototype.proxy = function () {
|
|
627
|
-
return new Proxy(this, {
|
|
628
|
-
set: function (target, p, value) {
|
|
629
|
-
target.splice(parseInt(p), 1, value);
|
|
630
|
-
return true;
|
|
631
|
-
}
|
|
632
|
-
});
|
|
633
|
-
};
|
|
634
603
|
Object.defineProperty(ArrayModel.prototype, "last", {
|
|
635
604
|
/* Array members */
|
|
636
605
|
/**
|
|
@@ -829,6 +798,12 @@ var ArrayModel = /** @class */ (function (_super) {
|
|
|
829
798
|
this.removeAt(this.indexOf(v));
|
|
830
799
|
return this;
|
|
831
800
|
};
|
|
801
|
+
ArrayModel.prototype.replace = function (at, with_) {
|
|
802
|
+
this.listener.emitAdded(this[at], with_);
|
|
803
|
+
this.listener.emitRemoved(this[at], this[at]);
|
|
804
|
+
this[at] = with_;
|
|
805
|
+
return this;
|
|
806
|
+
};
|
|
832
807
|
ArrayModel.prototype.enableReactivity = function () {
|
|
833
808
|
this.listener.enableReactivity();
|
|
834
809
|
};
|
|
@@ -841,467 +816,186 @@ var ArrayModel = /** @class */ (function (_super) {
|
|
|
841
816
|
|
|
842
817
|
window.ArrayModel = ArrayModel;
|
|
843
818
|
|
|
844
|
-
// ./lib-es5/
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
function
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
out_1.$.push(item);
|
|
858
|
-
}
|
|
859
|
-
else if (typeof item === 'string') {
|
|
860
|
-
out_1[item] = true;
|
|
861
|
-
}
|
|
862
|
-
else if (typeof item === 'object') {
|
|
863
|
-
Object.assign(out_1, item);
|
|
864
|
-
}
|
|
865
|
-
});
|
|
866
|
-
obj.class = out_1;
|
|
867
|
-
}
|
|
819
|
+
// ./lib-es5/core/signal.js
|
|
820
|
+
/**
|
|
821
|
+
* Signal is an event generator
|
|
822
|
+
* @class Signal
|
|
823
|
+
*/
|
|
824
|
+
var Signal = /** @class */ (function () {
|
|
825
|
+
function Signal() {
|
|
826
|
+
/**
|
|
827
|
+
* Handler of event
|
|
828
|
+
* @type {Set}
|
|
829
|
+
* @private
|
|
830
|
+
*/
|
|
831
|
+
this.handlers = new Set;
|
|
868
832
|
}
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
833
|
+
/**
|
|
834
|
+
* Emit event
|
|
835
|
+
* @param a1 {*} argument
|
|
836
|
+
* @param a2 {*} argument
|
|
837
|
+
* @param a3 {*} argument
|
|
838
|
+
* @param a4 {*} argument
|
|
839
|
+
* @param a5 {*} argument
|
|
840
|
+
* @param a6 {*} argument
|
|
841
|
+
* @param a7 {*} argument
|
|
842
|
+
* @param a8 {*} argument
|
|
843
|
+
* @param a9 {*} argument
|
|
844
|
+
*/
|
|
845
|
+
Signal.prototype.emit = function (a1, a2, a3, a4, a5, a6, a7, a8, a9) {
|
|
846
|
+
this.handlers.forEach(function (handler) {
|
|
847
|
+
try {
|
|
848
|
+
handler(a1, a2, a3, a4, a5, a6, a7, a8, a9);
|
|
875
849
|
}
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
refactorClass(target);
|
|
879
|
-
}
|
|
880
|
-
if (prop === '$' && Array.isArray(main[prop]) && Array.isArray(target[prop])) {
|
|
881
|
-
(_a = main.$).push.apply(_a, target.$);
|
|
882
|
-
}
|
|
883
|
-
else {
|
|
884
|
-
merge(main[prop], target[prop]);
|
|
885
|
-
}
|
|
850
|
+
catch (e) {
|
|
851
|
+
console.error("Vasille.js: Handler throw exception: ", e);
|
|
886
852
|
}
|
|
887
853
|
});
|
|
888
|
-
}
|
|
889
|
-
|
|
854
|
+
};
|
|
855
|
+
/**
|
|
856
|
+
* Subscribe to event
|
|
857
|
+
* @param func {function} handler
|
|
858
|
+
*/
|
|
859
|
+
Signal.prototype.subscribe = function (func) {
|
|
860
|
+
this.handlers.add(func);
|
|
861
|
+
};
|
|
862
|
+
/**
|
|
863
|
+
* Unsubscribe from event
|
|
864
|
+
* @param func {function} handler
|
|
865
|
+
*/
|
|
866
|
+
Signal.prototype.unsubscribe = function (func) {
|
|
867
|
+
this.handlers.delete(func);
|
|
868
|
+
};
|
|
869
|
+
return Signal;
|
|
870
|
+
}());
|
|
890
871
|
|
|
891
|
-
window.merge = merge;
|
|
892
872
|
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
873
|
+
window.Signal = Signal;
|
|
874
|
+
|
|
875
|
+
// ./lib-es5/core/slot.js
|
|
876
|
+
/**
|
|
877
|
+
* Component slot
|
|
878
|
+
* @class Slot
|
|
879
|
+
*/
|
|
880
|
+
var Slot = /** @class */ (function () {
|
|
881
|
+
function Slot() {
|
|
882
|
+
}
|
|
883
|
+
/**
|
|
884
|
+
* Sets the runner
|
|
885
|
+
* @param func {function} the function to run
|
|
886
|
+
*/
|
|
887
|
+
Slot.prototype.insert = function (func) {
|
|
888
|
+
this.runner = func;
|
|
897
889
|
};
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
890
|
+
/**
|
|
891
|
+
* @param a0 {Fragment} node to paste content
|
|
892
|
+
* @param a1 {*} 1st argument
|
|
893
|
+
* @param a2 {*} 2nd argument
|
|
894
|
+
* @param a3 {*} 3rd argument
|
|
895
|
+
* @param a4 {*} 4th argument
|
|
896
|
+
* @param a5 {*} 5th argument
|
|
897
|
+
* @param a6 {*} 6th argument
|
|
898
|
+
* @param a7 {*} 7th argument
|
|
899
|
+
* @param a8 {*} 8th argument
|
|
900
|
+
* @param a9 {*} 9th argument
|
|
901
|
+
*/
|
|
902
|
+
Slot.prototype.release = function (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) {
|
|
903
|
+
if (this.runner) {
|
|
904
|
+
this.runner(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
|
|
905
|
+
}
|
|
911
906
|
};
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
907
|
+
/**
|
|
908
|
+
* Predefine a handler for a slot
|
|
909
|
+
* @param func {function(node : Fragment)} Function to run if no handler specified
|
|
910
|
+
* @param a0 {Fragment} node to paste content
|
|
911
|
+
* @param a1 {*} 1st argument
|
|
912
|
+
* @param a2 {*} 2nd argument
|
|
913
|
+
* @param a3 {*} 3rd argument
|
|
914
|
+
* @param a4 {*} 4th argument
|
|
915
|
+
* @param a5 {*} 5th argument
|
|
916
|
+
* @param a6 {*} 6th argument
|
|
917
|
+
* @param a7 {*} 7th argument
|
|
918
|
+
* @param a8 {*} 8th argument
|
|
919
|
+
* @param a9 {*} 9th argument
|
|
920
|
+
*/
|
|
921
|
+
Slot.prototype.predefine = function (func, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) {
|
|
922
|
+
(this.runner || func)(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
|
|
922
923
|
};
|
|
924
|
+
return Slot;
|
|
925
|
+
}());
|
|
926
|
+
|
|
927
|
+
|
|
928
|
+
window.Slot = Slot;
|
|
929
|
+
|
|
930
|
+
// ./lib-es5/core/errors.js
|
|
931
|
+
var reportIt = "Report it here: https://gitlab.com/vasille-js/vasille-js/-/issues";
|
|
932
|
+
function notOverwritten() {
|
|
933
|
+
console.error("Vasille-SFP: Internal error", "Must be overwritten", reportIt);
|
|
934
|
+
return "not-overwritten";
|
|
923
935
|
}
|
|
924
|
-
function
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
if (!(current instanceof Fragment))
|
|
928
|
-
throw userError('missing parent node', 'out-of-context');
|
|
929
|
-
if (callback)
|
|
930
|
-
opts.slot = callback;
|
|
931
|
-
current.create(ext);
|
|
932
|
-
return ext.runFunctional(renderer, opts);
|
|
933
|
-
};
|
|
936
|
+
function internalError(msg) {
|
|
937
|
+
console.error("Vasille-SFP: Internal error", msg, reportIt);
|
|
938
|
+
return "internal-error";
|
|
934
939
|
}
|
|
935
|
-
function
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
return {
|
|
939
|
-
node: current.tag(name, opts, function (node) {
|
|
940
|
-
callback && node.runFunctional(callback);
|
|
941
|
-
})
|
|
942
|
-
};
|
|
940
|
+
function userError(msg, err) {
|
|
941
|
+
console.error("Vasille-SFP: User error", msg);
|
|
942
|
+
return err;
|
|
943
943
|
}
|
|
944
|
-
function
|
|
945
|
-
|
|
946
|
-
throw userError('missing current node', 'out-of-context');
|
|
947
|
-
current.create(node, function (node) {
|
|
948
|
-
var args = [];
|
|
949
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
950
|
-
args[_i - 1] = arguments[_i];
|
|
951
|
-
}
|
|
952
|
-
callback && node.runFunctional.apply(node, __spreadArray([callback], args, false));
|
|
953
|
-
});
|
|
954
|
-
return node;
|
|
955
|
-
}
|
|
956
|
-
var vx = {
|
|
957
|
-
if: function (condition, callback) {
|
|
958
|
-
if (current instanceof Fragment) {
|
|
959
|
-
current.if(condition, function (node) { return node.runFunctional(callback); });
|
|
960
|
-
}
|
|
961
|
-
else {
|
|
962
|
-
throw userError("wrong use of `v.if` function", "logic-error");
|
|
963
|
-
}
|
|
964
|
-
},
|
|
965
|
-
else: function (callback) {
|
|
966
|
-
if (current instanceof Fragment) {
|
|
967
|
-
current.else(function (node) { return node.runFunctional(callback); });
|
|
968
|
-
}
|
|
969
|
-
else {
|
|
970
|
-
throw userError("wrong use of `v.else` function", "logic-error");
|
|
971
|
-
}
|
|
972
|
-
},
|
|
973
|
-
elif: function (condition, callback) {
|
|
974
|
-
if (current instanceof Fragment) {
|
|
975
|
-
current.elif(condition, function (node) { return node.runFunctional(callback); });
|
|
976
|
-
}
|
|
977
|
-
else {
|
|
978
|
-
throw userError("wrong use of `v.elif` function", "logic-error");
|
|
979
|
-
}
|
|
980
|
-
},
|
|
981
|
-
for: function (model, callback) {
|
|
982
|
-
if (model instanceof ArrayModel) {
|
|
983
|
-
// for arrays T & K are the same type
|
|
984
|
-
create(new ArrayView({ model: model }), callback);
|
|
985
|
-
}
|
|
986
|
-
else if (model instanceof MapModel) {
|
|
987
|
-
create(new MapView({ model: model }), callback);
|
|
988
|
-
}
|
|
989
|
-
else if (model instanceof SetModel) {
|
|
990
|
-
// for sets T & K are the same type
|
|
991
|
-
create(new SetView({ model: model }), callback);
|
|
992
|
-
}
|
|
993
|
-
else if (model instanceof ObjectModel) {
|
|
994
|
-
// for objects K is always string
|
|
995
|
-
create(new ObjectView({ model: model }), callback);
|
|
996
|
-
}
|
|
997
|
-
else {
|
|
998
|
-
throw userError("wrong use of `v.for` function", 'wrong-model');
|
|
999
|
-
}
|
|
1000
|
-
},
|
|
1001
|
-
watch: function (model, callback) {
|
|
1002
|
-
var opts = { model: model };
|
|
1003
|
-
create(new Watch(opts), callback);
|
|
1004
|
-
},
|
|
1005
|
-
nextTick: function (callback) {
|
|
1006
|
-
var node = current;
|
|
1007
|
-
window.setTimeout(function () {
|
|
1008
|
-
node.runFunctional(callback);
|
|
1009
|
-
}, 0);
|
|
1010
|
-
}
|
|
1011
|
-
};
|
|
1012
|
-
|
|
1013
|
-
window.app = app;
|
|
1014
|
-
window.component = component;
|
|
1015
|
-
window.fragment = fragment;
|
|
1016
|
-
window.extension = extension;
|
|
1017
|
-
window.tag = tag;
|
|
1018
|
-
window.create = create;
|
|
1019
|
-
window.vx = vx;
|
|
1020
|
-
|
|
1021
|
-
// ./lib-es5/functional/models.js
|
|
1022
|
-
function arrayModel(arr) {
|
|
1023
|
-
if (arr === void 0) { arr = []; }
|
|
1024
|
-
if (!current)
|
|
1025
|
-
throw userError('missing parent node', 'out-of-context');
|
|
1026
|
-
return current.register(new ArrayModel(arr)).proxy();
|
|
1027
|
-
}
|
|
1028
|
-
function mapModel(map) {
|
|
1029
|
-
if (map === void 0) { map = []; }
|
|
1030
|
-
if (!current)
|
|
1031
|
-
throw userError('missing parent node', 'out-of-context');
|
|
1032
|
-
return current.register(new MapModel(map));
|
|
1033
|
-
}
|
|
1034
|
-
function setModel(arr) {
|
|
1035
|
-
if (arr === void 0) { arr = []; }
|
|
1036
|
-
if (!current)
|
|
1037
|
-
throw userError('missing parent node', 'out-of-context');
|
|
1038
|
-
return current.register(new SetModel(arr));
|
|
1039
|
-
}
|
|
1040
|
-
function objectModel(obj) {
|
|
1041
|
-
if (obj === void 0) { obj = {}; }
|
|
1042
|
-
if (!current)
|
|
1043
|
-
throw userError('missing parent node', 'out-of-context');
|
|
1044
|
-
return current.register(new ObjectModel(obj));
|
|
1045
|
-
}
|
|
1046
|
-
|
|
1047
|
-
window.arrayModel = arrayModel;
|
|
1048
|
-
window.mapModel = mapModel;
|
|
1049
|
-
window.setModel = setModel;
|
|
1050
|
-
window.objectModel = objectModel;
|
|
1051
|
-
|
|
1052
|
-
// ./lib-es5/functional/options.js
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
// ./lib-es5/functional/reactivity.js
|
|
1057
|
-
function ref(value) {
|
|
1058
|
-
var ref = current.ref(value);
|
|
1059
|
-
return [ref, function (value) { return ref.$ = value; }];
|
|
1060
|
-
}
|
|
1061
|
-
function mirror(value) {
|
|
1062
|
-
return current.mirror(value);
|
|
1063
|
-
}
|
|
1064
|
-
function forward(value) {
|
|
1065
|
-
return current.forward(value);
|
|
1066
|
-
}
|
|
1067
|
-
function point(value) {
|
|
1068
|
-
return current.point(value);
|
|
1069
|
-
}
|
|
1070
|
-
function expr(func) {
|
|
1071
|
-
var values = [];
|
|
1072
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1073
|
-
values[_i - 1] = arguments[_i];
|
|
1074
|
-
}
|
|
1075
|
-
return current.expr.apply(current, __spreadArray([func], values, false));
|
|
1076
|
-
}
|
|
1077
|
-
function watch(func) {
|
|
1078
|
-
var values = [];
|
|
1079
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1080
|
-
values[_i - 1] = arguments[_i];
|
|
1081
|
-
}
|
|
1082
|
-
current.watch.apply(current, __spreadArray([func], values, false));
|
|
1083
|
-
}
|
|
1084
|
-
function valueOf(value) {
|
|
1085
|
-
return value.$;
|
|
1086
|
-
}
|
|
1087
|
-
function setValue(ref, value) {
|
|
1088
|
-
if (ref instanceof Pointer && value instanceof IValue) {
|
|
1089
|
-
ref.point(value);
|
|
1090
|
-
}
|
|
1091
|
-
else {
|
|
1092
|
-
ref.$ = value instanceof IValue ? value.$ : value;
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1095
|
-
|
|
1096
|
-
window.ref = ref;
|
|
1097
|
-
window.mirror = mirror;
|
|
1098
|
-
window.forward = forward;
|
|
1099
|
-
window.point = point;
|
|
1100
|
-
window.expr = expr;
|
|
1101
|
-
window.watch = watch;
|
|
1102
|
-
window.valueOf = valueOf;
|
|
1103
|
-
window.setValue = setValue;
|
|
1104
|
-
|
|
1105
|
-
// ./lib-es5/functional/components.js
|
|
1106
|
-
function text(text) {
|
|
1107
|
-
if (!(current instanceof Fragment))
|
|
1108
|
-
throw userError('missing parent node', 'out-of-context');
|
|
1109
|
-
;
|
|
1110
|
-
current.text(text);
|
|
1111
|
-
}
|
|
1112
|
-
function debug(text) {
|
|
1113
|
-
if (!(current instanceof Fragment))
|
|
1114
|
-
throw userError('missing parent node', 'out-of-context');
|
|
1115
|
-
current.debug(text);
|
|
1116
|
-
}
|
|
1117
|
-
function predefine(slot, predefined) {
|
|
1118
|
-
return slot || predefined;
|
|
944
|
+
function wrongBinding(msg) {
|
|
945
|
+
return userError(msg, "wrong-binding");
|
|
1119
946
|
}
|
|
1120
947
|
|
|
1121
|
-
window.
|
|
1122
|
-
window.
|
|
1123
|
-
window.
|
|
948
|
+
window.notOverwritten = notOverwritten;
|
|
949
|
+
window.internalError = internalError;
|
|
950
|
+
window.userError = userError;
|
|
951
|
+
window.wrongBinding = wrongBinding;
|
|
1124
952
|
|
|
1125
|
-
// ./lib-es5/core/
|
|
953
|
+
// ./lib-es5/core/executor.js
|
|
1126
954
|
/**
|
|
1127
|
-
*
|
|
1128
|
-
* @class
|
|
955
|
+
* Represents an executor unit interface
|
|
956
|
+
* @class Executor
|
|
1129
957
|
*/
|
|
1130
|
-
var
|
|
1131
|
-
function
|
|
1132
|
-
/**
|
|
1133
|
-
* Handler of event
|
|
1134
|
-
* @type {Set}
|
|
1135
|
-
* @private
|
|
1136
|
-
*/
|
|
1137
|
-
this.handlers = new Set;
|
|
958
|
+
var Executor = /** @class */ (function () {
|
|
959
|
+
function Executor() {
|
|
1138
960
|
}
|
|
1139
961
|
/**
|
|
1140
|
-
*
|
|
1141
|
-
* @param
|
|
1142
|
-
* @param
|
|
1143
|
-
* @param a3 {*} argument
|
|
1144
|
-
* @param a4 {*} argument
|
|
1145
|
-
* @param a5 {*} argument
|
|
1146
|
-
* @param a6 {*} argument
|
|
1147
|
-
* @param a7 {*} argument
|
|
1148
|
-
* @param a8 {*} argument
|
|
1149
|
-
* @param a9 {*} argument
|
|
962
|
+
* Adds a CSS class
|
|
963
|
+
* @param el {Element} element to manipulate
|
|
964
|
+
* @param cl {string} class to be added
|
|
1150
965
|
*/
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
try {
|
|
1154
|
-
handler(a1, a2, a3, a4, a5, a6, a7, a8, a9);
|
|
1155
|
-
}
|
|
1156
|
-
catch (e) {
|
|
1157
|
-
console.error("Vasille.js: Handler throw exception: ", e);
|
|
1158
|
-
}
|
|
1159
|
-
});
|
|
966
|
+
Executor.prototype.addClass = function (el, cl) {
|
|
967
|
+
throw notOverwritten();
|
|
1160
968
|
};
|
|
1161
969
|
/**
|
|
1162
|
-
*
|
|
1163
|
-
* @param
|
|
970
|
+
* Removes a CSS class
|
|
971
|
+
* @param el {Element} element to manipulate
|
|
972
|
+
* @param cl {string} class to be removed
|
|
1164
973
|
*/
|
|
1165
|
-
|
|
1166
|
-
|
|
974
|
+
Executor.prototype.removeClass = function (el, cl) {
|
|
975
|
+
throw notOverwritten();
|
|
1167
976
|
};
|
|
1168
977
|
/**
|
|
1169
|
-
*
|
|
1170
|
-
* @param
|
|
978
|
+
* Sets a tag attribute
|
|
979
|
+
* @param el {Element} element to manipulate
|
|
980
|
+
* @param name {string} name of attribute
|
|
981
|
+
* @param value {string} value of attribute
|
|
1171
982
|
*/
|
|
1172
|
-
|
|
1173
|
-
|
|
983
|
+
Executor.prototype.setAttribute = function (el, name, value) {
|
|
984
|
+
throw notOverwritten();
|
|
1174
985
|
};
|
|
1175
|
-
return Signal;
|
|
1176
|
-
}());
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
window.Signal = Signal;
|
|
1180
|
-
|
|
1181
|
-
// ./lib-es5/core/slot.js
|
|
1182
|
-
/**
|
|
1183
|
-
* Component slot
|
|
1184
|
-
* @class Slot
|
|
1185
|
-
*/
|
|
1186
|
-
var Slot = /** @class */ (function () {
|
|
1187
|
-
function Slot() {
|
|
1188
|
-
}
|
|
1189
986
|
/**
|
|
1190
|
-
*
|
|
1191
|
-
* @param
|
|
987
|
+
* Removes a tag attribute
|
|
988
|
+
* @param el {Element} element to manipulate
|
|
989
|
+
* @param name {string} name of attribute
|
|
1192
990
|
*/
|
|
1193
|
-
|
|
1194
|
-
|
|
991
|
+
Executor.prototype.removeAttribute = function (el, name) {
|
|
992
|
+
throw notOverwritten();
|
|
1195
993
|
};
|
|
1196
994
|
/**
|
|
1197
|
-
*
|
|
1198
|
-
* @param
|
|
1199
|
-
* @param
|
|
1200
|
-
* @param
|
|
1201
|
-
* @param a4 {*} 4th argument
|
|
1202
|
-
* @param a5 {*} 5th argument
|
|
1203
|
-
* @param a6 {*} 6th argument
|
|
1204
|
-
* @param a7 {*} 7th argument
|
|
1205
|
-
* @param a8 {*} 8th argument
|
|
1206
|
-
* @param a9 {*} 9th argument
|
|
1207
|
-
*/
|
|
1208
|
-
Slot.prototype.release = function (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) {
|
|
1209
|
-
if (this.runner) {
|
|
1210
|
-
this.runner(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
|
|
1211
|
-
}
|
|
1212
|
-
};
|
|
1213
|
-
/**
|
|
1214
|
-
* Predefine a handler for a slot
|
|
1215
|
-
* @param func {function(node : Fragment)} Function to run if no handler specified
|
|
1216
|
-
* @param a0 {Fragment} node to paste content
|
|
1217
|
-
* @param a1 {*} 1st argument
|
|
1218
|
-
* @param a2 {*} 2nd argument
|
|
1219
|
-
* @param a3 {*} 3rd argument
|
|
1220
|
-
* @param a4 {*} 4th argument
|
|
1221
|
-
* @param a5 {*} 5th argument
|
|
1222
|
-
* @param a6 {*} 6th argument
|
|
1223
|
-
* @param a7 {*} 7th argument
|
|
1224
|
-
* @param a8 {*} 8th argument
|
|
1225
|
-
* @param a9 {*} 9th argument
|
|
1226
|
-
*/
|
|
1227
|
-
Slot.prototype.predefine = function (func, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) {
|
|
1228
|
-
(this.runner || func)(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
|
|
1229
|
-
};
|
|
1230
|
-
return Slot;
|
|
1231
|
-
}());
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
window.Slot = Slot;
|
|
1235
|
-
|
|
1236
|
-
// ./lib-es5/core/errors.js
|
|
1237
|
-
var reportIt = "Report it here: https://gitlab.com/vasille-js/vasille-js/-/issues";
|
|
1238
|
-
function notOverwritten() {
|
|
1239
|
-
console.error("Vasille-SFP: Internal error", "Must be overwritten", reportIt);
|
|
1240
|
-
return "not-overwritten";
|
|
1241
|
-
}
|
|
1242
|
-
function internalError(msg) {
|
|
1243
|
-
console.error("Vasille-SFP: Internal error", msg, reportIt);
|
|
1244
|
-
return "internal-error";
|
|
1245
|
-
}
|
|
1246
|
-
function userError(msg, err) {
|
|
1247
|
-
console.error("Vasille-SFP: User error", msg);
|
|
1248
|
-
return err;
|
|
1249
|
-
}
|
|
1250
|
-
function wrongBinding(msg) {
|
|
1251
|
-
return userError(msg, "wrong-binding");
|
|
1252
|
-
}
|
|
1253
|
-
|
|
1254
|
-
window.notOverwritten = notOverwritten;
|
|
1255
|
-
window.internalError = internalError;
|
|
1256
|
-
window.userError = userError;
|
|
1257
|
-
window.wrongBinding = wrongBinding;
|
|
1258
|
-
|
|
1259
|
-
// ./lib-es5/core/executor.js
|
|
1260
|
-
/**
|
|
1261
|
-
* Represents an executor unit interface
|
|
1262
|
-
* @class Executor
|
|
1263
|
-
*/
|
|
1264
|
-
var Executor = /** @class */ (function () {
|
|
1265
|
-
function Executor() {
|
|
1266
|
-
}
|
|
1267
|
-
/**
|
|
1268
|
-
* Adds a CSS class
|
|
1269
|
-
* @param el {Element} element to manipulate
|
|
1270
|
-
* @param cl {string} class to be added
|
|
1271
|
-
*/
|
|
1272
|
-
Executor.prototype.addClass = function (el, cl) {
|
|
1273
|
-
throw notOverwritten();
|
|
1274
|
-
};
|
|
1275
|
-
/**
|
|
1276
|
-
* Removes a CSS class
|
|
1277
|
-
* @param el {Element} element to manipulate
|
|
1278
|
-
* @param cl {string} class to be removed
|
|
1279
|
-
*/
|
|
1280
|
-
Executor.prototype.removeClass = function (el, cl) {
|
|
1281
|
-
throw notOverwritten();
|
|
1282
|
-
};
|
|
1283
|
-
/**
|
|
1284
|
-
* Sets a tag attribute
|
|
1285
|
-
* @param el {Element} element to manipulate
|
|
1286
|
-
* @param name {string} name of attribute
|
|
1287
|
-
* @param value {string} value of attribute
|
|
1288
|
-
*/
|
|
1289
|
-
Executor.prototype.setAttribute = function (el, name, value) {
|
|
1290
|
-
throw notOverwritten();
|
|
1291
|
-
};
|
|
1292
|
-
/**
|
|
1293
|
-
* Removes a tag attribute
|
|
1294
|
-
* @param el {Element} element to manipulate
|
|
1295
|
-
* @param name {string} name of attribute
|
|
1296
|
-
*/
|
|
1297
|
-
Executor.prototype.removeAttribute = function (el, name) {
|
|
1298
|
-
throw notOverwritten();
|
|
1299
|
-
};
|
|
1300
|
-
/**
|
|
1301
|
-
* Sets a style attribute
|
|
1302
|
-
* @param el {HTMLElement} element to manipulate
|
|
1303
|
-
* @param prop {string} property name
|
|
1304
|
-
* @param value {string} property value
|
|
995
|
+
* Sets a style attribute
|
|
996
|
+
* @param el {HTMLElement} element to manipulate
|
|
997
|
+
* @param prop {string} property name
|
|
998
|
+
* @param value {string} property value
|
|
1305
999
|
*/
|
|
1306
1000
|
Executor.prototype.setStyle = function (el, prop, value) {
|
|
1307
1001
|
throw notOverwritten();
|
|
@@ -1452,7 +1146,7 @@ var Destroyable = /** @class */ (function () {
|
|
|
1452
1146
|
* Make object fields non configurable
|
|
1453
1147
|
* @protected
|
|
1454
1148
|
*/
|
|
1455
|
-
Destroyable.prototype
|
|
1149
|
+
Destroyable.prototype.$seal = function () {
|
|
1456
1150
|
var _this = this;
|
|
1457
1151
|
var $ = this;
|
|
1458
1152
|
Object.keys($).forEach(function (i) {
|
|
@@ -1485,7 +1179,7 @@ var Destroyable = /** @class */ (function () {
|
|
|
1485
1179
|
/**
|
|
1486
1180
|
* Garbage collector method
|
|
1487
1181
|
*/
|
|
1488
|
-
Destroyable.prototype
|
|
1182
|
+
Destroyable.prototype.$destroy = function () {
|
|
1489
1183
|
// nothing here
|
|
1490
1184
|
};
|
|
1491
1185
|
return Destroyable;
|
|
@@ -1503,13 +1197,13 @@ var Switchable = /** @class */ (function (_super) {
|
|
|
1503
1197
|
/**
|
|
1504
1198
|
* Enable update handlers triggering
|
|
1505
1199
|
*/
|
|
1506
|
-
Switchable.prototype
|
|
1200
|
+
Switchable.prototype.$enable = function () {
|
|
1507
1201
|
throw notOverwritten();
|
|
1508
1202
|
};
|
|
1509
1203
|
/**
|
|
1510
1204
|
* disable update handlers triggering
|
|
1511
1205
|
*/
|
|
1512
|
-
Switchable.prototype
|
|
1206
|
+
Switchable.prototype.$disable = function () {
|
|
1513
1207
|
throw notOverwritten();
|
|
1514
1208
|
};
|
|
1515
1209
|
return Switchable;
|
|
@@ -1552,14 +1246,14 @@ var IValue = /** @class */ (function (_super) {
|
|
|
1552
1246
|
* Add a new handler to value change
|
|
1553
1247
|
* @param handler {function(value : *)} the handler to add
|
|
1554
1248
|
*/
|
|
1555
|
-
IValue.prototype
|
|
1249
|
+
IValue.prototype.$on = function (handler) {
|
|
1556
1250
|
throw notOverwritten();
|
|
1557
1251
|
};
|
|
1558
1252
|
/**
|
|
1559
1253
|
* Removes a handler of value change
|
|
1560
1254
|
* @param handler {function(value : *)} the handler to remove
|
|
1561
1255
|
*/
|
|
1562
|
-
IValue.prototype
|
|
1256
|
+
IValue.prototype.$off = function (handler) {
|
|
1563
1257
|
throw notOverwritten();
|
|
1564
1258
|
};
|
|
1565
1259
|
return IValue;
|
|
@@ -1626,12 +1320,12 @@ var Expression = /** @class */ (function (_super) {
|
|
|
1626
1320
|
_this.values = values;
|
|
1627
1321
|
_this.func = handler;
|
|
1628
1322
|
if (link) {
|
|
1629
|
-
_this
|
|
1323
|
+
_this.$enable();
|
|
1630
1324
|
}
|
|
1631
1325
|
else {
|
|
1632
1326
|
handler();
|
|
1633
1327
|
}
|
|
1634
|
-
_this
|
|
1328
|
+
_this.$seal();
|
|
1635
1329
|
return _this;
|
|
1636
1330
|
}
|
|
1637
1331
|
Object.defineProperty(Expression.prototype, "$", {
|
|
@@ -1644,18 +1338,18 @@ var Expression = /** @class */ (function (_super) {
|
|
|
1644
1338
|
enumerable: false,
|
|
1645
1339
|
configurable: true
|
|
1646
1340
|
});
|
|
1647
|
-
Expression.prototype
|
|
1648
|
-
this.sync
|
|
1341
|
+
Expression.prototype.$on = function (handler) {
|
|
1342
|
+
this.sync.$on(handler);
|
|
1649
1343
|
return this;
|
|
1650
1344
|
};
|
|
1651
|
-
Expression.prototype
|
|
1652
|
-
this.sync
|
|
1345
|
+
Expression.prototype.$off = function (handler) {
|
|
1346
|
+
this.sync.$off(handler);
|
|
1653
1347
|
return this;
|
|
1654
1348
|
};
|
|
1655
|
-
Expression.prototype
|
|
1349
|
+
Expression.prototype.$enable = function () {
|
|
1656
1350
|
if (!this.isEnabled) {
|
|
1657
1351
|
for (var i = 0; i < this.values.length; i++) {
|
|
1658
|
-
this.values[i]
|
|
1352
|
+
this.values[i].$on(this.linkedFunc[i]);
|
|
1659
1353
|
this.valuesCache[i] = this.values[i].$;
|
|
1660
1354
|
}
|
|
1661
1355
|
this.func();
|
|
@@ -1663,21 +1357,21 @@ var Expression = /** @class */ (function (_super) {
|
|
|
1663
1357
|
}
|
|
1664
1358
|
return this;
|
|
1665
1359
|
};
|
|
1666
|
-
Expression.prototype
|
|
1360
|
+
Expression.prototype.$disable = function () {
|
|
1667
1361
|
if (this.isEnabled) {
|
|
1668
1362
|
for (var i = 0; i < this.values.length; i++) {
|
|
1669
|
-
this.values[i]
|
|
1363
|
+
this.values[i].$off(this.linkedFunc[i]);
|
|
1670
1364
|
}
|
|
1671
1365
|
this.isEnabled = false;
|
|
1672
1366
|
}
|
|
1673
1367
|
return this;
|
|
1674
1368
|
};
|
|
1675
|
-
Expression.prototype
|
|
1676
|
-
this
|
|
1369
|
+
Expression.prototype.$destroy = function () {
|
|
1370
|
+
this.$disable();
|
|
1677
1371
|
this.values.splice(0);
|
|
1678
1372
|
this.valuesCache.splice(0);
|
|
1679
1373
|
this.linkedFunc.splice(0);
|
|
1680
|
-
_super.prototype
|
|
1374
|
+
_super.prototype.$destroy.call(this);
|
|
1681
1375
|
};
|
|
1682
1376
|
return Expression;
|
|
1683
1377
|
}(IValue));
|
|
@@ -1698,20 +1392,20 @@ var Reference = /** @class */ (function (_super) {
|
|
|
1698
1392
|
*/
|
|
1699
1393
|
function Reference(value) {
|
|
1700
1394
|
var _this = _super.call(this, true) || this;
|
|
1701
|
-
_this
|
|
1702
|
-
_this
|
|
1703
|
-
_this
|
|
1395
|
+
_this.$value = value;
|
|
1396
|
+
_this.$onchange = new Set;
|
|
1397
|
+
_this.$seal();
|
|
1704
1398
|
return _this;
|
|
1705
1399
|
}
|
|
1706
1400
|
Object.defineProperty(Reference.prototype, "$", {
|
|
1707
1401
|
get: function () {
|
|
1708
|
-
return this
|
|
1402
|
+
return this.$value;
|
|
1709
1403
|
},
|
|
1710
1404
|
set: function (value) {
|
|
1711
|
-
if (this
|
|
1712
|
-
this
|
|
1405
|
+
if (this.$value !== value) {
|
|
1406
|
+
this.$value = value;
|
|
1713
1407
|
if (this.isEnabled) {
|
|
1714
|
-
this
|
|
1408
|
+
this.$onchange.forEach(function (handler) {
|
|
1715
1409
|
handler(value);
|
|
1716
1410
|
});
|
|
1717
1411
|
}
|
|
@@ -1720,27 +1414,27 @@ var Reference = /** @class */ (function (_super) {
|
|
|
1720
1414
|
enumerable: false,
|
|
1721
1415
|
configurable: true
|
|
1722
1416
|
});
|
|
1723
|
-
Reference.prototype
|
|
1417
|
+
Reference.prototype.$enable = function () {
|
|
1724
1418
|
var _this = this;
|
|
1725
1419
|
if (!this.isEnabled) {
|
|
1726
|
-
this
|
|
1727
|
-
handler(_this
|
|
1420
|
+
this.$onchange.forEach(function (handler) {
|
|
1421
|
+
handler(_this.$value);
|
|
1728
1422
|
});
|
|
1729
1423
|
this.isEnabled = true;
|
|
1730
1424
|
}
|
|
1731
1425
|
};
|
|
1732
|
-
Reference.prototype
|
|
1426
|
+
Reference.prototype.$disable = function () {
|
|
1733
1427
|
this.isEnabled = false;
|
|
1734
1428
|
};
|
|
1735
|
-
Reference.prototype
|
|
1736
|
-
this
|
|
1429
|
+
Reference.prototype.$on = function (handler) {
|
|
1430
|
+
this.$onchange.add(handler);
|
|
1737
1431
|
};
|
|
1738
|
-
Reference.prototype
|
|
1739
|
-
this
|
|
1432
|
+
Reference.prototype.$off = function (handler) {
|
|
1433
|
+
this.$onchange.delete(handler);
|
|
1740
1434
|
};
|
|
1741
|
-
Reference.prototype
|
|
1742
|
-
_super.prototype
|
|
1743
|
-
this
|
|
1435
|
+
Reference.prototype.$destroy = function () {
|
|
1436
|
+
_super.prototype.$destroy.call(this);
|
|
1437
|
+
this.$onchange.clear();
|
|
1744
1438
|
};
|
|
1745
1439
|
return Reference;
|
|
1746
1440
|
}(IValue));
|
|
@@ -1765,13 +1459,13 @@ var Mirror = /** @class */ (function (_super) {
|
|
|
1765
1459
|
function Mirror(value, forwardOnly) {
|
|
1766
1460
|
if (forwardOnly === void 0) { forwardOnly = false; }
|
|
1767
1461
|
var _this = _super.call(this, value.$) || this;
|
|
1768
|
-
_this
|
|
1462
|
+
_this.$handler = function (v) {
|
|
1769
1463
|
_this.$ = v;
|
|
1770
1464
|
};
|
|
1771
|
-
_this
|
|
1772
|
-
_this
|
|
1773
|
-
value
|
|
1774
|
-
_this
|
|
1465
|
+
_this.$pointedValue = value;
|
|
1466
|
+
_this.$forwardOnly = forwardOnly;
|
|
1467
|
+
value.$on(_this.$handler);
|
|
1468
|
+
_this.$seal();
|
|
1775
1469
|
return _this;
|
|
1776
1470
|
}
|
|
1777
1471
|
Object.defineProperty(Mirror.prototype, "$", {
|
|
@@ -1782,8 +1476,8 @@ var Mirror = /** @class */ (function (_super) {
|
|
|
1782
1476
|
return _super.prototype.$;
|
|
1783
1477
|
},
|
|
1784
1478
|
set: function (v) {
|
|
1785
|
-
if (!this
|
|
1786
|
-
this
|
|
1479
|
+
if (!this.$forwardOnly) {
|
|
1480
|
+
this.$pointedValue.$ = v;
|
|
1787
1481
|
}
|
|
1788
1482
|
// this is a ts bug
|
|
1789
1483
|
// eslint-disable-next-line
|
|
@@ -1793,22 +1487,22 @@ var Mirror = /** @class */ (function (_super) {
|
|
|
1793
1487
|
enumerable: false,
|
|
1794
1488
|
configurable: true
|
|
1795
1489
|
});
|
|
1796
|
-
Mirror.prototype
|
|
1490
|
+
Mirror.prototype.$enable = function () {
|
|
1797
1491
|
if (!this.isEnabled) {
|
|
1798
1492
|
this.isEnabled = true;
|
|
1799
|
-
this
|
|
1800
|
-
this.$ = this
|
|
1493
|
+
this.$pointedValue.$on(this.$handler);
|
|
1494
|
+
this.$ = this.$pointedValue.$;
|
|
1801
1495
|
}
|
|
1802
1496
|
};
|
|
1803
|
-
Mirror.prototype
|
|
1497
|
+
Mirror.prototype.$disable = function () {
|
|
1804
1498
|
if (this.isEnabled) {
|
|
1805
|
-
this
|
|
1499
|
+
this.$pointedValue.$off(this.$handler);
|
|
1806
1500
|
this.isEnabled = false;
|
|
1807
1501
|
}
|
|
1808
1502
|
};
|
|
1809
|
-
Mirror.prototype
|
|
1810
|
-
this
|
|
1811
|
-
_super.prototype
|
|
1503
|
+
Mirror.prototype.$destroy = function () {
|
|
1504
|
+
this.$disable();
|
|
1505
|
+
_super.prototype.$destroy.call(this);
|
|
1812
1506
|
};
|
|
1813
1507
|
return Mirror;
|
|
1814
1508
|
}(Reference));
|
|
@@ -1832,17 +1526,21 @@ var Pointer = /** @class */ (function (_super) {
|
|
|
1832
1526
|
if (forwardOnly === void 0) { forwardOnly = false; }
|
|
1833
1527
|
return _super.call(this, value, forwardOnly) || this;
|
|
1834
1528
|
}
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
this
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1529
|
+
Object.defineProperty(Pointer.prototype, "$$", {
|
|
1530
|
+
/**
|
|
1531
|
+
* Point a new ivalue
|
|
1532
|
+
* @param value {IValue} value to point
|
|
1533
|
+
*/
|
|
1534
|
+
set: function (value) {
|
|
1535
|
+
if (this.$pointedValue !== value) {
|
|
1536
|
+
this.$disable();
|
|
1537
|
+
this.$pointedValue = value;
|
|
1538
|
+
this.$enable();
|
|
1539
|
+
}
|
|
1540
|
+
},
|
|
1541
|
+
enumerable: false,
|
|
1542
|
+
configurable: true
|
|
1543
|
+
});
|
|
1846
1544
|
return Pointer;
|
|
1847
1545
|
}(Mirror));
|
|
1848
1546
|
|
|
@@ -1864,20 +1562,20 @@ var Binding = /** @class */ (function (_super) {
|
|
|
1864
1562
|
function Binding(value) {
|
|
1865
1563
|
var _this = this; _super.call(this);
|
|
1866
1564
|
_this.binding = value;
|
|
1867
|
-
_this
|
|
1565
|
+
_this.$seal();
|
|
1868
1566
|
return _this;
|
|
1869
1567
|
}
|
|
1870
1568
|
Binding.prototype.init = function (bounded) {
|
|
1871
1569
|
this.func = bounded;
|
|
1872
|
-
this.binding
|
|
1570
|
+
this.binding.$on(this.func);
|
|
1873
1571
|
this.func(this.binding.$);
|
|
1874
1572
|
};
|
|
1875
1573
|
/**
|
|
1876
1574
|
* Just clear bindings
|
|
1877
1575
|
*/
|
|
1878
|
-
Binding.prototype
|
|
1879
|
-
this.binding
|
|
1880
|
-
_super.prototype
|
|
1576
|
+
Binding.prototype.$destroy = function () {
|
|
1577
|
+
this.binding.$off(this.func);
|
|
1578
|
+
_super.prototype.$destroy.call(this);
|
|
1881
1579
|
};
|
|
1882
1580
|
return Binding;
|
|
1883
1581
|
}(Destroyable));
|
|
@@ -1928,19 +1626,19 @@ var ReactivePrivate = /** @class */ (function (_super) {
|
|
|
1928
1626
|
* @type {boolean}
|
|
1929
1627
|
*/
|
|
1930
1628
|
_this.frozen = false;
|
|
1931
|
-
_this
|
|
1629
|
+
_this.$seal();
|
|
1932
1630
|
return _this;
|
|
1933
1631
|
}
|
|
1934
|
-
ReactivePrivate.prototype
|
|
1935
|
-
this.watch.forEach(function (value) { return value
|
|
1632
|
+
ReactivePrivate.prototype.$destroy = function () {
|
|
1633
|
+
this.watch.forEach(function (value) { return value.$destroy(); });
|
|
1936
1634
|
this.watch.clear();
|
|
1937
|
-
this.bindings.forEach(function (binding) { return binding
|
|
1635
|
+
this.bindings.forEach(function (binding) { return binding.$destroy(); });
|
|
1938
1636
|
this.bindings.clear();
|
|
1939
1637
|
this.models.forEach(function (model) { return model.disableReactivity(); });
|
|
1940
1638
|
this.models.clear();
|
|
1941
|
-
this.freezeExpr && this.freezeExpr
|
|
1639
|
+
this.freezeExpr && this.freezeExpr.$destroy();
|
|
1942
1640
|
this.onDestroy && this.onDestroy();
|
|
1943
|
-
_super.prototype
|
|
1641
|
+
_super.prototype.$destroy.call(this);
|
|
1944
1642
|
};
|
|
1945
1643
|
return ReactivePrivate;
|
|
1946
1644
|
}(Destroyable));
|
|
@@ -1956,7 +1654,7 @@ var Reactive = /** @class */ (function (_super) {
|
|
|
1956
1654
|
var _this = this; _super.call(this);
|
|
1957
1655
|
_this.input = input;
|
|
1958
1656
|
_this.$ = $ || new ReactivePrivate;
|
|
1959
|
-
_this
|
|
1657
|
+
_this.$seal();
|
|
1960
1658
|
return _this;
|
|
1961
1659
|
}
|
|
1962
1660
|
Object.defineProperty(Reactive.prototype, "parent", {
|
|
@@ -2053,7 +1751,7 @@ var Reactive = /** @class */ (function (_super) {
|
|
|
2053
1751
|
var $ = this.$;
|
|
2054
1752
|
if (!$.enabled) {
|
|
2055
1753
|
$.watch.forEach(function (watcher) {
|
|
2056
|
-
watcher
|
|
1754
|
+
watcher.$enable();
|
|
2057
1755
|
});
|
|
2058
1756
|
$.models.forEach(function (model) {
|
|
2059
1757
|
model.enableReactivity();
|
|
@@ -2068,7 +1766,7 @@ var Reactive = /** @class */ (function (_super) {
|
|
|
2068
1766
|
var $ = this.$;
|
|
2069
1767
|
if ($.enabled) {
|
|
2070
1768
|
$.watch.forEach(function (watcher) {
|
|
2071
|
-
watcher
|
|
1769
|
+
watcher.$disable();
|
|
2072
1770
|
});
|
|
2073
1771
|
$.models.forEach(function (model) {
|
|
2074
1772
|
model.disableReactivity();
|
|
@@ -2106,13 +1804,19 @@ var Reactive = /** @class */ (function (_super) {
|
|
|
2106
1804
|
};
|
|
2107
1805
|
Reactive.prototype.init = function () {
|
|
2108
1806
|
this.applyOptions(this.input);
|
|
2109
|
-
this.compose(this.input);
|
|
1807
|
+
return this.compose(this.input);
|
|
2110
1808
|
};
|
|
2111
1809
|
Reactive.prototype.applyOptions = function (input) {
|
|
2112
1810
|
// empty
|
|
2113
1811
|
};
|
|
1812
|
+
Reactive.prototype.applyOptionsNow = function () {
|
|
1813
|
+
this.applyOptions(this.input);
|
|
1814
|
+
};
|
|
2114
1815
|
Reactive.prototype.compose = function (input) {
|
|
2115
|
-
|
|
1816
|
+
throw notOverwritten();
|
|
1817
|
+
};
|
|
1818
|
+
Reactive.prototype.composeNow = function () {
|
|
1819
|
+
this.compose(this.input);
|
|
2116
1820
|
};
|
|
2117
1821
|
Reactive.prototype.runFunctional = function (f) {
|
|
2118
1822
|
var args = [];
|
|
@@ -2130,9 +1834,9 @@ var Reactive = /** @class */ (function (_super) {
|
|
|
2130
1834
|
Reactive.prototype.runOnDestroy = function (func) {
|
|
2131
1835
|
this.$.onDestroy = func;
|
|
2132
1836
|
};
|
|
2133
|
-
Reactive.prototype
|
|
2134
|
-
_super.prototype
|
|
2135
|
-
this
|
|
1837
|
+
Reactive.prototype.$destroy = function () {
|
|
1838
|
+
_super.prototype.$destroy.call(this);
|
|
1839
|
+
this.$.$destroy();
|
|
2136
1840
|
this.$ = null;
|
|
2137
1841
|
};
|
|
2138
1842
|
return Reactive;
|
|
@@ -2153,7 +1857,7 @@ var FragmentPrivate = /** @class */ (function (_super) {
|
|
|
2153
1857
|
__extends(FragmentPrivate, _super);
|
|
2154
1858
|
function FragmentPrivate() {
|
|
2155
1859
|
var _this = this; _super.call(this);
|
|
2156
|
-
_this
|
|
1860
|
+
_this.$seal();
|
|
2157
1861
|
return _this;
|
|
2158
1862
|
}
|
|
2159
1863
|
/**
|
|
@@ -2168,10 +1872,10 @@ var FragmentPrivate = /** @class */ (function (_super) {
|
|
|
2168
1872
|
/**
|
|
2169
1873
|
* Unlinks all bindings
|
|
2170
1874
|
*/
|
|
2171
|
-
FragmentPrivate.prototype
|
|
1875
|
+
FragmentPrivate.prototype.$destroy = function () {
|
|
2172
1876
|
this.next = null;
|
|
2173
1877
|
this.prev = null;
|
|
2174
|
-
_super.prototype
|
|
1878
|
+
_super.prototype.$destroy.call(this);
|
|
2175
1879
|
};
|
|
2176
1880
|
return FragmentPrivate;
|
|
2177
1881
|
}(ReactivePrivate));
|
|
@@ -2217,8 +1921,12 @@ var Fragment = /** @class */ (function (_super) {
|
|
|
2217
1921
|
var $ = this.$;
|
|
2218
1922
|
$.preinit(app, parent);
|
|
2219
1923
|
};
|
|
1924
|
+
Fragment.prototype.init = function () {
|
|
1925
|
+
var ret = _super.prototype.init.call(this);
|
|
1926
|
+
this.ready();
|
|
1927
|
+
return ret;
|
|
1928
|
+
};
|
|
2220
1929
|
Fragment.prototype.compose = function (input) {
|
|
2221
|
-
_super.prototype.compose.call(this, input);
|
|
2222
1930
|
input.slot && input.slot(this);
|
|
2223
1931
|
};
|
|
2224
1932
|
/** To be overloaded: ready event handler */
|
|
@@ -2326,8 +2034,7 @@ var Fragment = /** @class */ (function (_super) {
|
|
|
2326
2034
|
node.preinit($.app, this);
|
|
2327
2035
|
node.input.slot = callback || node.input.slot;
|
|
2328
2036
|
this.pushNode(node);
|
|
2329
|
-
node.init();
|
|
2330
|
-
node.ready();
|
|
2037
|
+
return node.init();
|
|
2331
2038
|
};
|
|
2332
2039
|
/**
|
|
2333
2040
|
* Defines an if node
|
|
@@ -2399,14 +2106,14 @@ var Fragment = /** @class */ (function (_super) {
|
|
|
2399
2106
|
$.prev.$.next = $.next;
|
|
2400
2107
|
}
|
|
2401
2108
|
};
|
|
2402
|
-
Fragment.prototype
|
|
2403
|
-
this.children.forEach(function (child) { return child
|
|
2109
|
+
Fragment.prototype.$destroy = function () {
|
|
2110
|
+
this.children.forEach(function (child) { return child.$destroy(); });
|
|
2404
2111
|
this.children.clear();
|
|
2405
2112
|
this.lastChild = null;
|
|
2406
2113
|
if (this.$.parent.lastChild === this) {
|
|
2407
2114
|
this.$.parent.lastChild = this.$.prev;
|
|
2408
2115
|
}
|
|
2409
|
-
_super.prototype
|
|
2116
|
+
_super.prototype.$destroy.call(this);
|
|
2410
2117
|
};
|
|
2411
2118
|
return Fragment;
|
|
2412
2119
|
}(Reactive));
|
|
@@ -2421,7 +2128,7 @@ var TextNodePrivate = /** @class */ (function (_super) {
|
|
|
2421
2128
|
__extends(TextNodePrivate, _super);
|
|
2422
2129
|
function TextNodePrivate() {
|
|
2423
2130
|
var _this = this; _super.call(this);
|
|
2424
|
-
_this
|
|
2131
|
+
_this.$seal();
|
|
2425
2132
|
return _this;
|
|
2426
2133
|
}
|
|
2427
2134
|
/**
|
|
@@ -2443,8 +2150,8 @@ var TextNodePrivate = /** @class */ (function (_super) {
|
|
|
2443
2150
|
/**
|
|
2444
2151
|
* Clear node data
|
|
2445
2152
|
*/
|
|
2446
|
-
TextNodePrivate.prototype
|
|
2447
|
-
_super.prototype
|
|
2153
|
+
TextNodePrivate.prototype.$destroy = function () {
|
|
2154
|
+
_super.prototype.$destroy.call(this);
|
|
2448
2155
|
};
|
|
2449
2156
|
return TextNodePrivate;
|
|
2450
2157
|
}(FragmentPrivate));
|
|
@@ -2459,7 +2166,7 @@ var TextNode = /** @class */ (function (_super) {
|
|
|
2459
2166
|
function TextNode($) {
|
|
2460
2167
|
if ($ === void 0) { $ = new TextNodePrivate(); }
|
|
2461
2168
|
var _this = _super.call(this, {}, $) || this;
|
|
2462
|
-
_this
|
|
2169
|
+
_this.$seal();
|
|
2463
2170
|
return _this;
|
|
2464
2171
|
}
|
|
2465
2172
|
TextNode.prototype.preinit = function (app, parent, text) {
|
|
@@ -2473,10 +2180,10 @@ var TextNode = /** @class */ (function (_super) {
|
|
|
2473
2180
|
TextNode.prototype.findFirstChild = function () {
|
|
2474
2181
|
return this.$.node;
|
|
2475
2182
|
};
|
|
2476
|
-
TextNode.prototype
|
|
2183
|
+
TextNode.prototype.$destroy = function () {
|
|
2477
2184
|
this.$.node.remove();
|
|
2478
|
-
this
|
|
2479
|
-
_super.prototype
|
|
2185
|
+
this.$.$destroy();
|
|
2186
|
+
_super.prototype.$destroy.call(this);
|
|
2480
2187
|
};
|
|
2481
2188
|
return TextNode;
|
|
2482
2189
|
}(Fragment));
|
|
@@ -2495,11 +2202,11 @@ var INodePrivate = /** @class */ (function (_super) {
|
|
|
2495
2202
|
* @type {boolean}
|
|
2496
2203
|
*/
|
|
2497
2204
|
_this.unmounted = false;
|
|
2498
|
-
_this
|
|
2205
|
+
_this.$seal();
|
|
2499
2206
|
return _this;
|
|
2500
2207
|
}
|
|
2501
|
-
INodePrivate.prototype
|
|
2502
|
-
_super.prototype
|
|
2208
|
+
INodePrivate.prototype.$destroy = function () {
|
|
2209
|
+
_super.prototype.$destroy.call(this);
|
|
2503
2210
|
};
|
|
2504
2211
|
return INodePrivate;
|
|
2505
2212
|
}(FragmentPrivate));
|
|
@@ -2518,7 +2225,7 @@ var INode = /** @class */ (function (_super) {
|
|
|
2518
2225
|
*/
|
|
2519
2226
|
function INode(input, $) {
|
|
2520
2227
|
var _this = _super.call(this, input, $ || new INodePrivate) || this;
|
|
2521
|
-
_this
|
|
2228
|
+
_this.$seal();
|
|
2522
2229
|
return _this;
|
|
2523
2230
|
}
|
|
2524
2231
|
Object.defineProperty(INode.prototype, "node", {
|
|
@@ -2770,7 +2477,7 @@ var Tag = /** @class */ (function (_super) {
|
|
|
2770
2477
|
__extends(Tag, _super);
|
|
2771
2478
|
function Tag(input) {
|
|
2772
2479
|
var _this = _super.call(this, input) || this;
|
|
2773
|
-
_this
|
|
2480
|
+
_this.$seal();
|
|
2774
2481
|
return _this;
|
|
2775
2482
|
}
|
|
2776
2483
|
Tag.prototype.preinit = function (app, parent, tagName) {
|
|
@@ -2825,9 +2532,9 @@ var Tag = /** @class */ (function (_super) {
|
|
|
2825
2532
|
/**
|
|
2826
2533
|
* Runs GC
|
|
2827
2534
|
*/
|
|
2828
|
-
Tag.prototype
|
|
2535
|
+
Tag.prototype.$destroy = function () {
|
|
2829
2536
|
this.node.remove();
|
|
2830
|
-
_super.prototype
|
|
2537
|
+
_super.prototype.$destroy.call(this);
|
|
2831
2538
|
};
|
|
2832
2539
|
return Tag;
|
|
2833
2540
|
}(INode));
|
|
@@ -2856,8 +2563,11 @@ var Extension = /** @class */ (function (_super) {
|
|
|
2856
2563
|
throw userError("A extension node can be encapsulated only in a tag/extension/component", "virtual-dom");
|
|
2857
2564
|
}
|
|
2858
2565
|
};
|
|
2859
|
-
Extension.prototype.
|
|
2860
|
-
|
|
2566
|
+
Extension.prototype.extend = function (options) {
|
|
2567
|
+
this.applyOptions(options);
|
|
2568
|
+
};
|
|
2569
|
+
Extension.prototype.$destroy = function () {
|
|
2570
|
+
_super.prototype.$destroy.call(this);
|
|
2861
2571
|
};
|
|
2862
2572
|
return Extension;
|
|
2863
2573
|
}(INode));
|
|
@@ -2872,6 +2582,11 @@ var Component = /** @class */ (function (_super) {
|
|
|
2872
2582
|
function Component() {
|
|
2873
2583
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
2874
2584
|
}
|
|
2585
|
+
Component.prototype.init = function () {
|
|
2586
|
+
_super.prototype.composeNow.call(this);
|
|
2587
|
+
this.ready();
|
|
2588
|
+
_super.prototype.applyOptionsNow.call(this);
|
|
2589
|
+
};
|
|
2875
2590
|
Component.prototype.ready = function () {
|
|
2876
2591
|
_super.prototype.ready.call(this);
|
|
2877
2592
|
if (this.children.size !== 1) {
|
|
@@ -2906,19 +2621,19 @@ var SwitchedNodePrivate = /** @class */ (function (_super) {
|
|
|
2906
2621
|
* @type {Array<{cond : IValue<boolean>, cb : function(Fragment)}>}
|
|
2907
2622
|
*/
|
|
2908
2623
|
_this.cases = [];
|
|
2909
|
-
_this
|
|
2624
|
+
_this.$seal();
|
|
2910
2625
|
return _this;
|
|
2911
2626
|
}
|
|
2912
2627
|
/**
|
|
2913
2628
|
* Runs GC
|
|
2914
2629
|
*/
|
|
2915
|
-
SwitchedNodePrivate.prototype
|
|
2630
|
+
SwitchedNodePrivate.prototype.$destroy = function () {
|
|
2916
2631
|
this.cases.forEach(function (c) {
|
|
2917
2632
|
delete c.cond;
|
|
2918
2633
|
delete c.cb;
|
|
2919
2634
|
});
|
|
2920
2635
|
this.cases.splice(0);
|
|
2921
|
-
_super.prototype
|
|
2636
|
+
_super.prototype.$destroy.call(this);
|
|
2922
2637
|
};
|
|
2923
2638
|
return SwitchedNodePrivate;
|
|
2924
2639
|
}(FragmentPrivate));
|
|
@@ -2945,7 +2660,7 @@ var SwitchedNode = /** @class */ (function (_super) {
|
|
|
2945
2660
|
return;
|
|
2946
2661
|
}
|
|
2947
2662
|
if (_this.lastChild) {
|
|
2948
|
-
_this.lastChild
|
|
2663
|
+
_this.lastChild.$destroy();
|
|
2949
2664
|
_this.children.clear();
|
|
2950
2665
|
_this.lastChild = null;
|
|
2951
2666
|
}
|
|
@@ -2957,12 +2672,12 @@ var SwitchedNode = /** @class */ (function (_super) {
|
|
|
2957
2672
|
$.index = -1;
|
|
2958
2673
|
}
|
|
2959
2674
|
};
|
|
2960
|
-
_this
|
|
2675
|
+
_this.$seal();
|
|
2961
2676
|
return _this;
|
|
2962
2677
|
}
|
|
2963
2678
|
SwitchedNode.prototype.addCase = function (case_) {
|
|
2964
2679
|
this.$.cases.push(case_);
|
|
2965
|
-
case_.cond
|
|
2680
|
+
case_.cond.$on(this.$.sync);
|
|
2966
2681
|
this.$.sync();
|
|
2967
2682
|
};
|
|
2968
2683
|
/**
|
|
@@ -2980,16 +2695,16 @@ var SwitchedNode = /** @class */ (function (_super) {
|
|
|
2980
2695
|
SwitchedNode.prototype.ready = function () {
|
|
2981
2696
|
var $ = this.$;
|
|
2982
2697
|
$.cases.forEach(function (c) {
|
|
2983
|
-
c.cond
|
|
2698
|
+
c.cond.$on($.sync);
|
|
2984
2699
|
});
|
|
2985
2700
|
$.sync();
|
|
2986
2701
|
};
|
|
2987
|
-
SwitchedNode.prototype
|
|
2702
|
+
SwitchedNode.prototype.$destroy = function () {
|
|
2988
2703
|
var $ = this.$;
|
|
2989
2704
|
$.cases.forEach(function (c) {
|
|
2990
|
-
c.cond
|
|
2705
|
+
c.cond.$off($.sync);
|
|
2991
2706
|
});
|
|
2992
|
-
_super.prototype
|
|
2707
|
+
_super.prototype.$destroy.call(this);
|
|
2993
2708
|
};
|
|
2994
2709
|
return SwitchedNode;
|
|
2995
2710
|
}(Fragment));
|
|
@@ -3001,7 +2716,7 @@ var DebugPrivate = /** @class */ (function (_super) {
|
|
|
3001
2716
|
__extends(DebugPrivate, _super);
|
|
3002
2717
|
function DebugPrivate() {
|
|
3003
2718
|
var _this = this; _super.call(this);
|
|
3004
|
-
_this
|
|
2719
|
+
_this.$seal();
|
|
3005
2720
|
return _this;
|
|
3006
2721
|
}
|
|
3007
2722
|
/**
|
|
@@ -3022,9 +2737,9 @@ var DebugPrivate = /** @class */ (function (_super) {
|
|
|
3022
2737
|
/**
|
|
3023
2738
|
* Clear node data
|
|
3024
2739
|
*/
|
|
3025
|
-
DebugPrivate.prototype
|
|
2740
|
+
DebugPrivate.prototype.$destroy = function () {
|
|
3026
2741
|
this.node.remove();
|
|
3027
|
-
_super.prototype
|
|
2742
|
+
_super.prototype.$destroy.call(this);
|
|
3028
2743
|
};
|
|
3029
2744
|
return DebugPrivate;
|
|
3030
2745
|
}(FragmentPrivate));
|
|
@@ -3043,7 +2758,7 @@ var DebugNode = /** @class */ (function (_super) {
|
|
|
3043
2758
|
* @type {DebugNode}
|
|
3044
2759
|
*/
|
|
3045
2760
|
_this.$ = new DebugPrivate();
|
|
3046
|
-
_this
|
|
2761
|
+
_this.$seal();
|
|
3047
2762
|
return _this;
|
|
3048
2763
|
}
|
|
3049
2764
|
DebugNode.prototype.preinit = function (app, parent, text) {
|
|
@@ -3056,9 +2771,9 @@ var DebugNode = /** @class */ (function (_super) {
|
|
|
3056
2771
|
/**
|
|
3057
2772
|
* Runs garbage collector
|
|
3058
2773
|
*/
|
|
3059
|
-
DebugNode.prototype
|
|
3060
|
-
this
|
|
3061
|
-
_super.prototype
|
|
2774
|
+
DebugNode.prototype.$destroy = function () {
|
|
2775
|
+
this.$.$destroy();
|
|
2776
|
+
_super.prototype.$destroy.call(this);
|
|
3062
2777
|
};
|
|
3063
2778
|
return DebugNode;
|
|
3064
2779
|
}(Fragment));
|
|
@@ -3092,7 +2807,7 @@ var AppNode = /** @class */ (function (_super) {
|
|
|
3092
2807
|
function AppNode(input) {
|
|
3093
2808
|
var _this = _super.call(this, input) || this;
|
|
3094
2809
|
_this.debugUi = input.debugUi || false;
|
|
3095
|
-
_this
|
|
2810
|
+
_this.$seal();
|
|
3096
2811
|
return _this;
|
|
3097
2812
|
}
|
|
3098
2813
|
return AppNode;
|
|
@@ -3115,7 +2830,7 @@ var App = /** @class */ (function (_super) {
|
|
|
3115
2830
|
_this.$.node = node;
|
|
3116
2831
|
_this.preinit(_this, _this);
|
|
3117
2832
|
_this.init();
|
|
3118
|
-
_this
|
|
2833
|
+
_this.$seal();
|
|
3119
2834
|
return _this;
|
|
3120
2835
|
}
|
|
3121
2836
|
App.prototype.appendNode = function (node) {
|
|
@@ -3129,7 +2844,7 @@ var Portal = /** @class */ (function (_super) {
|
|
|
3129
2844
|
function Portal(input) {
|
|
3130
2845
|
var _this = _super.call(this, input) || this;
|
|
3131
2846
|
_this.$.node = input.node;
|
|
3132
|
-
_this
|
|
2847
|
+
_this.$seal();
|
|
3133
2848
|
return _this;
|
|
3134
2849
|
}
|
|
3135
2850
|
Portal.prototype.appendNode = function (node) {
|
|
@@ -3265,7 +2980,7 @@ var AttributeBinding = /** @class */ (function (_super) {
|
|
|
3265
2980
|
node.node.removeAttribute(name);
|
|
3266
2981
|
}
|
|
3267
2982
|
});
|
|
3268
|
-
_this
|
|
2983
|
+
_this.$seal();
|
|
3269
2984
|
return _this;
|
|
3270
2985
|
}
|
|
3271
2986
|
return AttributeBinding;
|
|
@@ -3295,7 +3010,7 @@ var StyleBinding = /** @class */ (function (_super) {
|
|
|
3295
3010
|
node.node.style.setProperty(name, value);
|
|
3296
3011
|
}
|
|
3297
3012
|
});
|
|
3298
|
-
_this
|
|
3013
|
+
_this.$seal();
|
|
3299
3014
|
return _this;
|
|
3300
3015
|
}
|
|
3301
3016
|
return StyleBinding;
|
|
@@ -3327,7 +3042,7 @@ var StaticClassBinding = /** @class */ (function (_super) {
|
|
|
3327
3042
|
_this.current = value;
|
|
3328
3043
|
}
|
|
3329
3044
|
});
|
|
3330
|
-
_this
|
|
3045
|
+
_this.$seal();
|
|
3331
3046
|
return _this;
|
|
3332
3047
|
}
|
|
3333
3048
|
return StaticClassBinding;
|
|
@@ -3349,7 +3064,7 @@ var DynamicalClassBinding = /** @class */ (function (_super) {
|
|
|
3349
3064
|
_this.current = value;
|
|
3350
3065
|
}
|
|
3351
3066
|
});
|
|
3352
|
-
_this
|
|
3067
|
+
_this.$seal();
|
|
3353
3068
|
return _this;
|
|
3354
3069
|
}
|
|
3355
3070
|
return DynamicalClassBinding;
|
|
@@ -3374,12 +3089,12 @@ var RepeatNodePrivate = /** @class */ (function (_super) {
|
|
|
3374
3089
|
* @type {Map}
|
|
3375
3090
|
*/
|
|
3376
3091
|
_this.nodes = new Map();
|
|
3377
|
-
_this
|
|
3092
|
+
_this.$seal();
|
|
3378
3093
|
return _this;
|
|
3379
3094
|
}
|
|
3380
|
-
RepeatNodePrivate.prototype
|
|
3095
|
+
RepeatNodePrivate.prototype.$destroy = function () {
|
|
3381
3096
|
this.nodes.clear();
|
|
3382
|
-
_super.prototype
|
|
3097
|
+
_super.prototype.$destroy.call(this);
|
|
3383
3098
|
};
|
|
3384
3099
|
return RepeatNodePrivate;
|
|
3385
3100
|
}(INodePrivate));
|
|
@@ -3425,7 +3140,7 @@ var RepeatNode = /** @class */ (function (_super) {
|
|
|
3425
3140
|
var child = $.nodes.get(id);
|
|
3426
3141
|
if (child) {
|
|
3427
3142
|
child.remove();
|
|
3428
|
-
child
|
|
3143
|
+
child.$destroy();
|
|
3429
3144
|
this.$.nodes.delete(id);
|
|
3430
3145
|
this.children.delete(child);
|
|
3431
3146
|
}
|
|
@@ -3521,7 +3236,7 @@ var BaseViewPrivate = /** @class */ (function (_super) {
|
|
|
3521
3236
|
__extends(BaseViewPrivate, _super);
|
|
3522
3237
|
function BaseViewPrivate() {
|
|
3523
3238
|
var _this = this; _super.call(this);
|
|
3524
|
-
_this
|
|
3239
|
+
_this.$seal();
|
|
3525
3240
|
return _this;
|
|
3526
3241
|
}
|
|
3527
3242
|
return BaseViewPrivate;
|
|
@@ -3603,7 +3318,7 @@ var Watch = /** @class */ (function (_super) {
|
|
|
3603
3318
|
var _this = this;
|
|
3604
3319
|
this.watch(function (value) {
|
|
3605
3320
|
_this.children.forEach(function (child) {
|
|
3606
|
-
child
|
|
3321
|
+
child.$destroy();
|
|
3607
3322
|
});
|
|
3608
3323
|
_this.children.clear();
|
|
3609
3324
|
_this.lastChild = null;
|
|
@@ -3630,7 +3345,7 @@ var ObjectView = /** @class */ (function (_super) {
|
|
|
3630
3345
|
}
|
|
3631
3346
|
ObjectView.prototype.compose = function (input) {
|
|
3632
3347
|
_super.prototype.compose.call(this, input);
|
|
3633
|
-
var obj = input.model.
|
|
3348
|
+
var obj = input.model.values;
|
|
3634
3349
|
for (var key in obj) {
|
|
3635
3350
|
this.createChild(input, key, obj[key]);
|
|
3636
3351
|
}
|
|
@@ -3691,4 +3406,297 @@ var SetView = /** @class */ (function (_super) {
|
|
|
3691
3406
|
|
|
3692
3407
|
window.SetView = SetView;
|
|
3693
3408
|
|
|
3409
|
+
// ./lib-es5/functional/merge.js
|
|
3410
|
+
function merge(main) {
|
|
3411
|
+
var targets = [];
|
|
3412
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
3413
|
+
targets[_i - 1] = arguments[_i];
|
|
3414
|
+
}
|
|
3415
|
+
function refactorClass(obj) {
|
|
3416
|
+
if (Array.isArray(obj.class)) {
|
|
3417
|
+
var out_1 = {
|
|
3418
|
+
$: []
|
|
3419
|
+
};
|
|
3420
|
+
obj.class.forEach(function (item) {
|
|
3421
|
+
if (item instanceof IValue) {
|
|
3422
|
+
out_1.$.push(item);
|
|
3423
|
+
}
|
|
3424
|
+
else if (typeof item === 'string') {
|
|
3425
|
+
out_1[item] = true;
|
|
3426
|
+
}
|
|
3427
|
+
else if (typeof item === 'object') {
|
|
3428
|
+
Object.assign(out_1, item);
|
|
3429
|
+
}
|
|
3430
|
+
});
|
|
3431
|
+
obj.class = out_1;
|
|
3432
|
+
}
|
|
3433
|
+
}
|
|
3434
|
+
refactorClass(main);
|
|
3435
|
+
targets.forEach(function (target) {
|
|
3436
|
+
Reflect.ownKeys(target).forEach(function (prop) {
|
|
3437
|
+
var _a;
|
|
3438
|
+
if (!Reflect.has(main, prop)) {
|
|
3439
|
+
main[prop] = target[prop];
|
|
3440
|
+
}
|
|
3441
|
+
else if (typeof main[prop] === 'object' && typeof target[prop] === 'object') {
|
|
3442
|
+
if (prop === 'class') {
|
|
3443
|
+
refactorClass(target);
|
|
3444
|
+
}
|
|
3445
|
+
if (prop === '$' && Array.isArray(main[prop]) && Array.isArray(target[prop])) {
|
|
3446
|
+
(_a = main.$).push.apply(_a, target.$);
|
|
3447
|
+
}
|
|
3448
|
+
else {
|
|
3449
|
+
merge(main[prop], target[prop]);
|
|
3450
|
+
}
|
|
3451
|
+
}
|
|
3452
|
+
});
|
|
3453
|
+
});
|
|
3454
|
+
}
|
|
3455
|
+
|
|
3456
|
+
window.merge = merge;
|
|
3457
|
+
|
|
3458
|
+
// ./lib-es5/functional/stack.js
|
|
3459
|
+
function app(renderer) {
|
|
3460
|
+
return function (node, opts) {
|
|
3461
|
+
return new App(node, opts).runFunctional(renderer, opts);
|
|
3462
|
+
};
|
|
3463
|
+
}
|
|
3464
|
+
function component(renderer) {
|
|
3465
|
+
return function (opts, callback) {
|
|
3466
|
+
var component = new Component(opts);
|
|
3467
|
+
if (!(current instanceof Fragment))
|
|
3468
|
+
throw userError('missing parent node', 'out-of-context');
|
|
3469
|
+
var ret;
|
|
3470
|
+
if (callback)
|
|
3471
|
+
opts.slot = callback;
|
|
3472
|
+
current.create(component, function (node) {
|
|
3473
|
+
ret = node.runFunctional(renderer, opts);
|
|
3474
|
+
});
|
|
3475
|
+
return ret;
|
|
3476
|
+
};
|
|
3477
|
+
}
|
|
3478
|
+
function fragment(renderer) {
|
|
3479
|
+
return function (opts, callback) {
|
|
3480
|
+
var frag = new Fragment(opts);
|
|
3481
|
+
if (!(current instanceof Fragment))
|
|
3482
|
+
throw userError('missing parent node', 'out-of-context');
|
|
3483
|
+
if (callback)
|
|
3484
|
+
opts.slot = callback;
|
|
3485
|
+
current.create(frag);
|
|
3486
|
+
return frag.runFunctional(renderer, opts);
|
|
3487
|
+
};
|
|
3488
|
+
}
|
|
3489
|
+
function extension(renderer) {
|
|
3490
|
+
return function (opts, callback) {
|
|
3491
|
+
var ext = new Extension(opts);
|
|
3492
|
+
if (!(current instanceof Fragment))
|
|
3493
|
+
throw userError('missing parent node', 'out-of-context');
|
|
3494
|
+
if (callback)
|
|
3495
|
+
opts.slot = callback;
|
|
3496
|
+
current.create(ext);
|
|
3497
|
+
return ext.runFunctional(renderer, opts);
|
|
3498
|
+
};
|
|
3499
|
+
}
|
|
3500
|
+
function tag(name, opts, callback) {
|
|
3501
|
+
if (!(current instanceof Fragment))
|
|
3502
|
+
throw userError('missing parent node', 'out-of-context');
|
|
3503
|
+
return {
|
|
3504
|
+
node: current.tag(name, opts, function (node) {
|
|
3505
|
+
callback && node.runFunctional(callback);
|
|
3506
|
+
})
|
|
3507
|
+
};
|
|
3508
|
+
}
|
|
3509
|
+
function create(node, callback) {
|
|
3510
|
+
if (!(current instanceof Fragment))
|
|
3511
|
+
throw userError('missing current node', 'out-of-context');
|
|
3512
|
+
current.create(node, function (node) {
|
|
3513
|
+
var args = [];
|
|
3514
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
3515
|
+
args[_i - 1] = arguments[_i];
|
|
3516
|
+
}
|
|
3517
|
+
callback && node.runFunctional.apply(node, __spreadArray([callback], args, false));
|
|
3518
|
+
});
|
|
3519
|
+
return node;
|
|
3520
|
+
}
|
|
3521
|
+
var vx = {
|
|
3522
|
+
if: function (condition, callback) {
|
|
3523
|
+
if (current instanceof Fragment) {
|
|
3524
|
+
current.if(condition, function (node) { return node.runFunctional(callback); });
|
|
3525
|
+
}
|
|
3526
|
+
else {
|
|
3527
|
+
throw userError("wrong use of `v.if` function", "logic-error");
|
|
3528
|
+
}
|
|
3529
|
+
},
|
|
3530
|
+
else: function (callback) {
|
|
3531
|
+
if (current instanceof Fragment) {
|
|
3532
|
+
current.else(function (node) { return node.runFunctional(callback); });
|
|
3533
|
+
}
|
|
3534
|
+
else {
|
|
3535
|
+
throw userError("wrong use of `v.else` function", "logic-error");
|
|
3536
|
+
}
|
|
3537
|
+
},
|
|
3538
|
+
elif: function (condition, callback) {
|
|
3539
|
+
if (current instanceof Fragment) {
|
|
3540
|
+
current.elif(condition, function (node) { return node.runFunctional(callback); });
|
|
3541
|
+
}
|
|
3542
|
+
else {
|
|
3543
|
+
throw userError("wrong use of `v.elif` function", "logic-error");
|
|
3544
|
+
}
|
|
3545
|
+
},
|
|
3546
|
+
for: function (model, callback) {
|
|
3547
|
+
if (model instanceof ArrayModel) {
|
|
3548
|
+
// for arrays T & K are the same type
|
|
3549
|
+
create(new ArrayView({ model: model }), callback);
|
|
3550
|
+
}
|
|
3551
|
+
else if (model instanceof MapModel) {
|
|
3552
|
+
create(new MapView({ model: model }), callback);
|
|
3553
|
+
}
|
|
3554
|
+
else if (model instanceof SetModel) {
|
|
3555
|
+
// for sets T & K are the same type
|
|
3556
|
+
create(new SetView({ model: model }), callback);
|
|
3557
|
+
}
|
|
3558
|
+
else if (model instanceof ObjectModel) {
|
|
3559
|
+
// for objects K is always string
|
|
3560
|
+
create(new ObjectView({ model: model }), callback);
|
|
3561
|
+
}
|
|
3562
|
+
else {
|
|
3563
|
+
throw userError("wrong use of `v.for` function", 'wrong-model');
|
|
3564
|
+
}
|
|
3565
|
+
},
|
|
3566
|
+
watch: function (model, callback) {
|
|
3567
|
+
var opts = { model: model };
|
|
3568
|
+
create(new Watch(opts), callback);
|
|
3569
|
+
},
|
|
3570
|
+
nextTick: function (callback) {
|
|
3571
|
+
var node = current;
|
|
3572
|
+
window.setTimeout(function () {
|
|
3573
|
+
node.runFunctional(callback);
|
|
3574
|
+
}, 0);
|
|
3575
|
+
}
|
|
3576
|
+
};
|
|
3577
|
+
|
|
3578
|
+
window.app = app;
|
|
3579
|
+
window.component = component;
|
|
3580
|
+
window.fragment = fragment;
|
|
3581
|
+
window.extension = extension;
|
|
3582
|
+
window.tag = tag;
|
|
3583
|
+
window.create = create;
|
|
3584
|
+
window.vx = vx;
|
|
3585
|
+
|
|
3586
|
+
// ./lib-es5/functional/models.js
|
|
3587
|
+
function arrayModel(arr) {
|
|
3588
|
+
if (arr === void 0) { arr = []; }
|
|
3589
|
+
if (!current)
|
|
3590
|
+
throw userError('missing parent node', 'out-of-context');
|
|
3591
|
+
return current.register(new ArrayModel(arr)).proxy();
|
|
3592
|
+
}
|
|
3593
|
+
function mapModel(map) {
|
|
3594
|
+
if (map === void 0) { map = []; }
|
|
3595
|
+
if (!current)
|
|
3596
|
+
throw userError('missing parent node', 'out-of-context');
|
|
3597
|
+
return current.register(new MapModel(map));
|
|
3598
|
+
}
|
|
3599
|
+
function setModel(arr) {
|
|
3600
|
+
if (arr === void 0) { arr = []; }
|
|
3601
|
+
if (!current)
|
|
3602
|
+
throw userError('missing parent node', 'out-of-context');
|
|
3603
|
+
return current.register(new SetModel(arr));
|
|
3604
|
+
}
|
|
3605
|
+
function objectModel(obj) {
|
|
3606
|
+
if (obj === void 0) { obj = {}; }
|
|
3607
|
+
if (!current)
|
|
3608
|
+
throw userError('missing parent node', 'out-of-context');
|
|
3609
|
+
return current.register(new ObjectModel(obj));
|
|
3610
|
+
}
|
|
3611
|
+
|
|
3612
|
+
window.arrayModel = arrayModel;
|
|
3613
|
+
window.mapModel = mapModel;
|
|
3614
|
+
window.setModel = setModel;
|
|
3615
|
+
window.objectModel = objectModel;
|
|
3616
|
+
|
|
3617
|
+
// ./lib-es5/functional/options.js
|
|
3618
|
+
|
|
3619
|
+
|
|
3620
|
+
|
|
3621
|
+
// ./lib-es5/functional/reactivity.js
|
|
3622
|
+
function ref(value) {
|
|
3623
|
+
var ref = current.ref(value);
|
|
3624
|
+
return [ref, function (value) { return ref.$ = value; }];
|
|
3625
|
+
}
|
|
3626
|
+
function mirror(value) {
|
|
3627
|
+
return current.mirror(value);
|
|
3628
|
+
}
|
|
3629
|
+
function forward(value) {
|
|
3630
|
+
return current.forward(value);
|
|
3631
|
+
}
|
|
3632
|
+
function point(value) {
|
|
3633
|
+
return current.point(value);
|
|
3634
|
+
}
|
|
3635
|
+
function expr(func) {
|
|
3636
|
+
var values = [];
|
|
3637
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
3638
|
+
values[_i - 1] = arguments[_i];
|
|
3639
|
+
}
|
|
3640
|
+
return current.expr.apply(current, __spreadArray([func], values, false));
|
|
3641
|
+
}
|
|
3642
|
+
function watch(func) {
|
|
3643
|
+
var values = [];
|
|
3644
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
3645
|
+
values[_i - 1] = arguments[_i];
|
|
3646
|
+
}
|
|
3647
|
+
current.watch.apply(current, __spreadArray([func], values, false));
|
|
3648
|
+
}
|
|
3649
|
+
function valueOf(value) {
|
|
3650
|
+
return value.$;
|
|
3651
|
+
}
|
|
3652
|
+
function setValue(ref, value) {
|
|
3653
|
+
if (ref instanceof Pointer && value instanceof IValue) {
|
|
3654
|
+
ref.$$ = value;
|
|
3655
|
+
}
|
|
3656
|
+
else {
|
|
3657
|
+
ref.$ = value instanceof IValue ? value.$ : value;
|
|
3658
|
+
}
|
|
3659
|
+
}
|
|
3660
|
+
|
|
3661
|
+
window.ref = ref;
|
|
3662
|
+
window.mirror = mirror;
|
|
3663
|
+
window.forward = forward;
|
|
3664
|
+
window.point = point;
|
|
3665
|
+
window.expr = expr;
|
|
3666
|
+
window.watch = watch;
|
|
3667
|
+
window.valueOf = valueOf;
|
|
3668
|
+
window.setValue = setValue;
|
|
3669
|
+
|
|
3670
|
+
// ./lib-es5/functional/components.js
|
|
3671
|
+
function text(text) {
|
|
3672
|
+
if (!(current instanceof Fragment))
|
|
3673
|
+
throw userError('missing parent node', 'out-of-context');
|
|
3674
|
+
;
|
|
3675
|
+
current.text(text);
|
|
3676
|
+
}
|
|
3677
|
+
function debug(text) {
|
|
3678
|
+
if (!(current instanceof Fragment))
|
|
3679
|
+
throw userError('missing parent node', 'out-of-context');
|
|
3680
|
+
current.debug(text);
|
|
3681
|
+
}
|
|
3682
|
+
function predefine(slot, predefined) {
|
|
3683
|
+
return slot || predefined;
|
|
3684
|
+
}
|
|
3685
|
+
|
|
3686
|
+
window.text = text;
|
|
3687
|
+
window.debug = debug;
|
|
3688
|
+
window.predefine = predefine;
|
|
3689
|
+
|
|
3690
|
+
// ./lib-es5/v/index.js
|
|
3691
|
+
|
|
3692
|
+
var v = __assign(__assign({ ref: function (value) {
|
|
3693
|
+
return current.ref(value);
|
|
3694
|
+
}, expr: expr, of: valueOf, sv: setValue, alwaysFalse: new Reference(false), app: app, component: component, fragment: fragment, extension: extension, text: text, tag: tag, create: create }, vx), { merge: merge, destructor: function () {
|
|
3695
|
+
return current.$destroy.bind(current);
|
|
3696
|
+
}, runOnDestroy: function (callback) {
|
|
3697
|
+
current.runOnDestroy(callback);
|
|
3698
|
+
} });
|
|
3699
|
+
|
|
3700
|
+
window.v = v;
|
|
3701
|
+
|
|
3694
3702
|
})();
|