mol_plot_all 1.2.244 → 1.2.245

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
@@ -619,29 +619,72 @@ var $;
619
619
  ;
620
620
  "use strict";
621
621
  var $;
622
+ (function ($) {
623
+ class $mol_term_color {
624
+ static reset = this.ansi(0, 0);
625
+ static bold = this.ansi(1, 22);
626
+ static italic = this.ansi(3, 23);
627
+ static underline = this.ansi(4, 24);
628
+ static inverse = this.ansi(7, 27);
629
+ static hidden = this.ansi(8, 28);
630
+ static strike = this.ansi(9, 29);
631
+ static gray = this.ansi(90, 39);
632
+ static red = this.ansi(91, 39);
633
+ static green = this.ansi(92, 39);
634
+ static yellow = this.ansi(93, 39);
635
+ static blue = this.ansi(94, 39);
636
+ static magenta = this.ansi(95, 39);
637
+ static cyan = this.ansi(96, 39);
638
+ static white = this.ansi(97, 39);
639
+ static Red = (str) => this.inverse(this.red(str));
640
+ static Green = (str) => this.inverse(this.green(str));
641
+ static Yellow = (str) => this.inverse(this.yellow(str));
642
+ static Blue = (str) => this.inverse(this.blue(str));
643
+ static Magenta = (str) => this.inverse(this.magenta(str));
644
+ static Cyan = (str) => this.inverse(this.cyan(str));
645
+ static White = (str) => this.inverse(this.white(str));
646
+ static ansi(open, close) {
647
+ if (typeof process === 'undefined')
648
+ return String;
649
+ if (!process.stdout.isTTY)
650
+ return String;
651
+ const prefix = `\x1b[${open}m`;
652
+ const postfix = `\x1b[${close}m`;
653
+ const suffix_regexp = new RegExp(postfix.replace('[', '\\['), 'g');
654
+ return function colorer(str) {
655
+ str = String(str);
656
+ if (str === '')
657
+ return str;
658
+ const suffix = str.replace(suffix_regexp, prefix);
659
+ return prefix + suffix + postfix;
660
+ };
661
+ }
662
+ }
663
+ $.$mol_term_color = $mol_term_color;
664
+ })($ || ($ = {}));
665
+ //mol/term/color/color.ts
666
+ ;
667
+ "use strict";
668
+ var $;
622
669
  (function ($) {
623
670
  function $mol_log3_node_make(level, output, type, color) {
624
671
  return function $mol_log3_logger(event) {
625
672
  if (!event.time)
626
673
  event = { time: new Date().toISOString(), ...event };
627
674
  const tree = this.$mol_tree.fromJSON(event).clone({ type });
628
- let str = tree.toString();
629
- if (process[output].isTTY) {
630
- str = $node.colorette[color + 'Bright'](str);
631
- }
632
- ;
675
+ let str = color(tree.toString());
633
676
  this.console[level](str);
634
677
  const self = this;
635
678
  return () => self.console.groupEnd();
636
679
  };
637
680
  }
638
681
  $.$mol_log3_node_make = $mol_log3_node_make;
639
- $.$mol_log3_come = $mol_log3_node_make('info', 'stdout', 'come', 'blue');
640
- $.$mol_log3_done = $mol_log3_node_make('info', 'stdout', 'done', 'green');
641
- $.$mol_log3_fail = $mol_log3_node_make('error', 'stderr', 'fail', 'red');
642
- $.$mol_log3_warn = $mol_log3_node_make('warn', 'stderr', 'warn', 'yellow');
643
- $.$mol_log3_rise = $mol_log3_node_make('log', 'stdout', 'rise', 'magenta');
644
- $.$mol_log3_area = $mol_log3_node_make('log', 'stdout', 'area', 'cyan');
682
+ $.$mol_log3_come = $mol_log3_node_make('info', 'stdout', 'come', $mol_term_color.blue);
683
+ $.$mol_log3_done = $mol_log3_node_make('info', 'stdout', 'done', $mol_term_color.green);
684
+ $.$mol_log3_fail = $mol_log3_node_make('error', 'stderr', 'fail', $mol_term_color.red);
685
+ $.$mol_log3_warn = $mol_log3_node_make('warn', 'stderr', 'warn', $mol_term_color.yellow);
686
+ $.$mol_log3_rise = $mol_log3_node_make('log', 'stdout', 'rise', $mol_term_color.magenta);
687
+ $.$mol_log3_area = $mol_log3_node_make('log', 'stdout', 'area', $mol_term_color.cyan);
645
688
  })($ || ($ = {}));
646
689
  //mol/log3/log3.node.ts
647
690
  ;
