mol_wire_lib 1.0.103 → 1.0.104
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/node.d.ts +20 -20
- package/node.deps.json +1 -1
- package/node.esm.js +89 -89
- package/node.esm.js.map +1 -1
- package/node.js +89 -89
- package/node.js.map +1 -1
- package/node.test.js +89 -89
- package/node.test.js.map +1 -1
- package/package.json +8 -8
- package/web.d.ts +20 -20
- package/web.deps.json +1 -1
- package/web.esm.js +89 -89
- package/web.esm.js.map +1 -1
- package/web.js +89 -89
- package/web.js.map +1 -1
package/node.test.js
CHANGED
|
@@ -740,34 +740,6 @@ var $;
|
|
|
740
740
|
;
|
|
741
741
|
"use strict";
|
|
742
742
|
var $;
|
|
743
|
-
(function ($) {
|
|
744
|
-
function $mol_wire_probe(task, next) {
|
|
745
|
-
const warm = $mol_wire_fiber.warm;
|
|
746
|
-
try {
|
|
747
|
-
$mol_wire_fiber.warm = false;
|
|
748
|
-
return task();
|
|
749
|
-
}
|
|
750
|
-
finally {
|
|
751
|
-
$mol_wire_fiber.warm = warm;
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
|
-
$.$mol_wire_probe = $mol_wire_probe;
|
|
755
|
-
})($ || ($ = {}));
|
|
756
|
-
//mol/wire/probe/probe.ts
|
|
757
|
-
;
|
|
758
|
-
"use strict";
|
|
759
|
-
var $;
|
|
760
|
-
(function ($) {
|
|
761
|
-
function $mol_wire_solid() {
|
|
762
|
-
$mol_wire_auto().reap = nothing;
|
|
763
|
-
}
|
|
764
|
-
$.$mol_wire_solid = $mol_wire_solid;
|
|
765
|
-
const nothing = () => { };
|
|
766
|
-
})($ || ($ = {}));
|
|
767
|
-
//mol/wire/solid/solid.ts
|
|
768
|
-
;
|
|
769
|
-
"use strict";
|
|
770
|
-
var $;
|
|
771
743
|
(function ($) {
|
|
772
744
|
$.$mol_compare_deep_cache = new WeakMap();
|
|
773
745
|
function $mol_compare_deep(left, right) {
|
|
@@ -894,12 +866,12 @@ var $;
|
|
|
894
866
|
"use strict";
|
|
895
867
|
var $;
|
|
896
868
|
(function ($) {
|
|
897
|
-
class $
|
|
869
|
+
class $mol_wire_task extends $mol_wire_fiber {
|
|
898
870
|
static getter(task) {
|
|
899
871
|
return function $mol_wire_fiber_temp_get(host, args) {
|
|
900
872
|
const existen = $mol_wire_auto()?.track_next();
|
|
901
873
|
reuse: if (existen) {
|
|
902
|
-
if (!(existen instanceof $
|
|
874
|
+
if (!(existen instanceof $mol_wire_task))
|
|
903
875
|
break reuse;
|
|
904
876
|
if (existen.host !== host)
|
|
905
877
|
break reuse;
|
|
@@ -909,7 +881,7 @@ var $;
|
|
|
909
881
|
break reuse;
|
|
910
882
|
return existen;
|
|
911
883
|
}
|
|
912
|
-
return new $
|
|
884
|
+
return new $mol_wire_task(`${host?.[Symbol.toStringTag] ?? host}.${task.name}(#)`, task, host, ...args);
|
|
913
885
|
};
|
|
914
886
|
}
|
|
915
887
|
complete() {
|
|
@@ -932,53 +904,9 @@ var $;
|
|
|
932
904
|
return next;
|
|
933
905
|
}
|
|
934
906
|
}
|
|
935
|
-
$.$
|
|
936
|
-
})($ || ($ = {}));
|
|
937
|
-
//mol/wire/fiber/temp/temp.ts
|
|
938
|
-
;
|
|
939
|
-
"use strict";
|
|
940
|
-
var $;
|
|
941
|
-
(function ($) {
|
|
942
|
-
function $mol_wire_sync(obj) {
|
|
943
|
-
return new Proxy(obj, {
|
|
944
|
-
get(obj, field) {
|
|
945
|
-
const val = obj[field];
|
|
946
|
-
if (typeof val !== 'function')
|
|
947
|
-
return val;
|
|
948
|
-
const temp = $mol_wire_fiber_temp.getter(val);
|
|
949
|
-
return function $mol_wire_sync(...args) {
|
|
950
|
-
const fiber = temp(obj, args);
|
|
951
|
-
return fiber.sync();
|
|
952
|
-
};
|
|
953
|
-
}
|
|
954
|
-
});
|
|
955
|
-
}
|
|
956
|
-
$.$mol_wire_sync = $mol_wire_sync;
|
|
907
|
+
$.$mol_wire_task = $mol_wire_task;
|
|
957
908
|
})($ || ($ = {}));
|
|
958
|
-
//mol/wire/
|
|
959
|
-
;
|
|
960
|
-
"use strict";
|
|
961
|
-
var $;
|
|
962
|
-
(function ($) {
|
|
963
|
-
function $mol_wire_async(obj) {
|
|
964
|
-
return new Proxy(obj, {
|
|
965
|
-
get(obj, field) {
|
|
966
|
-
const val = obj[field];
|
|
967
|
-
if (typeof val !== 'function')
|
|
968
|
-
return val;
|
|
969
|
-
let fiber;
|
|
970
|
-
const temp = $mol_wire_fiber_temp.getter(val);
|
|
971
|
-
return function $mol_wire_async(...args) {
|
|
972
|
-
fiber?.destructor();
|
|
973
|
-
fiber = temp(obj, args);
|
|
974
|
-
return fiber.async();
|
|
975
|
-
};
|
|
976
|
-
}
|
|
977
|
-
});
|
|
978
|
-
}
|
|
979
|
-
$.$mol_wire_async = $mol_wire_async;
|
|
980
|
-
})($ || ($ = {}));
|
|
981
|
-
//mol/wire/async/async.ts
|
|
909
|
+
//mol/wire/task/task.ts
|
|
982
910
|
;
|
|
983
911
|
"use strict";
|
|
984
912
|
var $;
|
|
@@ -1043,7 +971,7 @@ var $;
|
|
|
1043
971
|
if (typeof sup[field] === 'function') {
|
|
1044
972
|
Object.defineProperty(orig, 'name', { value: sup[field].name });
|
|
1045
973
|
}
|
|
1046
|
-
const temp = $
|
|
974
|
+
const temp = $mol_wire_task.getter(orig);
|
|
1047
975
|
const value = function (...args) {
|
|
1048
976
|
const fiber = temp(this ?? null, args);
|
|
1049
977
|
return fiber.sync();
|
|
@@ -1061,7 +989,7 @@ var $;
|
|
|
1061
989
|
"use strict";
|
|
1062
990
|
var $;
|
|
1063
991
|
(function ($) {
|
|
1064
|
-
class $
|
|
992
|
+
class $mol_wire_atom extends $mol_wire_fiber {
|
|
1065
993
|
static getter(task, keys) {
|
|
1066
994
|
const field = task.name + '()';
|
|
1067
995
|
if (keys) {
|
|
@@ -1077,7 +1005,7 @@ var $;
|
|
|
1077
1005
|
else {
|
|
1078
1006
|
dict = (host ?? task)[field] = new Map();
|
|
1079
1007
|
}
|
|
1080
|
-
fiber = new $
|
|
1008
|
+
fiber = new $mol_wire_atom(key, task, host, ...args);
|
|
1081
1009
|
dict.set(key, fiber);
|
|
1082
1010
|
return fiber;
|
|
1083
1011
|
};
|
|
@@ -1088,7 +1016,7 @@ var $;
|
|
|
1088
1016
|
if (existen)
|
|
1089
1017
|
return existen;
|
|
1090
1018
|
const key = `${host?.[Symbol.toStringTag] ?? host}.${field}`;
|
|
1091
|
-
const fiber = new $
|
|
1019
|
+
const fiber = new $mol_wire_atom(key, task, host, ...args);
|
|
1092
1020
|
(host ?? task)[field] = fiber;
|
|
1093
1021
|
return fiber;
|
|
1094
1022
|
};
|
|
@@ -1152,13 +1080,85 @@ var $;
|
|
|
1152
1080
|
}
|
|
1153
1081
|
__decorate([
|
|
1154
1082
|
$mol_wire_method
|
|
1155
|
-
], $
|
|
1083
|
+
], $mol_wire_atom.prototype, "recall", null);
|
|
1156
1084
|
__decorate([
|
|
1157
1085
|
$mol_wire_method
|
|
1158
|
-
], $
|
|
1159
|
-
$.$
|
|
1086
|
+
], $mol_wire_atom.prototype, "once", null);
|
|
1087
|
+
$.$mol_wire_atom = $mol_wire_atom;
|
|
1160
1088
|
})($ || ($ = {}));
|
|
1161
|
-
//mol/wire/
|
|
1089
|
+
//mol/wire/atom/atom.ts
|
|
1090
|
+
;
|
|
1091
|
+
"use strict";
|
|
1092
|
+
var $;
|
|
1093
|
+
(function ($) {
|
|
1094
|
+
function $mol_wire_probe(task, next) {
|
|
1095
|
+
const warm = $mol_wire_fiber.warm;
|
|
1096
|
+
try {
|
|
1097
|
+
$mol_wire_fiber.warm = false;
|
|
1098
|
+
return task();
|
|
1099
|
+
}
|
|
1100
|
+
finally {
|
|
1101
|
+
$mol_wire_fiber.warm = warm;
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
$.$mol_wire_probe = $mol_wire_probe;
|
|
1105
|
+
})($ || ($ = {}));
|
|
1106
|
+
//mol/wire/probe/probe.ts
|
|
1107
|
+
;
|
|
1108
|
+
"use strict";
|
|
1109
|
+
var $;
|
|
1110
|
+
(function ($) {
|
|
1111
|
+
function $mol_wire_solid() {
|
|
1112
|
+
$mol_wire_auto().reap = nothing;
|
|
1113
|
+
}
|
|
1114
|
+
$.$mol_wire_solid = $mol_wire_solid;
|
|
1115
|
+
const nothing = () => { };
|
|
1116
|
+
})($ || ($ = {}));
|
|
1117
|
+
//mol/wire/solid/solid.ts
|
|
1118
|
+
;
|
|
1119
|
+
"use strict";
|
|
1120
|
+
var $;
|
|
1121
|
+
(function ($) {
|
|
1122
|
+
function $mol_wire_sync(obj) {
|
|
1123
|
+
return new Proxy(obj, {
|
|
1124
|
+
get(obj, field) {
|
|
1125
|
+
const val = obj[field];
|
|
1126
|
+
if (typeof val !== 'function')
|
|
1127
|
+
return val;
|
|
1128
|
+
const temp = $mol_wire_task.getter(val);
|
|
1129
|
+
return function $mol_wire_sync(...args) {
|
|
1130
|
+
const fiber = temp(obj, args);
|
|
1131
|
+
return fiber.sync();
|
|
1132
|
+
};
|
|
1133
|
+
}
|
|
1134
|
+
});
|
|
1135
|
+
}
|
|
1136
|
+
$.$mol_wire_sync = $mol_wire_sync;
|
|
1137
|
+
})($ || ($ = {}));
|
|
1138
|
+
//mol/wire/sync/sync.ts
|
|
1139
|
+
;
|
|
1140
|
+
"use strict";
|
|
1141
|
+
var $;
|
|
1142
|
+
(function ($) {
|
|
1143
|
+
function $mol_wire_async(obj) {
|
|
1144
|
+
return new Proxy(obj, {
|
|
1145
|
+
get(obj, field) {
|
|
1146
|
+
const val = obj[field];
|
|
1147
|
+
if (typeof val !== 'function')
|
|
1148
|
+
return val;
|
|
1149
|
+
let fiber;
|
|
1150
|
+
const temp = $mol_wire_task.getter(val);
|
|
1151
|
+
return function $mol_wire_async(...args) {
|
|
1152
|
+
fiber?.destructor();
|
|
1153
|
+
fiber = temp(obj, args);
|
|
1154
|
+
return fiber.async();
|
|
1155
|
+
};
|
|
1156
|
+
}
|
|
1157
|
+
});
|
|
1158
|
+
}
|
|
1159
|
+
$.$mol_wire_async = $mol_wire_async;
|
|
1160
|
+
})($ || ($ = {}));
|
|
1161
|
+
//mol/wire/async/async.ts
|
|
1162
1162
|
;
|
|
1163
1163
|
"use strict";
|
|
1164
1164
|
var $;
|
|
@@ -1184,11 +1184,11 @@ var $;
|
|
|
1184
1184
|
$.$mol_wire_mem = $mol_wire_mem;
|
|
1185
1185
|
function $mol_wire_mem_func(keys) {
|
|
1186
1186
|
return (func) => {
|
|
1187
|
-
const persist = $
|
|
1187
|
+
const persist = $mol_wire_atom.getter(func, keys);
|
|
1188
1188
|
const wrapper = function (...args) {
|
|
1189
1189
|
let atom = persist(this, args.slice(0, keys));
|
|
1190
1190
|
if (args.length <= keys || args[keys] === undefined) {
|
|
1191
|
-
if ($mol_wire_auto() instanceof $
|
|
1191
|
+
if ($mol_wire_auto() instanceof $mol_wire_task) {
|
|
1192
1192
|
return atom.once();
|
|
1193
1193
|
}
|
|
1194
1194
|
else {
|
|
@@ -1226,7 +1226,7 @@ var $;
|
|
|
1226
1226
|
if (!descr)
|
|
1227
1227
|
descr = Reflect.getOwnPropertyDescriptor(host, field);
|
|
1228
1228
|
const _get = descr?.get || $mol_const(descr?.value);
|
|
1229
|
-
const persist = $
|
|
1229
|
+
const persist = $mol_wire_atom.getter(_get, 0);
|
|
1230
1230
|
const _set = descr?.set || function (next) {
|
|
1231
1231
|
persist(this, []).put(next);
|
|
1232
1232
|
};
|
|
@@ -1237,7 +1237,7 @@ var $;
|
|
|
1237
1237
|
function get() {
|
|
1238
1238
|
return persist(this, []).sync();
|
|
1239
1239
|
}
|
|
1240
|
-
const temp = $
|
|
1240
|
+
const temp = $mol_wire_task.getter(_set);
|
|
1241
1241
|
function set(next) {
|
|
1242
1242
|
temp(this, [next]).sync();
|
|
1243
1243
|
}
|