mol_dump_lib 0.0.180 → 0.0.182

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/node.meta.tree CHANGED
@@ -12,64 +12,6 @@
12
12
  pack icon git \https://github.com/nin-jin/mol_icon.git
13
13
  \/mol/view
14
14
  include \/mol/view/tree/test
15
- \/hyoo
16
- pack about git \https://github.com/hyoo-ru/about.hyoo.ru.git
17
- pack artist git \https://github.com/hyoo-ru/artist.hyoo.ru.git
18
- pack apps git \https://github.com/hyoo-ru/apps.hyoo.ru.git
19
- pack aura git \https://github.com/hyoo-ru/aura.hyoo.ru.git
20
- pack bench git \https://github.com/hyoo-ru/bench.hyoo.ru.git
21
- pack board git \https://github.com/hyoo-ru/board.hyoo.ru.git
22
- pack calc git \https://github.com/hyoo-ru/calc.hyoo.ru.git
23
- pack case git \https://github.com/hyoo-ru/case.hyoo.ru.git
24
- pack crowd git \https://github.com/hyoo-ru/crowd.hyoo.ru.git
25
- pack draw git \https://github.com/hyoo-ru/draw.hyoo.ru.git
26
- pack game git \https://github.com/hyoo-ru/game.hyoo.ru.git
27
- pack github git \https://github.com/hyoo-ru/github.hyoo.ru.git
28
- pack habhub git \https://github.com/hyoo-ru/habhub.hyoo.ru.git
29
- pack harp git \https://github.com/hyoo-ru/harp.hyoo.ru.git
30
- pack http git \https://github.com/hyoo-ru/http.hyoo.ru.git
31
- pack fallacy git \https://github.com/hyoo-ru/fallacy.hyoo.ru.git
32
- pack invest git \https://github.com/hyoo-ru/invest.hyoo.ru.git
33
- pack iq git \https://github.com/hyoo-ru/iq.hyoo.ru.git
34
- pack js git \https://github.com/hyoo-ru/hyoo_js.git
35
- pack lamps git \https://github.com/hyoo-ru/lamps.hyoo.ru.git
36
- pack life git \https://github.com/hyoo-ru/life.hyoo.ru.git
37
- pack lingua git \https://github.com/hyoo-ru/lingua.hyoo.ru.git
38
- pack lupa git \https://github.com/hyoo-ru/lupa.hyoo.ru.git
39
- pack mail git \https://github.com/hyoo-ru/mail.hyoo.ru.git
40
- pack map git \https://github.com/hyoo-ru/map.hyoo.ru.git
41
- pack marked git \https://github.com/hyoo-ru/marked.hyoo.ru.git
42
- pack match git \https://github.com/hyoo-ru/match.hyoo.ru.git
43
- pack meme git \https://github.com/hyoo-ru/meme.hyoo.ru.git
44
- pack meta git \https://github.com/hyoo-ru/hyoo_meta.git
45
- pack mill git \https://github.com/hyoo-ru/mill.git
46
- pack mol git \https://github.com/hyoo-ru/mol.hyoo.ru.git
47
- pack notes git \https://github.com/hyoo-ru/notes.hyoo.ru.git
48
- pack offer git \https://github.com/hyoo-ru/offer.hyoo.ru.git
49
- pack page git \https://github.com/hyoo-ru/page.hyoo.ru.git
50
- pack play git \https://github.com/hyoo-ru/play.hyoo.ru.git
51
- pack rdf git \https://github.com/hyoo-ru/rdf.hyoo.ru.git
52
- pack realworld git \https://github.com/hyoo-ru/realworld.hyoo.ru.git
53
- pack scout git \https://github.com/hyoo-ru/scout.hyoo.ru.git
54
- pack search git \https://github.com/hyoo-ru/search.hyoo.ru.git
55
- pack shelter git \https://github.com/hyoo-ru/shelter.hyoo.ru.git
56
- pack showcase git \https://github.com/hyoo-ru/showcase.hyoo.ru.git
57
- pack speculant git \https://github.com/hyoo-ru/speculant.hyoo.ru.git
58
- pack sketch git \https://github.com/hyoo-ru/sketch.hyoo.ru.git
59
- pack slides git \https://github.com/hyoo-ru/slides.hyoo.ru.git
60
- pack studio git \https://github.com/hyoo-ru/studio.hyoo.ru.git
61
- pack sporno git \https://github.com/hyoo-ru/hyoo_sporno.git
62
- pack static git \https://github.com/hyoo-ru/hyoo_static.git
63
- pack talks git \https://github.com/hyoo-ru/talks.hyoo.ru.git
64
- pack todomvc git \https://github.com/hyoo-ru/todomvc.hyoo.ru.git
65
- pack toys git \https://github.com/hyoo-ru/toys.hyoo.ru.git
66
- pack tree git \https://github.com/hyoo-ru/tree.hyoo.ru.git
67
- pack webdav git \https://github.com/hyoo-ru/webdav.hyoo.ru.git
68
- pack when git \https://github.com/hyoo-ru/when.hyoo.ru.git
69
- pack sync git \https://github.com/hyoo-ru/sync.hyoo.ru.git
70
- pack home git \https://github.com/hyoo-ru/hyoo.ru.git
71
- pack idea git \https://github.com/hyoo-ru/idea.hyoo.ru.git
72
- pack intern git \https://github.com/hyoo-ru/intern.hyoo.ru.git
73
15
  \/mol/dump/lib