@@ -945,7 +988,7 @@ var $;
945
988
  promote() {
946
989
  $mol_wire_auto()?.track_next(this);
947
990
  }
948
- refresh() { }
991
+ fresh() { }
949
992
  complete() { }
950
993
  emit(quant = $mol_wire_cursor.stale) {
951
994
  for (let i = this.sub_from; i < this.data.length; i += 2) {
@@ -1148,7 +1191,7 @@ var $;
1148
1191
  }
1149
1192
  for (let cursor = this.pub_from; cursor < this.cursor; cursor += 2) {
1150
1193
  const pub = this.data[cursor];
1151
- pub.refresh();
1194
+ pub.fresh();
1152
1195
  }
1153
1196
  this.cursor = $mol_wire_cursor.fresh;
1154
1197
  }
@@ -1284,7 +1327,7 @@ var $;
1284
1327
  continue;
1285
1328
  if (fiber.cursor === $mol_wire_cursor.final)
1286
1329
  continue;
1287
- fiber.refresh();
1330
+ fiber.fresh();
1288
1331
  }
1289
1332
  }
1290
1333
  while (this.reaping.size) {
@@ -1352,7 +1395,7 @@ var $;
1352
1395
  else
1353
1396
  super.emit(quant);
1354
1397
  }
1355
- refresh() {
1398
+ fresh() {
1356
1399
  if (this.cursor === $mol_wire_cursor.fresh)
1357
1400
  return;
1358
1401
  if (this.cursor === $mol_wire_cursor.final)
@@ -1360,7 +1403,7 @@ var $;
1360
1403
  check: if (this.cursor === $mol_wire_cursor.doubt) {
1361
1404
  for (let i = this.pub_from; i < this.sub_from; i += 2) {
1362
1405
  ;
1363
- this.data[i]?.refresh();
1406
+ this.data[i]?.fresh();
1364
1407
  if (this.cursor !== $mol_wire_cursor.doubt)
1365
1408
  break check;
1366
1409
  }
@@ -1416,12 +1459,16 @@ var $;
1416
1459
  this.track_off(bu);
1417
1460
  this.put(result);
1418
1461
  }
1462
+ refresh() {
1463
+ this.cursor = $mol_wire_cursor.stale;
1464
+ this.fresh();
1465
+ }
1419
1466
  sync() {
1420
1467
  if (!$mol_wire_fiber.warm) {
1421
1468
  return this.result();
1422
1469
  }
1423
1470
  this.promote();
1424
- this.refresh();
1471
+ this.fresh();
1425
1472
  if (this.cache instanceof Error) {
1426
1473
  return $mol_fail_hidden(this.cache);
1427
1474
  }
@@ -1432,7 +1479,7 @@ var $;
1432
1479
  }
1433
1480
  async async() {
1434
1481
  while (true) {
1435
- this.refresh();
1482
+ this.fresh();
1436
1483
  if (this.cache instanceof Error) {
1437
1484
  $mol_fail_hidden(this.cache);
1438
1485
  }
@@ -1734,6 +1781,22 @@ var $;
1734
1781
  };
1735
1782
  }
1736
1783
  }
1784
+ static watching = new Set();
1785
+ static watch() {
1786
+ new $mol_after_frame($mol_wire_atom.watch);
1787
+ for (const atom of $mol_wire_atom.watching) {
1788
+ if (atom.cursor === $mol_wire_cursor.final) {
1789
+ $mol_wire_atom.watching.delete(atom);
1790
+ }
1791
+ else {
1792
+ atom.cursor = $mol_wire_cursor.stale;
1793
+ atom.fresh();
1794
+ }
1795
+ }
1796
+ }
1797
+ watch() {
1798
+ $mol_wire_atom.watching.add(this);
1799
+ }
1737
1800
  resync(args) {
1738
1801
  return this.put(this.task.call(this.host, ...args));
1739
1802
  }
@@ -1788,6 +1851,7 @@ var $;
1788
1851
  $mol_wire_method
1789
1852
  ], $mol_wire_atom.prototype, "once", null);
1790
1853
  $.$mol_wire_atom = $mol_wire_atom;
1854
+ $mol_wire_atom.watch();
1791
1855
  })($ || ($ = {}));
1792
1856
  //mol/wire/atom/atom.ts
1793
1857
  ;
@@ -1977,6 +2041,22 @@ var $;
1977
2041
  ;
1978
2042
  "use strict";
1979
2043
  var $;
