hyoo_sync_client 0.0.603 → 0.0.605

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/web.test.js CHANGED
@@ -120,6 +120,8 @@ var $;
120
120
 
121
121
  ;
122
122
  "use strict";
123
+ /** @jsx $mol_jsx */
124
+ /** @jsxFrag $mol_jsx_frag */
123
125
  var $;
124
126
  (function ($) {
125
127
  $mol_test({
@@ -225,6 +227,7 @@ var $;
225
227
  "use strict";
226
228
  var $;
227
229
  (function ($) {
230
+ /** Lazy computed lists with native Array interface. $mol_range2_array is mutable but all derived ranges are immutable. */
228
231
  function $mol_range2(item = index => index, size = () => Number.POSITIVE_INFINITY) {
229
232
  const source = typeof item === 'function' ? new $mol_range2_array() : item;
230
233
  if (typeof item !== 'function') {
@@ -273,6 +276,7 @@ var $;
273
276
  }
274
277
  $.$mol_range2 = $mol_range2;
275
278
  class $mol_range2_array extends Array {
279
+ // Lazy
276
280
  concat(...tail) {
277
281
  if (tail.length === 0)
278
282
  return this;
@@ -284,6 +288,7 @@ var $;
284
288
  }
285
289
  return $mol_range2(index => index < this.length ? this[index] : tail[0][index - this.length], () => this.length + tail[0].length);
286
290
  }
291
+ // Lazy
287
292
  filter(check, context) {
288
293
  const filtered = [];
289
294
  let cursor = -1;
@@ -296,13 +301,16 @@ var $;
296
301
  return filtered[index];
297
302
  }, () => cursor < this.length ? Number.POSITIVE_INFINITY : filtered.length);
298
303
  }
304
+ // Diligent
299
305
  forEach(proceed, context) {
300
306
  for (let [key, value] of this.entries())
301
307
  proceed.call(context, value, key, this);
302
308
  }
309
+ // Lazy
303
310
  map(proceed, context) {
304
311
  return $mol_range2(index => proceed.call(context, this[index], index, this), () => this.length);
305
312
  }
313
+ // Diligent
306
314
  reduce(merge, result) {
307
315
  let index = 0;
308
316
  if (arguments.length === 1) {
@@ -313,12 +321,15 @@ var $;
313
321
  }
314
322
  return result;
315
323
  }
324
+ // Lazy
316
325
  toReversed() {
317
326
  return $mol_range2(index => this[this.length - 1 - index], () => this.length);
318
327
  }
328
+ // Lazy
319
329
  slice(from = 0, to = this.length) {
320
330
  return $mol_range2(index => this[from + index], () => Math.min(to, this.length) - from);
321
331
  }
332
+ // Lazy
322
333
  some(check, context) {
323
334
  for (let index = 0; index < this.length; ++index) {
324
335
  if (check.call(context, this[index], index, this))
@@ -339,6 +350,9 @@ var $;
339
350
  sort() {
340
351
  return $mol_fail(new TypeError(`Mutable sort is forbidden. Use toSorted instead.`));
341
352
  }
353
+ indexOf(needle) {
354
+ return this.findIndex(item => item === needle);
355
+ }
342
356
  [Symbol.toPrimitive]() {
343
357
  return $mol_guid();
344
358
  }
@@ -508,6 +522,7 @@ var $;
508
522
 
509
523
  ;
510
524
  "use strict";
525
+ /** @jsx $mol_jsx */
511
526
  var $;
512
527
  (function ($) {
513
528
  $mol_test({
@@ -569,6 +584,7 @@ var $;
569
584
  const obj3_copy = { test: 3, obj2: obj2_copy };
570
585
  obj1.obj3 = obj3;
571
586
  obj1_copy.obj3 = obj3_copy;
587
+ // warmup cache
572
588
  $mol_assert_not($mol_compare_deep(obj1, {}));
573
589
  $mol_assert_not($mol_compare_deep(obj2, {}));
574
590
  $mol_assert_not($mol_compare_deep(obj3, {}));
@@ -638,18 +654,34 @@ var $;
638
654
  "use strict";
639
655
  var $;
640
656
  (function ($) {
657
+ /**
658
+ * Argument must be Truthy
659
+ * @deprecated use $mol_assert_equal instead
660
+ */
641
661
  function $mol_assert_ok(value) {
642
662
  if (value)
643
663
  return;
644
664
  $mol_fail(new Error(`${value} ≠ true`));
645
665
  }
646
666
  $.$mol_assert_ok = $mol_assert_ok;
667
+ /**
668
+ * Argument must be Falsy
669
+ * @deprecated use $mol_assert_equal instead
670
+ */
647
671
  function $mol_assert_not(value) {
648
672
  if (!value)
649
673
  return;
650
674
  $mol_fail(new Error(`${value} ≠ false`));
651
675
  }
652
676
  $.$mol_assert_not = $mol_assert_not;
677
+ /**
678
+ * Handler must throw an error.
679
+ * @example
680
+ * $mol_assert_fail( ()=>{ throw new Error( 'Parse error' ) } ) // Passes because throws error
681
+ * $mol_assert_fail( ()=>{ throw new Error( 'Parse error' ) } , 'Parse error' ) // Passes because throws right message
682
+ * $mol_assert_fail( ()=>{ throw new Error( 'Parse error' ) } , Error ) // Passes because throws right class
683
+ * @see https://mol.hyoo.ru/#!section=docs/=9q9dv3_fgxjsf
684
+ */
653
685
  function $mol_assert_fail(handler, ErrorRight) {
654
686
  const fail = $.$mol_fail;
655
687
  try {
@@ -659,7 +691,7 @@ var $;
659
691
  catch (error) {
660
692
  $.$mol_fail = fail;
661
693
  if (typeof ErrorRight === 'string') {
662
- $mol_assert_equal(error.message, ErrorRight);
694
+ $mol_assert_equal(error.message ?? error, ErrorRight);
663
695
  }
664
696
  else {
665
697
  $mol_assert_equal(error instanceof ErrorRight, true);
@@ -669,13 +701,21 @@ var $;
669
701
  finally {
670
702
  $.$mol_fail = fail;
671
703
  }
672
- $mol_fail(new Error('Not failed'));
704
+ $mol_fail(new Error('Not failed', { cause: { expect: ErrorRight } }));
673
705
  }
674
706
  $.$mol_assert_fail = $mol_assert_fail;
707
+ /** @deprecated Use $mol_assert_equal */
675
708
  function $mol_assert_like(...args) {
676
709
  $mol_assert_equal(...args);
677
710
  }
678
711
  $.$mol_assert_like = $mol_assert_like;
712
+ /**
713
+ * All arguments must not be structural equal to each other.
714
+ * @example
715
+ * $mol_assert_unique( 1 , 2 , 3 ) // Passes
716
+ * $mol_assert_unique( 1 , 1 , 2 ) // Fails because 1 === 1
717
+ * @see https://mol.hyoo.ru/#!section=docs/=9q9dv3_fgxjsf
718
+ */
679
719
  function $mol_assert_unique(...args) {
680
720
  for (let i = 0; i < args.length; ++i) {
681
721
  for (let j = 0; j < args.length; ++j) {
@@ -683,40 +723,26 @@ var $;
683
723
  continue;
684
724
  if (!$mol_compare_deep(args[i], args[j]))
685
725
  continue;
686
- $mol_fail(new Error(`args[${i}] = args[${j}] = ${print(args[i])}`));
726
+ return $mol_fail(new Error(`Uniquesess assertion failure`, { cause: { [i]: args[i], [i]: args[i] } }));
687
727
  }
688
728
  }
689
729
  }
690
730
  $.$mol_assert_unique = $mol_assert_unique;
731
+ /**
732
+ * All arguments must be structural equal each other.
733
+ * @example
734
+ * $mol_assert_like( [1] , [1] , [1] ) // Passes
735
+ * $mol_assert_like( [1] , [1] , [2] ) // Fails because 1 !== 2
736
+ * @see https://mol.hyoo.ru/#!section=docs/=9q9dv3_fgxjsf
737
+ */
691
738
  function $mol_assert_equal(...args) {
692
739
  for (let i = 1; i < args.length; ++i) {
693
740
  if ($mol_compare_deep(args[0], args[i]))
694
741
  continue;
695
- if (args[0] instanceof $mol_dom_context.Element && args[i] instanceof $mol_dom_context.Element && args[0].outerHTML === args[i].outerHTML)
696
- continue;
697
- return $mol_fail(new Error(`args[0] ≠ args[${i}]\n${print(args[0])}\n---\n${print(args[i])}`));
742
+ return $mol_fail(new Error(`Equality assertion failure`, { cause: { 0: args[0], [i]: args[i] } }));
698
743
  }
699
744
  }
700
745
  $.$mol_assert_equal = $mol_assert_equal;
701
- const print = (val) => {
702
- if (!val)
703
- return val;
704
- if (typeof val === 'bigint')
705
- return String(val) + 'n';
706
- if (typeof val === 'symbol')
707
- return `Symbol(${val.description})`;
708
- if (typeof val !== 'object')
709
- return val;
710
- if ('outerHTML' in val)
711
- return val.outerHTML;
712
- try {
713
- return JSON.stringify(val, (k, v) => typeof v === 'bigint' ? String(v) : v, '\t');
714
- }
715
- catch (error) {
716
- console.error(error);
717
- return val;
718
- }
719
- };
720
746
  })($ || ($ = {}));
721
747
 
722
748
  ;
@@ -743,16 +769,16 @@ var $;
743
769
  $mol_assert_unique([1], [2], [3]);
744
770
  },
745
771
  'two must be alike'() {
746
- $mol_assert_like([3], [3]);
772
+ $mol_assert_equal([3], [3]);
747
773
  },
748
774
  'three must be alike'() {
749
- $mol_assert_like([3], [3], [3]);
775
+ $mol_assert_equal([3], [3], [3]);
750
776
  },
751
777
  'two object must be alike'() {
752
- $mol_assert_like({ a: 1 }, { a: 1 });
778
+ $mol_assert_equal({ a: 1 }, { a: 1 });
753
779
  },
754
780
  'three object must be alike'() {
755
- $mol_assert_like({ a: 1 }, { a: 1 }, { a: 1 });
781
+ $mol_assert_equal({ a: 1 }, { a: 1 }, { a: 1 });
756
782
  },
757
783
  });
758
784
  })($ || ($ = {}));
@@ -865,10 +891,23 @@ var $;
865
891
  var $;
866
892
  (function ($) {
867
893
  $mol_test({
868
- 'encode utf8 string'() {
869
- const str = 'Hello, ΧΨΩЫ';
870
- const encoded = new Uint8Array([72, 101, 108, 108, 111, 44, 32, 206, 167, 206, 168, 206, 169, 208, 171]);
871
- $mol_assert_like($mol_charset_encode(str), encoded);
894
+ 'encode empty'() {
895
+ $mol_assert_equal($mol_charset_encode(''), new Uint8Array([]));
896
+ },
897
+ 'encode 1 octet'() {
898
+ $mol_assert_equal($mol_charset_encode('F'), new Uint8Array([0x46]));
899
+ },
900
+ 'encode 2 octet'() {
901
+ $mol_assert_equal($mol_charset_encode('Б'), new Uint8Array([0xd0, 0x91]));
902
+ },
903
+ 'encode 3 octet'() {
904
+ $mol_assert_equal($mol_charset_encode('ह'), new Uint8Array([0xe0, 0xa4, 0xb9]));
905
+ },
906
+ 'encode 4 octet'() {
907
+ $mol_assert_equal($mol_charset_encode('𐍈'), new Uint8Array([0xf0, 0x90, 0x8d, 0x88]));
908
+ },
909
+ 'encode surrogate pair'() {
910
+ $mol_assert_equal($mol_charset_encode('😀'), new Uint8Array([0xf0, 0x9f, 0x98, 0x80]));
872
911
  },
873
912
  });
874
913
  })($ || ($ = {}));
@@ -932,6 +971,9 @@ var $;
932
971
  gender["bisexual"] = "bisexual";
933
972
  gender["trans"] = "transgender";
934
973
  })(gender || (gender = {}));
974
+ // Test disabled due https://github.com/microsoft/TypeScript/issues/46112
975
+ // const Sex = $mol_data_enum( 'sex' , sex )
976
+ // type sex_value = $mol_type_assert< typeof Sex.Value , sex >
935
977
  $mol_test({
936
978
  'config of enum'() {
937
979
  const Sex = $mol_data_enum('sex', sex);
@@ -961,6 +1003,8 @@ var $;
961
1003
  $mol_assert_fail(() => Sex('__proto__'), `__proto__ is not value of sex enum`);
962
1004
  },
963
1005
  });
1006
+ // Test disabled due https://github.com/microsoft/TypeScript/issues/46112
1007
+ // type gender_value = $mol_type_assert< typeof Gender.Value , gender >
964
1008
  $mol_test({
965
1009
  'config of enum'() {
966
1010
  const Gender = $mol_data_enum('gender', gender);
@@ -995,11 +1039,14 @@ var $;
995
1039
  const png = new Uint8Array([0x1a, 0x0a, 0x00, 0x49, 0x48, 0x78, 0xda]);
996
1040
  $mol_test({
997
1041
  'base64 encode string'() {
998
- $mol_assert_equal($mol_base64_encode('Hello, ΧΨΩЫ'), 'SGVsbG8sIM6nzqjOqdCr');
1042
+ $mol_assert_equal($mol_base64_encode($mol_charset_encode('Hello, ΧΨΩЫ')), 'SGVsbG8sIM6nzqjOqdCr');
999
1043
  },
1000
1044
  'base64 encode binary'() {
1001
1045
  $mol_assert_equal($mol_base64_encode(png), 'GgoASUh42g==');
1002
1046
  },
1047
+ 'base64 encode string with plus'() {
1048
+ $mol_assert_equal($mol_base64_encode($mol_charset_encode('шоешпо')), '0YjQvtC10YjQv9C+');
1049
+ },
1003
1050
  });
1004
1051
  })($ || ($ = {}));
1005
1052
 
@@ -1008,12 +1055,19 @@ var $;
1008
1055
  var $;
1009
1056
  (function ($) {
1010
1057
  const png = new Uint8Array([0x1a, 0x0a, 0x00, 0x49, 0x48, 0x78, 0xda]);
1058
+ const with_plus = new TextEncoder().encode('шоешпо');
1011
1059
  $mol_test({
1012
1060
  'base64 decode string'() {
1013
- $mol_assert_like($mol_base64_decode('SGVsbG8sIM6nzqjOqdCr'), new TextEncoder().encode('Hello, ΧΨΩЫ'));
1061
+ $mol_assert_equal($mol_base64_decode('SGVsbG8sIM6nzqjOqdCr'), new TextEncoder().encode('Hello, ΧΨΩЫ'));
1014
1062
  },
1015
1063
  'base64 decode binary'() {
1016
- $mol_assert_like($mol_base64_decode('GgoASUh42g=='), png);
1064
+ $mol_assert_equal($mol_base64_decode('GgoASUh42g=='), png);
1065
+ },
1066
+ 'base64 decode binary - without equals'() {
1067
+ $mol_assert_equal($mol_base64_decode('GgoASUh42g'), png);
1068
+ },
1069
+ 'base64 decode with plus'() {
1070
+ $mol_assert_equal($mol_base64_decode('0YjQvtC10YjQv9C+'), with_plus);
1017
1071
  },
1018
1072
  });
1019
1073
  })($ || ($ = {}));
@@ -1109,30 +1163,30 @@ var $;
1109
1163
  (function ($_1) {
1110
1164
  const common = [
1111
1165
  $mol_int62_to_string({
1112
- lo: 12 << 0 | 13 << 8 | 14 << 16 | 15 << 24,
1113
- hi: 13 << 0 | 14 << 8 | 15 << 16 | 16 << 24,
1166
+ lo: 12 << 0 | 13 << 8 | 14 << 16 | 15 << 24, // land_lo
1167
+ hi: 13 << 0 | 14 << 8 | 15 << 16 | 16 << 24, // land_hi
1114
1168
  }),
1115
1169
  $mol_int62_to_string({
1116
- lo: 2 << 0 | 3 << 8 | 4 << 16 | 5 << 24,
1117
- hi: 3 << 0 | 4 << 8 | 5 << 16 | 6 << 24,
1170
+ lo: 2 << 0 | 3 << 8 | 4 << 16 | 5 << 24, // auth_lo
1171
+ hi: 3 << 0 | 4 << 8 | 5 << 16 | 6 << 24, // auto_hi
1118
1172
  }),
1119
1173
  $mol_int62_to_string({
1120
- lo: 4 << 0 | 5 << 8 | 6 << 16 | 7 << 24,
1121
- hi: 5 << 0 | 6 << 8 | 7 << 16 | 8 << 24,
1174
+ lo: 4 << 0 | 5 << 8 | 6 << 16 | 7 << 24, // head_lo
1175
+ hi: 5 << 0 | 6 << 8 | 7 << 16 | 8 << 24, // head_hi
1122
1176
  }),
1123
1177
  $mol_int62_to_string({
1124
- lo: 10 << 0 | 11 << 8 | 12 << 16 | 13 << 24,
1125
- hi: 11 << 0 | 12 << 8 | 13 << 16 | 14 << 24,
1178
+ lo: 10 << 0 | 11 << 8 | 12 << 16 | 13 << 24, // self_lo
1179
+ hi: 11 << 0 | 12 << 8 | 13 << 16 | 14 << 24, // self_hi
1126
1180
  }),
1127
1181
  $mol_int62_to_string({
1128
- lo: 6 << 0 | 7 << 8 | 8 << 16 | 9 << 24,
1129
- hi: 7 << 0 | 8 << 8 | 9 << 16 | 10 << 24,
1182
+ lo: 6 << 0 | 7 << 8 | 8 << 16 | 9 << 24, // next_lo
1183
+ hi: 7 << 0 | 8 << 8 | 9 << 16 | 10 << 24, // next_hi
1130
1184
  }),
1131
1185
  $mol_int62_to_string({
1132
- lo: 8 << 0 | 9 << 8 | 10 << 16 | 11 << 24,
1133
- hi: 9 << 0 | 10 << 8 | 11 << 16 | 12 << 24,
1186
+ lo: 8 << 0 | 9 << 8 | 10 << 16 | 11 << 24, // prev_lo
1187
+ hi: 9 << 0 | 10 << 8 | 11 << 16 | 12 << 24, // prev_hi
1134
1188
  }),
1135
- 1 << 0 | 2 << 8 | 3 << 16 | 4 << 24,
1189
+ 1 << 0 | 2 << 8 | 3 << 16 | 4 << 24, // time
1136
1190
  ];
1137
1191
  $mol_test({
1138
1192
  'pack and unpack unit with null'($) {
@@ -1229,6 +1283,7 @@ var $;
1229
1283
  "use strict";
1230
1284
  var $;
1231
1285
  (function ($) {
1286
+ /// @todo right orderinng
1232
1287
  $.$mol_after_mock_queue = [];
1233
1288
  function $mol_after_mock_warp() {
1234
1289
  const queue = $.$mol_after_mock_queue.splice(0);
@@ -1466,7 +1521,7 @@ var $;
1466
1521
  }
1467
1522
  await $mol_wire_async(A).a();
1468
1523
  $mol_assert_equal(A.instances.length, 2);
1469
- $mol_assert_equal(A.instances[0] instanceof A);
1524
+ $mol_assert_equal(A.instances[0] instanceof A, true);
1470
1525
  $mol_assert_equal(A.instances[0], A.instances[1]);
1471
1526
  }
1472
1527
  });
@@ -1552,6 +1607,7 @@ var $;
1552
1607
  var $;
1553
1608
  (function ($_1) {
1554
1609
  $mol_test({
1610
+ // https://github.com/nin-jin/slides/tree/master/reactivity#component-states
1555
1611
  'Cached channel'($) {
1556
1612
  class App extends $mol_object2 {
1557
1613
  static $ = $;
@@ -1609,6 +1665,7 @@ var $;
1609
1665
  $mol_assert_equal(App.value(5), 21);
1610
1666
  $mol_assert_equal(App.value(), 21);
1611
1667
  },
1668
+ // https://github.com/nin-jin/slides/tree/master/reactivity#wish-consistency
1612
1669
  'Auto recalculation of cached values'($) {
1613
1670
  class App extends $mol_object2 {
1614
1671
  static $ = $;
@@ -1636,6 +1693,7 @@ var $;
1636
1693
  App.xxx(5);
1637
1694
  $mol_assert_equal(App.zzz(), 7);
1638
1695
  },
1696
+ // https://github.com/nin-jin/slides/tree/master/reactivity#wish-reasonability
1639
1697
  'Skip recalculation when actually no dependency changes'($) {
1640
1698
  const log = [];
1641
1699
  class App extends $mol_object2 {
@@ -1669,6 +1727,7 @@ var $;
1669
1727
  App.zzz();
1670
1728
  $mol_assert_like(log, ['zzz', 'yyy', 'xxx', 'xxx', 'yyy']);
1671
1729
  },
1730
+ // https://github.com/nin-jin/slides/tree/master/reactivity#flow-auto
1672
1731
  'Flow: Auto'($) {
1673
1732
  class App extends $mol_object2 {
1674
1733
  static get $() { return $; }
@@ -1706,6 +1765,7 @@ var $;
1706
1765
  $mol_assert_equal(App.result(), 23);
1707
1766
  $mol_assert_equal(App.counter, 4);
1708
1767
  },
1768
+ // https://github.com/nin-jin/slides/tree/master/reactivity#dupes-equality
1709
1769
  'Dupes: Equality'($) {
1710
1770
  let counter = 0;
1711
1771
  class App extends $mol_object2 {
@@ -1729,6 +1789,7 @@ var $;
1729
1789
  App.foo({ numbs: [2] });
1730
1790
  $mol_assert_like(App.bar(), { numbs: [2], count: 2 });
1731
1791
  },
1792
+ // https://github.com/nin-jin/slides/tree/master/reactivity#cycle-fail
1732
1793
  'Cycle: Fail'($) {
1733
1794
  class App extends $mol_object2 {
1734
1795
  static $ = $;
@@ -1753,6 +1814,29 @@ var $;
1753
1814
  ], App, "test", null);
1754
1815
  App.test();
1755
1816
  },
1817
+ // https://github.com/nin-jin/slides/tree/master/reactivity#wish-stability
1818
+ // 'Update deps on push'( $ ) {
1819
+ // class App extends $mol_object2 {
1820
+ // static $ = $
1821
+ // @ $mol_wire_solo
1822
+ // static left( next = false ) {
1823
+ // return next
1824
+ // }
1825
+ // @ $mol_wire_solo
1826
+ // static right( next = false ) {
1827
+ // return next
1828
+ // }
1829
+ // @ $mol_wire_solo
1830
+ // static res( next?: boolean ) {
1831
+ // return this.left( next ) && this.right()
1832
+ // }
1833
+ // }
1834
+ // $mol_assert_equal( App.res(), false )
1835
+ // $mol_assert_equal( App.res( true ), false )
1836
+ // $mol_assert_equal( App.right( true ), true )
1837
+ // $mol_assert_equal( App.res(), true )
1838
+ // } ,
1839
+ // https://github.com/nin-jin/slides/tree/master/reactivity#wish-stability
1756
1840
  'Different order of pull and push'($) {
1757
1841
  class App extends $mol_object2 {
1758
1842
  static $ = $;
@@ -1764,7 +1848,7 @@ var $;
1764
1848
  }
1765
1849
  static slow(next) {
1766
1850
  if (next !== undefined)
1767
- this.slow();
1851
+ this.slow(); // enforce pull before push
1768
1852
  return this.store(next);
1769
1853
  }
1770
1854
  }
@@ -1783,6 +1867,7 @@ var $;
1783
1867
  App.store(777);
1784
1868
  $mol_assert_equal(App.fast(), App.slow(), 777);
1785
1869
  },
1870
+ // https://github.com/nin-jin/slides/tree/master/reactivity#wish-stability
1786
1871
  'Actions inside invariant'($) {
1787
1872
  class App extends $mol_object2 {
1788
1873
  static $ = $;
@@ -1822,6 +1907,7 @@ var $;
1822
1907
  static toggle() {
1823
1908
  const prev = this.checked();
1824
1909
  $mol_assert_unique(this.checked(!prev), prev);
1910
+ // $mol_assert_equal( this.checked() , prev )
1825
1911
  }
1826
1912
  static res() {
1827
1913
  return this.checked();
@@ -1846,6 +1932,39 @@ var $;
1846
1932
  ], App, "test", null);
1847
1933
  await $mol_wire_async(App).test();
1848
1934
  },
1935
+ // // https://github.com/nin-jin/slides/tree/master/reactivity#wish-stability
1936
+ // 'Stable order of multiple root'( $ ) {
1937
+ // class App extends $mol_object2 {
1938
+ // static $ = $
1939
+ // static counter = 0
1940
+ // @ $mol_wire_solo
1941
+ // static left_trigger( next = 0 ) {
1942
+ // return next
1943
+ // }
1944
+ // @ $mol_wire_solo
1945
+ // static left_root() {
1946
+ // this.left_trigger()
1947
+ // return ++ this.counter
1948
+ // }
1949
+ // @ $mol_wire_solo
1950
+ // static right_trigger( next = 0 ) {
1951
+ // return next
1952
+ // }
1953
+ // @ $mol_wire_solo
1954
+ // static right_root() {
1955
+ // this.right_trigger()
1956
+ // return ++ this.counter
1957
+ // }
1958
+ // }
1959
+ // $mol_assert_equal( App.left_root(), 1 )
1960
+ // $mol_assert_equal( App.right_root(), 2 )
1961
+ // App.right_trigger( 1 )
1962
+ // App.left_trigger( 1 )
1963
+ // $mol_wire_fiber.sync()
1964
+ // $mol_assert_equal( App.right_root(), 4 )
1965
+ // $mol_assert_equal( App.left_root(), 3 )
1966
+ // } ,
1967
+ // https://github.com/nin-jin/slides/tree/master/reactivity#error-store
1849
1968
  'Restore after error'($) {
1850
1969
  class App extends $mol_object2 {
1851
1970
  static get $() { return $; }
@@ -1943,6 +2062,7 @@ var $;
1943
2062
  App.showing(true);
1944
2063
  $mol_assert_unique(App.render(), details);
1945
2064
  },
2065
+ // https://github.com/nin-jin/slides/tree/master/reactivity#wish-stability
1946
2066
  async 'Hold pubs while wait async task'($) {
1947
2067
  class App extends $mol_object2 {
1948
2068
  static $ = $;
@@ -1959,8 +2079,6 @@ var $;
1959
2079
  $mol_wire_sync(this).wait();
1960
2080
  return this.value();
1961
2081
  }
1962
- static test() {
1963
- }
1964
2082
  }
1965
2083
  __decorate([
1966
2084
  $mol_wire_solo
@@ -1971,9 +2089,6 @@ var $;
1971
2089
  __decorate([
1972
2090
  $mol_wire_solo
1973
2091
  ], App, "result", null);
1974
- __decorate([
1975
- $mol_wire_method
1976
- ], App, "test", null);
1977
2092
  $mol_assert_equal(App.result(), 1);
1978
2093
  App.resets(null);
1979
2094
  $mol_wire_fiber.sync();
@@ -2164,7 +2279,7 @@ var $;
2164
2279
  ;
2165
2280
  "use strict";
2166
2281
  var $;
2167
- (function ($) {
2282
+ (function ($_1) {
2168
2283
  $mol_test({
2169
2284
  'init with overload'() {
2170
2285
  class X extends $mol_object {
@@ -2177,6 +2292,22 @@ var $;
2177
2292
  });
2178
2293
  $mol_assert_equal(x.foo(), 2);
2179
2294
  },
2295
+ 'Context in instance inherits from class'($) {
2296
+ const custom = $.$mol_ambient({});
2297
+ class X extends $.$mol_object {
2298
+ static $ = custom;
2299
+ }
2300
+ $mol_assert_equal(new X().$, custom);
2301
+ },
2302
+ });
2303
+ })($ || ($ = {}));
2304
+
2305
+ ;
2306
+ "use strict";
2307
+ var $;
2308
+ (function ($_1) {
2309
+ $mol_test_mocks.push($ => {
2310
+ $.$mol_after_frame = $mol_after_mock_commmon;
2180
2311
  });
2181
2312
  })($ || ($ = {}));
2182
2313
 
@@ -2456,9 +2587,9 @@ var $;
2456
2587
  if (!replace)
2457
2588
  replace = (next, prev, lead) => insert(next, drop(prev, lead));
2458
2589
  if (to > prev.length)
2459
- to = prev.length;
2590
+ to = prev.length; // $mol_fail( new RangeError( `To(${ to }) greater then length(${ prev.length })` ) )
2460
2591
  if (from > to)
2461
- from = to;
2592
+ from = to; // $mol_fail( new RangeError( `From(${ to }) greater then to(${ to })` ) )
2462
2593
  let p = from;
2463
2594
  let n = 0;
2464
2595
  let lead = p ? prev[p - 1] : null;
@@ -2488,6 +2619,8 @@ var $;
2488
2619
 
2489
2620
  ;
2490
2621
  "use strict";
2622
+ /** @jsx $mol_jsx */
2623
+ /** @jsxFrag $mol_jsx_frag */
2491
2624
  var $;
2492
2625
  (function ($) {
2493
2626
  $mol_test({
@@ -2510,10 +2643,10 @@ var $;
2510
2643
  return prev;
2511
2644
  },
2512
2645
  });
2513
- $mol_assert_equal(list, $mol_jsx("body", null,
2646
+ $mol_assert_equal(list.outerHTML, ($mol_jsx("body", null,
2514
2647
  $mol_jsx("p", { "data-rev": "old" }, "a"),
2515
2648
  $mol_jsx("p", { "data-rev": "old" }, "b"),
2516
- $mol_jsx("p", { "data-rev": "old" }, "c")));
2649
+ $mol_jsx("p", { "data-rev": "old" }, "c"))).outerHTML);
2517
2650
  },
2518
2651
  'insert items'() {
2519
2652
  const list = $mol_jsx("body", null,
@@ -2535,13 +2668,13 @@ var $;
2535
2668
  return prev;
2536
2669
  },
2537
2670
  });
2538
- $mol_assert_equal(list, $mol_jsx("body", null,
2671
+ $mol_assert_equal(list.outerHTML, ($mol_jsx("body", null,
2539
2672
  $mol_jsx("p", { "data-rev": "old" }, "a"),
2540
2673
  $mol_jsx("p", { "data-rev": "old" }, "b"),
2541
2674
  $mol_jsx("p", { "data-rev": "new" }, "X"),
2542
2675
  $mol_jsx("p", { "data-rev": "new" }, "Y"),
2543
2676
  $mol_jsx("p", { "data-rev": "old" }, "c"),
2544
- $mol_jsx("p", { "data-rev": "old" }, "d")));
2677
+ $mol_jsx("p", { "data-rev": "old" }, "d"))).outerHTML);
2545
2678
  },
2546
2679
  'append items'() {
2547
2680
  const list = $mol_jsx("body", null,
@@ -2560,10 +2693,10 @@ var $;
2560
2693
  return prev;
2561
2694
  },
2562
2695
  });
2563
- $mol_assert_equal(list, $mol_jsx("body", null,
2696
+ $mol_assert_equal(list.outerHTML, ($mol_jsx("body", null,
2564
2697
  $mol_jsx("p", { "data-rev": "old" }, "a"),
2565
2698
  $mol_jsx("p", { "data-rev": "new" }, "b"),
2566
- $mol_jsx("p", { "data-rev": "new" }, "c")));
2699
+ $mol_jsx("p", { "data-rev": "new" }, "c"))).outerHTML);
2567
2700
  },
2568
2701
  'split item'() {
2569
2702
  const list = $mol_jsx("body", null,
@@ -2584,11 +2717,11 @@ var $;
2584
2717
  return prev;
2585
2718
  },
2586
2719
  });
2587
- $mol_assert_equal(list, $mol_jsx("body", null,
2720
+ $mol_assert_equal(list.outerHTML, ($mol_jsx("body", null,
2588
2721
  $mol_jsx("p", { "data-rev": "old" }, "a"),
2589
2722
  $mol_jsx("p", { "data-rev": "new" }, "b"),
2590
2723
  $mol_jsx("p", { "data-rev": "up" }, "c"),
2591
- $mol_jsx("p", { "data-rev": "old" }, "d")));
2724
+ $mol_jsx("p", { "data-rev": "old" }, "d"))).outerHTML);
2592
2725
  },
2593
2726
  'drop items'() {
2594
2727
  const list = $mol_jsx("body", null,
@@ -2612,11 +2745,11 @@ var $;
2612
2745
  return prev;
2613
2746
  },
2614
2747
  });
2615
- $mol_assert_equal(list, $mol_jsx("body", null,
2748
+ $mol_assert_equal(list.outerHTML, ($mol_jsx("body", null,
2616
2749
  $mol_jsx("p", { "data-rev": "old" }, "A"),
2617
2750
  $mol_jsx("p", { "data-rev": "old" }, "B"),
2618
2751
  $mol_jsx("p", { "data-rev": "old" }, "C"),
2619
- $mol_jsx("p", { "data-rev": "old" }, "D")));
2752
+ $mol_jsx("p", { "data-rev": "old" }, "D"))).outerHTML);
2620
2753
  },
2621
2754
  'update items'() {
2622
2755
  const list = $mol_jsx("body", null,
@@ -2638,11 +2771,11 @@ var $;
2638
2771
  return prev;
2639
2772
  },
2640
2773
  });
2641
- $mol_assert_equal(list, $mol_jsx("body", null,
2774
+ $mol_assert_equal(list.outerHTML, ($mol_jsx("body", null,
2642
2775
  $mol_jsx("p", { "data-rev": "old" }, "a"),
2643
2776
  $mol_jsx("p", { "data-rev": "up" }, "X"),
2644
2777
  $mol_jsx("p", { "data-rev": "up" }, "Y"),
2645
- $mol_jsx("p", { "data-rev": "old" }, "d")));
2778
+ $mol_jsx("p", { "data-rev": "old" }, "d"))).outerHTML);
2646
2779
  },
2647
2780
  });
2648
2781
  })($ || ($ = {}));
@@ -2665,12 +2798,18 @@ var $;
2665
2798
  ;
2666
2799
  "use strict";
2667
2800
 
2801
+ ;
2802
+ "use strict";
2803
+
2668
2804
  ;
2669
2805
  "use strict";
2670
2806
  var $;
2671
2807
  (function ($) {
2808
+ let x = /x/[Symbol.matchAll];
2809
+ /** Type safe reguar expression builder */
2672
2810
  class $mol_regexp extends RegExp {
2673
2811
  groups;
2812
+ /** Prefer to use $mol_regexp.from */
2674
2813
  constructor(source, flags = 'gsu', groups = []) {
2675
2814
  super(source, flags);
2676
2815
  this.groups = groups;
@@ -2690,12 +2829,14 @@ var $;
2690
2829
  this.lastIndex = index;
2691
2830
  }
2692
2831
  }
2832
+ /** Parses input and returns found capture groups or null */
2693
2833
  [Symbol.match](str) {
2694
2834
  const res = [...this[Symbol.matchAll](str)].filter(r => r.groups).map(r => r[0]);
2695
2835
  if (!res.length)
2696
2836
  return null;
2697
2837
  return res;
2698
2838
  }
2839
+ /** Splits string by regexp edges */
2699
2840
  [Symbol.split](str) {
2700
2841
  const res = [];
2701
2842
  let token_last = null;
@@ -2750,6 +2891,14 @@ var $;
2750
2891
  get native() {
2751
2892
  return new RegExp(this.source, this.flags);
2752
2893
  }
2894
+ /** Makes regexp that greedy repeats this pattern with delimiter */
2895
+ static separated(chunk, sep) {
2896
+ return $mol_regexp.from([
2897
+ $mol_regexp.repeat_greedy([[chunk], sep], 0),
2898
+ chunk,
2899
+ ]);
2900
+ }
2901
+ /** Makes regexp that non-greedy repeats this pattern from min to max count */
2753
2902
  static repeat(source, min = 0, max = Number.POSITIVE_INFINITY) {
2754
2903
  const regexp = $mol_regexp.from(source);
2755
2904
  const upper = Number.isFinite(max) ? max : '';
@@ -2765,6 +2914,7 @@ var $;
2765
2914
  };
2766
2915
  return regexp2;
2767
2916
  }
2917
+ /** Makes regexp that greedy repeats this pattern from min to max count */
2768
2918
  static repeat_greedy(source, min = 0, max = Number.POSITIVE_INFINITY) {
2769
2919
  const regexp = $mol_regexp.from(source);
2770
2920
  const upper = Number.isFinite(max) ? max : '';
@@ -2780,26 +2930,31 @@ var $;
2780
2930
  };
2781
2931
  return regexp2;
2782
2932
  }
2783
- static vary(sources) {
2933
+ /** Makes regexp that match any of options */
2934
+ static vary(sources, flags = 'gsu') {
2784
2935
  const groups = [];
2785
2936
  const chunks = sources.map(source => {
2786
2937
  const regexp = $mol_regexp.from(source);
2787
2938
  groups.push(...regexp.groups);
2788
2939
  return regexp.source;
2789
2940
  });
2790
- return new $mol_regexp(`(?:${chunks.join('|')})`, '', groups);
2941
+ return new $mol_regexp(`(?:${chunks.join('|')})`, flags, groups);
2791
2942
  }
2943
+ /** Makes regexp that allow absent of this pattern */
2792
2944
  static optional(source) {
2793
2945
  return $mol_regexp.repeat_greedy(source, 0, 1);
2794
2946
  }
2947
+ /** Makes regexp that look ahead for pattern */
2795
2948
  static force_after(source) {
2796
2949
  const regexp = $mol_regexp.from(source);
2797
2950
  return new $mol_regexp(`(?=${regexp.source})`, regexp.flags, regexp.groups);
2798
2951
  }
2952
+ /** Makes regexp that look ahead for pattern */
2799
2953
  static forbid_after(source) {
2800
2954
  const regexp = $mol_regexp.from(source);
2801
2955
  return new $mol_regexp(`(?!${regexp.source})`, regexp.flags, regexp.groups);
2802
2956
  }
2957
+ /** Converts some js values to regexp */
2803
2958
  static from(source, { ignoreCase, multiline } = {
2804
2959
  ignoreCase: false,
2805
2960
  multiline: false,
@@ -2900,9 +3055,11 @@ var $;
2900
3055
  return regexp;
2901
3056
  }
2902
3057
  }
3058
+ /** Makes regexp which includes only unicode category */
2903
3059
  static unicode_only(...category) {
2904
3060
  return new $mol_regexp(`\\p{${category.join('=')}}`);
2905
3061
  }
3062
+ /** Makes regexp which excludes unicode category */
2906
3063
  static unicode_except(...category) {
2907
3064
  return new $mol_regexp(`\\P{${category.join('=')}}`);
2908
3065
  }
@@ -3343,6 +3500,7 @@ var $;
3343
3500
  var $;
3344
3501
  (function ($) {
3345
3502
  class $hyoo_crowd_text extends $hyoo_crowd_node {
3503
+ /** Text representation. Based on list of strings. */
3346
3504
  text(next) {
3347
3505
  if (next === undefined) {
3348
3506
  return this.str();
@@ -3374,6 +3532,7 @@ var $;
3374
3532
  return next;
3375
3533
  }
3376
3534
  }
3535
+ /** Text representation. Based on list of strings. */
3377
3536
  str(next) {
3378
3537
  if (next === undefined) {
3379
3538
  let str = '';
@@ -3465,7 +3624,7 @@ var $;
3465
3624
  return next;
3466
3625
  }
3467
3626
  else {
3468
- this.units();
3627
+ this.units(); // track text to recalc selection on its change
3469
3628
  return reg.value()
3470
3629
  ?.map(point => this.offset_by_point(point)[1]) ?? [0, 0];
3471
3630
  }
@@ -3972,6 +4131,7 @@ var $;
3972
4131
 
3973
4132
  ;
3974
4133
  "use strict";
4134
+ /** @jsx $mol_jsx */
3975
4135
  var $;
3976
4136
  (function ($) {
3977
4137
  $mol_test({
@@ -3989,9 +4149,9 @@ var $;
3989
4149
  $mol_assert_equal($mol_key({ foo: [false] }), '{"foo":[false]}');
3990
4150
  },
3991
4151
  'Uint8Array'() {
3992
- $mol_assert_equal($mol_key(new Uint8Array([1, 2])), '[1,2]');
3993
- $mol_assert_equal($mol_key([new Uint8Array([1, 2])]), '[[1,2]]');
3994
- $mol_assert_equal($mol_key({ foo: new Uint8Array([1, 2]) }), '{"foo":[1,2]}');
4152
+ $mol_assert_equal($mol_key(new Uint8Array([1, 2])), 'Uint8Array([1,2])');
4153
+ $mol_assert_equal($mol_key([new Uint8Array([1, 2])]), '[Uint8Array([1,2])]');
4154
+ $mol_assert_equal($mol_key({ foo: new Uint8Array([1, 2]) }), '{"foo":Uint8Array([1,2])}');
3995
4155
  },
3996
4156
  'Function'() {
3997
4157
  const func = () => { };
@@ -4011,6 +4171,12 @@ var $;
4011
4171
  $mol_assert_unique($mol_key(foo), $mol_key($mol_jsx("div", null, "bar")));
4012
4172
  },
4013
4173
  'Custom JSON representation'() {
4174
+ class User {
4175
+ toJSON() { return 'jin'; }
4176
+ }
4177
+ $mol_assert_unique([$mol_key(new User)], [$mol_key(new User)]);
4178
+ },
4179
+ 'Custom key handler'() {
4014
4180
  class User {
4015
4181
  name;
4016
4182
  age;
@@ -4018,21 +4184,22 @@ var $;
4018
4184
  this.name = name;
4019
4185
  this.age = age;
4020
4186
  }
4021
- toJSON() { return { name: this.name }; }
4187
+ [$mol_key_handle]() { return `User(${JSON.stringify(this.name)})`; }
4022
4188
  }
4023
- $mol_assert_equal($mol_key(new User('jin', 18)), '{"name":"jin"}');
4189
+ $mol_assert_equal($mol_key([new User('jin', 16)]), $mol_key([new User('jin', 18)]), '[User("jin")]');
4024
4190
  },
4025
4191
  'Special native classes'() {
4026
- $mol_assert_equal($mol_key(new Date('xyz')), 'null');
4027
- $mol_assert_equal($mol_key(new Date('2001-01-02T03:04:05.678Z')), '"2001-01-02T03:04:05.678Z"');
4028
- $mol_assert_equal($mol_key(/./), '"/./"');
4029
- $mol_assert_equal($mol_key(/\./gimsu), '"/\\\\./gimsu"');
4192
+ $mol_assert_equal($mol_key(new Date('xyz')), 'Date(NaN)');
4193
+ $mol_assert_equal($mol_key(new Date(12345)), 'Date(12345)');
4194
+ $mol_assert_equal($mol_key(/./), '/./');
4195
+ $mol_assert_equal($mol_key(/\./gimsu), '/\\./gimsu');
4030
4196
  },
4031
4197
  });
4032
4198
  })($ || ($ = {}));
4033
4199
 
4034
4200
  ;
4035
4201
  "use strict";
4202
+ /** @jsx $mol_jsx */
4036
4203
  var $;
4037
4204
  (function ($) {
4038
4205
  $mol_test({
@@ -4119,6 +4286,7 @@ var $;
4119
4286
  var $;
4120
4287
  (function ($) {
4121
4288
  class $hyoo_crowd_list extends $hyoo_crowd_node {
4289
+ /** Data list representation. */
4122
4290
  list(next) {
4123
4291
  const units = this.units();
4124
4292
  if (next === undefined) {
@@ -4232,8 +4400,10 @@ var $;
4232
4400
  const world2 = new $hyoo_crowd_world(await $hyoo_crowd_peer.generate());
4233
4401
  const land1 = await world1.grab();
4234
4402
  const land2 = await world1.grab();
4403
+ // do changes
4235
4404
  land1.chief.as($hyoo_crowd_list).list([123, 456]);
4236
4405
  land2.chief.as($hyoo_crowd_list).list([456, 789]);
4406
+ // apply changes
4237
4407
  for await (const batch of world1.delta()) {
4238
4408
  $mol_assert_like((await world2.apply(batch)).forbid, new Map);
4239
4409
  }
@@ -4244,7 +4414,9 @@ var $;
4244
4414
  const world1 = new $hyoo_crowd_world(await $hyoo_crowd_peer.generate());
4245
4415
  const world2 = new $hyoo_crowd_world(await $hyoo_crowd_peer.generate());
4246
4416
  const land = world1.land(world1.peer.id);
4417
+ // do changes
4247
4418
  land.chief.as($hyoo_crowd_list).list([123, 456]);
4419
+ // apply changes
4248
4420
  const batch = await world1.delta_batch(land);
4249
4421
  $mol_assert_like((await world2.apply(batch)).forbid, new Map);
4250
4422
  $mol_assert_like(world2.land(land.id()).chief.as($hyoo_crowd_list).list(), [123, 456]);
@@ -4253,38 +4425,50 @@ var $;
4253
4425
  const world1 = new $hyoo_crowd_world(await $hyoo_crowd_peer.generate());
4254
4426
  const world2 = new $hyoo_crowd_world(await $hyoo_crowd_peer.generate());
4255
4427
  const land = await world1.grab();
4428
+ // go to future
4256
4429
  const clock = land.clock_data;
4257
4430
  clock.see_time(clock.now() + 60 * 60 * 24 * 10);
4431
+ // do changes
4258
4432
  land.chief.as($hyoo_crowd_reg).numb(123);
4433
+ // 1 ignored units
4259
4434
  const batch = await world1.delta_batch(land);
4260
4435
  $mol_assert_like([...(await world2.apply(batch)).forbid.values()], ['Far future']);
4436
+ // only 3 grab units
4261
4437
  $mol_assert_like(world2.land(land.id()).delta().length, 3);
4262
4438
  },
4263
4439
  async 'ignore auth as another peer'() {
4264
4440
  const world1 = new $hyoo_crowd_world({ ...await $hyoo_crowd_peer.generate(), id: '1_1' });
4265
4441
  const world2 = new $hyoo_crowd_world(await $hyoo_crowd_peer.generate());
4266
4442
  const land = await world1.grab();
4443
+ // do changes
4267
4444
  land.chief.as($hyoo_crowd_reg).numb(123);
4445
+ // 2 ignored units
4268
4446
  const batch = await world1.delta_batch(land);
4269
4447
  $mol_assert_like([...(await world2.apply(batch)).forbid.values()], ['Alien join key', 'No auth key']);
4448
+ // only 2 grab units
4270
4449
  $mol_assert_like(world2.land(land.id()).delta().length, 2);
4271
4450
  },
4272
4451
  async 'ignore auth without key'() {
4273
4452
  const world1 = new $hyoo_crowd_world({ ...await $hyoo_crowd_peer.generate(), key_public_serial: [] });
4274
4453
  const world2 = new $hyoo_crowd_world(await $hyoo_crowd_peer.generate());
4275
4454
  const land = world1.land('1_1');
4455
+ // do changes
4276
4456
  land.chief.as($hyoo_crowd_reg).numb(123);
4457
+ // 2 ignored units
4277
4458
  const batch = await world1.delta_batch(land);
4278
4459
  $mol_assert_like([...(await world2.apply(batch)).forbid.values()], ['No join key', 'Level too low']);
4460
+ // only 2 grab units
4279
4461
  $mol_assert_like(world2.land(land.id()).delta().length, 0);
4280
4462
  },
4281
4463
  async 'ignore changes with wrong signs'() {
4282
4464
  const world1 = new $hyoo_crowd_world(await $hyoo_crowd_peer.generate());
4283
4465
  const world2 = new $hyoo_crowd_world(await $hyoo_crowd_peer.generate());
4284
4466
  const land = await world1.grab();
4467
+ // 2 ignored units
4285
4468
  const batch = await world1.delta_batch(land);
4286
- batch[152] = ~batch[152];
4469
+ batch[152] = ~batch[152]; // break sign
4287
4470
  $mol_assert_like([...(await world2.apply(batch)).forbid.values()], ['Wrong join sign', 'Level too low']);
4471
+ // no applied units
4288
4472
  $mol_assert_like(world2.land(land.id()).delta().length, 0);
4289
4473
  },
4290
4474
  async 'ignore update auth except auth removing'() {
@@ -4295,6 +4479,7 @@ var $;
4295
4479
  const land2 = world2.land(land1.id());
4296
4480
  land2.clock_auth.tick(peer.id);
4297
4481
  land2.clock_data.tick(peer.id);
4482
+ // do changes
4298
4483
  land1.chief.as($hyoo_crowd_reg).numb(123);
4299
4484
  land2.chief.as($hyoo_crowd_reg).numb(234);
4300
4485
  const batch = await world1.delta_batch(land1);
@@ -4310,15 +4495,16 @@ var $;
4310
4495
  const world1 = new $hyoo_crowd_world(await $hyoo_crowd_peer.generate());
4311
4496
  const world2 = new $hyoo_crowd_world(await $hyoo_crowd_peer.generate());
4312
4497
  const peer = await $hyoo_crowd_peer.generate();
4313
- const land1 = await world1.grab();
4498
+ const land1 = await world1.grab(); // +3 units
4314
4499
  const land2 = world2.land(land1.id());
4315
- land1.chief.sub('foo', $hyoo_crowd_reg).numb(123);
4500
+ // do changes
4501
+ land1.chief.sub('foo', $hyoo_crowd_reg).numb(123); // +1 unit
4316
4502
  for await (const batch of world1.delta()) {
4317
4503
  $mol_assert_like([...(await world2.apply(batch)).forbid.values()], []);
4318
4504
  }
4319
- land2.chief.sub('foo', $hyoo_crowd_reg).numb(234);
4320
- land2.chief.sub('bar', $hyoo_crowd_reg).numb(234);
4321
- land2.level(peer.id, $hyoo_crowd_peer_level.law);
4505
+ land2.chief.sub('foo', $hyoo_crowd_reg).numb(234); // 1 unit update +1 unit
4506
+ land2.chief.sub('bar', $hyoo_crowd_reg).numb(234); // +1 unit
4507
+ land2.level(peer.id, $hyoo_crowd_peer_level.law); // ingnored
4322
4508
  $mol_assert_like(land1.delta().length, 4);
4323
4509
  level_get: {
4324
4510
  const batch = await world2.delta_batch(land2);
@@ -4329,7 +4515,7 @@ var $;
4329
4515
  $mol_assert_like(land1.level(peer.id), $hyoo_crowd_peer_level.get);
4330
4516
  }
4331
4517
  level_add: {
4332
- land1.level(land2.peer().id, $hyoo_crowd_peer_level.add);
4518
+ land1.level(land2.peer().id, $hyoo_crowd_peer_level.add); // +1 unit
4333
4519
  const batch = await world2.delta_batch(land2);
4334
4520
  $mol_assert_like([...(await world1.apply(batch)).forbid.values()], ['Level too low']);
4335
4521
  $mol_assert_like(land1.delta().length, 7);
@@ -4351,7 +4537,7 @@ var $;
4351
4537
  for await (const batch of world1.delta()) {
4352
4538
  $mol_assert_like([...(await world2.apply(batch)).forbid.values()], []);
4353
4539
  }
4354
- land2.level(peer.id, $hyoo_crowd_peer_level.law);
4540
+ land2.level(peer.id, $hyoo_crowd_peer_level.law); // +1 unit
4355
4541
  const batch = await world2.delta_batch(land2);
4356
4542
  $mol_assert_like([...(await world1.apply(batch)).forbid.values()], []);
4357
4543
  $mol_assert_like(land1.delta().length, 8);
@@ -4366,6 +4552,7 @@ var $;
4366
4552
  const peer = await $hyoo_crowd_peer.generate();
4367
4553
  const land1 = await world1.grab();
4368
4554
  const land2 = world2.land(land1.id());
4555
+ // do changes
4369
4556
  land1.chief.sub('foo', $hyoo_crowd_reg).numb(123);
4370
4557
  const batch = await world1.delta_batch(land1);
4371
4558
  $mol_assert_like([...(await world2.apply(batch)).forbid.values()], []);
@@ -4396,7 +4583,7 @@ var $;
4396
4583
  for await (const batch of world1.delta()) {
4397
4584
  $mol_assert_like([...(await world2.apply(batch)).forbid.values()], []);
4398
4585
  }
4399
- land2.level(peer.id, $hyoo_crowd_peer_level.law);
4586
+ land2.level(peer.id, $hyoo_crowd_peer_level.law); //ingnored
4400
4587
  const batch = await world2.delta_batch(land2);
4401
4588
  $mol_assert_like([...(await world1.apply(batch)).forbid.values()], []);
4402
4589
  $mol_assert_like(land1.delta().length, 7);
@@ -4408,6 +4595,23 @@ var $;
4408
4595
  });
4409
4596
  })($ || ($ = {}));
4410
4597
 
4598
+ ;
4599
+ "use strict";
4600
+ var $;
4601
+ (function ($) {
4602
+ $mol_test({
4603
+ 'return result without errors'() {
4604
+ $mol_assert_equal($mol_try(() => false), false);
4605
+ },
4606
+ //'return error if thrown'() {
4607
+ //
4608
+ // const error = new Error( '$mol_try test error' )
4609
+ // $mol_assert_equal( $mol_try( ()=> { throw error } ) , error )
4610
+ //
4611
+ //} ,
4612
+ });
4613
+ })($ || ($ = {}));
4614
+
4411
4615
  ;
4412
4616
  "use strict";
4413
4617
  var $;
@@ -4425,15 +4629,6 @@ var $;
4425
4629
  ];
4426
4630
  })($ || ($ = {}));
4427
4631
 
4428
- ;
4429
- "use strict";
4430
- var $;
4431
- (function ($_1) {
4432
- $mol_test_mocks.push($ => {
4433
- $.$mol_after_frame = $mol_after_mock_commmon;
4434
- });
4435
- })($ || ($ = {}));
4436
-
4437
4632
  ;
4438
4633
  "use strict";
4439
4634
 
@@ -4441,6 +4636,7 @@ var $;
4441
4636
  "use strict";
4442
4637
  var $;
4443
4638
  (function ($) {
4639
+ /** Watch and logs reactive states. Logger automatically added to test bundle which is adding to `test.html`. */
4444
4640
  class $mol_wire_log extends $mol_object2 {
4445
4641
  static watch(task) {
4446
4642
  return task;