mol_plot_all 1.2.1705 → 1.2.1707

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.test.js CHANGED
@@ -32,7 +32,7 @@ var $;
32
32
  "use strict";
33
33
  var $;
34
34
  (function ($) {
35
- const mod = require('module');
35
+ const mod = require /****/('module');
36
36
  const internals = mod.builtinModules;
37
37
  function $node_internal_check(name) {
38
38
  if (name.startsWith('node:'))
@@ -72,7 +72,7 @@ var $;
72
72
  var $;
73
73
  (function ($) {
74
74
  function $mol_fail_hidden(error) {
75
- throw error;
75
+ throw error; /// Use 'Never Pause Here' breakpoint in DevTools or simply blackbox this script
76
76
  }
77
77
  $.$mol_fail_hidden = $mol_fail_hidden;
78
78
  })($ || ($ = {}));
@@ -130,8 +130,8 @@ var $;
130
130
  "use strict";
131
131
  var $;
132
132
  (function ($) {
133
- const path = require('path');
134
- const mod = require('module');
133
+ const path = require /****/('path');
134
+ const mod = require /****/('module');
135
135
  const localRequire = mod.createRequire(path.join(process.cwd(), 'package.json'));
136
136
  function $node_autoinstall(name) {
137
137
  try {
@@ -238,6 +238,7 @@ var $;
238
238
  ])
239
239
  ].map(frame_normalize).join('\n')
240
240
  });
241
+ // в nodejs, что б не дублировалось cause в консоли
241
242
  Object.defineProperty(this, 'cause', {
242
243
  get: () => cause
243
244
  });
@@ -271,6 +272,11 @@ var $;
271
272
  var $;
272
273
  (function ($) {
273
274
  const instances = new WeakSet();
275
+ /**
276
+ * Proxy that delegates all to lazy returned target.
277
+ *
278
+ * $mol_delegate( Array.prototype , ()=> fetch_array() )
279
+ */
274
280
  function $mol_delegate(proto, target) {
275
281
  const proxy = new Proxy(proto, {
276
282
  get: (_, field) => {
@@ -414,6 +420,9 @@ var $;
414
420
  [Symbol.dispose]() {
415
421
  this.destructor();
416
422
  }
423
+ //[ Symbol.toPrimitive ]( hint: string ) {
424
+ // return hint === 'number' ? this.valueOf() : this.toString()
425
+ //}
417
426
  toString() {
418
427
  return this[Symbol.toStringTag] || this.constructor.name + '<>';
419
428
  }
@@ -464,6 +473,7 @@ var $;
464
473
  "use strict";
465
474
  var $;
466
475
  (function ($) {
476
+ /** Generates unique identifier. */
467
477
  function $mol_guid(length = 8, exists = () => false) {
468
478
  for (;;) {
469
479
  let id = Math.random().toString(36).substring(2, length + 2).toUpperCase();
@@ -479,11 +489,16 @@ var $;
479
489
  "use strict";
480
490
  var $;
481
491
  (function ($) {
492
+ /** Special status statuses. */
482
493
  let $mol_wire_cursor;
483
494
  (function ($mol_wire_cursor) {
495
+ /** Update required. */
484
496
  $mol_wire_cursor[$mol_wire_cursor["stale"] = -1] = "stale";
497
+ /** Some of (transitive) pub update required. */
485
498
  $mol_wire_cursor[$mol_wire_cursor["doubt"] = -2] = "doubt";
499
+ /** Actual state but may be dropped. */
486
500
  $mol_wire_cursor[$mol_wire_cursor["fresh"] = -3] = "fresh";
501
+ /** State will never be changed. */
487
502
  $mol_wire_cursor[$mol_wire_cursor["final"] = -4] = "final";
488
503
  })($mol_wire_cursor = $.$mol_wire_cursor || ($.$mol_wire_cursor = {}));
489
504
  })($ || ($ = {}));
@@ -492,6 +507,9 @@ var $;
492
507
  "use strict";
493
508
  var $;
494
509
  (function ($) {
510
+ /**
511
+ * Collects subscribers in compact array. 28B
512
+ */
495
513
  class $mol_wire_pub extends Object {
496
514
  constructor(id = `$mol_wire_pub:${$mol_guid()}`) {
497
515
  super();
@@ -499,10 +517,17 @@ var $;
499
517
  }
500
518
  [Symbol.toStringTag];
501
519
  data = [];
520
+ // Derived objects should be Arrays.
502
521
  static get [Symbol.species]() {
503
522
  return Array;
504
523
  }
505
- sub_from = 0;
524
+ /**
525
+ * Index of first subscriber.
526
+ */
527
+ sub_from = 0; // 4B
528
+ /**
529
+ * All current subscribers.
530
+ */
506
531
  get sub_list() {
507
532
  const res = [];
508
533
  for (let i = this.sub_from; i < this.data.length; i += 2) {
@@ -510,14 +535,23 @@ var $;
510
535
  }
511
536
  return res;
512
537
  }
538
+ /**
539
+ * Has any subscribers or not.
540
+ */
513
541
  get sub_empty() {
514
542
  return this.sub_from === this.data.length;
515
543
  }
544
+ /**
545
+ * Subscribe subscriber to this publisher events and return position of subscriber that required to unsubscribe.
546
+ */
516
547
  sub_on(sub, pub_pos) {
517
548
  const pos = this.data.length;
518
549
  this.data.push(sub, pub_pos);
519
550
  return pos;
520
551
  }
552
+ /**
553
+ * Unsubscribe subscriber from this publisher events by subscriber position provided by `on(pub)`.
554
+ */
521
555
  sub_off(sub_pos) {
522
556
  if (!(sub_pos < this.data.length)) {
523
557
  $mol_fail(new Error(`Wrong pos ${sub_pos}`));
@@ -530,21 +564,39 @@ var $;
530
564
  if (end === this.sub_from)
531
565
  this.reap();
532
566
  }
567
+ /**
568
+ * Called when last sub was unsubscribed.
569
+ **/
533
570
  reap() { }
571
+ /**
572
+ * Autowire this publisher with current subscriber.
573
+ **/
534
574
  promote() {
535
575
  $mol_wire_auto()?.track_next(this);
536
576
  }
577
+ /**
578
+ * Enforce actualization. Should not throw errors.
579
+ */
537
580
  fresh() { }
581
+ /**
582
+ * Allow to put data to caches in the subtree.
583
+ */
538
584
  complete() { }
539
585
  get incompleted() {
540
586
  return false;
541
587
  }
588
+ /**
589
+ * Notify subscribers about self changes.
590
+ */
542
591
  emit(quant = $mol_wire_cursor.stale) {
543
592
  for (let i = this.sub_from; i < this.data.length; i += 2) {
544
593
  ;
545
594
  this.data[i].absorb(quant, this.data[i + 1]);
546
595
  }
547
596
  }
597
+ /**
598
+ * Moves peer from one position to another. Doesn't clear data at old position!
599
+ */
548
600
  peer_move(from_pos, to_pos) {
549
601
  const peer = this.data[from_pos];
550
602
  const self_pos = this.data[from_pos + 1];
@@ -552,6 +604,9 @@ var $;
552
604
  this.data[to_pos + 1] = self_pos;
553
605
  peer.peer_repos(self_pos, to_pos);
554
606
  }
607
+ /**
608
+ * Updates self position in the peer.
609
+ */
555
610
  peer_repos(peer_pos, self_pos) {
556
611
  this.data[peer_pos + 1] = self_pos;
557
612
  }
@@ -567,10 +622,16 @@ var $;
567
622
  var $;
568
623
  (function ($) {
569
624
  $.$mol_wire_auto_sub = null;
625
+ /**
626
+ * When fulfilled, all publishers are promoted to this subscriber on access to its.
627
+ */
570
628
  function $mol_wire_auto(next = $.$mol_wire_auto_sub) {
571
629
  return $.$mol_wire_auto_sub = next;
572
630
  }
573
631
  $.$mol_wire_auto = $mol_wire_auto;
632
+ /**
633
+ * Affection queue. Used to prevent accidental stack overflow on emit.
634
+ */
574
635
  $.$mol_wire_affected = [];
575
636
  })($ || ($ = {}));
576
637
 
@@ -578,6 +639,7 @@ var $;
578
639
  "use strict";
579
640
  var $;
580
641
  (function ($) {
642
+ // https://docs.google.com/document/d/1FTascZXT9cxfetuPRT2eXPQKXui4nWFivUnS_335T3U/preview#
581
643
  $['devtoolsFormatters'] ||= [];
582
644
  function $mol_dev_format_register(config) {
583
645
  $['devtoolsFormatters'].push(config);
@@ -629,6 +691,7 @@ var $;
629
691
  return false;
630
692
  if (!val)
631
693
  return false;
694
+ // if( Error.isError( val ) ) true
632
695
  if (val[$.$mol_dev_format_body])
633
696
  return true;
634
697
  return false;
@@ -646,12 +709,16 @@ var $;
646
709
  return $.$mol_dev_format_accent($mol_dev_format_native(val), '💨', $mol_dev_format_native(error), '');
647
710
  }
648
711
  }
712
+ // if( Error.isError( val ) ) {
713
+ // return $mol_dev_format_native( val )
714
+ // }
649
715
  return null;
650
716
  },
651
717
  });
652
718
  function $mol_dev_format_native(obj) {
653
719
  if (typeof obj === 'undefined')
654
720
  return $.$mol_dev_format_shade('undefined');
721
+ // if( ![ 'object', 'function', 'symbol' ].includes( typeof obj ) ) return obj
655
722
  return [
656
723
  'object',
657
724
  {
@@ -709,6 +776,9 @@ var $;
709
776
  'margin-left': '13px'
710
777
  });
711
778
  class Stack extends Array {
779
+ // [ Symbol.toPrimitive ]() {
780
+ // return this.toString()
781
+ // }
712
782
  toString() {
713
783
  return this.join('\n');
714
784
  }
@@ -731,6 +801,7 @@ var $;
731
801
  this.method = call.getMethodName() ?? '';
732
802
  if (this.method === this.function)
733
803
  this.method = '';
804
+ // const func = c.getFunction()
734
805
  this.pos = [call.getEnclosingLineNumber() ?? 0, call.getEnclosingColumnNumber() ?? 0];
735
806
  this.eval = call.getEvalOrigin() ?? '';
736
807
  this.source = call.getScriptNameOrSourceURL() ?? '';
@@ -777,9 +848,16 @@ var $;
777
848
  "use strict";
778
849
  var $;
779
850
  (function ($) {
851
+ /**
852
+ * Publisher that can auto collect other publishers. 32B
853
+ *
854
+ * P1 P2 P3 P4 S1 S2 S3
855
+ * ^ ^
856
+ * pubs_from subs_from
857
+ */
780
858
  class $mol_wire_pub_sub extends $mol_wire_pub {
781
- pub_from = 0;
782
- cursor = $mol_wire_cursor.stale;
859
+ pub_from = 0; // 4B
860
+ cursor = $mol_wire_cursor.stale; // 4B
783
861
  get temp() {
784
862
  return false;
785
863
  }
@@ -897,10 +975,27 @@ var $;
897
975
  return;
898
976
  this.cursor = quant;
899
977
  this.emit($mol_wire_cursor.doubt);
978
+ // if( pos >= 0 && pos < this.sub_from - 2 ) {
979
+ // const pub = this.data[ pos ] as $mol_wire_pub
980
+ // if( pub instanceof $mol_wire_task ) return
981
+ // for(
982
+ // let cursor = this.pub_from;
983
+ // cursor < this.sub_from;
984
+ // cursor += 2
985
+ // ) {
986
+ // const pub = this.data[ cursor ] as $mol_wire_pub
987
+ // if( pub instanceof $mol_wire_task ) {
988
+ // pub.destructor()
989
+ // }
990
+ // }
991
+ // }
900
992
  }
901
993
  [$mol_dev_format_head]() {
902
994
  return $mol_dev_format_native(this);
903
995
  }
996
+ /**
997
+ * Is subscribed to any publisher or not.
998
+ */
904
999
  get pub_empty() {
905
1000
  return this.sub_from === this.pub_from;
906
1001
  }
@@ -941,6 +1036,13 @@ var $;
941
1036
  var $;
942
1037
  (function ($) {
943
1038
  const wrappers = new WeakMap();
1039
+ /**
1040
+ * Suspendable task with support both sync/async api.
1041
+ *
1042
+ * A1 A2 A3 A4 P1 P2 P3 P4 S1 S2 S3
1043
+ * ^ ^ ^
1044
+ * args_from pubs_from subs_from
1045
+ **/
944
1046
  class $mol_wire_fiber extends $mol_wire_pub_sub {
945
1047
  task;
946
1048
  host;
@@ -961,6 +1063,7 @@ var $;
961
1063
  });
962
1064
  }
963
1065
  static sync() {
1066
+ // Sync whole fiber graph
964
1067
  while (this.planning.size) {
965
1068
  for (const fiber of this.planning) {
966
1069
  this.planning.delete(fiber);
@@ -971,6 +1074,7 @@ var $;
971
1074
  fiber.fresh();
972
1075
  }
973
1076
  }
1077
+ // Collect garbage
974
1078
  while (this.reaping.size) {
975
1079
  const fibers = this.reaping;
976
1080
  this.reaping = new Set;
@@ -1122,6 +1226,10 @@ var $;
1122
1226
  this.cursor = $mol_wire_cursor.stale;
1123
1227
  this.fresh();
1124
1228
  }
1229
+ /**
1230
+ * Synchronous execution. Throws Promise when waits async task (SuspenseAPI provider).
1231
+ * Should be called inside SuspenseAPI consumer (ie fiber).
1232
+ */
1125
1233
  sync() {
1126
1234
  if (!$mol_wire_fiber.warm) {
1127
1235
  return this.result();
@@ -1136,6 +1244,10 @@ var $;
1136
1244
  }
1137
1245
  return this.cache;
1138
1246
  }
1247
+ /**
1248
+ * Asynchronous execution.
1249
+ * It's SuspenseAPI consumer. So SuspenseAPI providers can be called inside.
1250
+ */
1139
1251
  async async_raw() {
1140
1252
  while (true) {
1141
1253
  this.fresh();
@@ -1148,6 +1260,7 @@ var $;
1148
1260
  if (!$mol_promise_like(this.cache))
1149
1261
  return this.cache;
1150
1262
  if (this.cursor === $mol_wire_cursor.final) {
1263
+ // never ends on destructed fiber
1151
1264
  await new Promise(() => { });
1152
1265
  }
1153
1266
  }
@@ -1195,6 +1308,10 @@ var $;
1195
1308
  var $;
1196
1309
  (function ($) {
1197
1310
  $.$mol_compare_deep_cache = new WeakMap();
1311
+ /**
1312
+ * Deeply compares two values. Returns true if equal.
1313
+ * Define `Symbol.toPrimitive` to customize.
1314
+ */
1198
1315
  function $mol_compare_deep(left, right) {
1199
1316
  if (Object.is(left, right))
1200
1317
  return true;
@@ -1334,6 +1451,7 @@ var $;
1334
1451
  "use strict";
1335
1452
  var $;
1336
1453
  (function ($) {
1454
+ /** Log begin of collapsed group only when some logged inside, returns func to close group */
1337
1455
  function $mol_log3_area_lazy(event) {
1338
1456
  const self = this.$;
1339
1457
  const stack = self.$mol_log3_stack;
@@ -1358,6 +1476,7 @@ var $;
1358
1476
  "use strict";
1359
1477
  var $;
1360
1478
  (function ($) {
1479
+ /** Position in any resource. */
1361
1480
  class $mol_span extends $mol_object2 {
1362
1481
  uri;
1363
1482
  source;
@@ -1373,13 +1492,17 @@ var $;
1373
1492
  this.length = length;
1374
1493
  this[Symbol.toStringTag] = this.uri + ('#' + this.row + ':' + this.col + '/' + this.length);
1375
1494
  }
1495
+ /** Span for begin of unknown resource */
1376
1496
  static unknown = $mol_span.begin('?');
1497
+ /** Makes new span for begin of resource. */
1377
1498
  static begin(uri, source = '') {
1378
1499
  return new $mol_span(uri, source, 1, 1, 0);
1379
1500
  }
1501
+ /** Makes new span for end of resource. */
1380
1502
  static end(uri, source) {
1381
1503
  return new $mol_span(uri, source, 1, source.length + 1, 0);
1382
1504
  }
1505
+ /** Makes new span for entire resource. */
1383
1506
  static entire(uri, source) {
1384
1507
  return new $mol_span(uri, source, 1, 1, source.length);
1385
1508
  }
@@ -1394,15 +1517,19 @@ var $;
1394
1517
  length: this.length
1395
1518
  };
1396
1519
  }
1520
+ /** Makes new error for this span. */
1397
1521
  error(message, Class = Error) {
1398
1522
  return new Class(`${message} (${this})`);
1399
1523
  }
1524
+ /** Makes new span for same uri. */
1400
1525
  span(row, col, length) {
1401
1526
  return new $mol_span(this.uri, this.source, row, col, length);
1402
1527
  }
1528
+ /** Makes new span after end of this. */
1403
1529
  after(length = 0) {
1404
1530
  return new $mol_span(this.uri, this.source, this.row, this.col + this.length, length);
1405
1531
  }
1532
+ /** Makes new span between begin and end. */
1406
1533
  slice(begin, end = -1) {
1407
1534
  let len = this.length;
1408
1535
  if (begin < 0)
@@ -1425,6 +1552,7 @@ var $;
1425
1552
  "use strict";
1426
1553
  var $;
1427
1554
  (function ($) {
1555
+ /** Serializes tree to string in tree format. */
1428
1556
  function $mol_tree2_to_string(tree) {
1429
1557
  let output = [];
1430
1558
  function dump(tree, prefix = '') {
@@ -1468,12 +1596,25 @@ var $;
1468
1596
  "use strict";
1469
1597
  var $;
1470
1598
  (function ($) {
1599
+ /**
1600
+ * Abstract Syntax Tree with human readable serialization.
1601
+ * Avoid direct instantiation. Use static factories instead.
1602
+ * @see https://github.com/nin-jin/tree.d
1603
+ */
1471
1604
  class $mol_tree2 extends Object {
1472
1605
  type;
1473
1606
  value;
1474
1607
  kids;
1475
1608
  span;
1476
- constructor(type, value, kids, span) {
1609
+ constructor(
1610
+ /** Type of structural node, `value` should be empty */
1611
+ type,
1612
+ /** Content of data node, `type` should be empty */
1613
+ value,
1614
+ /** Child nodes */
1615
+ kids,
1616
+ /** Position in most far source resource */
1617
+ span) {
1477
1618
  super();
1478
1619
  this.type = type;
1479
1620
  this.value = value;
@@ -1481,12 +1622,15 @@ var $;
1481
1622
  this.span = span;
1482
1623
  this[Symbol.toStringTag] = type || '\\' + value;
1483
1624
  }
1625
+ /** Makes collection node. */
1484
1626
  static list(kids, span = $mol_span.unknown) {
1485
1627
  return new $mol_tree2('', '', kids, span);
1486
1628
  }
1629
+ /** Makes new derived collection node. */
1487
1630
  list(kids) {
1488
1631
  return $mol_tree2.list(kids, this.span);
1489
1632
  }
1633
+ /** Makes data node for any string. */
1490
1634
  static data(value, kids = [], span = $mol_span.unknown) {
1491
1635
  const chunks = value.split('\n');
1492
1636
  if (chunks.length > 1) {
@@ -1500,21 +1644,26 @@ var $;
1500
1644
  }
1501
1645
  return new $mol_tree2('', value, kids, span);
1502
1646
  }
1647
+ /** Makes new derived data node. */
1503
1648
  data(value, kids = []) {
1504
1649
  return $mol_tree2.data(value, kids, this.span);
1505
1650
  }
1651
+ /** Makes struct node. */
1506
1652
  static struct(type, kids = [], span = $mol_span.unknown) {
1507
1653
  if (/[ \n\t\\]/.test(type)) {
1508
1654
  $$.$mol_fail(span.error(`Wrong type ${JSON.stringify(type)}`));
1509
1655
  }
1510
1656
  return new $mol_tree2(type, '', kids, span);
1511
1657
  }
1658
+ /** Makes new derived structural node. */
1512
1659
  struct(type, kids = []) {
1513
1660
  return $mol_tree2.struct(type, kids, this.span);
1514
1661
  }
1662
+ /** Makes new derived node with different kids id defined. */
1515
1663
  clone(kids, span = this.span) {
1516
1664
  return new $mol_tree2(this.type, this.value, kids, span);
1517
1665
  }
1666
+ /** Returns multiline text content. */
1518
1667
  text() {
1519
1668
  var values = [];
1520
1669
  for (var kid of this.kids) {
@@ -1524,15 +1673,20 @@ var $;
1524
1673
  }
1525
1674
  return this.value + values.join('\n');
1526
1675
  }
1676
+ /** Parses tree format. */
1677
+ /** @deprecated Use $mol_tree2_from_string */
1527
1678
  static fromString(str, uri = 'unknown') {
1528
1679
  return $$.$mol_tree2_from_string(str, uri);
1529
1680
  }
1681
+ /** Serializes to tree format. */
1530
1682
  toString() {
1531
1683
  return $$.$mol_tree2_to_string(this);
1532
1684
  }
1685
+ /** Makes new tree with node overrided by path. */
1533
1686
  insert(value, ...path) {
1534
1687
  return this.update($mol_maybe(value), ...path)[0];
1535
1688
  }
1689
+ /** Makes new tree with node overrided by path. */
1536
1690
  update(value, ...path) {
1537
1691
  if (path.length === 0)
1538
1692
  return value;
@@ -1565,6 +1719,7 @@ var $;
1565
1719
  return [this.clone(kids)];
1566
1720
  }
1567
1721
  }
1722
+ /** Query nodes by path. */
1568
1723
  select(...path) {
1569
1724
  let next = [this];
1570
1725
  for (const type of path) {
@@ -1591,6 +1746,7 @@ var $;
1591
1746
  }
1592
1747
  return this.list(next);
1593
1748
  }
1749
+ /** Filter kids by path or value. */
1594
1750
  filter(path, value) {
1595
1751
  const sub = this.kids.filter(item => {
1596
1752
  var found = item.select(...path);
@@ -1618,9 +1774,11 @@ var $;
1618
1774
  $mol_fail_hidden(error);
1619
1775
  }
1620
1776
  }
1777
+ /** Transform tree through context with transformers */
1621
1778
  hack(belt, context = {}) {
1622
1779
  return [].concat(...this.kids.map(child => child.hack_self(belt, context)));
1623
1780
  }
1781
+ /** Makes Error with node coordinates. */
1624
1782
  error(message, Class = Error) {
1625
1783
  return this.span.error(`${message}\n${this.clone([])}`, Class);
1626
1784
  }
@@ -1638,6 +1796,7 @@ var $;
1638
1796
  "use strict";
1639
1797
  var $;
1640
1798
  (function ($) {
1799
+ /** Syntax error with cordinates and source line snippet. */
1641
1800
  class $mol_error_syntax extends SyntaxError {
1642
1801
  reason;
1643
1802
  line;
@@ -1656,6 +1815,7 @@ var $;
1656
1815
  "use strict";
1657
1816
  var $;
1658
1817
  (function ($) {
1818
+ /** Parses tree format from string. */
1659
1819
  function $mol_tree2_from_string(str, uri = '?') {
1660
1820
  const span = $mol_span.entire(uri, str);
1661
1821
  var root = $mol_tree2.list([], span);
@@ -1665,6 +1825,7 @@ var $;
1665
1825
  var indent = 0;
1666
1826
  var line_start = pos;
1667
1827
  row++;
1828
+ // read indent
1668
1829
  while (str.length > pos && str[pos] == '\t') {
1669
1830
  indent++;
1670
1831
  pos++;
@@ -1673,8 +1834,10 @@ var $;
1673
1834
  min_indent = indent;
1674
1835
  }
1675
1836
  indent -= min_indent;
1837
+ // invalid tab size
1676
1838
  if (indent < 0 || indent >= stack.length) {
1677
1839
  const sp = span.span(row, 1, pos - line_start);
1840
+ // skip error line
1678
1841
  while (str.length > pos && str[pos] != '\n') {
1679
1842
  pos++;
1680
1843
  }
@@ -1689,7 +1852,9 @@ var $;
1689
1852
  }
1690
1853
  stack.length = indent + 1;
1691
1854
  var parent = stack[indent];
1855
+ // parse types
1692
1856
  while (str.length > pos && str[pos] != '\\' && str[pos] != '\n') {
1857
+ // type can not contain space and tab
1693
1858
  var error_start = pos;
1694
1859
  while (str.length > pos && (str[pos] == ' ' || str[pos] == '\t')) {
1695
1860
  pos++;
@@ -1701,6 +1866,7 @@ var $;
1701
1866
  const sp = span.span(row, error_start - line_start + 1, pos - error_start);
1702
1867
  this.$mol_fail(new this.$mol_error_syntax(`Wrong nodes separator`, str.substring(line_start, line_end), sp));
1703
1868
  }
1869
+ // read type
1704
1870
  var type_start = pos;
1705
1871
  while (str.length > pos &&
1706
1872
  str[pos] != '\\' &&
@@ -1715,10 +1881,12 @@ var $;
1715
1881
  parent_kids.push(next);
1716
1882
  parent = next;
1717
1883
  }
1884
+ // read one space if exists
1718
1885
  if (str.length > pos && str[pos] == ' ') {
1719
1886
  pos++;
1720
1887
  }
1721
1888
  }
1889
+ // read data
1722
1890
  if (str.length > pos && str[pos] == '\\') {
1723
1891
  var data_start = pos;
1724
1892
  while (str.length > pos && str[pos] != '\n') {
@@ -1729,6 +1897,7 @@ var $;
1729
1897
  parent_kids.push(next);
1730
1898
  parent = next;
1731
1899
  }
1900
+ // now must be end of text
1732
1901
  if (str.length === pos && stack.length > 0) {
1733
1902
  const sp = span.span(row, pos - line_start + 1, 1);
1734
1903
  this.$mol_fail(new this.$mol_error_syntax(`Unexpected EOF, LF required`, str.substring(line_start, str.length), sp));
@@ -1821,6 +1990,7 @@ var $;
1821
1990
  "use strict";
1822
1991
  var $;
1823
1992
  (function ($) {
1993
+ /** Module for working with terminal. Text coloring when output in terminal */
1824
1994
  class $mol_term_color {
1825
1995
  static reset = this.ansi(0, 0);
1826
1996
  static bold = this.ansi(1, 22);
@@ -1892,6 +2062,7 @@ var $;
1892
2062
  "use strict";
1893
2063
  var $;
1894
2064
  (function ($) {
2065
+ /** One-shot fiber */
1895
2066
  class $mol_wire_task extends $mol_wire_fiber {
1896
2067
  static getter(task) {
1897
2068
  return function $mol_wire_task_get(host, args) {
@@ -1917,6 +2088,7 @@ var $;
1917
2088
  }
1918
2089
  const key = (host?.[Symbol.toStringTag] ?? host) + ('.' + task.name + '<#>');
1919
2090
  const next = new $mol_wire_task(key, task, host, args);
2091
+ // Disabled because non-idempotency is required for try-catch
1920
2092
  if (existen?.temp) {
1921
2093
  $$.$mol_log3_warn({
1922
2094
  place: '$mol_wire_task',
@@ -1949,7 +2121,7 @@ var $;
1949
2121
  try {
1950
2122
  next[Symbol.toStringTag] = this[Symbol.toStringTag];
1951
2123
  }
1952
- catch {
2124
+ catch { // Promises throw in strict mode
1953
2125
  Object.defineProperty(next, Symbol.toStringTag, { value: this[Symbol.toStringTag] });
1954
2126
  }
1955
2127
  }
@@ -2002,6 +2174,10 @@ var $;
2002
2174
  props[field] = get_val;
2003
2175
  return get_val;
2004
2176
  }
2177
+ /**
2178
+ * Convert asynchronous (promise-based) API to synchronous by wrapping function and method calls in a fiber.
2179
+ * @see https://mol.hyoo.ru/#!section=docs/=1fcpsq_1wh0h2
2180
+ */
2005
2181
  function $mol_wire_sync(obj) {
2006
2182
  return new Proxy(obj, {
2007
2183
  get(obj, field) {
@@ -2243,6 +2419,10 @@ var $;
2243
2419
  "use strict";
2244
2420
  var $;
2245
2421
  (function ($) {
2422
+ /**
2423
+ * CSS Units
2424
+ * @see https://mol.hyoo.ru/#!section=docs/=xwq9q5_f966fg
2425
+ */
2246
2426
  class $mol_style_unit extends $mol_decor {
2247
2427
  literal;
2248
2428
  constructor(value, literal) {
@@ -2289,6 +2469,10 @@ var $;
2289
2469
  var $;
2290
2470
  (function ($) {
2291
2471
  const { per } = $mol_style_unit;
2472
+ /**
2473
+ * CSS Functions
2474
+ * @see https://mol.hyoo.ru/#!section=docs/=xwq9q5_f966fg
2475
+ */
2292
2476
  class $mol_style_func extends $mol_decor {
2293
2477
  name;
2294
2478
  constructor(name, value) {
@@ -2383,6 +2567,7 @@ var $;
2383
2567
  "use strict";
2384
2568
  var $;
2385
2569
  (function ($) {
2570
+ /** Create record of CSS variables. */
2386
2571
  function $mol_style_prop(prefix, keys) {
2387
2572
  const record = keys.reduce((rec, key) => {
2388
2573
  rec[key] = $mol_style_func.vary(`--${prefix}_${key}`);
@@ -2397,6 +2582,10 @@ var $;
2397
2582
  "use strict";
2398
2583
  var $;
2399
2584
  (function ($) {
2585
+ /**
2586
+ * Theme css variables
2587
+ * @see https://mol.hyoo.ru/#!section=demos/demo=mol_textarea_demo
2588
+ */
2400
2589
  $.$mol_theme = $mol_style_prop('mol_theme', [
2401
2590
  'back',
2402
2591
  'hover',
@@ -2425,11 +2614,18 @@ var $;
2425
2614
 
2426
2615
  ;
2427
2616
  "use strict";
2617
+ // namespace $ {
2618
+ // $mol_style_attach( '$mol_theme_lights', `:root { --mol_theme_back: oklch( ${ $$.$mol_lights() ? 92 : 20 }% .01 var(--mol_theme_hue) ) }` )
2619
+ // }
2428
2620
 
2429
2621
  ;
2430
2622
  "use strict";
2431
2623
  var $;
2432
2624
  (function ($) {
2625
+ /**
2626
+ * Gap in CSS
2627
+ * @see https://page.hyoo.ru/#!=msdb74_bm7nsq
2628
+ */
2433
2629
  $.$mol_gap = $mol_style_prop('mol_gap', [
2434
2630
  'page',
2435
2631
  'block',
@@ -2519,6 +2715,12 @@ var $;
2519
2715
  createDocumentFragment: () => $mol_dom_context.document.createDocumentFragment(),
2520
2716
  };
2521
2717
  $.$mol_jsx_frag = '';
2718
+ /**
2719
+ * JSX adapter that makes DOM tree.
2720
+ * Generates global unique ids for every DOM-element by components tree with ids.
2721
+ * Ensures all local ids are unique.
2722
+ * Can reuse an existing nodes by GUIDs when used inside [`mol_jsx_attach`](https://github.com/hyoo-ru/mam_mol/tree/master/jsx/attach).
2723
+ */
2522
2724
  function $mol_jsx(Elem, props, ...childNodes) {
2523
2725
  const id = props && props.id || '';
2524
2726
  const guid = id ? $.$mol_jsx_prefix ? $.$mol_jsx_prefix + '/' + id : id : $.$mol_jsx_prefix;
@@ -2647,6 +2849,7 @@ var $;
2647
2849
  var $;
2648
2850
  (function ($) {
2649
2851
  const TypedArray = Object.getPrototypeOf(Uint8Array);
2852
+ /** Returns string key for any value. */
2650
2853
  function $mol_key(value) {
2651
2854
  primitives: {
2652
2855
  if (typeof value === 'bigint')
@@ -2654,9 +2857,9 @@ var $;
2654
2857
  if (typeof value === 'symbol')
2655
2858
  return `Symbol(${value.description})`;
2656
2859
  if (!value)
2657
- return JSON.stringify(value);
2860
+ return JSON.stringify(value); // 0, null, ""
2658
2861
  if (typeof value !== 'object' && typeof value !== 'function')
2659
- return JSON.stringify(value);
2862
+ return JSON.stringify(value); // boolean, number, string
2660
2863
  }
2661
2864
  caching: {
2662
2865
  let key = $mol_key_store.get(value);
@@ -2733,6 +2936,9 @@ var $;
2733
2936
  "use strict";
2734
2937
  var $;
2735
2938
  (function ($) {
2939
+ /**
2940
+ * Decorates method to fiber to ensure it is executed only once inside other fiber.
2941
+ */
2736
2942
  function $mol_wire_method(host, field, descr) {
2737
2943
  if (!descr)
2738
2944
  descr = Reflect.getOwnPropertyDescriptor(host, field);
@@ -2765,6 +2971,7 @@ var $;
2765
2971
  "use strict";
2766
2972
  var $;
2767
2973
  (function ($) {
2974
+ /** Long-living fiber. */
2768
2975
  class $mol_wire_atom extends $mol_wire_fiber {
2769
2976
  static solo(host, task) {
2770
2977
  const field = task.name + '()';
@@ -2815,7 +3022,11 @@ var $;
2815
3022
  }
2816
3023
  $mol_wire_atom.watching.add(this);
2817
3024
  }
3025
+ /**
3026
+ * Update atom value through another temp fiber.
3027
+ */
2818
3028
  resync(args) {
3029
+ // enforce pulling tasks abort
2819
3030
  for (let cursor = this.pub_from; cursor < this.sub_from; cursor += 2) {
2820
3031
  const pub = this.data[cursor];
2821
3032
  if (pub && pub instanceof $mol_wire_task) {
@@ -2876,7 +3087,7 @@ var $;
2876
3087
  try {
2877
3088
  next[Symbol.toStringTag] = this[Symbol.toStringTag];
2878
3089
  }
2879
- catch {
3090
+ catch { // Promises throw in strict mode
2880
3091
  Object.defineProperty(next, Symbol.toStringTag, { value: this[Symbol.toStringTag] });
2881
3092
  }
2882
3093
  }
@@ -2904,6 +3115,7 @@ var $;
2904
3115
  "use strict";
2905
3116
  var $;
2906
3117
  (function ($) {
3118
+ /** Decorates solo object channel to [mol_wire_atom](../atom/atom.ts). */
2907
3119
  function $mol_wire_solo(host, field, descr) {
2908
3120
  if (!descr)
2909
3121
  descr = Reflect.getOwnPropertyDescriptor(host, field);
@@ -2942,6 +3154,7 @@ var $;
2942
3154
  "use strict";
2943
3155
  var $;
2944
3156
  (function ($) {
3157
+ /** Reactive memoizing multiplexed property decorator. */
2945
3158
  function $mol_wire_plex(host, field, descr) {
2946
3159
  if (!descr)
2947
3160
  descr = Reflect.getOwnPropertyDescriptor(host, field);
@@ -2980,7 +3193,25 @@ var $;
2980
3193
  "use strict";
2981
3194
  var $;
2982
3195
  (function ($) {
3196
+ /**
3197
+ * Reactive memoizing solo property decorator from [mol_wire](../wire/README.md)
3198
+ * @example
3199
+ * '@' $mol_mem
3200
+ * name(next?: string) {
3201
+ * return next ?? 'default'
3202
+ * }
3203
+ * @see https://mol.hyoo.ru/#!section=docs/=qxmh6t_sinbmb
3204
+ */
2983
3205
  $.$mol_mem = $mol_wire_solo;
3206
+ /**
3207
+ * Reactive memoizing multiplexed property decorator [mol_wire](../wire/README.md)
3208
+ * @example
3209
+ * '@' $mol_mem_key
3210
+ * name(id: number, next?: string) {
3211
+ * return next ?? 'default'
3212
+ * }
3213
+ * @see https://mol.hyoo.ru/#!section=docs/=qxmh6t_sinbmb
3214
+ */
2984
3215
  $.$mol_mem_key = $mol_wire_plex;
2985
3216
  })($ || ($ = {}));
2986
3217
 
@@ -3104,6 +3335,7 @@ var $;
3104
3335
  "use strict";
3105
3336
  var $;
3106
3337
  (function ($) {
3338
+ /** Run code without state changes */
3107
3339
  function $mol_wire_probe(task, def) {
3108
3340
  const warm = $mol_wire_fiber.warm;
3109
3341
  try {
@@ -3124,6 +3356,10 @@ var $;
3124
3356
  "use strict";
3125
3357
  var $;
3126
3358
  (function ($) {
3359
+ /**
3360
+ * Real-time refresh current atom.
3361
+ * Don't use if possible. May reduce performance.
3362
+ */
3127
3363
  function $mol_wire_watch() {
3128
3364
  const atom = $mol_wire_auto();
3129
3365
  if (atom instanceof $mol_wire_atom) {
@@ -3140,6 +3376,11 @@ var $;
3140
3376
  "use strict";
3141
3377
  var $;
3142
3378
  (function ($) {
3379
+ /**
3380
+ * Returns closure that returns constant value.
3381
+ * @example
3382
+ * const rnd = $mol_const( Math.random() )
3383
+ */
3143
3384
  function $mol_const(value) {
3144
3385
  const getter = (() => value);
3145
3386
  getter['()'] = value;
@@ -3154,6 +3395,9 @@ var $;
3154
3395
  "use strict";
3155
3396
  var $;
3156
3397
  (function ($) {
3398
+ /**
3399
+ * Disable reaping of current subscriber
3400
+ */
3157
3401
  function $mol_wire_solid() {
3158
3402
  let current = $mol_wire_auto();
3159
3403
  if (current.temp)
@@ -3257,6 +3501,7 @@ var $;
3257
3501
  "use strict";
3258
3502
  var $;
3259
3503
  (function ($) {
3504
+ /** Convert a pseudo-synchronous (Suspense API) API to an explicit asynchronous one (for integrating with external systems). */
3260
3505
  function $mol_wire_async(obj) {
3261
3506
  let fiber;
3262
3507
  const temp = $mol_wire_task.getter(obj);
@@ -3298,6 +3543,7 @@ var $;
3298
3543
 
3299
3544
  ;
3300
3545
  "use strict";
3546
+ /** @jsx $mol_jsx */
3301
3547
  var $;
3302
3548
  (function ($) {
3303
3549
  function $mol_view_visible_width() {
@@ -3312,6 +3558,11 @@ var $;
3312
3558
  return suffix;
3313
3559
  }
3314
3560
  $.$mol_view_state_key = $mol_view_state_key;
3561
+ /**
3562
+ * The base class for all visual components. It provides the infrastructure for reactive lazy rendering, handling exceptions.
3563
+ * @see https://mol.hyoo.ru/#!section=docs/=vv2nig_s5zr0f
3564
+ */
3565
+ /// Reactive statefull lazy ViewModel
3315
3566
  class $mol_view extends $mol_object {
3316
3567
  static Root(id) {
3317
3568
  return new this;
@@ -3376,16 +3627,22 @@ var $;
3376
3627
  state_key(suffix = '') {
3377
3628
  return this.$.$mol_view_state_key(suffix);
3378
3629
  }
3630
+ /// Name of element that created when element not found in DOM
3379
3631
  dom_name() {
3380
3632
  return $mol_dom_qname(this.constructor.toString()) || 'div';
3381
3633
  }
3634
+ /// NameSpace of element that created when element not found in DOM
3382
3635
  dom_name_space() { return 'http://www.w3.org/1999/xhtml'; }
3636
+ /// Raw child views
3383
3637
  sub() {
3384
3638
  return [];
3385
3639
  }
3640
+ /// Visible sub views with defined ambient context
3641
+ /// Render all by default
3386
3642
  sub_visible() {
3387
3643
  return this.sub();
3388
3644
  }
3645
+ /// Minimal width that used for lazy rendering
3389
3646
  minimal_width() {
3390
3647
  let min = 0;
3391
3648
  try {
@@ -3407,6 +3664,7 @@ var $;
3407
3664
  maximal_width() {
3408
3665
  return this.minimal_width();
3409
3666
  }
3667
+ /// Minimal height that used for lazy rendering
3410
3668
  minimal_height() {
3411
3669
  let min = 0;
3412
3670
  try {
@@ -3426,11 +3684,11 @@ var $;
3426
3684
  view_rect() {
3427
3685
  if ($mol_wire_probe(() => this.view_rect()) === undefined) {
3428
3686
  $mol_wire_watch();
3429
- return null;
3687
+ return null; // don't touch DOM to prevent instant reflow
3430
3688
  }
3431
3689
  else {
3432
3690
  const { width, height, left, right, top, bottom } = this.dom_node().getBoundingClientRect();
3433
- return { width, height, left, right, top, bottom };
3691
+ return { width, height, left, right, top, bottom }; // pick to optimize compare
3434
3692
  }
3435
3693
  }
3436
3694
  dom_id() {
@@ -3620,6 +3878,7 @@ var $;
3620
3878
  [$mol_dev_format_head]() {
3621
3879
  return $mol_dev_format_span({}, $mol_dev_format_native(this));
3622
3880
  }
3881
+ /** Deep search view by predicate. */
3623
3882
  *view_find(check, path = []) {
3624
3883
  if (path.length === 0 && check(this))
3625
3884
  return yield [this];
@@ -3648,6 +3907,7 @@ var $;
3648
3907
  $mol_fail_log(error);
3649
3908
  }
3650
3909
  }
3910
+ /** Renders path of views to DOM. */
3651
3911
  force_render(path) {
3652
3912
  const kids = this.sub();
3653
3913
  const index = kids.findIndex(item => {
@@ -3662,6 +3922,7 @@ var $;
3662
3922
  kids[index].force_render(path);
3663
3923
  }
3664
3924
  }
3925
+ /** Renders view to DOM and scroll to it. */
3665
3926
  ensure_visible(view, align = "start") {
3666
3927
  const path = this.view_find(v => v === view).next().value;
3667
3928
  this.force_render(new Set(path));
@@ -3676,6 +3937,9 @@ var $;
3676
3937
  const win = this.$.$mol_dom_context;
3677
3938
  if (win.parent !== win.self && !win.document.hasFocus())
3678
3939
  return;
3940
+ // new this.$.$mol_after_frame( ()=> {
3941
+ // this.dom_node().scrollIntoView({ block: 'start', inline: 'nearest' })
3942
+ // } )
3679
3943
  new this.$.$mol_after_timeout(0, () => {
3680
3944
  this.focused(true);
3681
3945
  });
@@ -3756,6 +4020,7 @@ var $;
3756
4020
  "use strict";
3757
4021
  var $;
3758
4022
  (function ($) {
4023
+ /** Plugin is component without its own DOM element, but instead uses the owner DOM element */
3759
4024
  class $mol_plugin extends $mol_view {
3760
4025
  dom_node_external(next) {
3761
4026
  return next ?? $mol_owning_get(this).host.dom_node();
@@ -3791,6 +4056,7 @@ var $;
3791
4056
  "use strict";
3792
4057
  var $;
3793
4058
  (function ($) {
4059
+ /** State of time moment */
3794
4060
  class $mol_state_time extends $mol_object {
3795
4061
  static task(precision, reset) {
3796
4062
  if (precision) {
@@ -3817,12 +4083,14 @@ var $;
3817
4083
  ;
3818
4084
  "use strict";
3819
4085
 
4086
+
3820
4087
  ;
3821
4088
  "use strict";
3822
4089
  var $;
3823
4090
  (function ($) {
3824
4091
  var $$;
3825
4092
  (function ($$) {
4093
+ /** Base SVG component to display SVG images or icons. */
3826
4094
  class $mol_svg extends $.$mol_svg {
3827
4095
  computed_style() {
3828
4096
  const win = this.$.$mol_dom_context;
@@ -3882,6 +4150,7 @@ var $;
3882
4150
  ;
3883
4151
  "use strict";
3884
4152
 
4153
+
3885
4154
  ;
3886
4155
  "use strict";
3887
4156
  var $;
@@ -4191,12 +4460,17 @@ var $;
4191
4460
  ;
4192
4461
  "use strict";
4193
4462
 
4463
+
4194
4464
  ;
4195
4465
  "use strict";
4196
4466
  var $;
4197
4467
  (function ($) {
4198
4468
  var $$;
4199
4469
  (function ($$) {
4470
+ /**
4471
+ * Plugin for touch gestures.
4472
+ * @see [mol_plugin](../plugin/readme.md)
4473
+ */
4200
4474
  class $mol_touch extends $.$mol_touch {
4201
4475
  auto() {
4202
4476
  this.pointer_events();
@@ -4680,6 +4954,7 @@ var $;
4680
4954
  ;
4681
4955
  "use strict";
4682
4956
 
4957
+
4683
4958
  ;
4684
4959
  ($.$mol_svg_title) = class $mol_svg_title extends ($.$mol_svg) {
4685
4960
  dom_name(){
@@ -4694,6 +4969,7 @@ var $;
4694
4969
  ;
4695
4970
  "use strict";
4696
4971
 
4972
+
4697
4973
  ;
4698
4974
  ($.$mol_plot_graph) = class $mol_plot_graph extends ($.$mol_svg_group) {
4699
4975
  type(){
@@ -4848,6 +5124,7 @@ var $;
4848
5124
  ;
4849
5125
  "use strict";
4850
5126
 
5127
+
4851
5128
  ;
4852
5129
  "use strict";
4853
5130
  var $;
@@ -4931,12 +5208,17 @@ var $;
4931
5208
  ;
4932
5209
  "use strict";
4933
5210
 
5211
+
4934
5212
  ;
4935
5213
  "use strict";
4936
5214
  var $;
4937
5215
  (function ($) {
4938
5216
  var $$;
4939
5217
  (function ($$) {
5218
+ /**
5219
+ * Fastest plot lib for vector graphics.
5220
+ * @see https://mol.hyoo.ru/#!section=demos/demo=mol_plot_demo
5221
+ */
4940
5222
  class $mol_plot_pane extends $.$mol_plot_pane {
4941
5223
  dimensions() {
4942
5224
  const graphs = this.graphs();
@@ -5176,6 +5458,7 @@ var $;
5176
5458
  ;
5177
5459
  "use strict";
5178
5460
 
5461
+
5179
5462
  ;
5180
5463
  "use strict";
5181
5464
  var $;
@@ -5268,6 +5551,7 @@ var $;
5268
5551
  ;
5269
5552
  "use strict";
5270
5553
 
5554
+
5271
5555
  ;
5272
5556
  "use strict";
5273
5557
  var $;
@@ -5350,6 +5634,7 @@ var $;
5350
5634
  ;
5351
5635
  "use strict";
5352
5636
 
5637
+
5353
5638
  ;
5354
5639
  ($.$mol_plot_dot) = class $mol_plot_dot extends ($.$mol_plot_graph) {
5355
5640
  diameter(){
@@ -5389,6 +5674,7 @@ var $;
5389
5674
  "use strict";
5390
5675
  var $;
5391
5676
  (function ($) {
5677
+ // 00 HHHHH HHHHH HHHHH LLLLL LLLLL LLLLL
5392
5678
  const mask = 0b11111_11111_11111;
5393
5679
  function $mol_coord_pack(high, low) {
5394
5680
  return (high << 17 >>> 2) | (low & mask);
@@ -5407,6 +5693,7 @@ var $;
5407
5693
  ;
5408
5694
  "use strict";
5409
5695
 
5696
+
5410
5697
  ;
5411
5698
  "use strict";
5412
5699
  var $;
@@ -5419,6 +5706,7 @@ var $;
5419
5706
  }
5420
5707
  indexes() {
5421
5708
  const radius = this.diameter() / 2;
5709
+ // calculate by cpu
5422
5710
  const points_max = this.points_max();
5423
5711
  const viewport = this.viewport();
5424
5712
  const viewport_left = viewport.x.min - radius;
@@ -5555,12 +5843,17 @@ var $;
5555
5843
  ;
5556
5844
  "use strict";
5557
5845
 
5846
+
5558
5847
  ;
5559
5848
  "use strict";
5560
5849
  var $;
5561
5850
  (function ($) {
5562
5851
  var $$;
5563
5852
  (function ($$) {
5853
+ /**
5854
+ * Heat map graph.
5855
+ * @see https://mol.hyoo.ru/#!section=demos/demo=mol_plot_map_heat_demo
5856
+ */
5564
5857
  class $mol_plot_map_heat extends $.$mol_plot_map_heat {
5565
5858
  levels() {
5566
5859
  return [...new Set(this.series_z())].sort((a, b) => a - b);
@@ -5657,6 +5950,7 @@ var $;
5657
5950
  ;
5658
5951
  "use strict";
5659
5952
 
5953
+
5660
5954
  ;
5661
5955
  "use strict";
5662
5956
  var $;
@@ -5759,6 +6053,7 @@ var $;
5759
6053
  ;
5760
6054
  "use strict";
5761
6055
 
6056
+
5762
6057
  ;
5763
6058
  "use strict";
5764
6059
  var $;
@@ -5827,6 +6122,7 @@ var $;
5827
6122
  ;
5828
6123
  "use strict";
5829
6124
 
6125
+
5830
6126
  ;
5831
6127
  "use strict";
5832
6128
  var $;
@@ -5889,6 +6185,7 @@ var $;
5889
6185
  ;
5890
6186
  "use strict";
5891
6187
 
6188
+
5892
6189
  ;
5893
6190
  "use strict";
5894
6191
  var $;
@@ -6054,6 +6351,7 @@ var $;
6054
6351
  ;
6055
6352
  "use strict";
6056
6353
 
6354
+
6057
6355
  ;
6058
6356
  "use strict";
6059
6357
  var $;
@@ -6123,6 +6421,7 @@ var $;
6123
6421
  }
6124
6422
  front() {
6125
6423
  return [
6424
+ // this.Background(),
6126
6425
  ...this.labels_formatted(),
6127
6426
  this.Title()
6128
6427
  ];
@@ -6174,6 +6473,7 @@ var $;
6174
6473
  ;
6175
6474
  "use strict";
6176
6475
 
6476
+
6177
6477
  ;
6178
6478
  "use strict";
6179
6479
  var $;
@@ -6249,6 +6549,7 @@ var $;
6249
6549
  ;
6250
6550
  "use strict";
6251
6551
 
6552
+
6252
6553
  ;
6253
6554
  "use strict";
6254
6555
  var $;
@@ -6386,6 +6687,7 @@ var $;
6386
6687
  ;
6387
6688
  "use strict";
6388
6689
 
6690
+
6389
6691
  ;
6390
6692
  "use strict";
6391
6693
  var $;
@@ -6513,6 +6815,7 @@ var $;
6513
6815
  ;
6514
6816
  "use strict";
6515
6817
 
6818
+
6516
6819
  ;
6517
6820
  "use strict";
6518
6821
  var $;
@@ -6625,6 +6928,7 @@ var $;
6625
6928
  ;
6626
6929
  "use strict";
6627
6930
 
6931
+
6628
6932
  ;
6629
6933
  "use strict";
6630
6934
  var $;
@@ -6825,18 +7129,34 @@ var $;
6825
7129
  "use strict";
6826
7130
  var $;
6827
7131
  (function ($) {
7132
+ /**
7133
+ * Argument must be Truthy
7134
+ * @deprecated use $mol_assert_equal instead
7135
+ */
6828
7136
  function $mol_assert_ok(value) {
6829
7137
  if (value)
6830
7138
  return;
6831
7139
  $mol_fail(new Error(`${value} ≠ true`));
6832
7140
  }
6833
7141
  $.$mol_assert_ok = $mol_assert_ok;
7142
+ /**
7143
+ * Argument must be Falsy
7144
+ * @deprecated use $mol_assert_equal instead
7145
+ */
6834
7146
  function $mol_assert_not(value) {
6835
7147
  if (!value)
6836
7148
  return;
6837
7149
  $mol_fail(new Error(`${value} ≠ false`));
6838
7150
  }
6839
7151
  $.$mol_assert_not = $mol_assert_not;
7152
+ /**
7153
+ * Handler must throw an error.
7154
+ * @example
7155
+ * $mol_assert_fail( ()=>{ throw new Error( 'Parse error' ) } ) // Passes because throws error
7156
+ * $mol_assert_fail( ()=>{ throw new Error( 'Parse error' ) } , 'Parse error' ) // Passes because throws right message
7157
+ * $mol_assert_fail( ()=>{ throw new Error( 'Parse error' ) } , Error ) // Passes because throws right class
7158
+ * @see https://mol.hyoo.ru/#!section=docs/=9q9dv3_fgxjsf
7159
+ */
6840
7160
  function $mol_assert_fail(handler, ErrorRight) {
6841
7161
  const fail = $.$mol_fail;
6842
7162
  try {
@@ -6859,10 +7179,18 @@ var $;
6859
7179
  $mol_fail(new Error('Not failed', { cause: { expect: ErrorRight } }));
6860
7180
  }
6861
7181
  $.$mol_assert_fail = $mol_assert_fail;
7182
+ /** @deprecated Use $mol_assert_equal */
6862
7183
  function $mol_assert_like(...args) {
6863
7184
  $mol_assert_equal(...args);
6864
7185
  }
6865
7186
  $.$mol_assert_like = $mol_assert_like;
7187
+ /**
7188
+ * All arguments must not be structural equal to each other.
7189
+ * @example
7190
+ * $mol_assert_unique( 1 , 2 , 3 ) // Passes
7191
+ * $mol_assert_unique( 1 , 1 , 2 ) // Fails because 1 === 1
7192
+ * @see https://mol.hyoo.ru/#!section=docs/=9q9dv3_fgxjsf
7193
+ */
6866
7194
  function $mol_assert_unique(...args) {
6867
7195
  for (let i = 0; i < args.length; ++i) {
6868
7196
  for (let j = 0; j < args.length; ++j) {
@@ -6875,6 +7203,13 @@ var $;
6875
7203
  }
6876
7204
  }
6877
7205
  $.$mol_assert_unique = $mol_assert_unique;
7206
+ /**
7207
+ * All arguments must be structural equal each other.
7208
+ * @example
7209
+ * $mol_assert_like( [1] , [1] , [1] ) // Passes
7210
+ * $mol_assert_like( [1] , [1] , [2] ) // Fails because 1 !== 2
7211
+ * @see https://mol.hyoo.ru/#!section=docs/=9q9dv3_fgxjsf
7212
+ */
6878
7213
  function $mol_assert_equal(...args) {
6879
7214
  for (let i = 1; i < args.length; ++i) {
6880
7215
  if ($mol_compare_deep(args[0], args[i]))
@@ -6931,6 +7266,12 @@ var $;
6931
7266
  'return result without errors'() {
6932
7267
  $mol_assert_equal($mol_try(() => false), false);
6933
7268
  },
7269
+ //'return error if thrown'() {
7270
+ //
7271
+ // const error = new Error( '$mol_try test error' )
7272
+ // $mol_assert_equal( $mol_try( ()=> { throw error } ) , error )
7273
+ //
7274
+ //} ,
6934
7275
  });
6935
7276
  })($ || ($ = {}));
6936
7277
 
@@ -7439,6 +7780,7 @@ var $;
7439
7780
  "use strict";
7440
7781
  var $;
7441
7782
  (function ($) {
7783
+ /// @todo right orderinng
7442
7784
  $.$mol_after_mock_queue = [];
7443
7785
  function $mol_after_mock_warp() {
7444
7786
  const queue = $.$mol_after_mock_queue.splice(0);
@@ -7842,6 +8184,8 @@ var $;
7842
8184
 
7843
8185
  ;
7844
8186
  "use strict";
8187
+ /** @jsx $mol_jsx */
8188
+ /** @jsxFrag $mol_jsx_frag */
7845
8189
  var $;
7846
8190
  (function ($) {
7847
8191
  $mol_test({
@@ -7947,6 +8291,7 @@ var $;
7947
8291
  "use strict";
7948
8292
  var $;
7949
8293
  (function ($) {
8294
+ /** Lazy computed lists with native Array interface. $mol_range2_array is mutable but all derived ranges are immutable. */
7950
8295
  function $mol_range2(item = index => index, size = () => Number.POSITIVE_INFINITY) {
7951
8296
  const source = typeof item === 'function' ? new $mol_range2_array() : item;
7952
8297
  if (typeof item !== 'function') {
@@ -7995,6 +8340,7 @@ var $;
7995
8340
  }
7996
8341
  $.$mol_range2 = $mol_range2;
7997
8342
  class $mol_range2_array extends Array {
8343
+ // Lazy
7998
8344
  concat(...tail) {
7999
8345
  if (tail.length === 0)
8000
8346
  return this;
@@ -8006,6 +8352,7 @@ var $;
8006
8352
  }
8007
8353
  return $mol_range2(index => index < this.length ? this[index] : tail[0][index - this.length], () => this.length + tail[0].length);
8008
8354
  }
8355
+ // Lazy
8009
8356
  filter(check, context) {
8010
8357
  const filtered = [];
8011
8358
  let cursor = -1;
@@ -8018,13 +8365,16 @@ var $;
8018
8365
  return filtered[index];
8019
8366
  }, () => cursor < this.length ? Number.POSITIVE_INFINITY : filtered.length);
8020
8367
  }
8368
+ // Diligent
8021
8369
  forEach(proceed, context) {
8022
8370
  for (let [key, value] of this.entries())
8023
8371
  proceed.call(context, value, key, this);
8024
8372
  }
8373
+ // Lazy
8025
8374
  map(proceed, context) {
8026
8375
  return $mol_range2(index => proceed.call(context, this[index], index, this), () => this.length);
8027
8376
  }
8377
+ // Diligent
8028
8378
  reduce(merge, result) {
8029
8379
  let index = 0;
8030
8380
  if (arguments.length === 1) {
@@ -8035,12 +8385,15 @@ var $;
8035
8385
  }
8036
8386
  return result;
8037
8387
  }
8388
+ // Lazy
8038
8389
  toReversed() {
8039
8390
  return $mol_range2(index => this[this.length - 1 - index], () => this.length);
8040
8391
  }
8392
+ // Lazy
8041
8393
  slice(from = 0, to = this.length) {
8042
8394
  return $mol_range2(index => this[from + index], () => Math.min(to, this.length) - from);
8043
8395
  }
8396
+ // Lazy
8044
8397
  some(check, context) {
8045
8398
  for (let index = 0; index < this.length; ++index) {
8046
8399
  if (check.call(context, this[index], index, this))
@@ -8233,6 +8586,7 @@ var $;
8233
8586
 
8234
8587
  ;
8235
8588
  "use strict";
8589
+ /** @jsx $mol_jsx */
8236
8590
  var $;
8237
8591
  (function ($) {
8238
8592
  $mol_test({
@@ -8294,6 +8648,7 @@ var $;
8294
8648
  const obj3_copy = { test: 3, obj2: obj2_copy };
8295
8649
  obj1.obj3 = obj3;
8296
8650
  obj1_copy.obj3 = obj3_copy;
8651
+ // warmup cache
8297
8652
  $mol_assert_not($mol_compare_deep(obj1, {}));
8298
8653
  $mol_assert_not($mol_compare_deep(obj2, {}));
8299
8654
  $mol_assert_not($mol_compare_deep(obj3, {}));
@@ -8362,11 +8717,15 @@ var $;
8362
8717
  ;
8363
8718
  "use strict";
8364
8719
 
8720
+ ;
8721
+ "use strict";
8722
+
8365
8723
  ;
8366
8724
  "use strict";
8367
8725
  var $;
8368
8726
  (function ($_1) {
8369
8727
  $mol_test({
8728
+ // https://github.com/nin-jin/slides/tree/master/reactivity#component-states
8370
8729
  'Cached channel'($) {
8371
8730
  class App extends $mol_object2 {
8372
8731
  static $ = $;
@@ -8424,6 +8783,7 @@ var $;
8424
8783
  $mol_assert_equal(App.value(5), 21);
8425
8784
  $mol_assert_equal(App.value(), 21);
8426
8785
  },
8786
+ // https://github.com/nin-jin/slides/tree/master/reactivity#wish-consistency
8427
8787
  'Auto recalculation of cached values'($) {
8428
8788
  class App extends $mol_object2 {
8429
8789
  static $ = $;
@@ -8451,6 +8811,7 @@ var $;
8451
8811
  App.xxx(5);
8452
8812
  $mol_assert_equal(App.zzz(), 7);
8453
8813
  },
8814
+ // https://github.com/nin-jin/slides/tree/master/reactivity#wish-reasonability
8454
8815
  'Skip recalculation when actually no dependency changes'($) {
8455
8816
  const log = [];
8456
8817
  class App extends $mol_object2 {
@@ -8484,6 +8845,7 @@ var $;
8484
8845
  App.zzz();
8485
8846
  $mol_assert_like(log, ['zzz', 'yyy', 'xxx', 'xxx', 'yyy']);
8486
8847
  },
8848
+ // https://github.com/nin-jin/slides/tree/master/reactivity#flow-auto
8487
8849
  'Flow: Auto'($) {
8488
8850
  class App extends $mol_object2 {
8489
8851
  static get $() { return $; }
@@ -8521,6 +8883,7 @@ var $;
8521
8883
  $mol_assert_equal(App.result(), 23);
8522
8884
  $mol_assert_equal(App.counter, 4);
8523
8885
  },
8886
+ // https://github.com/nin-jin/slides/tree/master/reactivity#dupes-equality
8524
8887
  'Dupes: Equality'($) {
8525
8888
  let counter = 0;
8526
8889
  class App extends $mol_object2 {
@@ -8544,6 +8907,7 @@ var $;
8544
8907
  App.foo({ numbs: [2] });
8545
8908
  $mol_assert_like(App.bar(), { numbs: [2], count: 2 });
8546
8909
  },
8910
+ // https://github.com/nin-jin/slides/tree/master/reactivity#cycle-fail
8547
8911
  'Cycle: Fail'($) {
8548
8912
  class App extends $mol_object2 {
8549
8913
  static $ = $;
@@ -8568,6 +8932,29 @@ var $;
8568
8932
  ], App, "test", null);
8569
8933
  App.test();
8570
8934
  },
8935
+ // https://github.com/nin-jin/slides/tree/master/reactivity#wish-stability
8936
+ // 'Update deps on push'( $ ) {
8937
+ // class App extends $mol_object2 {
8938
+ // static $ = $
8939
+ // @ $mol_wire_solo
8940
+ // static left( next = false ) {
8941
+ // return next
8942
+ // }
8943
+ // @ $mol_wire_solo
8944
+ // static right( next = false ) {
8945
+ // return next
8946
+ // }
8947
+ // @ $mol_wire_solo
8948
+ // static res( next?: boolean ) {
8949
+ // return this.left( next ) && this.right()
8950
+ // }
8951
+ // }
8952
+ // $mol_assert_equal( App.res(), false )
8953
+ // $mol_assert_equal( App.res( true ), false )
8954
+ // $mol_assert_equal( App.right( true ), true )
8955
+ // $mol_assert_equal( App.res(), true )
8956
+ // } ,
8957
+ // https://github.com/nin-jin/slides/tree/master/reactivity#wish-stability
8571
8958
  'Different order of pull and push'($) {
8572
8959
  class App extends $mol_object2 {
8573
8960
  static $ = $;
@@ -8579,7 +8966,7 @@ var $;
8579
8966
  }
8580
8967
  static slow(next) {
8581
8968
  if (next !== undefined)
8582
- this.slow();
8969
+ this.slow(); // enforce pull before push
8583
8970
  return this.store(next);
8584
8971
  }
8585
8972
  }
@@ -8598,6 +8985,7 @@ var $;
8598
8985
  App.store(777);
8599
8986
  $mol_assert_equal(App.fast(), App.slow(), 777);
8600
8987
  },
8988
+ // https://github.com/nin-jin/slides/tree/master/reactivity#wish-stability
8601
8989
  'Actions inside invariant'($) {
8602
8990
  class App extends $mol_object2 {
8603
8991
  static $ = $;
@@ -8637,6 +9025,7 @@ var $;
8637
9025
  static toggle() {
8638
9026
  const prev = this.checked();
8639
9027
  $mol_assert_unique(this.checked(!prev), prev);
9028
+ // $mol_assert_equal( this.checked() , prev )
8640
9029
  }
8641
9030
  static res() {
8642
9031
  return this.checked();
@@ -8661,6 +9050,39 @@ var $;
8661
9050
  ], App, "test", null);
8662
9051
  await $mol_wire_async(App).test();
8663
9052
  },
9053
+ // // https://github.com/nin-jin/slides/tree/master/reactivity#wish-stability
9054
+ // 'Stable order of multiple root'( $ ) {
9055
+ // class App extends $mol_object2 {
9056
+ // static $ = $
9057
+ // static counter = 0
9058
+ // @ $mol_wire_solo
9059
+ // static left_trigger( next = 0 ) {
9060
+ // return next
9061
+ // }
9062
+ // @ $mol_wire_solo
9063
+ // static left_root() {
9064
+ // this.left_trigger()
9065
+ // return ++ this.counter
9066
+ // }
9067
+ // @ $mol_wire_solo
9068
+ // static right_trigger( next = 0 ) {
9069
+ // return next
9070
+ // }
9071
+ // @ $mol_wire_solo
9072
+ // static right_root() {
9073
+ // this.right_trigger()
9074
+ // return ++ this.counter
9075
+ // }
9076
+ // }
9077
+ // $mol_assert_equal( App.left_root(), 1 )
9078
+ // $mol_assert_equal( App.right_root(), 2 )
9079
+ // App.right_trigger( 1 )
9080
+ // App.left_trigger( 1 )
9081
+ // $mol_wire_fiber.sync()
9082
+ // $mol_assert_equal( App.right_root(), 4 )
9083
+ // $mol_assert_equal( App.left_root(), 3 )
9084
+ // } ,
9085
+ // https://github.com/nin-jin/slides/tree/master/reactivity#error-store
8664
9086
  'Restore after error'($) {
8665
9087
  class App extends $mol_object2 {
8666
9088
  static get $() { return $; }
@@ -8758,6 +9180,7 @@ var $;
8758
9180
  App.showing(true);
8759
9181
  $mol_assert_unique(App.render(), details);
8760
9182
  },
9183
+ // https://github.com/nin-jin/slides/tree/master/reactivity#wish-stability
8761
9184
  async 'Hold pubs while wait async task'($) {
8762
9185
  class App extends $mol_object2 {
8763
9186
  static $ = $;
@@ -9116,6 +9539,7 @@ var $;
9116
9539
 
9117
9540
  ;
9118
9541
  "use strict";
9542
+ /** @jsx $mol_jsx */
9119
9543
  var $;
9120
9544
  (function ($) {
9121
9545
  $mol_test({
@@ -9197,6 +9621,7 @@ var $;
9197
9621
  "use strict";
9198
9622
  var $;
9199
9623
  (function ($) {
9624
+ /** Watch and logs reactive states. Logger automatically added to test bundle which is adding to `test.html`. */
9200
9625
  class $mol_wire_log extends $mol_object2 {
9201
9626
  static watch(task) {
9202
9627
  return task;
@@ -9282,6 +9707,9 @@ var $;
9282
9707
  ;
9283
9708
  "use strict";
9284
9709
 
9710
+ ;
9711
+ "use strict";
9712
+
9285
9713
  ;
9286
9714
  "use strict";
9287
9715
  var $;