mol_wire_lib 1.0.837 → 1.0.839
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 +133 -133
- package/node.deps.json +1 -1
- package/node.js +1133 -1123
- package/node.js.map +1 -1
- package/node.mjs +1133 -1123
- package/node.test.js +1038 -1052
- package/node.test.js.map +1 -1
- package/package.json +14 -14
- package/web.d.ts +33 -33
- package/web.deps.json +1 -1
- package/web.js +67 -57
- package/web.js.map +1 -1
- package/web.mjs +67 -57
- package/web.test.js +33 -57
- package/web.test.js.map +1 -1
package/node.test.js
CHANGED
|
@@ -974,6 +974,519 @@ var $;
|
|
|
974
974
|
;
|
|
975
975
|
"use strict";
|
|
976
976
|
var $;
|
|
977
|
+
(function ($) {
|
|
978
|
+
function $mol_log3_area_lazy(event) {
|
|
979
|
+
const self = this;
|
|
980
|
+
const stack = self.$mol_log3_stack;
|
|
981
|
+
const deep = stack.length;
|
|
982
|
+
let logged = false;
|
|
983
|
+
stack.push(() => {
|
|
984
|
+
logged = true;
|
|
985
|
+
self.$mol_log3_area.call(self, event);
|
|
986
|
+
});
|
|
987
|
+
return () => {
|
|
988
|
+
if (logged)
|
|
989
|
+
self.console.groupEnd();
|
|
990
|
+
if (stack.length > deep)
|
|
991
|
+
stack.length = deep;
|
|
992
|
+
};
|
|
993
|
+
}
|
|
994
|
+
$.$mol_log3_area_lazy = $mol_log3_area_lazy;
|
|
995
|
+
$.$mol_log3_stack = [];
|
|
996
|
+
})($ || ($ = {}));
|
|
997
|
+
//mol/log3/log3.ts
|
|
998
|
+
;
|
|
999
|
+
"use strict";
|
|
1000
|
+
var $;
|
|
1001
|
+
(function ($) {
|
|
1002
|
+
class $mol_span extends $mol_object2 {
|
|
1003
|
+
uri;
|
|
1004
|
+
source;
|
|
1005
|
+
row;
|
|
1006
|
+
col;
|
|
1007
|
+
length;
|
|
1008
|
+
constructor(uri, source, row, col, length) {
|
|
1009
|
+
super();
|
|
1010
|
+
this.uri = uri;
|
|
1011
|
+
this.source = source;
|
|
1012
|
+
this.row = row;
|
|
1013
|
+
this.col = col;
|
|
1014
|
+
this.length = length;
|
|
1015
|
+
this[Symbol.toStringTag] = `${this.uri}#${this.row}:${this.col}/${this.length}`;
|
|
1016
|
+
}
|
|
1017
|
+
static unknown = $mol_span.begin('?');
|
|
1018
|
+
static begin(uri, source = '') {
|
|
1019
|
+
return new $mol_span(uri, source, 1, 1, 0);
|
|
1020
|
+
}
|
|
1021
|
+
static end(uri, source) {
|
|
1022
|
+
return new $mol_span(uri, source, 1, source.length + 1, 0);
|
|
1023
|
+
}
|
|
1024
|
+
static entire(uri, source) {
|
|
1025
|
+
return new $mol_span(uri, source, 1, 1, source.length);
|
|
1026
|
+
}
|
|
1027
|
+
toString() {
|
|
1028
|
+
return this[Symbol.toStringTag];
|
|
1029
|
+
}
|
|
1030
|
+
toJSON() {
|
|
1031
|
+
return {
|
|
1032
|
+
uri: this.uri,
|
|
1033
|
+
row: this.row,
|
|
1034
|
+
col: this.col,
|
|
1035
|
+
length: this.length
|
|
1036
|
+
};
|
|
1037
|
+
}
|
|
1038
|
+
error(message, Class = Error) {
|
|
1039
|
+
return new Class(`${message} (${this})`);
|
|
1040
|
+
}
|
|
1041
|
+
span(row, col, length) {
|
|
1042
|
+
return new $mol_span(this.uri, this.source, row, col, length);
|
|
1043
|
+
}
|
|
1044
|
+
after(length = 0) {
|
|
1045
|
+
return new $mol_span(this.uri, this.source, this.row, this.col + this.length, length);
|
|
1046
|
+
}
|
|
1047
|
+
slice(begin, end = -1) {
|
|
1048
|
+
let len = this.length;
|
|
1049
|
+
if (begin < 0)
|
|
1050
|
+
begin += len;
|
|
1051
|
+
if (end < 0)
|
|
1052
|
+
end += len;
|
|
1053
|
+
if (begin < 0 || begin > len)
|
|
1054
|
+
this.$.$mol_fail(this.error(`Begin value '${begin}' out of range`, RangeError));
|
|
1055
|
+
if (end < 0 || end > len)
|
|
1056
|
+
this.$.$mol_fail(this.error(`End value '${end}' out of range`, RangeError));
|
|
1057
|
+
if (end < begin)
|
|
1058
|
+
this.$.$mol_fail(this.error(`End value '${end}' can't be less than begin value`, RangeError));
|
|
1059
|
+
return this.span(this.row, this.col + begin, end - begin);
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
$.$mol_span = $mol_span;
|
|
1063
|
+
})($ || ($ = {}));
|
|
1064
|
+
//mol/span/span.ts
|
|
1065
|
+
;
|
|
1066
|
+
"use strict";
|
|
1067
|
+
var $;
|
|
1068
|
+
(function ($) {
|
|
1069
|
+
function $mol_tree2_to_string(tree) {
|
|
1070
|
+
let output = [];
|
|
1071
|
+
function dump(tree, prefix = '') {
|
|
1072
|
+
if (tree.type.length) {
|
|
1073
|
+
if (!prefix.length) {
|
|
1074
|
+
prefix = "\t";
|
|
1075
|
+
}
|
|
1076
|
+
output.push(tree.type);
|
|
1077
|
+
if (tree.kids.length == 1) {
|
|
1078
|
+
output.push(' ');
|
|
1079
|
+
dump(tree.kids[0], prefix);
|
|
1080
|
+
return;
|
|
1081
|
+
}
|
|
1082
|
+
output.push("\n");
|
|
1083
|
+
}
|
|
1084
|
+
else if (tree.value.length || prefix.length) {
|
|
1085
|
+
output.push("\\" + tree.value + "\n");
|
|
1086
|
+
}
|
|
1087
|
+
for (const kid of tree.kids) {
|
|
1088
|
+
output.push(prefix);
|
|
1089
|
+
dump(kid, prefix + "\t");
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
dump(tree);
|
|
1093
|
+
return output.join('');
|
|
1094
|
+
}
|
|
1095
|
+
$.$mol_tree2_to_string = $mol_tree2_to_string;
|
|
1096
|
+
})($ || ($ = {}));
|
|
1097
|
+
//mol/tree2/to/string/string.ts
|
|
1098
|
+
;
|
|
1099
|
+
"use strict";
|
|
1100
|
+
var $;
|
|
1101
|
+
(function ($) {
|
|
1102
|
+
class $mol_tree2 extends Object {
|
|
1103
|
+
type;
|
|
1104
|
+
value;
|
|
1105
|
+
kids;
|
|
1106
|
+
span;
|
|
1107
|
+
constructor(type, value, kids, span) {
|
|
1108
|
+
super();
|
|
1109
|
+
this.type = type;
|
|
1110
|
+
this.value = value;
|
|
1111
|
+
this.kids = kids;
|
|
1112
|
+
this.span = span;
|
|
1113
|
+
this[Symbol.toStringTag] = type || '\\' + value;
|
|
1114
|
+
}
|
|
1115
|
+
static list(kids, span = $mol_span.unknown) {
|
|
1116
|
+
return new $mol_tree2('', '', kids, span);
|
|
1117
|
+
}
|
|
1118
|
+
list(kids) {
|
|
1119
|
+
return $mol_tree2.list(kids, this.span);
|
|
1120
|
+
}
|
|
1121
|
+
static data(value, kids = [], span = $mol_span.unknown) {
|
|
1122
|
+
const chunks = value.split('\n');
|
|
1123
|
+
if (chunks.length > 1) {
|
|
1124
|
+
let kid_span = span.span(span.row, span.col, 0);
|
|
1125
|
+
const data = chunks.map(chunk => {
|
|
1126
|
+
kid_span = kid_span.after(chunk.length);
|
|
1127
|
+
return new $mol_tree2('', chunk, [], kid_span);
|
|
1128
|
+
});
|
|
1129
|
+
kids = [...data, ...kids];
|
|
1130
|
+
value = '';
|
|
1131
|
+
}
|
|
1132
|
+
return new $mol_tree2('', value, kids, span);
|
|
1133
|
+
}
|
|
1134
|
+
data(value, kids = []) {
|
|
1135
|
+
return $mol_tree2.data(value, kids, this.span);
|
|
1136
|
+
}
|
|
1137
|
+
static struct(type, kids = [], span = $mol_span.unknown) {
|
|
1138
|
+
if (/[ \n\t\\]/.test(type)) {
|
|
1139
|
+
$$.$mol_fail(span.error(`Wrong type ${JSON.stringify(type)}`));
|
|
1140
|
+
}
|
|
1141
|
+
return new $mol_tree2(type, '', kids, span);
|
|
1142
|
+
}
|
|
1143
|
+
struct(type, kids = []) {
|
|
1144
|
+
return $mol_tree2.struct(type, kids, this.span);
|
|
1145
|
+
}
|
|
1146
|
+
clone(kids, span = this.span) {
|
|
1147
|
+
return new $mol_tree2(this.type, this.value, kids, span);
|
|
1148
|
+
}
|
|
1149
|
+
text() {
|
|
1150
|
+
var values = [];
|
|
1151
|
+
for (var kid of this.kids) {
|
|
1152
|
+
if (kid.type)
|
|
1153
|
+
continue;
|
|
1154
|
+
values.push(kid.value);
|
|
1155
|
+
}
|
|
1156
|
+
return this.value + values.join('\n');
|
|
1157
|
+
}
|
|
1158
|
+
static fromString(str, uri = 'unknown') {
|
|
1159
|
+
return $$.$mol_tree2_from_string(str, uri);
|
|
1160
|
+
}
|
|
1161
|
+
toString() {
|
|
1162
|
+
return $$.$mol_tree2_to_string(this);
|
|
1163
|
+
}
|
|
1164
|
+
insert(value, ...path) {
|
|
1165
|
+
if (path.length === 0)
|
|
1166
|
+
return value;
|
|
1167
|
+
const type = path[0];
|
|
1168
|
+
if (typeof type === 'string') {
|
|
1169
|
+
let replaced = false;
|
|
1170
|
+
const sub = this.kids.map((item, index) => {
|
|
1171
|
+
if (item.type !== type)
|
|
1172
|
+
return item;
|
|
1173
|
+
replaced = true;
|
|
1174
|
+
return item.insert(value, ...path.slice(1));
|
|
1175
|
+
}).filter(Boolean);
|
|
1176
|
+
if (!replaced && value) {
|
|
1177
|
+
sub.push(this.struct(type, []).insert(value, ...path.slice(1)));
|
|
1178
|
+
}
|
|
1179
|
+
return this.clone(sub);
|
|
1180
|
+
}
|
|
1181
|
+
else if (typeof type === 'number') {
|
|
1182
|
+
const sub = this.kids.slice();
|
|
1183
|
+
sub[type] = (sub[type] || this.list([]))
|
|
1184
|
+
.insert(value, ...path.slice(1));
|
|
1185
|
+
return this.clone(sub.filter(Boolean));
|
|
1186
|
+
}
|
|
1187
|
+
else {
|
|
1188
|
+
const kids = ((this.kids.length === 0) ? [this.list([])] : this.kids)
|
|
1189
|
+
.map(item => item.insert(value, ...path.slice(1)))
|
|
1190
|
+
.filter(Boolean);
|
|
1191
|
+
return this.clone(kids);
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
select(...path) {
|
|
1195
|
+
let next = [this];
|
|
1196
|
+
for (const type of path) {
|
|
1197
|
+
if (!next.length)
|
|
1198
|
+
break;
|
|
1199
|
+
const prev = next;
|
|
1200
|
+
next = [];
|
|
1201
|
+
for (var item of prev) {
|
|
1202
|
+
switch (typeof (type)) {
|
|
1203
|
+
case 'string':
|
|
1204
|
+
for (var child of item.kids) {
|
|
1205
|
+
if (child.type == type) {
|
|
1206
|
+
next.push(child);
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
break;
|
|
1210
|
+
case 'number':
|
|
1211
|
+
if (type < item.kids.length)
|
|
1212
|
+
next.push(item.kids[type]);
|
|
1213
|
+
break;
|
|
1214
|
+
default: next.push(...item.kids);
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
return this.list(next);
|
|
1219
|
+
}
|
|
1220
|
+
filter(path, value) {
|
|
1221
|
+
const sub = this.kids.filter(item => {
|
|
1222
|
+
var found = item.select(...path);
|
|
1223
|
+
if (value === undefined) {
|
|
1224
|
+
return Boolean(found.kids.length);
|
|
1225
|
+
}
|
|
1226
|
+
else {
|
|
1227
|
+
return found.kids.some(child => child.value == value);
|
|
1228
|
+
}
|
|
1229
|
+
});
|
|
1230
|
+
return this.clone(sub);
|
|
1231
|
+
}
|
|
1232
|
+
hack(belt, context = {}) {
|
|
1233
|
+
return [].concat(...this.kids.map(child => {
|
|
1234
|
+
let handle = belt[child.type] || belt[''];
|
|
1235
|
+
if (!handle || handle === Object.prototype[child.type]) {
|
|
1236
|
+
handle = (input, belt, context) => [
|
|
1237
|
+
input.clone(input.hack(belt, context), context.span)
|
|
1238
|
+
];
|
|
1239
|
+
}
|
|
1240
|
+
try {
|
|
1241
|
+
return handle(child, belt, context);
|
|
1242
|
+
}
|
|
1243
|
+
catch (error) {
|
|
1244
|
+
error.message += `\n${child.clone([])}${child.span}`;
|
|
1245
|
+
$mol_fail_hidden(error);
|
|
1246
|
+
}
|
|
1247
|
+
}));
|
|
1248
|
+
}
|
|
1249
|
+
error(message, Class = Error) {
|
|
1250
|
+
return this.span.error(`${message}\n${this.clone([])}`, Class);
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
$.$mol_tree2 = $mol_tree2;
|
|
1254
|
+
class $mol_tree2_empty extends $mol_tree2 {
|
|
1255
|
+
constructor() {
|
|
1256
|
+
super('', '', [], $mol_span.unknown);
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
$.$mol_tree2_empty = $mol_tree2_empty;
|
|
1260
|
+
})($ || ($ = {}));
|
|
1261
|
+
//mol/tree2/tree2.ts
|
|
1262
|
+
;
|
|
1263
|
+
"use strict";
|
|
1264
|
+
var $;
|
|
1265
|
+
(function ($) {
|
|
1266
|
+
class $mol_error_syntax extends SyntaxError {
|
|
1267
|
+
reason;
|
|
1268
|
+
line;
|
|
1269
|
+
span;
|
|
1270
|
+
constructor(reason, line, span) {
|
|
1271
|
+
super(`${reason}\n${span}\n${line.substring(0, span.col - 1).replace(/\S/g, ' ')}${''.padEnd(span.length, '!')}\n${line}`);
|
|
1272
|
+
this.reason = reason;
|
|
1273
|
+
this.line = line;
|
|
1274
|
+
this.span = span;
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
$.$mol_error_syntax = $mol_error_syntax;
|
|
1278
|
+
})($ || ($ = {}));
|
|
1279
|
+
//mol/error/syntax/syntax.ts
|
|
1280
|
+
;
|
|
1281
|
+
"use strict";
|
|
1282
|
+
var $;
|
|
1283
|
+
(function ($) {
|
|
1284
|
+
function $mol_tree2_from_string(str, uri = '?') {
|
|
1285
|
+
const span = $mol_span.entire(uri, str);
|
|
1286
|
+
var root = $mol_tree2.list([], span);
|
|
1287
|
+
var stack = [root];
|
|
1288
|
+
var pos = 0, row = 0, min_indent = 0;
|
|
1289
|
+
while (str.length > pos) {
|
|
1290
|
+
var indent = 0;
|
|
1291
|
+
var line_start = pos;
|
|
1292
|
+
row++;
|
|
1293
|
+
while (str.length > pos && str[pos] == '\t') {
|
|
1294
|
+
indent++;
|
|
1295
|
+
pos++;
|
|
1296
|
+
}
|
|
1297
|
+
if (!root.kids.length) {
|
|
1298
|
+
min_indent = indent;
|
|
1299
|
+
}
|
|
1300
|
+
indent -= min_indent;
|
|
1301
|
+
if (indent < 0 || indent >= stack.length) {
|
|
1302
|
+
const sp = span.span(row, 1, pos - line_start);
|
|
1303
|
+
while (str.length > pos && str[pos] != '\n') {
|
|
1304
|
+
pos++;
|
|
1305
|
+
}
|
|
1306
|
+
if (indent < 0) {
|
|
1307
|
+
if (str.length > pos) {
|
|
1308
|
+
this.$mol_fail(new this.$mol_error_syntax(`Too few tabs`, str.substring(line_start, pos), sp));
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
else {
|
|
1312
|
+
this.$mol_fail(new this.$mol_error_syntax(`Too many tabs`, str.substring(line_start, pos), sp));
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
stack.length = indent + 1;
|
|
1316
|
+
var parent = stack[indent];
|
|
1317
|
+
while (str.length > pos && str[pos] != '\\' && str[pos] != '\n') {
|
|
1318
|
+
var error_start = pos;
|
|
1319
|
+
while (str.length > pos && (str[pos] == ' ' || str[pos] == '\t')) {
|
|
1320
|
+
pos++;
|
|
1321
|
+
}
|
|
1322
|
+
if (pos > error_start) {
|
|
1323
|
+
let line_end = str.indexOf('\n', pos);
|
|
1324
|
+
if (line_end === -1)
|
|
1325
|
+
line_end = str.length;
|
|
1326
|
+
const sp = span.span(row, error_start - line_start + 1, pos - error_start);
|
|
1327
|
+
this.$mol_fail(new this.$mol_error_syntax(`Wrong nodes separator`, str.substring(line_start, line_end), sp));
|
|
1328
|
+
}
|
|
1329
|
+
var type_start = pos;
|
|
1330
|
+
while (str.length > pos &&
|
|
1331
|
+
str[pos] != '\\' &&
|
|
1332
|
+
str[pos] != ' ' &&
|
|
1333
|
+
str[pos] != '\t' &&
|
|
1334
|
+
str[pos] != '\n') {
|
|
1335
|
+
pos++;
|
|
1336
|
+
}
|
|
1337
|
+
if (pos > type_start) {
|
|
1338
|
+
let next = new $mol_tree2(str.slice(type_start, pos), '', [], span.span(row, type_start - line_start + 1, pos - type_start));
|
|
1339
|
+
const parent_kids = parent.kids;
|
|
1340
|
+
parent_kids.push(next);
|
|
1341
|
+
parent = next;
|
|
1342
|
+
}
|
|
1343
|
+
if (str.length > pos && str[pos] == ' ') {
|
|
1344
|
+
pos++;
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
if (str.length > pos && str[pos] == '\\') {
|
|
1348
|
+
var data_start = pos;
|
|
1349
|
+
while (str.length > pos && str[pos] != '\n') {
|
|
1350
|
+
pos++;
|
|
1351
|
+
}
|
|
1352
|
+
let next = new $mol_tree2('', str.slice(data_start + 1, pos), [], span.span(row, data_start - line_start + 2, pos - data_start - 1));
|
|
1353
|
+
const parent_kids = parent.kids;
|
|
1354
|
+
parent_kids.push(next);
|
|
1355
|
+
parent = next;
|
|
1356
|
+
}
|
|
1357
|
+
if (str.length === pos && stack.length > 0) {
|
|
1358
|
+
const sp = span.span(row, pos - line_start + 1, 1);
|
|
1359
|
+
this.$mol_fail(new this.$mol_error_syntax(`Unexpected EOF, LF required`, str.substring(line_start, str.length), sp));
|
|
1360
|
+
}
|
|
1361
|
+
stack.push(parent);
|
|
1362
|
+
pos++;
|
|
1363
|
+
}
|
|
1364
|
+
return root;
|
|
1365
|
+
}
|
|
1366
|
+
$.$mol_tree2_from_string = $mol_tree2_from_string;
|
|
1367
|
+
})($ || ($ = {}));
|
|
1368
|
+
//mol/tree2/from/string/string.ts
|
|
1369
|
+
;
|
|
1370
|
+
"use strict";
|
|
1371
|
+
var $;
|
|
1372
|
+
(function ($) {
|
|
1373
|
+
function $mol_tree2_from_json(json, span = $mol_span.unknown) {
|
|
1374
|
+
if (typeof json === 'boolean' || typeof json === 'number' || json === null) {
|
|
1375
|
+
return new $mol_tree2(String(json), '', [], span);
|
|
1376
|
+
}
|
|
1377
|
+
if (typeof json === 'string') {
|
|
1378
|
+
return $mol_tree2.data(json, [], span);
|
|
1379
|
+
}
|
|
1380
|
+
if (Array.isArray(json)) {
|
|
1381
|
+
const sub = json.map(json => $mol_tree2_from_json(json, span));
|
|
1382
|
+
return new $mol_tree2('/', '', sub, span);
|
|
1383
|
+
}
|
|
1384
|
+
if (ArrayBuffer.isView(json)) {
|
|
1385
|
+
const buf = new Uint8Array(json.buffer, json.byteOffset, json.byteLength);
|
|
1386
|
+
return $mol_tree2.data(String.fromCharCode(...buf), [], span);
|
|
1387
|
+
}
|
|
1388
|
+
if (json instanceof Date) {
|
|
1389
|
+
return new $mol_tree2('', json.toISOString(), [], span);
|
|
1390
|
+
}
|
|
1391
|
+
if (typeof json.toJSON === 'function') {
|
|
1392
|
+
return $mol_tree2_from_json(json.toJSON());
|
|
1393
|
+
}
|
|
1394
|
+
if (json instanceof Error) {
|
|
1395
|
+
const { name, message, stack } = json;
|
|
1396
|
+
json = { ...json, name, message, stack };
|
|
1397
|
+
}
|
|
1398
|
+
const sub = [];
|
|
1399
|
+
for (var key in json) {
|
|
1400
|
+
const val = json[key];
|
|
1401
|
+
if (val === undefined)
|
|
1402
|
+
continue;
|
|
1403
|
+
const subsub = $mol_tree2_from_json(val, span);
|
|
1404
|
+
if (/^[^\n\t\\ ]+$/.test(key)) {
|
|
1405
|
+
sub.push(new $mol_tree2(key, '', [subsub], span));
|
|
1406
|
+
}
|
|
1407
|
+
else {
|
|
1408
|
+
sub.push($mol_tree2.data(key, [subsub], span));
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
return new $mol_tree2('*', '', sub, span);
|
|
1412
|
+
}
|
|
1413
|
+
$.$mol_tree2_from_json = $mol_tree2_from_json;
|
|
1414
|
+
})($ || ($ = {}));
|
|
1415
|
+
//mol/tree2/from/json/json.ts
|
|
1416
|
+
;
|
|
1417
|
+
"use strict";
|
|
1418
|
+
var $;
|
|
1419
|
+
(function ($) {
|
|
1420
|
+
class $mol_term_color {
|
|
1421
|
+
static reset = this.ansi(0, 0);
|
|
1422
|
+
static bold = this.ansi(1, 22);
|
|
1423
|
+
static italic = this.ansi(3, 23);
|
|
1424
|
+
static underline = this.ansi(4, 24);
|
|
1425
|
+
static inverse = this.ansi(7, 27);
|
|
1426
|
+
static hidden = this.ansi(8, 28);
|
|
1427
|
+
static strike = this.ansi(9, 29);
|
|
1428
|
+
static gray = this.ansi(90, 39);
|
|
1429
|
+
static red = this.ansi(91, 39);
|
|
1430
|
+
static green = this.ansi(92, 39);
|
|
1431
|
+
static yellow = this.ansi(93, 39);
|
|
1432
|
+
static blue = this.ansi(94, 39);
|
|
1433
|
+
static magenta = this.ansi(95, 39);
|
|
1434
|
+
static cyan = this.ansi(96, 39);
|
|
1435
|
+
static Gray = (str) => this.inverse(this.gray(str));
|
|
1436
|
+
static Red = (str) => this.inverse(this.red(str));
|
|
1437
|
+
static Green = (str) => this.inverse(this.green(str));
|
|
1438
|
+
static Yellow = (str) => this.inverse(this.yellow(str));
|
|
1439
|
+
static Blue = (str) => this.inverse(this.blue(str));
|
|
1440
|
+
static Magenta = (str) => this.inverse(this.magenta(str));
|
|
1441
|
+
static Cyan = (str) => this.inverse(this.cyan(str));
|
|
1442
|
+
static ansi(open, close) {
|
|
1443
|
+
if (typeof process === 'undefined')
|
|
1444
|
+
return String;
|
|
1445
|
+
if (!process.stdout.isTTY)
|
|
1446
|
+
return String;
|
|
1447
|
+
const prefix = `\x1b[${open}m`;
|
|
1448
|
+
const postfix = `\x1b[${close}m`;
|
|
1449
|
+
const suffix_regexp = new RegExp(postfix.replace('[', '\\['), 'g');
|
|
1450
|
+
return function colorer(str) {
|
|
1451
|
+
str = String(str);
|
|
1452
|
+
if (str === '')
|
|
1453
|
+
return str;
|
|
1454
|
+
const suffix = str.replace(suffix_regexp, prefix);
|
|
1455
|
+
return prefix + suffix + postfix;
|
|
1456
|
+
};
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
$.$mol_term_color = $mol_term_color;
|
|
1460
|
+
})($ || ($ = {}));
|
|
1461
|
+
//mol/term/color/color.ts
|
|
1462
|
+
;
|
|
1463
|
+
"use strict";
|
|
1464
|
+
var $;
|
|
1465
|
+
(function ($) {
|
|
1466
|
+
function $mol_log3_node_make(level, output, type, color) {
|
|
1467
|
+
return function $mol_log3_logger(event) {
|
|
1468
|
+
if (!event.time)
|
|
1469
|
+
event = { time: new Date().toISOString(), ...event };
|
|
1470
|
+
let tree = this.$mol_tree2_from_json(event);
|
|
1471
|
+
tree = tree.struct(type, tree.kids);
|
|
1472
|
+
let str = color(tree.toString());
|
|
1473
|
+
this.console[level](str);
|
|
1474
|
+
const self = this;
|
|
1475
|
+
return () => self.console.groupEnd();
|
|
1476
|
+
};
|
|
1477
|
+
}
|
|
1478
|
+
$.$mol_log3_node_make = $mol_log3_node_make;
|
|
1479
|
+
$.$mol_log3_come = $mol_log3_node_make('info', 'stdout', 'come', $mol_term_color.blue);
|
|
1480
|
+
$.$mol_log3_done = $mol_log3_node_make('info', 'stdout', 'done', $mol_term_color.green);
|
|
1481
|
+
$.$mol_log3_fail = $mol_log3_node_make('error', 'stderr', 'fail', $mol_term_color.red);
|
|
1482
|
+
$.$mol_log3_warn = $mol_log3_node_make('warn', 'stderr', 'warn', $mol_term_color.yellow);
|
|
1483
|
+
$.$mol_log3_rise = $mol_log3_node_make('log', 'stdout', 'rise', $mol_term_color.magenta);
|
|
1484
|
+
$.$mol_log3_area = $mol_log3_node_make('log', 'stdout', 'area', $mol_term_color.cyan);
|
|
1485
|
+
})($ || ($ = {}));
|
|
1486
|
+
//mol/log3/log3.node.ts
|
|
1487
|
+
;
|
|
1488
|
+
"use strict";
|
|
1489
|
+
var $;
|
|
977
1490
|
(function ($) {
|
|
978
1491
|
class $mol_wire_task extends $mol_wire_fiber {
|
|
979
1492
|
static getter(task) {
|
|
@@ -991,7 +1504,17 @@ var $;
|
|
|
991
1504
|
break reuse;
|
|
992
1505
|
return existen;
|
|
993
1506
|
}
|
|
994
|
-
|
|
1507
|
+
const next = new $mol_wire_task(`${host?.[Symbol.toStringTag] ?? host}.${task.name}(#)`, task, host, args);
|
|
1508
|
+
if (existen?.temp) {
|
|
1509
|
+
$$.$mol_log3_warn({
|
|
1510
|
+
place: '$mol_wire_task',
|
|
1511
|
+
message: `Non idempotency`,
|
|
1512
|
+
existen,
|
|
1513
|
+
next,
|
|
1514
|
+
hint: 'Ignore it',
|
|
1515
|
+
});
|
|
1516
|
+
}
|
|
1517
|
+
return next;
|
|
995
1518
|
};
|
|
996
1519
|
}
|
|
997
1520
|
get temp() {
|
|
@@ -1214,1131 +1737,618 @@ var $;
|
|
|
1214
1737
|
return this.once();
|
|
1215
1738
|
}
|
|
1216
1739
|
else {
|
|
1217
|
-
return this.sync();
|
|
1218
|
-
}
|
|
1219
|
-
}, { atom: this });
|
|
1220
|
-
}
|
|
1221
|
-
destructor() {
|
|
1222
|
-
super.destructor();
|
|
1223
|
-
const prev = this.cache;
|
|
1224
|
-
if ($mol_owning_check(this, prev)) {
|
|
1225
|
-
prev.destructor();
|
|
1226
|
-
}
|
|
1227
|
-
if (this.pub_from === 0) {
|
|
1228
|
-
;
|
|
1229
|
-
(this.host ?? this.task)[this.field()] = null;
|
|
1230
|
-
}
|
|
1231
|
-
else {
|
|
1232
|
-
;
|
|
1233
|
-
(this.host ?? this.task)[this.field()].delete(this[Symbol.toStringTag]);
|
|
1234
|
-
}
|
|
1235
|
-
}
|
|
1236
|
-
put(next) {
|
|
1237
|
-
const prev = this.cache;
|
|
1238
|
-
update: if (next !== prev) {
|
|
1239
|
-
try {
|
|
1240
|
-
if ($mol_compare_deep(prev, next))
|
|
1241
|
-
break update;
|
|
1242
|
-
}
|
|
1243
|
-
catch (error) {
|
|
1244
|
-
$mol_fail_log(error);
|
|
1245
|
-
}
|
|
1246
|
-
if ($mol_owning_check(this, prev)) {
|
|
1247
|
-
prev.destructor();
|
|
1248
|
-
}
|
|
1249
|
-
if ($mol_owning_catch(this, next)) {
|
|
1250
|
-
try {
|
|
1251
|
-
next[Symbol.toStringTag] = this[Symbol.toStringTag];
|
|
1252
|
-
}
|
|
1253
|
-
catch {
|
|
1254
|
-
Object.defineProperty(next, Symbol.toStringTag, { value: this[Symbol.toStringTag] });
|
|
1255
|
-
}
|
|
1256
|
-
}
|
|
1257
|
-
if (!this.sub_empty)
|
|
1258
|
-
this.emit();
|
|
1259
|
-
}
|
|
1260
|
-
this.cache = next;
|
|
1261
|
-
this.cursor = $mol_wire_cursor.fresh;
|
|
1262
|
-
if ($mol_promise_like(next))
|
|
1263
|
-
return next;
|
|
1264
|
-
this.complete_pubs();
|
|
1265
|
-
return next;
|
|
1266
|
-
}
|
|
1267
|
-
}
|
|
1268
|
-
__decorate([
|
|
1269
|
-
$mol_wire_method
|
|
1270
|
-
], $mol_wire_atom.prototype, "resync", null);
|
|
1271
|
-
__decorate([
|
|
1272
|
-
$mol_wire_method
|
|
1273
|
-
], $mol_wire_atom.prototype, "once", null);
|
|
1274
|
-
$.$mol_wire_atom = $mol_wire_atom;
|
|
1275
|
-
})($ || ($ = {}));
|
|
1276
|
-
//mol/wire/atom/atom.ts
|
|
1277
|
-
;
|
|
1278
|
-
"use strict";
|
|
1279
|
-
var $;
|
|
1280
|
-
(function ($) {
|
|
1281
|
-
function $mol_wire_probe(task, def) {
|
|
1282
|
-
const warm = $mol_wire_fiber.warm;
|
|
1283
|
-
try {
|
|
1284
|
-
$mol_wire_fiber.warm = false;
|
|
1285
|
-
const res = task();
|
|
1286
|
-
if (res === undefined)
|
|
1287
|
-
return def;
|
|
1288
|
-
return res;
|
|
1289
|
-
}
|
|
1290
|
-
finally {
|
|
1291
|
-
$mol_wire_fiber.warm = warm;
|
|
1292
|
-
}
|
|
1293
|
-
}
|
|
1294
|
-
$.$mol_wire_probe = $mol_wire_probe;
|
|
1295
|
-
})($ || ($ = {}));
|
|
1296
|
-
//mol/wire/probe/probe.ts
|
|
1297
|
-
;
|
|
1298
|
-
"use strict";
|
|
1299
|
-
var $;
|
|
1300
|
-
(function ($) {
|
|
1301
|
-
function $mol_wire_solid() {
|
|
1302
|
-
const current = $mol_wire_auto();
|
|
1303
|
-
if (current.reap !== nothing) {
|
|
1304
|
-
current?.sub_on(sub, sub.data.length);
|
|
1305
|
-
}
|
|
1306
|
-
current.reap = nothing;
|
|
1307
|
-
}
|
|
1308
|
-
$.$mol_wire_solid = $mol_wire_solid;
|
|
1309
|
-
const nothing = () => { };
|
|
1310
|
-
const sub = new $mol_wire_pub_sub;
|
|
1311
|
-
})($ || ($ = {}));
|
|
1312
|
-
//mol/wire/solid/solid.ts
|
|
1313
|
-
;
|
|
1314
|
-
"use strict";
|
|
1315
|
-
var $;
|
|
1316
|
-
(function ($) {
|
|
1317
|
-
function $mol_wire_watch() {
|
|
1318
|
-
const atom = $mol_wire_auto();
|
|
1319
|
-
if (atom instanceof $mol_wire_atom) {
|
|
1320
|
-
atom.watch();
|
|
1321
|
-
}
|
|
1322
|
-
else {
|
|
1323
|
-
$mol_fail(new Error('Atom is required for watching'));
|
|
1324
|
-
}
|
|
1325
|
-
}
|
|
1326
|
-
$.$mol_wire_watch = $mol_wire_watch;
|
|
1327
|
-
})($ || ($ = {}));
|
|
1328
|
-
//mol/wire/watch/watch.ts
|
|
1329
|
-
;
|
|
1330
|
-
"use strict";
|
|
1331
|
-
var $;
|
|
1332
|
-
(function ($) {
|
|
1333
|
-
function $mol_wire_sync(obj) {
|
|
1334
|
-
return new Proxy(obj, {
|
|
1335
|
-
get(obj, field) {
|
|
1336
|
-
const val = obj[field];
|
|
1337
|
-
if (typeof val !== 'function')
|
|
1338
|
-
return val;
|
|
1339
|
-
const temp = $mol_wire_task.getter(val);
|
|
1340
|
-
return function $mol_wire_sync(...args) {
|
|
1341
|
-
const fiber = temp(obj, args);
|
|
1342
|
-
return fiber.sync();
|
|
1343
|
-
};
|
|
1344
|
-
},
|
|
1345
|
-
apply(obj, self, args) {
|
|
1346
|
-
const temp = $mol_wire_task.getter(obj);
|
|
1347
|
-
const fiber = temp(self, args);
|
|
1348
|
-
return fiber.sync();
|
|
1349
|
-
},
|
|
1350
|
-
});
|
|
1351
|
-
}
|
|
1352
|
-
$.$mol_wire_sync = $mol_wire_sync;
|
|
1353
|
-
})($ || ($ = {}));
|
|
1354
|
-
//mol/wire/sync/sync.ts
|
|
1355
|
-
;
|
|
1356
|
-
"use strict";
|
|
1357
|
-
var $;
|
|
1358
|
-
(function ($) {
|
|
1359
|
-
function $mol_wire_async(obj) {
|
|
1360
|
-
let fiber;
|
|
1361
|
-
const temp = $mol_wire_task.getter(obj);
|
|
1362
|
-
return new Proxy(obj, {
|
|
1363
|
-
get(obj, field) {
|
|
1364
|
-
const val = obj[field];
|
|
1365
|
-
if (typeof val !== 'function')
|
|
1366
|
-
return val;
|
|
1367
|
-
let fiber;
|
|
1368
|
-
const temp = $mol_wire_task.getter(val);
|
|
1369
|
-
return function $mol_wire_async(...args) {
|
|
1370
|
-
fiber?.destructor();
|
|
1371
|
-
fiber = temp(obj, args);
|
|
1372
|
-
return fiber.async();
|
|
1373
|
-
};
|
|
1374
|
-
},
|
|
1375
|
-
apply(obj, self, args) {
|
|
1376
|
-
fiber?.destructor();
|
|
1377
|
-
fiber = temp(self, args);
|
|
1378
|
-
return fiber.async();
|
|
1379
|
-
},
|
|
1380
|
-
});
|
|
1381
|
-
}
|
|
1382
|
-
$.$mol_wire_async = $mol_wire_async;
|
|
1383
|
-
})($ || ($ = {}));
|
|
1384
|
-
//mol/wire/async/async.ts
|
|
1385
|
-
;
|
|
1386
|
-
"use strict";
|
|
1387
|
-
var $;
|
|
1388
|
-
(function ($) {
|
|
1389
|
-
function $mol_wire_race(...tasks) {
|
|
1390
|
-
const results = tasks.map(task => {
|
|
1391
|
-
try {
|
|
1392
|
-
return task();
|
|
1393
|
-
}
|
|
1394
|
-
catch (error) {
|
|
1395
|
-
return error;
|
|
1396
|
-
}
|
|
1397
|
-
});
|
|
1398
|
-
const promises = results.filter(res => $mol_promise_like(res));
|
|
1399
|
-
if (promises.length)
|
|
1400
|
-
$mol_fail(Promise.race(promises));
|
|
1401
|
-
const error = results.find(res => res instanceof Error);
|
|
1402
|
-
if (error)
|
|
1403
|
-
$mol_fail(error);
|
|
1404
|
-
return results;
|
|
1405
|
-
}
|
|
1406
|
-
$.$mol_wire_race = $mol_wire_race;
|
|
1407
|
-
})($ || ($ = {}));
|
|
1408
|
-
//mol/wire/race/race.ts
|
|
1409
|
-
;
|
|
1410
|
-
"use strict";
|
|
1411
|
-
var $;
|
|
1412
|
-
(function ($) {
|
|
1413
|
-
function $mol_wire_solo(host, field, descr) {
|
|
1414
|
-
if (!descr)
|
|
1415
|
-
descr = Reflect.getOwnPropertyDescriptor(host, field);
|
|
1416
|
-
const orig = descr?.value ?? host[field];
|
|
1417
|
-
const sup = Reflect.getPrototypeOf(host);
|
|
1418
|
-
if (typeof sup[field] === 'function') {
|
|
1419
|
-
Object.defineProperty(orig, 'name', { value: sup[field].name });
|
|
1420
|
-
}
|
|
1421
|
-
const descr2 = {
|
|
1422
|
-
...descr,
|
|
1423
|
-
value: function (...args) {
|
|
1424
|
-
let atom = $mol_wire_atom.solo(this, orig);
|
|
1425
|
-
if ((args.length === 0) || (args[0] === undefined)) {
|
|
1426
|
-
if (!$mol_wire_fiber.warm)
|
|
1427
|
-
return atom.result();
|
|
1428
|
-
if ($mol_wire_auto()?.temp) {
|
|
1429
|
-
return atom.once();
|
|
1430
|
-
}
|
|
1431
|
-
else {
|
|
1432
|
-
return atom.sync();
|
|
1433
|
-
}
|
|
1740
|
+
return this.sync();
|
|
1434
1741
|
}
|
|
1435
|
-
|
|
1742
|
+
}, { atom: this });
|
|
1743
|
+
}
|
|
1744
|
+
destructor() {
|
|
1745
|
+
super.destructor();
|
|
1746
|
+
const prev = this.cache;
|
|
1747
|
+
if ($mol_owning_check(this, prev)) {
|
|
1748
|
+
prev.destructor();
|
|
1749
|
+
}
|
|
1750
|
+
if (this.pub_from === 0) {
|
|
1751
|
+
;
|
|
1752
|
+
(this.host ?? this.task)[this.field()] = null;
|
|
1753
|
+
}
|
|
1754
|
+
else {
|
|
1755
|
+
;
|
|
1756
|
+
(this.host ?? this.task)[this.field()].delete(this[Symbol.toStringTag]);
|
|
1436
1757
|
}
|
|
1437
|
-
};
|
|
1438
|
-
Reflect.defineProperty(descr2.value, 'name', { value: orig.name + ' ' });
|
|
1439
|
-
Reflect.defineProperty(descr2.value, 'length', { value: orig.length });
|
|
1440
|
-
Object.assign(descr2.value, { orig });
|
|
1441
|
-
Reflect.defineProperty(host, field, descr2);
|
|
1442
|
-
return descr2;
|
|
1443
|
-
}
|
|
1444
|
-
$.$mol_wire_solo = $mol_wire_solo;
|
|
1445
|
-
})($ || ($ = {}));
|
|
1446
|
-
//mol/wire/solo/solo.ts
|
|
1447
|
-
;
|
|
1448
|
-
"use strict";
|
|
1449
|
-
var $;
|
|
1450
|
-
(function ($) {
|
|
1451
|
-
function $mol_wire_plex(host, field, descr) {
|
|
1452
|
-
if (!descr)
|
|
1453
|
-
descr = Reflect.getOwnPropertyDescriptor(host, field);
|
|
1454
|
-
const orig = descr?.value ?? host[field];
|
|
1455
|
-
const sup = Reflect.getPrototypeOf(host);
|
|
1456
|
-
if (typeof sup[field] === 'function') {
|
|
1457
|
-
Object.defineProperty(orig, 'name', { value: sup[field].name });
|
|
1458
1758
|
}
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1759
|
+
put(next) {
|
|
1760
|
+
const prev = this.cache;
|
|
1761
|
+
update: if (next !== prev) {
|
|
1762
|
+
try {
|
|
1763
|
+
if ($mol_compare_deep(prev, next))
|
|
1764
|
+
break update;
|
|
1765
|
+
}
|
|
1766
|
+
catch (error) {
|
|
1767
|
+
$mol_fail_log(error);
|
|
1768
|
+
}
|
|
1769
|
+
if ($mol_owning_check(this, prev)) {
|
|
1770
|
+
prev.destructor();
|
|
1771
|
+
}
|
|
1772
|
+
if ($mol_owning_catch(this, next)) {
|
|
1773
|
+
try {
|
|
1774
|
+
next[Symbol.toStringTag] = this[Symbol.toStringTag];
|
|
1468
1775
|
}
|
|
1469
|
-
|
|
1470
|
-
|
|
1776
|
+
catch {
|
|
1777
|
+
Object.defineProperty(next, Symbol.toStringTag, { value: this[Symbol.toStringTag] });
|
|
1471
1778
|
}
|
|
1472
1779
|
}
|
|
1473
|
-
|
|
1780
|
+
if (!this.sub_empty)
|
|
1781
|
+
this.emit();
|
|
1474
1782
|
}
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
$.$mol_wire_plex = $mol_wire_plex;
|
|
1483
|
-
})($ || ($ = {}));
|
|
1484
|
-
//mol/wire/plex/plex.ts
|
|
1485
|
-
;
|
|
1486
|
-
"use strict";
|
|
1487
|
-
var $;
|
|
1488
|
-
(function ($) {
|
|
1489
|
-
function $mol_const(value) {
|
|
1490
|
-
const getter = (() => value);
|
|
1491
|
-
getter['()'] = value;
|
|
1492
|
-
getter[Symbol.toStringTag] = value;
|
|
1493
|
-
getter[$mol_dev_format_head] = () => $mol_dev_format_span({}, '()=> ', $mol_dev_format_auto(value));
|
|
1494
|
-
return getter;
|
|
1783
|
+
this.cache = next;
|
|
1784
|
+
this.cursor = $mol_wire_cursor.fresh;
|
|
1785
|
+
if ($mol_promise_like(next))
|
|
1786
|
+
return next;
|
|
1787
|
+
this.complete_pubs();
|
|
1788
|
+
return next;
|
|
1789
|
+
}
|
|
1495
1790
|
}
|
|
1496
|
-
|
|
1791
|
+
__decorate([
|
|
1792
|
+
$mol_wire_method
|
|
1793
|
+
], $mol_wire_atom.prototype, "resync", null);
|
|
1794
|
+
__decorate([
|
|
1795
|
+
$mol_wire_method
|
|
1796
|
+
], $mol_wire_atom.prototype, "once", null);
|
|
1797
|
+
$.$mol_wire_atom = $mol_wire_atom;
|
|
1497
1798
|
})($ || ($ = {}));
|
|
1498
|
-
//mol/
|
|
1799
|
+
//mol/wire/atom/atom.ts
|
|
1499
1800
|
;
|
|
1500
1801
|
"use strict";
|
|
1501
1802
|
var $;
|
|
1502
1803
|
(function ($) {
|
|
1503
|
-
function $
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
const sup_descr = Reflect.getOwnPropertyDescriptor(sup, field);
|
|
1512
|
-
Object.defineProperty(_get, 'name', { value: sup_descr?.get?.name ?? field });
|
|
1513
|
-
Object.defineProperty(_set, 'name', { value: sup_descr?.set?.name ?? field });
|
|
1514
|
-
function get() {
|
|
1515
|
-
return $mol_wire_atom.solo(this, _get).sync();
|
|
1516
|
-
}
|
|
1517
|
-
const temp = $mol_wire_task.getter(_set);
|
|
1518
|
-
function set(next) {
|
|
1519
|
-
temp(this, [next]).sync();
|
|
1804
|
+
function $mol_wire_probe(task, def) {
|
|
1805
|
+
const warm = $mol_wire_fiber.warm;
|
|
1806
|
+
try {
|
|
1807
|
+
$mol_wire_fiber.warm = false;
|
|
1808
|
+
const res = task();
|
|
1809
|
+
if (res === undefined)
|
|
1810
|
+
return def;
|
|
1811
|
+
return res;
|
|
1520
1812
|
}
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
Object.assign(get, { orig: _get });
|
|
1524
|
-
Object.assign(set, { orig: _set });
|
|
1525
|
-
const { value, writable, ...descr2 } = { ...descr, get, set };
|
|
1526
|
-
Reflect.defineProperty(host, field, descr2);
|
|
1527
|
-
return descr2;
|
|
1528
|
-
}
|
|
1529
|
-
$.$mol_wire_field = $mol_wire_field;
|
|
1530
|
-
})($ || ($ = {}));
|
|
1531
|
-
//mol/wire/field/field.ts
|
|
1532
|
-
;
|
|
1533
|
-
"use strict";
|
|
1534
|
-
var $;
|
|
1535
|
-
(function ($_1) {
|
|
1536
|
-
let $$;
|
|
1537
|
-
(function ($$) {
|
|
1538
|
-
let $;
|
|
1539
|
-
})($$ = $_1.$$ || ($_1.$$ = {}));
|
|
1540
|
-
$_1.$mol_object_field = Symbol('$mol_object_field');
|
|
1541
|
-
class $mol_object extends $mol_object2 {
|
|
1542
|
-
static make(config) {
|
|
1543
|
-
return super.create(obj => {
|
|
1544
|
-
for (let key in config)
|
|
1545
|
-
obj[key] = config[key];
|
|
1546
|
-
});
|
|
1813
|
+
finally {
|
|
1814
|
+
$mol_wire_fiber.warm = warm;
|
|
1547
1815
|
}
|
|
1548
1816
|
}
|
|
1549
|
-
|
|
1550
|
-
})($ || ($ = {}));
|
|
1551
|
-
//mol/object/object.ts
|
|
1552
|
-
;
|
|
1553
|
-
"use strict";
|
|
1554
|
-
var $;
|
|
1555
|
-
(function ($) {
|
|
1556
|
-
$.$mol_mem = $mol_wire_solo;
|
|
1557
|
-
$.$mol_mem_key = $mol_wire_plex;
|
|
1817
|
+
$.$mol_wire_probe = $mol_wire_probe;
|
|
1558
1818
|
})($ || ($ = {}));
|
|
1559
|
-
//mol/
|
|
1819
|
+
//mol/wire/probe/probe.ts
|
|
1560
1820
|
;
|
|
1561
1821
|
"use strict";
|
|
1562
1822
|
var $;
|
|
1563
1823
|
(function ($) {
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
}
|
|
1569
|
-
else {
|
|
1570
|
-
return new $mol_after_frame(() => this.task(precision, null));
|
|
1571
|
-
}
|
|
1572
|
-
}
|
|
1573
|
-
static now(precision) {
|
|
1574
|
-
this.task(precision);
|
|
1575
|
-
return Date.now();
|
|
1824
|
+
function $mol_wire_solid() {
|
|
1825
|
+
const current = $mol_wire_auto();
|
|
1826
|
+
if (current.reap !== nothing) {
|
|
1827
|
+
current?.sub_on(sub, sub.data.length);
|
|
1576
1828
|
}
|
|
1829
|
+
current.reap = nothing;
|
|
1577
1830
|
}
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
__decorate([
|
|
1582
|
-
$mol_mem_key
|
|
1583
|
-
], $mol_state_time, "now", null);
|
|
1584
|
-
$.$mol_state_time = $mol_state_time;
|
|
1831
|
+
$.$mol_wire_solid = $mol_wire_solid;
|
|
1832
|
+
const nothing = () => { };
|
|
1833
|
+
const sub = new $mol_wire_pub_sub;
|
|
1585
1834
|
})($ || ($ = {}));
|
|
1586
|
-
//mol/
|
|
1835
|
+
//mol/wire/solid/solid.ts
|
|
1587
1836
|
;
|
|
1588
1837
|
"use strict";
|
|
1589
1838
|
var $;
|
|
1590
1839
|
(function ($) {
|
|
1591
|
-
function $
|
|
1840
|
+
function $mol_wire_watch() {
|
|
1592
1841
|
const atom = $mol_wire_auto();
|
|
1593
|
-
if (
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
const diff = Math.abs(current - next);
|
|
1600
|
-
if (diff < 1)
|
|
1601
|
-
return next;
|
|
1602
|
-
$mol_state_time.now(0);
|
|
1603
|
-
return current;
|
|
1842
|
+
if (atom instanceof $mol_wire_atom) {
|
|
1843
|
+
atom.watch();
|
|
1844
|
+
}
|
|
1845
|
+
else {
|
|
1846
|
+
$mol_fail(new Error('Atom is required for watching'));
|
|
1847
|
+
}
|
|
1604
1848
|
}
|
|
1605
|
-
$.$
|
|
1849
|
+
$.$mol_wire_watch = $mol_wire_watch;
|
|
1606
1850
|
})($ || ($ = {}));
|
|
1607
|
-
//mol/wire/
|
|
1851
|
+
//mol/wire/watch/watch.ts
|
|
1608
1852
|
;
|
|
1609
1853
|
"use strict";
|
|
1610
1854
|
var $;
|
|
1611
1855
|
(function ($) {
|
|
1612
|
-
function $
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
const atom = $mol_wire_atom.solo(obj, get);
|
|
1631
|
-
set.call(this, next);
|
|
1632
|
-
atom.refresh();
|
|
1633
|
-
},
|
|
1634
|
-
});
|
|
1635
|
-
}
|
|
1856
|
+
function $mol_wire_sync(obj) {
|
|
1857
|
+
return new Proxy(obj, {
|
|
1858
|
+
get(obj, field) {
|
|
1859
|
+
const val = obj[field];
|
|
1860
|
+
if (typeof val !== 'function')
|
|
1861
|
+
return val;
|
|
1862
|
+
const temp = $mol_wire_task.getter(val);
|
|
1863
|
+
return function $mol_wire_sync(...args) {
|
|
1864
|
+
const fiber = temp(obj, args);
|
|
1865
|
+
return fiber.sync();
|
|
1866
|
+
};
|
|
1867
|
+
},
|
|
1868
|
+
apply(obj, self, args) {
|
|
1869
|
+
const temp = $mol_wire_task.getter(obj);
|
|
1870
|
+
const fiber = temp(self, args);
|
|
1871
|
+
return fiber.sync();
|
|
1872
|
+
},
|
|
1873
|
+
});
|
|
1636
1874
|
}
|
|
1637
|
-
$.$
|
|
1875
|
+
$.$mol_wire_sync = $mol_wire_sync;
|
|
1638
1876
|
})($ || ($ = {}));
|
|
1639
|
-
//mol/wire/
|
|
1640
|
-
;
|
|
1641
|
-
"use strict";
|
|
1642
|
-
//mol/type/result/result.ts
|
|
1877
|
+
//mol/wire/sync/sync.ts
|
|
1643
1878
|
;
|
|
1644
1879
|
"use strict";
|
|
1645
1880
|
var $;
|
|
1646
1881
|
(function ($) {
|
|
1647
|
-
function $
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1882
|
+
function $mol_wire_async(obj) {
|
|
1883
|
+
let fiber;
|
|
1884
|
+
const temp = $mol_wire_task.getter(obj);
|
|
1885
|
+
return new Proxy(obj, {
|
|
1886
|
+
get(obj, field) {
|
|
1887
|
+
const val = obj[field];
|
|
1888
|
+
if (typeof val !== 'function')
|
|
1889
|
+
return val;
|
|
1890
|
+
let fiber;
|
|
1891
|
+
const temp = $mol_wire_task.getter(val);
|
|
1892
|
+
return function $mol_wire_async(...args) {
|
|
1893
|
+
fiber?.destructor();
|
|
1894
|
+
fiber = temp(obj, args);
|
|
1895
|
+
return fiber.async();
|
|
1896
|
+
};
|
|
1897
|
+
},
|
|
1898
|
+
apply(obj, self, args) {
|
|
1899
|
+
fiber?.destructor();
|
|
1900
|
+
fiber = temp(self, args);
|
|
1901
|
+
return fiber.async();
|
|
1902
|
+
},
|
|
1903
|
+
});
|
|
1652
1904
|
}
|
|
1653
|
-
$.$
|
|
1905
|
+
$.$mol_wire_async = $mol_wire_async;
|
|
1654
1906
|
})($ || ($ = {}));
|
|
1655
|
-
//mol/wire/
|
|
1907
|
+
//mol/wire/async/async.ts
|
|
1656
1908
|
;
|
|
1657
1909
|
"use strict";
|
|
1658
1910
|
var $;
|
|
1659
1911
|
(function ($) {
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
return super.values();
|
|
1677
|
-
}
|
|
1678
|
-
forEach(task, self) {
|
|
1679
|
-
this.pub.promote();
|
|
1680
|
-
super.forEach(task, self);
|
|
1681
|
-
}
|
|
1682
|
-
[Symbol.iterator]() {
|
|
1683
|
-
this.pub.promote();
|
|
1684
|
-
return super[Symbol.iterator]();
|
|
1685
|
-
}
|
|
1686
|
-
get size() {
|
|
1687
|
-
this.pub.promote();
|
|
1688
|
-
return super.size;
|
|
1689
|
-
}
|
|
1690
|
-
add(value) {
|
|
1691
|
-
if (super.has(value))
|
|
1692
|
-
return this;
|
|
1693
|
-
super.add(value);
|
|
1694
|
-
this.pub.emit();
|
|
1695
|
-
return this;
|
|
1696
|
-
}
|
|
1697
|
-
delete(value) {
|
|
1698
|
-
const res = super.delete(value);
|
|
1699
|
-
if (res)
|
|
1700
|
-
this.pub.emit();
|
|
1701
|
-
return res;
|
|
1702
|
-
}
|
|
1703
|
-
clear() {
|
|
1704
|
-
if (!super.size)
|
|
1705
|
-
return;
|
|
1706
|
-
super.clear();
|
|
1707
|
-
this.pub.emit();
|
|
1708
|
-
}
|
|
1709
|
-
item(val, next) {
|
|
1710
|
-
if (next === undefined)
|
|
1711
|
-
return this.has(val);
|
|
1712
|
-
if (next)
|
|
1713
|
-
this.add(val);
|
|
1714
|
-
else
|
|
1715
|
-
this.delete(val);
|
|
1716
|
-
return next;
|
|
1717
|
-
}
|
|
1912
|
+
function $mol_wire_race(...tasks) {
|
|
1913
|
+
const results = tasks.map(task => {
|
|
1914
|
+
try {
|
|
1915
|
+
return task();
|
|
1916
|
+
}
|
|
1917
|
+
catch (error) {
|
|
1918
|
+
return error;
|
|
1919
|
+
}
|
|
1920
|
+
});
|
|
1921
|
+
const promises = results.filter(res => $mol_promise_like(res));
|
|
1922
|
+
if (promises.length)
|
|
1923
|
+
$mol_fail(Promise.race(promises));
|
|
1924
|
+
const error = results.find(res => res instanceof Error);
|
|
1925
|
+
if (error)
|
|
1926
|
+
$mol_fail(error);
|
|
1927
|
+
return results;
|
|
1718
1928
|
}
|
|
1719
|
-
$.$
|
|
1929
|
+
$.$mol_wire_race = $mol_wire_race;
|
|
1720
1930
|
})($ || ($ = {}));
|
|
1721
|
-
//mol/wire/
|
|
1931
|
+
//mol/wire/race/race.ts
|
|
1722
1932
|
;
|
|
1723
1933
|
"use strict";
|
|
1724
1934
|
var $;
|
|
1725
1935
|
(function ($) {
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
this.pub.promote();
|
|
1734
|
-
return super.get(key);
|
|
1735
|
-
}
|
|
1736
|
-
entries() {
|
|
1737
|
-
this.pub.promote();
|
|
1738
|
-
return super.entries();
|
|
1739
|
-
}
|
|
1740
|
-
keys() {
|
|
1741
|
-
this.pub.promote();
|
|
1742
|
-
return super.keys();
|
|
1743
|
-
}
|
|
1744
|
-
values() {
|
|
1745
|
-
this.pub.promote();
|
|
1746
|
-
return super.values();
|
|
1747
|
-
}
|
|
1748
|
-
forEach(task, self) {
|
|
1749
|
-
this.pub.promote();
|
|
1750
|
-
super.forEach(task, self);
|
|
1751
|
-
}
|
|
1752
|
-
[Symbol.iterator]() {
|
|
1753
|
-
this.pub.promote();
|
|
1754
|
-
return super[Symbol.iterator]();
|
|
1755
|
-
}
|
|
1756
|
-
get size() {
|
|
1757
|
-
this.pub.promote();
|
|
1758
|
-
return super.size;
|
|
1759
|
-
}
|
|
1760
|
-
set(key, value) {
|
|
1761
|
-
if (super.get(key) === value)
|
|
1762
|
-
return this;
|
|
1763
|
-
super.set(key, value);
|
|
1764
|
-
this.pub?.emit();
|
|
1765
|
-
return this;
|
|
1766
|
-
}
|
|
1767
|
-
delete(key) {
|
|
1768
|
-
const res = super.delete(key);
|
|
1769
|
-
if (res)
|
|
1770
|
-
this.pub.emit();
|
|
1771
|
-
return res;
|
|
1772
|
-
}
|
|
1773
|
-
clear() {
|
|
1774
|
-
if (!super.size)
|
|
1775
|
-
return;
|
|
1776
|
-
super.clear();
|
|
1777
|
-
this.pub.emit();
|
|
1778
|
-
}
|
|
1779
|
-
item(key, next) {
|
|
1780
|
-
if (next === undefined)
|
|
1781
|
-
return this.get(key) ?? null;
|
|
1782
|
-
if (next === null)
|
|
1783
|
-
this.delete(key);
|
|
1784
|
-
else
|
|
1785
|
-
this.set(key, next);
|
|
1786
|
-
return next;
|
|
1936
|
+
function $mol_wire_solo(host, field, descr) {
|
|
1937
|
+
if (!descr)
|
|
1938
|
+
descr = Reflect.getOwnPropertyDescriptor(host, field);
|
|
1939
|
+
const orig = descr?.value ?? host[field];
|
|
1940
|
+
const sup = Reflect.getPrototypeOf(host);
|
|
1941
|
+
if (typeof sup[field] === 'function') {
|
|
1942
|
+
Object.defineProperty(orig, 'name', { value: sup[field].name });
|
|
1787
1943
|
}
|
|
1944
|
+
const descr2 = {
|
|
1945
|
+
...descr,
|
|
1946
|
+
value: function (...args) {
|
|
1947
|
+
let atom = $mol_wire_atom.solo(this, orig);
|
|
1948
|
+
if ((args.length === 0) || (args[0] === undefined)) {
|
|
1949
|
+
if (!$mol_wire_fiber.warm)
|
|
1950
|
+
return atom.result();
|
|
1951
|
+
if ($mol_wire_auto()?.temp) {
|
|
1952
|
+
return atom.once();
|
|
1953
|
+
}
|
|
1954
|
+
else {
|
|
1955
|
+
return atom.sync();
|
|
1956
|
+
}
|
|
1957
|
+
}
|
|
1958
|
+
return atom.resync(args);
|
|
1959
|
+
}
|
|
1960
|
+
};
|
|
1961
|
+
Reflect.defineProperty(descr2.value, 'name', { value: orig.name + ' ' });
|
|
1962
|
+
Reflect.defineProperty(descr2.value, 'length', { value: orig.length });
|
|
1963
|
+
Object.assign(descr2.value, { orig });
|
|
1964
|
+
Reflect.defineProperty(host, field, descr2);
|
|
1965
|
+
return descr2;
|
|
1788
1966
|
}
|
|
1789
|
-
$.$
|
|
1967
|
+
$.$mol_wire_solo = $mol_wire_solo;
|
|
1790
1968
|
})($ || ($ = {}));
|
|
1791
|
-
//mol/wire/
|
|
1969
|
+
//mol/wire/solo/solo.ts
|
|
1792
1970
|
;
|
|
1793
1971
|
"use strict";
|
|
1794
1972
|
var $;
|
|
1795
1973
|
(function ($) {
|
|
1796
|
-
function $
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
const
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1974
|
+
function $mol_wire_plex(host, field, descr) {
|
|
1975
|
+
if (!descr)
|
|
1976
|
+
descr = Reflect.getOwnPropertyDescriptor(host, field);
|
|
1977
|
+
const orig = descr?.value ?? host[field];
|
|
1978
|
+
const sup = Reflect.getPrototypeOf(host);
|
|
1979
|
+
if (typeof sup[field] === 'function') {
|
|
1980
|
+
Object.defineProperty(orig, 'name', { value: sup[field].name });
|
|
1981
|
+
}
|
|
1982
|
+
const descr2 = {
|
|
1983
|
+
...descr,
|
|
1984
|
+
value: function (...args) {
|
|
1985
|
+
let atom = $mol_wire_atom.plex(this, orig, args[0]);
|
|
1986
|
+
if ((args.length === 1) || (args[1] === undefined)) {
|
|
1987
|
+
if (!$mol_wire_fiber.warm)
|
|
1988
|
+
return atom.result();
|
|
1989
|
+
if ($mol_wire_auto()?.temp) {
|
|
1990
|
+
return atom.once();
|
|
1991
|
+
}
|
|
1992
|
+
else {
|
|
1993
|
+
return atom.sync();
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
return atom.resync(args);
|
|
1997
|
+
}
|
|
1998
|
+
};
|
|
1999
|
+
Reflect.defineProperty(descr2.value, 'name', { value: orig.name + ' ' });
|
|
2000
|
+
Reflect.defineProperty(descr2.value, 'length', { value: orig.length });
|
|
2001
|
+
Object.assign(descr2.value, { orig });
|
|
2002
|
+
Reflect.defineProperty(host, field, descr2);
|
|
2003
|
+
return descr2;
|
|
1807
2004
|
}
|
|
1808
|
-
$.$
|
|
2005
|
+
$.$mol_wire_plex = $mol_wire_plex;
|
|
1809
2006
|
})($ || ($ = {}));
|
|
1810
|
-
//mol/
|
|
2007
|
+
//mol/wire/plex/plex.ts
|
|
1811
2008
|
;
|
|
1812
2009
|
"use strict";
|
|
1813
2010
|
var $;
|
|
1814
2011
|
(function ($) {
|
|
1815
|
-
function $
|
|
1816
|
-
const
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
}
|
|
1822
|
-
$.$mol_wait_timeout_async = $mol_wait_timeout_async;
|
|
1823
|
-
function $mol_wait_timeout(timeout) {
|
|
1824
|
-
return this.$mol_wire_sync(this).$mol_wait_timeout_async(timeout);
|
|
2012
|
+
function $mol_const(value) {
|
|
2013
|
+
const getter = (() => value);
|
|
2014
|
+
getter['()'] = value;
|
|
2015
|
+
getter[Symbol.toStringTag] = value;
|
|
2016
|
+
getter[$mol_dev_format_head] = () => $mol_dev_format_span({}, '()=> ', $mol_dev_format_auto(value));
|
|
2017
|
+
return getter;
|
|
1825
2018
|
}
|
|
1826
|
-
$.$
|
|
2019
|
+
$.$mol_const = $mol_const;
|
|
1827
2020
|
})($ || ($ = {}));
|
|
1828
|
-
//mol/
|
|
2021
|
+
//mol/const/const.ts
|
|
1829
2022
|
;
|
|
1830
2023
|
"use strict";
|
|
1831
2024
|
var $;
|
|
1832
2025
|
(function ($) {
|
|
1833
|
-
function $
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
const
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
logged = true;
|
|
1840
|
-
self.$mol_log3_area.call(self, event);
|
|
1841
|
-
});
|
|
1842
|
-
return () => {
|
|
1843
|
-
if (logged)
|
|
1844
|
-
self.console.groupEnd();
|
|
1845
|
-
if (stack.length > deep)
|
|
1846
|
-
stack.length = deep;
|
|
2026
|
+
function $mol_wire_field(host, field, descr) {
|
|
2027
|
+
if (!descr)
|
|
2028
|
+
descr = Reflect.getOwnPropertyDescriptor(host, field);
|
|
2029
|
+
const _get = descr?.get || $mol_const(descr?.value);
|
|
2030
|
+
const _set = descr?.set || function (next) {
|
|
2031
|
+
$mol_wire_atom.solo(this, _get).put(next);
|
|
1847
2032
|
};
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
;
|
|
1854
|
-
"use strict";
|
|
1855
|
-
var $;
|
|
1856
|
-
(function ($) {
|
|
1857
|
-
class $mol_span extends $mol_object2 {
|
|
1858
|
-
uri;
|
|
1859
|
-
source;
|
|
1860
|
-
row;
|
|
1861
|
-
col;
|
|
1862
|
-
length;
|
|
1863
|
-
constructor(uri, source, row, col, length) {
|
|
1864
|
-
super();
|
|
1865
|
-
this.uri = uri;
|
|
1866
|
-
this.source = source;
|
|
1867
|
-
this.row = row;
|
|
1868
|
-
this.col = col;
|
|
1869
|
-
this.length = length;
|
|
1870
|
-
this[Symbol.toStringTag] = `${this.uri}#${this.row}:${this.col}/${this.length}`;
|
|
1871
|
-
}
|
|
1872
|
-
static unknown = $mol_span.begin('?');
|
|
1873
|
-
static begin(uri, source = '') {
|
|
1874
|
-
return new $mol_span(uri, source, 1, 1, 0);
|
|
1875
|
-
}
|
|
1876
|
-
static end(uri, source) {
|
|
1877
|
-
return new $mol_span(uri, source, 1, source.length + 1, 0);
|
|
1878
|
-
}
|
|
1879
|
-
static entire(uri, source) {
|
|
1880
|
-
return new $mol_span(uri, source, 1, 1, source.length);
|
|
1881
|
-
}
|
|
1882
|
-
toString() {
|
|
1883
|
-
return this[Symbol.toStringTag];
|
|
1884
|
-
}
|
|
1885
|
-
toJSON() {
|
|
1886
|
-
return {
|
|
1887
|
-
uri: this.uri,
|
|
1888
|
-
row: this.row,
|
|
1889
|
-
col: this.col,
|
|
1890
|
-
length: this.length
|
|
1891
|
-
};
|
|
1892
|
-
}
|
|
1893
|
-
error(message, Class = Error) {
|
|
1894
|
-
return new Class(`${message}${this}`);
|
|
1895
|
-
}
|
|
1896
|
-
span(row, col, length) {
|
|
1897
|
-
return new $mol_span(this.uri, this.source, row, col, length);
|
|
1898
|
-
}
|
|
1899
|
-
after(length = 0) {
|
|
1900
|
-
return new $mol_span(this.uri, this.source, this.row, this.col + this.length, length);
|
|
2033
|
+
const sup = Reflect.getPrototypeOf(host);
|
|
2034
|
+
const sup_descr = Reflect.getOwnPropertyDescriptor(sup, field);
|
|
2035
|
+
Object.defineProperty(_get, 'name', { value: sup_descr?.get?.name ?? field });
|
|
2036
|
+
Object.defineProperty(_set, 'name', { value: sup_descr?.set?.name ?? field });
|
|
2037
|
+
function get() {
|
|
2038
|
+
return $mol_wire_atom.solo(this, _get).sync();
|
|
1901
2039
|
}
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
begin += len;
|
|
1906
|
-
if (end < 0)
|
|
1907
|
-
end += len;
|
|
1908
|
-
if (begin < 0 || begin > len)
|
|
1909
|
-
this.$.$mol_fail(`Begin value '${begin}' out of range ${this}`);
|
|
1910
|
-
if (end < 0 || end > len)
|
|
1911
|
-
this.$.$mol_fail(`End value '${end}' out of range ${this}`);
|
|
1912
|
-
if (end < begin)
|
|
1913
|
-
this.$.$mol_fail(`End value '${end}' can't be less than begin value ${this}`);
|
|
1914
|
-
return this.span(this.row, this.col + begin, end - begin);
|
|
2040
|
+
const temp = $mol_wire_task.getter(_set);
|
|
2041
|
+
function set(next) {
|
|
2042
|
+
temp(this, [next]).sync();
|
|
1915
2043
|
}
|
|
2044
|
+
Object.defineProperty(get, 'name', { value: _get.name + '$' });
|
|
2045
|
+
Object.defineProperty(set, 'name', { value: _set.name + '@' });
|
|
2046
|
+
Object.assign(get, { orig: _get });
|
|
2047
|
+
Object.assign(set, { orig: _set });
|
|
2048
|
+
const { value, writable, ...descr2 } = { ...descr, get, set };
|
|
2049
|
+
Reflect.defineProperty(host, field, descr2);
|
|
2050
|
+
return descr2;
|
|
1916
2051
|
}
|
|
1917
|
-
$.$
|
|
2052
|
+
$.$mol_wire_field = $mol_wire_field;
|
|
1918
2053
|
})($ || ($ = {}));
|
|
1919
|
-
//mol/
|
|
2054
|
+
//mol/wire/field/field.ts
|
|
1920
2055
|
;
|
|
1921
2056
|
"use strict";
|
|
1922
2057
|
var $;
|
|
1923
|
-
(function ($) {
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
return;
|
|
1936
|
-
}
|
|
1937
|
-
output.push("\n");
|
|
1938
|
-
}
|
|
1939
|
-
else if (tree.value.length || prefix.length) {
|
|
1940
|
-
output.push("\\" + tree.value + "\n");
|
|
1941
|
-
}
|
|
1942
|
-
for (const kid of tree.kids) {
|
|
1943
|
-
output.push(prefix);
|
|
1944
|
-
dump(kid, prefix + "\t");
|
|
1945
|
-
}
|
|
2058
|
+
(function ($_1) {
|
|
2059
|
+
let $$;
|
|
2060
|
+
(function ($$) {
|
|
2061
|
+
let $;
|
|
2062
|
+
})($$ = $_1.$$ || ($_1.$$ = {}));
|
|
2063
|
+
$_1.$mol_object_field = Symbol('$mol_object_field');
|
|
2064
|
+
class $mol_object extends $mol_object2 {
|
|
2065
|
+
static make(config) {
|
|
2066
|
+
return super.create(obj => {
|
|
2067
|
+
for (let key in config)
|
|
2068
|
+
obj[key] = config[key];
|
|
2069
|
+
});
|
|
1946
2070
|
}
|
|
1947
|
-
dump(tree);
|
|
1948
|
-
return output.join('');
|
|
1949
2071
|
}
|
|
1950
|
-
|
|
2072
|
+
$_1.$mol_object = $mol_object;
|
|
1951
2073
|
})($ || ($ = {}));
|
|
1952
|
-
//mol/
|
|
2074
|
+
//mol/object/object.ts
|
|
1953
2075
|
;
|
|
1954
2076
|
"use strict";
|
|
1955
2077
|
var $;
|
|
1956
2078
|
(function ($) {
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
}
|
|
1970
|
-
static list(kids, span = $mol_span.unknown) {
|
|
1971
|
-
return new $mol_tree2('', '', kids, span);
|
|
1972
|
-
}
|
|
1973
|
-
list(kids) {
|
|
1974
|
-
return $mol_tree2.list(kids, this.span);
|
|
1975
|
-
}
|
|
1976
|
-
static data(value, kids = [], span = $mol_span.unknown) {
|
|
1977
|
-
const chunks = value.split('\n');
|
|
1978
|
-
if (chunks.length > 1) {
|
|
1979
|
-
let kid_span = span.span(span.row, span.col, 0);
|
|
1980
|
-
const data = chunks.map(chunk => {
|
|
1981
|
-
kid_span = kid_span.after(chunk.length);
|
|
1982
|
-
return new $mol_tree2('', chunk, [], kid_span);
|
|
1983
|
-
});
|
|
1984
|
-
kids = [...data, ...kids];
|
|
1985
|
-
value = '';
|
|
1986
|
-
}
|
|
1987
|
-
return new $mol_tree2('', value, kids, span);
|
|
1988
|
-
}
|
|
1989
|
-
data(value, kids = []) {
|
|
1990
|
-
return $mol_tree2.data(value, kids, this.span);
|
|
1991
|
-
}
|
|
1992
|
-
static struct(type, kids = [], span = $mol_span.unknown) {
|
|
1993
|
-
if (/[ \n\t\\]/.test(type)) {
|
|
1994
|
-
$$.$mol_fail(span.error(`Wrong type ${JSON.stringify(type)}`));
|
|
1995
|
-
}
|
|
1996
|
-
return new $mol_tree2(type, '', kids, span);
|
|
1997
|
-
}
|
|
1998
|
-
struct(type, kids = []) {
|
|
1999
|
-
return $mol_tree2.struct(type, kids, this.span);
|
|
2000
|
-
}
|
|
2001
|
-
clone(kids, span = this.span) {
|
|
2002
|
-
return new $mol_tree2(this.type, this.value, kids, span);
|
|
2003
|
-
}
|
|
2004
|
-
text() {
|
|
2005
|
-
var values = [];
|
|
2006
|
-
for (var kid of this.kids) {
|
|
2007
|
-
if (kid.type)
|
|
2008
|
-
continue;
|
|
2009
|
-
values.push(kid.value);
|
|
2010
|
-
}
|
|
2011
|
-
return this.value + values.join('\n');
|
|
2012
|
-
}
|
|
2013
|
-
static fromString(str, uri = 'unknown') {
|
|
2014
|
-
return $$.$mol_tree2_from_string(str, uri);
|
|
2015
|
-
}
|
|
2016
|
-
toString() {
|
|
2017
|
-
return $$.$mol_tree2_to_string(this);
|
|
2018
|
-
}
|
|
2019
|
-
insert(value, ...path) {
|
|
2020
|
-
if (path.length === 0)
|
|
2021
|
-
return value;
|
|
2022
|
-
const type = path[0];
|
|
2023
|
-
if (typeof type === 'string') {
|
|
2024
|
-
let replaced = false;
|
|
2025
|
-
const sub = this.kids.map((item, index) => {
|
|
2026
|
-
if (item.type !== type)
|
|
2027
|
-
return item;
|
|
2028
|
-
replaced = true;
|
|
2029
|
-
return item.insert(value, ...path.slice(1));
|
|
2030
|
-
}).filter(Boolean);
|
|
2031
|
-
if (!replaced && value) {
|
|
2032
|
-
sub.push(this.struct(type, []).insert(value, ...path.slice(1)));
|
|
2033
|
-
}
|
|
2034
|
-
return this.clone(sub);
|
|
2035
|
-
}
|
|
2036
|
-
else if (typeof type === 'number') {
|
|
2037
|
-
const sub = this.kids.slice();
|
|
2038
|
-
sub[type] = (sub[type] || this.list([]))
|
|
2039
|
-
.insert(value, ...path.slice(1));
|
|
2040
|
-
return this.clone(sub.filter(Boolean));
|
|
2079
|
+
$.$mol_mem = $mol_wire_solo;
|
|
2080
|
+
$.$mol_mem_key = $mol_wire_plex;
|
|
2081
|
+
})($ || ($ = {}));
|
|
2082
|
+
//mol/mem/mem.ts
|
|
2083
|
+
;
|
|
2084
|
+
"use strict";
|
|
2085
|
+
var $;
|
|
2086
|
+
(function ($) {
|
|
2087
|
+
class $mol_state_time extends $mol_object {
|
|
2088
|
+
static task(precision, reset) {
|
|
2089
|
+
if (precision) {
|
|
2090
|
+
return new $mol_after_timeout(precision, () => this.task(precision, null));
|
|
2041
2091
|
}
|
|
2042
2092
|
else {
|
|
2043
|
-
|
|
2044
|
-
.map(item => item.insert(value, ...path.slice(1)))
|
|
2045
|
-
.filter(Boolean);
|
|
2046
|
-
return this.clone(kids);
|
|
2047
|
-
}
|
|
2048
|
-
}
|
|
2049
|
-
select(...path) {
|
|
2050
|
-
let next = [this];
|
|
2051
|
-
for (const type of path) {
|
|
2052
|
-
if (!next.length)
|
|
2053
|
-
break;
|
|
2054
|
-
const prev = next;
|
|
2055
|
-
next = [];
|
|
2056
|
-
for (var item of prev) {
|
|
2057
|
-
switch (typeof (type)) {
|
|
2058
|
-
case 'string':
|
|
2059
|
-
for (var child of item.kids) {
|
|
2060
|
-
if (child.type == type) {
|
|
2061
|
-
next.push(child);
|
|
2062
|
-
}
|
|
2063
|
-
}
|
|
2064
|
-
break;
|
|
2065
|
-
case 'number':
|
|
2066
|
-
if (type < item.kids.length)
|
|
2067
|
-
next.push(item.kids[type]);
|
|
2068
|
-
break;
|
|
2069
|
-
default: next.push(...item.kids);
|
|
2070
|
-
}
|
|
2071
|
-
}
|
|
2093
|
+
return new $mol_after_frame(() => this.task(precision, null));
|
|
2072
2094
|
}
|
|
2073
|
-
return this.list(next);
|
|
2074
|
-
}
|
|
2075
|
-
filter(path, value) {
|
|
2076
|
-
const sub = this.kids.filter(item => {
|
|
2077
|
-
var found = item.select(...path);
|
|
2078
|
-
if (value === undefined) {
|
|
2079
|
-
return Boolean(found.kids.length);
|
|
2080
|
-
}
|
|
2081
|
-
else {
|
|
2082
|
-
return found.kids.some(child => child.value == value);
|
|
2083
|
-
}
|
|
2084
|
-
});
|
|
2085
|
-
return this.clone(sub);
|
|
2086
|
-
}
|
|
2087
|
-
hack(belt, context = {}) {
|
|
2088
|
-
return [].concat(...this.kids.map(child => {
|
|
2089
|
-
let handle = belt[child.type] || belt[''];
|
|
2090
|
-
if (!handle || handle === Object.prototype[child.type]) {
|
|
2091
|
-
handle = (input, belt, context) => [
|
|
2092
|
-
input.clone(input.hack(belt, context), context.span)
|
|
2093
|
-
];
|
|
2094
|
-
}
|
|
2095
|
-
try {
|
|
2096
|
-
return handle(child, belt, context);
|
|
2097
|
-
}
|
|
2098
|
-
catch (error) {
|
|
2099
|
-
error.message += `\n${child.clone([])}${child.span}`;
|
|
2100
|
-
$mol_fail_hidden(error);
|
|
2101
|
-
}
|
|
2102
|
-
}));
|
|
2103
2095
|
}
|
|
2104
|
-
|
|
2105
|
-
|
|
2096
|
+
static now(precision) {
|
|
2097
|
+
this.task(precision);
|
|
2098
|
+
return Date.now();
|
|
2106
2099
|
}
|
|
2107
2100
|
}
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2101
|
+
__decorate([
|
|
2102
|
+
$mol_mem_key
|
|
2103
|
+
], $mol_state_time, "task", null);
|
|
2104
|
+
__decorate([
|
|
2105
|
+
$mol_mem_key
|
|
2106
|
+
], $mol_state_time, "now", null);
|
|
2107
|
+
$.$mol_state_time = $mol_state_time;
|
|
2108
|
+
})($ || ($ = {}));
|
|
2109
|
+
//mol/state/time/time.ts
|
|
2110
|
+
;
|
|
2111
|
+
"use strict";
|
|
2112
|
+
var $;
|
|
2113
|
+
(function ($) {
|
|
2114
|
+
function $mol_wire_easing(next) {
|
|
2115
|
+
const atom = $mol_wire_auto();
|
|
2116
|
+
if (!(atom instanceof $mol_wire_atom))
|
|
2117
|
+
$mol_fail(new Error('Allowed only inside atom'));
|
|
2118
|
+
const prev = atom.result() ?? next;
|
|
2119
|
+
if (typeof prev !== 'number')
|
|
2120
|
+
return next;
|
|
2121
|
+
const current = (prev * 2 + next) / 3;
|
|
2122
|
+
const diff = Math.abs(current - next);
|
|
2123
|
+
if (diff < 1)
|
|
2124
|
+
return next;
|
|
2125
|
+
$mol_state_time.now(0);
|
|
2126
|
+
return current;
|
|
2127
|
+
}
|
|
2128
|
+
$.$mol_wire_easing = $mol_wire_easing;
|
|
2129
|
+
})($ || ($ = {}));
|
|
2130
|
+
//mol/wire/easing/easing.ts
|
|
2131
|
+
;
|
|
2132
|
+
"use strict";
|
|
2133
|
+
var $;
|
|
2134
|
+
(function ($) {
|
|
2135
|
+
function $mol_wire_patch(obj) {
|
|
2136
|
+
for (const field of Reflect.ownKeys(obj)) {
|
|
2137
|
+
const descr = Reflect.getOwnPropertyDescriptor(obj, field);
|
|
2138
|
+
if (!descr.configurable)
|
|
2139
|
+
continue;
|
|
2140
|
+
if (!descr.get)
|
|
2141
|
+
continue;
|
|
2142
|
+
const get = descr.get ?? (() => descr.value);
|
|
2143
|
+
const set = descr.set ?? (next => descr.value = next);
|
|
2144
|
+
Reflect.defineProperty(obj, field, {
|
|
2145
|
+
configurable: true,
|
|
2146
|
+
enumerable: descr.enumerable,
|
|
2147
|
+
get() {
|
|
2148
|
+
const atom = $mol_wire_atom.solo(obj, get);
|
|
2149
|
+
atom.watch();
|
|
2150
|
+
return atom.sync();
|
|
2151
|
+
},
|
|
2152
|
+
set(next) {
|
|
2153
|
+
const atom = $mol_wire_atom.solo(obj, get);
|
|
2154
|
+
set.call(this, next);
|
|
2155
|
+
atom.refresh();
|
|
2156
|
+
},
|
|
2157
|
+
});
|
|
2112
2158
|
}
|
|
2113
2159
|
}
|
|
2114
|
-
$.$
|
|
2160
|
+
$.$mol_wire_patch = $mol_wire_patch;
|
|
2115
2161
|
})($ || ($ = {}));
|
|
2116
|
-
//mol/
|
|
2162
|
+
//mol/wire/patch/patch.ts
|
|
2163
|
+
;
|
|
2164
|
+
"use strict";
|
|
2165
|
+
//mol/type/result/result.ts
|
|
2117
2166
|
;
|
|
2118
2167
|
"use strict";
|
|
2119
2168
|
var $;
|
|
2120
2169
|
(function ($) {
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
span;
|
|
2125
|
-
constructor(reason, line, span) {
|
|
2126
|
-
super(`${reason}\n${span}\n${line.substring(0, span.col - 1).replace(/\S/g, ' ')}${''.padEnd(span.length, '!')}\n${line}`);
|
|
2127
|
-
this.reason = reason;
|
|
2128
|
-
this.line = line;
|
|
2129
|
-
this.span = span;
|
|
2170
|
+
function $mol_wire_let(host) {
|
|
2171
|
+
for (const field of Object.keys(host)) {
|
|
2172
|
+
host[field] = new $mol_wire_atom(field, host[field], host).channel();
|
|
2130
2173
|
}
|
|
2174
|
+
return host;
|
|
2131
2175
|
}
|
|
2132
|
-
$.$
|
|
2176
|
+
$.$mol_wire_let = $mol_wire_let;
|
|
2133
2177
|
})($ || ($ = {}));
|
|
2134
|
-
//mol/
|
|
2178
|
+
//mol/wire/let/let.ts
|
|
2135
2179
|
;
|
|
2136
2180
|
"use strict";
|
|
2137
2181
|
var $;
|
|
2138
2182
|
(function ($) {
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
parent = next;
|
|
2197
|
-
}
|
|
2198
|
-
if (str.length > pos && str[pos] == ' ') {
|
|
2199
|
-
pos++;
|
|
2200
|
-
}
|
|
2201
|
-
}
|
|
2202
|
-
if (str.length > pos && str[pos] == '\\') {
|
|
2203
|
-
var data_start = pos;
|
|
2204
|
-
while (str.length > pos && str[pos] != '\n') {
|
|
2205
|
-
pos++;
|
|
2206
|
-
}
|
|
2207
|
-
let next = new $mol_tree2('', str.slice(data_start + 1, pos), [], span.span(row, data_start - line_start + 2, pos - data_start - 1));
|
|
2208
|
-
const parent_kids = parent.kids;
|
|
2209
|
-
parent_kids.push(next);
|
|
2210
|
-
parent = next;
|
|
2211
|
-
}
|
|
2212
|
-
if (str.length === pos && stack.length > 0) {
|
|
2213
|
-
const sp = span.span(row, pos - line_start + 1, 1);
|
|
2214
|
-
this.$mol_fail(new this.$mol_error_syntax(`Unexpected EOF, LF required`, str.substring(line_start, str.length), sp));
|
|
2215
|
-
}
|
|
2216
|
-
stack.push(parent);
|
|
2217
|
-
pos++;
|
|
2183
|
+
class $mol_wire_set extends Set {
|
|
2184
|
+
pub = new $mol_wire_pub;
|
|
2185
|
+
has(value) {
|
|
2186
|
+
this.pub.promote();
|
|
2187
|
+
return super.has(value);
|
|
2188
|
+
}
|
|
2189
|
+
entries() {
|
|
2190
|
+
this.pub.promote();
|
|
2191
|
+
return super.entries();
|
|
2192
|
+
}
|
|
2193
|
+
keys() {
|
|
2194
|
+
this.pub.promote();
|
|
2195
|
+
return super.keys();
|
|
2196
|
+
}
|
|
2197
|
+
values() {
|
|
2198
|
+
this.pub.promote();
|
|
2199
|
+
return super.values();
|
|
2200
|
+
}
|
|
2201
|
+
forEach(task, self) {
|
|
2202
|
+
this.pub.promote();
|
|
2203
|
+
super.forEach(task, self);
|
|
2204
|
+
}
|
|
2205
|
+
[Symbol.iterator]() {
|
|
2206
|
+
this.pub.promote();
|
|
2207
|
+
return super[Symbol.iterator]();
|
|
2208
|
+
}
|
|
2209
|
+
get size() {
|
|
2210
|
+
this.pub.promote();
|
|
2211
|
+
return super.size;
|
|
2212
|
+
}
|
|
2213
|
+
add(value) {
|
|
2214
|
+
if (super.has(value))
|
|
2215
|
+
return this;
|
|
2216
|
+
super.add(value);
|
|
2217
|
+
this.pub.emit();
|
|
2218
|
+
return this;
|
|
2219
|
+
}
|
|
2220
|
+
delete(value) {
|
|
2221
|
+
const res = super.delete(value);
|
|
2222
|
+
if (res)
|
|
2223
|
+
this.pub.emit();
|
|
2224
|
+
return res;
|
|
2225
|
+
}
|
|
2226
|
+
clear() {
|
|
2227
|
+
if (!super.size)
|
|
2228
|
+
return;
|
|
2229
|
+
super.clear();
|
|
2230
|
+
this.pub.emit();
|
|
2231
|
+
}
|
|
2232
|
+
item(val, next) {
|
|
2233
|
+
if (next === undefined)
|
|
2234
|
+
return this.has(val);
|
|
2235
|
+
if (next)
|
|
2236
|
+
this.add(val);
|
|
2237
|
+
else
|
|
2238
|
+
this.delete(val);
|
|
2239
|
+
return next;
|
|
2218
2240
|
}
|
|
2219
|
-
return root;
|
|
2220
2241
|
}
|
|
2221
|
-
$.$
|
|
2242
|
+
$.$mol_wire_set = $mol_wire_set;
|
|
2222
2243
|
})($ || ($ = {}));
|
|
2223
|
-
//mol/
|
|
2244
|
+
//mol/wire/set/set.ts
|
|
2224
2245
|
;
|
|
2225
2246
|
"use strict";
|
|
2226
2247
|
var $;
|
|
2227
2248
|
(function ($) {
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2249
|
+
class $mol_wire_dict extends Map {
|
|
2250
|
+
pub = new $mol_wire_pub;
|
|
2251
|
+
has(key) {
|
|
2252
|
+
this.pub.promote();
|
|
2253
|
+
return super.has(key);
|
|
2231
2254
|
}
|
|
2232
|
-
|
|
2233
|
-
|
|
2255
|
+
get(key) {
|
|
2256
|
+
this.pub.promote();
|
|
2257
|
+
return super.get(key);
|
|
2234
2258
|
}
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
return
|
|
2259
|
+
entries() {
|
|
2260
|
+
this.pub.promote();
|
|
2261
|
+
return super.entries();
|
|
2238
2262
|
}
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
return
|
|
2263
|
+
keys() {
|
|
2264
|
+
this.pub.promote();
|
|
2265
|
+
return super.keys();
|
|
2242
2266
|
}
|
|
2243
|
-
|
|
2244
|
-
|
|
2267
|
+
values() {
|
|
2268
|
+
this.pub.promote();
|
|
2269
|
+
return super.values();
|
|
2245
2270
|
}
|
|
2246
|
-
|
|
2247
|
-
|
|
2271
|
+
forEach(task, self) {
|
|
2272
|
+
this.pub.promote();
|
|
2273
|
+
super.forEach(task, self);
|
|
2248
2274
|
}
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2275
|
+
[Symbol.iterator]() {
|
|
2276
|
+
this.pub.promote();
|
|
2277
|
+
return super[Symbol.iterator]();
|
|
2252
2278
|
}
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2279
|
+
get size() {
|
|
2280
|
+
this.pub.promote();
|
|
2281
|
+
return super.size;
|
|
2282
|
+
}
|
|
2283
|
+
set(key, value) {
|
|
2284
|
+
if (super.get(key) === value)
|
|
2285
|
+
return this;
|
|
2286
|
+
super.set(key, value);
|
|
2287
|
+
this.pub?.emit();
|
|
2288
|
+
return this;
|
|
2289
|
+
}
|
|
2290
|
+
delete(key) {
|
|
2291
|
+
const res = super.delete(key);
|
|
2292
|
+
if (res)
|
|
2293
|
+
this.pub.emit();
|
|
2294
|
+
return res;
|
|
2295
|
+
}
|
|
2296
|
+
clear() {
|
|
2297
|
+
if (!super.size)
|
|
2298
|
+
return;
|
|
2299
|
+
super.clear();
|
|
2300
|
+
this.pub.emit();
|
|
2301
|
+
}
|
|
2302
|
+
item(key, next) {
|
|
2303
|
+
if (next === undefined)
|
|
2304
|
+
return this.get(key) ?? null;
|
|
2305
|
+
if (next === null)
|
|
2306
|
+
this.delete(key);
|
|
2307
|
+
else
|
|
2308
|
+
this.set(key, next);
|
|
2309
|
+
return next;
|
|
2265
2310
|
}
|
|
2266
|
-
return new $mol_tree2('*', '', sub, span);
|
|
2267
2311
|
}
|
|
2268
|
-
$.$
|
|
2312
|
+
$.$mol_wire_dict = $mol_wire_dict;
|
|
2269
2313
|
})($ || ($ = {}));
|
|
2270
|
-
//mol/
|
|
2314
|
+
//mol/wire/dict/dict.ts
|
|
2271
2315
|
;
|
|
2272
2316
|
"use strict";
|
|
2273
2317
|
var $;
|
|
2274
2318
|
(function ($) {
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
static yellow = this.ansi(93, 39);
|
|
2287
|
-
static blue = this.ansi(94, 39);
|
|
2288
|
-
static magenta = this.ansi(95, 39);
|
|
2289
|
-
static cyan = this.ansi(96, 39);
|
|
2290
|
-
static Gray = (str) => this.inverse(this.gray(str));
|
|
2291
|
-
static Red = (str) => this.inverse(this.red(str));
|
|
2292
|
-
static Green = (str) => this.inverse(this.green(str));
|
|
2293
|
-
static Yellow = (str) => this.inverse(this.yellow(str));
|
|
2294
|
-
static Blue = (str) => this.inverse(this.blue(str));
|
|
2295
|
-
static Magenta = (str) => this.inverse(this.magenta(str));
|
|
2296
|
-
static Cyan = (str) => this.inverse(this.cyan(str));
|
|
2297
|
-
static ansi(open, close) {
|
|
2298
|
-
if (typeof process === 'undefined')
|
|
2299
|
-
return String;
|
|
2300
|
-
if (!process.stdout.isTTY)
|
|
2301
|
-
return String;
|
|
2302
|
-
const prefix = `\x1b[${open}m`;
|
|
2303
|
-
const postfix = `\x1b[${close}m`;
|
|
2304
|
-
const suffix_regexp = new RegExp(postfix.replace('[', '\\['), 'g');
|
|
2305
|
-
return function colorer(str) {
|
|
2306
|
-
str = String(str);
|
|
2307
|
-
if (str === '')
|
|
2308
|
-
return str;
|
|
2309
|
-
const suffix = str.replace(suffix_regexp, prefix);
|
|
2310
|
-
return prefix + suffix + postfix;
|
|
2311
|
-
};
|
|
2312
|
-
}
|
|
2319
|
+
function $mol_promise() {
|
|
2320
|
+
let done;
|
|
2321
|
+
let fail;
|
|
2322
|
+
const promise = new Promise((d, f) => {
|
|
2323
|
+
done = d;
|
|
2324
|
+
fail = f;
|
|
2325
|
+
});
|
|
2326
|
+
return Object.assign(promise, {
|
|
2327
|
+
done,
|
|
2328
|
+
fail,
|
|
2329
|
+
});
|
|
2313
2330
|
}
|
|
2314
|
-
$.$
|
|
2331
|
+
$.$mol_promise = $mol_promise;
|
|
2315
2332
|
})($ || ($ = {}));
|
|
2316
|
-
//mol/
|
|
2333
|
+
//mol/promise/promise/promise.ts
|
|
2317
2334
|
;
|
|
2318
2335
|
"use strict";
|
|
2319
2336
|
var $;
|
|
2320
2337
|
(function ($) {
|
|
2321
|
-
function $
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
let str = color(tree.toString());
|
|
2328
|
-
this.console[level](str);
|
|
2329
|
-
const self = this;
|
|
2330
|
-
return () => self.console.groupEnd();
|
|
2331
|
-
};
|
|
2338
|
+
function $mol_wait_timeout_async(timeout) {
|
|
2339
|
+
const promise = $mol_promise();
|
|
2340
|
+
const task = new this.$mol_after_timeout(timeout, () => promise.done());
|
|
2341
|
+
return Object.assign(promise, {
|
|
2342
|
+
destructor: () => task.destructor()
|
|
2343
|
+
});
|
|
2332
2344
|
}
|
|
2333
|
-
$.$
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
$.$
|
|
2338
|
-
$.$mol_log3_rise = $mol_log3_node_make('log', 'stdout', 'rise', $mol_term_color.magenta);
|
|
2339
|
-
$.$mol_log3_area = $mol_log3_node_make('log', 'stdout', 'area', $mol_term_color.cyan);
|
|
2345
|
+
$.$mol_wait_timeout_async = $mol_wait_timeout_async;
|
|
2346
|
+
function $mol_wait_timeout(timeout) {
|
|
2347
|
+
return this.$mol_wire_sync(this).$mol_wait_timeout_async(timeout);
|
|
2348
|
+
}
|
|
2349
|
+
$.$mol_wait_timeout = $mol_wait_timeout;
|
|
2340
2350
|
})($ || ($ = {}));
|
|
2341
|
-
//mol/
|
|
2351
|
+
//mol/wait/timeout/timeout.ts
|
|
2342
2352
|
;
|
|
2343
2353
|
"use strict";
|
|
2344
2354
|
var $;
|
|
@@ -3294,17 +3304,6 @@ var $;
|
|
|
3294
3304
|
;
|
|
3295
3305
|
"use strict";
|
|
3296
3306
|
var $;
|
|
3297
|
-
(function ($) {
|
|
3298
|
-
function $mol_dom_serialize(node) {
|
|
3299
|
-
const serializer = new $mol_dom_context.XMLSerializer;
|
|
3300
|
-
return serializer.serializeToString(node);
|
|
3301
|
-
}
|
|
3302
|
-
$.$mol_dom_serialize = $mol_dom_serialize;
|
|
3303
|
-
})($ || ($ = {}));
|
|
3304
|
-
//mol/dom/serialize/serialize.ts
|
|
3305
|
-
;
|
|
3306
|
-
"use strict";
|
|
3307
|
-
var $;
|
|
3308
3307
|
(function ($) {
|
|
3309
3308
|
function $mol_assert_ok(value) {
|
|
3310
3309
|
if (value)
|
|
@@ -3325,14 +3324,12 @@ var $;
|
|
|
3325
3324
|
handler();
|
|
3326
3325
|
}
|
|
3327
3326
|
catch (error) {
|
|
3328
|
-
if (!ErrorRight)
|
|
3329
|
-
return error;
|
|
3330
3327
|
$.$mol_fail = fail;
|
|
3331
3328
|
if (typeof ErrorRight === 'string') {
|
|
3332
3329
|
$mol_assert_equal(error.message, ErrorRight);
|
|
3333
3330
|
}
|
|
3334
3331
|
else {
|
|
3335
|
-
$
|
|
3332
|
+
$mol_assert_equal(error instanceof ErrorRight, true);
|
|
3336
3333
|
}
|
|
3337
3334
|
return error;
|
|
3338
3335
|
}
|
|
@@ -3342,58 +3339,47 @@ var $;
|
|
|
3342
3339
|
$mol_fail(new Error('Not failed'));
|
|
3343
3340
|
}
|
|
3344
3341
|
$.$mol_assert_fail = $mol_assert_fail;
|
|
3345
|
-
function $
|
|
3346
|
-
|
|
3347
|
-
for (let j = 0; j < args.length; ++j) {
|
|
3348
|
-
if (i === j)
|
|
3349
|
-
continue;
|
|
3350
|
-
if (Number.isNaN(args[i]) && Number.isNaN(args[j]))
|
|
3351
|
-
continue;
|
|
3352
|
-
if (args[i] !== args[j])
|
|
3353
|
-
$mol_fail(new Error(`Not equal (${i + 1}:${j + 1})\n${args[i]}\n${args[j]}`));
|
|
3354
|
-
}
|
|
3355
|
-
}
|
|
3342
|
+
function $mol_assert_like(...args) {
|
|
3343
|
+
$mol_assert_equal(...args);
|
|
3356
3344
|
}
|
|
3357
|
-
$.$
|
|
3345
|
+
$.$mol_assert_like = $mol_assert_like;
|
|
3358
3346
|
function $mol_assert_unique(...args) {
|
|
3359
3347
|
for (let i = 0; i < args.length; ++i) {
|
|
3360
3348
|
for (let j = 0; j < args.length; ++j) {
|
|
3361
3349
|
if (i === j)
|
|
3362
3350
|
continue;
|
|
3363
|
-
if (
|
|
3364
|
-
|
|
3365
|
-
}
|
|
3351
|
+
if (!$mol_compare_deep(args[i], args[j]))
|
|
3352
|
+
continue;
|
|
3353
|
+
$mol_fail(new Error(`args[${i}] = args[${j}] = ${args[i]}`));
|
|
3366
3354
|
}
|
|
3367
3355
|
}
|
|
3368
3356
|
}
|
|
3369
3357
|
$.$mol_assert_unique = $mol_assert_unique;
|
|
3370
|
-
function $
|
|
3371
|
-
for (let
|
|
3372
|
-
if (
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
return val;
|
|
3378
|
-
if ('outerHTML' in val)
|
|
3379
|
-
return val.outerHTML;
|
|
3380
|
-
try {
|
|
3381
|
-
return JSON.stringify(val, (k, v) => typeof v === 'bigint' ? String(v) : v, '\t');
|
|
3382
|
-
}
|
|
3383
|
-
catch (error) {
|
|
3384
|
-
console.error(error);
|
|
3385
|
-
return val;
|
|
3386
|
-
}
|
|
3387
|
-
};
|
|
3388
|
-
return $mol_fail(new Error(`Not like (1:${+index + 2})\n${print(head)}\n---\n${print(value)}`));
|
|
3389
|
-
}
|
|
3358
|
+
function $mol_assert_equal(...args) {
|
|
3359
|
+
for (let i = 1; i < args.length; ++i) {
|
|
3360
|
+
if ($mol_compare_deep(args[0], args[i]))
|
|
3361
|
+
continue;
|
|
3362
|
+
if (args[0] instanceof Element && args[i] instanceof Element && args[0].outerHTML === args[i].outerHTML)
|
|
3363
|
+
continue;
|
|
3364
|
+
return $mol_fail(new Error(`args[0] ≠ args[${i}]\n${print(args[0])}\n---\n${print(args[i])}`));
|
|
3390
3365
|
}
|
|
3391
3366
|
}
|
|
3392
|
-
$.$
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3367
|
+
$.$mol_assert_equal = $mol_assert_equal;
|
|
3368
|
+
const print = (val) => {
|
|
3369
|
+
if (!val)
|
|
3370
|
+
return val;
|
|
3371
|
+
if (typeof val !== 'object')
|
|
3372
|
+
return val;
|
|
3373
|
+
if ('outerHTML' in val)
|
|
3374
|
+
return val.outerHTML;
|
|
3375
|
+
try {
|
|
3376
|
+
return JSON.stringify(val, (k, v) => typeof v === 'bigint' ? String(v) : v, '\t');
|
|
3377
|
+
}
|
|
3378
|
+
catch (error) {
|
|
3379
|
+
console.error(error);
|
|
3380
|
+
return val;
|
|
3381
|
+
}
|
|
3382
|
+
};
|
|
3397
3383
|
})($ || ($ = {}));
|
|
3398
3384
|
//mol/assert/assert.ts
|
|
3399
3385
|
;
|
|
@@ -3414,10 +3400,10 @@ var $;
|
|
|
3414
3400
|
$mol_assert_equal(2, 2, 2);
|
|
3415
3401
|
},
|
|
3416
3402
|
'two must be unique'() {
|
|
3417
|
-
$mol_assert_unique([
|
|
3403
|
+
$mol_assert_unique([2], [3]);
|
|
3418
3404
|
},
|
|
3419
3405
|
'three must be unique'() {
|
|
3420
|
-
$mol_assert_unique([
|
|
3406
|
+
$mol_assert_unique([1], [2], [3]);
|
|
3421
3407
|
},
|
|
3422
3408
|
'two must be alike'() {
|
|
3423
3409
|
$mol_assert_like([3], [3]);
|
|
@@ -3560,14 +3546,14 @@ var $;
|
|
|
3560
3546
|
},
|
|
3561
3547
|
'slice span - out of range'($) {
|
|
3562
3548
|
const span = new $mol_span('test.ts', '', 1, 3, 5);
|
|
3563
|
-
$mol_assert_fail(() => span.slice(-1, 3));
|
|
3564
|
-
$mol_assert_fail(() => span.slice(1, 6));
|
|
3565
|
-
$mol_assert_fail(() => span.slice(1, 10));
|
|
3549
|
+
$mol_assert_fail(() => span.slice(-1, 3), `End value '3' can't be less than begin value (test.ts#1:3/5)`);
|
|
3550
|
+
$mol_assert_fail(() => span.slice(1, 6), `End value '6' out of range (test.ts#1:3/5)`);
|
|
3551
|
+
$mol_assert_fail(() => span.slice(1, 10), `End value '10' out of range (test.ts#1:3/5)`);
|
|
3566
3552
|
},
|
|
3567
3553
|
'error handling'($) {
|
|
3568
3554
|
const span = new $mol_span('test.ts', '', 1, 3, 4);
|
|
3569
|
-
const error = span.error('Some error
|
|
3570
|
-
$mol_assert_equal(error.message, 'Some error
|
|
3555
|
+
const error = span.error('Some error');
|
|
3556
|
+
$mol_assert_equal(error.message, 'Some error (test.ts#1:3/4)');
|
|
3571
3557
|
}
|
|
3572
3558
|
});
|
|
3573
3559
|
})($ || ($ = {}));
|
|
@@ -4359,7 +4345,7 @@ var $;
|
|
|
4359
4345
|
], App, "result", null);
|
|
4360
4346
|
$mol_assert_equal(App.result(), 1);
|
|
4361
4347
|
App.condition(true);
|
|
4362
|
-
$mol_assert_fail(() => App.result());
|
|
4348
|
+
$mol_assert_fail(() => App.result(), 'test error');
|
|
4363
4349
|
App.condition(false);
|
|
4364
4350
|
$mol_assert_equal(App.result(), 1);
|
|
4365
4351
|
},
|