mol_plot_all 1.2.1010 → 1.2.1012

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.mjs CHANGED
@@ -595,31 +595,14 @@ var $;
595
595
  "use strict";
596
596
  var $;
597
597
  (function ($) {
598
- class $mol_after_frame extends $mol_object2 {
598
+ class $mol_after_tick extends $mol_object2 {
599
599
  task;
600
- static _promise = null;
601
- static get promise() {
602
- if (this._promise)
603
- return this._promise;
604
- return this._promise = new Promise(done => {
605
- const complete = () => {
606
- this._promise = null;
607
- done();
608
- };
609
- if (typeof requestAnimationFrame === 'function') {
610
- requestAnimationFrame(complete);
611
- }
612
- else {
613
- setTimeout(complete, 16);
614
- }
615
- });
616
- }
617
- cancelled = false;
618
600
  promise;
601
+ cancelled = false;
619
602
  constructor(task) {
620
603
  super();
621
604
  this.task = task;
622
- this.promise = $mol_after_frame.promise.then(() => {
605
+ this.promise = Promise.resolve().then(() => {
623
606
  if (this.cancelled)
624
607
  return;
625
608
  task();
@@ -629,7 +612,7 @@ var $;
629
612
  this.cancelled = true;
630
613
  }
631
614
  }
632
- $.$mol_after_frame = $mol_after_frame;
615
+ $.$mol_after_tick = $mol_after_tick;
633
616
  })($ || ($ = {}));
634
617
 
635
618
  ;
@@ -657,7 +640,7 @@ var $;
657
640
  static plan() {
658
641
  if (this.plan_task)
659
642
  return;
660
- this.plan_task = new $mol_after_frame(() => {
643
+ this.plan_task = new $mol_after_tick(() => {
661
644
  try {
662
645
  this.sync();
663
646
  }
@@ -859,7 +842,7 @@ var $;
859
842
  sub.track_off(prev);
860
843
  sub.absorb = () => {
861
844
  done(null);
862
- sub.destructor();
845
+ setTimeout(() => sub.destructor());
863
846
  };
864
847
  });
865
848
  }
@@ -929,6 +912,47 @@ var $;
929
912
  $.$mol_key = $mol_key;
930
913
  })($ || ($ = {}));
931
914
 
915
+ ;
916
+ "use strict";
917
+ var $;
918
+ (function ($) {
919
+ class $mol_after_frame extends $mol_object2 {
920
+ task;
921
+ static _promise = null;
922
+ static get promise() {
923
+ if (this._promise)
924
+ return this._promise;
925
+ return this._promise = new Promise(done => {
926
+ const complete = () => {
927
+ this._promise = null;
928
+ done();
929
+ };
930
+ if (typeof requestAnimationFrame === 'function') {
931
+ requestAnimationFrame(complete);
932
+ }
933
+ else {
934
+ setTimeout(complete, 16);
935
+ }
936
+ });
937
+ }
938
+ cancelled = false;
939
+ promise;
940
+ constructor(task) {
941
+ super();
942
+ this.task = task;
943
+ this.promise = $mol_after_frame.promise.then(() => {
944
+ if (this.cancelled)
945
+ return;
946
+ task();
947
+ });
948
+ }
949
+ destructor() {
950
+ this.cancelled = true;
951
+ }
952
+ }
953
+ $.$mol_after_frame = $mol_after_frame;
954
+ })($ || ($ = {}));
955
+
932
956
  ;
933
957
  "use strict";
934
958
  var $;
@@ -1501,30 +1525,6 @@ var $;
1501
1525
  $.$mol_dom_context = self;
1502
1526
  })($ || ($ = {}));
1503
1527
 
1504
- ;
1505
- "use strict";
1506
- var $;
1507
- (function ($) {
1508
- class $mol_after_tick extends $mol_object2 {
1509
- task;
1510
- promise;
1511
- cancelled = false;
1512
- constructor(task) {
1513
- super();
1514
- this.task = task;
1515
- this.promise = Promise.resolve().then(() => {
1516
- if (this.cancelled)
1517
- return;
1518
- task();
1519
- });
1520
- }
1521
- destructor() {
1522
- this.cancelled = true;
1523
- }
1524
- }
1525
- $.$mol_after_tick = $mol_after_tick;
1526
- })($ || ($ = {}));
1527
-
1528
1528
  ;
1529
1529
  "use strict";
1530
1530
  var $;
@@ -1876,29 +1876,19 @@ var $;
1876
1876
  "use strict";
1877
1877
  var $;
1878
1878
  (function ($) {
1879
- let all = [];
1880
- let el = null;
1881
- let timer = null;
1882
- function $mol_style_attach_force() {
1883
- if (all.length) {
1884
- el.innerHTML += '\n' + all.join('\n\n');
1885
- all = [];
1886
- }
1887
- timer = null;
1888
- return el;
1889
- }
1890
- $.$mol_style_attach_force = $mol_style_attach_force;
1891
1879
  function $mol_style_attach(id, text) {
1892
- all.push(`/* ${id} */\n\n${text}`);
1893
- if (timer)
1894
- return el;
1895
1880
  const doc = $mol_dom_context.document;
1896
1881
  if (!doc)
1897
1882
  return null;
1898
- el = doc.createElement('style');
1899
- el.id = `$mol_style_attach`;
1900
- doc.head.appendChild(el);
1901
- timer = new $mol_after_tick($mol_style_attach_force);
1883
+ const elid = `$mol_style_attach:${id}`;
1884
+ let el = doc.getElementById(elid);
1885
+ if (!el) {
1886
+ el = doc.createElement('style');
1887
+ el.id = elid;
1888
+ doc.head.appendChild(el);
1889
+ }
1890
+ if (el.innerHTML != text)
1891
+ el.innerHTML = text;
1902
1892
  return el;
1903
1893
  }
1904
1894
  $.$mol_style_attach = $mol_style_attach;
package/web.test.js CHANGED
@@ -1066,7 +1066,7 @@ var $;
1066
1066
  var $;
1067
1067
  (function ($_1) {
1068
1068
  $mol_test_mocks.push($ => {
1069
- $.$mol_after_frame = $mol_after_mock_commmon;
1069
+ $.$mol_after_tick = $mol_after_mock_commmon;
1070
1070
  });
1071
1071
  })($ || ($ = {}));
1072
1072
 
@@ -1973,6 +1973,15 @@ var $;
1973
1973
  });
1974
1974
  })($ || ($ = {}));
1975
1975
 
1976
+ ;
1977
+ "use strict";
1978
+ var $;
1979
+ (function ($_1) {
1980
+ $mol_test_mocks.push($ => {
1981
+ $.$mol_after_frame = $mol_after_mock_commmon;
1982
+ });
1983
+ })($ || ($ = {}));
1984
+
1976
1985
  ;
1977
1986
  "use strict";
1978
1987
 
@@ -2056,15 +2065,6 @@ var $;
2056
2065
  $mol_wire_log.active();
2057
2066
  })($ || ($ = {}));
2058
2067
 
2059
- ;
2060
- "use strict";
2061
- var $;
2062
- (function ($_1) {
2063
- $mol_test_mocks.push($ => {
2064
- $.$mol_after_tick = $mol_after_mock_commmon;
2065
- });
2066
- })($ || ($ = {}));
2067
-
2068
2068
  ;
2069
2069
  "use strict";
2070
2070
  var $;