mol_jsx_lib 0.0.39 → 0.0.42

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
@@ -1218,9 +1218,12 @@ var $;
1218
1218
  }
1219
1219
  static sync() {
1220
1220
  while (this.planning.size) {
1221
- const fibers = this.planning;
1222
- this.planning = new Set;
1223
- for (const fiber of fibers) {
1221
+ for (const fiber of this.planning) {
1222
+ this.planning.delete(fiber);
1223
+ if (fiber.cursor >= 0)
1224
+ continue;
1225
+ if (fiber.cursor === $mol_wire_cursor.final)
1226
+ continue;
1224
1227
  fiber.refresh();
1225
1228
  }
1226
1229
  }
@@ -1248,12 +1251,13 @@ var $;
1248
1251
  field() {
1249
1252
  return this.task.name + '()';
1250
1253
  }
1251
- constructor(id, task, host, ...args) {
1254
+ constructor(id, task, host, args) {
1252
1255
  super();
1253
1256
  this.task = task;
1254
1257
  this.host = host;
1255
- this.data.push(...args);
1256
- this.pub_from = this.sub_from = args.length;
1258
+ if (args)
1259
+ this.data.push(...args);
1260
+ this.pub_from = this.sub_from = args?.length ?? 0;
1257
1261
  this[Symbol.toStringTag] = id;
1258
1262
  }
1259
1263
  plan() {
@@ -1314,7 +1318,7 @@ var $;
1314
1318
  result = this.task.call(this.host, this.data[0]);
1315
1319
  break;
1316
1320
  default:
1317
- result = this.task.call(this.host, ...this.data.slice(0, this.pub_from));
1321
+ result = this.task.call(this.host, ...this.args);
1318
1322
  break;
1319
1323
  }
1320
1324
  if (result instanceof Promise) {
@@ -1580,7 +1584,7 @@ var $;
1580
1584
  break reuse;
1581
1585
  return existen;
1582
1586
  }
1583
- return new $mol_wire_task(`${host?.[Symbol.toStringTag] ?? host}.${task.name}(#)`, task, host, ...args);
1587
+ return new $mol_wire_task(`${host?.[Symbol.toStringTag] ?? host}.${task.name}(#)`, task, host, args);
1584
1588
  };
1585
1589
  }
1586
1590
  complete() {
@@ -1653,7 +1657,7 @@ var $;
1653
1657
  else {
1654
1658
  dict = (host ?? task)[field] = new Map();
1655
1659
  }
1656
- fiber = new $mol_wire_atom(key, task, host, ...args);
1660
+ fiber = new $mol_wire_atom(key, task, host, args);
1657
1661
  dict.set(key, fiber);
1658
1662
  return fiber;
1659
1663
  };
@@ -1664,33 +1668,14 @@ var $;
1664
1668
  if (existen)
1665
1669
  return existen;
1666
1670
  const key = `${host?.[Symbol.toStringTag] ?? host}.${field}`;
1667
- const fiber = new $mol_wire_atom(key, task, host, ...args);
1671
+ const fiber = new $mol_wire_atom(key, task, host, args);
1668
1672
  (host ?? task)[field] = fiber;
1669
1673
  return fiber;
1670
1674
  };
1671
1675
  }
1672
1676
  }
1673
- resync(...args) {
1674
- let res;
1675
- try {
1676
- res = this.recall(...args);
1677
- }
1678
- catch (error) {
1679
- if (error instanceof Promise)
1680
- $mol_fail_hidden(error);
1681
- res = error;
1682
- }
1683
- try {
1684
- this.once();
1685
- }
1686
- catch (error) {
1687
- if (error instanceof Promise)
1688
- $mol_fail_hidden(error);
1689
- }
1690
- return this.put(res);
1691
- }
1692
- recall(...args) {
1693
- return this.task.call(this.host, ...args);
1677
+ resync(args) {
1678
+ return this.put(this.task.call(this.host, ...args));
1694
1679
  }
1695
1680
  once() {
1696
1681
  return this.sync();
@@ -1739,9 +1724,6 @@ var $;
1739
1724
  __decorate([
1740
1725
  $mol_wire_method
1741
1726
  ], $mol_wire_atom.prototype, "resync", null);
1742
- __decorate([
1743
- $mol_wire_method
1744
- ], $mol_wire_atom.prototype, "recall", null);
1745
1727
  __decorate([
1746
1728
  $mol_wire_method
1747
1729
  ], $mol_wire_atom.prototype, "once", null);
@@ -1778,7 +1760,7 @@ var $;
1778
1760
  let atom = persist(this, args.slice(0, keys));
1779
1761
  if (args.length <= keys || args[keys] === undefined) {
1780
1762
  if (!$mol_wire_fiber.warm)
1781
- return atom.sync();
1763
+ return atom.result();
1782
1764
  if ($mol_wire_auto() instanceof $mol_wire_task) {
1783
1765
  return atom.once();
1784
1766
  }
@@ -1786,7 +1768,7 @@ var $;
1786
1768
  return atom.sync();
1787
1769
  }
1788
1770
  }
1789
- return atom.resync(...args);
1771
+ return atom.resync(args);
1790
1772
  };
1791
1773
  Object.defineProperty(wrapper, 'name', { value: func.name + ' ' });
1792
1774
  Object.assign(wrapper, { orig: func });
@@ -2943,33 +2925,6 @@ var $;
2943
2925
  ], App, "test", null);
2944
2926
  App.test();
2945
2927
  },
2946
- 'Update deps on push'($) {
2947
- class App extends $mol_object2 {
2948
- static $ = $;
2949
- static left(next = false) {
2950
- return next;
2951
- }
2952
- static right(next = false) {
2953
- return next;
2954
- }
2955
- static res(next) {
2956
- return this.left(next) && this.right();
2957
- }
2958
- }
2959
- __decorate([
2960
- $mol_wire_mem(0)
2961
- ], App, "left", null);
2962
- __decorate([
2963
- $mol_wire_mem(0)
2964
- ], App, "right", null);
2965
- __decorate([
2966
- $mol_wire_mem(0)
2967
- ], App, "res", null);
2968
- $mol_assert_equal(App.res(), false);
2969
- $mol_assert_equal(App.res(true), false);
2970
- $mol_assert_equal(App.right(true), true);
2971
- $mol_assert_equal(App.res(), true);
2972
- },
2973
2928
  'Different order of pull and push'($) {
2974
2929
  class App extends $mol_object2 {
2975
2930
  static $ = $;
@@ -2980,6 +2935,8 @@ var $;
2980
2935
  return this.store(next);
2981
2936
  }
2982
2937
  static slow(next) {
2938
+ if (next !== undefined)
2939
+ this.slow();
2983
2940
  return this.store(next);
2984
2941
  }
2985
2942
  }