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/web.js CHANGED
@@ -468,7 +468,7 @@ var $;
468
468
  promote() {
469
469
  $mol_wire_auto()?.track_next(this);
470
470
  }
471
- refresh() { }
471
+ fresh() { }
472
472
  complete() { }
473
473
  emit(quant = $mol_wire_cursor.stale) {
474
474
  for (let i = this.sub_from; i < this.data.length; i += 2) {
@@ -671,7 +671,7 @@ var $;
671
671
  }
672
672
  for (let cursor = this.pub_from; cursor < this.cursor; cursor += 2) {
673
673
  const pub = this.data[cursor];
674
- pub.refresh();
674
+ pub.fresh();
675
675
  }
676
676
  this.cursor = $mol_wire_cursor.fresh;
677
677
  }
@@ -747,18 +747,20 @@ var $;
747
747
  class $mol_after_frame extends $mol_object2 {
748
748
  task;
749
749
  static _promise = null;
750
- static _timeout = null;
751
750
  static get promise() {
752
751
  if (this._promise)
753
752
  return this._promise;
754
753
  return this._promise = new Promise(done => {
755
754
  const complete = () => {
756
755
  this._promise = null;
757
- clearTimeout(this._timeout);
758
756
  done();
759
757
  };
760
- requestAnimationFrame(complete);
761
- this._timeout = setTimeout(complete, 100);
758
+ if (typeof requestAnimationFrame === 'function') {
759
+ requestAnimationFrame(complete);
760
+ }
761
+ else {
762
+ setTimeout(complete, 16);
763
+ }
762
764
  });
763
765
  }
764
766
  cancelled = false;
@@ -811,7 +813,7 @@ var $;
811
813
  continue;
812
814
  if (fiber.cursor === $mol_wire_cursor.final)
813
815
  continue;
814
- fiber.refresh();
816
+ fiber.fresh();
815
817
  }
816
818
  }
817
819
  while (this.reaping.size) {
@@ -879,7 +881,7 @@ var $;
879
881
  else
880
882
  super.emit(quant);
881
883
  }
882
- refresh() {
884
+ fresh() {
883
885
  if (this.cursor === $mol_wire_cursor.fresh)
884
886
  return;
885
887
  if (this.cursor === $mol_wire_cursor.final)
@@ -887,7 +889,7 @@ var $;
887
889
  check: if (this.cursor === $mol_wire_cursor.doubt) {
888
890
  for (let i = this.pub_from; i < this.sub_from; i += 2) {
889
891
  ;
890
- this.data[i]?.refresh();
892
+ this.data[i]?.fresh();
891
893
  if (this.cursor !== $mol_wire_cursor.doubt)
892
894
  break check;
893
895
  }
@@ -943,12 +945,16 @@ var $;
943
945
  this.track_off(bu);
944
946
  this.put(result);
945
947
  }
948
+ refresh() {
949
+ this.cursor = $mol_wire_cursor.stale;
950
+ this.fresh();
951
+ }
946
952
  sync() {
947
953
  if (!$mol_wire_fiber.warm) {
948
954
  return this.result();
949
955
  }
950
956
  this.promote();
951
- this.refresh();
957
+ this.fresh();
952
958
  if (this.cache instanceof Error) {
953
959
  return $mol_fail_hidden(this.cache);
954
960
  }
@@ -959,7 +965,7 @@ var $;
959
965
  }
960
966
  async async() {
961
967
  while (true) {
962
- this.refresh();
968
+ this.fresh();
963
969
  if (this.cache instanceof Error) {
964
970
  $mol_fail_hidden(this.cache);
965
971
  }
@@ -1261,6 +1267,22 @@ var $;
1261
1267
  };
1262
1268
  }
1263
1269
  }
1270
+ static watching = new Set();
1271
+ static watch() {
1272
+ new $mol_after_frame($mol_wire_atom.watch);
1273
+ for (const atom of $mol_wire_atom.watching) {
1274
+ if (atom.cursor === $mol_wire_cursor.final) {
1275
+ $mol_wire_atom.watching.delete(atom);
1276
+ }
1277
+ else {
1278
+ atom.cursor = $mol_wire_cursor.stale;
1279
+ atom.fresh();
1280
+ }
1281
+ }
1282
+ }
1283
+ watch() {
1284
+ $mol_wire_atom.watching.add(this);
1285
+ }
1264
1286
  resync(args) {
1265
1287
  return this.put(this.task.call(this.host, ...args));
1266
1288
  }
@@ -1315,6 +1337,7 @@ var $;
1315
1337
  $mol_wire_method
1316
1338
  ], $mol_wire_atom.prototype, "once", null);
1317
1339
  $.$mol_wire_atom = $mol_wire_atom;
1340
+ $mol_wire_atom.watch();
1318
1341
  })($ || ($ = {}));
1319
1342
  //mol/wire/atom/atom.ts
1320
1343
  ;
@@ -1549,6 +1572,22 @@ var $;
1549
1572
  ;
1550
1573
  "use strict";
1551
1574
  var $;