74
16
  include \/mol/view/component
75
17
  include \/mol/dump/value
package/node.mjs CHANGED
@@ -1137,7 +1137,7 @@ var $;
1137
1137
  };
1138
1138
  }
1139
1139
  error(message, Class = Error) {
1140
- return new Class(`${message}${this}`);
1140
+ return new Class(`${message} (${this})`);
1141
1141
  }
1142
1142
  span(row, col, length) {
1143
1143
  return new $mol_span(this.uri, this.source, row, col, length);
@@ -1152,11 +1152,11 @@ var $;
1152
1152
  if (end < 0)
1153
1153
  end += len;
1154
1154
  if (begin < 0 || begin > len)
1155
- this.$.$mol_fail(`Begin value '${begin}' out of range ${this}`);
1155
+ this.$.$mol_fail(this.error(`Begin value '${begin}' out of range`, RangeError));
1156
1156
  if (end < 0 || end > len)
1157
- this.$.$mol_fail(`End value '${end}' out of range ${this}`);
1157
+ this.$.$mol_fail(this.error(`End value '${end}' out of range`, RangeError));
1158
1158
  if (end < begin)
1159
- this.$.$mol_fail(`End value '${end}' can't be less than begin value ${this}`);
1159
+ this.$.$mol_fail(this.error(`End value '${end}' can't be less than begin value`, RangeError));
1160
1160
  return this.span(this.row, this.col + begin, end - begin);
1161
1161
  }
1162
1162
  }
@@ -2203,7 +2203,9 @@ var $;
2203
2203
  var $;
