mol_jsx_lib 0.0.1667 → 0.0.1669
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/node.mjs
CHANGED
|
@@ -505,12 +505,10 @@ var $;
|
|
|
505
505
|
$mol_wire_cursor[$mol_wire_cursor["stale"] = -1] = "stale";
|
|
506
506
|
/** Some of (transitive) pub update required. */
|
|
507
507
|
$mol_wire_cursor[$mol_wire_cursor["doubt"] = -2] = "doubt";
|
|
508
|
-
/** Doubt check in progress, so any incoming quant is noticeable. */
|
|
509
|
-
$mol_wire_cursor[$mol_wire_cursor["check"] = -3] = "check";
|
|
510
508
|
/** Actual state but may be dropped. */
|
|
511
|
-
$mol_wire_cursor[$mol_wire_cursor["fresh"] = -
|
|
509
|
+
$mol_wire_cursor[$mol_wire_cursor["fresh"] = -3] = "fresh";
|
|
512
510
|
/** State will never be changed. */
|
|
513
|
-
$mol_wire_cursor[$mol_wire_cursor["final"] = -
|
|
511
|
+
$mol_wire_cursor[$mol_wire_cursor["final"] = -4] = "final";
|
|
514
512
|
})($mol_wire_cursor = $.$mol_wire_cursor || ($.$mol_wire_cursor = {}));
|
|
515
513
|
})($ || ($ = {}));
|
|
516
514
|
|
|
@@ -589,12 +587,6 @@ var $;
|
|
|
589
587
|
* Enforce actualization. Should not throw errors.
|
|
590
588
|
*/
|
|
591
589
|
fresh() { }
|
|
592
|
-
/**
|
|
593
|
-
* Lives inside single calculation of subscriber or not.
|
|
594
|
-
*/
|
|
595
|
-
get temp() {
|
|
596
|
-
return false;
|
|
597
|
-
}
|
|
598
590
|
/**
|
|
599
591
|
* Allow to put data to caches in the subtree.
|
|
600
592
|
*/
|
|
@@ -881,6 +873,9 @@ var $;
|
|
|
881
873
|
class $mol_wire_pub_sub extends $mol_wire_pub {
|
|
882
874
|
pub_from = 0; // 4B
|
|
883
875
|
cursor = $mol_wire_cursor.stale; // 4B
|
|
876
|
+
get temp() {
|
|
877
|
+
return false;
|
|
878
|
+
}
|
|
884
879
|
get pub_list() {
|
|
885
880
|
const res = [];
|
|
886
881
|
const max = this.cursor >= 0 ? this.cursor : this.sub_from;
|
|
@@ -900,9 +895,6 @@ var $;
|
|
|
900
895
|
if (this.cursor >= this.pub_from) {
|
|
901
896
|
$mol_fail(new Error('Circular subscription'));
|
|
902
897
|
}
|
|
903
|
-
if (this.cursor === $mol_wire_cursor.check) {
|
|
904
|
-
$mol_fail(new Error('Circular checking'));
|
|
905
|
-
}
|
|
906
898
|
super.promote();
|
|
907
899
|
}
|
|
908
900
|
track_next(pub) {
|
|
@@ -944,8 +936,7 @@ var $;
|
|
|
944
936
|
}
|
|
945
937
|
for (let cursor = this.pub_from; cursor < this.cursor; cursor += 2) {
|
|
946
938
|
const pub = this.data[cursor];
|
|
947
|
-
|
|
948
|
-
pub?.fresh();
|
|
939
|
+
pub.fresh();
|
|
949
940
|
}
|
|
950
941
|
this.cursor = $mol_wire_cursor.fresh;
|
|
951
942
|
}
|
|
@@ -954,10 +945,6 @@ var $;
|
|
|
954
945
|
this.data[sub_pos + 1] = undefined;
|
|
955
946
|
}
|
|
956
947
|
destructor() {
|
|
957
|
-
// Mid-calc destroy (absorb restarts a temp): stop promoting into this
|
|
958
|
-
// fiber so track_next does not throw 'Promo to non begun sub'.
|
|
959
|
-
if ($mol_wire_auto() === this)
|
|
960
|
-
$mol_wire_auto(null);
|
|
961
948
|
for (let cursor = this.data.length - 2; cursor >= this.sub_from; cursor -= 2) {
|
|
962
949
|
const sub = this.data[cursor];
|
|
963
950
|
const pos = this.data[cursor + 1];
|
|
@@ -1003,21 +990,20 @@ var $;
|
|
|
1003
990
|
return;
|
|
1004
991
|
this.cursor = quant;
|
|
1005
992
|
this.emit($mol_wire_cursor.doubt);
|
|
1006
|
-
if
|
|
1007
|
-
|
|
1008
|
-
if
|
|
1009
|
-
|
|
1010
|
-
//
|
|
1011
|
-
//
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
}
|
|
993
|
+
// if( pos >= 0 && pos < this.sub_from - 2 ) {
|
|
994
|
+
// const pub = this.data[ pos ] as $mol_wire_pub
|
|
995
|
+
// if( pub instanceof $mol_wire_task ) return
|
|
996
|
+
// for(
|
|
997
|
+
// let cursor = this.pub_from;
|
|
998
|
+
// cursor < this.sub_from;
|
|
999
|
+
// cursor += 2
|
|
1000
|
+
// ) {
|
|
1001
|
+
// const pub = this.data[ cursor ] as $mol_wire_pub
|
|
1002
|
+
// if( pub instanceof $mol_wire_task ) {
|
|
1003
|
+
// pub.destructor()
|
|
1004
|
+
// }
|
|
1005
|
+
// }
|
|
1006
|
+
// }
|
|
1021
1007
|
}
|
|
1022
1008
|
[$mol_dev_format_head]() {
|
|
1023
1009
|
return $mol_dev_format_native(this);
|
|
@@ -1157,8 +1143,7 @@ var $;
|
|
|
1157
1143
|
[$mol_dev_format_head]() {
|
|
1158
1144
|
const cursor = {
|
|
1159
1145
|
[$mol_wire_cursor.stale]: '🔴',
|
|
1160
|
-
[$mol_wire_cursor.doubt]: '
|
|
1161
|
-
[$mol_wire_cursor.check]: '🟡',
|
|
1146
|
+
[$mol_wire_cursor.doubt]: '🟡',
|
|
1162
1147
|
[$mol_wire_cursor.fresh]: '🟢',
|
|
1163
1148
|
[$mol_wire_cursor.final]: '🔵',
|
|
1164
1149
|
}[this.cursor] ?? this.cursor.toString();
|
|
@@ -1182,11 +1167,10 @@ var $;
|
|
|
1182
1167
|
if (this.cursor === $mol_wire_cursor.final)
|
|
1183
1168
|
return;
|
|
1184
1169
|
check: if (this.cursor === $mol_wire_cursor.doubt) {
|
|
1185
|
-
this.cursor = $mol_wire_cursor.check;
|
|
1186
1170
|
for (let i = this.pub_from; i < this.sub_from; i += 2) {
|
|
1187
1171
|
;
|
|
1188
1172
|
this.data[i]?.fresh();
|
|
1189
|
-
if (this.cursor !== $mol_wire_cursor.
|
|
1173
|
+
if (this.cursor !== $mol_wire_cursor.doubt)
|
|
1190
1174
|
break check;
|
|
1191
1175
|
}
|
|
1192
1176
|
this.cursor = $mol_wire_cursor.fresh;
|
|
@@ -1195,74 +1179,62 @@ var $;
|
|
|
1195
1179
|
const bu = this.track_on();
|
|
1196
1180
|
let result;
|
|
1197
1181
|
try {
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1182
|
+
switch (this.pub_from) {
|
|
1183
|
+
case 0:
|
|
1184
|
+
result = this.task.call(this.host);
|
|
1185
|
+
break;
|
|
1186
|
+
case 1:
|
|
1187
|
+
result = this.task.call(this.host, this.data[0]);
|
|
1188
|
+
break;
|
|
1189
|
+
default:
|
|
1190
|
+
result = this.task.call(this.host, ...this.args);
|
|
1191
|
+
break;
|
|
1192
|
+
}
|
|
1193
|
+
if ($mol_promise_like(result)) {
|
|
1194
|
+
if (wrappers.has(result)) {
|
|
1195
|
+
result = wrappers.get(result).then(a => a);
|
|
1209
1196
|
}
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
wrappers.set(result, result = Object.assign(result.then(put, put), { destructor: result.destructor || (() => { }) }));
|
|
1221
|
-
wrappers.set(result, result);
|
|
1222
|
-
const error = new Error(`Promise in ${this}`);
|
|
1223
|
-
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
1224
|
-
}
|
|
1197
|
+
else {
|
|
1198
|
+
const put = (res) => {
|
|
1199
|
+
if (this.cache === result)
|
|
1200
|
+
this.put(res);
|
|
1201
|
+
return res;
|
|
1202
|
+
};
|
|
1203
|
+
wrappers.set(result, result = Object.assign(result.then(put, put), { destructor: result.destructor || (() => { }) }));
|
|
1204
|
+
wrappers.set(result, result);
|
|
1205
|
+
const error = new Error(`Promise in ${this}`);
|
|
1206
|
+
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
1225
1207
|
}
|
|
1226
1208
|
}
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1209
|
+
}
|
|
1210
|
+
catch (error) {
|
|
1211
|
+
if (error instanceof Error || $mol_promise_like(error)) {
|
|
1212
|
+
result = error;
|
|
1213
|
+
}
|
|
1214
|
+
else {
|
|
1215
|
+
result = new Error(String(error), { cause: error });
|
|
1216
|
+
}
|
|
1217
|
+
if ($mol_promise_like(result)) {
|
|
1218
|
+
if (wrappers.has(result)) {
|
|
1219
|
+
result = wrappers.get(result);
|
|
1230
1220
|
}
|
|
1231
1221
|
else {
|
|
1232
|
-
|
|
1222
|
+
const put = (v) => {
|
|
1223
|
+
if (this.cache === result)
|
|
1224
|
+
this.absorb();
|
|
1225
|
+
return v;
|
|
1226
|
+
};
|
|
1227
|
+
wrappers.set(result, result = Object.assign(result.then(put, put), { destructor: result.destructor || (() => { }) }));
|
|
1228
|
+
const error = new Error(`Promise in ${this}`);
|
|
1229
|
+
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
1233
1230
|
}
|
|
1234
|
-
if ($mol_promise_like(result)) {
|
|
1235
|
-
if (wrappers.has(result)) {
|
|
1236
|
-
result = wrappers.get(result);
|
|
1237
|
-
}
|
|
1238
|
-
else {
|
|
1239
|
-
const put = (v) => {
|
|
1240
|
-
if (this.cache === result)
|
|
1241
|
-
this.absorb();
|
|
1242
|
-
return v;
|
|
1243
|
-
};
|
|
1244
|
-
wrappers.set(result, result = Object.assign(result.then(put, put), { destructor: result.destructor || (() => { }) }));
|
|
1245
|
-
const error = new Error(`Promise in ${this}`);
|
|
1246
|
-
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
1247
|
-
}
|
|
1248
|
-
}
|
|
1249
|
-
}
|
|
1250
|
-
// Temp destroyed mid-calc (absorb restart): cut/off would throw.
|
|
1251
|
-
if (this.cursor < this.pub_from)
|
|
1252
|
-
return this;
|
|
1253
|
-
if (!$mol_promise_like(result)) {
|
|
1254
|
-
this.track_cut();
|
|
1255
1231
|
}
|
|
1256
|
-
this.track_off(bu);
|
|
1257
|
-
this.put(result);
|
|
1258
1232
|
}
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
// (else once()/onclose → Promo to non begun sub).
|
|
1262
|
-
if ($mol_wire_auto() === this || !$mol_wire_auto()) {
|
|
1263
|
-
$mol_wire_auto(bu);
|
|
1264
|
-
}
|
|
1233
|
+
if (!$mol_promise_like(result)) {
|
|
1234
|
+
this.track_cut();
|
|
1265
1235
|
}
|
|
1236
|
+
this.track_off(bu);
|
|
1237
|
+
this.put(result);
|
|
1266
1238
|
return this;
|
|
1267
1239
|
}
|
|
1268
1240
|
refresh() {
|