mol_plot_all 1.2.845 → 1.2.847

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
@@ -1692,7 +1692,9 @@ var $;
1692
1692
  var $;
1693
1693
  (function ($) {
1694
1694
  function $mol_wire_solid() {
1695
- const current = $mol_wire_auto();
1695
+ let current = $mol_wire_auto();
1696
+ if (current.temp)
1697
+ current = current.host;
1696
1698
  if (current.reap !== nothing) {
1697
1699
  current?.sub_on(sub, sub.data.length);
1698
1700
  }
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 $mol_dom_context.Element && args[i] instanceof $mol_dom_context.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]);
@@ -1634,7 +1610,7 @@ var $;
1634
1610
  ], App, "result", null);
1635
1611
  $mol_assert_equal(App.result(), 1);
1636
1612
  App.condition(true);
1637
- $mol_assert_fail(() => App.result());
1613
+ $mol_assert_fail(() => App.result(), 'test error');
1638
1614
  App.condition(false);
1639
1615
  $mol_assert_equal(App.result(), 1);
1640
1616
  },
@@ -2965,7 +2941,7 @@ var $;
2965
2941
  native.persist().then(actual => {
2966
2942
  setTimeout(() => this.persisted(actual, 'cache'), 5000);
2967
2943
  if (actual)
2968
- this.$.$mol_log3_rise({ place: `$mol_storage`, message: `Persist: Yes` });
2944
+ this.$.$mol_log3_done({ place: `$mol_storage`, message: `Persist: Yes` });
2969
2945
  else
2970
2946
  this.$.$mol_log3_fail({ place: `$mol_storage`, message: `Persist: No` });
2971
2947
  });
@@ -3529,106 +3505,6 @@ var $;
3529
3505
  //mol/file/file.web.ts
3530
3506
  ;
3531
3507
  "use strict";
3532
- //hyoo/hyoo.ts
3533
- ;
3534
- "use strict";
3535
- var $;
3536
- (function ($) {
3537
- function $mol_huggingface_run(space, method, ...data) {
3538
- while (true) {
3539
- try {
3540
- if (typeof method === 'number') {
3541
- return $mol_wire_sync(this).$mol_huggingface_ws(space, method, ...data);
3542
- }
3543
- else {
3544
- return this.$mol_huggingface_rest(space, method, ...data);
3545
- }
3546
- }
3547
- catch (error) {
3548
- if ($mol_promise_like(error))
3549
- $mol_fail_hidden(error);
3550
- if (error instanceof Error && error.message === `Queue full`) {
3551
- $mol_fail_log(error);
3552
- continue;
3553
- }
3554
- $mol_fail_hidden(error);
3555
- }
3556
- }
3557
- }
3558
- $.$mol_huggingface_run = $mol_huggingface_run;
3559
- function $mol_huggingface_rest(space, method, ...data) {
3560
- const uri = `https://${space}.hf.space/run/${method}`;
3561
- const response = $mol_fetch.json(uri, {
3562
- method: 'post',
3563
- headers: { "Content-Type": "application/json" },
3564
- body: JSON.stringify({ data }),
3565
- });
3566
- if ('error' in response) {
3567
- $mol_fail(new Error(response.error ?? 'Unknown API error'));
3568
- }
3569
- return response.data;
3570
- }
3571
- $.$mol_huggingface_rest = $mol_huggingface_rest;
3572
- function $mol_huggingface_ws(space, fn_index, ...data) {
3573
- const session_hash = $mol_guid();
3574
- const socket = new WebSocket(`wss://${space}.hf.space/queue/join`);
3575
- const promise = new Promise((done, fail) => {
3576
- socket.onclose = event => {
3577
- if (event.reason)
3578
- fail(new Error(event.reason));
3579
- };
3580
- socket.onerror = event => {
3581
- fail(new Error(`Socket error`));
3582
- };
3583
- socket.onmessage = event => {
3584
- const message = JSON.parse(event.data);
3585
- switch (message.msg) {
3586
- case 'send_hash':
3587
- return socket.send(JSON.stringify({ session_hash, fn_index }));
3588
- case 'estimation': return;
3589
- case 'queue_full':
3590
- fail(new Error(`Queue full`));
3591
- case 'send_data':
3592
- return socket.send(JSON.stringify({ session_hash, fn_index, data }));
3593
- case 'process_starts': return;
3594
- case 'process_completed':
3595
- if (message.success) {
3596
- return done(message.output.data);
3597
- }
3598
- else {
3599
- return fail(new Error(message.output.error ?? `Unknown API error`));
3600
- }
3601
- default:
3602
- return fail(new Error(`Unknown message type: ${message.msg}`));
3603
- }
3604
- };
3605
- });
3606
- return Object.assign(promise, {
3607
- destructor: () => socket.close()
3608
- });
3609
- }
3610
- $.$mol_huggingface_ws = $mol_huggingface_ws;
3611
- })($ || ($ = {}));
3612
- //mol/huggingface/huggingface.ts
3613
- ;
3614
- "use strict";
3615
- var $;
3616
- (function ($) {
3617
- function $hyoo_lingua_translate(lang, text) {
3618
- if (!text.trim())
3619
- return '';
3620
- const cache_key = `$hyoo_lingua_translate(${JSON.stringify(lang)},${JSON.stringify(text)})`;
3621
- const cached = this.$mol_state_local.value(cache_key);
3622
- if (cached)
3623
- return String(cached);
3624
- const translated = this.$mol_huggingface_run('hyoo-translate', 0, lang, text)[0];
3625
- return this.$mol_state_local.value(cache_key, translated);
3626
- }
3627
- $.$hyoo_lingua_translate = $hyoo_lingua_translate;
3628
- })($ || ($ = {}));
3629
- //hyoo/lingua/translate/translate.ts
3630
- ;
3631
- "use strict";
3632
3508
  var $;
3633
3509
  (function ($) {
3634
3510
  class $mol_locale extends $mol_object {
@@ -3665,12 +3541,6 @@ var $;
3665
3541
  const en = this.texts('en')[key];
3666
3542
  if (!en)
3667
3543
  return key;
3668
- try {
3669
- return $mol_wire_sync($hyoo_lingua_translate).call(this.$, lang, en);
3670
- }
3671
- catch (error) {
3672
- $mol_fail_log(error);
3673
- }
3674
3544
  return en;
3675
3545
  }
3676
3546
  static warn(key) {