2044
+ (function ($) {
2045
+ function $mol_wire_watch() {
2046
+ const atom = $mol_wire_auto();
2047
+ if (atom instanceof $mol_wire_atom) {
2048
+ atom.watch();
2049
+ }
2050
+ else {
2051
+ $mol_fail(new Error('Atom is equired for watching'));
2052
+ }
2053
+ }
2054
+ $.$mol_wire_watch = $mol_wire_watch;
2055
+ })($ || ($ = {}));
2056
+ //mol/wire/watch/watch.ts
2057
+ ;
2058
+ "use strict";
2059
+ var $;
1980
2060
  (function ($) {
1981
2061
  function $mol_const(value) {
1982
2062
  var getter = (() => value);
@@ -2266,15 +2346,9 @@ var $;
2266
2346
  }
2267
2347
  static watchers = new Set();
2268
2348
  view_rect() {
2269
- this.view_rect_watcher();
2270
- return this.view_rect_cache();
2271
- }
2272
- view_rect_cache(next = null) {
2273
- return next;
2274
- }
2275
- view_rect_watcher() {
2276
- $mol_view.watchers.add(this);
2277
- return { destructor: () => $mol_view.watchers.delete(this) };
2349
+ $mol_wire_watch();
2350
+ const { width, height, left, right, top, bottom } = this.dom_node().getBoundingClientRect();
2351
+ return { width, height, left, right, top, bottom };
2278
2352
  }
2279
2353
  dom_id() {
2280
2354
  return this.toString();
@@ -2491,12 +2565,6 @@ var $;
2491
2565
  __decorate([
2492
2566
  $mol_mem
2493
2567
  ], $mol_view.prototype, "view_rect", null);
2494
- __decorate([
2495
- $mol_mem
2496
- ], $mol_view.prototype, "view_rect_cache", null);
2497
- __decorate([
2498
- $mol_mem
2499
- ], $mol_view.prototype, "view_rect_watcher", null);
2500
2568
  __decorate([
2501
2569
  $mol_mem
2502
2570
  ], $mol_view.prototype, "dom_node", null);
@@ -4061,14 +4129,12 @@ var $;
4061
4129
  const size_real = this.size_real();
4062
4130
  const max_x = (viewport.x.max - viewport.x.min) / size_real.x;
4063
4131
  const max_y = (viewport.y.max - viewport.y.min) / size_real.y;
4064
- return this.graphs().filter(graph => {
4132
+ return this.graphs_positioned().filter(graph => {
4065
4133
  const dims = graph.dimensions();
4066
4134
  if (dims.x.min > dims.x.max)
4067
4135
  return true;
4068
4136
  if (dims.y.min > dims.y.max)
4069
4137
  return true;
4070
- if (dims.x.max - dims.x.min < max_x && dims.y.max - dims.y.min < max_y)
4071
- return false;
4072
4138
  if (dims.x.min > viewport.x.max)
4073
4139
  return false;
4074
4140
  if (dims.x.max < viewport.x.min)
@@ -4081,7 +4147,7 @@ var $;
4081
4147
  });
4082
4148
  }
4083
4149
  graphs_positioned() {
4084
- const graphs = this.graphs_visible();
4150
+ const graphs = this.graphs();
4085
4151
  for (let graph of graphs) {
4086
4152
  graph.shift = () => this.shift();
4087
4153
  graph.scale = () => this.scale();
@@ -4529,12 +4595,6 @@ var $;
4529
4595
  const size_x = Math.max(0, Math.ceil((1 / aspect - 1) * diameter));
4530
4596
  return points.map(point => `M ${point[0] - shift_x} ${point[1] - shift_y} l ${size_x} ${size_y}`).join(' ');
4531
4597
  }
4532
- dimensions() {
4533
- const scale = this.scale();
4534
- const radius = this.diameter() / Math.min(...scale) / 2;
4535
- const dims = super.dimensions();
4536
- return new this.$.$mol_vector_2d(new $mol_vector_range(dims.x.min - radius, dims.x.max + radius), new $mol_vector_range(dims.y.min - radius, dims.y.max + radius));
4537
- }
4538
4598
  }
4539
4599
  __decorate([
4540
4600
  $mol_mem
@@ -4542,9 +4602,6 @@ var $;
4542
4602
  __decorate([
4543
4603
  $mol_mem
4544
4604
  ], $mol_plot_dot.prototype, "indexes", null);
4545
- __decorate([
4546
- $mol_mem
4547
- ], $mol_plot_dot.prototype, "dimensions", null);
4548
4605
  $$.$mol_plot_dot = $mol_plot_dot;
4549
4606
  })($$ = $.$$ || ($.$$ = {}));
4550
4607
  })($ || ($ = {}));
@@ -5931,6 +5988,20 @@ var $;
5931
5988
  //mol/test/test.test.ts
5932
5989
  ;
5933
5990
  "use strict";
5991
+ var $;
5992
+ (function ($_1) {
5993
+ $mol_test_mocks.push($ => {
5994
+ $.$mol_log3_come = () => { };
5995
+ $.$mol_log3_done = () => { };
5996
+ $.$mol_log3_fail = () => { };
5997
+ $.$mol_log3_warn = () => { };
5998
+ $.$mol_log3_rise = () => { };
5999
+ $.$mol_log3_area = () => () => { };
6000
+ });
6001
+ })($ || ($ = {}));
6002
+ //mol/log3/log3.test.ts
6003
+ ;
6004
+ "use strict";
5934
6005
  //mol/type/error/error.ts
5935
6006
  ;
5936
6007
  "use strict";
@@ -6437,20 +6508,6 @@ var $;
6437
6508
  ;
6438
6509
  "use strict";
6439
6510
  var $;
6440
- (function ($_1) {
6441
- $mol_test_mocks.push($ => {
6442
- $.$mol_log3_come = () => { };
6443
- $.$mol_log3_done = () => { };
6444
- $.$mol_log3_fail = () => { };
6445
- $.$mol_log3_warn = () => { };
6446
- $.$mol_log3_rise = () => { };
6447
- $.$mol_log3_area = () => () => { };
6448
- });
6449
- })($ || ($ = {}));
6450
- //mol/log3/log3.test.ts
6451
- ;
6452
- "use strict";
6453
- var $;
6454
6511
  (function ($_1) {
6455
6512
  $mol_test({
6456
6513
  'tree parsing'() {
@@ -7495,36 +7552,6 @@ var $;
7495
7552
  ;
7496
7553
  "use strict";
7497
7554
  var $;
7498
- (function ($) {
7499
- $mol_test({
7500
- 'const returns stored value'() {
7501
- const foo = { bar: $mol_const(Math.random()) };
7502
- $mol_assert_equal(foo.bar(), foo.bar());
7503
- $mol_assert_equal(foo.bar(), foo.bar['()']);
7504
- },
7505
- });
7506
- })($ || ($ = {}));
7507
- //mol/const/const.test.ts
7508
- ;
7509
- "use strict";
7510
- var $;
7511
- (function ($_1) {
7512
- $mol_test({
7513
- 'FQN of anon function'($) {
7514
- const $$ = Object.assign($, { $mol_func_name_test: (() => () => { })() });
7515
- $mol_assert_equal($$.$mol_func_name_test.name, '');
7516
- $mol_assert_equal($$.$mol_func_name($$.$mol_func_name_test), '$mol_func_name_test');
7517
- $mol_assert_equal($$.$mol_func_name_test.name, '$mol_func_name_test');
7518
- },
7519
- });
7520
- })($ || ($ = {}));
7521
- //mol/func/name/name.test.ts
7522
- ;
7523
- "use strict";
7524
- //mol/type/keys/extract/extract.test.ts
7525
- ;
7526
- "use strict";
7527
- var $;
7528
7555
  (function ($) {
7529
7556
  class $mol_wire_log extends $mol_object2 {
7530
7557
  static watch(task) {
@@ -7641,6 +7668,36 @@ var $;
7641
7668
  ;
7642
7669
  "use strict";
7643
7670
  var $;
7671
+ (function ($) {
7672
+ $mol_test({
7673
+ 'const returns stored value'() {
7674
+ const foo = { bar: $mol_const(Math.random()) };
7675
+ $mol_assert_equal(foo.bar(), foo.bar());
7676
+ $mol_assert_equal(foo.bar(), foo.bar['()']);
7677
+ },
7678
+ });
7679
+ })($ || ($ = {}));
7680
+ //mol/const/const.test.ts
7681
+ ;
7682
+ "use strict";
7683
+ var $;
7684
+ (function ($_1) {
7685
+ $mol_test({
7686
+ 'FQN of anon function'($) {
7687
+ const $$ = Object.assign($, { $mol_func_name_test: (() => () => { })() });
7688
+ $mol_assert_equal($$.$mol_func_name_test.name, '');
7689
+ $mol_assert_equal($$.$mol_func_name($$.$mol_func_name_test), '$mol_func_name_test');
7690
+ $mol_assert_equal($$.$mol_func_name_test.name, '$mol_func_name_test');
7691
+ },
7692
+ });
7693
+ })($ || ($ = {}));
7694
+ //mol/func/name/name.test.ts
7695
+ ;
7696
+ "use strict";
7697
+ //mol/type/keys/extract/extract.test.ts
7698
+ ;
7699
+ "use strict";
7700
+ var $;
7644
7701
  (function ($_1) {
7645
7702
  $mol_test({
7646
7703
  'id auto generation'($) {