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.js CHANGED
@@ -627,29 +627,72 @@ var $;
627
627
  ;
628
628
  "use strict";
629
629
  var $;
630
+ (function ($) {
631
+ class $mol_term_color {
632
+ static reset = this.ansi(0, 0);
633
+ static bold = this.ansi(1, 22);
634
+ static italic = this.ansi(3, 23);
635
+ static underline = this.ansi(4, 24);
636
+ static inverse = this.ansi(7, 27);
637
+ static hidden = this.ansi(8, 28);
638
+ static strike = this.ansi(9, 29);
639
+ static gray = this.ansi(90, 39);
640
+ static red = this.ansi(91, 39);
641
+ static green = this.ansi(92, 39);
642
+ static yellow = this.ansi(93, 39);
643
+ static blue = this.ansi(94, 39);
644
+ static magenta = this.ansi(95, 39);
645
+ static cyan = this.ansi(96, 39);
646
+ static white = this.ansi(97, 39);
647
+ static Red = (str) => this.inverse(this.red(str));
648
+ static Green = (str) => this.inverse(this.green(str));
649
+ static Yellow = (str) => this.inverse(this.yellow(str));
650
+ static Blue = (str) => this.inverse(this.blue(str));
651
+ static Magenta = (str) => this.inverse(this.magenta(str));
652
+ static Cyan = (str) => this.inverse(this.cyan(str));
653
+ static White = (str) => this.inverse(this.white(str));
654
+ static ansi(open, close) {
655
+ if (typeof process === 'undefined')
656
+ return String;
657
+ if (!process.stdout.isTTY)
658
+ return String;
659
+ const prefix = `\x1b[${open}m`;
660
+ const postfix = `\x1b[${close}m`;
661
+ const suffix_regexp = new RegExp(postfix.replace('[', '\\['), 'g');
662
+ return function colorer(str) {
663
+ str = String(str);
664
+ if (str === '')
665
+ return str;
666
+ const suffix = str.replace(suffix_regexp, prefix);
667
+ return prefix + suffix + postfix;
668
+ };
669
+ }
670
+ }
671
+ $.$mol_term_color = $mol_term_color;
672
+ })($ || ($ = {}));
673
+ //mol/term/color/color.ts
674
+ ;
675
+ "use strict";
676
+ var $;
630
677
  (function ($) {
631
678
  function $mol_log3_node_make(level, output, type, color) {
632
679
  return function $mol_log3_logger(event) {
633
680
  if (!event.time)
634
681
  event = { time: new Date().toISOString(), ...event };
635
682
  const tree = this.$mol_tree.fromJSON(event).clone({ type });
636
- let str = tree.toString();
637
- if (process[output].isTTY) {
638
- str = $node.colorette[color + 'Bright'](str);
639
- }
640
- ;
683
+ let str = color(tree.toString());
641
684
  this.console[level](str);
642
685
  const self = this;
643
686
  return () => self.console.groupEnd();
644
687
  };
645
688
  }
646
689
  $.$mol_log3_node_make = $mol_log3_node_make;
647
- $.$mol_log3_come = $mol_log3_node_make('info', 'stdout', 'come', 'blue');
648
- $.$mol_log3_done = $mol_log3_node_make('info', 'stdout', 'done', 'green');
649
- $.$mol_log3_fail = $mol_log3_node_make('error', 'stderr', 'fail', 'red');
650
- $.$mol_log3_warn = $mol_log3_node_make('warn', 'stderr', 'warn', 'yellow');
651
- $.$mol_log3_rise = $mol_log3_node_make('log', 'stdout', 'rise', 'magenta');
652
- $.$mol_log3_area = $mol_log3_node_make('log', 'stdout', 'area', 'cyan');
690
+ $.$mol_log3_come = $mol_log3_node_make('info', 'stdout', 'come', $mol_term_color.blue);
691
+ $.$mol_log3_done = $mol_log3_node_make('info', 'stdout', 'done', $mol_term_color.green);
692
+ $.$mol_log3_fail = $mol_log3_node_make('error', 'stderr', 'fail', $mol_term_color.red);
693
+ $.$mol_log3_warn = $mol_log3_node_make('warn', 'stderr', 'warn', $mol_term_color.yellow);
694
+ $.$mol_log3_rise = $mol_log3_node_make('log', 'stdout', 'rise', $mol_term_color.magenta);
695
+ $.$mol_log3_area = $mol_log3_node_make('log', 'stdout', 'area', $mol_term_color.cyan);
653
696
  })($ || ($ = {}));
