@expressive/mvc 0.4.0 → 0.4.1
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/lib/index.esm.js +78 -66
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +78 -66
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/index.esm.js
CHANGED
|
@@ -932,8 +932,9 @@ function parent(Expects, required) {
|
|
|
932
932
|
|
|
933
933
|
const ANY$1 = Symbol("any");
|
|
934
934
|
function managedMap(control, property, initial) {
|
|
935
|
-
const context = new WeakMap();
|
|
936
935
|
const lastUpdate = new Set();
|
|
936
|
+
const context = new WeakMap();
|
|
937
|
+
const assoc = new WeakMap();
|
|
937
938
|
let managed;
|
|
938
939
|
let value;
|
|
939
940
|
function reset() {
|
|
@@ -950,6 +951,11 @@ function managedMap(control, property, initial) {
|
|
|
950
951
|
control.state.set(property, next);
|
|
951
952
|
if (!initial)
|
|
952
953
|
emit(ANY$1);
|
|
954
|
+
const watch = (key, on) => {
|
|
955
|
+
const local = assoc.get(on);
|
|
956
|
+
if (local)
|
|
957
|
+
local(key);
|
|
958
|
+
};
|
|
953
959
|
managed.set = (k, v) => {
|
|
954
960
|
emit(k);
|
|
955
961
|
return value.set(k, v);
|
|
@@ -962,56 +968,56 @@ function managedMap(control, property, initial) {
|
|
|
962
968
|
emit(ANY$1);
|
|
963
969
|
value.clear();
|
|
964
970
|
};
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
if (!local)
|
|
968
|
-
return managed;
|
|
969
|
-
if (context.has(local))
|
|
970
|
-
return context.get(local);
|
|
971
|
-
const proxy = Object.create(managed);
|
|
972
|
-
const using = new Set();
|
|
973
|
-
context.set(local, proxy);
|
|
974
|
-
local.add(property, () => {
|
|
975
|
-
if (using.has(ANY$1) || lastUpdate.has(ANY$1) && using.size)
|
|
976
|
-
return true;
|
|
977
|
-
for (const key of lastUpdate)
|
|
978
|
-
if (using.has(key))
|
|
979
|
-
return true;
|
|
980
|
-
});
|
|
981
|
-
const watch = (key) => {
|
|
982
|
-
if (!local.active)
|
|
983
|
-
using.add(key);
|
|
984
|
-
};
|
|
985
|
-
proxy.get = (key) => {
|
|
986
|
-
watch(key);
|
|
971
|
+
managed.get = function (key) {
|
|
972
|
+
watch(key, this);
|
|
987
973
|
return value.get(key);
|
|
988
974
|
};
|
|
989
|
-
|
|
990
|
-
watch(key);
|
|
975
|
+
managed.has = function (key) {
|
|
976
|
+
watch(key, this);
|
|
991
977
|
return value.has(key);
|
|
992
978
|
};
|
|
993
|
-
|
|
994
|
-
watch(ANY$1);
|
|
979
|
+
managed.values = function () {
|
|
980
|
+
watch(ANY$1, this);
|
|
995
981
|
return value.values();
|
|
996
982
|
};
|
|
997
|
-
|
|
998
|
-
watch(ANY$1);
|
|
983
|
+
managed.keys = function () {
|
|
984
|
+
watch(ANY$1, this);
|
|
999
985
|
return value.keys();
|
|
1000
986
|
};
|
|
1001
|
-
|
|
1002
|
-
watch(ANY$1);
|
|
987
|
+
managed.entries = function () {
|
|
988
|
+
watch(ANY$1, this);
|
|
1003
989
|
return value.entries();
|
|
1004
990
|
};
|
|
1005
|
-
|
|
1006
|
-
watch(ANY$1);
|
|
991
|
+
managed[Symbol.iterator] = function () {
|
|
992
|
+
watch(ANY$1, this);
|
|
1007
993
|
return value[Symbol.iterator]();
|
|
1008
994
|
};
|
|
1009
|
-
defineProperty(
|
|
995
|
+
defineProperty(managed, "size", {
|
|
1010
996
|
get() {
|
|
1011
|
-
watch(ANY$1);
|
|
997
|
+
watch(ANY$1, this);
|
|
1012
998
|
return value.size;
|
|
1013
999
|
}
|
|
1014
1000
|
});
|
|
1001
|
+
}
|
|
1002
|
+
function getValue(local) {
|
|
1003
|
+
if (!local)
|
|
1004
|
+
return managed;
|
|
1005
|
+
if (context.has(local))
|
|
1006
|
+
return context.get(local);
|
|
1007
|
+
const proxy = Object.create(managed);
|
|
1008
|
+
const using = new Set();
|
|
1009
|
+
context.set(local, proxy);
|
|
1010
|
+
assoc.set(proxy, (key) => {
|
|
1011
|
+
if (!local.active)
|
|
1012
|
+
using.add(key);
|
|
1013
|
+
});
|
|
1014
|
+
local.add(property, () => {
|
|
1015
|
+
if (using.has(ANY$1) || lastUpdate.has(ANY$1) && using.size)
|
|
1016
|
+
return true;
|
|
1017
|
+
for (const key of lastUpdate)
|
|
1018
|
+
if (using.has(key))
|
|
1019
|
+
return true;
|
|
1020
|
+
});
|
|
1015
1021
|
return proxy;
|
|
1016
1022
|
}
|
|
1017
1023
|
setValue(initial, true);
|
|
@@ -1023,8 +1029,9 @@ function managedMap(control, property, initial) {
|
|
|
1023
1029
|
|
|
1024
1030
|
const ANY = Symbol("any");
|
|
1025
1031
|
function managedSet(control, property, initial) {
|
|
1026
|
-
const context = new WeakMap();
|
|
1027
1032
|
const lastUpdate = new Set();
|
|
1033
|
+
const context = new WeakMap();
|
|
1034
|
+
const assoc = new WeakMap();
|
|
1028
1035
|
let managed;
|
|
1029
1036
|
let value;
|
|
1030
1037
|
function reset() {
|
|
@@ -1041,6 +1048,11 @@ function managedSet(control, property, initial) {
|
|
|
1041
1048
|
control.state.set(property, next);
|
|
1042
1049
|
if (!initial)
|
|
1043
1050
|
emit(ANY);
|
|
1051
|
+
const watch = (key, on) => {
|
|
1052
|
+
const local = assoc.get(on);
|
|
1053
|
+
if (local)
|
|
1054
|
+
local(key);
|
|
1055
|
+
};
|
|
1044
1056
|
managed.add = (k) => {
|
|
1045
1057
|
emit(k);
|
|
1046
1058
|
return value.add(k);
|
|
@@ -1053,6 +1065,32 @@ function managedSet(control, property, initial) {
|
|
|
1053
1065
|
emit(ANY);
|
|
1054
1066
|
value.clear();
|
|
1055
1067
|
};
|
|
1068
|
+
managed.has = function (key) {
|
|
1069
|
+
watch(key, this);
|
|
1070
|
+
return value.has(key);
|
|
1071
|
+
};
|
|
1072
|
+
managed.values = function () {
|
|
1073
|
+
watch(ANY, this);
|
|
1074
|
+
return value.values();
|
|
1075
|
+
};
|
|
1076
|
+
managed.keys = function () {
|
|
1077
|
+
watch(ANY, this);
|
|
1078
|
+
return value.keys();
|
|
1079
|
+
};
|
|
1080
|
+
managed.entries = function () {
|
|
1081
|
+
watch(ANY, this);
|
|
1082
|
+
return value.entries();
|
|
1083
|
+
};
|
|
1084
|
+
managed[Symbol.iterator] = function () {
|
|
1085
|
+
watch(ANY, this);
|
|
1086
|
+
return value[Symbol.iterator]();
|
|
1087
|
+
};
|
|
1088
|
+
defineProperty(managed, "size", {
|
|
1089
|
+
get() {
|
|
1090
|
+
watch(ANY, this);
|
|
1091
|
+
return value.size;
|
|
1092
|
+
}
|
|
1093
|
+
});
|
|
1056
1094
|
}
|
|
1057
1095
|
function getValue(local) {
|
|
1058
1096
|
if (!local)
|
|
@@ -1062,6 +1100,10 @@ function managedSet(control, property, initial) {
|
|
|
1062
1100
|
const proxy = Object.create(managed);
|
|
1063
1101
|
const using = new Set();
|
|
1064
1102
|
context.set(local, proxy);
|
|
1103
|
+
assoc.set(proxy, (key) => {
|
|
1104
|
+
if (!local.active)
|
|
1105
|
+
using.add(key);
|
|
1106
|
+
});
|
|
1065
1107
|
local.add(property, () => {
|
|
1066
1108
|
if (using.has(ANY) || lastUpdate.has(ANY) && using.size)
|
|
1067
1109
|
return true;
|
|
@@ -1069,36 +1111,6 @@ function managedSet(control, property, initial) {
|
|
|
1069
1111
|
if (using.has(key))
|
|
1070
1112
|
return true;
|
|
1071
1113
|
});
|
|
1072
|
-
const watch = (key) => {
|
|
1073
|
-
if (!local.active)
|
|
1074
|
-
using.add(key);
|
|
1075
|
-
};
|
|
1076
|
-
proxy.has = (key) => {
|
|
1077
|
-
watch(key);
|
|
1078
|
-
return value.has(key);
|
|
1079
|
-
};
|
|
1080
|
-
proxy.values = () => {
|
|
1081
|
-
watch(ANY);
|
|
1082
|
-
return value.values();
|
|
1083
|
-
};
|
|
1084
|
-
proxy.keys = () => {
|
|
1085
|
-
watch(ANY);
|
|
1086
|
-
return value.keys();
|
|
1087
|
-
};
|
|
1088
|
-
proxy.entries = () => {
|
|
1089
|
-
watch(ANY);
|
|
1090
|
-
return value.entries();
|
|
1091
|
-
};
|
|
1092
|
-
proxy[Symbol.iterator] = () => {
|
|
1093
|
-
watch(ANY);
|
|
1094
|
-
return value[Symbol.iterator]();
|
|
1095
|
-
};
|
|
1096
|
-
defineProperty(proxy, "size", {
|
|
1097
|
-
get() {
|
|
1098
|
-
watch(ANY);
|
|
1099
|
-
return value.size;
|
|
1100
|
-
}
|
|
1101
|
-
});
|
|
1102
1114
|
return proxy;
|
|
1103
1115
|
}
|
|
1104
1116
|
setValue(initial, true);
|