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/cdn/es5.js
CHANGED
|
@@ -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
|
|
|
@@ -841,475 +829,194 @@ var ArrayModel = /** @class */ (function (_super) {
|
|
|
841
829
|
|
|
842
830
|
window.ArrayModel = ArrayModel;
|
|
843
831
|
|
|
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
|
-
}
|
|
832
|
+
// ./lib-es5/core/signal.js
|
|
833
|
+
/**
|
|
834
|
+
* Signal is an event generator
|
|
835
|
+
* @class Signal
|
|
836
|
+
*/
|
|
837
|
+
var Signal = /** @class */ (function () {
|
|
838
|
+
function Signal() {
|
|
839
|
+
/**
|
|
840
|
+
* Handler of event
|
|
841
|
+
* @type {Set}
|
|
842
|
+
* @private
|
|
843
|
+
*/
|
|
844
|
+
this.handlers = new Set;
|
|
868
845
|
}
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
846
|
+
/**
|
|
847
|
+
* Emit event
|
|
848
|
+
* @param a1 {*} argument
|
|
849
|
+
* @param a2 {*} argument
|
|
850
|
+
* @param a3 {*} argument
|
|
851
|
+
* @param a4 {*} argument
|
|
852
|
+
* @param a5 {*} argument
|
|
853
|
+
* @param a6 {*} argument
|
|
854
|
+
* @param a7 {*} argument
|
|
855
|
+
* @param a8 {*} argument
|
|
856
|
+
* @param a9 {*} argument
|
|
857
|
+
*/
|
|
858
|
+
Signal.prototype.emit = function (a1, a2, a3, a4, a5, a6, a7, a8, a9) {
|
|
859
|
+
this.handlers.forEach(function (handler) {
|
|
860
|
+
try {
|
|
861
|
+
handler(a1, a2, a3, a4, a5, a6, a7, a8, a9);
|
|
875
862
|
}
|
|
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
|
-
}
|
|
863
|
+
catch (e) {
|
|
864
|
+
console.error("Vasille.js: Handler throw exception: ", e);
|
|
886
865
|
}
|
|
887
866
|
});
|
|
888
|
-
}
|
|
889
|
-
|
|
867
|
+
};
|
|
868
|
+
/**
|
|
869
|
+
* Subscribe to event
|
|
870
|
+
* @param func {function} handler
|
|
871
|
+
*/
|
|
872
|
+
Signal.prototype.subscribe = function (func) {
|
|
873
|
+
this.handlers.add(func);
|
|
874
|
+
};
|
|
875
|
+
/**
|
|
876
|
+
* Unsubscribe from event
|
|
877
|
+
* @param func {function} handler
|
|
878
|
+
*/
|
|
879
|
+
Signal.prototype.unsubscribe = function (func) {
|
|
880
|
+
this.handlers.delete(func);
|
|
881
|
+
};
|
|
882
|
+
return Signal;
|
|
883
|
+
}());
|
|
890
884
|
|
|
891
|
-
window.merge = merge;
|
|
892
885
|
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
886
|
+
window.Signal = Signal;
|
|
887
|
+
|
|
888
|
+
// ./lib-es5/core/slot.js
|
|
889
|
+
/**
|
|
890
|
+
* Component slot
|
|
891
|
+
* @class Slot
|
|
892
|
+
*/
|
|
893
|
+
var Slot = /** @class */ (function () {
|
|
894
|
+
function Slot() {
|
|
895
|
+
}
|
|
896
|
+
/**
|
|
897
|
+
* Sets the runner
|
|
898
|
+
* @param func {function} the function to run
|
|
899
|
+
*/
|
|
900
|
+
Slot.prototype.insert = function (func) {
|
|
901
|
+
this.runner = func;
|
|
897
902
|
};
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
903
|
+
/**
|
|
904
|
+
* @param a0 {Fragment} node to paste content
|
|
905
|
+
* @param a1 {*} 1st argument
|
|
906
|
+
* @param a2 {*} 2nd argument
|
|
907
|
+
* @param a3 {*} 3rd argument
|
|
908
|
+
* @param a4 {*} 4th argument
|
|
909
|
+
* @param a5 {*} 5th argument
|
|
910
|
+
* @param a6 {*} 6th argument
|
|
911
|
+
* @param a7 {*} 7th argument
|
|
912
|
+
* @param a8 {*} 8th argument
|
|
913
|
+
* @param a9 {*} 9th argument
|
|
914
|
+
*/
|
|
915
|
+
Slot.prototype.release = function (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) {
|
|
916
|
+
if (this.runner) {
|
|
917
|
+
this.runner(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
|
|
918
|
+
}
|
|
911
919
|
};
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
920
|
+
/**
|
|
921
|
+
* Predefine a handler for a slot
|
|
922
|
+
* @param func {function(node : Fragment)} Function to run if no handler specified
|
|
923
|
+
* @param a0 {Fragment} node to paste content
|
|
924
|
+
* @param a1 {*} 1st argument
|
|
925
|
+
* @param a2 {*} 2nd argument
|
|
926
|
+
* @param a3 {*} 3rd argument
|
|
927
|
+
* @param a4 {*} 4th argument
|
|
928
|
+
* @param a5 {*} 5th argument
|
|
929
|
+
* @param a6 {*} 6th argument
|
|
930
|
+
* @param a7 {*} 7th argument
|
|
931
|
+
* @param a8 {*} 8th argument
|
|
932
|
+
* @param a9 {*} 9th argument
|
|
933
|
+
*/
|
|
934
|
+
Slot.prototype.predefine = function (func, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) {
|
|
935
|
+
(this.runner || func)(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
|
|
922
936
|
};
|
|
937
|
+
return Slot;
|
|
938
|
+
}());
|
|
939
|
+
|
|
940
|
+
|
|
941
|
+
window.Slot = Slot;
|
|
942
|
+
|
|
943
|
+
// ./lib-es5/core/errors.js
|
|
944
|
+
var reportIt = "Report it here: https://gitlab.com/vasille-js/vasille-js/-/issues";
|
|
945
|
+
function notOverwritten() {
|
|
946
|
+
console.error("Vasille-SFP: Internal error", "Must be overwritten", reportIt);
|
|
947
|
+
return "not-overwritten";
|
|
923
948
|
}
|
|
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
|
-
};
|
|
949
|
+
function internalError(msg) {
|
|
950
|
+
console.error("Vasille-SFP: Internal error", msg, reportIt);
|
|
951
|
+
return "internal-error";
|
|
934
952
|
}
|
|
935
|
-
function
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
return {
|
|
939
|
-
node: current.tag(name, opts, function (node) {
|
|
940
|
-
callback && node.runFunctional(callback);
|
|
941
|
-
})
|
|
942
|
-
};
|
|
953
|
+
function userError(msg, err) {
|
|
954
|
+
console.error("Vasille-SFP: User error", msg);
|
|
955
|
+
return err;
|
|
943
956
|
}
|
|
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;
|
|
957
|
+
function wrongBinding(msg) {
|
|
958
|
+
return userError(msg, "wrong-binding");
|
|
1119
959
|
}
|
|
1120
960
|
|
|
1121
|
-
window.
|
|
1122
|
-
window.
|
|
1123
|
-
window.
|
|
961
|
+
window.notOverwritten = notOverwritten;
|
|
962
|
+
window.internalError = internalError;
|
|
963
|
+
window.userError = userError;
|
|
964
|
+
window.wrongBinding = wrongBinding;
|
|
1124
965
|
|
|
1125
|
-
// ./lib-es5/core/
|
|
966
|
+
// ./lib-es5/core/executor.js
|
|
1126
967
|
/**
|
|
1127
|
-
*
|
|
1128
|
-
* @class
|
|
968
|
+
* Represents an executor unit interface
|
|
969
|
+
* @class Executor
|
|
1129
970
|
*/
|
|
1130
|
-
var
|
|
1131
|
-
function
|
|
1132
|
-
/**
|
|
1133
|
-
* Handler of event
|
|
1134
|
-
* @type {Set}
|
|
1135
|
-
* @private
|
|
1136
|
-
*/
|
|
1137
|
-
this.handlers = new Set;
|
|
971
|
+
var Executor = /** @class */ (function () {
|
|
972
|
+
function Executor() {
|
|
1138
973
|
}
|
|
1139
974
|
/**
|
|
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
|
|
975
|
+
* Adds a CSS class
|
|
976
|
+
* @param el {Element} element to manipulate
|
|
977
|
+
* @param cl {string} class to be added
|
|
1150
978
|
*/
|
|
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
|
-
});
|
|
979
|
+
Executor.prototype.addClass = function (el, cl) {
|
|
980
|
+
throw notOverwritten();
|
|
1160
981
|
};
|
|
1161
982
|
/**
|
|
1162
|
-
*
|
|
1163
|
-
* @param
|
|
983
|
+
* Removes a CSS class
|
|
984
|
+
* @param el {Element} element to manipulate
|
|
985
|
+
* @param cl {string} class to be removed
|
|
1164
986
|
*/
|
|
1165
|
-
|
|
1166
|
-
|
|
987
|
+
Executor.prototype.removeClass = function (el, cl) {
|
|
988
|
+
throw notOverwritten();
|
|
1167
989
|
};
|
|
1168
990
|
/**
|
|
1169
|
-
*
|
|
1170
|
-
* @param
|
|
991
|
+
* Sets a tag attribute
|
|
992
|
+
* @param el {Element} element to manipulate
|
|
993
|
+
* @param name {string} name of attribute
|
|
994
|
+
* @param value {string} value of attribute
|
|
1171
995
|
*/
|
|
1172
|
-
|
|
1173
|
-
|
|
996
|
+
Executor.prototype.setAttribute = function (el, name, value) {
|
|
997
|
+
throw notOverwritten();
|
|
1174
998
|
};
|
|
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
999
|
/**
|
|
1190
|
-
*
|
|
1191
|
-
* @param
|
|
1000
|
+
* Removes a tag attribute
|
|
1001
|
+
* @param el {Element} element to manipulate
|
|
1002
|
+
* @param name {string} name of attribute
|
|
1192
1003
|
*/
|
|
1193
|
-
|
|
1194
|
-
|
|
1004
|
+
Executor.prototype.removeAttribute = function (el, name) {
|
|
1005
|
+
throw notOverwritten();
|
|
1195
1006
|
};
|
|
1196
1007
|
/**
|
|
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
|
|
1008
|
+
* Sets a style attribute
|
|
1009
|
+
* @param el {HTMLElement} element to manipulate
|
|
1010
|
+
* @param prop {string} property name
|
|
1011
|
+
* @param value {string} property value
|
|
1207
1012
|
*/
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
this.runner(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
|
|
1211
|
-
}
|
|
1013
|
+
Executor.prototype.setStyle = function (el, prop, value) {
|
|
1014
|
+
throw notOverwritten();
|
|
1212
1015
|
};
|
|
1213
1016
|
/**
|
|
1214
|
-
*
|
|
1215
|
-
* @param
|
|
1216
|
-
* @param
|
|
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
|
|
1305
|
-
*/
|
|
1306
|
-
Executor.prototype.setStyle = function (el, prop, value) {
|
|
1307
|
-
throw notOverwritten();
|
|
1308
|
-
};
|
|
1309
|
-
/**
|
|
1310
|
-
* Inserts a child before target
|
|
1311
|
-
* @param target {Element} target element
|
|
1312
|
-
* @param child {Node} element to insert before
|
|
1017
|
+
* Inserts a child before target
|
|
1018
|
+
* @param target {Element} target element
|
|
1019
|
+
* @param child {Node} element to insert before
|
|
1313
1020
|
*/
|
|
1314
1021
|
Executor.prototype.insertBefore = function (target, child) {
|
|
1315
1022
|
throw notOverwritten();
|
|
@@ -1452,7 +1159,7 @@ var Destroyable = /** @class */ (function () {
|
|
|
1452
1159
|
* Make object fields non configurable
|
|
1453
1160
|
* @protected
|
|
1454
1161
|
*/
|
|
1455
|
-
Destroyable.prototype
|
|
1162
|
+
Destroyable.prototype.$seal = function () {
|
|
1456
1163
|
var _this = this;
|
|
1457
1164
|
var $ = this;
|
|
1458
1165
|
Object.keys($).forEach(function (i) {
|
|
@@ -1485,7 +1192,7 @@ var Destroyable = /** @class */ (function () {
|
|
|
1485
1192
|
/**
|
|
1486
1193
|
* Garbage collector method
|
|
1487
1194
|
*/
|
|
1488
|
-
Destroyable.prototype
|
|
1195
|
+
Destroyable.prototype.$destroy = function () {
|
|
1489
1196
|
// nothing here
|
|
1490
1197
|
};
|
|
1491
1198
|
return Destroyable;
|
|
@@ -1503,13 +1210,13 @@ var Switchable = /** @class */ (function (_super) {
|
|
|
1503
1210
|
/**
|
|
1504
1211
|
* Enable update handlers triggering
|
|
1505
1212
|
*/
|
|
1506
|
-
Switchable.prototype
|
|
1213
|
+
Switchable.prototype.$enable = function () {
|
|
1507
1214
|
throw notOverwritten();
|
|
1508
1215
|
};
|
|
1509
1216
|
/**
|
|
1510
1217
|
* disable update handlers triggering
|
|
1511
1218
|
*/
|
|
1512
|
-
Switchable.prototype
|
|
1219
|
+
Switchable.prototype.$disable = function () {
|
|
1513
1220
|
throw notOverwritten();
|
|
1514
1221
|
};
|
|
1515
1222
|
return Switchable;
|
|
@@ -1552,14 +1259,14 @@ var IValue = /** @class */ (function (_super) {
|
|
|
1552
1259
|
* Add a new handler to value change
|
|
1553
1260
|
* @param handler {function(value : *)} the handler to add
|
|
1554
1261
|
*/
|
|
1555
|
-
IValue.prototype
|
|
1262
|
+
IValue.prototype.$on = function (handler) {
|
|
1556
1263
|
throw notOverwritten();
|
|
1557
1264
|
};
|
|
1558
1265
|
/**
|
|
1559
1266
|
* Removes a handler of value change
|
|
1560
1267
|
* @param handler {function(value : *)} the handler to remove
|
|
1561
1268
|
*/
|
|
1562
|
-
IValue.prototype
|
|
1269
|
+
IValue.prototype.$off = function (handler) {
|
|
1563
1270
|
throw notOverwritten();
|
|
1564
1271
|
};
|
|
1565
1272
|
return IValue;
|
|
@@ -1626,12 +1333,12 @@ var Expression = /** @class */ (function (_super) {
|
|
|
1626
1333
|
_this.values = values;
|
|
1627
1334
|
_this.func = handler;
|
|
1628
1335
|
if (link) {
|
|
1629
|
-
_this
|
|
1336
|
+
_this.$enable();
|
|
1630
1337
|
}
|
|
1631
1338
|
else {
|
|
1632
1339
|
handler();
|
|
1633
1340
|
}
|
|
1634
|
-
_this
|
|
1341
|
+
_this.$seal();
|
|
1635
1342
|
return _this;
|
|
1636
1343
|
}
|
|
1637
1344
|
Object.defineProperty(Expression.prototype, "$", {
|
|
@@ -1644,18 +1351,18 @@ var Expression = /** @class */ (function (_super) {
|
|
|
1644
1351
|
enumerable: false,
|
|
1645
1352
|
configurable: true
|
|
1646
1353
|
});
|
|
1647
|
-
Expression.prototype
|
|
1648
|
-
this.sync
|
|
1354
|
+
Expression.prototype.$on = function (handler) {
|
|
1355
|
+
this.sync.$on(handler);
|
|
1649
1356
|
return this;
|
|
1650
1357
|
};
|
|
1651
|
-
Expression.prototype
|
|
1652
|
-
this.sync
|
|
1358
|
+
Expression.prototype.$off = function (handler) {
|
|
1359
|
+
this.sync.$off(handler);
|
|
1653
1360
|
return this;
|
|
1654
1361
|
};
|
|
1655
|
-
Expression.prototype
|
|
1362
|
+
Expression.prototype.$enable = function () {
|
|
1656
1363
|
if (!this.isEnabled) {
|
|
1657
1364
|
for (var i = 0; i < this.values.length; i++) {
|
|
1658
|
-
this.values[i]
|
|
1365
|
+
this.values[i].$on(this.linkedFunc[i]);
|
|
1659
1366
|
this.valuesCache[i] = this.values[i].$;
|
|
1660
1367
|
}
|
|
1661
1368
|
this.func();
|
|
@@ -1663,21 +1370,21 @@ var Expression = /** @class */ (function (_super) {
|
|
|
1663
1370
|
}
|
|
1664
1371
|
return this;
|
|
1665
1372
|
};
|
|
1666
|
-
Expression.prototype
|
|
1373
|
+
Expression.prototype.$disable = function () {
|
|
1667
1374
|
if (this.isEnabled) {
|
|
1668
1375
|
for (var i = 0; i < this.values.length; i++) {
|
|
1669
|
-
this.values[i]
|
|
1376
|
+
this.values[i].$off(this.linkedFunc[i]);
|
|
1670
1377
|
}
|
|
1671
1378
|
this.isEnabled = false;
|
|
1672
1379
|
}
|
|
1673
1380
|
return this;
|
|
1674
1381
|
};
|
|
1675
|
-
Expression.prototype
|
|
1676
|
-
this
|
|
1382
|
+
Expression.prototype.$destroy = function () {
|
|
1383
|
+
this.$disable();
|
|
1677
1384
|
this.values.splice(0);
|
|
1678
1385
|
this.valuesCache.splice(0);
|
|
1679
1386
|
this.linkedFunc.splice(0);
|
|
1680
|
-
_super.prototype
|
|
1387
|
+
_super.prototype.$destroy.call(this);
|
|
1681
1388
|
};
|
|
1682
1389
|
return Expression;
|
|
1683
1390
|
}(IValue));
|
|
@@ -1698,20 +1405,20 @@ var Reference = /** @class */ (function (_super) {
|
|
|
1698
1405
|
*/
|
|
1699
1406
|
function Reference(value) {
|
|
1700
1407
|
var _this = _super.call(this, true) || this;
|
|
1701
|
-
_this
|
|
1702
|
-
_this
|
|
1703
|
-
_this
|
|
1408
|
+
_this.$value = value;
|
|
1409
|
+
_this.$onchange = new Set;
|
|
1410
|
+
_this.$seal();
|
|
1704
1411
|
return _this;
|
|
1705
1412
|
}
|
|
1706
1413
|
Object.defineProperty(Reference.prototype, "$", {
|
|
1707
1414
|
get: function () {
|
|
1708
|
-
return this
|
|
1415
|
+
return this.$value;
|
|
1709
1416
|
},
|
|
1710
1417
|
set: function (value) {
|
|
1711
|
-
if (this
|
|
1712
|
-
this
|
|
1418
|
+
if (this.$value !== value) {
|
|
1419
|
+
this.$value = value;
|
|
1713
1420
|
if (this.isEnabled) {
|
|
1714
|
-
this
|
|
1421
|
+
this.$onchange.forEach(function (handler) {
|
|
1715
1422
|
handler(value);
|
|
1716
1423
|
});
|
|
1717
1424
|
}
|
|
@@ -1720,27 +1427,27 @@ var Reference = /** @class */ (function (_super) {
|
|
|
1720
1427
|
enumerable: false,
|
|
1721
1428
|
configurable: true
|
|
1722
1429
|
});
|
|
1723
|
-
Reference.prototype
|
|
1430
|
+
Reference.prototype.$enable = function () {
|
|
1724
1431
|
var _this = this;
|
|
1725
1432
|
if (!this.isEnabled) {
|
|
1726
|
-
this
|
|
1727
|
-
handler(_this
|
|
1433
|
+
this.$onchange.forEach(function (handler) {
|
|
1434
|
+
handler(_this.$value);
|
|
1728
1435
|
});
|
|
1729
1436
|
this.isEnabled = true;
|
|
1730
1437
|
}
|
|
1731
1438
|
};
|
|
1732
|
-
Reference.prototype
|
|
1439
|
+
Reference.prototype.$disable = function () {
|
|
1733
1440
|
this.isEnabled = false;
|
|
1734
1441
|
};
|
|
1735
|
-
Reference.prototype
|
|
1736
|
-
this
|
|
1442
|
+
Reference.prototype.$on = function (handler) {
|
|
1443
|
+
this.$onchange.add(handler);
|
|
1737
1444
|
};
|
|
1738
|
-
Reference.prototype
|
|
1739
|
-
this
|
|
1445
|
+
Reference.prototype.$off = function (handler) {
|
|
1446
|
+
this.$onchange.delete(handler);
|
|
1740
1447
|
};
|
|
1741
|
-
Reference.prototype
|
|
1742
|
-
_super.prototype
|
|
1743
|
-
this
|
|
1448
|
+
Reference.prototype.$destroy = function () {
|
|
1449
|
+
_super.prototype.$destroy.call(this);
|
|
1450
|
+
this.$onchange.clear();
|
|
1744
1451
|
};
|
|
1745
1452
|
return Reference;
|
|
1746
1453
|
}(IValue));
|
|
@@ -1765,13 +1472,13 @@ var Mirror = /** @class */ (function (_super) {
|
|
|
1765
1472
|
function Mirror(value, forwardOnly) {
|
|
1766
1473
|
if (forwardOnly === void 0) { forwardOnly = false; }
|
|
1767
1474
|
var _this = _super.call(this, value.$) || this;
|
|
1768
|
-
_this
|
|
1475
|
+
_this.$handler = function (v) {
|
|
1769
1476
|
_this.$ = v;
|
|
1770
1477
|
};
|
|
1771
|
-
_this
|
|
1772
|
-
_this
|
|
1773
|
-
value
|
|
1774
|
-
_this
|
|
1478
|
+
_this.$pointedValue = value;
|
|
1479
|
+
_this.$forwardOnly = forwardOnly;
|
|
1480
|
+
value.$on(_this.$handler);
|
|
1481
|
+
_this.$seal();
|
|
1775
1482
|
return _this;
|
|
1776
1483
|
}
|
|
1777
1484
|
Object.defineProperty(Mirror.prototype, "$", {
|
|
@@ -1782,8 +1489,8 @@ var Mirror = /** @class */ (function (_super) {
|
|
|
1782
1489
|
return _super.prototype.$;
|
|
1783
1490
|
},
|
|
1784
1491
|
set: function (v) {
|
|
1785
|
-
if (!this
|
|
1786
|
-
this
|
|
1492
|
+
if (!this.$forwardOnly) {
|
|
1493
|
+
this.$pointedValue.$ = v;
|
|
1787
1494
|
}
|
|
1788
1495
|
// this is a ts bug
|
|
1789
1496
|
// eslint-disable-next-line
|
|
@@ -1793,22 +1500,22 @@ var Mirror = /** @class */ (function (_super) {
|
|
|
1793
1500
|
enumerable: false,
|
|
1794
1501
|
configurable: true
|
|
1795
1502
|
});
|
|
1796
|
-
Mirror.prototype
|
|
1503
|
+
Mirror.prototype.$enable = function () {
|
|
1797
1504
|
if (!this.isEnabled) {
|
|
1798
1505
|
this.isEnabled = true;
|
|
1799
|
-
this
|
|
1800
|
-
this.$ = this
|
|
1506
|
+
this.$pointedValue.$on(this.$handler);
|
|
1507
|
+
this.$ = this.$pointedValue.$;
|
|
1801
1508
|
}
|
|
1802
1509
|
};
|
|
1803
|
-
Mirror.prototype
|
|
1510
|
+
Mirror.prototype.$disable = function () {
|
|
1804
1511
|
if (this.isEnabled) {
|
|
1805
|
-
this
|
|
1512
|
+
this.$pointedValue.$off(this.$handler);
|
|
1806
1513
|
this.isEnabled = false;
|
|
1807
1514
|
}
|
|
1808
1515
|
};
|
|
1809
|
-
Mirror.prototype
|
|
1810
|
-
this
|
|
1811
|
-
_super.prototype
|
|
1516
|
+
Mirror.prototype.$destroy = function () {
|
|
1517
|
+
this.$disable();
|
|
1518
|
+
_super.prototype.$destroy.call(this);
|
|
1812
1519
|
};
|
|
1813
1520
|
return Mirror;
|
|
1814
1521
|
}(Reference));
|
|
@@ -1832,17 +1539,21 @@ var Pointer = /** @class */ (function (_super) {
|
|
|
1832
1539
|
if (forwardOnly === void 0) { forwardOnly = false; }
|
|
1833
1540
|
return _super.call(this, value, forwardOnly) || this;
|
|
1834
1541
|
}
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
this
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1542
|
+
Object.defineProperty(Pointer.prototype, "$$", {
|
|
1543
|
+
/**
|
|
1544
|
+
* Point a new ivalue
|
|
1545
|
+
* @param value {IValue} value to point
|
|
1546
|
+
*/
|
|
1547
|
+
set: function (value) {
|
|
1548
|
+
if (this.$pointedValue !== value) {
|
|
1549
|
+
this.$disable();
|
|
1550
|
+
this.$pointedValue = value;
|
|
1551
|
+
this.$enable();
|
|
1552
|
+
}
|
|
1553
|
+
},
|
|
1554
|
+
enumerable: false,
|
|
1555
|
+
configurable: true
|
|
1556
|
+
});
|
|
1846
1557
|
return Pointer;
|
|
1847
1558
|
}(Mirror));
|
|
1848
1559
|
|
|
@@ -1864,20 +1575,20 @@ var Binding = /** @class */ (function (_super) {
|
|
|
1864
1575
|
function Binding(value) {
|
|
1865
1576
|
var _this = this; _super.call(this);
|
|
1866
1577
|
_this.binding = value;
|
|
1867
|
-
_this
|
|
1578
|
+
_this.$seal();
|
|
1868
1579
|
return _this;
|
|
1869
1580
|
}
|
|
1870
1581
|
Binding.prototype.init = function (bounded) {
|
|
1871
1582
|
this.func = bounded;
|
|
1872
|
-
this.binding
|
|
1583
|
+
this.binding.$on(this.func);
|
|
1873
1584
|
this.func(this.binding.$);
|
|
1874
1585
|
};
|
|
1875
1586
|
/**
|
|
1876
1587
|
* Just clear bindings
|
|
1877
1588
|
*/
|
|
1878
|
-
Binding.prototype
|
|
1879
|
-
this.binding
|
|
1880
|
-
_super.prototype
|
|
1589
|
+
Binding.prototype.$destroy = function () {
|
|
1590
|
+
this.binding.$off(this.func);
|
|
1591
|
+
_super.prototype.$destroy.call(this);
|
|
1881
1592
|
};
|
|
1882
1593
|
return Binding;
|
|
1883
1594
|
}(Destroyable));
|
|
@@ -1928,19 +1639,19 @@ var ReactivePrivate = /** @class */ (function (_super) {
|
|
|
1928
1639
|
* @type {boolean}
|
|
1929
1640
|
*/
|
|
1930
1641
|
_this.frozen = false;
|
|
1931
|
-
_this
|
|
1642
|
+
_this.$seal();
|
|
1932
1643
|
return _this;
|
|
1933
1644
|
}
|
|
1934
|
-
ReactivePrivate.prototype
|
|
1935
|
-
this.watch.forEach(function (value) { return value
|
|
1645
|
+
ReactivePrivate.prototype.$destroy = function () {
|
|
1646
|
+
this.watch.forEach(function (value) { return value.$destroy(); });
|
|
1936
1647
|
this.watch.clear();
|
|
1937
|
-
this.bindings.forEach(function (binding) { return binding
|
|
1648
|
+
this.bindings.forEach(function (binding) { return binding.$destroy(); });
|
|
1938
1649
|
this.bindings.clear();
|
|
1939
1650
|
this.models.forEach(function (model) { return model.disableReactivity(); });
|
|
1940
1651
|
this.models.clear();
|
|
1941
|
-
this.freezeExpr && this.freezeExpr
|
|
1652
|
+
this.freezeExpr && this.freezeExpr.$destroy();
|
|
1942
1653
|
this.onDestroy && this.onDestroy();
|
|
1943
|
-
_super.prototype
|
|
1654
|
+
_super.prototype.$destroy.call(this);
|
|
1944
1655
|
};
|
|
1945
1656
|
return ReactivePrivate;
|
|
1946
1657
|
}(Destroyable));
|
|
@@ -1956,7 +1667,7 @@ var Reactive = /** @class */ (function (_super) {
|
|
|
1956
1667
|
var _this = this; _super.call(this);
|
|
1957
1668
|
_this.input = input;
|
|
1958
1669
|
_this.$ = $ || new ReactivePrivate;
|
|
1959
|
-
_this
|
|
1670
|
+
_this.$seal();
|
|
1960
1671
|
return _this;
|
|
1961
1672
|
}
|
|
1962
1673
|
Object.defineProperty(Reactive.prototype, "parent", {
|
|
@@ -2053,7 +1764,7 @@ var Reactive = /** @class */ (function (_super) {
|
|
|
2053
1764
|
var $ = this.$;
|
|
2054
1765
|
if (!$.enabled) {
|
|
2055
1766
|
$.watch.forEach(function (watcher) {
|
|
2056
|
-
watcher
|
|
1767
|
+
watcher.$enable();
|
|
2057
1768
|
});
|
|
2058
1769
|
$.models.forEach(function (model) {
|
|
2059
1770
|
model.enableReactivity();
|
|
@@ -2068,7 +1779,7 @@ var Reactive = /** @class */ (function (_super) {
|
|
|
2068
1779
|
var $ = this.$;
|
|
2069
1780
|
if ($.enabled) {
|
|
2070
1781
|
$.watch.forEach(function (watcher) {
|
|
2071
|
-
watcher
|
|
1782
|
+
watcher.$disable();
|
|
2072
1783
|
});
|
|
2073
1784
|
$.models.forEach(function (model) {
|
|
2074
1785
|
model.disableReactivity();
|
|
@@ -2136,9 +1847,9 @@ var Reactive = /** @class */ (function (_super) {
|
|
|
2136
1847
|
Reactive.prototype.runOnDestroy = function (func) {
|
|
2137
1848
|
this.$.onDestroy = func;
|
|
2138
1849
|
};
|
|
2139
|
-
Reactive.prototype
|
|
2140
|
-
_super.prototype
|
|
2141
|
-
this
|
|
1850
|
+
Reactive.prototype.$destroy = function () {
|
|
1851
|
+
_super.prototype.$destroy.call(this);
|
|
1852
|
+
this.$.$destroy();
|
|
2142
1853
|
this.$ = null;
|
|
2143
1854
|
};
|
|
2144
1855
|
return Reactive;
|
|
@@ -2159,7 +1870,7 @@ var FragmentPrivate = /** @class */ (function (_super) {
|
|
|
2159
1870
|
__extends(FragmentPrivate, _super);
|
|
2160
1871
|
function FragmentPrivate() {
|
|
2161
1872
|
var _this = this; _super.call(this);
|
|
2162
|
-
_this
|
|
1873
|
+
_this.$seal();
|
|
2163
1874
|
return _this;
|
|
2164
1875
|
}
|
|
2165
1876
|
/**
|
|
@@ -2174,10 +1885,10 @@ var FragmentPrivate = /** @class */ (function (_super) {
|
|
|
2174
1885
|
/**
|
|
2175
1886
|
* Unlinks all bindings
|
|
2176
1887
|
*/
|
|
2177
|
-
FragmentPrivate.prototype
|
|
1888
|
+
FragmentPrivate.prototype.$destroy = function () {
|
|
2178
1889
|
this.next = null;
|
|
2179
1890
|
this.prev = null;
|
|
2180
|
-
_super.prototype
|
|
1891
|
+
_super.prototype.$destroy.call(this);
|
|
2181
1892
|
};
|
|
2182
1893
|
return FragmentPrivate;
|
|
2183
1894
|
}(ReactivePrivate));
|
|
@@ -2408,14 +2119,14 @@ var Fragment = /** @class */ (function (_super) {
|
|
|
2408
2119
|
$.prev.$.next = $.next;
|
|
2409
2120
|
}
|
|
2410
2121
|
};
|
|
2411
|
-
Fragment.prototype
|
|
2412
|
-
this.children.forEach(function (child) { return child
|
|
2122
|
+
Fragment.prototype.$destroy = function () {
|
|
2123
|
+
this.children.forEach(function (child) { return child.$destroy(); });
|
|
2413
2124
|
this.children.clear();
|
|
2414
2125
|
this.lastChild = null;
|
|
2415
2126
|
if (this.$.parent.lastChild === this) {
|
|
2416
2127
|
this.$.parent.lastChild = this.$.prev;
|
|
2417
2128
|
}
|
|
2418
|
-
_super.prototype
|
|
2129
|
+
_super.prototype.$destroy.call(this);
|
|
2419
2130
|
};
|
|
2420
2131
|
return Fragment;
|
|
2421
2132
|
}(Reactive));
|
|
@@ -2430,7 +2141,7 @@ var TextNodePrivate = /** @class */ (function (_super) {
|
|
|
2430
2141
|
__extends(TextNodePrivate, _super);
|
|
2431
2142
|
function TextNodePrivate() {
|
|
2432
2143
|
var _this = this; _super.call(this);
|
|
2433
|
-
_this
|
|
2144
|
+
_this.$seal();
|
|
2434
2145
|
return _this;
|
|
2435
2146
|
}
|
|
2436
2147
|
/**
|
|
@@ -2452,8 +2163,8 @@ var TextNodePrivate = /** @class */ (function (_super) {
|
|
|
2452
2163
|
/**
|
|
2453
2164
|
* Clear node data
|
|
2454
2165
|
*/
|
|
2455
|
-
TextNodePrivate.prototype
|
|
2456
|
-
_super.prototype
|
|
2166
|
+
TextNodePrivate.prototype.$destroy = function () {
|
|
2167
|
+
_super.prototype.$destroy.call(this);
|
|
2457
2168
|
};
|
|
2458
2169
|
return TextNodePrivate;
|
|
2459
2170
|
}(FragmentPrivate));
|
|
@@ -2468,7 +2179,7 @@ var TextNode = /** @class */ (function (_super) {
|
|
|
2468
2179
|
function TextNode($) {
|
|
2469
2180
|
if ($ === void 0) { $ = new TextNodePrivate(); }
|
|
2470
2181
|
var _this = _super.call(this, {}, $) || this;
|
|
2471
|
-
_this
|
|
2182
|
+
_this.$seal();
|
|
2472
2183
|
return _this;
|
|
2473
2184
|
}
|
|
2474
2185
|
TextNode.prototype.preinit = function (app, parent, text) {
|
|
@@ -2482,10 +2193,10 @@ var TextNode = /** @class */ (function (_super) {
|
|
|
2482
2193
|
TextNode.prototype.findFirstChild = function () {
|
|
2483
2194
|
return this.$.node;
|
|
2484
2195
|
};
|
|
2485
|
-
TextNode.prototype
|
|
2196
|
+
TextNode.prototype.$destroy = function () {
|
|
2486
2197
|
this.$.node.remove();
|
|
2487
|
-
this
|
|
2488
|
-
_super.prototype
|
|
2198
|
+
this.$.$destroy();
|
|
2199
|
+
_super.prototype.$destroy.call(this);
|
|
2489
2200
|
};
|
|
2490
2201
|
return TextNode;
|
|
2491
2202
|
}(Fragment));
|
|
@@ -2504,11 +2215,11 @@ var INodePrivate = /** @class */ (function (_super) {
|
|
|
2504
2215
|
* @type {boolean}
|
|
2505
2216
|
*/
|
|
2506
2217
|
_this.unmounted = false;
|
|
2507
|
-
_this
|
|
2218
|
+
_this.$seal();
|
|
2508
2219
|
return _this;
|
|
2509
2220
|
}
|
|
2510
|
-
INodePrivate.prototype
|
|
2511
|
-
_super.prototype
|
|
2221
|
+
INodePrivate.prototype.$destroy = function () {
|
|
2222
|
+
_super.prototype.$destroy.call(this);
|
|
2512
2223
|
};
|
|
2513
2224
|
return INodePrivate;
|
|
2514
2225
|
}(FragmentPrivate));
|
|
@@ -2527,7 +2238,7 @@ var INode = /** @class */ (function (_super) {
|
|
|
2527
2238
|
*/
|
|
2528
2239
|
function INode(input, $) {
|
|
2529
2240
|
var _this = _super.call(this, input, $ || new INodePrivate) || this;
|
|
2530
|
-
_this
|
|
2241
|
+
_this.$seal();
|
|
2531
2242
|
return _this;
|
|
2532
2243
|
}
|
|
2533
2244
|
Object.defineProperty(INode.prototype, "node", {
|
|
@@ -2779,7 +2490,7 @@ var Tag = /** @class */ (function (_super) {
|
|
|
2779
2490
|
__extends(Tag, _super);
|
|
2780
2491
|
function Tag(input) {
|
|
2781
2492
|
var _this = _super.call(this, input) || this;
|
|
2782
|
-
_this
|
|
2493
|
+
_this.$seal();
|
|
2783
2494
|
return _this;
|
|
2784
2495
|
}
|
|
2785
2496
|
Tag.prototype.preinit = function (app, parent, tagName) {
|
|
@@ -2834,9 +2545,9 @@ var Tag = /** @class */ (function (_super) {
|
|
|
2834
2545
|
/**
|
|
2835
2546
|
* Runs GC
|
|
2836
2547
|
*/
|
|
2837
|
-
Tag.prototype
|
|
2548
|
+
Tag.prototype.$destroy = function () {
|
|
2838
2549
|
this.node.remove();
|
|
2839
|
-
_super.prototype
|
|
2550
|
+
_super.prototype.$destroy.call(this);
|
|
2840
2551
|
};
|
|
2841
2552
|
return Tag;
|
|
2842
2553
|
}(INode));
|
|
@@ -2865,8 +2576,8 @@ var Extension = /** @class */ (function (_super) {
|
|
|
2865
2576
|
throw userError("A extension node can be encapsulated only in a tag/extension/component", "virtual-dom");
|
|
2866
2577
|
}
|
|
2867
2578
|
};
|
|
2868
|
-
Extension.prototype
|
|
2869
|
-
_super.prototype
|
|
2579
|
+
Extension.prototype.$destroy = function () {
|
|
2580
|
+
_super.prototype.$destroy.call(this);
|
|
2870
2581
|
};
|
|
2871
2582
|
return Extension;
|
|
2872
2583
|
}(INode));
|
|
@@ -2920,19 +2631,19 @@ var SwitchedNodePrivate = /** @class */ (function (_super) {
|
|
|
2920
2631
|
* @type {Array<{cond : IValue<boolean>, cb : function(Fragment)}>}
|
|
2921
2632
|
*/
|
|
2922
2633
|
_this.cases = [];
|
|
2923
|
-
_this
|
|
2634
|
+
_this.$seal();
|
|
2924
2635
|
return _this;
|
|
2925
2636
|
}
|
|
2926
2637
|
/**
|
|
2927
2638
|
* Runs GC
|
|
2928
2639
|
*/
|
|
2929
|
-
SwitchedNodePrivate.prototype
|
|
2640
|
+
SwitchedNodePrivate.prototype.$destroy = function () {
|
|
2930
2641
|
this.cases.forEach(function (c) {
|
|
2931
2642
|
delete c.cond;
|
|
2932
2643
|
delete c.cb;
|
|
2933
2644
|
});
|
|
2934
2645
|
this.cases.splice(0);
|
|
2935
|
-
_super.prototype
|
|
2646
|
+
_super.prototype.$destroy.call(this);
|
|
2936
2647
|
};
|
|
2937
2648
|
return SwitchedNodePrivate;
|
|
2938
2649
|
}(FragmentPrivate));
|
|
@@ -2959,7 +2670,7 @@ var SwitchedNode = /** @class */ (function (_super) {
|
|
|
2959
2670
|
return;
|
|
2960
2671
|
}
|
|
2961
2672
|
if (_this.lastChild) {
|
|
2962
|
-
_this.lastChild
|
|
2673
|
+
_this.lastChild.$destroy();
|
|
2963
2674
|
_this.children.clear();
|
|
2964
2675
|
_this.lastChild = null;
|
|
2965
2676
|
}
|
|
@@ -2971,12 +2682,12 @@ var SwitchedNode = /** @class */ (function (_super) {
|
|
|
2971
2682
|
$.index = -1;
|
|
2972
2683
|
}
|
|
2973
2684
|
};
|
|
2974
|
-
_this
|
|
2685
|
+
_this.$seal();
|
|
2975
2686
|
return _this;
|
|
2976
2687
|
}
|
|
2977
2688
|
SwitchedNode.prototype.addCase = function (case_) {
|
|
2978
2689
|
this.$.cases.push(case_);
|
|
2979
|
-
case_.cond
|
|
2690
|
+
case_.cond.$on(this.$.sync);
|
|
2980
2691
|
this.$.sync();
|
|
2981
2692
|
};
|
|
2982
2693
|
/**
|
|
@@ -2994,16 +2705,16 @@ var SwitchedNode = /** @class */ (function (_super) {
|
|
|
2994
2705
|
SwitchedNode.prototype.ready = function () {
|
|
2995
2706
|
var $ = this.$;
|
|
2996
2707
|
$.cases.forEach(function (c) {
|
|
2997
|
-
c.cond
|
|
2708
|
+
c.cond.$on($.sync);
|
|
2998
2709
|
});
|
|
2999
2710
|
$.sync();
|
|
3000
2711
|
};
|
|
3001
|
-
SwitchedNode.prototype
|
|
2712
|
+
SwitchedNode.prototype.$destroy = function () {
|
|
3002
2713
|
var $ = this.$;
|
|
3003
2714
|
$.cases.forEach(function (c) {
|
|
3004
|
-
c.cond
|
|
2715
|
+
c.cond.$off($.sync);
|
|
3005
2716
|
});
|
|
3006
|
-
_super.prototype
|
|
2717
|
+
_super.prototype.$destroy.call(this);
|
|
3007
2718
|
};
|
|
3008
2719
|
return SwitchedNode;
|
|
3009
2720
|
}(Fragment));
|
|
@@ -3015,7 +2726,7 @@ var DebugPrivate = /** @class */ (function (_super) {
|
|
|
3015
2726
|
__extends(DebugPrivate, _super);
|
|
3016
2727
|
function DebugPrivate() {
|
|
3017
2728
|
var _this = this; _super.call(this);
|
|
3018
|
-
_this
|
|
2729
|
+
_this.$seal();
|
|
3019
2730
|
return _this;
|
|
3020
2731
|
}
|
|
3021
2732
|
/**
|
|
@@ -3036,9 +2747,9 @@ var DebugPrivate = /** @class */ (function (_super) {
|
|
|
3036
2747
|
/**
|
|
3037
2748
|
* Clear node data
|
|
3038
2749
|
*/
|
|
3039
|
-
DebugPrivate.prototype
|
|
2750
|
+
DebugPrivate.prototype.$destroy = function () {
|
|
3040
2751
|
this.node.remove();
|
|
3041
|
-
_super.prototype
|
|
2752
|
+
_super.prototype.$destroy.call(this);
|
|
3042
2753
|
};
|
|
3043
2754
|
return DebugPrivate;
|
|
3044
2755
|
}(FragmentPrivate));
|
|
@@ -3057,7 +2768,7 @@ var DebugNode = /** @class */ (function (_super) {
|
|
|
3057
2768
|
* @type {DebugNode}
|
|
3058
2769
|
*/
|
|
3059
2770
|
_this.$ = new DebugPrivate();
|
|
3060
|
-
_this
|
|
2771
|
+
_this.$seal();
|
|
3061
2772
|
return _this;
|
|
3062
2773
|
}
|
|
3063
2774
|
DebugNode.prototype.preinit = function (app, parent, text) {
|
|
@@ -3070,9 +2781,9 @@ var DebugNode = /** @class */ (function (_super) {
|
|
|
3070
2781
|
/**
|
|
3071
2782
|
* Runs garbage collector
|
|
3072
2783
|
*/
|
|
3073
|
-
DebugNode.prototype
|
|
3074
|
-
this
|
|
3075
|
-
_super.prototype
|
|
2784
|
+
DebugNode.prototype.$destroy = function () {
|
|
2785
|
+
this.$.$destroy();
|
|
2786
|
+
_super.prototype.$destroy.call(this);
|
|
3076
2787
|
};
|
|
3077
2788
|
return DebugNode;
|
|
3078
2789
|
}(Fragment));
|
|
@@ -3106,7 +2817,7 @@ var AppNode = /** @class */ (function (_super) {
|
|
|
3106
2817
|
function AppNode(input) {
|
|
3107
2818
|
var _this = _super.call(this, input) || this;
|
|
3108
2819
|
_this.debugUi = input.debugUi || false;
|
|
3109
|
-
_this
|
|
2820
|
+
_this.$seal();
|
|
3110
2821
|
return _this;
|
|
3111
2822
|
}
|
|
3112
2823
|
return AppNode;
|
|
@@ -3129,7 +2840,7 @@ var App = /** @class */ (function (_super) {
|
|
|
3129
2840
|
_this.$.node = node;
|
|
3130
2841
|
_this.preinit(_this, _this);
|
|
3131
2842
|
_this.init();
|
|
3132
|
-
_this
|
|
2843
|
+
_this.$seal();
|
|
3133
2844
|
return _this;
|
|
3134
2845
|
}
|
|
3135
2846
|
App.prototype.appendNode = function (node) {
|
|
@@ -3143,7 +2854,7 @@ var Portal = /** @class */ (function (_super) {
|
|
|
3143
2854
|
function Portal(input) {
|
|
3144
2855
|
var _this = _super.call(this, input) || this;
|
|
3145
2856
|
_this.$.node = input.node;
|
|
3146
|
-
_this
|
|
2857
|
+
_this.$seal();
|
|
3147
2858
|
return _this;
|
|
3148
2859
|
}
|
|
3149
2860
|
Portal.prototype.appendNode = function (node) {
|
|
@@ -3279,7 +2990,7 @@ var AttributeBinding = /** @class */ (function (_super) {
|
|
|
3279
2990
|
node.node.removeAttribute(name);
|
|
3280
2991
|
}
|
|
3281
2992
|
});
|
|
3282
|
-
_this
|
|
2993
|
+
_this.$seal();
|
|
3283
2994
|
return _this;
|
|
3284
2995
|
}
|
|
3285
2996
|
return AttributeBinding;
|
|
@@ -3309,7 +3020,7 @@ var StyleBinding = /** @class */ (function (_super) {
|
|
|
3309
3020
|
node.node.style.setProperty(name, value);
|
|
3310
3021
|
}
|
|
3311
3022
|
});
|
|
3312
|
-
_this
|
|
3023
|
+
_this.$seal();
|
|
3313
3024
|
return _this;
|
|
3314
3025
|
}
|
|
3315
3026
|
return StyleBinding;
|
|
@@ -3341,7 +3052,7 @@ var StaticClassBinding = /** @class */ (function (_super) {
|
|
|
3341
3052
|
_this.current = value;
|
|
3342
3053
|
}
|
|
3343
3054
|
});
|
|
3344
|
-
_this
|
|
3055
|
+
_this.$seal();
|
|
3345
3056
|
return _this;
|
|
3346
3057
|
}
|
|
3347
3058
|
return StaticClassBinding;
|
|
@@ -3363,7 +3074,7 @@ var DynamicalClassBinding = /** @class */ (function (_super) {
|
|
|
3363
3074
|
_this.current = value;
|
|
3364
3075
|
}
|
|
3365
3076
|
});
|
|
3366
|
-
_this
|
|
3077
|
+
_this.$seal();
|
|
3367
3078
|
return _this;
|
|
3368
3079
|
}
|
|
3369
3080
|
return DynamicalClassBinding;
|
|
@@ -3388,12 +3099,12 @@ var RepeatNodePrivate = /** @class */ (function (_super) {
|
|
|
3388
3099
|
* @type {Map}
|
|
3389
3100
|
*/
|
|
3390
3101
|
_this.nodes = new Map();
|
|
3391
|
-
_this
|
|
3102
|
+
_this.$seal();
|
|
3392
3103
|
return _this;
|
|
3393
3104
|
}
|
|
3394
|
-
RepeatNodePrivate.prototype
|
|
3105
|
+
RepeatNodePrivate.prototype.$destroy = function () {
|
|
3395
3106
|
this.nodes.clear();
|
|
3396
|
-
_super.prototype
|
|
3107
|
+
_super.prototype.$destroy.call(this);
|
|
3397
3108
|
};
|
|
3398
3109
|
return RepeatNodePrivate;
|
|
3399
3110
|
}(INodePrivate));
|
|
@@ -3439,7 +3150,7 @@ var RepeatNode = /** @class */ (function (_super) {
|
|
|
3439
3150
|
var child = $.nodes.get(id);
|
|
3440
3151
|
if (child) {
|
|
3441
3152
|
child.remove();
|
|
3442
|
-
child
|
|
3153
|
+
child.$destroy();
|
|
3443
3154
|
this.$.nodes.delete(id);
|
|
3444
3155
|
this.children.delete(child);
|
|
3445
3156
|
}
|
|
@@ -3535,7 +3246,7 @@ var BaseViewPrivate = /** @class */ (function (_super) {
|
|
|
3535
3246
|
__extends(BaseViewPrivate, _super);
|
|
3536
3247
|
function BaseViewPrivate() {
|
|
3537
3248
|
var _this = this; _super.call(this);
|
|
3538
|
-
_this
|
|
3249
|
+
_this.$seal();
|
|
3539
3250
|
return _this;
|
|
3540
3251
|
}
|
|
3541
3252
|
return BaseViewPrivate;
|
|
@@ -3617,7 +3328,7 @@ var Watch = /** @class */ (function (_super) {
|
|
|
3617
3328
|
var _this = this;
|
|
3618
3329
|
this.watch(function (value) {
|
|
3619
3330
|
_this.children.forEach(function (child) {
|
|
3620
|
-
child
|
|
3331
|
+
child.$destroy();
|
|
3621
3332
|
});
|
|
3622
3333
|
_this.children.clear();
|
|
3623
3334
|
_this.lastChild = null;
|
|
@@ -3705,4 +3416,297 @@ var SetView = /** @class */ (function (_super) {
|
|
|
3705
3416
|
|
|
3706
3417
|
window.SetView = SetView;
|
|
3707
3418
|
|
|
3419
|
+
// ./lib-es5/functional/merge.js
|
|
3420
|
+
function merge(main) {
|
|
3421
|
+
var targets = [];
|
|
3422
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
3423
|
+
targets[_i - 1] = arguments[_i];
|
|
3424
|
+
}
|
|
3425
|
+
function refactorClass(obj) {
|
|
3426
|
+
if (Array.isArray(obj.class)) {
|
|
3427
|
+
var out_1 = {
|
|
3428
|
+
$: []
|
|
3429
|
+
};
|
|
3430
|
+
obj.class.forEach(function (item) {
|
|
3431
|
+
if (item instanceof IValue) {
|
|
3432
|
+
out_1.$.push(item);
|
|
3433
|
+
}
|
|
3434
|
+
else if (typeof item === 'string') {
|
|
3435
|
+
out_1[item] = true;
|
|
3436
|
+
}
|
|
3437
|
+
else if (typeof item === 'object') {
|
|
3438
|
+
Object.assign(out_1, item);
|
|
3439
|
+
}
|
|
3440
|
+
});
|
|
3441
|
+
obj.class = out_1;
|
|
3442
|
+
}
|
|
3443
|
+
}
|
|
3444
|
+
refactorClass(main);
|
|
3445
|
+
targets.forEach(function (target) {
|
|
3446
|
+
Reflect.ownKeys(target).forEach(function (prop) {
|
|
3447
|
+
var _a;
|
|
3448
|
+
if (!Reflect.has(main, prop)) {
|
|
3449
|
+
main[prop] = target[prop];
|
|
3450
|
+
}
|
|
3451
|
+
else if (typeof main[prop] === 'object' && typeof target[prop] === 'object') {
|
|
3452
|
+
if (prop === 'class') {
|
|
3453
|
+
refactorClass(target);
|
|
3454
|
+
}
|
|
3455
|
+
if (prop === '$' && Array.isArray(main[prop]) && Array.isArray(target[prop])) {
|
|
3456
|
+
(_a = main.$).push.apply(_a, target.$);
|
|
3457
|
+
}
|
|
3458
|
+
else {
|
|
3459
|
+
merge(main[prop], target[prop]);
|
|
3460
|
+
}
|
|
3461
|
+
}
|
|
3462
|
+
});
|
|
3463
|
+
});
|
|
3464
|
+
}
|
|
3465
|
+
|
|
3466
|
+
window.merge = merge;
|
|
3467
|
+
|
|
3468
|
+
// ./lib-es5/functional/stack.js
|
|
3469
|
+
function app(renderer) {
|
|
3470
|
+
return function (node, opts) {
|
|
3471
|
+
return new App(node, opts).runFunctional(renderer, opts);
|
|
3472
|
+
};
|
|
3473
|
+
}
|
|
3474
|
+
function component(renderer) {
|
|
3475
|
+
return function (opts, callback) {
|
|
3476
|
+
var component = new Component(opts);
|
|
3477
|
+
if (!(current instanceof Fragment))
|
|
3478
|
+
throw userError('missing parent node', 'out-of-context');
|
|
3479
|
+
var ret;
|
|
3480
|
+
if (callback)
|
|
3481
|
+
opts.slot = callback;
|
|
3482
|
+
current.create(component, function (node) {
|
|
3483
|
+
ret = node.runFunctional(renderer, opts);
|
|
3484
|
+
});
|
|
3485
|
+
return ret;
|
|
3486
|
+
};
|
|
3487
|
+
}
|
|
3488
|
+
function fragment(renderer) {
|
|
3489
|
+
return function (opts, callback) {
|
|
3490
|
+
var frag = new Fragment(opts);
|
|
3491
|
+
if (!(current instanceof Fragment))
|
|
3492
|
+
throw userError('missing parent node', 'out-of-context');
|
|
3493
|
+
if (callback)
|
|
3494
|
+
opts.slot = callback;
|
|
3495
|
+
current.create(frag);
|
|
3496
|
+
return frag.runFunctional(renderer, opts);
|
|
3497
|
+
};
|
|
3498
|
+
}
|
|
3499
|
+
function extension(renderer) {
|
|
3500
|
+
return function (opts, callback) {
|
|
3501
|
+
var ext = new Extension(opts);
|
|
3502
|
+
if (!(current instanceof Fragment))
|
|
3503
|
+
throw userError('missing parent node', 'out-of-context');
|
|
3504
|
+
if (callback)
|
|
3505
|
+
opts.slot = callback;
|
|
3506
|
+
current.create(ext);
|
|
3507
|
+
return ext.runFunctional(renderer, opts);
|
|
3508
|
+
};
|
|
3509
|
+
}
|
|
3510
|
+
function tag(name, opts, callback) {
|
|
3511
|
+
if (!(current instanceof Fragment))
|
|
3512
|
+
throw userError('missing parent node', 'out-of-context');
|
|
3513
|
+
return {
|
|
3514
|
+
node: current.tag(name, opts, function (node) {
|
|
3515
|
+
callback && node.runFunctional(callback);
|
|
3516
|
+
})
|
|
3517
|
+
};
|
|
3518
|
+
}
|
|
3519
|
+
function create(node, callback) {
|
|
3520
|
+
if (!(current instanceof Fragment))
|
|
3521
|
+
throw userError('missing current node', 'out-of-context');
|
|
3522
|
+
current.create(node, function (node) {
|
|
3523
|
+
var args = [];
|
|
3524
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
3525
|
+
args[_i - 1] = arguments[_i];
|
|
3526
|
+
}
|
|
3527
|
+
callback && node.runFunctional.apply(node, __spreadArray([callback], args, false));
|
|
3528
|
+
});
|
|
3529
|
+
return node;
|
|
3530
|
+
}
|
|
3531
|
+
var vx = {
|
|
3532
|
+
if: function (condition, callback) {
|
|
3533
|
+
if (current instanceof Fragment) {
|
|
3534
|
+
current.if(condition, function (node) { return node.runFunctional(callback); });
|
|
3535
|
+
}
|
|
3536
|
+
else {
|
|
3537
|
+
throw userError("wrong use of `v.if` function", "logic-error");
|
|
3538
|
+
}
|
|
3539
|
+
},
|
|
3540
|
+
else: function (callback) {
|
|
3541
|
+
if (current instanceof Fragment) {
|
|
3542
|
+
current.else(function (node) { return node.runFunctional(callback); });
|
|
3543
|
+
}
|
|
3544
|
+
else {
|
|
3545
|
+
throw userError("wrong use of `v.else` function", "logic-error");
|
|
3546
|
+
}
|
|
3547
|
+
},
|
|
3548
|
+
elif: function (condition, callback) {
|
|
3549
|
+
if (current instanceof Fragment) {
|
|
3550
|
+
current.elif(condition, function (node) { return node.runFunctional(callback); });
|
|
3551
|
+
}
|
|
3552
|
+
else {
|
|
3553
|
+
throw userError("wrong use of `v.elif` function", "logic-error");
|
|
3554
|
+
}
|
|
3555
|
+
},
|
|
3556
|
+
for: function (model, callback) {
|
|
3557
|
+
if (model instanceof ArrayModel) {
|
|
3558
|
+
// for arrays T & K are the same type
|
|
3559
|
+
create(new ArrayView({ model: model }), callback);
|
|
3560
|
+
}
|
|
3561
|
+
else if (model instanceof MapModel) {
|
|
3562
|
+
create(new MapView({ model: model }), callback);
|
|
3563
|
+
}
|
|
3564
|
+
else if (model instanceof SetModel) {
|
|
3565
|
+
// for sets T & K are the same type
|
|
3566
|
+
create(new SetView({ model: model }), callback);
|
|
3567
|
+
}
|
|
3568
|
+
else if (model instanceof ObjectModel) {
|
|
3569
|
+
// for objects K is always string
|
|
3570
|
+
create(new ObjectView({ model: model }), callback);
|
|
3571
|
+
}
|
|
3572
|
+
else {
|
|
3573
|
+
throw userError("wrong use of `v.for` function", 'wrong-model');
|
|
3574
|
+
}
|
|
3575
|
+
},
|
|
3576
|
+
watch: function (model, callback) {
|
|
3577
|
+
var opts = { model: model };
|
|
3578
|
+
create(new Watch(opts), callback);
|
|
3579
|
+
},
|
|
3580
|
+
nextTick: function (callback) {
|
|
3581
|
+
var node = current;
|
|
3582
|
+
window.setTimeout(function () {
|
|
3583
|
+
node.runFunctional(callback);
|
|
3584
|
+
}, 0);
|
|
3585
|
+
}
|
|
3586
|
+
};
|
|
3587
|
+
|
|
3588
|
+
window.app = app;
|
|
3589
|
+
window.component = component;
|
|
3590
|
+
window.fragment = fragment;
|
|
3591
|
+
window.extension = extension;
|
|
3592
|
+
window.tag = tag;
|
|
3593
|
+
window.create = create;
|
|
3594
|
+
window.vx = vx;
|
|
3595
|
+
|
|
3596
|
+
// ./lib-es5/functional/models.js
|
|
3597
|
+
function arrayModel(arr) {
|
|
3598
|
+
if (arr === void 0) { arr = []; }
|
|
3599
|
+
if (!current)
|
|
3600
|
+
throw userError('missing parent node', 'out-of-context');
|
|
3601
|
+
return current.register(new ArrayModel(arr)).proxy();
|
|
3602
|
+
}
|
|
3603
|
+
function mapModel(map) {
|
|
3604
|
+
if (map === void 0) { map = []; }
|
|
3605
|
+
if (!current)
|
|
3606
|
+
throw userError('missing parent node', 'out-of-context');
|
|
3607
|
+
return current.register(new MapModel(map));
|
|
3608
|
+
}
|
|
3609
|
+
function setModel(arr) {
|
|
3610
|
+
if (arr === void 0) { arr = []; }
|
|
3611
|
+
if (!current)
|
|
3612
|
+
throw userError('missing parent node', 'out-of-context');
|
|
3613
|
+
return current.register(new SetModel(arr));
|
|
3614
|
+
}
|
|
3615
|
+
function objectModel(obj) {
|
|
3616
|
+
if (obj === void 0) { obj = {}; }
|
|
3617
|
+
if (!current)
|
|
3618
|
+
throw userError('missing parent node', 'out-of-context');
|
|
3619
|
+
return current.register(new ObjectModel(obj));
|
|
3620
|
+
}
|
|
3621
|
+
|
|
3622
|
+
window.arrayModel = arrayModel;
|
|
3623
|
+
window.mapModel = mapModel;
|
|
3624
|
+
window.setModel = setModel;
|
|
3625
|
+
window.objectModel = objectModel;
|
|
3626
|
+
|
|
3627
|
+
// ./lib-es5/functional/options.js
|
|
3628
|
+
|
|
3629
|
+
|
|
3630
|
+
|
|
3631
|
+
// ./lib-es5/functional/reactivity.js
|
|
3632
|
+
function ref(value) {
|
|
3633
|
+
var ref = current.ref(value);
|
|
3634
|
+
return [ref, function (value) { return ref.$ = value; }];
|
|
3635
|
+
}
|
|
3636
|
+
function mirror(value) {
|
|
3637
|
+
return current.mirror(value);
|
|
3638
|
+
}
|
|
3639
|
+
function forward(value) {
|
|
3640
|
+
return current.forward(value);
|
|
3641
|
+
}
|
|
3642
|
+
function point(value) {
|
|
3643
|
+
return current.point(value);
|
|
3644
|
+
}
|
|
3645
|
+
function expr(func) {
|
|
3646
|
+
var values = [];
|
|
3647
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
3648
|
+
values[_i - 1] = arguments[_i];
|
|
3649
|
+
}
|
|
3650
|
+
return current.expr.apply(current, __spreadArray([func], values, false));
|
|
3651
|
+
}
|
|
3652
|
+
function watch(func) {
|
|
3653
|
+
var values = [];
|
|
3654
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
3655
|
+
values[_i - 1] = arguments[_i];
|
|
3656
|
+
}
|
|
3657
|
+
current.watch.apply(current, __spreadArray([func], values, false));
|
|
3658
|
+
}
|
|
3659
|
+
function valueOf(value) {
|
|
3660
|
+
return value.$;
|
|
3661
|
+
}
|
|
3662
|
+
function setValue(ref, value) {
|
|
3663
|
+
if (ref instanceof Pointer && value instanceof IValue) {
|
|
3664
|
+
ref.$$ = value;
|
|
3665
|
+
}
|
|
3666
|
+
else {
|
|
3667
|
+
ref.$ = value instanceof IValue ? value.$ : value;
|
|
3668
|
+
}
|
|
3669
|
+
}
|
|
3670
|
+
|
|
3671
|
+
window.ref = ref;
|
|
3672
|
+
window.mirror = mirror;
|
|
3673
|
+
window.forward = forward;
|
|
3674
|
+
window.point = point;
|
|
3675
|
+
window.expr = expr;
|
|
3676
|
+
window.watch = watch;
|
|
3677
|
+
window.valueOf = valueOf;
|
|
3678
|
+
window.setValue = setValue;
|
|
3679
|
+
|
|
3680
|
+
// ./lib-es5/functional/components.js
|
|
3681
|
+
function text(text) {
|
|
3682
|
+
if (!(current instanceof Fragment))
|
|
3683
|
+
throw userError('missing parent node', 'out-of-context');
|
|
3684
|
+
;
|
|
3685
|
+
current.text(text);
|
|
3686
|
+
}
|
|
3687
|
+
function debug(text) {
|
|
3688
|
+
if (!(current instanceof Fragment))
|
|
3689
|
+
throw userError('missing parent node', 'out-of-context');
|
|
3690
|
+
current.debug(text);
|
|
3691
|
+
}
|
|
3692
|
+
function predefine(slot, predefined) {
|
|
3693
|
+
return slot || predefined;
|
|
3694
|
+
}
|
|
3695
|
+
|
|
3696
|
+
window.text = text;
|
|
3697
|
+
window.debug = debug;
|
|
3698
|
+
window.predefine = predefine;
|
|
3699
|
+
|
|
3700
|
+
// ./lib-es5/v/index.js
|
|
3701
|
+
|
|
3702
|
+
var v = __assign(__assign({ ref: function (value) {
|
|
3703
|
+
return current.ref(value);
|
|
3704
|
+
}, 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 () {
|
|
3705
|
+
return current.$destroy.bind(current);
|
|
3706
|
+
}, runOnDestroy: function (callback) {
|
|
3707
|
+
current.runOnDestroy(callback);
|
|
3708
|
+
} });
|
|
3709
|
+
|
|
3710
|
+
window.v = v;
|
|
3711
|
+
|
|
3708
3712
|
})();
|