1575
+ (function ($) {
1576
+ function $mol_wire_watch() {
1577
+ const atom = $mol_wire_auto();
1578
+ if (atom instanceof $mol_wire_atom) {
1579
+ atom.watch();
1580
+ }
1581
+ else {
1582
+ $mol_fail(new Error('Atom is equired for watching'));
1583
+ }
1584
+ }
1585
+ $.$mol_wire_watch = $mol_wire_watch;
1586
+ })($ || ($ = {}));
1587
+ //mol/wire/watch/watch.ts
1588
+ ;
1589
+ "use strict";
1590
+ var $;
1552
1591
  (function ($) {
1553
1592
  function $mol_const(value) {
1554
1593
  var getter = (() => value);
@@ -1831,15 +1870,9 @@ var $;
1831
1870
  }
1832
1871
  static watchers = new Set();
1833
1872
  view_rect() {
1834
- this.view_rect_watcher();
1835
- return this.view_rect_cache();
1836
- }
1837
- view_rect_cache(next = null) {
1838
- return next;
1839
- }
1840
- view_rect_watcher() {
1841
- $mol_view.watchers.add(this);
1842
- return { destructor: () => $mol_view.watchers.delete(this) };
1873
+ $mol_wire_watch();
1874
+ const { width, height, left, right, top, bottom } = this.dom_node().getBoundingClientRect();
1875
+ return { width, height, left, right, top, bottom };
1843
1876
  }
1844
1877
  dom_id() {
1845
1878
  return this.toString();
@@ -2056,12 +2089,6 @@ var $;
2056
2089
  __decorate([
2057
2090
  $mol_mem
2058
2091
  ], $mol_view.prototype, "view_rect", null);
2059
- __decorate([
2060
- $mol_mem
2061
- ], $mol_view.prototype, "view_rect_cache", null);
2062
- __decorate([
2063
- $mol_mem
2064
- ], $mol_view.prototype, "view_rect_watcher", null);
2065
2092
  __decorate([
2066
2093
  $mol_mem
2067
2094
  ], $mol_view.prototype, "dom_node", null);
@@ -2108,22 +2135,6 @@ var $;
2108
2135
  (function ($) {
2109
2136
  if ($mol_dom_context.document) {
2110
2137
  setTimeout(() => $mol_view.autobind());
2111
- function $mol_view_watch() {
2112
- new $mol_after_frame($mol_view_watch);
2113
- for (const view of $mol_view.watchers) {
2114
- const prev = view.view_rect_cache();
2115
- const next = view.dom_node().getBoundingClientRect();
2116
- if (next.left === 0 && next.right === 0 && next.width === 0) {
2117
- if (prev)
2118
- view.view_rect_cache(null);
2119
- continue;
2120
- }
2121
- if (!prev || prev.x !== next.x || prev.y !== next.y || prev.width !== next.width || prev.height !== next.height) {
2122
- view.view_rect_cache(next);
2123
- }
2124
- }
2125
- }
2126
- $mol_view_watch();
2127
2138
  }
2128
2139
  })($ || ($ = {}));
2129
2140
  //mol/view/view/view.web.ts
@@ -3679,14 +3690,12 @@ var $;
3679
3690
  const size_real = this.size_real();
3680
3691
  const max_x = (viewport.x.max - viewport.x.min) / size_real.x;
3681
3692
  const max_y = (viewport.y.max - viewport.y.min) / size_real.y;
3682
- return this.graphs().filter(graph => {
3693
+ return this.graphs_positioned().filter(graph => {
3683
3694
  const dims = graph.dimensions();
3684
3695
  if (dims.x.min > dims.x.max)
3685
3696
  return true;
3686
3697
  if (dims.y.min > dims.y.max)
3687
3698
  return true;
3688
- if (dims.x.max - dims.x.min < max_x && dims.y.max - dims.y.min < max_y)
3689
- return false;
3690
3699
  if (dims.x.min > viewport.x.max)
3691
3700
  return false;
3692
3701
  if (dims.x.max < viewport.x.min)
@@ -3699,7 +3708,7 @@ var $;
3699
3708
  });
3700
3709
  }
3701
3710
  graphs_positioned() {
3702
- const graphs = this.graphs_visible();
3711
+ const graphs = this.graphs();
3703
3712
  for (let graph of graphs) {
3704
3713
  graph.shift = () => this.shift();
3705
3714
  graph.scale = () => this.scale();
@@ -4147,12 +4156,6 @@ var $;
4147
4156
  const size_x = Math.max(0, Math.ceil((1 / aspect - 1) * diameter));
4148
4157
  return points.map(point => `M ${point[0] - shift_x} ${point[1] - shift_y} l ${size_x} ${size_y}`).join(' ');
4149
4158
  }
4150
- dimensions() {
4151
- const scale = this.scale();
4152
- const radius = this.diameter() / Math.min(...scale) / 2;
4153
- const dims = super.dimensions();
4154
- 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));
4155
- }
4156
4159
  }
4157
4160
  __decorate([
4158
4161
  $mol_mem
@@ -4160,9 +4163,6 @@ var $;
4160
4163
  __decorate([
4161
4164
  $mol_mem
4162
4165
  ], $mol_plot_dot.prototype, "indexes", null);
4163
- __decorate([
4164
- $mol_mem
4165
- ], $mol_plot_dot.prototype, "dimensions", null);
4166
4166
  $$.$mol_plot_dot = $mol_plot_dot;
4167
4167
  })($$ = $.$$ || ($.$$ = {}));
4168
4168
  })($ || ($ = {}));