mol_plot_all 1.2.844 → 1.2.846

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.mjs CHANGED
@@ -1066,6 +1066,62 @@ var $;
1066
1066
  ;
1067
1067
  "use strict";
1068
1068
  var $;
1069
+ (function ($) {
1070
+ function $mol_log3_area_lazy(event) {
1071
+ const self = this;
1072
+ const stack = self.$mol_log3_stack;
1073
+ const deep = stack.length;
1074
+ let logged = false;
1075
+ stack.push(() => {
1076
+ logged = true;
1077
+ self.$mol_log3_area.call(self, event);
1078
+ });
1079
+ return () => {
1080
+ if (logged)
1081
+ self.console.groupEnd();
1082
+ if (stack.length > deep)
1083
+ stack.length = deep;
1084
+ };
1085
+ }
1086
+ $.$mol_log3_area_lazy = $mol_log3_area_lazy;
1087
+ $.$mol_log3_stack = [];
1088
+ })($ || ($ = {}));
1089
+ //mol/log3/log3.ts
1090
+ ;
1091
+ "use strict";
1092
+ //mol/type/keys/extract/extract.ts
1093
+ ;
1094
+ "use strict";
1095
+ var $;
1096
+ (function ($) {
1097
+ function $mol_log3_web_make(level, color) {
1098
+ return function $mol_log3_logger(event) {
1099
+ const pending = this.$mol_log3_stack.pop();
1100
+ if (pending)
1101
+ pending();
1102
+ let tpl = '%c';
1103
+ const chunks = Object.values(event);
1104
+ for (let i = 0; i < chunks.length; ++i) {
1105
+ tpl += (typeof chunks[i] === 'string') ? ' ▫ %s' : ' ▫ %o';
1106
+ }
1107
+ const style = `color:${color};font-weight:bolder`;
1108
+ this.console[level](tpl, style, ...chunks);
1109
+ const self = this;
1110
+ return () => self.console.groupEnd();
1111
+ };
1112
+ }
1113
+ $.$mol_log3_web_make = $mol_log3_web_make;
1114
+ $.$mol_log3_come = $mol_log3_web_make('info', 'royalblue');
1115
+ $.$mol_log3_done = $mol_log3_web_make('info', 'forestgreen');
1116
+ $.$mol_log3_fail = $mol_log3_web_make('error', 'orangered');
1117
+ $.$mol_log3_warn = $mol_log3_web_make('warn', 'goldenrod');
1118
+ $.$mol_log3_rise = $mol_log3_web_make('log', 'magenta');
1119
+ $.$mol_log3_area = $mol_log3_web_make('group', 'cyan');
1120
+ })($ || ($ = {}));
1121
+ //mol/log3/log3.web.ts
1122
+ ;
1123
+ "use strict";
1124
+ var $;
1069
1125
  (function ($) {
1070
1126
  class $mol_wire_task extends $mol_wire_fiber {
1071
1127
  static getter(task) {
@@ -1083,7 +1139,17 @@ var $;
1083
1139
  break reuse;
1084
1140
  return existen;
1085
1141
  }
1086
- return new $mol_wire_task(`${host?.[Symbol.toStringTag] ?? host}.${task.name}(#)`, task, host, args);
1142
+ const next = new $mol_wire_task(`${host?.[Symbol.toStringTag] ?? host}.${task.name}(#)`, task, host, args);
1143
+ if (existen?.temp) {
1144
+ $$.$mol_log3_warn({
1145
+ place: '$mol_wire_task',
1146
+ message: `Non idempotency`,
1147
+ existen,
1148
+ next,
1149
+ hint: 'Ignore it',
1150
+ });
1151
+ }
1152
+ return next;
1087
1153
  };
1088
1154
  }
1089
1155
  get temp() {
@@ -1797,9 +1863,6 @@ var $;
1797
1863
  //mol/wire/async/async.ts
1798
1864
  ;
1799
1865
  "use strict";
1800
- //mol/type/keys/extract/extract.ts
1801
- ;
1802
- "use strict";
1803
1866
  //mol/type/pick/pick.ts
1804
1867
  ;
1805
1868
  "use strict";
package/web.test.js CHANGED
@@ -715,17 +715,6 @@ var $;
715
715
  ;
716
716
  "use strict";
717
717
  var $;
718
- (function ($) {
719
- function $mol_dom_serialize(node) {
720
- const serializer = new $mol_dom_context.XMLSerializer;
721
- return serializer.serializeToString(node);
722
- }
723
- $.$mol_dom_serialize = $mol_dom_serialize;
724
- })($ || ($ = {}));
725
- //mol/dom/serialize/serialize.ts
726
- ;
727
- "use strict";
728
- var $;
729
718
  (function ($) {
730
719
  function $mol_assert_ok(value) {
731
720
  if (value)
@@ -746,14 +735,12 @@ var $;
746
735
  handler();
747
736
  }
748
737
  catch (error) {
749
- if (!ErrorRight)
750
- return error;
751
738
  $.$mol_fail = fail;
752
739
  if (typeof ErrorRight === 'string') {
753
740
  $mol_assert_equal(error.message, ErrorRight);
754
741
  }
755
742
  else {
756
- $mol_assert_ok(error instanceof ErrorRight);
743
+ $mol_assert_equal(error instanceof ErrorRight, true);
757
744
  }
758
745
  return error;
759
746
  }
@@ -763,58 +750,47 @@ var $;
763
750
  $mol_fail(new Error('Not failed'));
764
751
  }
765
752
  $.$mol_assert_fail = $mol_assert_fail;
766
- function $mol_assert_equal(...args) {
767
- for (let i = 0; i < args.length; ++i) {
768
- for (let j = 0; j < args.length; ++j) {
769
- if (i === j)
770
- continue;
771
- if (Number.isNaN(args[i]) && Number.isNaN(args[j]))
772
- continue;
773
- if (args[i] !== args[j])
774
- $mol_fail(new Error(`Not equal (${i + 1}:${j + 1})\n${args[i]}\n${args[j]}`));
775
- }
776
- }
753
+ function $mol_assert_like(...args) {
754
+ $mol_assert_equal(...args);
777
755
  }
778
- $.$mol_assert_equal = $mol_assert_equal;
756
+ $.$mol_assert_like = $mol_assert_like;
779
757
  function $mol_assert_unique(...args) {
780
758
  for (let i = 0; i < args.length; ++i) {
781
759
  for (let j = 0; j < args.length; ++j) {
782
760
  if (i === j)
783
761
  continue;
784
- if (args[i] === args[j] || (Number.isNaN(args[i]) && Number.isNaN(args[j]))) {
785
- $mol_fail(new Error(`args[${i}] = args[${j}] = ${args[i]}`));
786
- }
762
+ if (!$mol_compare_deep(args[i], args[j]))
763
+ continue;
764
+ $mol_fail(new Error(`args[${i}] = args[${j}] = ${args[i]}`));
787
765
  }
788
766
  }
789
767
  }
790
768
  $.$mol_assert_unique = $mol_assert_unique;
791
- function $mol_assert_like(head, ...tail) {
792
- for (let [index, value] of Object.entries(tail)) {
793
- if (!$mol_compare_deep(value, head)) {
794
- const print = (val) => {
795
- if (!val)
796
- return val;
797
- if (typeof val !== 'object')
798
- return val;
799
- if ('outerHTML' in val)
800
- return val.outerHTML;
801
- try {
802
- return JSON.stringify(val, (k, v) => typeof v === 'bigint' ? String(v) : v, '\t');
803
- }
804
- catch (error) {
805
- console.error(error);
806
- return val;
807
- }
808
- };
809
- return $mol_fail(new Error(`Not like (1:${+index + 2})\n${print(head)}\n---\n${print(value)}`));
810
- }
769
+ function $mol_assert_equal(...args) {
770
+ for (let i = 1; i < args.length; ++i) {
771
+ if ($mol_compare_deep(args[0], args[i]))
772
+ continue;
773
+ if (args[0] instanceof Element && args[i] instanceof Element && args[0].outerHTML === args[i].outerHTML)
774
+ continue;
775
+ return $mol_fail(new Error(`args[0] args[${i}]\n${print(args[0])}\n---\n${print(args[i])}`));
811
776
  }
812
777
  }
813
- $.$mol_assert_like = $mol_assert_like;
814
- function $mol_assert_dom(left, right) {
815
- $mol_assert_equal($mol_dom_serialize(left), $mol_dom_serialize(right));
816
- }
817
- $.$mol_assert_dom = $mol_assert_dom;
778
+ $.$mol_assert_equal = $mol_assert_equal;
779
+ const print = (val) => {
780
+ if (!val)
781
+ return val;
782
+ if (typeof val !== 'object')
783
+ return val;
784
+ if ('outerHTML' in val)
785
+ return val.outerHTML;
786
+ try {
787
+ return JSON.stringify(val, (k, v) => typeof v === 'bigint' ? String(v) : v, '\t');
788
+ }
789
+ catch (error) {
790
+ console.error(error);
791
+ return val;
792
+ }
793
+ };
818
794
  })($ || ($ = {}));
819
795
  //mol/assert/assert.ts
820
796
  ;
@@ -835,10 +811,10 @@ var $;
835
811
  $mol_assert_equal(2, 2, 2);
836
812
  },
837
813
  'two must be unique'() {
838
- $mol_assert_unique([3], [3]);
814
+ $mol_assert_unique([2], [3]);
839
815
  },
840
816
  'three must be unique'() {
841
- $mol_assert_unique([3], [3], [3]);
817
+ $mol_assert_unique([1], [2], [3]);
842
818
  },
843
819
  'two must be alike'() {
844
820
  $mol_assert_like([3], [3]);
@@ -857,30 +833,6 @@ var $;
857
833
  //mol/assert/assert.test.ts
858
834
  ;
859
835
  "use strict";
860
- var $;
861
- (function ($) {
862
- function $mol_log3_area_lazy(event) {
863
- const self = this;
864
- const stack = self.$mol_log3_stack;
865
- const deep = stack.length;
866
- let logged = false;
867
- stack.push(() => {
868
- logged = true;
869
- self.$mol_log3_area.call(self, event);
870
- });
871
- return () => {
872
- if (logged)
873
- self.console.groupEnd();
874
- if (stack.length > deep)
875
- stack.length = deep;
876
- };
877
- }
878
- $.$mol_log3_area_lazy = $mol_log3_area_lazy;
879
- $.$mol_log3_stack = [];
880
- })($ || ($ = {}));
881
- //mol/log3/log3.ts
882
- ;
883
- "use strict";
884
836
  //mol/type/equals/equals.ts
885
837
  ;
886
838
  "use strict";
@@ -891,35 +843,6 @@ var $;
891
843
  ;
892
844
  "use strict";
893
845
  var $;
894
- (function ($) {
895
- function $mol_log3_web_make(level, color) {
896
- return function $mol_log3_logger(event) {
897
- const pending = this.$mol_log3_stack.pop();
898
- if (pending)
899
- pending();
900
- let tpl = '%c';
901
- const chunks = Object.values(event);
902
- for (let i = 0; i < chunks.length; ++i) {
903
- tpl += (typeof chunks[i] === 'string') ? ' ⦙ %s' : ' ⦙ %o';
904
- }
905
- const style = `color:${color};font-weight:bolder`;
906
- this.console[level](tpl, style, ...chunks);
907
- const self = this;
908
- return () => self.console.groupEnd();
909
- };
910
- }
911
- $.$mol_log3_web_make = $mol_log3_web_make;
912
- $.$mol_log3_come = $mol_log3_web_make('info', 'royalblue');
913
- $.$mol_log3_done = $mol_log3_web_make('info', 'forestgreen');
914
- $.$mol_log3_fail = $mol_log3_web_make('error', 'orangered');
915
- $.$mol_log3_warn = $mol_log3_web_make('warn', 'goldenrod');
916
- $.$mol_log3_rise = $mol_log3_web_make('log', 'magenta');
917
- $.$mol_log3_area = $mol_log3_web_make('group', 'cyan');
918
- })($ || ($ = {}));
919
- //mol/log3/log3.web.ts
920
- ;
921
- "use strict";
922
- var $;
923
846
  (function ($_1) {
924
847
  $mol_test_mocks.push($ => {
925
848
  $.$mol_log3_come = () => { };
@@ -1687,7 +1610,7 @@ var $;
1687
1610
  ], App, "result", null);
1688
1611
  $mol_assert_equal(App.result(), 1);
1689
1612
  App.condition(true);
1690
- $mol_assert_fail(() => App.result());
1613
+ $mol_assert_fail(() => App.result(), 'test error');
1691
1614
  App.condition(false);
1692
1615
  $mol_assert_equal(App.result(), 1);
1693
1616
  },
@@ -3582,106 +3505,6 @@ var $;
3582
3505
  //mol/file/file.web.ts
3583
3506
  ;
3584
3507
  "use strict";
3585
- //hyoo/hyoo.ts
3586
- ;
3587
- "use strict";
3588
- var $;
3589
- (function ($) {
3590
- function $mol_huggingface_run(space, method, ...data) {
3591
- while (true) {
3592
- try {
3593
- if (typeof method === 'number') {
3594
- return $mol_wire_sync(this).$mol_huggingface_ws(space, method, ...data);
3595
- }
3596
- else {
3597
- return this.$mol_huggingface_rest(space, method, ...data);
3598
- }
3599
- }
3600
- catch (error) {
3601
- if ($mol_promise_like(error))
3602
- $mol_fail_hidden(error);
3603
- if (error instanceof Error && error.message === `Queue full`) {
3604
- $mol_fail_log(error);
3605
- continue;
3606
- }
3607
- $mol_fail_hidden(error);
3608
- }
3609
- }
3610
- }
3611
- $.$mol_huggingface_run = $mol_huggingface_run;
3612
- function $mol_huggingface_rest(space, method, ...data) {
3613
- const uri = `https://${space}.hf.space/run/${method}`;
3614
- const response = $mol_fetch.json(uri, {
3615
- method: 'post',
3616
- headers: { "Content-Type": "application/json" },
3617
- body: JSON.stringify({ data }),
3618
- });
3619
- if ('error' in response) {
3620
- $mol_fail(new Error(response.error ?? 'Unknown API error'));
3621
- }
3622
- return response.data;
3623
- }
3624
- $.$mol_huggingface_rest = $mol_huggingface_rest;
3625
- function $mol_huggingface_ws(space, fn_index, ...data) {
3626
- const session_hash = $mol_guid();
3627
- const socket = new WebSocket(`wss://${space}.hf.space/queue/join`);
3628
- const promise = new Promise((done, fail) => {
3629
- socket.onclose = event => {
3630
- if (event.reason)
3631
- fail(new Error(event.reason));
3632
- };
3633
- socket.onerror = event => {
3634
- fail(new Error(`Socket error`));
3635
- };
3636
- socket.onmessage = event => {
3637
- const message = JSON.parse(event.data);
3638
- switch (message.msg) {
3639
- case 'send_hash':
3640
- return socket.send(JSON.stringify({ session_hash, fn_index }));
3641
- case 'estimation': return;
3642
- case 'queue_full':
3643
- fail(new Error(`Queue full`));
3644
- case 'send_data':
3645
- return socket.send(JSON.stringify({ session_hash, fn_index, data }));
3646
- case 'process_starts': return;
3647
- case 'process_completed':
3648
- if (message.success) {
3649
- return done(message.output.data);
3650
- }
3651
- else {
3652
- return fail(new Error(message.output.error ?? `Unknown API error`));
3653
- }
3654
- default:
3655
- return fail(new Error(`Unknown message type: ${message.msg}`));
3656
- }
3657
- };
3658
- });
3659
- return Object.assign(promise, {
3660
- destructor: () => socket.close()
3661
- });
3662
- }
3663
- $.$mol_huggingface_ws = $mol_huggingface_ws;
3664
- })($ || ($ = {}));
3665
- //mol/huggingface/huggingface.ts
3666
- ;
3667
- "use strict";
3668
- var $;
3669
- (function ($) {
3670
- function $hyoo_lingua_translate(lang, text) {
3671
- if (!text.trim())
3672
- return '';
3673
- const cache_key = `$hyoo_lingua_translate(${JSON.stringify(lang)},${JSON.stringify(text)})`;
3674
- const cached = this.$mol_state_local.value(cache_key);
3675
- if (cached)
3676
- return String(cached);
3677
- const translated = this.$mol_huggingface_run('hyoo-translate', 0, lang, text)[0];
3678
- return this.$mol_state_local.value(cache_key, translated);
3679
- }
3680
- $.$hyoo_lingua_translate = $hyoo_lingua_translate;
3681
- })($ || ($ = {}));
3682
- //hyoo/lingua/translate/translate.ts
3683
- ;
3684
- "use strict";
3685
3508
  var $;
3686
3509
  (function ($) {
3687
3510
  class $mol_locale extends $mol_object {
@@ -3718,12 +3541,6 @@ var $;
3718
3541
  const en = this.texts('en')[key];
3719
3542
  if (!en)
3720
3543
  return key;
3721
- try {
3722
- return $mol_wire_sync($hyoo_lingua_translate).call(this.$, lang, en);
3723
- }
3724
- catch (error) {
3725
- $mol_fail_log(error);
3726
- }
3727
3544
  return en;
3728
3545
  }
3729
3546
  static warn(key) {