mol_tree2 1.0.694 → 1.0.696

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.test.js CHANGED
@@ -4450,44 +4450,24 @@ var $;
4450
4450
  "use strict";
4451
4451
  var $;
4452
4452
  (function ($) {
4453
- class $mol_after_timeout extends $mol_object2 {
4454
- delay;
4453
+ class $mol_after_tick extends $mol_object2 {
4455
4454
  task;
4456
- id;
4457
- constructor(delay, task) {
4455
+ promise;
4456
+ cancelled = false;
4457
+ constructor(task) {
4458
4458
  super();
4459
- this.delay = delay;
4460
4459
  this.task = task;
4461
- this.id = setTimeout(task, delay);
4460
+ this.promise = Promise.resolve().then(() => {
4461
+ if (this.cancelled)
4462
+ return;
4463
+ task();
4464
+ });
4462
4465
  }
4463
4466
  destructor() {
4464
- clearTimeout(this.id);
4465
- }
4466
- }
4467
- $.$mol_after_timeout = $mol_after_timeout;
4468
- })($ || ($ = {}));
4469
-
4470
- ;
4471
- "use strict";
4472
- var $;
4473
- (function ($_1) {
4474
- $mol_test_mocks.push($ => {
4475
- $.$mol_after_timeout = $mol_after_mock_timeout;
4476
- });
4477
- })($ || ($ = {}));
4478
-
4479
- ;
4480
- "use strict";
4481
- var $;
4482
- (function ($) {
4483
- class $mol_after_frame extends $mol_after_timeout {
4484
- task;
4485
- constructor(task) {
4486
- super(16, task);
4487
- this.task = task;
4467
+ this.cancelled = true;
4488
4468
  }
4489
4469
  }
4490
- $.$mol_after_frame = $mol_after_frame;
4470
+ $.$mol_after_tick = $mol_after_tick;
4491
4471
  })($ || ($ = {}));
4492
4472
 
4493
4473
  ;
@@ -4495,7 +4475,7 @@ var $;
4495
4475
  var $;
4496
4476
  (function ($_1) {
4497
4477
  $mol_test_mocks.push($ => {
4498
- $.$mol_after_frame = $mol_after_mock_commmon;
4478
+ $.$mol_after_tick = $mol_after_mock_commmon;
4499
4479
  });
4500
4480
  })($ || ($ = {}));
4501
4481
 
@@ -4514,7 +4494,7 @@ var $;
4514
4494
  static plan() {
4515
4495
  if (this.plan_task)
4516
4496
  return;
4517
- this.plan_task = new $mol_after_frame(() => {
4497
+ this.plan_task = new $mol_after_tick(() => {
4518
4498
  try {
4519
4499
  this.sync();
4520
4500
  }
@@ -4716,7 +4696,7 @@ var $;
4716
4696
  sub.track_off(prev);
4717
4697
  sub.absorb = () => {
4718
4698
  done(null);
4719
- sub.destructor();
4699
+ setTimeout(() => sub.destructor());
4720
4700
  };
4721
4701
  });
4722
4702
  }
@@ -4918,6 +4898,36 @@ var $;
4918
4898
  $.$mol_promise = $mol_promise;
4919
4899
  })($ || ($ = {}));
4920
4900
 
4901
+ ;
4902
+ "use strict";
4903
+ var $;
4904
+ (function ($) {
4905
+ class $mol_after_timeout extends $mol_object2 {
4906
+ delay;
4907
+ task;
4908
+ id;
4909
+ constructor(delay, task) {
4910
+ super();
4911
+ this.delay = delay;
4912
+ this.task = task;
4913
+ this.id = setTimeout(task, delay);
4914
+ }
4915
+ destructor() {
4916
+ clearTimeout(this.id);
4917
+ }
4918
+ }
4919
+ $.$mol_after_timeout = $mol_after_timeout;
4920
+ })($ || ($ = {}));
4921
+
4922
+ ;
4923
+ "use strict";
4924
+ var $;
4925
+ (function ($_1) {
4926
+ $mol_test_mocks.push($ => {
4927
+ $.$mol_after_timeout = $mol_after_mock_timeout;
4928
+ });
4929
+ })($ || ($ = {}));
4930
+
4921
4931
  ;
4922
4932
  "use strict";
4923
4933
  var $;
@@ -5781,39 +5791,6 @@ var $;
5781
5791
  $.$mol_mem_key = $mol_wire_plex;
5782
5792
  })($ || ($ = {}));
