@expressive/mvc 0.4.2 → 0.4.3
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 +122 -118
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +122 -118
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/index.esm.js
CHANGED
|
@@ -938,11 +938,9 @@ function parent(Expects, required) {
|
|
|
938
938
|
|
|
939
939
|
const ANY$1 = Symbol("any");
|
|
940
940
|
function managedMap(control, property, initial) {
|
|
941
|
-
const
|
|
941
|
+
const managed = new ManagedMap(initial, emit);
|
|
942
942
|
const context = new WeakMap();
|
|
943
|
-
const
|
|
944
|
-
let managed;
|
|
945
|
-
let value;
|
|
943
|
+
const lastUpdate = new Set();
|
|
946
944
|
function reset() {
|
|
947
945
|
lastUpdate.clear();
|
|
948
946
|
}
|
|
@@ -951,59 +949,10 @@ function managedMap(control, property, initial) {
|
|
|
951
949
|
control.update(property);
|
|
952
950
|
control.waiting.add(reset);
|
|
953
951
|
}
|
|
954
|
-
function setValue(next
|
|
955
|
-
value = next;
|
|
956
|
-
managed = create(next);
|
|
952
|
+
function setValue(next) {
|
|
957
953
|
control.state.set(property, next);
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
const watch = (key, on) => {
|
|
961
|
-
const local = assoc.get(on);
|
|
962
|
-
if (local)
|
|
963
|
-
local(key);
|
|
964
|
-
};
|
|
965
|
-
managed.set = (k, v) => {
|
|
966
|
-
emit(k);
|
|
967
|
-
return value.set(k, v);
|
|
968
|
-
};
|
|
969
|
-
managed.delete = (k) => {
|
|
970
|
-
emit(k);
|
|
971
|
-
return value.delete(k);
|
|
972
|
-
};
|
|
973
|
-
managed.clear = () => {
|
|
974
|
-
emit(ANY$1);
|
|
975
|
-
value.clear();
|
|
976
|
-
};
|
|
977
|
-
managed.get = function (key) {
|
|
978
|
-
watch(key, this);
|
|
979
|
-
return value.get(key);
|
|
980
|
-
};
|
|
981
|
-
managed.has = function (key) {
|
|
982
|
-
watch(key, this);
|
|
983
|
-
return value.has(key);
|
|
984
|
-
};
|
|
985
|
-
managed.values = function () {
|
|
986
|
-
watch(ANY$1, this);
|
|
987
|
-
return value.values();
|
|
988
|
-
};
|
|
989
|
-
managed.keys = function () {
|
|
990
|
-
watch(ANY$1, this);
|
|
991
|
-
return value.keys();
|
|
992
|
-
};
|
|
993
|
-
managed.entries = function () {
|
|
994
|
-
watch(ANY$1, this);
|
|
995
|
-
return value.entries();
|
|
996
|
-
};
|
|
997
|
-
managed[Symbol.iterator] = function () {
|
|
998
|
-
watch(ANY$1, this);
|
|
999
|
-
return value[Symbol.iterator]();
|
|
1000
|
-
};
|
|
1001
|
-
defineProperty(managed, "size", {
|
|
1002
|
-
get() {
|
|
1003
|
-
watch(ANY$1, this);
|
|
1004
|
-
return value.size;
|
|
1005
|
-
}
|
|
1006
|
-
});
|
|
954
|
+
managed.source = next;
|
|
955
|
+
emit(ANY$1);
|
|
1007
956
|
}
|
|
1008
957
|
function getValue(local) {
|
|
1009
958
|
if (!local)
|
|
@@ -1011,7 +960,7 @@ function managedMap(control, property, initial) {
|
|
|
1011
960
|
if (context.has(local))
|
|
1012
961
|
return context.get(local);
|
|
1013
962
|
const refresh = local.onUpdate(property, control);
|
|
1014
|
-
const proxy =
|
|
963
|
+
const proxy = create(managed);
|
|
1015
964
|
const using = new Set();
|
|
1016
965
|
const update = () => {
|
|
1017
966
|
if (using.has(ANY$1) || lastUpdate.has(ANY$1) && using.size)
|
|
@@ -1023,28 +972,80 @@ function managedMap(control, property, initial) {
|
|
|
1023
972
|
break;
|
|
1024
973
|
}
|
|
1025
974
|
};
|
|
975
|
+
local.add(property, () => update);
|
|
1026
976
|
context.set(local, proxy);
|
|
1027
|
-
|
|
977
|
+
proxy.watch = (key) => {
|
|
1028
978
|
if (!local.active)
|
|
1029
979
|
using.add(key);
|
|
1030
|
-
}
|
|
1031
|
-
local.add(property, () => update);
|
|
980
|
+
};
|
|
1032
981
|
return proxy;
|
|
1033
982
|
}
|
|
1034
|
-
setValue(initial, true);
|
|
1035
983
|
return {
|
|
984
|
+
value: initial,
|
|
1036
985
|
set: setValue,
|
|
1037
986
|
get: getValue
|
|
1038
987
|
};
|
|
988
|
+
}
|
|
989
|
+
class ManagedMap {
|
|
990
|
+
constructor(source, emit) {
|
|
991
|
+
this.source = source;
|
|
992
|
+
this.emit = emit;
|
|
993
|
+
}
|
|
994
|
+
watch(_key) { }
|
|
995
|
+
set(key, value) {
|
|
996
|
+
this.source.set(key, value);
|
|
997
|
+
this.emit(key);
|
|
998
|
+
return this;
|
|
999
|
+
}
|
|
1000
|
+
;
|
|
1001
|
+
delete(key) {
|
|
1002
|
+
this.emit(key);
|
|
1003
|
+
return this.source.delete(key);
|
|
1004
|
+
}
|
|
1005
|
+
;
|
|
1006
|
+
clear() {
|
|
1007
|
+
this.emit(ANY$1);
|
|
1008
|
+
this.source.clear();
|
|
1009
|
+
}
|
|
1010
|
+
get(key) {
|
|
1011
|
+
this.watch(key);
|
|
1012
|
+
return this.source.get(key);
|
|
1013
|
+
}
|
|
1014
|
+
;
|
|
1015
|
+
has(key) {
|
|
1016
|
+
this.watch(key);
|
|
1017
|
+
return this.source.has(key);
|
|
1018
|
+
}
|
|
1019
|
+
;
|
|
1020
|
+
values() {
|
|
1021
|
+
this.watch(ANY$1);
|
|
1022
|
+
return this.source.values();
|
|
1023
|
+
}
|
|
1024
|
+
keys() {
|
|
1025
|
+
this.watch(ANY$1);
|
|
1026
|
+
return this.source.keys();
|
|
1027
|
+
}
|
|
1028
|
+
entries() {
|
|
1029
|
+
this.watch(ANY$1);
|
|
1030
|
+
return this.source.entries();
|
|
1031
|
+
}
|
|
1032
|
+
;
|
|
1033
|
+
[Symbol.iterator]() {
|
|
1034
|
+
this.watch(ANY$1);
|
|
1035
|
+
return this.source[Symbol.iterator]();
|
|
1036
|
+
}
|
|
1037
|
+
;
|
|
1038
|
+
get size() {
|
|
1039
|
+
this.watch(ANY$1);
|
|
1040
|
+
return this.source.size;
|
|
1041
|
+
}
|
|
1039
1042
|
}
|
|
1040
1043
|
|
|
1041
1044
|
const ANY = Symbol("any");
|
|
1042
1045
|
function managedSet(control, property, initial) {
|
|
1043
|
-
const
|
|
1046
|
+
const managed = new ManagedSet(initial, emit);
|
|
1044
1047
|
const context = new WeakMap();
|
|
1045
|
-
const
|
|
1046
|
-
let managed;
|
|
1047
|
-
let value;
|
|
1048
|
+
const lastUpdate = new Set();
|
|
1048
1049
|
function reset() {
|
|
1049
1050
|
lastUpdate.clear();
|
|
1050
1051
|
}
|
|
@@ -1053,55 +1054,10 @@ function managedSet(control, property, initial) {
|
|
|
1053
1054
|
control.update(property);
|
|
1054
1055
|
control.waiting.add(reset);
|
|
1055
1056
|
}
|
|
1056
|
-
function setValue(next
|
|
1057
|
-
|
|
1058
|
-
managed = create(next);
|
|
1057
|
+
function setValue(next) {
|
|
1058
|
+
managed.source = next;
|
|
1059
1059
|
control.state.set(property, next);
|
|
1060
|
-
|
|
1061
|
-
emit(ANY);
|
|
1062
|
-
const watch = (key, on) => {
|
|
1063
|
-
const local = assoc.get(on);
|
|
1064
|
-
if (local)
|
|
1065
|
-
local(key);
|
|
1066
|
-
};
|
|
1067
|
-
managed.add = (k) => {
|
|
1068
|
-
emit(k);
|
|
1069
|
-
return value.add(k);
|
|
1070
|
-
};
|
|
1071
|
-
managed.delete = (k) => {
|
|
1072
|
-
emit(k);
|
|
1073
|
-
return value.delete(k);
|
|
1074
|
-
};
|
|
1075
|
-
managed.clear = () => {
|
|
1076
|
-
emit(ANY);
|
|
1077
|
-
value.clear();
|
|
1078
|
-
};
|
|
1079
|
-
managed.has = function (key) {
|
|
1080
|
-
watch(key, this);
|
|
1081
|
-
return value.has(key);
|
|
1082
|
-
};
|
|
1083
|
-
managed.values = function () {
|
|
1084
|
-
watch(ANY, this);
|
|
1085
|
-
return value.values();
|
|
1086
|
-
};
|
|
1087
|
-
managed.keys = function () {
|
|
1088
|
-
watch(ANY, this);
|
|
1089
|
-
return value.keys();
|
|
1090
|
-
};
|
|
1091
|
-
managed.entries = function () {
|
|
1092
|
-
watch(ANY, this);
|
|
1093
|
-
return value.entries();
|
|
1094
|
-
};
|
|
1095
|
-
managed[Symbol.iterator] = function () {
|
|
1096
|
-
watch(ANY, this);
|
|
1097
|
-
return value[Symbol.iterator]();
|
|
1098
|
-
};
|
|
1099
|
-
defineProperty(managed, "size", {
|
|
1100
|
-
get() {
|
|
1101
|
-
watch(ANY, this);
|
|
1102
|
-
return value.size;
|
|
1103
|
-
}
|
|
1104
|
-
});
|
|
1060
|
+
emit(ANY);
|
|
1105
1061
|
}
|
|
1106
1062
|
function getValue(local) {
|
|
1107
1063
|
if (!local)
|
|
@@ -1109,7 +1065,7 @@ function managedSet(control, property, initial) {
|
|
|
1109
1065
|
if (context.has(local))
|
|
1110
1066
|
return context.get(local);
|
|
1111
1067
|
const refresh = local.onUpdate(property, control);
|
|
1112
|
-
const proxy =
|
|
1068
|
+
const proxy = create(managed);
|
|
1113
1069
|
const using = new Set();
|
|
1114
1070
|
const update = () => {
|
|
1115
1071
|
if (using.has(ANY) || lastUpdate.has(ANY) && using.size)
|
|
@@ -1121,19 +1077,67 @@ function managedSet(control, property, initial) {
|
|
|
1121
1077
|
break;
|
|
1122
1078
|
}
|
|
1123
1079
|
};
|
|
1080
|
+
local.add(property, () => update);
|
|
1124
1081
|
context.set(local, proxy);
|
|
1125
|
-
|
|
1082
|
+
proxy.watch = (key) => {
|
|
1126
1083
|
if (!local.active)
|
|
1127
1084
|
using.add(key);
|
|
1128
|
-
}
|
|
1129
|
-
local.add(property, () => update);
|
|
1085
|
+
};
|
|
1130
1086
|
return proxy;
|
|
1131
1087
|
}
|
|
1132
|
-
setValue(initial, true);
|
|
1133
1088
|
return {
|
|
1089
|
+
value: initial,
|
|
1134
1090
|
set: setValue,
|
|
1135
1091
|
get: getValue
|
|
1136
1092
|
};
|
|
1093
|
+
}
|
|
1094
|
+
class ManagedSet {
|
|
1095
|
+
constructor(source, emit) {
|
|
1096
|
+
this.source = source;
|
|
1097
|
+
this.emit = emit;
|
|
1098
|
+
}
|
|
1099
|
+
watch(_key) { }
|
|
1100
|
+
add(key) {
|
|
1101
|
+
this.emit(key);
|
|
1102
|
+
return this.source.add(key);
|
|
1103
|
+
}
|
|
1104
|
+
;
|
|
1105
|
+
delete(key) {
|
|
1106
|
+
this.emit(key);
|
|
1107
|
+
return this.source.delete(key);
|
|
1108
|
+
}
|
|
1109
|
+
;
|
|
1110
|
+
clear() {
|
|
1111
|
+
this.emit(ANY);
|
|
1112
|
+
this.source.clear();
|
|
1113
|
+
}
|
|
1114
|
+
has(key) {
|
|
1115
|
+
this.watch(key);
|
|
1116
|
+
return this.source.has(key);
|
|
1117
|
+
}
|
|
1118
|
+
;
|
|
1119
|
+
values() {
|
|
1120
|
+
this.watch(ANY);
|
|
1121
|
+
return this.source.values();
|
|
1122
|
+
}
|
|
1123
|
+
keys() {
|
|
1124
|
+
this.watch(ANY);
|
|
1125
|
+
return this.source.keys();
|
|
1126
|
+
}
|
|
1127
|
+
entries() {
|
|
1128
|
+
this.watch(ANY);
|
|
1129
|
+
return this.source.entries();
|
|
1130
|
+
}
|
|
1131
|
+
;
|
|
1132
|
+
[Symbol.iterator]() {
|
|
1133
|
+
this.watch(ANY);
|
|
1134
|
+
return this.source[Symbol.iterator]();
|
|
1135
|
+
}
|
|
1136
|
+
;
|
|
1137
|
+
get size() {
|
|
1138
|
+
this.watch(ANY);
|
|
1139
|
+
return this.source.size;
|
|
1140
|
+
}
|
|
1137
1141
|
}
|
|
1138
1142
|
|
|
1139
1143
|
const Oops$5 = issues({
|