mol_jsx_lib 0.0.299 → 0.0.301

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
@@ -1768,6 +1768,12 @@ var $;
1768
1768
  //mol/wire/method/method.ts
1769
1769
  ;
1770
1770
  "use strict";
1771
+ //mol/type/tail/tail.ts
1772
+ ;
1773
+ "use strict";
1774
+ //mol/type/foot/foot.ts
1775
+ ;
1776
+ "use strict";
1771
1777
  var $;
1772
1778
  (function ($) {
1773
1779
  class $mol_wire_atom extends $mol_wire_fiber {
@@ -1821,6 +1827,20 @@ var $;
1821
1827
  once() {
1822
1828
  return this.sync();
1823
1829
  }
1830
+ channel() {
1831
+ return Object.assign((next) => {
1832
+ if (next !== undefined)
1833
+ return this.resync([...this.args, next]);
1834
+ if (!$mol_wire_fiber.warm)
1835
+ return this.result();
1836
+ if ($mol_wire_auto() instanceof $mol_wire_task) {
1837
+ return this.once();
1838
+ }
1839
+ else {
1840
+ return this.sync();
1841
+ }
1842
+ }, { atom: this });
1843
+ }
1824
1844
  destructor() {
1825
1845
  super.destructor();
1826
1846
  const prev = this.cache;
@@ -1909,9 +1929,6 @@ var $;
1909
1929
  //mol/wire/field/field.ts
1910
1930
  ;
1911
1931
  "use strict";
1912
- //mol/type/tail/tail.ts
1913
- ;
1914
- "use strict";
1915
1932
  var $;
1916
1933
  (function ($) {
1917
1934
  function $mol_wire_solo(host, field, descr) {
@@ -2266,6 +2283,22 @@ var $;
2266
2283
  //mol/wire/patch/patch.ts
2267
2284
  ;
2268
2285
  "use strict";
2286
+ //mol/type/result/result.ts
2287
+ ;
2288
+ "use strict";
2289
+ var $;
2290
+ (function ($) {
2291
+ function $mol_wire_let(host) {
2292
+ for (const field of Object.keys(host)) {
2293
+ host[field] = new $mol_wire_atom(field, host[field], host).channel();
2294
+ }
2295
+ return host;
2296
+ }
2297
+ $.$mol_wire_let = $mol_wire_let;
2298
+ })($ || ($ = {}));
2299
+ //mol/wire/let/let.ts
2300
+ ;
2301
+ "use strict";
2269
2302
  var $;
2270
2303
  (function ($) {
2271
2304
  class $mol_wire_set extends Set {
@@ -4057,6 +4090,9 @@ var $;
4057
4090
  //mol/key/key.test.tsx
4058
4091
  ;
4059
4092
  "use strict";
4093
+ //mol/type/foot/foot.test.ts
4094
+ ;
4095
+ "use strict";
4060
4096
  var $;
4061
4097
  (function ($) {
4062
4098
  $mol_wire_log.active();
@@ -4214,6 +4250,37 @@ var $;
4214
4250
  //mol/object/object.test.ts
4215
4251
  ;
4216
4252
  "use strict";
4253
+ //mol/type/result/result.test.ts
4254
+ ;
4255
+ "use strict";
4256
+ var $;
4257
+ (function ($) {
4258
+ $mol_test({
4259
+ 'define as methods'() {
4260
+ const { foo, bar } = $mol_wire_let({
4261
+ foo(next = 1) { return next; },
4262
+ bar() { return this.foo() + 1; },
4263
+ });
4264
+ $mol_assert_equal(foo(), 1);
4265
+ $mol_assert_equal(bar(), 2);
4266
+ $mol_assert_equal(foo(5), 5);
4267
+ $mol_assert_equal(bar(), 6);
4268
+ },
4269
+ 'define as closures'() {
4270
+ const { foo, bar } = $mol_wire_let({
4271
+ foo: (next = 1) => next,
4272
+ bar: () => foo() + 1,
4273
+ });
4274
+ $mol_assert_equal(foo(), 1);
4275
+ $mol_assert_equal(bar(), 2);
4276
+ $mol_assert_equal(foo(5), 5);
4277
+ $mol_assert_equal(bar(), 6);
4278
+ },
4279
+ });
4280
+ })($ || ($ = {}));
4281
+ //mol/wire/let/let.test.ts
4282
+ ;
4283
+ "use strict";
4217
4284
  var $;
4218
4285
  (function ($_1) {
4219
4286
  $mol_test({