mol_plot_all 1.2.1706 → 1.2.1708
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 +597 -1
- package/node.d.ts.map +1 -1
- package/node.deps.json +1 -1
- package/node.js +318 -14
- package/node.js.map +1 -1
- package/node.mjs +318 -14
- package/node.test.js +443 -15
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.d.ts +546 -0
- package/web.d.ts.map +1 -1
- package/web.deps.json +1 -1
- package/web.js +262 -10
- package/web.js.map +1 -1
- package/web.mjs +262 -10
- package/web.test.js +135 -7
- package/web.test.js.map +1 -1
package/node.mjs
CHANGED
|
@@ -41,7 +41,7 @@ var $;
|
|
|
41
41
|
"use strict";
|
|
42
42
|
var $;
|
|
43
43
|
(function ($) {
|
|
44
|
-
const mod = require('module');
|
|
44
|
+
const mod = require /****/('module');
|
|
45
45
|
const internals = mod.builtinModules;
|
|
46
46
|
function $node_internal_check(name) {
|
|
47
47
|
if (name.startsWith('node:'))
|
|
@@ -81,7 +81,7 @@ var $;
|
|
|
81
81
|
var $;
|
|
82
82
|
(function ($) {
|
|
83
83
|
function $mol_fail_hidden(error) {
|
|
84
|
-
throw error;
|
|
84
|
+
throw error; /// Use 'Never Pause Here' breakpoint in DevTools or simply blackbox this script
|
|
85
85
|
}
|
|
86
86
|
$.$mol_fail_hidden = $mol_fail_hidden;
|
|
87
87
|
})($ || ($ = {}));
|
|
@@ -139,8 +139,8 @@ var $;
|
|
|
139
139
|
"use strict";
|
|
140
140
|
var $;
|
|
141
141
|
(function ($) {
|
|
142
|
-
const path = require('path');
|
|
143
|
-
const mod = require('module');
|
|
142
|
+
const path = require /****/('path');
|
|
143
|
+
const mod = require /****/('module');
|
|
144
144
|
const localRequire = mod.createRequire(path.join(process.cwd(), 'package.json'));
|
|
145
145
|
function $node_autoinstall(name) {
|
|
146
146
|
try {
|
|
@@ -247,6 +247,7 @@ var $;
|
|
|
247
247
|
])
|
|
248
248
|
].map(frame_normalize).join('\n')
|
|
249
249
|
});
|
|
250
|
+
// в nodejs, что б не дублировалось cause в консоли
|
|
250
251
|
Object.defineProperty(this, 'cause', {
|
|
251
252
|
get: () => cause
|
|
252
253
|
});
|
|
@@ -280,6 +281,11 @@ var $;
|
|
|
280
281
|
var $;
|
|
281
282
|
(function ($) {
|
|
282
283
|
const instances = new WeakSet();
|
|
284
|
+
/**
|
|
285
|
+
* Proxy that delegates all to lazy returned target.
|
|
286
|
+
*
|
|
287
|
+
* $mol_delegate( Array.prototype , ()=> fetch_array() )
|
|
288
|
+
*/
|
|
283
289
|
function $mol_delegate(proto, target) {
|
|
284
290
|
const proxy = new Proxy(proto, {
|
|
285
291
|
get: (_, field) => {
|
|
@@ -423,6 +429,9 @@ var $;
|
|
|
423
429
|
[Symbol.dispose]() {
|
|
424
430
|
this.destructor();
|
|
425
431
|
}
|
|
432
|
+
//[ Symbol.toPrimitive ]( hint: string ) {
|
|
433
|
+
// return hint === 'number' ? this.valueOf() : this.toString()
|
|
434
|
+
//}
|
|
426
435
|
toString() {
|
|
427
436
|
return this[Symbol.toStringTag] || this.constructor.name + '<>';
|
|
428
437
|
}
|
|
@@ -473,6 +482,7 @@ var $;
|
|
|
473
482
|
"use strict";
|
|
474
483
|
var $;
|
|
475
484
|
(function ($) {
|
|
485
|
+
/** Generates unique identifier. */
|
|
476
486
|
function $mol_guid(length = 8, exists = () => false) {
|
|
477
487
|
for (;;) {
|
|
478
488
|
let id = Math.random().toString(36).substring(2, length + 2).toUpperCase();
|
|
@@ -488,11 +498,16 @@ var $;
|
|
|
488
498
|
"use strict";
|
|
489
499
|
var $;
|
|
490
500
|
(function ($) {
|
|
501
|
+
/** Special status statuses. */
|
|
491
502
|
let $mol_wire_cursor;
|
|
492
503
|
(function ($mol_wire_cursor) {
|
|
504
|
+
/** Update required. */
|
|
493
505
|
$mol_wire_cursor[$mol_wire_cursor["stale"] = -1] = "stale";
|
|
506
|
+
/** Some of (transitive) pub update required. */
|
|
494
507
|
$mol_wire_cursor[$mol_wire_cursor["doubt"] = -2] = "doubt";
|
|
508
|
+
/** Actual state but may be dropped. */
|
|
495
509
|
$mol_wire_cursor[$mol_wire_cursor["fresh"] = -3] = "fresh";
|
|
510
|
+
/** State will never be changed. */
|
|
496
511
|
$mol_wire_cursor[$mol_wire_cursor["final"] = -4] = "final";
|
|
497
512
|
})($mol_wire_cursor = $.$mol_wire_cursor || ($.$mol_wire_cursor = {}));
|
|
498
513
|
})($ || ($ = {}));
|
|
@@ -501,6 +516,9 @@ var $;
|
|
|
501
516
|
"use strict";
|
|
502
517
|
var $;
|
|
503
518
|
(function ($) {
|
|
519
|
+
/**
|
|
520
|
+
* Collects subscribers in compact array. 28B
|
|
521
|
+
*/
|
|
504
522
|
class $mol_wire_pub extends Object {
|
|
505
523
|
constructor(id = `$mol_wire_pub:${$mol_guid()}`) {
|
|
506
524
|
super();
|
|
@@ -508,10 +526,17 @@ var $;
|
|
|
508
526
|
}
|
|
509
527
|
[Symbol.toStringTag];
|
|
510
528
|
data = [];
|
|
529
|
+
// Derived objects should be Arrays.
|
|
511
530
|
static get [Symbol.species]() {
|
|
512
531
|
return Array;
|
|
513
532
|
}
|
|
514
|
-
|
|
533
|
+
/**
|
|
534
|
+
* Index of first subscriber.
|
|
535
|
+
*/
|
|
536
|
+
sub_from = 0; // 4B
|
|
537
|
+
/**
|
|
538
|
+
* All current subscribers.
|
|
539
|
+
*/
|
|
515
540
|
get sub_list() {
|
|
516
541
|
const res = [];
|
|
517
542
|
for (let i = this.sub_from; i < this.data.length; i += 2) {
|
|
@@ -519,14 +544,23 @@ var $;
|
|
|
519
544
|
}
|
|
520
545
|
return res;
|
|
521
546
|
}
|
|
547
|
+
/**
|
|
548
|
+
* Has any subscribers or not.
|
|
549
|
+
*/
|
|
522
550
|
get sub_empty() {
|
|
523
551
|
return this.sub_from === this.data.length;
|
|
524
552
|
}
|
|
553
|
+
/**
|
|
554
|
+
* Subscribe subscriber to this publisher events and return position of subscriber that required to unsubscribe.
|
|
555
|
+
*/
|
|
525
556
|
sub_on(sub, pub_pos) {
|
|
526
557
|
const pos = this.data.length;
|
|
527
558
|
this.data.push(sub, pub_pos);
|
|
528
559
|
return pos;
|
|
529
560
|
}
|
|
561
|
+
/**
|
|
562
|
+
* Unsubscribe subscriber from this publisher events by subscriber position provided by `on(pub)`.
|
|
563
|
+
*/
|
|
530
564
|
sub_off(sub_pos) {
|
|
531
565
|
if (!(sub_pos < this.data.length)) {
|
|
532
566
|
$mol_fail(new Error(`Wrong pos ${sub_pos}`));
|
|
@@ -539,21 +573,39 @@ var $;
|
|
|
539
573
|
if (end === this.sub_from)
|
|
540
574
|
this.reap();
|
|
541
575
|
}
|
|
576
|
+
/**
|
|
577
|
+
* Called when last sub was unsubscribed.
|
|
578
|
+
**/
|
|
542
579
|
reap() { }
|
|
580
|
+
/**
|
|
581
|
+
* Autowire this publisher with current subscriber.
|
|
582
|
+
**/
|
|
543
583
|
promote() {
|
|
544
584
|
$mol_wire_auto()?.track_next(this);
|
|
545
585
|
}
|
|
586
|
+
/**
|
|
587
|
+
* Enforce actualization. Should not throw errors.
|
|
588
|
+
*/
|
|
546
589
|
fresh() { }
|
|
590
|
+
/**
|
|
591
|
+
* Allow to put data to caches in the subtree.
|
|
592
|
+
*/
|
|
547
593
|
complete() { }
|
|
548
594
|
get incompleted() {
|
|
549
595
|
return false;
|
|
550
596
|
}
|
|
597
|
+
/**
|
|
598
|
+
* Notify subscribers about self changes.
|
|
599
|
+
*/
|
|
551
600
|
emit(quant = $mol_wire_cursor.stale) {
|
|
552
601
|
for (let i = this.sub_from; i < this.data.length; i += 2) {
|
|
553
602
|
;
|
|
554
603
|
this.data[i].absorb(quant, this.data[i + 1]);
|
|
555
604
|
}
|
|
556
605
|
}
|
|
606
|
+
/**
|
|
607
|
+
* Moves peer from one position to another. Doesn't clear data at old position!
|
|
608
|
+
*/
|
|
557
609
|
peer_move(from_pos, to_pos) {
|
|
558
610
|
const peer = this.data[from_pos];
|
|
559
611
|
const self_pos = this.data[from_pos + 1];
|
|
@@ -561,6 +613,9 @@ var $;
|
|
|
561
613
|
this.data[to_pos + 1] = self_pos;
|
|
562
614
|
peer.peer_repos(self_pos, to_pos);
|
|
563
615
|
}
|
|
616
|
+
/**
|
|
617
|
+
* Updates self position in the peer.
|
|
618
|
+
*/
|
|
564
619
|
peer_repos(peer_pos, self_pos) {
|
|
565
620
|
this.data[peer_pos + 1] = self_pos;
|
|
566
621
|
}
|
|
@@ -576,10 +631,16 @@ var $;
|
|
|
576
631
|
var $;
|
|
577
632
|
(function ($) {
|
|
578
633
|
$.$mol_wire_auto_sub = null;
|
|
634
|
+
/**
|
|
635
|
+
* When fulfilled, all publishers are promoted to this subscriber on access to its.
|
|
636
|
+
*/
|
|
579
637
|
function $mol_wire_auto(next = $.$mol_wire_auto_sub) {
|
|
580
638
|
return $.$mol_wire_auto_sub = next;
|
|
581
639
|
}
|
|
582
640
|
$.$mol_wire_auto = $mol_wire_auto;
|
|
641
|
+
/**
|
|
642
|
+
* Affection queue. Used to prevent accidental stack overflow on emit.
|
|
643
|
+
*/
|
|
583
644
|
$.$mol_wire_affected = [];
|
|
584
645
|
})($ || ($ = {}));
|
|
585
646
|
|
|
@@ -587,6 +648,7 @@ var $;
|
|
|
587
648
|
"use strict";
|
|
588
649
|
var $;
|
|
589
650
|
(function ($) {
|
|
651
|
+
// https://docs.google.com/document/d/1FTascZXT9cxfetuPRT2eXPQKXui4nWFivUnS_335T3U/preview#
|
|
590
652
|
$['devtoolsFormatters'] ||= [];
|
|
591
653
|
function $mol_dev_format_register(config) {
|
|
592
654
|
$['devtoolsFormatters'].push(config);
|
|
@@ -638,6 +700,7 @@ var $;
|
|
|
638
700
|
return false;
|
|
639
701
|
if (!val)
|
|
640
702
|
return false;
|
|
703
|
+
// if( Error.isError( val ) ) true
|
|
641
704
|
if (val[$.$mol_dev_format_body])
|
|
642
705
|
return true;
|
|
643
706
|
return false;
|
|
@@ -655,12 +718,16 @@ var $;
|
|
|
655
718
|
return $.$mol_dev_format_accent($mol_dev_format_native(val), '💨', $mol_dev_format_native(error), '');
|
|
656
719
|
}
|
|
657
720
|
}
|
|
721
|
+
// if( Error.isError( val ) ) {
|
|
722
|
+
// return $mol_dev_format_native( val )
|
|
723
|
+
// }
|
|
658
724
|
return null;
|
|
659
725
|
},
|
|
660
726
|
});
|
|
661
727
|
function $mol_dev_format_native(obj) {
|
|
662
728
|
if (typeof obj === 'undefined')
|
|
663
729
|
return $.$mol_dev_format_shade('undefined');
|
|
730
|
+
// if( ![ 'object', 'function', 'symbol' ].includes( typeof obj ) ) return obj
|
|
664
731
|
return [
|
|
665
732
|
'object',
|
|
666
733
|
{
|
|
@@ -718,6 +785,9 @@ var $;
|
|
|
718
785
|
'margin-left': '13px'
|
|
719
786
|
});
|
|
720
787
|
class Stack extends Array {
|
|
788
|
+
// [ Symbol.toPrimitive ]() {
|
|
789
|
+
// return this.toString()
|
|
790
|
+
// }
|
|
721
791
|
toString() {
|
|
722
792
|
return this.join('\n');
|
|
723
793
|
}
|
|
@@ -740,6 +810,7 @@ var $;
|
|
|
740
810
|
this.method = call.getMethodName() ?? '';
|
|
741
811
|
if (this.method === this.function)
|
|
742
812
|
this.method = '';
|
|
813
|
+
// const func = c.getFunction()
|
|
743
814
|
this.pos = [call.getEnclosingLineNumber() ?? 0, call.getEnclosingColumnNumber() ?? 0];
|
|
744
815
|
this.eval = call.getEvalOrigin() ?? '';
|
|
745
816
|
this.source = call.getScriptNameOrSourceURL() ?? '';
|
|
@@ -786,9 +857,16 @@ var $;
|
|
|
786
857
|
"use strict";
|
|
787
858
|
var $;
|
|
788
859
|
(function ($) {
|
|
860
|
+
/**
|
|
861
|
+
* Publisher that can auto collect other publishers. 32B
|
|
862
|
+
*
|
|
863
|
+
* P1 P2 P3 P4 S1 S2 S3
|
|
864
|
+
* ^ ^
|
|
865
|
+
* pubs_from subs_from
|
|
866
|
+
*/
|
|
789
867
|
class $mol_wire_pub_sub extends $mol_wire_pub {
|
|
790
|
-
pub_from = 0;
|
|
791
|
-
cursor = $mol_wire_cursor.stale;
|
|
868
|
+
pub_from = 0; // 4B
|
|
869
|
+
cursor = $mol_wire_cursor.stale; // 4B
|
|
792
870
|
get temp() {
|
|
793
871
|
return false;
|
|
794
872
|
}
|
|
@@ -906,10 +984,27 @@ var $;
|
|
|
906
984
|
return;
|
|
907
985
|
this.cursor = quant;
|
|
908
986
|
this.emit($mol_wire_cursor.doubt);
|
|
987
|
+
// if( pos >= 0 && pos < this.sub_from - 2 ) {
|
|
988
|
+
// const pub = this.data[ pos ] as $mol_wire_pub
|
|
989
|
+
// if( pub instanceof $mol_wire_task ) return
|
|
990
|
+
// for(
|
|
991
|
+
// let cursor = this.pub_from;
|
|
992
|
+
// cursor < this.sub_from;
|
|
993
|
+
// cursor += 2
|
|
994
|
+
// ) {
|
|
995
|
+
// const pub = this.data[ cursor ] as $mol_wire_pub
|
|
996
|
+
// if( pub instanceof $mol_wire_task ) {
|
|
997
|
+
// pub.destructor()
|
|
998
|
+
// }
|
|
999
|
+
// }
|
|
1000
|
+
// }
|
|
909
1001
|
}
|
|
910
1002
|
[$mol_dev_format_head]() {
|
|
911
1003
|
return $mol_dev_format_native(this);
|
|
912
1004
|
}
|
|
1005
|
+
/**
|
|
1006
|
+
* Is subscribed to any publisher or not.
|
|
1007
|
+
*/
|
|
913
1008
|
get pub_empty() {
|
|
914
1009
|
return this.sub_from === this.pub_from;
|
|
915
1010
|
}
|
|
@@ -950,6 +1045,13 @@ var $;
|
|
|
950
1045
|
var $;
|
|
951
1046
|
(function ($) {
|
|
952
1047
|
const wrappers = new WeakMap();
|
|
1048
|
+
/**
|
|
1049
|
+
* Suspendable task with support both sync/async api.
|
|
1050
|
+
*
|
|
1051
|
+
* A1 A2 A3 A4 P1 P2 P3 P4 S1 S2 S3
|
|
1052
|
+
* ^ ^ ^
|
|
1053
|
+
* args_from pubs_from subs_from
|
|
1054
|
+
**/
|
|
953
1055
|
class $mol_wire_fiber extends $mol_wire_pub_sub {
|
|
954
1056
|
task;
|
|
955
1057
|
host;
|
|
@@ -970,6 +1072,7 @@ var $;
|
|
|
970
1072
|
});
|
|
971
1073
|
}
|
|
972
1074
|
static sync() {
|
|
1075
|
+
// Sync whole fiber graph
|
|
973
1076
|
while (this.planning.size) {
|
|
974
1077
|
for (const fiber of this.planning) {
|
|
975
1078
|
this.planning.delete(fiber);
|
|
@@ -980,6 +1083,7 @@ var $;
|
|
|
980
1083
|
fiber.fresh();
|
|
981
1084
|
}
|
|
982
1085
|
}
|
|
1086
|
+
// Collect garbage
|
|
983
1087
|
while (this.reaping.size) {
|
|
984
1088
|
const fibers = this.reaping;
|
|
985
1089
|
this.reaping = new Set;
|
|
@@ -1131,6 +1235,10 @@ var $;
|
|
|
1131
1235
|
this.cursor = $mol_wire_cursor.stale;
|
|
1132
1236
|
this.fresh();
|
|
1133
1237
|
}
|
|
1238
|
+
/**
|
|
1239
|
+
* Synchronous execution. Throws Promise when waits async task (SuspenseAPI provider).
|
|
1240
|
+
* Should be called inside SuspenseAPI consumer (ie fiber).
|
|
1241
|
+
*/
|
|
1134
1242
|
sync() {
|
|
1135
1243
|
if (!$mol_wire_fiber.warm) {
|
|
1136
1244
|
return this.result();
|
|
@@ -1145,6 +1253,10 @@ var $;
|
|
|
1145
1253
|
}
|
|
1146
1254
|
return this.cache;
|
|
1147
1255
|
}
|
|
1256
|
+
/**
|
|
1257
|
+
* Asynchronous execution.
|
|
1258
|
+
* It's SuspenseAPI consumer. So SuspenseAPI providers can be called inside.
|
|
1259
|
+
*/
|
|
1148
1260
|
async async_raw() {
|
|
1149
1261
|
while (true) {
|
|
1150
1262
|
this.fresh();
|
|
@@ -1157,6 +1269,7 @@ var $;
|
|
|
1157
1269
|
if (!$mol_promise_like(this.cache))
|
|
1158
1270
|
return this.cache;
|
|
1159
1271
|
if (this.cursor === $mol_wire_cursor.final) {
|
|
1272
|
+
// never ends on destructed fiber
|
|
1160
1273
|
await new Promise(() => { });
|
|
1161
1274
|
}
|
|
1162
1275
|
}
|
|
@@ -1204,6 +1317,10 @@ var $;
|
|
|
1204
1317
|
var $;
|
|
1205
1318
|
(function ($) {
|
|
1206
1319
|
$.$mol_compare_deep_cache = new WeakMap();
|
|
1320
|
+
/**
|
|
1321
|
+
* Deeply compares two values. Returns true if equal.
|
|
1322
|
+
* Define `Symbol.toPrimitive` to customize.
|
|
1323
|
+
*/
|
|
1207
1324
|
function $mol_compare_deep(left, right) {
|
|
1208
1325
|
if (Object.is(left, right))
|
|
1209
1326
|
return true;
|
|
@@ -1343,6 +1460,7 @@ var $;
|
|
|
1343
1460
|
"use strict";
|
|
1344
1461
|
var $;
|
|
1345
1462
|
(function ($) {
|
|
1463
|
+
/** Log begin of collapsed group only when some logged inside, returns func to close group */
|
|
1346
1464
|
function $mol_log3_area_lazy(event) {
|
|
1347
1465
|
const self = this.$;
|
|
1348
1466
|
const stack = self.$mol_log3_stack;
|
|
@@ -1367,6 +1485,7 @@ var $;
|
|
|
1367
1485
|
"use strict";
|
|
1368
1486
|
var $;
|
|
1369
1487
|
(function ($) {
|
|
1488
|
+
/** Position in any resource. */
|
|
1370
1489
|
class $mol_span extends $mol_object2 {
|
|
1371
1490
|
uri;
|
|
1372
1491
|
source;
|
|
@@ -1382,13 +1501,17 @@ var $;
|
|
|
1382
1501
|
this.length = length;
|
|
1383
1502
|
this[Symbol.toStringTag] = this.uri + ('#' + this.row + ':' + this.col + '/' + this.length);
|
|
1384
1503
|
}
|
|
1504
|
+
/** Span for begin of unknown resource */
|
|
1385
1505
|
static unknown = $mol_span.begin('?');
|
|
1506
|
+
/** Makes new span for begin of resource. */
|
|
1386
1507
|
static begin(uri, source = '') {
|
|
1387
1508
|
return new $mol_span(uri, source, 1, 1, 0);
|
|
1388
1509
|
}
|
|
1510
|
+
/** Makes new span for end of resource. */
|
|
1389
1511
|
static end(uri, source) {
|
|
1390
1512
|
return new $mol_span(uri, source, 1, source.length + 1, 0);
|
|
1391
1513
|
}
|
|
1514
|
+
/** Makes new span for entire resource. */
|
|
1392
1515
|
static entire(uri, source) {
|
|
1393
1516
|
return new $mol_span(uri, source, 1, 1, source.length);
|
|
1394
1517
|
}
|
|
@@ -1403,15 +1526,19 @@ var $;
|
|
|
1403
1526
|
length: this.length
|
|
1404
1527
|
};
|
|
1405
1528
|
}
|
|
1529
|
+
/** Makes new error for this span. */
|
|
1406
1530
|
error(message, Class = Error) {
|
|
1407
1531
|
return new Class(`${message} (${this})`);
|
|
1408
1532
|
}
|
|
1533
|
+
/** Makes new span for same uri. */
|
|
1409
1534
|
span(row, col, length) {
|
|
1410
1535
|
return new $mol_span(this.uri, this.source, row, col, length);
|
|
1411
1536
|
}
|
|
1537
|
+
/** Makes new span after end of this. */
|
|
1412
1538
|
after(length = 0) {
|
|
1413
1539
|
return new $mol_span(this.uri, this.source, this.row, this.col + this.length, length);
|
|
1414
1540
|
}
|
|
1541
|
+
/** Makes new span between begin and end. */
|
|
1415
1542
|
slice(begin, end = -1) {
|
|
1416
1543
|
let len = this.length;
|
|
1417
1544
|
if (begin < 0)
|
|
@@ -1434,6 +1561,7 @@ var $;
|
|
|
1434
1561
|
"use strict";
|
|
1435
1562
|
var $;
|
|
1436
1563
|
(function ($) {
|
|
1564
|
+
/** Serializes tree to string in tree format. */
|
|
1437
1565
|
function $mol_tree2_to_string(tree) {
|
|
1438
1566
|
let output = [];
|
|
1439
1567
|
function dump(tree, prefix = '') {
|
|
@@ -1477,12 +1605,25 @@ var $;
|
|
|
1477
1605
|
"use strict";
|
|
1478
1606
|
var $;
|
|
1479
1607
|
(function ($) {
|
|
1608
|
+
/**
|
|
1609
|
+
* Abstract Syntax Tree with human readable serialization.
|
|
1610
|
+
* Avoid direct instantiation. Use static factories instead.
|
|
1611
|
+
* @see https://github.com/nin-jin/tree.d
|
|
1612
|
+
*/
|
|
1480
1613
|
class $mol_tree2 extends Object {
|
|
1481
1614
|
type;
|
|
1482
1615
|
value;
|
|
1483
1616
|
kids;
|
|
1484
1617
|
span;
|
|
1485
|
-
constructor(
|
|
1618
|
+
constructor(
|
|
1619
|
+
/** Type of structural node, `value` should be empty */
|
|
1620
|
+
type,
|
|
1621
|
+
/** Content of data node, `type` should be empty */
|
|
1622
|
+
value,
|
|
1623
|
+
/** Child nodes */
|
|
1624
|
+
kids,
|
|
1625
|
+
/** Position in most far source resource */
|
|
1626
|
+
span) {
|
|
1486
1627
|
super();
|
|
1487
1628
|
this.type = type;
|
|
1488
1629
|
this.value = value;
|
|
@@ -1490,12 +1631,15 @@ var $;
|
|
|
1490
1631
|
this.span = span;
|
|
1491
1632
|
this[Symbol.toStringTag] = type || '\\' + value;
|
|
1492
1633
|
}
|
|
1634
|
+
/** Makes collection node. */
|
|
1493
1635
|
static list(kids, span = $mol_span.unknown) {
|
|
1494
1636
|
return new $mol_tree2('', '', kids, span);
|
|
1495
1637
|
}
|
|
1638
|
+
/** Makes new derived collection node. */
|
|
1496
1639
|
list(kids) {
|
|
1497
1640
|
return $mol_tree2.list(kids, this.span);
|
|
1498
1641
|
}
|
|
1642
|
+
/** Makes data node for any string. */
|
|
1499
1643
|
static data(value, kids = [], span = $mol_span.unknown) {
|
|
1500
1644
|
const chunks = value.split('\n');
|
|
1501
1645
|
if (chunks.length > 1) {
|
|
@@ -1509,21 +1653,26 @@ var $;
|
|
|
1509
1653
|
}
|
|
1510
1654
|
return new $mol_tree2('', value, kids, span);
|
|
1511
1655
|
}
|
|
1656
|
+
/** Makes new derived data node. */
|
|
1512
1657
|
data(value, kids = []) {
|
|
1513
1658
|
return $mol_tree2.data(value, kids, this.span);
|
|
1514
1659
|
}
|
|
1660
|
+
/** Makes struct node. */
|
|
1515
1661
|
static struct(type, kids = [], span = $mol_span.unknown) {
|
|
1516
1662
|
if (/[ \n\t\\]/.test(type)) {
|
|
1517
1663
|
$$.$mol_fail(span.error(`Wrong type ${JSON.stringify(type)}`));
|
|
1518
1664
|
}
|
|
1519
1665
|
return new $mol_tree2(type, '', kids, span);
|
|
1520
1666
|
}
|
|
1667
|
+
/** Makes new derived structural node. */
|
|
1521
1668
|
struct(type, kids = []) {
|
|
1522
1669
|
return $mol_tree2.struct(type, kids, this.span);
|
|
1523
1670
|
}
|
|
1671
|
+
/** Makes new derived node with different kids id defined. */
|
|
1524
1672
|
clone(kids, span = this.span) {
|
|
1525
1673
|
return new $mol_tree2(this.type, this.value, kids, span);
|
|
1526
1674
|
}
|
|
1675
|
+
/** Returns multiline text content. */
|
|
1527
1676
|
text() {
|
|
1528
1677
|
var values = [];
|
|
1529
1678
|
for (var kid of this.kids) {
|
|
@@ -1533,15 +1682,20 @@ var $;
|
|
|
1533
1682
|
}
|
|
1534
1683
|
return this.value + values.join('\n');
|
|
1535
1684
|
}
|
|
1685
|
+
/** Parses tree format. */
|
|
1686
|
+
/** @deprecated Use $mol_tree2_from_string */
|
|
1536
1687
|
static fromString(str, uri = 'unknown') {
|
|
1537
1688
|
return $$.$mol_tree2_from_string(str, uri);
|
|
1538
1689
|
}
|
|
1690
|
+
/** Serializes to tree format. */
|
|
1539
1691
|
toString() {
|
|
1540
1692
|
return $$.$mol_tree2_to_string(this);
|
|
1541
1693
|
}
|
|
1694
|
+
/** Makes new tree with node overrided by path. */
|
|
1542
1695
|
insert(value, ...path) {
|
|
1543
1696
|
return this.update($mol_maybe(value), ...path)[0];
|
|
1544
1697
|
}
|
|
1698
|
+
/** Makes new tree with node overrided by path. */
|
|
1545
1699
|
update(value, ...path) {
|
|
1546
1700
|
if (path.length === 0)
|
|
1547
1701
|
return value;
|
|
@@ -1574,6 +1728,7 @@ var $;
|
|
|
1574
1728
|
return [this.clone(kids)];
|
|
1575
1729
|
}
|
|
1576
1730
|
}
|
|
1731
|
+
/** Query nodes by path. */
|
|
1577
1732
|
select(...path) {
|
|
1578
1733
|
let next = [this];
|
|
1579
1734
|
for (const type of path) {
|
|
@@ -1600,6 +1755,7 @@ var $;
|
|
|
1600
1755
|
}
|
|
1601
1756
|
return this.list(next);
|
|
1602
1757
|
}
|
|
1758
|
+
/** Filter kids by path or value. */
|
|
1603
1759
|
filter(path, value) {
|
|
1604
1760
|
const sub = this.kids.filter(item => {
|
|
1605
1761
|
var found = item.select(...path);
|
|
@@ -1627,9 +1783,11 @@ var $;
|
|
|
1627
1783
|
$mol_fail_hidden(error);
|
|
1628
1784
|
}
|
|
1629
1785
|
}
|
|
1786
|
+
/** Transform tree through context with transformers */
|
|
1630
1787
|
hack(belt, context = {}) {
|
|
1631
1788
|
return [].concat(...this.kids.map(child => child.hack_self(belt, context)));
|
|
1632
1789
|
}
|
|
1790
|
+
/** Makes Error with node coordinates. */
|
|
1633
1791
|
error(message, Class = Error) {
|
|
1634
1792
|
return this.span.error(`${message}\n${this.clone([])}`, Class);
|
|
1635
1793
|
}
|
|
@@ -1647,6 +1805,7 @@ var $;
|
|
|
1647
1805
|
"use strict";
|
|
1648
1806
|
var $;
|
|
1649
1807
|
(function ($) {
|
|
1808
|
+
/** Syntax error with cordinates and source line snippet. */
|
|
1650
1809
|
class $mol_error_syntax extends SyntaxError {
|
|
1651
1810
|
reason;
|
|
1652
1811
|
line;
|
|
@@ -1665,6 +1824,7 @@ var $;
|
|
|
1665
1824
|
"use strict";
|
|
1666
1825
|
var $;
|
|
1667
1826
|
(function ($) {
|
|
1827
|
+
/** Parses tree format from string. */
|
|
1668
1828
|
function $mol_tree2_from_string(str, uri = '?') {
|
|
1669
1829
|
const span = $mol_span.entire(uri, str);
|
|
1670
1830
|
var root = $mol_tree2.list([], span);
|
|
@@ -1674,6 +1834,7 @@ var $;
|
|
|
1674
1834
|
var indent = 0;
|
|
1675
1835
|
var line_start = pos;
|
|
1676
1836
|
row++;
|
|
1837
|
+
// read indent
|
|
1677
1838
|
while (str.length > pos && str[pos] == '\t') {
|
|
1678
1839
|
indent++;
|
|
1679
1840
|
pos++;
|
|
@@ -1682,8 +1843,10 @@ var $;
|
|
|
1682
1843
|
min_indent = indent;
|
|
1683
1844
|
}
|
|
1684
1845
|
indent -= min_indent;
|
|
1846
|
+
// invalid tab size
|
|
1685
1847
|
if (indent < 0 || indent >= stack.length) {
|
|
1686
1848
|
const sp = span.span(row, 1, pos - line_start);
|
|
1849
|
+
// skip error line
|
|
1687
1850
|
while (str.length > pos && str[pos] != '\n') {
|
|
1688
1851
|
pos++;
|
|
1689
1852
|
}
|
|
@@ -1698,7 +1861,9 @@ var $;
|
|
|
1698
1861
|
}
|
|
1699
1862
|
stack.length = indent + 1;
|
|
1700
1863
|
var parent = stack[indent];
|
|
1864
|
+
// parse types
|
|
1701
1865
|
while (str.length > pos && str[pos] != '\\' && str[pos] != '\n') {
|
|
1866
|
+
// type can not contain space and tab
|
|
1702
1867
|
var error_start = pos;
|
|
1703
1868
|
while (str.length > pos && (str[pos] == ' ' || str[pos] == '\t')) {
|
|
1704
1869
|
pos++;
|
|
@@ -1710,6 +1875,7 @@ var $;
|
|
|
1710
1875
|
const sp = span.span(row, error_start - line_start + 1, pos - error_start);
|
|
1711
1876
|
this.$mol_fail(new this.$mol_error_syntax(`Wrong nodes separator`, str.substring(line_start, line_end), sp));
|
|
1712
1877
|
}
|
|
1878
|
+
// read type
|
|
1713
1879
|
var type_start = pos;
|
|
1714
1880
|
while (str.length > pos &&
|
|
1715
1881
|
str[pos] != '\\' &&
|
|
@@ -1724,10 +1890,12 @@ var $;
|
|
|
1724
1890
|
parent_kids.push(next);
|
|
1725
1891
|
parent = next;
|
|
1726
1892
|
}
|
|
1893
|
+
// read one space if exists
|
|
1727
1894
|
if (str.length > pos && str[pos] == ' ') {
|
|
1728
1895
|
pos++;
|
|
1729
1896
|
}
|
|
1730
1897
|
}
|
|
1898
|
+
// read data
|
|
1731
1899
|
if (str.length > pos && str[pos] == '\\') {
|
|
1732
1900
|
var data_start = pos;
|
|
1733
1901
|
while (str.length > pos && str[pos] != '\n') {
|
|
@@ -1738,6 +1906,7 @@ var $;
|
|
|
1738
1906
|
parent_kids.push(next);
|
|
1739
1907
|
parent = next;
|
|
1740
1908
|
}
|
|
1909
|
+
// now must be end of text
|
|
1741
1910
|
if (str.length === pos && stack.length > 0) {
|
|
1742
1911
|
const sp = span.span(row, pos - line_start + 1, 1);
|
|
1743
1912
|
this.$mol_fail(new this.$mol_error_syntax(`Unexpected EOF, LF required`, str.substring(line_start, str.length), sp));
|
|
@@ -1830,6 +1999,7 @@ var $;
|
|
|
1830
1999
|
"use strict";
|
|
1831
2000
|
var $;
|
|
1832
2001
|
(function ($) {
|
|
2002
|
+
/** Module for working with terminal. Text coloring when output in terminal */
|
|
1833
2003
|
class $mol_term_color {
|
|
1834
2004
|
static reset = this.ansi(0, 0);
|
|
1835
2005
|
static bold = this.ansi(1, 22);
|
|
@@ -1901,6 +2071,7 @@ var $;
|
|
|
1901
2071
|
"use strict";
|
|
1902
2072
|
var $;
|
|
1903
2073
|
(function ($) {
|
|
2074
|
+
/** One-shot fiber */
|
|
1904
2075
|
class $mol_wire_task extends $mol_wire_fiber {
|
|
1905
2076
|
static getter(task) {
|
|
1906
2077
|
return function $mol_wire_task_get(host, args) {
|
|
@@ -1926,6 +2097,7 @@ var $;
|
|
|
1926
2097
|
}
|
|
1927
2098
|
const key = (host?.[Symbol.toStringTag] ?? host) + ('.' + task.name + '<#>');
|
|
1928
2099
|
const next = new $mol_wire_task(key, task, host, args);
|
|
2100
|
+
// Disabled because non-idempotency is required for try-catch
|
|
1929
2101
|
if (existen?.temp) {
|
|
1930
2102
|
$$.$mol_log3_warn({
|
|
1931
2103
|
place: '$mol_wire_task',
|
|
@@ -1958,7 +2130,7 @@ var $;
|
|
|
1958
2130
|
try {
|
|
1959
2131
|
next[Symbol.toStringTag] = this[Symbol.toStringTag];
|
|
1960
2132
|
}
|
|
1961
|
-
catch {
|
|
2133
|
+
catch { // Promises throw in strict mode
|
|
1962
2134
|
Object.defineProperty(next, Symbol.toStringTag, { value: this[Symbol.toStringTag] });
|
|
1963
2135
|
}
|
|
1964
2136
|
}
|
|
@@ -2011,6 +2183,10 @@ var $;
|
|
|
2011
2183
|
props[field] = get_val;
|
|
2012
2184
|
return get_val;
|
|
2013
2185
|
}
|
|
2186
|
+
/**
|
|
2187
|
+
* Convert asynchronous (promise-based) API to synchronous by wrapping function and method calls in a fiber.
|
|
2188
|
+
* @see https://mol.hyoo.ru/#!section=docs/=1fcpsq_1wh0h2
|
|
2189
|
+
*/
|
|
2014
2190
|
function $mol_wire_sync(obj) {
|
|
2015
2191
|
return new Proxy(obj, {
|
|
2016
2192
|
get(obj, field) {
|
|
@@ -2252,6 +2428,10 @@ var $;
|
|
|
2252
2428
|
"use strict";
|
|
2253
2429
|
var $;
|
|
2254
2430
|
(function ($) {
|
|
2431
|
+
/**
|
|
2432
|
+
* CSS Units
|
|
2433
|
+
* @see https://mol.hyoo.ru/#!section=docs/=xwq9q5_f966fg
|
|
2434
|
+
*/
|
|
2255
2435
|
class $mol_style_unit extends $mol_decor {
|
|
2256
2436
|
literal;
|
|
2257
2437
|
constructor(value, literal) {
|
|
@@ -2298,6 +2478,10 @@ var $;
|
|
|
2298
2478
|
var $;
|
|
2299
2479
|
(function ($) {
|
|
2300
2480
|
const { per } = $mol_style_unit;
|
|
2481
|
+
/**
|
|
2482
|
+
* CSS Functions
|
|
2483
|
+
* @see https://mol.hyoo.ru/#!section=docs/=xwq9q5_f966fg
|
|
2484
|
+
*/
|
|
2301
2485
|
class $mol_style_func extends $mol_decor {
|
|
2302
2486
|
name;
|
|
2303
2487
|
constructor(name, value) {
|
|
@@ -2392,6 +2576,7 @@ var $;
|
|
|
2392
2576
|
"use strict";
|
|
2393
2577
|
var $;
|
|
2394
2578
|
(function ($) {
|
|
2579
|
+
/** Create record of CSS variables. */
|
|
2395
2580
|
function $mol_style_prop(prefix, keys) {
|
|
2396
2581
|
const record = keys.reduce((rec, key) => {
|
|
2397
2582
|
rec[key] = $mol_style_func.vary(`--${prefix}_${key}`);
|
|
@@ -2406,6 +2591,10 @@ var $;
|
|
|
2406
2591
|
"use strict";
|
|
2407
2592
|
var $;
|
|
2408
2593
|
(function ($) {
|
|
2594
|
+
/**
|
|
2595
|
+
* Theme css variables
|
|
2596
|
+
* @see https://mol.hyoo.ru/#!section=demos/demo=mol_textarea_demo
|
|
2597
|
+
*/
|
|
2409
2598
|
$.$mol_theme = $mol_style_prop('mol_theme', [
|
|
2410
2599
|
'back',
|
|
2411
2600
|
'hover',
|
|
@@ -2434,11 +2623,18 @@ var $;
|
|
|
2434
2623
|
|
|
2435
2624
|
;
|
|
2436
2625
|
"use strict";
|
|
2626
|
+
// namespace $ {
|
|
2627
|
+
// $mol_style_attach( '$mol_theme_lights', `:root { --mol_theme_back: oklch( ${ $$.$mol_lights() ? 92 : 20 }% .01 var(--mol_theme_hue) ) }` )
|
|
2628
|
+
// }
|
|
2437
2629
|
|
|
2438
2630
|
;
|
|
2439
2631
|
"use strict";
|
|
2440
2632
|
var $;
|
|
2441
2633
|
(function ($) {
|
|
2634
|
+
/**
|
|
2635
|
+
* Gap in CSS
|
|
2636
|
+
* @see https://page.hyoo.ru/#!=msdb74_bm7nsq
|
|
2637
|
+
*/
|
|
2442
2638
|
$.$mol_gap = $mol_style_prop('mol_gap', [
|
|
2443
2639
|
'page',
|
|
2444
2640
|
'block',
|
|
@@ -2528,6 +2724,12 @@ var $;
|
|
|
2528
2724
|
createDocumentFragment: () => $mol_dom_context.document.createDocumentFragment(),
|
|
2529
2725
|
};
|
|
2530
2726
|
$.$mol_jsx_frag = '';
|
|
2727
|
+
/**
|
|
2728
|
+
* JSX adapter that makes DOM tree.
|
|
2729
|
+
* Generates global unique ids for every DOM-element by components tree with ids.
|
|
2730
|
+
* Ensures all local ids are unique.
|
|
2731
|
+
* Can reuse an existing nodes by GUIDs when used inside [`mol_jsx_attach`](https://github.com/hyoo-ru/mam_mol/tree/master/jsx/attach).
|
|
2732
|
+
*/
|
|
2531
2733
|
function $mol_jsx(Elem, props, ...childNodes) {
|
|
2532
2734
|
const id = props && props.id || '';
|
|
2533
2735
|
const guid = id ? $.$mol_jsx_prefix ? $.$mol_jsx_prefix + '/' + id : id : $.$mol_jsx_prefix;
|
|
@@ -2656,6 +2858,7 @@ var $;
|
|
|
2656
2858
|
var $;
|
|
2657
2859
|
(function ($) {
|
|
2658
2860
|
const TypedArray = Object.getPrototypeOf(Uint8Array);
|
|
2861
|
+
/** Returns string key for any value. */
|
|
2659
2862
|
function $mol_key(value) {
|
|
2660
2863
|
primitives: {
|
|
2661
2864
|
if (typeof value === 'bigint')
|
|
@@ -2663,9 +2866,9 @@ var $;
|
|
|
2663
2866
|
if (typeof value === 'symbol')
|
|
2664
2867
|
return `Symbol(${value.description})`;
|
|
2665
2868
|
if (!value)
|
|
2666
|
-
return JSON.stringify(value);
|
|
2869
|
+
return JSON.stringify(value); // 0, null, ""
|
|
2667
2870
|
if (typeof value !== 'object' && typeof value !== 'function')
|
|
2668
|
-
return JSON.stringify(value);
|
|
2871
|
+
return JSON.stringify(value); // boolean, number, string
|
|
2669
2872
|
}
|
|
2670
2873
|
caching: {
|
|
2671
2874
|
let key = $mol_key_store.get(value);
|
|
@@ -2742,6 +2945,9 @@ var $;
|
|
|
2742
2945
|
"use strict";
|
|
2743
2946
|
var $;
|
|
2744
2947
|
(function ($) {
|
|
2948
|
+
/**
|
|
2949
|
+
* Decorates method to fiber to ensure it is executed only once inside other fiber.
|
|
2950
|
+
*/
|
|
2745
2951
|
function $mol_wire_method(host, field, descr) {
|
|
2746
2952
|
if (!descr)
|
|
2747
2953
|
descr = Reflect.getOwnPropertyDescriptor(host, field);
|
|
@@ -2774,6 +2980,7 @@ var $;
|
|
|
2774
2980
|
"use strict";
|
|
2775
2981
|
var $;
|
|
2776
2982
|
(function ($) {
|
|
2983
|
+
/** Long-living fiber. */
|
|
2777
2984
|
class $mol_wire_atom extends $mol_wire_fiber {
|
|
2778
2985
|
static solo(host, task) {
|
|
2779
2986
|
const field = task.name + '()';
|
|
@@ -2824,7 +3031,11 @@ var $;
|
|
|
2824
3031
|
}
|
|
2825
3032
|
$mol_wire_atom.watching.add(this);
|
|
2826
3033
|
}
|
|
3034
|
+
/**
|
|
3035
|
+
* Update atom value through another temp fiber.
|
|
3036
|
+
*/
|
|
2827
3037
|
resync(args) {
|
|
3038
|
+
// enforce pulling tasks abort
|
|
2828
3039
|
for (let cursor = this.pub_from; cursor < this.sub_from; cursor += 2) {
|
|
2829
3040
|
const pub = this.data[cursor];
|
|
2830
3041
|
if (pub && pub instanceof $mol_wire_task) {
|
|
@@ -2885,7 +3096,7 @@ var $;
|
|
|
2885
3096
|
try {
|
|
2886
3097
|
next[Symbol.toStringTag] = this[Symbol.toStringTag];
|
|
2887
3098
|
}
|
|
2888
|
-
catch {
|
|
3099
|
+
catch { // Promises throw in strict mode
|
|
2889
3100
|
Object.defineProperty(next, Symbol.toStringTag, { value: this[Symbol.toStringTag] });
|
|
2890
3101
|
}
|
|
2891
3102
|
}
|
|
@@ -2913,6 +3124,7 @@ var $;
|
|
|
2913
3124
|
"use strict";
|
|
2914
3125
|
var $;
|
|
2915
3126
|
(function ($) {
|
|
3127
|
+
/** Decorates solo object channel to [mol_wire_atom](../atom/atom.ts). */
|
|
2916
3128
|
function $mol_wire_solo(host, field, descr) {
|
|
2917
3129
|
if (!descr)
|
|
2918
3130
|
descr = Reflect.getOwnPropertyDescriptor(host, field);
|
|
@@ -2951,6 +3163,7 @@ var $;
|
|
|
2951
3163
|
"use strict";
|
|
2952
3164
|
var $;
|
|
2953
3165
|
(function ($) {
|
|
3166
|
+
/** Reactive memoizing multiplexed property decorator. */
|
|
2954
3167
|
function $mol_wire_plex(host, field, descr) {
|
|
2955
3168
|
if (!descr)
|
|
2956
3169
|
descr = Reflect.getOwnPropertyDescriptor(host, field);
|
|
@@ -2989,7 +3202,25 @@ var $;
|
|
|
2989
3202
|
"use strict";
|
|
2990
3203
|
var $;
|
|
2991
3204
|
(function ($) {
|
|
3205
|
+
/**
|
|
3206
|
+
* Reactive memoizing solo property decorator from [mol_wire](../wire/README.md)
|
|
3207
|
+
* @example
|
|
3208
|
+
* '@' $mol_mem
|
|
3209
|
+
* name(next?: string) {
|
|
3210
|
+
* return next ?? 'default'
|
|
3211
|
+
* }
|
|
3212
|
+
* @see https://mol.hyoo.ru/#!section=docs/=qxmh6t_sinbmb
|
|
3213
|
+
*/
|
|
2992
3214
|
$.$mol_mem = $mol_wire_solo;
|
|
3215
|
+
/**
|
|
3216
|
+
* Reactive memoizing multiplexed property decorator [mol_wire](../wire/README.md)
|
|
3217
|
+
* @example
|
|
3218
|
+
* '@' $mol_mem_key
|
|
3219
|
+
* name(id: number, next?: string) {
|
|
3220
|
+
* return next ?? 'default'
|
|
3221
|
+
* }
|
|
3222
|
+
* @see https://mol.hyoo.ru/#!section=docs/=qxmh6t_sinbmb
|
|
3223
|
+
*/
|
|
2993
3224
|
$.$mol_mem_key = $mol_wire_plex;
|
|
2994
3225
|
})($ || ($ = {}));
|
|
2995
3226
|
|
|
@@ -3113,6 +3344,7 @@ var $;
|
|
|
3113
3344
|
"use strict";
|
|
3114
3345
|
var $;
|
|
3115
3346
|
(function ($) {
|
|
3347
|
+
/** Run code without state changes */
|
|
3116
3348
|
function $mol_wire_probe(task, def) {
|
|
3117
3349
|
const warm = $mol_wire_fiber.warm;
|
|
3118
3350
|
try {
|
|
@@ -3133,6 +3365,10 @@ var $;
|
|
|
3133
3365
|
"use strict";
|
|
3134
3366
|
var $;
|
|
3135
3367
|
(function ($) {
|
|
3368
|
+
/**
|
|
3369
|
+
* Real-time refresh current atom.
|
|
3370
|
+
* Don't use if possible. May reduce performance.
|
|
3371
|
+
*/
|
|
3136
3372
|
function $mol_wire_watch() {
|
|
3137
3373
|
const atom = $mol_wire_auto();
|
|
3138
3374
|
if (atom instanceof $mol_wire_atom) {
|
|
@@ -3149,6 +3385,11 @@ var $;
|
|
|
3149
3385
|
"use strict";
|
|
3150
3386
|
var $;
|
|
3151
3387
|
(function ($) {
|
|
3388
|
+
/**
|
|
3389
|
+
* Returns closure that returns constant value.
|
|
3390
|
+
* @example
|
|
3391
|
+
* const rnd = $mol_const( Math.random() )
|
|
3392
|
+
*/
|
|
3152
3393
|
function $mol_const(value) {
|
|
3153
3394
|
const getter = (() => value);
|
|
3154
3395
|
getter['()'] = value;
|
|
@@ -3163,6 +3404,9 @@ var $;
|
|
|
3163
3404
|
"use strict";
|
|
3164
3405
|
var $;
|
|
3165
3406
|
(function ($) {
|
|
3407
|
+
/**
|
|
3408
|
+
* Disable reaping of current subscriber
|
|
3409
|
+
*/
|
|
3166
3410
|
function $mol_wire_solid() {
|
|
3167
3411
|
let current = $mol_wire_auto();
|
|
3168
3412
|
if (current.temp)
|
|
@@ -3266,6 +3510,7 @@ var $;
|
|
|
3266
3510
|
"use strict";
|
|
3267
3511
|
var $;
|
|
3268
3512
|
(function ($) {
|
|
3513
|
+
/** Convert a pseudo-synchronous (Suspense API) API to an explicit asynchronous one (for integrating with external systems). */
|
|
3269
3514
|
function $mol_wire_async(obj) {
|
|
3270
3515
|
let fiber;
|
|
3271
3516
|
const temp = $mol_wire_task.getter(obj);
|
|
@@ -3307,6 +3552,7 @@ var $;
|
|
|
3307
3552
|
|
|
3308
3553
|
;
|
|
3309
3554
|
"use strict";
|
|
3555
|
+
/** @jsx $mol_jsx */
|
|
3310
3556
|
var $;
|
|
3311
3557
|
(function ($) {
|
|
3312
3558
|
function $mol_view_visible_width() {
|
|
@@ -3321,6 +3567,11 @@ var $;
|
|
|
3321
3567
|
return suffix;
|
|
3322
3568
|
}
|
|
3323
3569
|
$.$mol_view_state_key = $mol_view_state_key;
|
|
3570
|
+
/**
|
|
3571
|
+
* The base class for all visual components. It provides the infrastructure for reactive lazy rendering, handling exceptions.
|
|
3572
|
+
* @see https://mol.hyoo.ru/#!section=docs/=vv2nig_s5zr0f
|
|
3573
|
+
*/
|
|
3574
|
+
/// Reactive statefull lazy ViewModel
|
|
3324
3575
|
class $mol_view extends $mol_object {
|
|
3325
3576
|
static Root(id) {
|
|
3326
3577
|
return new this;
|
|
@@ -3385,16 +3636,22 @@ var $;
|
|
|
3385
3636
|
state_key(suffix = '') {
|
|
3386
3637
|
return this.$.$mol_view_state_key(suffix);
|
|
3387
3638
|
}
|
|
3639
|
+
/// Name of element that created when element not found in DOM
|
|
3388
3640
|
dom_name() {
|
|
3389
3641
|
return $mol_dom_qname(this.constructor.toString()) || 'div';
|
|
3390
3642
|
}
|
|
3643
|
+
/// NameSpace of element that created when element not found in DOM
|
|
3391
3644
|
dom_name_space() { return 'http://www.w3.org/1999/xhtml'; }
|
|
3645
|
+
/// Raw child views
|
|
3392
3646
|
sub() {
|
|
3393
3647
|
return [];
|
|
3394
3648
|
}
|
|
3649
|
+
/// Visible sub views with defined ambient context
|
|
3650
|
+
/// Render all by default
|
|
3395
3651
|
sub_visible() {
|
|
3396
3652
|
return this.sub();
|
|
3397
3653
|
}
|
|
3654
|
+
/// Minimal width that used for lazy rendering
|
|
3398
3655
|
minimal_width() {
|
|
3399
3656
|
let min = 0;
|
|
3400
3657
|
try {
|
|
@@ -3416,6 +3673,7 @@ var $;
|
|
|
3416
3673
|
maximal_width() {
|
|
3417
3674
|
return this.minimal_width();
|
|
3418
3675
|
}
|
|
3676
|
+
/// Minimal height that used for lazy rendering
|
|
3419
3677
|
minimal_height() {
|
|
3420
3678
|
let min = 0;
|
|
3421
3679
|
try {
|
|
@@ -3435,11 +3693,11 @@ var $;
|
|
|
3435
3693
|
view_rect() {
|
|
3436
3694
|
if ($mol_wire_probe(() => this.view_rect()) === undefined) {
|
|
3437
3695
|
$mol_wire_watch();
|
|
3438
|
-
return null;
|
|
3696
|
+
return null; // don't touch DOM to prevent instant reflow
|
|
3439
3697
|
}
|
|
3440
3698
|
else {
|
|
3441
3699
|
const { width, height, left, right, top, bottom } = this.dom_node().getBoundingClientRect();
|
|
3442
|
-
return { width, height, left, right, top, bottom };
|
|
3700
|
+
return { width, height, left, right, top, bottom }; // pick to optimize compare
|
|
3443
3701
|
}
|
|
3444
3702
|
}
|
|
3445
3703
|
dom_id() {
|
|
@@ -3629,6 +3887,7 @@ var $;
|
|
|
3629
3887
|
[$mol_dev_format_head]() {
|
|
3630
3888
|
return $mol_dev_format_span({}, $mol_dev_format_native(this));
|
|
3631
3889
|
}
|
|
3890
|
+
/** Deep search view by predicate. */
|
|
3632
3891
|
*view_find(check, path = []) {
|
|
3633
3892
|
if (path.length === 0 && check(this))
|
|
3634
3893
|
return yield [this];
|
|
@@ -3657,6 +3916,7 @@ var $;
|
|
|
3657
3916
|
$mol_fail_log(error);
|
|
3658
3917
|
}
|
|
3659
3918
|
}
|
|
3919
|
+
/** Renders path of views to DOM. */
|
|
3660
3920
|
force_render(path) {
|
|
3661
3921
|
const kids = this.sub();
|
|
3662
3922
|
const index = kids.findIndex(item => {
|
|
@@ -3671,6 +3931,7 @@ var $;
|
|
|
3671
3931
|
kids[index].force_render(path);
|
|
3672
3932
|
}
|
|
3673
3933
|
}
|
|
3934
|
+
/** Renders view to DOM and scroll to it. */
|
|
3674
3935
|
ensure_visible(view, align = "start") {
|
|
3675
3936
|
const path = this.view_find(v => v === view).next().value;
|
|
3676
3937
|
this.force_render(new Set(path));
|
|
@@ -3685,6 +3946,9 @@ var $;
|
|
|
3685
3946
|
const win = this.$.$mol_dom_context;
|
|
3686
3947
|
if (win.parent !== win.self && !win.document.hasFocus())
|
|
3687
3948
|
return;
|
|
3949
|
+
// new this.$.$mol_after_frame( ()=> {
|
|
3950
|
+
// this.dom_node().scrollIntoView({ block: 'start', inline: 'nearest' })
|
|
3951
|
+
// } )
|
|
3688
3952
|
new this.$.$mol_after_timeout(0, () => {
|
|
3689
3953
|
this.focused(true);
|
|
3690
3954
|
});
|
|
@@ -3765,6 +4029,7 @@ var $;
|
|
|
3765
4029
|
"use strict";
|
|
3766
4030
|
var $;
|
|
3767
4031
|
(function ($) {
|
|
4032
|
+
/** Plugin is component without its own DOM element, but instead uses the owner DOM element */
|
|
3768
4033
|
class $mol_plugin extends $mol_view {
|
|
3769
4034
|
dom_node_external(next) {
|
|
3770
4035
|
return next ?? $mol_owning_get(this).host.dom_node();
|
|
@@ -3800,6 +4065,7 @@ var $;
|
|
|
3800
4065
|
"use strict";
|
|
3801
4066
|
var $;
|
|
3802
4067
|
(function ($) {
|
|
4068
|
+
/** State of time moment */
|
|
3803
4069
|
class $mol_state_time extends $mol_object {
|
|
3804
4070
|
static task(precision, reset) {
|
|
3805
4071
|
if (precision) {
|
|
@@ -3826,12 +4092,14 @@ var $;
|
|
|
3826
4092
|
;
|
|
3827
4093
|
"use strict";
|
|
3828
4094
|
|
|
4095
|
+
|
|
3829
4096
|
;
|
|
3830
4097
|
"use strict";
|
|
3831
4098
|
var $;
|
|
3832
4099
|
(function ($) {
|
|
3833
4100
|
var $$;
|
|
3834
4101
|
(function ($$) {
|
|
4102
|
+
/** Base SVG component to display SVG images or icons. */
|
|
3835
4103
|
class $mol_svg extends $.$mol_svg {
|
|
3836
4104
|
computed_style() {
|
|
3837
4105
|
const win = this.$.$mol_dom_context;
|
|
@@ -3891,6 +4159,7 @@ var $;
|
|
|
3891
4159
|
;
|
|
3892
4160
|
"use strict";
|
|
3893
4161
|
|
|
4162
|
+
|
|
3894
4163
|
;
|
|
3895
4164
|
"use strict";
|
|
3896
4165
|
var $;
|
|
@@ -4200,12 +4469,17 @@ var $;
|
|
|
4200
4469
|
;
|
|
4201
4470
|
"use strict";
|
|
4202
4471
|
|
|
4472
|
+
|
|
4203
4473
|
;
|
|
4204
4474
|
"use strict";
|
|
4205
4475
|
var $;
|
|
4206
4476
|
(function ($) {
|
|
4207
4477
|
var $$;
|
|
4208
4478
|
(function ($$) {
|
|
4479
|
+
/**
|
|
4480
|
+
* Plugin for touch gestures.
|
|
4481
|
+
* @see [mol_plugin](../plugin/readme.md)
|
|
4482
|
+
*/
|
|
4209
4483
|
class $mol_touch extends $.$mol_touch {
|
|
4210
4484
|
auto() {
|
|
4211
4485
|
this.pointer_events();
|
|
@@ -4689,6 +4963,7 @@ var $;
|
|
|
4689
4963
|
;
|
|
4690
4964
|
"use strict";
|
|
4691
4965
|
|
|
4966
|
+
|
|
4692
4967
|
;
|
|
4693
4968
|
($.$mol_svg_title) = class $mol_svg_title extends ($.$mol_svg) {
|
|
4694
4969
|
dom_name(){
|
|
@@ -4703,6 +4978,7 @@ var $;
|
|
|
4703
4978
|
;
|
|
4704
4979
|
"use strict";
|
|
4705
4980
|
|
|
4981
|
+
|
|
4706
4982
|
;
|
|
4707
4983
|
($.$mol_plot_graph) = class $mol_plot_graph extends ($.$mol_svg_group) {
|
|
4708
4984
|
type(){
|
|
@@ -4857,6 +5133,7 @@ var $;
|
|
|
4857
5133
|
;
|
|
4858
5134
|
"use strict";
|
|
4859
5135
|
|
|
5136
|
+
|
|
4860
5137
|
;
|
|
4861
5138
|
"use strict";
|
|
4862
5139
|
var $;
|
|
@@ -4940,12 +5217,17 @@ var $;
|
|
|
4940
5217
|
;
|
|
4941
5218
|
"use strict";
|
|
4942
5219
|
|
|
5220
|
+
|
|
4943
5221
|
;
|
|
4944
5222
|
"use strict";
|
|
4945
5223
|
var $;
|
|
4946
5224
|
(function ($) {
|
|
4947
5225
|
var $$;
|
|
4948
5226
|
(function ($$) {
|
|
5227
|
+
/**
|
|
5228
|
+
* Fastest plot lib for vector graphics.
|
|
5229
|
+
* @see https://mol.hyoo.ru/#!section=demos/demo=mol_plot_demo
|
|
5230
|
+
*/
|
|
4949
5231
|
class $mol_plot_pane extends $.$mol_plot_pane {
|
|
4950
5232
|
dimensions() {
|
|
4951
5233
|
const graphs = this.graphs();
|
|
@@ -5185,6 +5467,7 @@ var $;
|
|
|
5185
5467
|
;
|
|
5186
5468
|
"use strict";
|
|
5187
5469
|
|
|
5470
|
+
|
|
5188
5471
|
;
|
|
5189
5472
|
"use strict";
|
|
5190
5473
|
var $;
|
|
@@ -5277,6 +5560,7 @@ var $;
|
|
|
5277
5560
|
;
|
|
5278
5561
|
"use strict";
|
|
5279
5562
|
|
|
5563
|
+
|
|
5280
5564
|
;
|
|
5281
5565
|
"use strict";
|
|
5282
5566
|
var $;
|
|
@@ -5359,6 +5643,7 @@ var $;
|
|
|
5359
5643
|
;
|
|
5360
5644
|
"use strict";
|
|
5361
5645
|
|
|
5646
|
+
|
|
5362
5647
|
;
|
|
5363
5648
|
($.$mol_plot_dot) = class $mol_plot_dot extends ($.$mol_plot_graph) {
|
|
5364
5649
|
diameter(){
|
|
@@ -5398,6 +5683,7 @@ var $;
|
|
|
5398
5683
|
"use strict";
|
|
5399
5684
|
var $;
|
|
5400
5685
|
(function ($) {
|
|
5686
|
+
// 00 HHHHH HHHHH HHHHH LLLLL LLLLL LLLLL
|
|
5401
5687
|
const mask = 0b11111_11111_11111;
|
|
5402
5688
|
function $mol_coord_pack(high, low) {
|
|
5403
5689
|
return (high << 17 >>> 2) | (low & mask);
|
|
@@ -5416,6 +5702,7 @@ var $;
|
|
|
5416
5702
|
;
|
|
5417
5703
|
"use strict";
|
|
5418
5704
|
|
|
5705
|
+
|
|
5419
5706
|
;
|
|
5420
5707
|
"use strict";
|
|
5421
5708
|
var $;
|
|
@@ -5428,6 +5715,7 @@ var $;
|
|
|
5428
5715
|
}
|
|
5429
5716
|
indexes() {
|
|
5430
5717
|
const radius = this.diameter() / 2;
|
|
5718
|
+
// calculate by cpu
|
|
5431
5719
|
const points_max = this.points_max();
|
|
5432
5720
|
const viewport = this.viewport();
|
|
5433
5721
|
const viewport_left = viewport.x.min - radius;
|
|
@@ -5564,12 +5852,17 @@ var $;
|
|
|
5564
5852
|
;
|
|
5565
5853
|
"use strict";
|
|
5566
5854
|
|
|
5855
|
+
|
|
5567
5856
|
;
|
|
5568
5857
|
"use strict";
|
|
5569
5858
|
var $;
|
|
5570
5859
|
(function ($) {
|
|
5571
5860
|
var $$;
|
|
5572
5861
|
(function ($$) {
|
|
5862
|
+
/**
|
|
5863
|
+
* Heat map graph.
|
|
5864
|
+
* @see https://mol.hyoo.ru/#!section=demos/demo=mol_plot_map_heat_demo
|
|
5865
|
+
*/
|
|
5573
5866
|
class $mol_plot_map_heat extends $.$mol_plot_map_heat {
|
|
5574
5867
|
levels() {
|
|
5575
5868
|
return [...new Set(this.series_z())].sort((a, b) => a - b);
|
|
@@ -5666,6 +5959,7 @@ var $;
|
|
|
5666
5959
|
;
|
|
5667
5960
|
"use strict";
|
|
5668
5961
|
|
|
5962
|
+
|
|
5669
5963
|
;
|
|
5670
5964
|
"use strict";
|
|
5671
5965
|
var $;
|
|
@@ -5768,6 +6062,7 @@ var $;
|
|
|
5768
6062
|
;
|
|
5769
6063
|
"use strict";
|
|
5770
6064
|
|
|
6065
|
+
|
|
5771
6066
|
;
|
|
5772
6067
|
"use strict";
|
|
5773
6068
|
var $;
|
|
@@ -5836,6 +6131,7 @@ var $;
|
|
|
5836
6131
|
;
|
|
5837
6132
|
"use strict";
|
|
5838
6133
|
|
|
6134
|
+
|
|
5839
6135
|
;
|
|
5840
6136
|
"use strict";
|
|
5841
6137
|
var $;
|
|
@@ -5898,6 +6194,7 @@ var $;
|
|
|
5898
6194
|
;
|
|
5899
6195
|
"use strict";
|
|
5900
6196
|
|
|
6197
|
+
|
|
5901
6198
|
;
|
|
5902
6199
|
"use strict";
|
|
5903
6200
|
var $;
|
|
@@ -6063,6 +6360,7 @@ var $;
|
|
|
6063
6360
|
;
|
|
6064
6361
|
"use strict";
|
|
6065
6362
|
|
|
6363
|
+
|
|
6066
6364
|
;
|
|
6067
6365
|
"use strict";
|
|
6068
6366
|
var $;
|
|
@@ -6132,6 +6430,7 @@ var $;
|
|
|
6132
6430
|
}
|
|
6133
6431
|
front() {
|
|
6134
6432
|
return [
|
|
6433
|
+
// this.Background(),
|
|
6135
6434
|
...this.labels_formatted(),
|
|
6136
6435
|
this.Title()
|
|
6137
6436
|
];
|
|
@@ -6183,6 +6482,7 @@ var $;
|
|
|
6183
6482
|
;
|
|
6184
6483
|
"use strict";
|
|
6185
6484
|
|
|
6485
|
+
|
|
6186
6486
|
;
|
|
6187
6487
|
"use strict";
|
|
6188
6488
|
var $;
|
|
@@ -6258,6 +6558,7 @@ var $;
|
|
|
6258
6558
|
;
|
|
6259
6559
|
"use strict";
|
|
6260
6560
|
|
|
6561
|
+
|
|
6261
6562
|
;
|
|
6262
6563
|
"use strict";
|
|
6263
6564
|
var $;
|
|
@@ -6395,6 +6696,7 @@ var $;
|
|
|
6395
6696
|
;
|
|
6396
6697
|
"use strict";
|
|
6397
6698
|
|
|
6699
|
+
|
|
6398
6700
|
;
|
|
6399
6701
|
"use strict";
|
|
6400
6702
|
var $;
|
|
@@ -6522,6 +6824,7 @@ var $;
|
|
|
6522
6824
|
;
|
|
6523
6825
|
"use strict";
|
|
6524
6826
|
|
|
6827
|
+
|
|
6525
6828
|
;
|
|
6526
6829
|
"use strict";
|
|
6527
6830
|
var $;
|
|
@@ -6634,6 +6937,7 @@ var $;
|
|
|
6634
6937
|
;
|
|
6635
6938
|
"use strict";
|
|
6636
6939
|
|
|
6940
|
+
|
|
6637
6941
|
;
|
|
6638
6942
|
"use strict";
|
|
6639
6943
|
var $;
|