mol_plot_all 1.2.204 → 1.2.207

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
@@ -110,6 +110,12 @@ var $;
110
110
  //mol/type/assert/assert.ts
111
111
  ;
112
112
  "use strict";
113
+ //mol/type/equals/equals.test.ts
114
+ ;
115
+ "use strict";
116
+ //mol/type/equals/equals.ts
117
+ ;
118
+ "use strict";
113
119
  //mol/type/partial/deep/deep.test.ts
114
120
  ;
115
121
  "use strict";
@@ -151,8 +157,8 @@ var $;
151
157
  $mol_assert_equal(dom.outerHTML, '<div>hello<strong>world</strong>!</div>');
152
158
  },
153
159
  'Function as component'() {
154
- const Button = ({ hint }, target) => {
155
- return $mol_jsx("button", { title: hint }, target());
160
+ const Button = (props, target) => {
161
+ return $mol_jsx("button", { title: props.hint }, target());
156
162
  };
157
163
  const dom = $mol_jsx(Button, { id: "/foo", hint: "click me" }, () => 'hey!');
158
164
  $mol_assert_equal(dom.outerHTML, '<button title="click me" id="/foo">hey!</button>');
@@ -317,6 +323,12 @@ var $;
317
323
  $mol_assert_not($mol_compare_deep(/\x22/mig, /\x21/mig));
318
324
  $mol_assert_not($mol_compare_deep(/\x22/mig, /\x22/mg));
319
325
  },
326
+ 'Error'() {
327
+ $mol_assert_not($mol_compare_deep(new Error('xxx'), new Error('xxx')));
328
+ const fail = (message) => new Error(message);
329
+ $mol_assert_ok($mol_compare_deep(...['xxx', 'xxx'].map(msg => new Error(msg))));
330
+ $mol_assert_not($mol_compare_deep(...['xxx', 'yyy'].map(msg => new Error(msg))));
331
+ },
320
332
  'Map'() {
321
333
  $mol_assert_ok($mol_compare_deep(new Map, new Map));
322
334
  $mol_assert_ok($mol_compare_deep(new Map([[1, [2]]]), new Map([[1, [2]]])));
@@ -595,6 +607,76 @@ var $;
595
607
  ;
596
608
  "use strict";
597
609
  var $;
610
+ (function ($) {
611
+ function $mol_log3_area_lazy(event) {
612
+ const self = this;
613
+ const stack = self.$mol_log3_stack;
614
+ const deep = stack.length;
615
+ let logged = false;
616
+ stack.push(() => {
617
+ logged = true;
618
+ self.$mol_log3_area.call(self, event);
619
+ });
620
+ return () => {
621
+ if (logged)
622
+ self.console.groupEnd();
623
+ if (stack.length > deep)
624
+ stack.length = deep;
625
+ };
626
+ }
627
+ $.$mol_log3_area_lazy = $mol_log3_area_lazy;
628
+ $.$mol_log3_stack = [];
629
+ })($ || ($ = {}));
630
+ //mol/log3/log3.ts
631
+ ;
632
+ "use strict";
633
+ //mol/type/keys/extract/extract.test.ts
634
+ ;
635
+ "use strict";
636
+ var $;
637
+ (function ($_1) {
638
+ $mol_test_mocks.push($ => {
639
+ $.$mol_log3_come = () => { };
640
+ $.$mol_log3_done = () => { };
641
+ $.$mol_log3_fail = () => { };
642
+ $.$mol_log3_warn = () => { };
643
+ $.$mol_log3_rise = () => { };
644
+ $.$mol_log3_area = () => () => { };
645
+ });
646
+ })($ || ($ = {}));
647
+ //mol/log3/log3.test.ts
648
+ ;
649
+ "use strict";
650
+ var $;
651
+ (function ($) {
652
+ function $mol_log3_web_make(level, color) {
653
+ return function $mol_log3_logger(event) {
654
+ const pending = this.$mol_log3_stack.pop();
655
+ if (pending)
656
+ pending();
657
+ let tpl = '%c';
658
+ const chunks = Object.values(event);
659
+ for (let i = 0; i < chunks.length; ++i) {
660
+ tpl += (typeof chunks[i] === 'string') ? ' ⦙ %s' : ' ⦙ %o';
661
+ }
662
+ const style = `color:${color};font-weight:bolder`;
663
+ this.console[level](tpl, style, ...chunks);
664
+ const self = this;
665
+ return () => self.console.groupEnd();
666
+ };
667
+ }
668
+ $.$mol_log3_web_make = $mol_log3_web_make;
669
+ $.$mol_log3_come = $mol_log3_web_make('info', 'royalblue');
670
+ $.$mol_log3_done = $mol_log3_web_make('info', 'forestgreen');
671
+ $.$mol_log3_fail = $mol_log3_web_make('error', 'orangered');
672
+ $.$mol_log3_warn = $mol_log3_web_make('warn', 'goldenrod');
673
+ $.$mol_log3_rise = $mol_log3_web_make('log', 'magenta');
674
+ $.$mol_log3_area = $mol_log3_web_make('group', 'cyan');
675
+ })($ || ($ = {}));
676
+ //mol/log3/log3.web.ts
677
+ ;
678
+ "use strict";
679
+ var $;
598
680
  (function ($_1) {
599
681
  $mol_test_mocks.push($ => {
600
682
  $.$mol_after_tick = $mol_after_mock_commmon;
@@ -639,11 +721,12 @@ var $;
639
721
  const sub = new $mol_wire_pub_sub;
640
722
  const bu1 = sub.track_on();
641
723
  try {
642
- pub1.track_promote();
643
- pub2.track_promote();
644
- pub2.track_promote();
724
+ pub1.promote();
725
+ pub2.promote();
726
+ pub2.promote();
645
727
  }
646
728
  finally {
729
+ sub.track_cut();
647
730
  sub.track_off(bu1);
648
731
  }
649
732
  pub1.emit();
@@ -651,11 +734,12 @@ var $;
651
734
  $mol_assert_like(sub.pub_list, [pub1, pub2, pub2]);
652
735
  const bu2 = sub.track_on();
653
736
  try {
654
- pub1.track_promote();
655
- pub1.track_promote();
656
- pub2.track_promote();
737
+ pub1.promote();
738
+ pub1.promote();
739
+ pub2.promote();
657
740
  }
658
741
  finally {
742
+ sub.track_cut();
659
743
  sub.track_off(bu2);
660
744
  }
661
745
  pub1.emit();
@@ -669,13 +753,15 @@ var $;
669
753
  try {
670
754
  const bu2 = sub2.track_on();
671
755
  try {
672
- $mol_assert_fail(() => sub1.track_promote(), 'Circular subscription');
756
+ $mol_assert_fail(() => sub1.promote(), 'Circular subscription');
673
757
  }
674
758
  finally {
759
+ sub2.track_cut();
675
760
  sub2.track_off(bu2);
676
761
  }
677
762
  }
678
763
  finally {
764
+ sub1.track_cut();
679
765
  sub1.track_off(bu1);
680
766
  }
681
767
  },
@@ -685,61 +771,6 @@ var $;
685
771
  ;
686
772
  "use strict";
687
773
  var $;
688
- (function ($) {
689
- $mol_test({
690
- 'Primitives'() {
691
- $mol_assert_equal($mol_key(null), 'null');
692
- $mol_assert_equal($mol_key(false), 'false');
693
- $mol_assert_equal($mol_key(true), 'true');
694
- $mol_assert_equal($mol_key(0), '0');
695
- $mol_assert_equal($mol_key(''), '""');
696
- },
697
- 'Array & POJO'() {
698
- $mol_assert_equal($mol_key([null]), '[null]');
699
- $mol_assert_equal($mol_key({ foo: 0 }), '{"foo":0}');
700
- $mol_assert_equal($mol_key({ foo: [false] }), '{"foo":[false]}');
701
- },
702
- 'Function'() {
703
- const func = () => { };
704
- $mol_assert_equal($mol_key(func), $mol_key(func));
705
- $mol_assert_unique($mol_key(func), $mol_key(() => { }));
706
- },
707
- 'Objects'() {
708
- class User {
709
- }
710
- const jin = new User();
711
- $mol_assert_equal($mol_key(jin), $mol_key(jin));
712
- $mol_assert_unique($mol_key(jin), $mol_key(new User()));
713
- },
714
- 'Elements'() {
715
- const foo = $mol_jsx("div", null, "bar");
716
- $mol_assert_equal($mol_key(foo), $mol_key(foo));
717
- $mol_assert_unique($mol_key(foo), $mol_key($mol_jsx("div", null, "bar")));
718
- },
719
- 'Custom JSON representation'() {
720
- class User {
721
- name;
722
- age;
723
- constructor(name, age) {
724
- this.name = name;
725
- this.age = age;
726
- }
727
- toJSON() { return { name: this.name }; }
728
- }
729
- $mol_assert_equal($mol_key(new User('jin', 18)), '{"name":"jin"}');
730
- },
731
- 'Special native classes'() {
732
- $mol_assert_equal($mol_key(new Date('xyz')), 'null');
733
- $mol_assert_equal($mol_key(new Date('2001-01-02T03:04:05.678Z')), '"2001-01-02T03:04:05.678Z"');
734
- $mol_assert_equal($mol_key(/./), '"/./"');
735
- $mol_assert_equal($mol_key(/\./gimsu), '"/\\\\./gimsu"');
736
- },
737
- });
738
- })($ || ($ = {}));
739
- //mol/key/key.test.tsx
740
- ;
741
- "use strict";
742
- var $;
743
774
  (function ($_1) {
744
775
  $mol_test_mocks.push($ => {
745
776
  $.$mol_after_frame = $mol_after_mock_commmon;
@@ -838,8 +869,9 @@ var $;
838
869
  const val = obj[field];
839
870
  if (typeof val !== 'function')
840
871
  return val;
872
+ const temp = $mol_wire_task.getter(val);
841
873
  return function $mol_wire_sync(...args) {
842
- const fiber = $mol_wire_fiber.temp(obj, val, ...args);
874
+ const fiber = temp(obj, args);
843
875
  return fiber.sync();
844
876
  };
845
877
  }
@@ -851,6 +883,52 @@ var $;
851
883
  ;
852
884
  "use strict";
853
885
  var $;
886
+ (function ($) {
887
+ function $mol_promise() {
888
+ let done;
889
+ let fail;
890
+ const promise = new Promise((d, f) => {
891
+ done = d;
892
+ fail = f;
893
+ });
894
+ return Object.assign(promise, {
895
+ done,
896
+ fail,
897
+ });
898
+ }
899
+ $.$mol_promise = $mol_promise;
900
+ })($ || ($ = {}));
901
+ //mol/promise/promise.ts
902
+ ;
903
+ "use strict";
904
+ var $;
905
+ (function ($_1) {
906
+ $mol_test_mocks.push($ => {
907
+ $.$mol_after_timeout = $mol_after_mock_timeout;
908
+ });
909
+ })($ || ($ = {}));
910
+ //mol/after/timeout/timeout.test.ts
911
+ ;
912
+ "use strict";
913
+ var $;
914
+ (function ($) {
915
+ function $mol_wait_timeout_async(timeout) {
916
+ const promise = $mol_promise();
917
+ const task = new this.$mol_after_timeout(timeout, () => promise.done());
918
+ return Object.assign(promise, {
919
+ destructor: () => task.destructor()
920
+ });
921
+ }
922
+ $.$mol_wait_timeout_async = $mol_wait_timeout_async;
923
+ function $mol_wait_timeout(timeout) {
924
+ return this.$mol_wire_sync(this).$mol_wait_timeout_async(timeout);
925
+ }
926
+ $.$mol_wait_timeout = $mol_wait_timeout;
927
+ })($ || ($ = {}));
928
+ //mol/wait/timeout/timeout.ts
929
+ ;
930
+ "use strict";
931
+ var $;
854
932
  (function ($_1) {
855
933
  $mol_test({
856
934
  'Cached channel'($) {
@@ -859,19 +937,13 @@ var $;
859
937
  static value(next = 1) {
860
938
  return next + 1;
861
939
  }
862
- static test() {
863
- $mol_assert_equal(App.value(), 2);
864
- App.value(2);
865
- $mol_assert_equal(App.value(), 3);
866
- }
867
940
  }
868
941
  __decorate([
869
942
  $mol_wire_mem(0)
870
943
  ], App, "value", null);
871
- __decorate([
872
- $mol_wire_method
873
- ], App, "test", null);
874
- App.test();
944
+ $mol_assert_equal(App.value(), 2);
945
+ App.value(2);
946
+ $mol_assert_equal(App.value(), 3);
875
947
  },
876
948
  'Mem overrides mem'($) {
877
949
  class Base extends $mol_object2 {
@@ -895,19 +967,13 @@ var $;
895
967
  static value(next) {
896
968
  return super.value(next) * 3;
897
969
  }
898
- static test() {
899
- $mol_assert_equal(this.value(), 9);
900
- $mol_assert_equal(this.value(5), 21);
901
- $mol_assert_equal(this.value(), 21);
902
- }
903
970
  }
904
971
  __decorate([
905
972
  $mol_wire_mem(0)
906
973
  ], App, "value", null);
907
- __decorate([
908
- $mol_wire_method
909
- ], App, "test", null);
910
- App.test();
974
+ $mol_assert_equal(App.value(), 9);
975
+ $mol_assert_equal(App.value(5), 21);
976
+ $mol_assert_equal(App.value(), 21);
911
977
  },
912
978
  'Auto recalculation of cached values'($) {
913
979
  class App extends $mol_object2 {
@@ -921,12 +987,6 @@ var $;
921
987
  static zzz() {
922
988
  return this.yyy() + 1;
923
989
  }
924
- static test() {
925
- $mol_assert_equal(App.yyy(), 2);
926
- $mol_assert_equal(App.zzz(), 3);
927
- App.xxx(5);
928
- $mol_assert_equal(App.zzz(), 7);
929
- }
930
990
  }
931
991
  __decorate([
932
992
  $mol_wire_mem(0)
@@ -937,10 +997,10 @@ var $;
937
997
  __decorate([
938
998
  $mol_wire_mem(0)
939
999
  ], App, "zzz", null);
940
- __decorate([
941
- $mol_wire_method
942
- ], App, "test", null);
943
- App.test();
1000
+ $mol_assert_equal(App.yyy(), 2);
1001
+ $mol_assert_equal(App.zzz(), 3);
1002
+ App.xxx(5);
1003
+ $mol_assert_equal(App.zzz(), 7);
944
1004
  },
945
1005
  'Skip recalculation when actually no dependency changes'($) {
946
1006
  const log = [];
@@ -958,13 +1018,6 @@ var $;
958
1018
  log.push('zzz');
959
1019
  return this.yyy()[0] + 1;
960
1020
  }
961
- static test() {
962
- App.zzz();
963
- $mol_assert_like(log, ['zzz', 'yyy', 'xxx']);
964
- App.xxx(5);
965
- App.zzz();
966
- $mol_assert_like(log, ['zzz', 'yyy', 'xxx', 'xxx', 'yyy']);
967
- }
968
1021
  }
969
1022
  __decorate([
970
1023
  $mol_wire_mem(0)
@@ -975,10 +1028,12 @@ var $;
975
1028
  __decorate([
976
1029
  $mol_wire_mem(0)
977
1030
  ], App, "zzz", null);
978
- __decorate([
979
- $mol_wire_method
980
- ], App, "test", null);
981
- App.test();
1031
+ App.zzz();
1032
+ $mol_assert_like(log, ['zzz', 'yyy', 'xxx']);
1033
+ App.xxx(5);
1034
+ $mol_assert_like(log, ['zzz', 'yyy', 'xxx', 'xxx']);
1035
+ App.zzz();
1036
+ $mol_assert_like(log, ['zzz', 'yyy', 'xxx', 'xxx', 'yyy']);
982
1037
  },
983
1038
  'Flow: Auto'($) {
984
1039
  class App extends $mol_object2 {
@@ -1023,13 +1078,6 @@ var $;
1023
1078
  static bar() {
1024
1079
  return { ...this.foo(), count: ++counter };
1025
1080
  }
1026
- static test() {
1027
- $mol_assert_like(App.bar(), { numbs: [1], count: 1 });
1028
- App.foo({ numbs: [1] });
1029
- $mol_assert_like(App.bar(), { numbs: [1], count: 1 });
1030
- App.foo({ numbs: [2] });
1031
- $mol_assert_like(App.bar(), { numbs: [2], count: 2 });
1032
- }
1033
1081
  }
1034
1082
  __decorate([
1035
1083
  $mol_wire_mem(0)
@@ -1037,10 +1085,11 @@ var $;
1037
1085
  __decorate([
1038
1086
  $mol_wire_mem(0)
1039
1087
  ], App, "bar", null);
1040
- __decorate([
1041
- $mol_wire_method
1042
- ], App, "test", null);
1043
- App.test();
1088
+ $mol_assert_like(App.bar(), { numbs: [1], count: 1 });
1089
+ App.foo({ numbs: [1] });
1090
+ $mol_assert_like(App.bar(), { numbs: [1], count: 1 });
1091
+ App.foo({ numbs: [2] });
1092
+ $mol_assert_like(App.bar(), { numbs: [2], count: 2 });
1044
1093
  },
1045
1094
  'Cycle: Fail'($) {
1046
1095
  class App extends $mol_object2 {
@@ -1078,13 +1127,6 @@ var $;
1078
1127
  static slow(next) {
1079
1128
  return this.store(next);
1080
1129
  }
1081
- static test() {
1082
- App.fast();
1083
- $mol_assert_equal(App.slow(666), 666);
1084
- $mol_assert_equal(App.fast(), App.slow(), 666);
1085
- App.store(777);
1086
- $mol_assert_equal(App.fast(), App.slow(), 777);
1087
- }
1088
1130
  }
1089
1131
  __decorate([
1090
1132
  $mol_wire_mem(0)
@@ -1095,10 +1137,11 @@ var $;
1095
1137
  __decorate([
1096
1138
  $mol_wire_mem(0)
1097
1139
  ], App, "slow", null);
1098
- __decorate([
1099
- $mol_wire_method
1100
- ], App, "test", null);
1101
- App.test();
1140
+ App.fast();
1141
+ $mol_assert_equal(App.slow(666), 666);
1142
+ $mol_assert_equal(App.fast(), App.slow(), 666);
1143
+ App.store(777);
1144
+ $mol_assert_equal(App.fast(), App.slow(), 777);
1102
1145
  },
1103
1146
  'Actions inside invariant'($) {
1104
1147
  class App extends $mol_object2 {
@@ -1115,11 +1158,6 @@ var $;
1115
1158
  this.count(count + 1);
1116
1159
  return count + 1;
1117
1160
  }
1118
- static test() {
1119
- $mol_assert_like(App.res(), 1);
1120
- App.count(5);
1121
- $mol_assert_like(App.res(), 6);
1122
- }
1123
1161
  }
1124
1162
  __decorate([
1125
1163
  $mol_wire_mem(0)
@@ -1130,10 +1168,43 @@ var $;
1130
1168
  __decorate([
1131
1169
  $mol_wire_mem(0)
1132
1170
  ], App, "res", null);
1171
+ $mol_assert_like(App.res(), 1);
1172
+ App.count(5);
1173
+ $mol_assert_like(App.res(), 6);
1174
+ },
1175
+ async 'Toggle with async'($) {
1176
+ class App extends $mol_object2 {
1177
+ static $ = $;
1178
+ static checked(next = false) {
1179
+ $$.$mol_wait_timeout(0);
1180
+ return next;
1181
+ }
1182
+ static toggle() {
1183
+ const prev = this.checked();
1184
+ $mol_assert_unique(this.checked(!prev), prev);
1185
+ }
1186
+ static res() {
1187
+ return this.checked();
1188
+ }
1189
+ static test() {
1190
+ $mol_assert_equal(App.res(), false);
1191
+ App.toggle();
1192
+ $mol_assert_equal(App.res(), true);
1193
+ }
1194
+ }
1195
+ __decorate([
1196
+ $mol_wire_mem(0)
1197
+ ], App, "checked", null);
1198
+ __decorate([
1199
+ $mol_wire_method
1200
+ ], App, "toggle", null);
1201
+ __decorate([
1202
+ $mol_wire_mem(0)
1203
+ ], App, "res", null);
1133
1204
  __decorate([
1134
1205
  $mol_wire_method
1135
1206
  ], App, "test", null);
1136
- App.test();
1207
+ await $mol_wire_async(App).test();
1137
1208
  },
1138
1209
  'Restore after error'($) {
1139
1210
  class App extends $mol_object2 {
@@ -1232,28 +1303,41 @@ var $;
1232
1303
  App.showing(true);
1233
1304
  $mol_assert_unique(App.render(), details);
1234
1305
  },
1235
- 'Forget sub fibers on complete'($) {
1306
+ async 'Hold pubs while wait async task'($) {
1236
1307
  class App extends $mol_object2 {
1237
- static get $() { return $; }
1308
+ static $ = $;
1238
1309
  static counter = 0;
1239
- static count() { return this.counter++; }
1240
- static data(next = 1) { return next; }
1310
+ static resets(next) {
1311
+ return ($mol_wire_probe(() => this.resets()) ?? -1) + 1;
1312
+ }
1313
+ static async wait() { }
1314
+ static value() {
1315
+ return ++this.counter;
1316
+ }
1241
1317
  static result() {
1242
- return this.count() + this.data();
1318
+ if (this.resets())
1319
+ $mol_wire_sync(this).wait();
1320
+ return this.value();
1321
+ }
1322
+ static test() {
1243
1323
  }
1244
1324
  }
1245
1325
  __decorate([
1246
- $mol_wire_method
1247
- ], App, "count", null);
1326
+ $mol_wire_mem(0)
1327
+ ], App, "resets", null);
1248
1328
  __decorate([
1249
1329
  $mol_wire_mem(0)
1250
- ], App, "data", null);
1330
+ ], App, "value", null);
1251
1331
  __decorate([
1252
1332
  $mol_wire_mem(0)
1253
1333
  ], App, "result", null);
1334
+ __decorate([
1335
+ $mol_wire_method
1336
+ ], App, "test", null);
1254
1337
  $mol_assert_equal(App.result(), 1);
1255
- App.data(2);
1256
- $mol_assert_equal(App.result(), 3);
1338
+ App.resets(null);
1339
+ $mol_wire_fiber.sync();
1340
+ $mol_assert_equal(await $mol_wire_async(App).result(), 1);
1257
1341
  },
1258
1342
  'Memoize by single simple key'($) {
1259
1343
  class Team extends $mol_object2 {
@@ -1268,9 +1352,6 @@ var $;
1268
1352
  ];
1269
1353
  }
1270
1354
  static test() {
1271
- $mol_assert_like(this.user_names(), ['jin', 'john']);
1272
- Team.user_name('jin', 'JIN');
1273
- $mol_assert_like(this.user_names(), ['JIN', 'john']);
1274
1355
  }
1275
1356
  }
1276
1357
  __decorate([
@@ -1282,7 +1363,9 @@ var $;
1282
1363
  __decorate([
1283
1364
  $mol_wire_method
1284
1365
  ], Team, "test", null);
1285
- Team.test();
1366
+ $mol_assert_like(Team.user_names(), ['jin', 'john']);
1367
+ Team.user_name('jin', 'JIN');
1368
+ $mol_assert_like(Team.user_names(), ['JIN', 'john']);
1286
1369
  },
1287
1370
  'Memoize by single complex key'($) {
1288
1371
  class Map extends $mol_object2 {
@@ -1359,59 +1442,45 @@ var $;
1359
1442
  ++this.sums;
1360
1443
  return this.value(index - 1) + this.value(index - 2);
1361
1444
  }
1362
- static test() {
1363
- $mol_assert_equal(this.value(4), 5);
1364
- $mol_assert_equal(this.sums, 3);
1365
- this.value(1, 2);
1366
- $mol_assert_equal(this.value(4), 8);
1367
- $mol_assert_equal(this.sums, 6);
1368
- }
1369
1445
  }
1370
1446
  __decorate([
1371
1447
  $mol_wire_mem(1)
1372
1448
  ], Fib, "value", null);
1373
- __decorate([
1374
- $mol_wire_method
1375
- ], Fib, "test", null);
1376
- Fib.test();
1449
+ $mol_assert_equal(Fib.value(4), 5);
1450
+ $mol_assert_equal(Fib.sums, 3);
1451
+ Fib.value(1, 2);
1452
+ $mol_assert_equal(Fib.value(4), 8);
1453
+ $mol_assert_equal(Fib.sums, 6);
1377
1454
  },
1378
- 'Unsubscribe from temp pubs on complete'($) {
1379
- class Random extends $mol_object2 {
1380
- static $ = $;
1381
- static seed() {
1382
- return Math.random();
1383
- }
1384
- static resets(next) {
1385
- return Math.random();
1386
- }
1387
- static value() {
1388
- this.resets();
1389
- return this.seed();
1390
- }
1391
- static test() {
1392
- const first = this.value();
1393
- this.resets(null);
1394
- const second = this.value();
1395
- $mol_assert_unique(first, second);
1455
+ });
1456
+ })($ || ($ = {}));
1457
+ //mol/wire/mem/mem.test.ts
1458
+ ;
1459
+ "use strict";
1460
+ var $;
1461
+ (function ($) {
1462
+ $mol_test({
1463
+ 'Previous value'() {
1464
+ class Cache extends $mol_object2 {
1465
+ static store(next) {
1466
+ if (!next)
1467
+ return {};
1468
+ return {
1469
+ ...$mol_wire_probe(() => this.store()) ?? {},
1470
+ ...next,
1471
+ };
1396
1472
  }
1397
1473
  }
1398
- __decorate([
1399
- $mol_wire_method
1400
- ], Random, "seed", null);
1401
1474
  __decorate([
1402
1475
  $mol_wire_mem(0)
1403
- ], Random, "resets", null);
1404
- __decorate([
1405
- $mol_wire_mem(0)
1406
- ], Random, "value", null);
1407
- __decorate([
1408
- $mol_wire_method
1409
- ], Random, "test", null);
1410
- Random.test();
1476
+ ], Cache, "store", null);
1477
+ $mol_assert_like(Cache.store(), {});
1478
+ $mol_assert_like(Cache.store({ foo: 666 }), { foo: 666 });
1479
+ $mol_assert_like(Cache.store({ bar: 777 }), { foo: 666, bar: 777 });
1411
1480
  },
1412
1481
  });
1413
1482
  })($ || ($ = {}));
1414
- //mol/wire/mem/mem.test.ts
1483
+ //mol/wire/probe/probe.test.ts
1415
1484
  ;
1416
1485
  "use strict";
1417
1486
  var $;
@@ -1450,19 +1519,6 @@ var $;
1450
1519
  ;
1451
1520
  "use strict";
1452
1521
  var $;
1453
- (function ($) {
1454
- $mol_test({
1455
- 'const returns stored value'() {
1456
- const foo = { bar: $mol_const(Math.random()) };
1457
- $mol_assert_equal(foo.bar(), foo.bar());
1458
- $mol_assert_equal(foo.bar(), foo.bar['()']);
1459
- },
1460
- });
1461
- })($ || ($ = {}));
1462
- //mol/const/const.test.ts
1463
- ;
1464
- "use strict";
1465
- var $;
1466
1522
  (function ($) {
1467
1523
  $mol_test({
1468
1524
  'run callback'() {
@@ -1606,6 +1662,19 @@ var $;
1606
1662
  ;
1607
1663
  "use strict";
1608
1664
  var $;
1665
+ (function ($) {
1666
+ $mol_test({
1667
+ 'const returns stored value'() {
1668
+ const foo = { bar: $mol_const(Math.random()) };
1669
+ $mol_assert_equal(foo.bar(), foo.bar());
1670
+ $mol_assert_equal(foo.bar(), foo.bar['()']);
1671
+ },
1672
+ });
1673
+ })($ || ($ = {}));
1674
+ //mol/const/const.test.ts
1675
+ ;
1676
+ "use strict";
1677
+ var $;
1609
1678
  (function ($_1) {
1610
1679
  $mol_test({
1611
1680
  'FQN of anon function'($) {
@@ -1616,24 +1685,123 @@ var $;
1616
1685
  },
1617
1686
  });
1618
1687
  })($ || ($ = {}));
1619
- //mol/func/name/name.test.ts
1620
- ;
1621
- "use strict";
1622
- //mol/type/keys/extract/extract.test.ts
1688
+ //mol/func/name/name.test.ts
1689
+ ;
1690
+ "use strict";
1691
+ var $;
1692
+ (function ($) {
1693
+ class $mol_wire_log extends $mol_object2 {
1694
+ static watch(task) {
1695
+ return task;
1696
+ }
1697
+ static track(fiber) {
1698
+ const prev = $mol_wire_probe(() => this.track(fiber));
1699
+ let next;
1700
+ try {
1701
+ next = fiber.sync();
1702
+ }
1703
+ finally {
1704
+ for (const pub of fiber.pub_list) {
1705
+ if (pub instanceof $mol_wire_fiber) {
1706
+ this.track(pub);
1707
+ }
1708
+ }
1709
+ }
1710
+ if (prev !== undefined && !$mol_compare_deep(prev, next)) {
1711
+ this.$.$mol_log3_rise({
1712
+ message: 'Changed',
1713
+ place: fiber,
1714
+ });
1715
+ }
1716
+ return next;
1717
+ }
1718
+ static active() {
1719
+ try {
1720
+ this.watch()?.();
1721
+ }
1722
+ finally {
1723
+ for (const pub of $mol_wire_auto().pub_list) {
1724
+ if (pub instanceof $mol_wire_fiber) {
1725
+ this.track(pub);
1726
+ }
1727
+ }
1728
+ }
1729
+ }
1730
+ }
1731
+ __decorate([
1732
+ $mol_mem
1733
+ ], $mol_wire_log, "watch", null);
1734
+ __decorate([
1735
+ $mol_mem_key
1736
+ ], $mol_wire_log, "track", null);
1737
+ __decorate([
1738
+ $mol_mem
1739
+ ], $mol_wire_log, "active", null);
1740
+ $.$mol_wire_log = $mol_wire_log;
1741
+ })($ || ($ = {}));
1742
+ //mol/wire/log/log.ts
1743
+ ;
1744
+ "use strict";
1745
+ var $;
1746
+ (function ($) {
1747
+ $mol_test({
1748
+ 'Primitives'() {
1749
+ $mol_assert_equal($mol_key(null), 'null');
1750
+ $mol_assert_equal($mol_key(false), 'false');
1751
+ $mol_assert_equal($mol_key(true), 'true');
1752
+ $mol_assert_equal($mol_key(0), '0');
1753
+ $mol_assert_equal($mol_key(''), '""');
1754
+ },
1755
+ 'Array & POJO'() {
1756
+ $mol_assert_equal($mol_key([null]), '[null]');
1757
+ $mol_assert_equal($mol_key({ foo: 0 }), '{"foo":0}');
1758
+ $mol_assert_equal($mol_key({ foo: [false] }), '{"foo":[false]}');
1759
+ },
1760
+ 'Function'() {
1761
+ const func = () => { };
1762
+ $mol_assert_equal($mol_key(func), $mol_key(func));
1763
+ $mol_assert_unique($mol_key(func), $mol_key(() => { }));
1764
+ },
1765
+ 'Objects'() {
1766
+ class User {
1767
+ }
1768
+ const jin = new User();
1769
+ $mol_assert_equal($mol_key(jin), $mol_key(jin));
1770
+ $mol_assert_unique($mol_key(jin), $mol_key(new User()));
1771
+ },
1772
+ 'Elements'() {
1773
+ const foo = $mol_jsx("div", null, "bar");
1774
+ $mol_assert_equal($mol_key(foo), $mol_key(foo));
1775
+ $mol_assert_unique($mol_key(foo), $mol_key($mol_jsx("div", null, "bar")));
1776
+ },
1777
+ 'Custom JSON representation'() {
1778
+ class User {
1779
+ name;
1780
+ age;
1781
+ constructor(name, age) {
1782
+ this.name = name;
1783
+ this.age = age;
1784
+ }
1785
+ toJSON() { return { name: this.name }; }
1786
+ }
1787
+ $mol_assert_equal($mol_key(new User('jin', 18)), '{"name":"jin"}');
1788
+ },
1789
+ 'Special native classes'() {
1790
+ $mol_assert_equal($mol_key(new Date('xyz')), 'null');
1791
+ $mol_assert_equal($mol_key(new Date('2001-01-02T03:04:05.678Z')), '"2001-01-02T03:04:05.678Z"');
1792
+ $mol_assert_equal($mol_key(/./), '"/./"');
1793
+ $mol_assert_equal($mol_key(/\./gimsu), '"/\\\\./gimsu"');
1794
+ },
1795
+ });
1796
+ })($ || ($ = {}));
1797
+ //mol/key/key.test.tsx
1623
1798
  ;
1624
1799
  "use strict";
1625
1800
  var $;
1626
- (function ($_1) {
1627
- $mol_test_mocks.push($ => {
1628
- $.$mol_log3_come = () => { };
1629
- $.$mol_log3_done = () => { };
1630
- $.$mol_log3_fail = () => { };
1631
- $.$mol_log3_warn = () => { };
1632
- $.$mol_log3_rise = () => { };
1633
- $.$mol_log3_area = () => () => { };
1634
- });
1801
+ (function ($) {
1802
+ $mol_wire_log.active();
1635
1803
  })($ || ($ = {}));
1636
- //mol/log3/log3.test.ts
1804
+ //mol/wire/atom/atom.test.ts
1637
1805
  ;
1638
1806
  "use strict";
1639
1807
  var $;
@@ -1745,120 +1913,6 @@ var $;
1745
1913
  ;
1746
1914
  "use strict";
1747
1915
  var $;
1748
- (function ($_1) {
1749
- $mol_test_mocks.push($ => {
1750
- $.$mol_after_timeout = $mol_after_mock_timeout;
1751
- });
1752
- })($ || ($ = {}));
1753
- //mol/after/timeout/timeout.test.ts
1754
- ;
1755
- "use strict";
1756
- var $;
1757
- (function ($_1) {
1758
- $mol_test_mocks.push($ => {
1759
- $.$mol_after_work = $mol_after_mock_timeout;
1760
- });
1761
- })($ || ($ = {}));
1762
- //mol/after/work/work.test.ts
1763
- ;
1764
- "use strict";
1765
- var $;
1766
- (function ($) {
1767
- $mol_test({
1768
- 'Vector limiting'() {
1769
- let point = new $mol_vector_3d(7, 10, 13);
1770
- const res = point.limited([[1, 5], [15, 20], [5, 10]]);
1771
- $mol_assert_equal(res.x, 5);
1772
- $mol_assert_equal(res.y, 15);
1773
- $mol_assert_equal(res.z, 10);
1774
- },
1775
- 'Vector adding scalar'() {
1776
- let point = new $mol_vector_3d(1, 2, 3);
1777
- let res = point.added0(5);
1778
- $mol_assert_equal(res.x, 6);
1779
- $mol_assert_equal(res.y, 7);
1780
- $mol_assert_equal(res.z, 8);
1781
- },
1782
- 'Vector adding vector'() {
1783
- let point = new $mol_vector_3d(1, 2, 3);
1784
- let res = point.added1([5, 10, 15]);
1785
- $mol_assert_equal(res.x, 6);
1786
- $mol_assert_equal(res.y, 12);
1787
- $mol_assert_equal(res.z, 18);
1788
- },
1789
- 'Vector multiplying scalar'() {
1790
- let point = new $mol_vector_3d(2, 3, 4);
1791
- let res = point.multed0(-1);
1792
- $mol_assert_equal(res.x, -2);
1793
- $mol_assert_equal(res.y, -3);
1794
- $mol_assert_equal(res.z, -4);
1795
- },
1796
- 'Vector multiplying vector'() {
1797
- let point = new $mol_vector_3d(2, 3, 4);
1798
- let res = point.multed1([5, 2, -2]);
1799
- $mol_assert_equal(res.x, 10);
1800
- $mol_assert_equal(res.y, 6);
1801
- $mol_assert_equal(res.z, -8);
1802
- },
1803
- 'Matrix adding matrix'() {
1804
- let matrix = new $mol_vector_matrix(...[[1, 2], [3, 4], [5, 6]]);
1805
- let res = matrix.added2([[10, 20], [30, 40], [50, 60]]);
1806
- $mol_assert_equal(res[0][0], 11);
1807
- $mol_assert_equal(res[0][1], 22);
1808
- $mol_assert_equal(res[1][0], 33);
1809
- $mol_assert_equal(res[1][1], 44);
1810
- $mol_assert_equal(res[2][0], 55);
1811
- $mol_assert_equal(res[2][1], 66);
1812
- },
1813
- 'Matrix multiplying matrix'() {
1814
- let matrix = new $mol_vector_matrix(...[[2, 3], [4, 5], [6, 7]]);
1815
- let res = matrix.multed2([[2, 3], [4, 5], [6, 7]]);
1816
- $mol_assert_equal(res[0][0], 4);
1817
- $mol_assert_equal(res[0][1], 9);
1818
- $mol_assert_equal(res[1][0], 16);
1819
- $mol_assert_equal(res[1][1], 25);
1820
- $mol_assert_equal(res[2][0], 36);
1821
- $mol_assert_equal(res[2][1], 49);
1822
- },
1823
- 'Range expanding'() {
1824
- let range = $mol_vector_range_full.inversed;
1825
- const expanded = range.expanded0(10).expanded0(5);
1826
- $mol_assert_like([...expanded], [5, 10]);
1827
- },
1828
- 'Vector of range expanding by vector'() {
1829
- let dimensions = new $mol_vector_2d($mol_vector_range_full.inversed, $mol_vector_range_full.inversed);
1830
- const expanded = dimensions.expanded1([1, 7]).expanded1([3, 5]);
1831
- $mol_assert_like([...expanded.x], [1, 3]);
1832
- $mol_assert_like([...expanded.y], [5, 7]);
1833
- },
1834
- 'Vector of range expanding by vector of range'() {
1835
- let dimensions = new $mol_vector_2d($mol_vector_range_full.inversed, $mol_vector_range_full.inversed);
1836
- const expanded = dimensions
1837
- .expanded2([[1, 3], [7, 9]])
1838
- .expanded2([[2, 4], [6, 8]]);
1839
- $mol_assert_like([...expanded.x], [1, 4]);
1840
- $mol_assert_like([...expanded.y], [6, 9]);
1841
- },
1842
- 'Vector of infinity range expanding by vector of range'() {
1843
- let dimensions = new $mol_vector_2d($mol_vector_range_full.inversed, $mol_vector_range_full.inversed);
1844
- const next = new $mol_vector_2d($mol_vector_range_full.inversed, $mol_vector_range_full.inversed);
1845
- const expanded = next
1846
- .expanded2(dimensions);
1847
- $mol_assert_like([...expanded.x], [Infinity, -Infinity]);
1848
- $mol_assert_like([...expanded.y], [Infinity, -Infinity]);
1849
- },
1850
- });
1851
- })($ || ($ = {}));
1852
- //mol/vector/vector.test.ts
1853
- ;
1854
- "use strict";
1855
- //mol/type/equals/equals.test.ts
1856
- ;
1857
- "use strict";
1858
- //mol/type/equals/equals.ts
1859
- ;
1860
- "use strict";
1861
- var $;
1862
1916
  (function ($) {
1863
1917
  class $mol_view_tree_test_attributes_super extends $mol_view {
1864
1918
  some() {
@@ -2055,6 +2109,30 @@ var $;
2055
2109
  ;
2056
2110
  "use strict";
2057
2111
  var $;
2112
+ (function ($) {
2113
+ function $mol_deprecated(message) {
2114
+ return (host, field, descr) => {
2115
+ const value = descr.value;
2116
+ let warned = false;
2117
+ descr.value = function $mol_deprecated_wrapper(...args) {
2118
+ if (!warned) {
2119
+ $$.$mol_log3_warn({
2120
+ place: `${host.constructor.name}::${field}`,
2121
+ message: `Deprecated`,
2122
+ hint: message,
2123
+ });
2124
+ warned = true;
2125
+ }
2126
+ return value.call(this, ...args);
2127
+ };
2128
+ };
2129
+ }
2130
+ $.$mol_deprecated = $mol_deprecated;
2131
+ })($ || ($ = {}));
2132
+ //mol/deprecated/deprecated.ts
2133
+ ;
2134
+ "use strict";
2135
+ var $;
2058
2136
  (function ($_1) {
2059
2137
  $mol_test({
2060
2138
  'tree parsing'() {
@@ -2618,6 +2696,7 @@ var $;
2618
2696
  static relative(path) {
2619
2697
  throw new Error('Not implemented yet');
2620
2698
  }
2699
+ static base = '';
2621
2700
  path() {
2622
2701
  return '.';
2623
2702
  }
@@ -2651,7 +2730,7 @@ var $;
2651
2730
  return exists;
2652
2731
  if (next)
2653
2732
  this.parent().exists(true);
2654
- this.ensure(next);
2733
+ this.ensure();
2655
2734
  this.reset();
2656
2735
  return next;
2657
2736
  }
@@ -2931,7 +3010,7 @@ var $;
2931
3010
  }
2932
3011
  return this.constructor.absolute(res);
2933
3012
  }
2934
- ensure(next) {
3013
+ ensure() {
2935
3014
  throw new Error('$mol_file_web.ensure() not implemented');
2936
3015
  }
2937
3016
  sub() {
@@ -2969,10 +3048,10 @@ var $;
2969
3048
  return 'en';
2970
3049
  }
2971
3050
  static lang(next) {
2972
- return $mol_state_local.value('locale', next) || $mol_dom_context.navigator.language.replace(/-.*/, '') || this.lang_default();
3051
+ return this.$.$mol_state_local.value('locale', next) || $mol_dom_context.navigator.language.replace(/-.*/, '') || this.lang_default();
2973
3052
  }
2974
3053
  static source(lang) {
2975
- return JSON.parse($mol_file.relative(`web.locale=${lang}.json`).text().toString());
3054
+ return JSON.parse(this.$.$mol_file.relative(`web.locale=${lang}.json`).text().toString());
2976
3055
  }
2977
3056
  static texts(lang, next) {
2978
3057
  if (next)
@@ -3309,38 +3388,91 @@ var $;
3309
3388
  "use strict";
3310
3389
  var $;
3311
3390
  (function ($) {
3312
- function $mol_promise() {
3313
- let done;
3314
- let fail;
3315
- const promise = new Promise((d, f) => {
3316
- done = d;
3317
- fail = f;
3318
- });
3319
- return Object.assign(promise, {
3320
- done,
3321
- fail,
3322
- });
3323
- }
3324
- $.$mol_promise = $mol_promise;
3325
- })($ || ($ = {}));
3326
- //mol/promise/promise.ts
3327
- ;
3328
- "use strict";
3329
- var $;
3330
- (function ($) {
3331
- function $mol_wait_timeout_async(timeout) {
3332
- const promise = $mol_promise();
3333
- const task = new this.$mol_after_timeout(timeout, () => promise.done());
3334
- return Object.assign(promise, {
3335
- destructor: () => task.destructor()
3336
- });
3337
- }
3338
- $.$mol_wait_timeout_async = $mol_wait_timeout_async;
3339
- function $mol_wait_timeout(timeout) {
3340
- return this.$mol_wire_sync(this).$mol_wait_timeout_async(timeout);
3341
- }
3342
- $.$mol_wait_timeout = $mol_wait_timeout;
3391
+ $mol_test({
3392
+ 'Vector limiting'() {
3393
+ let point = new $mol_vector_3d(7, 10, 13);
3394
+ const res = point.limited([[1, 5], [15, 20], [5, 10]]);
3395
+ $mol_assert_equal(res.x, 5);
3396
+ $mol_assert_equal(res.y, 15);
3397
+ $mol_assert_equal(res.z, 10);
3398
+ },
3399
+ 'Vector adding scalar'() {
3400
+ let point = new $mol_vector_3d(1, 2, 3);
3401
+ let res = point.added0(5);
3402
+ $mol_assert_equal(res.x, 6);
3403
+ $mol_assert_equal(res.y, 7);
3404
+ $mol_assert_equal(res.z, 8);
3405
+ },
3406
+ 'Vector adding vector'() {
3407
+ let point = new $mol_vector_3d(1, 2, 3);
3408
+ let res = point.added1([5, 10, 15]);
3409
+ $mol_assert_equal(res.x, 6);
3410
+ $mol_assert_equal(res.y, 12);
3411
+ $mol_assert_equal(res.z, 18);
3412
+ },
3413
+ 'Vector multiplying scalar'() {
3414
+ let point = new $mol_vector_3d(2, 3, 4);
3415
+ let res = point.multed0(-1);
3416
+ $mol_assert_equal(res.x, -2);
3417
+ $mol_assert_equal(res.y, -3);
3418
+ $mol_assert_equal(res.z, -4);
3419
+ },
3420
+ 'Vector multiplying vector'() {
3421
+ let point = new $mol_vector_3d(2, 3, 4);
3422
+ let res = point.multed1([5, 2, -2]);
3423
+ $mol_assert_equal(res.x, 10);
3424
+ $mol_assert_equal(res.y, 6);
3425
+ $mol_assert_equal(res.z, -8);
3426
+ },
3427
+ 'Matrix adding matrix'() {
3428
+ let matrix = new $mol_vector_matrix(...[[1, 2], [3, 4], [5, 6]]);
3429
+ let res = matrix.added2([[10, 20], [30, 40], [50, 60]]);
3430
+ $mol_assert_equal(res[0][0], 11);
3431
+ $mol_assert_equal(res[0][1], 22);
3432
+ $mol_assert_equal(res[1][0], 33);
3433
+ $mol_assert_equal(res[1][1], 44);
3434
+ $mol_assert_equal(res[2][0], 55);
3435
+ $mol_assert_equal(res[2][1], 66);
3436
+ },
3437
+ 'Matrix multiplying matrix'() {
3438
+ let matrix = new $mol_vector_matrix(...[[2, 3], [4, 5], [6, 7]]);
3439
+ let res = matrix.multed2([[2, 3], [4, 5], [6, 7]]);
3440
+ $mol_assert_equal(res[0][0], 4);
3441
+ $mol_assert_equal(res[0][1], 9);
3442
+ $mol_assert_equal(res[1][0], 16);
3443
+ $mol_assert_equal(res[1][1], 25);
3444
+ $mol_assert_equal(res[2][0], 36);
3445
+ $mol_assert_equal(res[2][1], 49);
3446
+ },
3447
+ 'Range expanding'() {
3448
+ let range = $mol_vector_range_full.inversed;
3449
+ const expanded = range.expanded0(10).expanded0(5);
3450
+ $mol_assert_like([...expanded], [5, 10]);
3451
+ },
3452
+ 'Vector of range expanding by vector'() {
3453
+ let dimensions = new $mol_vector_2d($mol_vector_range_full.inversed, $mol_vector_range_full.inversed);
3454
+ const expanded = dimensions.expanded1([1, 7]).expanded1([3, 5]);
3455
+ $mol_assert_like([...expanded.x], [1, 3]);
3456
+ $mol_assert_like([...expanded.y], [5, 7]);
3457
+ },
3458
+ 'Vector of range expanding by vector of range'() {
3459
+ let dimensions = new $mol_vector_2d($mol_vector_range_full.inversed, $mol_vector_range_full.inversed);
3460
+ const expanded = dimensions
3461
+ .expanded2([[1, 3], [7, 9]])
3462
+ .expanded2([[2, 4], [6, 8]]);
3463
+ $mol_assert_like([...expanded.x], [1, 4]);
3464
+ $mol_assert_like([...expanded.y], [6, 9]);
3465
+ },
3466
+ 'Vector of infinity range expanding by vector of range'() {
3467
+ let dimensions = new $mol_vector_2d($mol_vector_range_full.inversed, $mol_vector_range_full.inversed);
3468
+ const next = new $mol_vector_2d($mol_vector_range_full.inversed, $mol_vector_range_full.inversed);
3469
+ const expanded = next
3470
+ .expanded2(dimensions);
3471
+ $mol_assert_like([...expanded.x], [Infinity, -Infinity]);
3472
+ $mol_assert_like([...expanded.y], [Infinity, -Infinity]);
3473
+ },
3474
+ });
3343
3475
  })($ || ($ = {}));
3344
- //mol/wait/timeout/timeout.ts
3476
+ //mol/vector/vector.test.ts
3345
3477
 
3346
3478
  //# sourceMappingURL=web.test.js.map