mol_plot_all 1.2.844 → 1.2.845
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 +85 -85
- package/node.deps.json +1 -1
- package/node.js +581 -571
- package/node.js.map +1 -1
- package/node.mjs +581 -571
- package/node.test.js +581 -571
- package/node.test.js.map +1 -1
- package/package.json +11 -11
- package/web.d.ts +33 -8
- package/web.deps.json +1 -1
- package/web.js +67 -4
- package/web.js.map +1 -1
- package/web.mjs +67 -4
- package/web.test.js +0 -53
- package/web.test.js.map +1 -1
package/node.test.js
CHANGED
|
@@ -1067,385 +1067,6 @@ var $;
|
|
|
1067
1067
|
;
|
|
1068
1068
|
"use strict";
|
|
1069
1069
|
var $;
|
|
1070
|
-
(function ($) {
|
|
1071
|
-
class $mol_wire_task extends $mol_wire_fiber {
|
|
1072
|
-
static getter(task) {
|
|
1073
|
-
return function $mol_wire_task_get(host, args) {
|
|
1074
|
-
const sub = $mol_wire_auto();
|
|
1075
|
-
const existen = sub?.track_next();
|
|
1076
|
-
reuse: if (existen) {
|
|
1077
|
-
if (!existen.temp)
|
|
1078
|
-
break reuse;
|
|
1079
|
-
if (existen.host !== host)
|
|
1080
|
-
break reuse;
|
|
1081
|
-
if (existen.task !== task)
|
|
1082
|
-
break reuse;
|
|
1083
|
-
if (!$mol_compare_deep(existen.args, args))
|
|
1084
|
-
break reuse;
|
|
1085
|
-
return existen;
|
|
1086
|
-
}
|
|
1087
|
-
return new $mol_wire_task(`${host?.[Symbol.toStringTag] ?? host}.${task.name}(#)`, task, host, args);
|
|
1088
|
-
};
|
|
1089
|
-
}
|
|
1090
|
-
get temp() {
|
|
1091
|
-
return true;
|
|
1092
|
-
}
|
|
1093
|
-
complete() {
|
|
1094
|
-
if ($mol_promise_like(this.cache))
|
|
1095
|
-
return;
|
|
1096
|
-
this.destructor();
|
|
1097
|
-
}
|
|
1098
|
-
put(next) {
|
|
1099
|
-
const prev = this.cache;
|
|
1100
|
-
this.cache = next;
|
|
1101
|
-
if ($mol_promise_like(next)) {
|
|
1102
|
-
this.cursor = $mol_wire_cursor.fresh;
|
|
1103
|
-
if (next !== prev)
|
|
1104
|
-
this.emit();
|
|
1105
|
-
return next;
|
|
1106
|
-
}
|
|
1107
|
-
this.cursor = $mol_wire_cursor.final;
|
|
1108
|
-
if (this.sub_empty)
|
|
1109
|
-
this.destructor();
|
|
1110
|
-
else if (next !== prev)
|
|
1111
|
-
this.emit();
|
|
1112
|
-
return next;
|
|
1113
|
-
}
|
|
1114
|
-
}
|
|
1115
|
-
$.$mol_wire_task = $mol_wire_task;
|
|
1116
|
-
})($ || ($ = {}));
|
|
1117
|
-
//mol/wire/task/task.ts
|
|
1118
|
-
;
|
|
1119
|
-
"use strict";
|
|
1120
|
-
var $;
|
|
1121
|
-
(function ($) {
|
|
1122
|
-
function $mol_wire_method(host, field, descr) {
|
|
1123
|
-
if (!descr)
|
|
1124
|
-
descr = Reflect.getOwnPropertyDescriptor(host, field);
|
|
1125
|
-
const orig = descr?.value ?? host[field];
|
|
1126
|
-
const sup = Reflect.getPrototypeOf(host);
|
|
1127
|
-
if (typeof sup[field] === 'function') {
|
|
1128
|
-
Object.defineProperty(orig, 'name', { value: sup[field].name });
|
|
1129
|
-
}
|
|
1130
|
-
const temp = $mol_wire_task.getter(orig);
|
|
1131
|
-
const value = function (...args) {
|
|
1132
|
-
const fiber = temp(this ?? null, args);
|
|
1133
|
-
return fiber.sync();
|
|
1134
|
-
};
|
|
1135
|
-
Object.defineProperty(value, 'name', { value: orig.name + ' ' });
|
|
1136
|
-
Object.assign(value, { orig });
|
|
1137
|
-
const descr2 = { ...descr, value };
|
|
1138
|
-
Reflect.defineProperty(host, field, descr2);
|
|
1139
|
-
return descr2;
|
|
1140
|
-
}
|
|
1141
|
-
$.$mol_wire_method = $mol_wire_method;
|
|
1142
|
-
})($ || ($ = {}));
|
|
1143
|
-
//mol/wire/method/method.ts
|
|
1144
|
-
;
|
|
1145
|
-
"use strict";
|
|
1146
|
-
//mol/type/tail/tail.ts
|
|
1147
|
-
;
|
|
1148
|
-
"use strict";
|
|
1149
|
-
//mol/type/foot/foot.ts
|
|
1150
|
-
;
|
|
1151
|
-
"use strict";
|
|
1152
|
-
var $;
|
|
1153
|
-
(function ($) {
|
|
1154
|
-
const catched = new WeakMap();
|
|
1155
|
-
function $mol_fail_catch(error) {
|
|
1156
|
-
if (typeof error !== 'object')
|
|
1157
|
-
return false;
|
|
1158
|
-
if ($mol_promise_like(error))
|
|
1159
|
-
$mol_fail_hidden(error);
|
|
1160
|
-
if (catched.get(error))
|
|
1161
|
-
return false;
|
|
1162
|
-
catched.set(error, true);
|
|
1163
|
-
return true;
|
|
1164
|
-
}
|
|
1165
|
-
$.$mol_fail_catch = $mol_fail_catch;
|
|
1166
|
-
})($ || ($ = {}));
|
|
1167
|
-
//mol/fail/catch/catch.ts
|
|
1168
|
-
;
|
|
1169
|
-
"use strict";
|
|
1170
|
-
var $;
|
|
1171
|
-
(function ($) {
|
|
1172
|
-
function $mol_fail_log(error) {
|
|
1173
|
-
if ($mol_promise_like(error))
|
|
1174
|
-
return false;
|
|
1175
|
-
if (!$mol_fail_catch(error))
|
|
1176
|
-
return false;
|
|
1177
|
-
console.error(error);
|
|
1178
|
-
return true;
|
|
1179
|
-
}
|
|
1180
|
-
$.$mol_fail_log = $mol_fail_log;
|
|
1181
|
-
})($ || ($ = {}));
|
|
1182
|
-
//mol/fail/log/log.ts
|
|
1183
|
-
;
|
|
1184
|
-
"use strict";
|
|
1185
|
-
var $;
|
|
1186
|
-
(function ($) {
|
|
1187
|
-
class $mol_wire_atom extends $mol_wire_fiber {
|
|
1188
|
-
static solo(host, task) {
|
|
1189
|
-
const field = task.name + '()';
|
|
1190
|
-
const existen = Object.getOwnPropertyDescriptor(host ?? task, field)?.value;
|
|
1191
|
-
if (existen)
|
|
1192
|
-
return existen;
|
|
1193
|
-
const prefix = host?.[Symbol.toStringTag] ?? (host instanceof Function ? $$.$mol_func_name(host) : host);
|
|
1194
|
-
const key = `${prefix}.${field}`;
|
|
1195
|
-
const fiber = new $mol_wire_atom(key, task, host, []);
|
|
1196
|
-
(host ?? task)[field] = fiber;
|
|
1197
|
-
return fiber;
|
|
1198
|
-
}
|
|
1199
|
-
static plex(host, task, key) {
|
|
1200
|
-
const field = task.name + '()';
|
|
1201
|
-
let dict = Object.getOwnPropertyDescriptor(host ?? task, field)?.value;
|
|
1202
|
-
const prefix = host?.[Symbol.toStringTag] ?? (host instanceof Function ? $$.$mol_func_name(host) : host);
|
|
1203
|
-
const id = `${prefix}.${task.name}(${$mol_key(key).replace(/^"|"$/g, "'")})`;
|
|
1204
|
-
if (dict) {
|
|
1205
|
-
const existen = dict.get(id);
|
|
1206
|
-
if (existen)
|
|
1207
|
-
return existen;
|
|
1208
|
-
}
|
|
1209
|
-
else {
|
|
1210
|
-
dict = (host ?? task)[field] = new Map();
|
|
1211
|
-
}
|
|
1212
|
-
const fiber = new $mol_wire_atom(id, task, host, [key]);
|
|
1213
|
-
dict.set(id, fiber);
|
|
1214
|
-
return fiber;
|
|
1215
|
-
}
|
|
1216
|
-
static watching = new Set();
|
|
1217
|
-
static watcher = null;
|
|
1218
|
-
static watch() {
|
|
1219
|
-
$mol_wire_atom.watcher = new $mol_after_frame($mol_wire_atom.watch);
|
|
1220
|
-
for (const atom of $mol_wire_atom.watching) {
|
|
1221
|
-
if (atom.cursor === $mol_wire_cursor.final) {
|
|
1222
|
-
$mol_wire_atom.watching.delete(atom);
|
|
1223
|
-
}
|
|
1224
|
-
else {
|
|
1225
|
-
atom.cursor = $mol_wire_cursor.stale;
|
|
1226
|
-
atom.fresh();
|
|
1227
|
-
}
|
|
1228
|
-
}
|
|
1229
|
-
}
|
|
1230
|
-
watch() {
|
|
1231
|
-
if (!$mol_wire_atom.watcher) {
|
|
1232
|
-
$mol_wire_atom.watcher = new $mol_after_frame($mol_wire_atom.watch);
|
|
1233
|
-
}
|
|
1234
|
-
$mol_wire_atom.watching.add(this);
|
|
1235
|
-
}
|
|
1236
|
-
resync(args) {
|
|
1237
|
-
return this.put(this.task.call(this.host, ...args));
|
|
1238
|
-
}
|
|
1239
|
-
once() {
|
|
1240
|
-
return this.sync();
|
|
1241
|
-
}
|
|
1242
|
-
channel() {
|
|
1243
|
-
return Object.assign((next) => {
|
|
1244
|
-
if (next !== undefined)
|
|
1245
|
-
return this.resync([...this.args, next]);
|
|
1246
|
-
if (!$mol_wire_fiber.warm)
|
|
1247
|
-
return this.result();
|
|
1248
|
-
if ($mol_wire_auto()?.temp) {
|
|
1249
|
-
return this.once();
|
|
1250
|
-
}
|
|
1251
|
-
else {
|
|
1252
|
-
return this.sync();
|
|
1253
|
-
}
|
|
1254
|
-
}, { atom: this });
|
|
1255
|
-
}
|
|
1256
|
-
destructor() {
|
|
1257
|
-
super.destructor();
|
|
1258
|
-
const prev = this.cache;
|
|
1259
|
-
if ($mol_owning_check(this, prev)) {
|
|
1260
|
-
prev.destructor();
|
|
1261
|
-
}
|
|
1262
|
-
if (this.pub_from === 0) {
|
|
1263
|
-
;
|
|
1264
|
-
(this.host ?? this.task)[this.field()] = null;
|
|
1265
|
-
}
|
|
1266
|
-
else {
|
|
1267
|
-
;
|
|
1268
|
-
(this.host ?? this.task)[this.field()].delete(this[Symbol.toStringTag]);
|
|
1269
|
-
}
|
|
1270
|
-
}
|
|
1271
|
-
put(next) {
|
|
1272
|
-
const prev = this.cache;
|
|
1273
|
-
update: if (next !== prev) {
|
|
1274
|
-
try {
|
|
1275
|
-
if ($mol_compare_deep(prev, next))
|
|
1276
|
-
break update;
|
|
1277
|
-
}
|
|
1278
|
-
catch (error) {
|
|
1279
|
-
$mol_fail_log(error);
|
|
1280
|
-
}
|
|
1281
|
-
if ($mol_owning_check(this, prev)) {
|
|
1282
|
-
prev.destructor();
|
|
1283
|
-
}
|
|
1284
|
-
if ($mol_owning_catch(this, next)) {
|
|
1285
|
-
try {
|
|
1286
|
-
next[Symbol.toStringTag] = this[Symbol.toStringTag];
|
|
1287
|
-
}
|
|
1288
|
-
catch {
|
|
1289
|
-
Object.defineProperty(next, Symbol.toStringTag, { value: this[Symbol.toStringTag] });
|
|
1290
|
-
}
|
|
1291
|
-
}
|
|
1292
|
-
if (!this.sub_empty)
|
|
1293
|
-
this.emit();
|
|
1294
|
-
}
|
|
1295
|
-
this.cache = next;
|
|
1296
|
-
this.cursor = $mol_wire_cursor.fresh;
|
|
1297
|
-
if ($mol_promise_like(next))
|
|
1298
|
-
return next;
|
|
1299
|
-
this.complete_pubs();
|
|
1300
|
-
return next;
|
|
1301
|
-
}
|
|
1302
|
-
}
|
|
1303
|
-
__decorate([
|
|
1304
|
-
$mol_wire_method
|
|
1305
|
-
], $mol_wire_atom.prototype, "resync", null);
|
|
1306
|
-
__decorate([
|
|
1307
|
-
$mol_wire_method
|
|
1308
|
-
], $mol_wire_atom.prototype, "once", null);
|
|
1309
|
-
$.$mol_wire_atom = $mol_wire_atom;
|
|
1310
|
-
})($ || ($ = {}));
|
|
1311
|
-
//mol/wire/atom/atom.ts
|
|
1312
|
-
;
|
|
1313
|
-
"use strict";
|
|
1314
|
-
var $;
|
|
1315
|
-
(function ($) {
|
|
1316
|
-
function $mol_wire_solo(host, field, descr) {
|
|
1317
|
-
if (!descr)
|
|
1318
|
-
descr = Reflect.getOwnPropertyDescriptor(host, field);
|
|
1319
|
-
const orig = descr?.value ?? host[field];
|
|
1320
|
-
const sup = Reflect.getPrototypeOf(host);
|
|
1321
|
-
if (typeof sup[field] === 'function') {
|
|
1322
|
-
Object.defineProperty(orig, 'name', { value: sup[field].name });
|
|
1323
|
-
}
|
|
1324
|
-
const descr2 = {
|
|
1325
|
-
...descr,
|
|
1326
|
-
value: function (...args) {
|
|
1327
|
-
let atom = $mol_wire_atom.solo(this, orig);
|
|
1328
|
-
if ((args.length === 0) || (args[0] === undefined)) {
|
|
1329
|
-
if (!$mol_wire_fiber.warm)
|
|
1330
|
-
return atom.result();
|
|
1331
|
-
if ($mol_wire_auto()?.temp) {
|
|
1332
|
-
return atom.once();
|
|
1333
|
-
}
|
|
1334
|
-
else {
|
|
1335
|
-
return atom.sync();
|
|
1336
|
-
}
|
|
1337
|
-
}
|
|
1338
|
-
return atom.resync(args);
|
|
1339
|
-
}
|
|
1340
|
-
};
|
|
1341
|
-
Reflect.defineProperty(descr2.value, 'name', { value: orig.name + ' ' });
|
|
1342
|
-
Reflect.defineProperty(descr2.value, 'length', { value: orig.length });
|
|
1343
|
-
Object.assign(descr2.value, { orig });
|
|
1344
|
-
Reflect.defineProperty(host, field, descr2);
|
|
1345
|
-
return descr2;
|
|
1346
|
-
}
|
|
1347
|
-
$.$mol_wire_solo = $mol_wire_solo;
|
|
1348
|
-
})($ || ($ = {}));
|
|
1349
|
-
//mol/wire/solo/solo.ts
|
|
1350
|
-
;
|
|
1351
|
-
"use strict";
|
|
1352
|
-
var $;
|
|
1353
|
-
(function ($) {
|
|
1354
|
-
function $mol_wire_plex(host, field, descr) {
|
|
1355
|
-
if (!descr)
|
|
1356
|
-
descr = Reflect.getOwnPropertyDescriptor(host, field);
|
|
1357
|
-
const orig = descr?.value ?? host[field];
|
|
1358
|
-
const sup = Reflect.getPrototypeOf(host);
|
|
1359
|
-
if (typeof sup[field] === 'function') {
|
|
1360
|
-
Object.defineProperty(orig, 'name', { value: sup[field].name });
|
|
1361
|
-
}
|
|
1362
|
-
const descr2 = {
|
|
1363
|
-
...descr,
|
|
1364
|
-
value: function (...args) {
|
|
1365
|
-
let atom = $mol_wire_atom.plex(this, orig, args[0]);
|
|
1366
|
-
if ((args.length === 1) || (args[1] === undefined)) {
|
|
1367
|
-
if (!$mol_wire_fiber.warm)
|
|
1368
|
-
return atom.result();
|
|
1369
|
-
if ($mol_wire_auto()?.temp) {
|
|
1370
|
-
return atom.once();
|
|
1371
|
-
}
|
|
1372
|
-
else {
|
|
1373
|
-
return atom.sync();
|
|
1374
|
-
}
|
|
1375
|
-
}
|
|
1376
|
-
return atom.resync(args);
|
|
1377
|
-
}
|
|
1378
|
-
};
|
|
1379
|
-
Reflect.defineProperty(descr2.value, 'name', { value: orig.name + ' ' });
|
|
1380
|
-
Reflect.defineProperty(descr2.value, 'length', { value: orig.length });
|
|
1381
|
-
Object.assign(descr2.value, { orig });
|
|
1382
|
-
Reflect.defineProperty(host, field, descr2);
|
|
1383
|
-
return descr2;
|
|
1384
|
-
}
|
|
1385
|
-
$.$mol_wire_plex = $mol_wire_plex;
|
|
1386
|
-
})($ || ($ = {}));
|
|
1387
|
-
//mol/wire/plex/plex.ts
|
|
1388
|
-
;
|
|
1389
|
-
"use strict";
|
|
1390
|
-
var $;
|
|
1391
|
-
(function ($) {
|
|
1392
|
-
$.$mol_mem = $mol_wire_solo;
|
|
1393
|
-
$.$mol_mem_key = $mol_wire_plex;
|
|
1394
|
-
})($ || ($ = {}));
|
|
1395
|
-
//mol/mem/mem.ts
|
|
1396
|
-
;
|
|
1397
|
-
"use strict";
|
|
1398
|
-
var $;
|
|
1399
|
-
(function ($) {
|
|
1400
|
-
})($ || ($ = {}));
|
|
1401
|
-
//mol/dom/context/context.ts
|
|
1402
|
-
;
|
|
1403
|
-
"use strict";
|
|
1404
|
-
//node/node.ts
|
|
1405
|
-
;
|
|
1406
|
-
"use strict";
|
|
1407
|
-
var $node = new Proxy({ require }, {
|
|
1408
|
-
get(target, name, wrapper) {
|
|
1409
|
-
if (target[name])
|
|
1410
|
-
return target[name];
|
|
1411
|
-
const mod = target.require('module');
|
|
1412
|
-
if (mod.builtinModules.indexOf(name) >= 0)
|
|
1413
|
-
return target.require(name);
|
|
1414
|
-
if (name[0] === '.')
|
|
1415
|
-
return target.require(name);
|
|
1416
|
-
const path = target.require('path');
|
|
1417
|
-
const fs = target.require('fs');
|
|
1418
|
-
let dir = path.resolve('.');
|
|
1419
|
-
const suffix = `./node_modules/${name}`;
|
|
1420
|
-
const $$ = $;
|
|
1421
|
-
while (!fs.existsSync(path.join(dir, suffix))) {
|
|
1422
|
-
const parent = path.resolve(dir, '..');
|
|
1423
|
-
if (parent === dir) {
|
|
1424
|
-
$$.$mol_exec('.', 'npm', 'install', '--omit=dev', name);
|
|
1425
|
-
try {
|
|
1426
|
-
$$.$mol_exec('.', 'npm', 'install', '--omit=dev', '@types/' + name);
|
|
1427
|
-
}
|
|
1428
|
-
catch { }
|
|
1429
|
-
break;
|
|
1430
|
-
}
|
|
1431
|
-
else {
|
|
1432
|
-
dir = parent;
|
|
1433
|
-
}
|
|
1434
|
-
}
|
|
1435
|
-
return target.require(name);
|
|
1436
|
-
},
|
|
1437
|
-
set(target, name, value) {
|
|
1438
|
-
target[name] = value;
|
|
1439
|
-
return true;
|
|
1440
|
-
},
|
|
1441
|
-
});
|
|
1442
|
-
require = (req => Object.assign(function require(name) {
|
|
1443
|
-
return $node[name];
|
|
1444
|
-
}, req))(require);
|
|
1445
|
-
//node/node.node.ts
|
|
1446
|
-
;
|
|
1447
|
-
"use strict";
|
|
1448
|
-
var $;
|
|
1449
1070
|
(function ($) {
|
|
1450
1071
|
function $mol_log3_area_lazy(event) {
|
|
1451
1072
|
const self = this;
|
|
@@ -1712,250 +1333,639 @@ var $;
|
|
|
1712
1333
|
try {
|
|
1713
1334
|
return handle(child, belt, context);
|
|
1714
1335
|
}
|
|
1715
|
-
catch (error) {
|
|
1716
|
-
error.message += `\n${child.clone([])}${child.span}`;
|
|
1717
|
-
$mol_fail_hidden(error);
|
|
1336
|
+
catch (error) {
|
|
1337
|
+
error.message += `\n${child.clone([])}${child.span}`;
|
|
1338
|
+
$mol_fail_hidden(error);
|
|
1339
|
+
}
|
|
1340
|
+
}));
|
|
1341
|
+
}
|
|
1342
|
+
error(message, Class = Error) {
|
|
1343
|
+
return this.span.error(`${message}\n${this.clone([])}`, Class);
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
$.$mol_tree2 = $mol_tree2;
|
|
1347
|
+
class $mol_tree2_empty extends $mol_tree2 {
|
|
1348
|
+
constructor() {
|
|
1349
|
+
super('', '', [], $mol_span.unknown);
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
$.$mol_tree2_empty = $mol_tree2_empty;
|
|
1353
|
+
})($ || ($ = {}));
|
|
1354
|
+
//mol/tree2/tree2.ts
|
|
1355
|
+
;
|
|
1356
|
+
"use strict";
|
|
1357
|
+
var $;
|
|
1358
|
+
(function ($) {
|
|
1359
|
+
class $mol_error_syntax extends SyntaxError {
|
|
1360
|
+
reason;
|
|
1361
|
+
line;
|
|
1362
|
+
span;
|
|
1363
|
+
constructor(reason, line, span) {
|
|
1364
|
+
super(`${reason}\n${span}\n${line.substring(0, span.col - 1).replace(/\S/g, ' ')}${''.padEnd(span.length, '!')}\n${line}`);
|
|
1365
|
+
this.reason = reason;
|
|
1366
|
+
this.line = line;
|
|
1367
|
+
this.span = span;
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
$.$mol_error_syntax = $mol_error_syntax;
|
|
1371
|
+
})($ || ($ = {}));
|
|
1372
|
+
//mol/error/syntax/syntax.ts
|
|
1373
|
+
;
|
|
1374
|
+
"use strict";
|
|
1375
|
+
var $;
|
|
1376
|
+
(function ($) {
|
|
1377
|
+
function $mol_tree2_from_string(str, uri = '?') {
|
|
1378
|
+
const span = $mol_span.entire(uri, str);
|
|
1379
|
+
var root = $mol_tree2.list([], span);
|
|
1380
|
+
var stack = [root];
|
|
1381
|
+
var pos = 0, row = 0, min_indent = 0;
|
|
1382
|
+
while (str.length > pos) {
|
|
1383
|
+
var indent = 0;
|
|
1384
|
+
var line_start = pos;
|
|
1385
|
+
row++;
|
|
1386
|
+
while (str.length > pos && str[pos] == '\t') {
|
|
1387
|
+
indent++;
|
|
1388
|
+
pos++;
|
|
1389
|
+
}
|
|
1390
|
+
if (!root.kids.length) {
|
|
1391
|
+
min_indent = indent;
|
|
1392
|
+
}
|
|
1393
|
+
indent -= min_indent;
|
|
1394
|
+
if (indent < 0 || indent >= stack.length) {
|
|
1395
|
+
const sp = span.span(row, 1, pos - line_start);
|
|
1396
|
+
while (str.length > pos && str[pos] != '\n') {
|
|
1397
|
+
pos++;
|
|
1398
|
+
}
|
|
1399
|
+
if (indent < 0) {
|
|
1400
|
+
if (str.length > pos) {
|
|
1401
|
+
this.$mol_fail(new this.$mol_error_syntax(`Too few tabs`, str.substring(line_start, pos), sp));
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
else {
|
|
1405
|
+
this.$mol_fail(new this.$mol_error_syntax(`Too many tabs`, str.substring(line_start, pos), sp));
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
stack.length = indent + 1;
|
|
1409
|
+
var parent = stack[indent];
|
|
1410
|
+
while (str.length > pos && str[pos] != '\\' && str[pos] != '\n') {
|
|
1411
|
+
var error_start = pos;
|
|
1412
|
+
while (str.length > pos && (str[pos] == ' ' || str[pos] == '\t')) {
|
|
1413
|
+
pos++;
|
|
1414
|
+
}
|
|
1415
|
+
if (pos > error_start) {
|
|
1416
|
+
let line_end = str.indexOf('\n', pos);
|
|
1417
|
+
if (line_end === -1)
|
|
1418
|
+
line_end = str.length;
|
|
1419
|
+
const sp = span.span(row, error_start - line_start + 1, pos - error_start);
|
|
1420
|
+
this.$mol_fail(new this.$mol_error_syntax(`Wrong nodes separator`, str.substring(line_start, line_end), sp));
|
|
1421
|
+
}
|
|
1422
|
+
var type_start = pos;
|
|
1423
|
+
while (str.length > pos &&
|
|
1424
|
+
str[pos] != '\\' &&
|
|
1425
|
+
str[pos] != ' ' &&
|
|
1426
|
+
str[pos] != '\t' &&
|
|
1427
|
+
str[pos] != '\n') {
|
|
1428
|
+
pos++;
|
|
1429
|
+
}
|
|
1430
|
+
if (pos > type_start) {
|
|
1431
|
+
let next = new $mol_tree2(str.slice(type_start, pos), '', [], span.span(row, type_start - line_start + 1, pos - type_start));
|
|
1432
|
+
const parent_kids = parent.kids;
|
|
1433
|
+
parent_kids.push(next);
|
|
1434
|
+
parent = next;
|
|
1435
|
+
}
|
|
1436
|
+
if (str.length > pos && str[pos] == ' ') {
|
|
1437
|
+
pos++;
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
if (str.length > pos && str[pos] == '\\') {
|
|
1441
|
+
var data_start = pos;
|
|
1442
|
+
while (str.length > pos && str[pos] != '\n') {
|
|
1443
|
+
pos++;
|
|
1444
|
+
}
|
|
1445
|
+
let next = new $mol_tree2('', str.slice(data_start + 1, pos), [], span.span(row, data_start - line_start + 2, pos - data_start - 1));
|
|
1446
|
+
const parent_kids = parent.kids;
|
|
1447
|
+
parent_kids.push(next);
|
|
1448
|
+
parent = next;
|
|
1449
|
+
}
|
|
1450
|
+
if (str.length === pos && stack.length > 0) {
|
|
1451
|
+
const sp = span.span(row, pos - line_start + 1, 1);
|
|
1452
|
+
this.$mol_fail(new this.$mol_error_syntax(`Unexpected EOF, LF required`, str.substring(line_start, str.length), sp));
|
|
1453
|
+
}
|
|
1454
|
+
stack.push(parent);
|
|
1455
|
+
pos++;
|
|
1456
|
+
}
|
|
1457
|
+
return root;
|
|
1458
|
+
}
|
|
1459
|
+
$.$mol_tree2_from_string = $mol_tree2_from_string;
|
|
1460
|
+
})($ || ($ = {}));
|
|
1461
|
+
//mol/tree2/from/string/string.ts
|
|
1462
|
+
;
|
|
1463
|
+
"use strict";
|
|
1464
|
+
var $;
|
|
1465
|
+
(function ($) {
|
|
1466
|
+
function $mol_tree2_from_json(json, span = $mol_span.unknown) {
|
|
1467
|
+
if (typeof json === 'boolean' || typeof json === 'number' || json === null) {
|
|
1468
|
+
return new $mol_tree2(String(json), '', [], span);
|
|
1469
|
+
}
|
|
1470
|
+
if (typeof json === 'string') {
|
|
1471
|
+
return $mol_tree2.data(json, [], span);
|
|
1472
|
+
}
|
|
1473
|
+
if (Array.isArray(json)) {
|
|
1474
|
+
const sub = json.map(json => $mol_tree2_from_json(json, span));
|
|
1475
|
+
return new $mol_tree2('/', '', sub, span);
|
|
1476
|
+
}
|
|
1477
|
+
if (ArrayBuffer.isView(json)) {
|
|
1478
|
+
const buf = new Uint8Array(json.buffer, json.byteOffset, json.byteLength);
|
|
1479
|
+
return $mol_tree2.data(String.fromCharCode(...buf), [], span);
|
|
1480
|
+
}
|
|
1481
|
+
if (json instanceof Date) {
|
|
1482
|
+
return new $mol_tree2('', json.toISOString(), [], span);
|
|
1483
|
+
}
|
|
1484
|
+
if (typeof json.toJSON === 'function') {
|
|
1485
|
+
return $mol_tree2_from_json(json.toJSON());
|
|
1486
|
+
}
|
|
1487
|
+
if (json instanceof Error) {
|
|
1488
|
+
const { name, message, stack } = json;
|
|
1489
|
+
json = { ...json, name, message, stack };
|
|
1490
|
+
}
|
|
1491
|
+
const sub = [];
|
|
1492
|
+
for (var key in json) {
|
|
1493
|
+
const val = json[key];
|
|
1494
|
+
if (val === undefined)
|
|
1495
|
+
continue;
|
|
1496
|
+
const subsub = $mol_tree2_from_json(val, span);
|
|
1497
|
+
if (/^[^\n\t\\ ]+$/.test(key)) {
|
|
1498
|
+
sub.push(new $mol_tree2(key, '', [subsub], span));
|
|
1499
|
+
}
|
|
1500
|
+
else {
|
|
1501
|
+
sub.push($mol_tree2.data(key, [subsub], span));
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
return new $mol_tree2('*', '', sub, span);
|
|
1505
|
+
}
|
|
1506
|
+
$.$mol_tree2_from_json = $mol_tree2_from_json;
|
|
1507
|
+
})($ || ($ = {}));
|
|
1508
|
+
//mol/tree2/from/json/json.ts
|
|
1509
|
+
;
|
|
1510
|
+
"use strict";
|
|
1511
|
+
var $;
|
|
1512
|
+
(function ($) {
|
|
1513
|
+
class $mol_term_color {
|
|
1514
|
+
static reset = this.ansi(0, 0);
|
|
1515
|
+
static bold = this.ansi(1, 22);
|
|
1516
|
+
static italic = this.ansi(3, 23);
|
|
1517
|
+
static underline = this.ansi(4, 24);
|
|
1518
|
+
static inverse = this.ansi(7, 27);
|
|
1519
|
+
static hidden = this.ansi(8, 28);
|
|
1520
|
+
static strike = this.ansi(9, 29);
|
|
1521
|
+
static gray = this.ansi(90, 39);
|
|
1522
|
+
static red = this.ansi(91, 39);
|
|
1523
|
+
static green = this.ansi(92, 39);
|
|
1524
|
+
static yellow = this.ansi(93, 39);
|
|
1525
|
+
static blue = this.ansi(94, 39);
|
|
1526
|
+
static magenta = this.ansi(95, 39);
|
|
1527
|
+
static cyan = this.ansi(96, 39);
|
|
1528
|
+
static Gray = (str) => this.inverse(this.gray(str));
|
|
1529
|
+
static Red = (str) => this.inverse(this.red(str));
|
|
1530
|
+
static Green = (str) => this.inverse(this.green(str));
|
|
1531
|
+
static Yellow = (str) => this.inverse(this.yellow(str));
|
|
1532
|
+
static Blue = (str) => this.inverse(this.blue(str));
|
|
1533
|
+
static Magenta = (str) => this.inverse(this.magenta(str));
|
|
1534
|
+
static Cyan = (str) => this.inverse(this.cyan(str));
|
|
1535
|
+
static ansi(open, close) {
|
|
1536
|
+
if (typeof process === 'undefined')
|
|
1537
|
+
return String;
|
|
1538
|
+
if (!process.stdout.isTTY)
|
|
1539
|
+
return String;
|
|
1540
|
+
const prefix = `\x1b[${open}m`;
|
|
1541
|
+
const postfix = `\x1b[${close}m`;
|
|
1542
|
+
const suffix_regexp = new RegExp(postfix.replace('[', '\\['), 'g');
|
|
1543
|
+
return function colorer(str) {
|
|
1544
|
+
str = String(str);
|
|
1545
|
+
if (str === '')
|
|
1546
|
+
return str;
|
|
1547
|
+
const suffix = str.replace(suffix_regexp, prefix);
|
|
1548
|
+
return prefix + suffix + postfix;
|
|
1549
|
+
};
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
$.$mol_term_color = $mol_term_color;
|
|
1553
|
+
})($ || ($ = {}));
|
|
1554
|
+
//mol/term/color/color.ts
|
|
1555
|
+
;
|
|
1556
|
+
"use strict";
|
|
1557
|
+
var $;
|
|
1558
|
+
(function ($) {
|
|
1559
|
+
function $mol_log3_node_make(level, output, type, color) {
|
|
1560
|
+
return function $mol_log3_logger(event) {
|
|
1561
|
+
if (!event.time)
|
|
1562
|
+
event = { time: new Date().toISOString(), ...event };
|
|
1563
|
+
let tree = this.$mol_tree2_from_json(event);
|
|
1564
|
+
tree = tree.struct(type, tree.kids);
|
|
1565
|
+
let str = color(tree.toString());
|
|
1566
|
+
this.console[level](str);
|
|
1567
|
+
const self = this;
|
|
1568
|
+
return () => self.console.groupEnd();
|
|
1569
|
+
};
|
|
1570
|
+
}
|
|
1571
|
+
$.$mol_log3_node_make = $mol_log3_node_make;
|
|
1572
|
+
$.$mol_log3_come = $mol_log3_node_make('info', 'stdout', 'come', $mol_term_color.blue);
|
|
1573
|
+
$.$mol_log3_done = $mol_log3_node_make('info', 'stdout', 'done', $mol_term_color.green);
|
|
1574
|
+
$.$mol_log3_fail = $mol_log3_node_make('error', 'stderr', 'fail', $mol_term_color.red);
|
|
1575
|
+
$.$mol_log3_warn = $mol_log3_node_make('warn', 'stderr', 'warn', $mol_term_color.yellow);
|
|
1576
|
+
$.$mol_log3_rise = $mol_log3_node_make('log', 'stdout', 'rise', $mol_term_color.magenta);
|
|
1577
|
+
$.$mol_log3_area = $mol_log3_node_make('log', 'stdout', 'area', $mol_term_color.cyan);
|
|
1578
|
+
})($ || ($ = {}));
|
|
1579
|
+
//mol/log3/log3.node.ts
|
|
1580
|
+
;
|
|
1581
|
+
"use strict";
|
|
1582
|
+
var $;
|
|
1583
|
+
(function ($) {
|
|
1584
|
+
class $mol_wire_task extends $mol_wire_fiber {
|
|
1585
|
+
static getter(task) {
|
|
1586
|
+
return function $mol_wire_task_get(host, args) {
|
|
1587
|
+
const sub = $mol_wire_auto();
|
|
1588
|
+
const existen = sub?.track_next();
|
|
1589
|
+
reuse: if (existen) {
|
|
1590
|
+
if (!existen.temp)
|
|
1591
|
+
break reuse;
|
|
1592
|
+
if (existen.host !== host)
|
|
1593
|
+
break reuse;
|
|
1594
|
+
if (existen.task !== task)
|
|
1595
|
+
break reuse;
|
|
1596
|
+
if (!$mol_compare_deep(existen.args, args))
|
|
1597
|
+
break reuse;
|
|
1598
|
+
return existen;
|
|
1599
|
+
}
|
|
1600
|
+
const next = new $mol_wire_task(`${host?.[Symbol.toStringTag] ?? host}.${task.name}(#)`, task, host, args);
|
|
1601
|
+
if (existen?.temp) {
|
|
1602
|
+
$$.$mol_log3_warn({
|
|
1603
|
+
place: '$mol_wire_task',
|
|
1604
|
+
message: `Non idempotency`,
|
|
1605
|
+
existen,
|
|
1606
|
+
next,
|
|
1607
|
+
hint: 'Ignore it',
|
|
1608
|
+
});
|
|
1718
1609
|
}
|
|
1719
|
-
|
|
1610
|
+
return next;
|
|
1611
|
+
};
|
|
1720
1612
|
}
|
|
1721
|
-
|
|
1722
|
-
return
|
|
1613
|
+
get temp() {
|
|
1614
|
+
return true;
|
|
1723
1615
|
}
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1616
|
+
complete() {
|
|
1617
|
+
if ($mol_promise_like(this.cache))
|
|
1618
|
+
return;
|
|
1619
|
+
this.destructor();
|
|
1620
|
+
}
|
|
1621
|
+
put(next) {
|
|
1622
|
+
const prev = this.cache;
|
|
1623
|
+
this.cache = next;
|
|
1624
|
+
if ($mol_promise_like(next)) {
|
|
1625
|
+
this.cursor = $mol_wire_cursor.fresh;
|
|
1626
|
+
if (next !== prev)
|
|
1627
|
+
this.emit();
|
|
1628
|
+
return next;
|
|
1629
|
+
}
|
|
1630
|
+
this.cursor = $mol_wire_cursor.final;
|
|
1631
|
+
if (this.sub_empty)
|
|
1632
|
+
this.destructor();
|
|
1633
|
+
else if (next !== prev)
|
|
1634
|
+
this.emit();
|
|
1635
|
+
return next;
|
|
1729
1636
|
}
|
|
1730
1637
|
}
|
|
1731
|
-
$.$
|
|
1638
|
+
$.$mol_wire_task = $mol_wire_task;
|
|
1732
1639
|
})($ || ($ = {}));
|
|
1733
|
-
//mol/
|
|
1640
|
+
//mol/wire/task/task.ts
|
|
1734
1641
|
;
|
|
1735
1642
|
"use strict";
|
|
1736
1643
|
var $;
|
|
1737
1644
|
(function ($) {
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
this.line = line;
|
|
1746
|
-
this.span = span;
|
|
1645
|
+
function $mol_wire_method(host, field, descr) {
|
|
1646
|
+
if (!descr)
|
|
1647
|
+
descr = Reflect.getOwnPropertyDescriptor(host, field);
|
|
1648
|
+
const orig = descr?.value ?? host[field];
|
|
1649
|
+
const sup = Reflect.getPrototypeOf(host);
|
|
1650
|
+
if (typeof sup[field] === 'function') {
|
|
1651
|
+
Object.defineProperty(orig, 'name', { value: sup[field].name });
|
|
1747
1652
|
}
|
|
1653
|
+
const temp = $mol_wire_task.getter(orig);
|
|
1654
|
+
const value = function (...args) {
|
|
1655
|
+
const fiber = temp(this ?? null, args);
|
|
1656
|
+
return fiber.sync();
|
|
1657
|
+
};
|
|
1658
|
+
Object.defineProperty(value, 'name', { value: orig.name + ' ' });
|
|
1659
|
+
Object.assign(value, { orig });
|
|
1660
|
+
const descr2 = { ...descr, value };
|
|
1661
|
+
Reflect.defineProperty(host, field, descr2);
|
|
1662
|
+
return descr2;
|
|
1748
1663
|
}
|
|
1749
|
-
$.$
|
|
1664
|
+
$.$mol_wire_method = $mol_wire_method;
|
|
1750
1665
|
})($ || ($ = {}));
|
|
1751
|
-
//mol/
|
|
1666
|
+
//mol/wire/method/method.ts
|
|
1667
|
+
;
|
|
1668
|
+
"use strict";
|
|
1669
|
+
//mol/type/tail/tail.ts
|
|
1670
|
+
;
|
|
1671
|
+
"use strict";
|
|
1672
|
+
//mol/type/foot/foot.ts
|
|
1752
1673
|
;
|
|
1753
1674
|
"use strict";
|
|
1754
1675
|
var $;
|
|
1755
1676
|
(function ($) {
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1677
|
+
const catched = new WeakMap();
|
|
1678
|
+
function $mol_fail_catch(error) {
|
|
1679
|
+
if (typeof error !== 'object')
|
|
1680
|
+
return false;
|
|
1681
|
+
if ($mol_promise_like(error))
|
|
1682
|
+
$mol_fail_hidden(error);
|
|
1683
|
+
if (catched.get(error))
|
|
1684
|
+
return false;
|
|
1685
|
+
catched.set(error, true);
|
|
1686
|
+
return true;
|
|
1687
|
+
}
|
|
1688
|
+
$.$mol_fail_catch = $mol_fail_catch;
|
|
1689
|
+
})($ || ($ = {}));
|
|
1690
|
+
//mol/fail/catch/catch.ts
|
|
1691
|
+
;
|
|
1692
|
+
"use strict";
|
|
1693
|
+
var $;
|
|
1694
|
+
(function ($) {
|
|
1695
|
+
function $mol_fail_log(error) {
|
|
1696
|
+
if ($mol_promise_like(error))
|
|
1697
|
+
return false;
|
|
1698
|
+
if (!$mol_fail_catch(error))
|
|
1699
|
+
return false;
|
|
1700
|
+
console.error(error);
|
|
1701
|
+
return true;
|
|
1702
|
+
}
|
|
1703
|
+
$.$mol_fail_log = $mol_fail_log;
|
|
1704
|
+
})($ || ($ = {}));
|
|
1705
|
+
//mol/fail/log/log.ts
|
|
1706
|
+
;
|
|
1707
|
+
"use strict";
|
|
1708
|
+
var $;
|
|
1709
|
+
(function ($) {
|
|
1710
|
+
class $mol_wire_atom extends $mol_wire_fiber {
|
|
1711
|
+
static solo(host, task) {
|
|
1712
|
+
const field = task.name + '()';
|
|
1713
|
+
const existen = Object.getOwnPropertyDescriptor(host ?? task, field)?.value;
|
|
1714
|
+
if (existen)
|
|
1715
|
+
return existen;
|
|
1716
|
+
const prefix = host?.[Symbol.toStringTag] ?? (host instanceof Function ? $$.$mol_func_name(host) : host);
|
|
1717
|
+
const key = `${prefix}.${field}`;
|
|
1718
|
+
const fiber = new $mol_wire_atom(key, task, host, []);
|
|
1719
|
+
(host ?? task)[field] = fiber;
|
|
1720
|
+
return fiber;
|
|
1721
|
+
}
|
|
1722
|
+
static plex(host, task, key) {
|
|
1723
|
+
const field = task.name + '()';
|
|
1724
|
+
let dict = Object.getOwnPropertyDescriptor(host ?? task, field)?.value;
|
|
1725
|
+
const prefix = host?.[Symbol.toStringTag] ?? (host instanceof Function ? $$.$mol_func_name(host) : host);
|
|
1726
|
+
const id = `${prefix}.${task.name}(${$mol_key(key).replace(/^"|"$/g, "'")})`;
|
|
1727
|
+
if (dict) {
|
|
1728
|
+
const existen = dict.get(id);
|
|
1729
|
+
if (existen)
|
|
1730
|
+
return existen;
|
|
1768
1731
|
}
|
|
1769
|
-
|
|
1770
|
-
|
|
1732
|
+
else {
|
|
1733
|
+
dict = (host ?? task)[field] = new Map();
|
|
1771
1734
|
}
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1735
|
+
const fiber = new $mol_wire_atom(id, task, host, [key]);
|
|
1736
|
+
dict.set(id, fiber);
|
|
1737
|
+
return fiber;
|
|
1738
|
+
}
|
|
1739
|
+
static watching = new Set();
|
|
1740
|
+
static watcher = null;
|
|
1741
|
+
static watch() {
|
|
1742
|
+
$mol_wire_atom.watcher = new $mol_after_frame($mol_wire_atom.watch);
|
|
1743
|
+
for (const atom of $mol_wire_atom.watching) {
|
|
1744
|
+
if (atom.cursor === $mol_wire_cursor.final) {
|
|
1745
|
+
$mol_wire_atom.watching.delete(atom);
|
|
1782
1746
|
}
|
|
1783
1747
|
else {
|
|
1784
|
-
|
|
1748
|
+
atom.cursor = $mol_wire_cursor.stale;
|
|
1749
|
+
atom.fresh();
|
|
1785
1750
|
}
|
|
1786
1751
|
}
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1752
|
+
}
|
|
1753
|
+
watch() {
|
|
1754
|
+
if (!$mol_wire_atom.watcher) {
|
|
1755
|
+
$mol_wire_atom.watcher = new $mol_after_frame($mol_wire_atom.watch);
|
|
1756
|
+
}
|
|
1757
|
+
$mol_wire_atom.watching.add(this);
|
|
1758
|
+
}
|
|
1759
|
+
resync(args) {
|
|
1760
|
+
return this.put(this.task.call(this.host, ...args));
|
|
1761
|
+
}
|
|
1762
|
+
once() {
|
|
1763
|
+
return this.sync();
|
|
1764
|
+
}
|
|
1765
|
+
channel() {
|
|
1766
|
+
return Object.assign((next) => {
|
|
1767
|
+
if (next !== undefined)
|
|
1768
|
+
return this.resync([...this.args, next]);
|
|
1769
|
+
if (!$mol_wire_fiber.warm)
|
|
1770
|
+
return this.result();
|
|
1771
|
+
if ($mol_wire_auto()?.temp) {
|
|
1772
|
+
return this.once();
|
|
1800
1773
|
}
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
str[pos] != '\\' &&
|
|
1804
|
-
str[pos] != ' ' &&
|
|
1805
|
-
str[pos] != '\t' &&
|
|
1806
|
-
str[pos] != '\n') {
|
|
1807
|
-
pos++;
|
|
1774
|
+
else {
|
|
1775
|
+
return this.sync();
|
|
1808
1776
|
}
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1777
|
+
}, { atom: this });
|
|
1778
|
+
}
|
|
1779
|
+
destructor() {
|
|
1780
|
+
super.destructor();
|
|
1781
|
+
const prev = this.cache;
|
|
1782
|
+
if ($mol_owning_check(this, prev)) {
|
|
1783
|
+
prev.destructor();
|
|
1784
|
+
}
|
|
1785
|
+
if (this.pub_from === 0) {
|
|
1786
|
+
;
|
|
1787
|
+
(this.host ?? this.task)[this.field()] = null;
|
|
1788
|
+
}
|
|
1789
|
+
else {
|
|
1790
|
+
;
|
|
1791
|
+
(this.host ?? this.task)[this.field()].delete(this[Symbol.toStringTag]);
|
|
1792
|
+
}
|
|
1793
|
+
}
|
|
1794
|
+
put(next) {
|
|
1795
|
+
const prev = this.cache;
|
|
1796
|
+
update: if (next !== prev) {
|
|
1797
|
+
try {
|
|
1798
|
+
if ($mol_compare_deep(prev, next))
|
|
1799
|
+
break update;
|
|
1814
1800
|
}
|
|
1815
|
-
|
|
1816
|
-
|
|
1801
|
+
catch (error) {
|
|
1802
|
+
$mol_fail_log(error);
|
|
1817
1803
|
}
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
var data_start = pos;
|
|
1821
|
-
while (str.length > pos && str[pos] != '\n') {
|
|
1822
|
-
pos++;
|
|
1804
|
+
if ($mol_owning_check(this, prev)) {
|
|
1805
|
+
prev.destructor();
|
|
1823
1806
|
}
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1807
|
+
if ($mol_owning_catch(this, next)) {
|
|
1808
|
+
try {
|
|
1809
|
+
next[Symbol.toStringTag] = this[Symbol.toStringTag];
|
|
1810
|
+
}
|
|
1811
|
+
catch {
|
|
1812
|
+
Object.defineProperty(next, Symbol.toStringTag, { value: this[Symbol.toStringTag] });
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1815
|
+
if (!this.sub_empty)
|
|
1816
|
+
this.emit();
|
|
1832
1817
|
}
|
|
1833
|
-
|
|
1834
|
-
|
|
1818
|
+
this.cache = next;
|
|
1819
|
+
this.cursor = $mol_wire_cursor.fresh;
|
|
1820
|
+
if ($mol_promise_like(next))
|
|
1821
|
+
return next;
|
|
1822
|
+
this.complete_pubs();
|
|
1823
|
+
return next;
|
|
1835
1824
|
}
|
|
1836
|
-
return root;
|
|
1837
1825
|
}
|
|
1838
|
-
|
|
1826
|
+
__decorate([
|
|
1827
|
+
$mol_wire_method
|
|
1828
|
+
], $mol_wire_atom.prototype, "resync", null);
|
|
1829
|
+
__decorate([
|
|
1830
|
+
$mol_wire_method
|
|
1831
|
+
], $mol_wire_atom.prototype, "once", null);
|
|
1832
|
+
$.$mol_wire_atom = $mol_wire_atom;
|
|
1839
1833
|
})($ || ($ = {}));
|
|
1840
|
-
//mol/
|
|
1834
|
+
//mol/wire/atom/atom.ts
|
|
1841
1835
|
;
|
|
1842
1836
|
"use strict";
|
|
1843
1837
|
var $;
|
|
1844
1838
|
(function ($) {
|
|
1845
|
-
function $
|
|
1846
|
-
if (
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
if (Array.isArray(json)) {
|
|
1853
|
-
const sub = json.map(json => $mol_tree2_from_json(json, span));
|
|
1854
|
-
return new $mol_tree2('/', '', sub, span);
|
|
1855
|
-
}
|
|
1856
|
-
if (ArrayBuffer.isView(json)) {
|
|
1857
|
-
const buf = new Uint8Array(json.buffer, json.byteOffset, json.byteLength);
|
|
1858
|
-
return $mol_tree2.data(String.fromCharCode(...buf), [], span);
|
|
1859
|
-
}
|
|
1860
|
-
if (json instanceof Date) {
|
|
1861
|
-
return new $mol_tree2('', json.toISOString(), [], span);
|
|
1862
|
-
}
|
|
1863
|
-
if (typeof json.toJSON === 'function') {
|
|
1864
|
-
return $mol_tree2_from_json(json.toJSON());
|
|
1865
|
-
}
|
|
1866
|
-
if (json instanceof Error) {
|
|
1867
|
-
const { name, message, stack } = json;
|
|
1868
|
-
json = { ...json, name, message, stack };
|
|
1839
|
+
function $mol_wire_solo(host, field, descr) {
|
|
1840
|
+
if (!descr)
|
|
1841
|
+
descr = Reflect.getOwnPropertyDescriptor(host, field);
|
|
1842
|
+
const orig = descr?.value ?? host[field];
|
|
1843
|
+
const sup = Reflect.getPrototypeOf(host);
|
|
1844
|
+
if (typeof sup[field] === 'function') {
|
|
1845
|
+
Object.defineProperty(orig, 'name', { value: sup[field].name });
|
|
1869
1846
|
}
|
|
1870
|
-
const
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1847
|
+
const descr2 = {
|
|
1848
|
+
...descr,
|
|
1849
|
+
value: function (...args) {
|
|
1850
|
+
let atom = $mol_wire_atom.solo(this, orig);
|
|
1851
|
+
if ((args.length === 0) || (args[0] === undefined)) {
|
|
1852
|
+
if (!$mol_wire_fiber.warm)
|
|
1853
|
+
return atom.result();
|
|
1854
|
+
if ($mol_wire_auto()?.temp) {
|
|
1855
|
+
return atom.once();
|
|
1856
|
+
}
|
|
1857
|
+
else {
|
|
1858
|
+
return atom.sync();
|
|
1859
|
+
}
|
|
1860
|
+
}
|
|
1861
|
+
return atom.resync(args);
|
|
1881
1862
|
}
|
|
1882
|
-
}
|
|
1883
|
-
|
|
1863
|
+
};
|
|
1864
|
+
Reflect.defineProperty(descr2.value, 'name', { value: orig.name + ' ' });
|
|
1865
|
+
Reflect.defineProperty(descr2.value, 'length', { value: orig.length });
|
|
1866
|
+
Object.assign(descr2.value, { orig });
|
|
1867
|
+
Reflect.defineProperty(host, field, descr2);
|
|
1868
|
+
return descr2;
|
|
1884
1869
|
}
|
|
1885
|
-
$.$
|
|
1870
|
+
$.$mol_wire_solo = $mol_wire_solo;
|
|
1886
1871
|
})($ || ($ = {}));
|
|
1887
|
-
//mol/
|
|
1872
|
+
//mol/wire/solo/solo.ts
|
|
1888
1873
|
;
|
|
1889
1874
|
"use strict";
|
|
1890
1875
|
var $;
|
|
1891
1876
|
(function ($) {
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
static strike = this.ansi(9, 29);
|
|
1900
|
-
static gray = this.ansi(90, 39);
|
|
1901
|
-
static red = this.ansi(91, 39);
|
|
1902
|
-
static green = this.ansi(92, 39);
|
|
1903
|
-
static yellow = this.ansi(93, 39);
|
|
1904
|
-
static blue = this.ansi(94, 39);
|
|
1905
|
-
static magenta = this.ansi(95, 39);
|
|
1906
|
-
static cyan = this.ansi(96, 39);
|
|
1907
|
-
static Gray = (str) => this.inverse(this.gray(str));
|
|
1908
|
-
static Red = (str) => this.inverse(this.red(str));
|
|
1909
|
-
static Green = (str) => this.inverse(this.green(str));
|
|
1910
|
-
static Yellow = (str) => this.inverse(this.yellow(str));
|
|
1911
|
-
static Blue = (str) => this.inverse(this.blue(str));
|
|
1912
|
-
static Magenta = (str) => this.inverse(this.magenta(str));
|
|
1913
|
-
static Cyan = (str) => this.inverse(this.cyan(str));
|
|
1914
|
-
static ansi(open, close) {
|
|
1915
|
-
if (typeof process === 'undefined')
|
|
1916
|
-
return String;
|
|
1917
|
-
if (!process.stdout.isTTY)
|
|
1918
|
-
return String;
|
|
1919
|
-
const prefix = `\x1b[${open}m`;
|
|
1920
|
-
const postfix = `\x1b[${close}m`;
|
|
1921
|
-
const suffix_regexp = new RegExp(postfix.replace('[', '\\['), 'g');
|
|
1922
|
-
return function colorer(str) {
|
|
1923
|
-
str = String(str);
|
|
1924
|
-
if (str === '')
|
|
1925
|
-
return str;
|
|
1926
|
-
const suffix = str.replace(suffix_regexp, prefix);
|
|
1927
|
-
return prefix + suffix + postfix;
|
|
1928
|
-
};
|
|
1877
|
+
function $mol_wire_plex(host, field, descr) {
|
|
1878
|
+
if (!descr)
|
|
1879
|
+
descr = Reflect.getOwnPropertyDescriptor(host, field);
|
|
1880
|
+
const orig = descr?.value ?? host[field];
|
|
1881
|
+
const sup = Reflect.getPrototypeOf(host);
|
|
1882
|
+
if (typeof sup[field] === 'function') {
|
|
1883
|
+
Object.defineProperty(orig, 'name', { value: sup[field].name });
|
|
1929
1884
|
}
|
|
1885
|
+
const descr2 = {
|
|
1886
|
+
...descr,
|
|
1887
|
+
value: function (...args) {
|
|
1888
|
+
let atom = $mol_wire_atom.plex(this, orig, args[0]);
|
|
1889
|
+
if ((args.length === 1) || (args[1] === undefined)) {
|
|
1890
|
+
if (!$mol_wire_fiber.warm)
|
|
1891
|
+
return atom.result();
|
|
1892
|
+
if ($mol_wire_auto()?.temp) {
|
|
1893
|
+
return atom.once();
|
|
1894
|
+
}
|
|
1895
|
+
else {
|
|
1896
|
+
return atom.sync();
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
return atom.resync(args);
|
|
1900
|
+
}
|
|
1901
|
+
};
|
|
1902
|
+
Reflect.defineProperty(descr2.value, 'name', { value: orig.name + ' ' });
|
|
1903
|
+
Reflect.defineProperty(descr2.value, 'length', { value: orig.length });
|
|
1904
|
+
Object.assign(descr2.value, { orig });
|
|
1905
|
+
Reflect.defineProperty(host, field, descr2);
|
|
1906
|
+
return descr2;
|
|
1930
1907
|
}
|
|
1931
|
-
$.$
|
|
1908
|
+
$.$mol_wire_plex = $mol_wire_plex;
|
|
1932
1909
|
})($ || ($ = {}));
|
|
1933
|
-
//mol/
|
|
1910
|
+
//mol/wire/plex/plex.ts
|
|
1934
1911
|
;
|
|
1935
1912
|
"use strict";
|
|
1936
1913
|
var $;
|
|
1937
1914
|
(function ($) {
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
if (!event.time)
|
|
1941
|
-
event = { time: new Date().toISOString(), ...event };
|
|
1942
|
-
let tree = this.$mol_tree2_from_json(event);
|
|
1943
|
-
tree = tree.struct(type, tree.kids);
|
|
1944
|
-
let str = color(tree.toString());
|
|
1945
|
-
this.console[level](str);
|
|
1946
|
-
const self = this;
|
|
1947
|
-
return () => self.console.groupEnd();
|
|
1948
|
-
};
|
|
1949
|
-
}
|
|
1950
|
-
$.$mol_log3_node_make = $mol_log3_node_make;
|
|
1951
|
-
$.$mol_log3_come = $mol_log3_node_make('info', 'stdout', 'come', $mol_term_color.blue);
|
|
1952
|
-
$.$mol_log3_done = $mol_log3_node_make('info', 'stdout', 'done', $mol_term_color.green);
|
|
1953
|
-
$.$mol_log3_fail = $mol_log3_node_make('error', 'stderr', 'fail', $mol_term_color.red);
|
|
1954
|
-
$.$mol_log3_warn = $mol_log3_node_make('warn', 'stderr', 'warn', $mol_term_color.yellow);
|
|
1955
|
-
$.$mol_log3_rise = $mol_log3_node_make('log', 'stdout', 'rise', $mol_term_color.magenta);
|
|
1956
|
-
$.$mol_log3_area = $mol_log3_node_make('log', 'stdout', 'area', $mol_term_color.cyan);
|
|
1915
|
+
$.$mol_mem = $mol_wire_solo;
|
|
1916
|
+
$.$mol_mem_key = $mol_wire_plex;
|
|
1957
1917
|
})($ || ($ = {}));
|
|
1958
|
-
//mol/
|
|
1918
|
+
//mol/mem/mem.ts
|
|
1919
|
+
;
|
|
1920
|
+
"use strict";
|
|
1921
|
+
var $;
|
|
1922
|
+
(function ($) {
|
|
1923
|
+
})($ || ($ = {}));
|
|
1924
|
+
//mol/dom/context/context.ts
|
|
1925
|
+
;
|
|
1926
|
+
"use strict";
|
|
1927
|
+
//node/node.ts
|
|
1928
|
+
;
|
|
1929
|
+
"use strict";
|
|
1930
|
+
var $node = new Proxy({ require }, {
|
|
1931
|
+
get(target, name, wrapper) {
|
|
1932
|
+
if (target[name])
|
|
1933
|
+
return target[name];
|
|
1934
|
+
const mod = target.require('module');
|
|
1935
|
+
if (mod.builtinModules.indexOf(name) >= 0)
|
|
1936
|
+
return target.require(name);
|
|
1937
|
+
if (name[0] === '.')
|
|
1938
|
+
return target.require(name);
|
|
1939
|
+
const path = target.require('path');
|
|
1940
|
+
const fs = target.require('fs');
|
|
1941
|
+
let dir = path.resolve('.');
|
|
1942
|
+
const suffix = `./node_modules/${name}`;
|
|
1943
|
+
const $$ = $;
|
|
1944
|
+
while (!fs.existsSync(path.join(dir, suffix))) {
|
|
1945
|
+
const parent = path.resolve(dir, '..');
|
|
1946
|
+
if (parent === dir) {
|
|
1947
|
+
$$.$mol_exec('.', 'npm', 'install', '--omit=dev', name);
|
|
1948
|
+
try {
|
|
1949
|
+
$$.$mol_exec('.', 'npm', 'install', '--omit=dev', '@types/' + name);
|
|
1950
|
+
}
|
|
1951
|
+
catch { }
|
|
1952
|
+
break;
|
|
1953
|
+
}
|
|
1954
|
+
else {
|
|
1955
|
+
dir = parent;
|
|
1956
|
+
}
|
|
1957
|
+
}
|
|
1958
|
+
return target.require(name);
|
|
1959
|
+
},
|
|
1960
|
+
set(target, name, value) {
|
|
1961
|
+
target[name] = value;
|
|
1962
|
+
return true;
|
|
1963
|
+
},
|
|
1964
|
+
});
|
|
1965
|
+
require = (req => Object.assign(function require(name) {
|
|
1966
|
+
return $node[name];
|
|
1967
|
+
}, req))(require);
|
|
1968
|
+
//node/node.node.ts
|
|
1959
1969
|
;
|
|
1960
1970
|
"use strict";
|
|
1961
1971
|
var $;
|