5783
5793
 
5784
- ;
5785
- "use strict";
5786
- var $;
5787
- (function ($) {
5788
- class $mol_after_tick extends $mol_object2 {
5789
- task;
5790
- promise;
5791
- cancelled = false;
5792
- constructor(task) {
5793
- super();
5794
- this.task = task;
5795
- this.promise = Promise.resolve().then(() => {
5796
- if (this.cancelled)
5797
- return;
5798
- task();
5799
- });
5800
- }
5801
- destructor() {
5802
- this.cancelled = true;
5803
- }
5804
- }
5805
- $.$mol_after_tick = $mol_after_tick;
5806
- })($ || ($ = {}));
5807
-
5808
- ;
5809
- "use strict";
5810
- var $;
5811
- (function ($_1) {
5812
- $mol_test_mocks.push($ => {
5813
- $.$mol_after_tick = $mol_after_mock_commmon;
5814
- });
5815
- })($ || ($ = {}));
5816
-
5817
5794
  ;
5818
5795
  "use strict";
5819
5796
  var $;
@@ -6162,6 +6139,29 @@ var $;
6162
6139
  });
6163
6140
  })($ || ($ = {}));
6164
6141
 
6142
+ ;
6143
+ "use strict";
6144
+ var $;
6145
+ (function ($) {
6146
+ class $mol_after_frame extends $mol_after_timeout {
6147
+ task;
6148
+ constructor(task) {
6149
+ super(16, task);
6150
+ this.task = task;
6151
+ }
6152
+ }
6153
+ $.$mol_after_frame = $mol_after_frame;
6154
+ })($ || ($ = {}));
6155
+
6156
+ ;
6157
+ "use strict";
6158
+ var $;
6159
+ (function ($_1) {
6160
+ $mol_test_mocks.push($ => {
6161
+ $.$mol_after_frame = $mol_after_mock_commmon;
6162
+ });
6163
+ })($ || ($ = {}));
6164
+
6165
6165
  ;
6166
6166
  "use strict";
6167
6167
 
@@ -6518,29 +6518,19 @@ var $;
6518
6518
  "use strict";
6519
6519
  var $;
6520
6520
  (function ($) {
6521
- let all = [];
6522
- let el = null;
6523
- let timer = null;
6524
- function $mol_style_attach_force() {
6525
- if (all.length) {
6526
- el.innerHTML += '\n' + all.join('\n\n');
6527
- all = [];
6528
- }
6529
- timer = null;
6530
- return el;
6531
- }
6532
- $.$mol_style_attach_force = $mol_style_attach_force;
6533
6521
  function $mol_style_attach(id, text) {
6534
- all.push(`/* ${id} */\n\n${text}`);
6535
- if (timer)
6536
- return el;
6537
6522
  const doc = $mol_dom_context.document;
6538
6523
  if (!doc)
6539
6524
  return null;
6540
- el = doc.createElement('style');
6541
- el.id = `$mol_style_attach`;
6542
- doc.head.appendChild(el);
6543
- timer = new $mol_after_tick($mol_style_attach_force);
6525
+ const elid = `$mol_style_attach:${id}`;
6526
+ let el = doc.getElementById(elid);
6527
+ if (!el) {
6528
+ el = doc.createElement('style');
6529
+ el.id = elid;
6530
+ doc.head.appendChild(el);
6531
+ }
6532
+ if (el.innerHTML != text)
6533
+ el.innerHTML = text;
6544
6534
  return el;
6545
6535
  }
6546
6536
  $.$mol_style_attach = $mol_style_attach;