mol_plot_all 1.2.1010 → 1.2.1011

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
@@ -610,35 +610,24 @@ var $;
610
610
  "use strict";
611
611
  var $;
612
612
  (function ($) {
613
- class $mol_after_timeout extends $mol_object2 {
614
- delay;
613
+ class $mol_after_tick extends $mol_object2 {
615
614
  task;
616
- id;
617
- constructor(delay, task) {
615
+ promise;
616
+ cancelled = false;
617
+ constructor(task) {
618
618
  super();
619
- this.delay = delay;
620
619
  this.task = task;
621
- this.id = setTimeout(task, delay);
620
+ this.promise = Promise.resolve().then(() => {
621
+ if (this.cancelled)
622
+ return;
623
+ task();
624
+ });
622
625
  }
623
626
  destructor() {
624
- clearTimeout(this.id);
625
- }
626
- }
627
- $.$mol_after_timeout = $mol_after_timeout;
628
- })($ || ($ = {}));
629
-
630
- ;
631
- "use strict";
632
- var $;
633
- (function ($) {
634
- class $mol_after_frame extends $mol_after_timeout {
635
- task;
636
- constructor(task) {
637
- super(16, task);
638
- this.task = task;
627
+ this.cancelled = true;
639
628
  }
640
629
  }
641
- $.$mol_after_frame = $mol_after_frame;
630
+ $.$mol_after_tick = $mol_after_tick;
642
631
  })($ || ($ = {}));
643
632
 
644
633
  ;
@@ -666,7 +655,7 @@ var $;
666
655
  static plan() {
667
656
  if (this.plan_task)
668
657
  return;
669
- this.plan_task = new $mol_after_frame(() => {
658
+ this.plan_task = new $mol_after_tick(() => {
670
659
  try {
671
660
  this.sync();
672
661
  }
@@ -868,7 +857,7 @@ var $;
868
857
  sub.track_off(prev);
869
858
  sub.absorb = () => {
870
859
  done(null);
871
- sub.destructor();
860
+ setTimeout(() => sub.destructor());
872
861
  };
873
862
  });
874
863
  }
@@ -938,6 +927,41 @@ var $;
938
927
  $.$mol_key = $mol_key;
939
928
  })($ || ($ = {}));
940
929
 
930
+ ;
931
+ "use strict";
932
+ var $;
933
+ (function ($) {
934
+ class $mol_after_timeout extends $mol_object2 {
935
+ delay;
936
+ task;
937
+ id;
938
+ constructor(delay, task) {
939
+ super();
940
+ this.delay = delay;
941
+ this.task = task;
942
+ this.id = setTimeout(task, delay);
943
+ }
944
+ destructor() {
945
+ clearTimeout(this.id);
946
+ }
947
+ }
948
+ $.$mol_after_timeout = $mol_after_timeout;
949
+ })($ || ($ = {}));
950
+
951
+ ;
952
+ "use strict";
953
+ var $;
954
+ (function ($) {
955
+ class $mol_after_frame extends $mol_after_timeout {
956
+ task;
957
+ constructor(task) {
958
+ super(16, task);
959
+ this.task = task;
960
+ }
961
+ }
962
+ $.$mol_after_frame = $mol_after_frame;
963
+ })($ || ($ = {}));
964
+
941
965
  ;
942
966
  "use strict";
943
967
  var $;
@@ -2051,30 +2075,6 @@ var $;
2051
2075
  $.$mol_dom_context = new $node.jsdom.JSDOM('', { url: 'https://localhost/' }).window;
2052
2076
  })($ || ($ = {}));
2053
2077
 
2054
- ;
2055
- "use strict";
2056
- var $;
2057
- (function ($) {
2058
- class $mol_after_tick extends $mol_object2 {
2059
- task;
2060
- promise;
2061
- cancelled = false;
2062
- constructor(task) {
2063
- super();
2064
- this.task = task;
2065
- this.promise = Promise.resolve().then(() => {
2066
- if (this.cancelled)
2067
- return;
2068
- task();
2069
- });
2070
- }
2071
- destructor() {
2072
- this.cancelled = true;
2073
- }
2074
- }
2075
- $.$mol_after_tick = $mol_after_tick;
2076
- })($ || ($ = {}));
2077
-
2078
2078
  ;
2079
2079
  "use strict";
2080
2080
  var $;
@@ -2408,29 +2408,19 @@ var $;
2408
2408
  "use strict";
2409
2409
  var $;
2410
2410
  (function ($) {
2411
- let all = [];
2412
- let el = null;
2413
- let timer = null;
2414
- function $mol_style_attach_force() {
2415
- if (all.length) {
2416
- el.innerHTML += '\n' + all.join('\n\n');
2417
- all = [];
2418
- }
2419
- timer = null;
2420
- return el;
2421
- }
2422
- $.$mol_style_attach_force = $mol_style_attach_force;
2423
2411
  function $mol_style_attach(id, text) {
2424
- all.push(`/* ${id} */\n\n${text}`);
2425
- if (timer)
2426
- return el;
2427
2412
  const doc = $mol_dom_context.document;
2428
2413
  if (!doc)
2429
2414
  return null;
2430
- el = doc.createElement('style');
2431
- el.id = `$mol_style_attach`;
2432
- doc.head.appendChild(el);
2433
- timer = new $mol_after_tick($mol_style_attach_force);
2415
+ const elid = `$mol_style_attach:${id}`;
2416
+ let el = doc.getElementById(elid);
2417
+ if (!el) {
2418
+ el = doc.createElement('style');
2419
+ el.id = elid;
2420
+ doc.head.appendChild(el);
2421
+ }
2422
+ if (el.innerHTML != text)
2423
+ el.innerHTML = text;
2434
2424
  return el;
2435
2425
  }
2436
2426
  $.$mol_style_attach = $mol_style_attach;