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/web.js 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
  }
@@ -3236,6 +3238,13 @@ var $;
3236
3238
  rules.push(`${key} ${query} {\n`);
3237
3239
  }
3238
3240
  }
3241
+ else if (key[0] === '[' && key[key.length - 1] === ']') {
3242
+ const attr = key.slice(1, -1);
3243
+ const vals = config[key];
3244
+ for (let val in vals) {
3245
+ make_class(selector(prefix, path) + ':where([' + attr + '=' + JSON.stringify(val) + '])', [], vals[val]);
3246
+ }
3247
+ }
3239
3248
  else {
3240
3249
  make_class(selector(prefix, path) + key, [], config[key]);
3241
3250
  }
@@ -4691,7 +4700,7 @@ var $;
4691
4700
  native.persist().then(actual => {
4692
4701
  setTimeout(() => this.persisted(actual, 'cache'), 5000);
4693
4702
  if (actual)
4694
- this.$.$mol_log3_rise({ place: `$mol_storage`, message: `Persist: Yes` });
4703
+ this.$.$mol_log3_done({ place: `$mol_storage`, message: `Persist: Yes` });
4695
4704
  else
4696
4705
  this.$.$mol_log3_fail({ place: `$mol_storage`, message: `Persist: No` });
4697
4706
  });
@@ -5183,106 +5192,6 @@ var $;
5183
5192
  //mol/file/file.web.ts
5184
5193
  ;
5185
5194
  "use strict";
5186
- //hyoo/hyoo.ts
5187
- ;
5188
- "use strict";
5189
- var $;
5190
- (function ($) {
5191
- function $mol_huggingface_run(space, method, ...data) {
5192
- while (true) {
5193
- try {
5194
- if (typeof method === 'number') {
5195
- return $mol_wire_sync(this).$mol_huggingface_ws(space, method, ...data);
5196
- }
5197
- else {
5198
- return this.$mol_huggingface_rest(space, method, ...data);
5199
- }
5200
- }
5201
- catch (error) {
5202
- if ($mol_promise_like(error))
5203
- $mol_fail_hidden(error);
5204
- if (error instanceof Error && error.message === `Queue full`) {
5205
- $mol_fail_log(error);
5206
- continue;
5207
- }
5208
- $mol_fail_hidden(error);
5209
- }
5210
- }
5211
- }
5212
- $.$mol_huggingface_run = $mol_huggingface_run;
5213
- function $mol_huggingface_rest(space, method, ...data) {
5214
- const uri = `https://${space}.hf.space/run/${method}`;
5215
- const response = $mol_fetch.json(uri, {
5216
- method: 'post',
5217
- headers: { "Content-Type": "application/json" },
5218
- body: JSON.stringify({ data }),
5219
- });
5220
- if ('error' in response) {
5221
- $mol_fail(new Error(response.error ?? 'Unknown API error'));
5222
- }
5223
- return response.data;
5224
- }
5225
- $.$mol_huggingface_rest = $mol_huggingface_rest;
5226
- function $mol_huggingface_ws(space, fn_index, ...data) {
5227
- const session_hash = $mol_guid();
5228
- const socket = new WebSocket(`wss://${space}.hf.space/queue/join`);
5229
- const promise = new Promise((done, fail) => {
5230
- socket.onclose = event => {
5231
- if (event.reason)
5232
- fail(new Error(event.reason));
5233
- };
5234
- socket.onerror = event => {
5235
- fail(new Error(`Socket error`));
5236
- };
5237
- socket.onmessage = event => {
5238
- const message = JSON.parse(event.data);
5239
- switch (message.msg) {
5240
- case 'send_hash':
5241
- return socket.send(JSON.stringify({ session_hash, fn_index }));
5242
- case 'estimation': return;
5243
- case 'queue_full':
5244
- fail(new Error(`Queue full`));
5245
- case 'send_data':
5246
- return socket.send(JSON.stringify({ session_hash, fn_index, data }));
5247
- case 'process_starts': return;
5248
- case 'process_completed':
5249
- if (message.success) {
5250
- return done(message.output.data);
5251
- }
5252
- else {
5253
- return fail(new Error(message.output.error ?? `Unknown API error`));
5254
- }
5255
- default:
5256
- return fail(new Error(`Unknown message type: ${message.msg}`));
5257
- }
5258
- };
5259
- });
5260
- return Object.assign(promise, {
5261
- destructor: () => socket.close()
5262
- });
5263
- }
5264
- $.$mol_huggingface_ws = $mol_huggingface_ws;
5265
- })($ || ($ = {}));
5266
- //mol/huggingface/huggingface.ts
5267
- ;
5268
- "use strict";
5269
- var $;
5270
- (function ($) {
5271
- function $hyoo_lingua_translate(lang, text) {
5272
- if (!text.trim())
5273
- return '';
5274
- const cache_key = `$hyoo_lingua_translate(${JSON.stringify(lang)},${JSON.stringify(text)})`;
5275
- const cached = this.$mol_state_local.value(cache_key);
5276
- if (cached)
5277
- return String(cached);
5278
- const translated = this.$mol_huggingface_run('hyoo-translate', 0, lang, text)[0];
5279
- return this.$mol_state_local.value(cache_key, translated);
5280
- }
5281
- $.$hyoo_lingua_translate = $hyoo_lingua_translate;
5282
- })($ || ($ = {}));
5283
- //hyoo/lingua/translate/translate.ts
5284
- ;
5285
- "use strict";
5286
5195
  var $;
5287
5196
  (function ($) {
5288
5197
  class $mol_locale extends $mol_object {
@@ -5319,12 +5228,6 @@ var $;
5319
5228
  const en = this.texts('en')[key];
5320
5229
  if (!en)
5321
5230
  return key;
5322
- try {
5323
- return $mol_wire_sync($hyoo_lingua_translate).call(this.$, lang, en);
5324
- }
5325
- catch (error) {
5326
- $mol_fail_log(error);
5327
- }
5328
5231
  return en;
5329
5232
  }
5330
5233
  static warn(key) {