mol_jsx_lib 0.0.1667 → 0.0.1668
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 +3 -8
- package/node.d.ts.map +1 -1
- package/node.deps.json +1 -1
- package/node.js +69 -97
- package/node.js.map +1 -1
- package/node.mjs +69 -97
- package/node.test.js +409 -14486
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.d.ts +3 -8
- package/web.d.ts.map +1 -1
- package/web.deps.json +1 -1
- package/web.js +69 -97
- package/web.js.map +1 -1
- package/web.mjs +69 -97
- package/web.test.js +256 -32210
- package/web.test.js.map +1 -1
- package/giper/baza/diagram/dict.png +0 -0
- package/giper/baza/diagram/gift.png +0 -0
- package/giper/baza/diagram/jepsen.png +0 -0
- package/giper/baza/diagram/json.png +0 -0
- package/giper/baza/diagram/list.png +0 -0
- package/giper/baza/diagram/network.png +0 -0
- package/giper/baza/diagram/pack.png +0 -0
- package/giper/baza/diagram/pass.png +0 -0
- package/giper/baza/diagram/reg.png +0 -0
- package/giper/baza/diagram/rich.png +0 -0
- package/giper/baza/diagram/sand.png +0 -0
- package/giper/baza/diagram/sync.png +0 -0
- package/giper/baza/diagram/text.png +0 -0
- package/giper/baza/diagram/tree.png +0 -0
- package/giper/baza/logo/bg.webp +0 -0
- package/giper/baza/logo/logo-512.png +0 -0
- package/giper/baza/logo/logo.svg +0 -3
package/web.mjs
CHANGED
|
@@ -503,12 +503,10 @@ var $;
|
|
|
503
503
|
$mol_wire_cursor[$mol_wire_cursor["stale"] = -1] = "stale";
|
|
504
504
|
/** Some of (transitive) pub update required. */
|
|
505
505
|
$mol_wire_cursor[$mol_wire_cursor["doubt"] = -2] = "doubt";
|
|
506
|
-
/** Doubt check in progress, so any incoming quant is noticeable. */
|
|
507
|
-
$mol_wire_cursor[$mol_wire_cursor["check"] = -3] = "check";
|
|
508
506
|
/** Actual state but may be dropped. */
|
|
509
|
-
$mol_wire_cursor[$mol_wire_cursor["fresh"] = -
|
|
507
|
+
$mol_wire_cursor[$mol_wire_cursor["fresh"] = -3] = "fresh";
|
|
510
508
|
/** State will never be changed. */
|
|
511
|
-
$mol_wire_cursor[$mol_wire_cursor["final"] = -
|
|
509
|
+
$mol_wire_cursor[$mol_wire_cursor["final"] = -4] = "final";
|
|
512
510
|
})($mol_wire_cursor = $.$mol_wire_cursor || ($.$mol_wire_cursor = {}));
|
|
513
511
|
})($ || ($ = {}));
|
|
514
512
|
|
|
@@ -587,12 +585,6 @@ var $;
|
|
|
587
585
|
* Enforce actualization. Should not throw errors.
|
|
588
586
|
*/
|
|
589
587
|
fresh() { }
|
|
590
|
-
/**
|
|
591
|
-
* Lives inside single calculation of subscriber or not.
|
|
592
|
-
*/
|
|
593
|
-
get temp() {
|
|
594
|
-
return false;
|
|
595
|
-
}
|
|
596
588
|
/**
|
|
597
589
|
* Allow to put data to caches in the subtree.
|
|
598
590
|
*/
|
|
@@ -898,6 +890,9 @@ var $;
|
|
|
898
890
|
class $mol_wire_pub_sub extends $mol_wire_pub {
|
|
899
891
|
pub_from = 0; // 4B
|
|
900
892
|
cursor = $mol_wire_cursor.stale; // 4B
|
|
893
|
+
get temp() {
|
|
894
|
+
return false;
|
|
895
|
+
}
|
|
901
896
|
get pub_list() {
|
|
902
897
|
const res = [];
|
|
903
898
|
const max = this.cursor >= 0 ? this.cursor : this.sub_from;
|
|
@@ -917,9 +912,6 @@ var $;
|
|
|
917
912
|
if (this.cursor >= this.pub_from) {
|
|
918
913
|
$mol_fail(new Error('Circular subscription'));
|
|
919
914
|
}
|
|
920
|
-
if (this.cursor === $mol_wire_cursor.check) {
|
|
921
|
-
$mol_fail(new Error('Circular checking'));
|
|
922
|
-
}
|
|
923
915
|
super.promote();
|
|
924
916
|
}
|
|
925
917
|
track_next(pub) {
|
|
@@ -961,8 +953,7 @@ var $;
|
|
|
961
953
|
}
|
|
962
954
|
for (let cursor = this.pub_from; cursor < this.cursor; cursor += 2) {
|
|
963
955
|
const pub = this.data[cursor];
|
|
964
|
-
|
|
965
|
-
pub?.fresh();
|
|
956
|
+
pub.fresh();
|
|
966
957
|
}
|
|
967
958
|
this.cursor = $mol_wire_cursor.fresh;
|
|
968
959
|
}
|
|
@@ -971,10 +962,6 @@ var $;
|
|
|
971
962
|
this.data[sub_pos + 1] = undefined;
|
|
972
963
|
}
|
|
973
964
|
destructor() {
|
|
974
|
-
// Mid-calc destroy (absorb restarts a temp): stop promoting into this
|
|
975
|
-
// fiber so track_next does not throw 'Promo to non begun sub'.
|
|
976
|
-
if ($mol_wire_auto() === this)
|
|
977
|
-
$mol_wire_auto(null);
|
|
978
965
|
for (let cursor = this.data.length - 2; cursor >= this.sub_from; cursor -= 2) {
|
|
979
966
|
const sub = this.data[cursor];
|
|
980
967
|
const pos = this.data[cursor + 1];
|
|
@@ -1020,21 +1007,20 @@ var $;
|
|
|
1020
1007
|
return;
|
|
1021
1008
|
this.cursor = quant;
|
|
1022
1009
|
this.emit($mol_wire_cursor.doubt);
|
|
1023
|
-
if
|
|
1024
|
-
|
|
1025
|
-
if
|
|
1026
|
-
|
|
1027
|
-
//
|
|
1028
|
-
//
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
}
|
|
1010
|
+
// if( pos >= 0 && pos < this.sub_from - 2 ) {
|
|
1011
|
+
// const pub = this.data[ pos ] as $mol_wire_pub
|
|
1012
|
+
// if( pub instanceof $mol_wire_task ) return
|
|
1013
|
+
// for(
|
|
1014
|
+
// let cursor = this.pub_from;
|
|
1015
|
+
// cursor < this.sub_from;
|
|
1016
|
+
// cursor += 2
|
|
1017
|
+
// ) {
|
|
1018
|
+
// const pub = this.data[ cursor ] as $mol_wire_pub
|
|
1019
|
+
// if( pub instanceof $mol_wire_task ) {
|
|
1020
|
+
// pub.destructor()
|
|
1021
|
+
// }
|
|
1022
|
+
// }
|
|
1023
|
+
// }
|
|
1038
1024
|
}
|
|
1039
1025
|
[$mol_dev_format_head]() {
|
|
1040
1026
|
return $mol_dev_format_native(this);
|
|
@@ -1189,8 +1175,7 @@ var $;
|
|
|
1189
1175
|
[$mol_dev_format_head]() {
|
|
1190
1176
|
const cursor = {
|
|
1191
1177
|
[$mol_wire_cursor.stale]: '🔴',
|
|
1192
|
-
[$mol_wire_cursor.doubt]: '
|
|
1193
|
-
[$mol_wire_cursor.check]: '🟡',
|
|
1178
|
+
[$mol_wire_cursor.doubt]: '🟡',
|
|
1194
1179
|
[$mol_wire_cursor.fresh]: '🟢',
|
|
1195
1180
|
[$mol_wire_cursor.final]: '🔵',
|
|
1196
1181
|
}[this.cursor] ?? this.cursor.toString();
|
|
@@ -1214,11 +1199,10 @@ var $;
|
|
|
1214
1199
|
if (this.cursor === $mol_wire_cursor.final)
|
|
1215
1200
|
return;
|
|
1216
1201
|
check: if (this.cursor === $mol_wire_cursor.doubt) {
|
|
1217
|
-
this.cursor = $mol_wire_cursor.check;
|
|
1218
1202
|
for (let i = this.pub_from; i < this.sub_from; i += 2) {
|
|
1219
1203
|
;
|
|
1220
1204
|
this.data[i]?.fresh();
|
|
1221
|
-
if (this.cursor !== $mol_wire_cursor.
|
|
1205
|
+
if (this.cursor !== $mol_wire_cursor.doubt)
|
|
1222
1206
|
break check;
|
|
1223
1207
|
}
|
|
1224
1208
|
this.cursor = $mol_wire_cursor.fresh;
|
|
@@ -1227,74 +1211,62 @@ var $;
|
|
|
1227
1211
|
const bu = this.track_on();
|
|
1228
1212
|
let result;
|
|
1229
1213
|
try {
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1214
|
+
switch (this.pub_from) {
|
|
1215
|
+
case 0:
|
|
1216
|
+
result = this.task.call(this.host);
|
|
1217
|
+
break;
|
|
1218
|
+
case 1:
|
|
1219
|
+
result = this.task.call(this.host, this.data[0]);
|
|
1220
|
+
break;
|
|
1221
|
+
default:
|
|
1222
|
+
result = this.task.call(this.host, ...this.args);
|
|
1223
|
+
break;
|
|
1224
|
+
}
|
|
1225
|
+
if ($mol_promise_like(result)) {
|
|
1226
|
+
if (wrappers.has(result)) {
|
|
1227
|
+
result = wrappers.get(result).then(a => a);
|
|
1241
1228
|
}
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
wrappers.set(result, result = Object.assign(result.then(put, put), { destructor: result.destructor || (() => { }) }));
|
|
1253
|
-
wrappers.set(result, result);
|
|
1254
|
-
const error = new Error(`Promise in ${this}`);
|
|
1255
|
-
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
1256
|
-
}
|
|
1229
|
+
else {
|
|
1230
|
+
const put = (res) => {
|
|
1231
|
+
if (this.cache === result)
|
|
1232
|
+
this.put(res);
|
|
1233
|
+
return res;
|
|
1234
|
+
};
|
|
1235
|
+
wrappers.set(result, result = Object.assign(result.then(put, put), { destructor: result.destructor || (() => { }) }));
|
|
1236
|
+
wrappers.set(result, result);
|
|
1237
|
+
const error = new Error(`Promise in ${this}`);
|
|
1238
|
+
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
1257
1239
|
}
|
|
1258
1240
|
}
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1241
|
+
}
|
|
1242
|
+
catch (error) {
|
|
1243
|
+
if (error instanceof Error || $mol_promise_like(error)) {
|
|
1244
|
+
result = error;
|
|
1245
|
+
}
|
|
1246
|
+
else {
|
|
1247
|
+
result = new Error(String(error), { cause: error });
|
|
1248
|
+
}
|
|
1249
|
+
if ($mol_promise_like(result)) {
|
|
1250
|
+
if (wrappers.has(result)) {
|
|
1251
|
+
result = wrappers.get(result);
|
|
1262
1252
|
}
|
|
1263
1253
|
else {
|
|
1264
|
-
|
|
1254
|
+
const put = (v) => {
|
|
1255
|
+
if (this.cache === result)
|
|
1256
|
+
this.absorb();
|
|
1257
|
+
return v;
|
|
1258
|
+
};
|
|
1259
|
+
wrappers.set(result, result = Object.assign(result.then(put, put), { destructor: result.destructor || (() => { }) }));
|
|
1260
|
+
const error = new Error(`Promise in ${this}`);
|
|
1261
|
+
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
1265
1262
|
}
|
|
1266
|
-
if ($mol_promise_like(result)) {
|
|
1267
|
-
if (wrappers.has(result)) {
|
|
1268
|
-
result = wrappers.get(result);
|
|
1269
|
-
}
|
|
1270
|
-
else {
|
|
1271
|
-
const put = (v) => {
|
|
1272
|
-
if (this.cache === result)
|
|
1273
|
-
this.absorb();
|
|
1274
|
-
return v;
|
|
1275
|
-
};
|
|
1276
|
-
wrappers.set(result, result = Object.assign(result.then(put, put), { destructor: result.destructor || (() => { }) }));
|
|
1277
|
-
const error = new Error(`Promise in ${this}`);
|
|
1278
|
-
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
1279
|
-
}
|
|
1280
|
-
}
|
|
1281
|
-
}
|
|
1282
|
-
// Temp destroyed mid-calc (absorb restart): cut/off would throw.
|
|
1283
|
-
if (this.cursor < this.pub_from)
|
|
1284
|
-
return this;
|
|
1285
|
-
if (!$mol_promise_like(result)) {
|
|
1286
|
-
this.track_cut();
|
|
1287
1263
|
}
|
|
1288
|
-
this.track_off(bu);
|
|
1289
|
-
this.put(result);
|
|
1290
1264
|
}
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
// (else once()/onclose → Promo to non begun sub).
|
|
1294
|
-
if ($mol_wire_auto() === this || !$mol_wire_auto()) {
|
|
1295
|
-
$mol_wire_auto(bu);
|
|
1296
|
-
}
|
|
1265
|
+
if (!$mol_promise_like(result)) {
|
|
1266
|
+
this.track_cut();
|
|
1297
1267
|
}
|
|
1268
|
+
this.track_off(bu);
|
|
1269
|
+
this.put(result);
|
|
1298
1270
|
return this;
|
|
1299
1271
|
}
|
|
1300
1272
|
refresh() {
|