654
697
  //mol/log3/log3.node.ts
655
698
  ;
@@ -953,7 +996,7 @@ var $;
953
996
  promote() {
954
997
  $mol_wire_auto()?.track_next(this);
955
998
  }
956
- refresh() { }
999
+ fresh() { }
957
1000
  complete() { }
958
1001
  emit(quant = $mol_wire_cursor.stale) {
959
1002
  for (let i = this.sub_from; i < this.data.length; i += 2) {
@@ -1156,7 +1199,7 @@ var $;
1156
1199
  }
1157
1200
  for (let cursor = this.pub_from; cursor < this.cursor; cursor += 2) {
1158
1201
  const pub = this.data[cursor];
1159
- pub.refresh();
1202
+ pub.fresh();
1160
1203
  }
1161
1204
  this.cursor = $mol_wire_cursor.fresh;
1162
1205
  }
@@ -1292,7 +1335,7 @@ var $;
1292
1335
  continue;
1293
1336
  if (fiber.cursor === $mol_wire_cursor.final)
1294
1337
  continue;
1295
- fiber.refresh();
1338
+ fiber.fresh();
1296
1339
  }
1297
1340
  }
1298
1341
  while (this.reaping.size) {
@@ -1360,7 +1403,7 @@ var $;
1360
1403
  else
1361
1404
  super.emit(quant);
1362
1405
  }
1363
- refresh() {
1406
+ fresh() {
1364
1407
  if (this.cursor === $mol_wire_cursor.fresh)
1365
1408
  return;
1366
1409
  if (this.cursor === $mol_wire_cursor.final)
@@ -1368,7 +1411,7 @@ var $;
1368
1411
  check: if (this.cursor === $mol_wire_cursor.doubt) {
1369
1412
  for (let i = this.pub_from; i < this.sub_from; i += 2) {
1370
1413
  ;
1371
- this.data[i]?.refresh();
1414
+ this.data[i]?.fresh();
1372
1415
  if (this.cursor !== $mol_wire_cursor.doubt)
1373
1416
  break check;
1374
1417
  }
@@ -1424,12 +1467,16 @@ var $;
1424
1467
  this.track_off(bu);
1425
1468
  this.put(result);
1426
1469
  }
1470
+ refresh() {
1471
+ this.cursor = $mol_wire_cursor.stale;
1472
+ this.fresh();
1473
+ }
1427
1474
  sync() {
1428
1475
  if (!$mol_wire_fiber.warm) {
1429
1476
  return this.result();
1430
1477
  }
1431
1478
  this.promote();
1432
- this.refresh();
1479
+ this.fresh();
1433
1480
  if (this.cache instanceof Error) {
1434
1481
  return $mol_fail_hidden(this.cache);
1435
1482
  }
@@ -1440,7 +1487,7 @@ var $;
1440
1487
  }
1441
1488
  async async() {
1442
1489
  while (true) {
1443
- this.refresh();
1490
+ this.fresh();
1444
1491
  if (this.cache instanceof Error) {
1445
1492
  $mol_fail_hidden(this.cache);
1446
1493
  }
@@ -1742,6 +1789,22 @@ var $;
1742
1789
  };
1743
1790
  }
1744
1791
  }
1792
+ static watching = new Set();
1793
+ static watch() {
1794
+ new $mol_after_frame($mol_wire_atom.watch);
1795
+ for (const atom of $mol_wire_atom.watching) {
1796
+ if (atom.cursor === $mol_wire_cursor.final) {
1797
+ $mol_wire_atom.watching.delete(atom);
1798
+ }
1799
+ else {
1800
+ atom.cursor = $mol_wire_cursor.stale;
1801
+ atom.fresh();
1802
+ }
1803
+ }
1804
+ }
1805
+ watch() {
1806
+ $mol_wire_atom.watching.add(this);
1807
+ }
1745
1808
  resync(args) {
1746
1809
  return this.put(this.task.call(this.host, ...args));
1747
1810
  }
@@ -1796,6 +1859,7 @@ var $;
1796
1859
  $mol_wire_method
1797
1860
  ], $mol_wire_atom.prototype, "once", null);
1798
1861
  $.$mol_wire_atom = $mol_wire_atom;
1862
+ $mol_wire_atom.watch();
1799
1863
  })($ || ($ = {}));
1800
1864
  //mol/wire/atom/atom.ts
1801
1865
  ;
@@ -1985,6 +2049,22 @@ var $;
1985
2049
  ;
1986
2050
  "use strict";
1987
2051
  var $;
