mol_wire_lib 1.0.262 → 1.0.263

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
@@ -1359,6 +1359,82 @@ var $;
1359
1359
  ;
1360
1360
  "use strict";
1361
1361
  var $;
1362
+ (function ($_1) {
1363
+ let $$;
1364
+ (function ($$) {
1365
+ let $;
1366
+ })($$ = $_1.$$ || ($_1.$$ = {}));
1367
+ $_1.$mol_object_field = Symbol('$mol_object_field');
1368
+ class $mol_object extends $mol_object2 {
1369
+ static make(config) {
1370
+ return super.create(obj => {
1371
+ for (let key in config)
1372
+ obj[key] = config[key];
1373
+ });
1374
+ }
1375
+ }
1376
+ $_1.$mol_object = $mol_object;
1377
+ })($ || ($ = {}));
1378
+ //mol/object/object.ts
1379
+ ;
1380
+ "use strict";
1381
+ var $;
1382
+ (function ($) {
1383
+ $.$mol_mem = $mol_wire_solo;
1384
+ $.$mol_mem_key = $mol_wire_plex;
1385
+ })($ || ($ = {}));
1386
+ //mol/mem/mem.ts
1387
+ ;
1388
+ "use strict";
1389
+ var $;
1390
+ (function ($) {
1391
+ class $mol_state_time extends $mol_object {
1392
+ static task(precision, reset) {
1393
+ if (precision) {
1394
+ return new $mol_after_timeout(precision, () => this.task(precision, null));
1395
+ }
1396
+ else {
1397
+ return new $mol_after_frame(() => this.task(precision, null));
1398
+ }
1399
+ }
1400
+ static now(precision) {
1401
+ this.task(precision);
1402
+ return Date.now();
1403
+ }
1404
+ }
1405
+ __decorate([
1406
+ $mol_mem_key
1407
+ ], $mol_state_time, "task", null);
1408
+ __decorate([
1409
+ $mol_mem_key
1410
+ ], $mol_state_time, "now", null);
1411
+ $.$mol_state_time = $mol_state_time;
1412
+ })($ || ($ = {}));
1413
+ //mol/state/time/time.ts
1414
+ ;
1415
+ "use strict";
1416
+ var $;
1417
+ (function ($) {
1418
+ function $mol_wire_trans(next) {
1419
+ const atom = $mol_wire_auto();
1420
+ if (!(atom instanceof $mol_wire_atom))
1421
+ $mol_fail(new Error('Allowed only inside atom'));
1422
+ const prev = atom.result() ?? next;
1423
+ if (typeof prev !== 'number')
1424
+ return next;
1425
+ const current = (prev * 2 + next) / 3;
1426
+ const diff = Math.abs(current - next);
1427
+ if (diff < 1)
1428
+ return next;
1429
+ $mol_state_time.now(0);
1430
+ return current;
1431
+ }
1432
+ $.$mol_wire_trans = $mol_wire_trans;
1433
+ })($ || ($ = {}));
1434
+ //mol/wire/trans/trans.ts
1435
+ ;
1436
+ "use strict";
1437
+ var $;
1362
1438
  (function ($) {
1363
1439
  function $mol_wire_patch(obj) {
1364
1440
  for (const field of Reflect.ownKeys(obj)) {
@@ -1564,14 +1640,6 @@ var $;
1564
1640
  ;
1565
1641
  "use strict";
1566
1642
  var $;
1567
- (function ($) {
1568
- $.$mol_mem = $mol_wire_solo;
1569
- $.$mol_mem_key = $mol_wire_plex;
1570
- })($ || ($ = {}));
1571
- //mol/mem/mem.ts
1572
- ;
1573
- "use strict";
1574
- var $;
1575
1643
  (function ($) {
1576
1644
  function $mol_log3_area_lazy(event) {
1577
1645
  const self = this;
@@ -3888,6 +3956,25 @@ var $;
3888
3956
  ;
3889
3957
  "use strict";
3890
3958
  var $;
3959
+ (function ($) {
3960
+ $mol_test({
3961
+ 'init with overload'() {
3962
+ class X extends $mol_object {
3963
+ foo() {
3964
+ return 1;
3965
+ }
3966
+ }
3967
+ var x = X.make({
3968
+ foo: () => 2,
3969
+ });
3970
+ $mol_assert_equal(x.foo(), 2);
3971
+ },
3972
+ });
3973
+ })($ || ($ = {}));
3974
+ //mol/object/object.test.ts
3975
+ ;
3976
+ "use strict";
3977
+ var $;
3891
3978
  (function ($_1) {
3892
3979
  $mol_test({
3893
3980
  'Watch one value'($) {