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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mol_tree2",
3
- "version": "1.0.694",
3
+ "version": "1.0.696",
4
4
  "exports": {
5
5
  "node": {
6
6
  "import": "./node.mjs",
package/web.test.js CHANGED
@@ -2234,31 +2234,14 @@ var $;
2234
2234
  "use strict";
2235
2235
  var $;
2236
2236
  (function ($) {
2237
- class $mol_after_frame extends $mol_object2 {
2237
+ class $mol_after_tick extends $mol_object2 {
2238
2238
  task;
2239
- static _promise = null;
2240
- static get promise() {
2241
- if (this._promise)
2242
- return this._promise;
2243
- return this._promise = new Promise(done => {
2244
- const complete = () => {
2245
- this._promise = null;
2246
- done();
2247
- };
2248
- if (typeof requestAnimationFrame === 'function') {
2249
- requestAnimationFrame(complete);
2250
- }
2251
- else {
2252
- setTimeout(complete, 16);
2253
- }
2254
- });
2255
- }
2256
- cancelled = false;
2257
2239
  promise;
2240
+ cancelled = false;
2258
2241
  constructor(task) {
2259
2242
  super();
2260
2243
  this.task = task;
2261
- this.promise = $mol_after_frame.promise.then(() => {
2244
+ this.promise = Promise.resolve().then(() => {
2262
2245
  if (this.cancelled)
2263
2246
  return;
2264
2247
  task();
@@ -2268,7 +2251,7 @@ var $;
2268
2251
  this.cancelled = true;
2269
2252
  }
2270
2253
  }
2271
- $.$mol_after_frame = $mol_after_frame;
2254
+ $.$mol_after_tick = $mol_after_tick;
2272
2255
  })($ || ($ = {}));
2273
2256
 
2274
2257
  ;
@@ -2276,7 +2259,7 @@ var $;
2276
2259
  var $;
2277
2260
  (function ($_1) {
2278
2261
  $mol_test_mocks.push($ => {
2279
- $.$mol_after_frame = $mol_after_mock_commmon;
2262
+ $.$mol_after_tick = $mol_after_mock_commmon;
2280
2263
  });
2281
2264
  })($ || ($ = {}));
2282
2265
 
@@ -2295,7 +2278,7 @@ var $;
2295
2278
  static plan() {
2296
2279
  if (this.plan_task)
2297
2280
  return;
2298
- this.plan_task = new $mol_after_frame(() => {
2281
+ this.plan_task = new $mol_after_tick(() => {
2299
2282
  try {
2300
2283
  this.sync();
2301
2284
  }
@@ -2497,7 +2480,7 @@ var $;
2497
2480
  sub.track_off(prev);
2498
2481
  sub.absorb = () => {
2499
2482
  done(null);
2500
- sub.destructor();
2483
+ setTimeout(() => sub.destructor());
2501
2484
  };
2502
2485
  });
2503
2486
  }
@@ -3700,6 +3683,56 @@ var $;
3700
3683
  });
3701
3684
  })($ || ($ = {}));
3702
3685
 
3686
+ ;
3687
+ "use strict";
3688
+ var $;
3689
+ (function ($) {
3690
+ class $mol_after_frame extends $mol_object2 {
3691
+ task;
3692
+ static _promise = null;
3693
+ static get promise() {
3694
+ if (this._promise)
3695
+ return this._promise;
3696
+ return this._promise = new Promise(done => {
3697
+ const complete = () => {
3698
+ this._promise = null;
3699
+ done();
3700
+ };
3701
+ if (typeof requestAnimationFrame === 'function') {
3702
+ requestAnimationFrame(complete);
3703
+ }
3704
+ else {
3705
+ setTimeout(complete, 16);
3706
+ }
3707
+ });
3708
+ }
3709
+ cancelled = false;
3710
+ promise;
3711
+ constructor(task) {
3712
+ super();
3713
+ this.task = task;
3714
+ this.promise = $mol_after_frame.promise.then(() => {
3715
+ if (this.cancelled)
3716
+ return;
3717
+ task();
3718
+ });
3719
+ }
3720
+ destructor() {
3721
+ this.cancelled = true;
3722
+ }
3723
+ }
3724
+ $.$mol_after_frame = $mol_after_frame;
3725
+ })($ || ($ = {}));
3726
+
3727
+ ;
3728
+ "use strict";
3729
+ var $;
3730
+ (function ($_1) {
3731
+ $mol_test_mocks.push($ => {
3732
+ $.$mol_after_frame = $mol_after_mock_commmon;
3733
+ });
3734
+ })($ || ($ = {}));
3735
+
3703
3736
  ;
3704
3737
  "use strict";
3705
3738
 
@@ -3973,39 +4006,6 @@ var $;
3973
4006
  self.addEventListener('resize', event => $mol_window.resizes(event));
3974
4007
  })($ || ($ = {}));
3975
4008
 
3976
- ;
3977
- "use strict";
3978
- var $;
3979
- (function ($) {
3980
- class $mol_after_tick extends $mol_object2 {
3981
- task;
3982
- promise;
3983
- cancelled = false;
3984
- constructor(task) {
3985
- super();
3986
- this.task = task;
3987
- this.promise = Promise.resolve().then(() => {
3988
- if (this.cancelled)
3989
- return;
3990
- task();
3991
- });
3992
- }
3993
- destructor() {
3994
- this.cancelled = true;
3995
- }
3996
- }
3997
- $.$mol_after_tick = $mol_after_tick;
3998
- })($ || ($ = {}));
3999
-
4000
- ;
4001
- "use strict";
4002
- var $;
4003
- (function ($_1) {
4004
- $mol_test_mocks.push($ => {
4005
- $.$mol_after_tick = $mol_after_mock_commmon;
4006
- });
4007
- })($ || ($ = {}));
4008
-
4009
4009
  ;
4010
4010
  "use strict";
4011
4011
  var $;
@@ -4424,29 +4424,19 @@ var $;
4424
4424
  "use strict";
4425
4425
  var $;
4426
4426
  (function ($) {
4427
- let all = [];
4428
- let el = null;
4429
- let timer = null;
4430
- function $mol_style_attach_force() {
4431
- if (all.length) {
4432
- el.innerHTML += '\n' + all.join('\n\n');
4433
- all = [];
4434
- }
4435
- timer = null;
4436
- return el;
4437
- }
4438
- $.$mol_style_attach_force = $mol_style_attach_force;
4439
4427
  function $mol_style_attach(id, text) {
4440
- all.push(`/* ${id} */\n\n${text}`);
4441
- if (timer)
4442
- return el;
4443
4428
  const doc = $mol_dom_context.document;
4444
4429
  if (!doc)
4445
4430
  return null;
4446
- el = doc.createElement('style');
4447
- el.id = `$mol_style_attach`;
4448
- doc.head.appendChild(el);
4449
- timer = new $mol_after_tick($mol_style_attach_force);
4431
+ const elid = `$mol_style_attach:${id}`;
4432
+ let el = doc.getElementById(elid);
4433
+ if (!el) {
4434
+ el = doc.createElement('style');
4435
+ el.id = elid;
4436
+ doc.head.appendChild(el);
4437
+ }
4438
+ if (el.innerHTML != text)
4439
+ el.innerHTML = text;
4450
4440
  return el;
4451
4441
  }
4452
4442
  $.$mol_style_attach = $mol_style_attach;