2052
+ (function ($) {
2053
+ function $mol_wire_watch() {
2054
+ const atom = $mol_wire_auto();
2055
+ if (atom instanceof $mol_wire_atom) {
2056
+ atom.watch();
2057
+ }
2058
+ else {
2059
+ $mol_fail(new Error('Atom is equired for watching'));
2060
+ }
2061
+ }
2062
+ $.$mol_wire_watch = $mol_wire_watch;
2063
+ })($ || ($ = {}));
2064
+ //mol/wire/watch/watch.ts
2065
+ ;
2066
+ "use strict";
2067
+ var $;
1988
2068
  (function ($) {
1989
2069
  function $mol_const(value) {
1990
2070
  var getter = (() => value);
@@ -2274,15 +2354,9 @@ var $;
2274
2354
  }
2275
2355
  static watchers = new Set();
2276
2356
  view_rect() {
2277
- this.view_rect_watcher();
2278
- return this.view_rect_cache();
2279
- }
2280
- view_rect_cache(next = null) {
2281
- return next;
2282
- }
2283
- view_rect_watcher() {
2284
- $mol_view.watchers.add(this);
2285
- return { destructor: () => $mol_view.watchers.delete(this) };
2357
+ $mol_wire_watch();
2358
+ const { width, height, left, right, top, bottom } = this.dom_node().getBoundingClientRect();
2359
+ return { width, height, left, right, top, bottom };
2286
2360
  }
2287
2361
  dom_id() {
2288
2362
  return this.toString();
@@ -2499,12 +2573,6 @@ var $;
2499
2573
  __decorate([
2500
2574
  $mol_mem
2501
2575
  ], $mol_view.prototype, "view_rect", null);
2502
- __decorate([
2503
- $mol_mem
2504
- ], $mol_view.prototype, "view_rect_cache", null);
2505
- __decorate([
2506
- $mol_mem
2507
- ], $mol_view.prototype, "view_rect_watcher", null);
2508
2576
  __decorate([
2509
2577
  $mol_mem
2510
2578
  ], $mol_view.prototype, "dom_node", null);
@@ -4069,14 +4137,12 @@ var $;
4069
4137
  const size_real = this.size_real();
4070
4138
  const max_x = (viewport.x.max - viewport.x.min) / size_real.x;
4071
4139
  const max_y = (viewport.y.max - viewport.y.min) / size_real.y;
4072
- return this.graphs().filter(graph => {
4140
+ return this.graphs_positioned().filter(graph => {
4073
4141
  const dims = graph.dimensions();
4074
4142
  if (dims.x.min > dims.x.max)
4075
4143
  return true;
4076
4144
  if (dims.y.min > dims.y.max)
4077
4145
  return true;
4078
- if (dims.x.max - dims.x.min < max_x && dims.y.max - dims.y.min < max_y)
4079
- return false;
4080
4146
  if (dims.x.min > viewport.x.max)
4081
4147
  return false;
4082
4148
  if (dims.x.max < viewport.x.min)
@@ -4089,7 +4155,7 @@ var $;
4089
4155
  });
4090
4156
  }
4091
4157
  graphs_positioned() {
4092
- const graphs = this.graphs_visible();
4158
+ const graphs = this.graphs();
4093
4159
  for (let graph of graphs) {
4094
4160
  graph.shift = () => this.shift();
4095
4161
  graph.scale = () => this.scale();
@@ -4537,12 +4603,6 @@ var $;
4537
4603
  const size_x = Math.max(0, Math.ceil((1 / aspect - 1) * diameter));
4538
4604
  return points.map(point => `M ${point[0] - shift_x} ${point[1] - shift_y} l ${size_x} ${size_y}`).join(' ');
4539
4605
  }
4540
- dimensions() {
4541
- const scale = this.scale();
4542
- const radius = this.diameter() / Math.min(...scale) / 2;
4543
- const dims = super.dimensions();
4544
- 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));
4545
- }
4546
4606
  }
4547
4607
  __decorate([
4548
4608
  $mol_mem
@@ -4550,9 +4610,6 @@ var $;
4550
4610
  __decorate([
4551
4611
  $mol_mem
4552
4612
  ], $mol_plot_dot.prototype, "indexes", null);
4553
- __decorate([
4554
- $mol_mem
4555
- ], $mol_plot_dot.prototype, "dimensions", null);
4556
4613
  $$.$mol_plot_dot = $mol_plot_dot;
4557
4614
  })($$ = $.$$ || ($.$$ = {}));
4558
4615
  })($ || ($ = {}));