2204
2204
  (function ($) {
2205
2205
  function $mol_wire_solid() {
2206
- const current = $mol_wire_auto();
2206
+ let current = $mol_wire_auto();
2207
+ if (current.temp)
2208
+ current = current.host;
2207
2209
  if (current.reap !== nothing) {
2208
2210
  current?.sub_on(sub, sub.data.length);
2209
2211
  }
@@ -3743,6 +3745,13 @@ var $;
3743
3745
  rules.push(`${key} ${query} {\n`);
3744
3746
  }
3745
3747
  }
3748
+ else if (key[0] === '[' && key[key.length - 1] === ']') {
3749
+ const attr = key.slice(1, -1);
3750
+ const vals = config[key];
3751
+ for (let val in vals) {
3752
+ make_class(selector(prefix, path) + ':where([' + attr + '=' + JSON.stringify(val) + '])', [], vals[val]);
3753
+ }
3754
+ }
3746
3755
  else {
3747
3756
  make_class(selector(prefix, path) + key, [], config[key]);
3748
3757
  }
@@ -5170,7 +5179,7 @@ var $;
5170
5179
  native.persist().then(actual => {
5171
5180
  setTimeout(() => this.persisted(actual, 'cache'), 5000);
5172
5181
  if (actual)
5173
- this.$.$mol_log3_rise({ place: `$mol_storage`, message: `Persist: Yes` });
5182
+ this.$.$mol_log3_done({ place: `$mol_storage`, message: `Persist: Yes` });
5174
5183
  else
5175
5184
  this.$.$mol_log3_fail({ place: `$mol_storage`, message: `Persist: No` });
5176
5185
  });
@@ -5609,279 +5618,6 @@ var $;
5609
5618
  //mol/file/file.node.ts
5610
5619
  ;
5611
5620
  "use strict";
5612
- //hyoo/hyoo.ts
5613
- ;
5614
- "use strict";
5615
- var $;
5616
- (function ($) {
5617
- $.$mol_action = $mol_wire_method;
5618
- })($ || ($ = {}));
5619
- //mol/action/action.ts
5620
- ;
5621
- "use strict";
5622
- var $;
5623
- (function ($) {
5624
- function $mol_dom_parse(text, type = 'application/xhtml+xml') {
5625
- const parser = new $mol_dom_context.DOMParser();
5626
- const doc = parser.parseFromString(text, type);
5627
- const error = doc.getElementsByTagName('parsererror');
5628
- if (error.length)
5629
- throw new Error(error[0].textContent);
5630
- return doc;
5631
- }
5632
- $.$mol_dom_parse = $mol_dom_parse;
5633
- })($ || ($ = {}));
5634
- //mol/dom/parse/parse.ts
5635
- ;
5636
- "use strict";
5637
- var $;
5638
- (function ($) {
5639
- class $mol_fetch_response extends $mol_object2 {
5640
- native;
5641
- constructor(native) {
5642
- super();
5643
- this.native = native;
5644
- }
5645
- status() {
5646
- const types = ['unknown', 'inform', 'success', 'redirect', 'wrong', 'failed'];
5647
- return types[Math.floor(this.native.status / 100)];
5648
- }
5649
- code() {
5650
- return this.native.status;
5651
- }
5652
- message() {
5653
- return this.native.statusText || `HTTP Error ${this.code()}`;
5654
- }
5655
- headers() {
5656
- return this.native.headers;
5657
- }
5658
- mime() {
5659
- return this.headers().get('content-type');
5660
- }
5661
- stream() {
5662
- return this.native.body;
5663
- }
5664
- text() {
5665
- const buffer = this.buffer();
5666
- const native = this.native;
5667
- const mime = native.headers.get('content-type') || '';
5668
- const [, charset] = /charset=(.*)/.exec(mime) || [, 'utf-8'];
5669
- const decoder = new TextDecoder(charset);
5670
- return decoder.decode(buffer);
5671
- }
5672
- json() {
5673
- return $mol_wire_sync(this.native).json();
5674
- }
5675
- buffer() {
5676
- return $mol_wire_sync(this.native).arrayBuffer();
5677
- }
5678
- xml() {
5679
- return $mol_dom_parse(this.text(), 'application/xml');
5680
- }
5681
- xhtml() {
5682
- return $mol_dom_parse(this.text(), 'application/xhtml+xml');
5683
- }
5684
- html() {
5685
- return $mol_dom_parse(this.text(), 'text/html');
5686
- }
5687
- }
5688
- __decorate([
5689
- $mol_action
5690
- ], $mol_fetch_response.prototype, "stream", null);
5691
- __decorate([
5692
- $mol_action
5693
- ], $mol_fetch_response.prototype, "text", null);
5694
- __decorate([
5695
- $mol_action
5696
- ], $mol_fetch_response.prototype, "buffer", null);
5697
- __decorate([
5698
- $mol_action
5699
- ], $mol_fetch_response.prototype, "xml", null);
5700
- __decorate([
5701
- $mol_action
5702
- ], $mol_fetch_response.prototype, "xhtml", null);
5703
- __decorate([
5704
- $mol_action
5705
- ], $mol_fetch_response.prototype, "html", null);
5706
- $.$mol_fetch_response = $mol_fetch_response;
5707
- class $mol_fetch extends $mol_object2 {
5708
- static request(input, init = {}) {
5709
- const native = globalThis.fetch ?? $node['undici'].fetch;
5710
- const controller = new AbortController();
5711
- let done = false;
5712
- const promise = native(input, {
5713
- ...init,
5714
- signal: controller.signal,
5715
- }).finally(() => {
5716
- done = true;
5717
- });
5718
- return Object.assign(promise, {
5719
- destructor: () => {
5720
- if (!done && !controller.signal.aborted)
5721
- controller.abort();
5722
- },
5723
- });
5724
- }
5725
- static response(input, init) {
5726
- return new $mol_fetch_response($mol_wire_sync(this).request(input, init));
5727
- }
5728
- static success(input, init) {
5729
- const response = this.response(input, init);
5730
- if (response.status() === 'success')
5731
- return response;
5732
- throw new Error(response.message());
5733
- }
5734
- static stream(input, init) {
5735
- return this.success(input, init).stream();
5736
- }
5737
- static text(input, init) {
5738
- return this.success(input, init).text();
5739
- }
5740
- static json(input, init) {
5741
- return this.success(input, init).json();
5742
- }
5743
- static buffer(input, init) {
5744
- return this.success(input, init).buffer();
5745
- }
5746
- static xml(input, init) {
5747
- return this.success(input, init).xml();
5748
- }
5749
- static xhtml(input, init) {
5750
- return this.success(input, init).xhtml();
5751
- }
5752
- static html(input, init) {
5753
- return this.success(input, init).html();
5754
- }
5755
- }
5756
- __decorate([
5757
- $mol_action
5758
- ], $mol_fetch, "response", null);
5759
- __decorate([
5760
- $mol_action
5761
- ], $mol_fetch, "success", null);
5762
- __decorate([
5763
- $mol_action
5764
- ], $mol_fetch, "stream", null);
5765
- __decorate([
5766
- $mol_action
5767
- ], $mol_fetch, "text", null);
5768
- __decorate([
5769
- $mol_action
5770
- ], $mol_fetch, "json", null);
5771
- __decorate([
5772
- $mol_action
5773
- ], $mol_fetch, "buffer", null);
5774
- __decorate([
5775
- $mol_action
5776
- ], $mol_fetch, "xml", null);
5777
- __decorate([
5778
- $mol_action
5779
- ], $mol_fetch, "xhtml", null);
5780
- __decorate([
5781
- $mol_action
5782
- ], $mol_fetch, "html", null);
5783
- $.$mol_fetch = $mol_fetch;
5784
- })($ || ($ = {}));
5785
- //mol/fetch/fetch.ts
5786
- ;
5787
- "use strict";
5788
- var $;
5789
- (function ($) {
5790
- function $mol_huggingface_run(space, method, ...data) {
5791
- while (true) {
5792
- try {
5793
- if (typeof method === 'number') {
5794
- return $mol_wire_sync(this).$mol_huggingface_ws(space, method, ...data);
5795
- }
5796
- else {
5797
- return this.$mol_huggingface_rest(space, method, ...data);
5798
- }
5799
- }
5800
- catch (error) {
5801
- if ($mol_promise_like(error))
5802
- $mol_fail_hidden(error);
5803
- if (error instanceof Error && error.message === `Queue full`) {
5804
- $mol_fail_log(error);
5805
- continue;
5806
- }
5807
- $mol_fail_hidden(error);
5808
- }
5809
- }
5810
- }
5811
- $.$mol_huggingface_run = $mol_huggingface_run;
5812
- function $mol_huggingface_rest(space, method, ...data) {
5813
- const uri = `https://${space}.hf.space/run/${method}`;
5814
- const response = $mol_fetch.json(uri, {
5815
- method: 'post',
5816
- headers: { "Content-Type": "application/json" },
5817
- body: JSON.stringify({ data }),
5818
- });
5819
- if ('error' in response) {
5820
- $mol_fail(new Error(response.error ?? 'Unknown API error'));
5821
- }
5822
- return response.data;
5823
- }
5824
- $.$mol_huggingface_rest = $mol_huggingface_rest;
5825
- function $mol_huggingface_ws(space, fn_index, ...data) {
5826
- const session_hash = $mol_guid();
5827
- const socket = new WebSocket(`wss://${space}.hf.space/queue/join`);
5828
- const promise = new Promise((done, fail) => {
5829
- socket.onclose = event => {
5830
- if (event.reason)
5831
- fail(new Error(event.reason));
5832
- };
5833
- socket.onerror = event => {
5834
- fail(new Error(`Socket error`));
5835
- };
5836
- socket.onmessage = event => {
5837
- const message = JSON.parse(event.data);
5838
- switch (message.msg) {
5839
- case 'send_hash':
5840
- return socket.send(JSON.stringify({ session_hash, fn_index }));
5841
- case 'estimation': return;
5842
- case 'queue_full':
5843
- fail(new Error(`Queue full`));
5844
- case 'send_data':
5845
- return socket.send(JSON.stringify({ session_hash, fn_index, data }));
5846
- case 'process_starts': return;
5847
- case 'process_completed':
5848
- if (message.success) {
5849
- return done(message.output.data);
5850
- }
5851
- else {
5852
- return fail(new Error(message.output.error ?? `Unknown API error`));
5853
- }
5854
- default:
5855
- return fail(new Error(`Unknown message type: ${message.msg}`));
5856
- }
5857
- };
5858
- });
5859
- return Object.assign(promise, {
5860
- destructor: () => socket.close()
5861
- });
5862
- }
5863
- $.$mol_huggingface_ws = $mol_huggingface_ws;
5864
- })($ || ($ = {}));
5865
- //mol/huggingface/huggingface.ts
5866
- ;
5867
- "use strict";
5868
- var $;
5869
- (function ($) {
5870
- function $hyoo_lingua_translate(lang, text) {
5871
- if (!text.trim())
5872
- return '';
5873
- const cache_key = `$hyoo_lingua_translate(${JSON.stringify(lang)},${JSON.stringify(text)})`;
5874
- const cached = this.$mol_state_local.value(cache_key);
5875
- if (cached)
5876
- return String(cached);
5877
- const translated = this.$mol_huggingface_run('hyoo-translate', 0, lang, text)[0];
5878
- return this.$mol_state_local.value(cache_key, translated);
5879
- }
5880
- $.$hyoo_lingua_translate = $hyoo_lingua_translate;
5881
- })($ || ($ = {}));
5882
- //hyoo/lingua/translate/translate.ts
5883
- ;
5884
- "use strict";
5885
5621
  var $;
5886
5622
  (function ($) {
5887
5623
  class $mol_locale extends $mol_object {
@@ -5918,12 +5654,6 @@ var $;
5918
5654
  const en = this.texts('en')[key];
5919
5655
  if (!en)
5920
5656
  return key;
5921
- try {
5922
- return $mol_wire_sync($hyoo_lingua_translate).call(this.$, lang, en);
5923
- }
5924
- catch (error) {
5925
- $mol_fail_log(error);
5926
- }
5927
5657
  return en;
5928
5658
  }
5929
5659
  static warn(key) {