mol_plot_all 1.2.1216 → 1.2.1218

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
@@ -653,7 +653,7 @@ var $;
653
653
  "use strict";
654
654
  var $;
655
655
  (function ($) {
656
- const handled = new WeakSet();
656
+ const wrappers = new WeakMap();
657
657
  class $mol_wire_fiber extends $mol_wire_pub_sub {
658
658
  task;
659
659
  host;
@@ -788,14 +788,21 @@ var $;
788
788
  result = this.task.call(this.host, ...this.args);
789
789
  break;
790
790
  }
791
- if ($mol_promise_like(result) && !handled.has(result)) {
792
- handled.add(result);
793
- const put = (res) => {
794
- if (this.cache === result)
795
- this.put(res);
796
- return res;
797
- };
798
- result = Object.assign(result.then(put, put), { destructor: result.destructor });
791
+ if ($mol_promise_like(result)) {
792
+ if (wrappers.has(result)) {
793
+ result = wrappers.get(result).then(a => a);
794
+ }
795
+ else {
796
+ const put = (res) => {
797
+ if (this.cache === result)
798
+ this.put(res);
799
+ return res;
800
+ };
801
+ wrappers.set(result, result = Object.assign(result.then(put, put), { destructor: result.destructor || (() => { }) }));
802
+ wrappers.set(result, result);
803
+ const error = new Error(`Promise in ${this}`);
804
+ Object.defineProperty(result, 'stack', { get: () => error.stack });
805
+ }
799
806
  }
800
807
  }
801
808
  catch (error) {
@@ -805,22 +812,20 @@ var $;
805
812
  else {
806
813
  result = new Error(String(error), { cause: error });
807
814
  }
808
- if ($mol_promise_like(result) && !handled.has(result)) {
809
- handled.add(result);
810
- result = Object.assign(result.finally(() => {
811
- if (this.cache === result)
812
- this.absorb();
813
- }), { destructor: result.destructor });
815
+ if ($mol_promise_like(result)) {
816
+ if (wrappers.has(result)) {
817
+ result = wrappers.get(result);
818
+ }
819
+ else {
820
+ wrappers.set(result, result = Object.assign(result.finally(() => {
821
+ if (this.cache === result)
822
+ this.absorb();
823
+ }), { destructor: result.destructor || (() => { }) }));
824
+ const error = new Error(`Promise in ${this}`);
825
+ Object.defineProperty(result, 'stack', { get: () => error.stack });
826
+ }
814
827
  }
815
828
  }
816
- if ($mol_promise_like(result) && !handled.has(result)) {
817
- result = Object.assign(result, {
818
- destructor: result['destructor'] ?? (() => { })
819
- });
820
- handled.add(result);
821
- const error = new Error(`Promise in ${this}`);
822
- Object.defineProperty(result, 'stack', { get: () => error.stack });
823
- }
824
829
  if (!$mol_promise_like(result)) {
825
830
  this.track_cut();
826
831
  }
@@ -880,6 +885,12 @@ var $;
880
885
  };
881
886
  });
882
887
  }
888
+ destructor() {
889
+ super.destructor();
890
+ if ($mol_owning_check(this, this.cache)) {
891
+ this.cache.destructor();
892
+ }
893
+ }
883
894
  }
884
895
  $.$mol_wire_fiber = $mol_wire_fiber;
885
896
  })($ || ($ = {}));
@@ -904,6 +915,7 @@ var $;
904
915
  var $;
905
916
  (function ($) {
906
917
  $.$mol_key_store = new WeakMap();
918
+ const TypedArray = Object.getPrototypeOf(Uint8Array);
907
919
  function $mol_key(value) {
908
920
  if (typeof value === 'bigint')
909
921
  return value.toString() + 'n';
@@ -933,7 +945,7 @@ var $;
933
945
  return value;
934
946
  if (value instanceof RegExp)
935
947
  return value.toString();
936
- if (value instanceof Uint8Array)
948
+ if (value instanceof TypedArray)
937
949
  return [...value];
938
950
  let key = $.$mol_key_store.get(value);
939
951
  if (key)
@@ -1664,7 +1676,8 @@ var $;
1664
1676
  $$.$mol_log3_warn({
1665
1677
  place: '$mol_wire_task',
1666
1678
  message: `Non idempotency`,
1667
- existen,
1679
+ sub,
1680
+ pubs: [...sub?.pub_list ?? [], existen],
1668
1681
  next,
1669
1682
  hint: 'Ignore it',
1670
1683
  });
@@ -1687,6 +1700,14 @@ var $;
1687
1700
  this.cursor = $mol_wire_cursor.fresh;
1688
1701
  if (next !== prev)
1689
1702
  this.emit();
1703
+ if ($mol_owning_catch(this, next)) {
1704
+ try {
1705
+ next[Symbol.toStringTag] = this[Symbol.toStringTag];
1706
+ }
1707
+ catch {
1708
+ Object.defineProperty(next, Symbol.toStringTag, { value: this[Symbol.toStringTag] });
1709
+ }
1710
+ }
1690
1711
  return next;
1691
1712
  }
1692
1713
  this.cursor = $mol_wire_cursor.final;
@@ -1841,10 +1862,6 @@ var $;
1841
1862
  }
1842
1863
  destructor() {
1843
1864
  super.destructor();
1844
- const prev = this.cache;
1845
- if ($mol_owning_check(this, prev)) {
1846
- prev.destructor();
1847
- }
1848
1865
  if (this.pub_from === 0) {
1849
1866
  ;
1850
1867
  (this.host ?? this.task)[this.field()] = null;
@@ -2319,13 +2336,15 @@ var $;
2319
2336
  class $mol_memo extends $mol_wrapper {
2320
2337
  static wrap(task) {
2321
2338
  const store = new WeakMap();
2322
- return function (next) {
2339
+ const fun = function (next) {
2323
2340
  if (next === undefined && store.has(this))
2324
2341
  return store.get(this);
2325
2342
  const val = task.call(this, next) ?? next;
2326
2343
  store.set(this, val);
2327
2344
  return val;
2328
2345
  };
2346
+ Reflect.defineProperty(fun, 'name', { value: task.name + ' ' });
2347
+ return fun;
2329
2348
  }
2330
2349
  }
2331
2350
  $.$mol_memo = $mol_memo;
@@ -3162,7 +3181,6 @@ var $;
3162
3181
  const win = this.$.$mol_dom_context;
3163
3182
  if (win.parent !== win.self && !win.document.hasFocus())
3164
3183
  return;
3165
- this.focused(true);
3166
3184
  }
3167
3185
  destructor() {
3168
3186
  const node = $mol_wire_probe(() => this.dom_node());