mol_plot_all 1.2.570 → 1.2.572
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.d.ts +29 -29
- package/node.js +29 -29
- package/node.js.map +1 -1
- package/node.meta.tree +24 -0
- package/node.mjs +29 -29
- package/node.mjs.map +1 -1
- package/node.test.js +60 -356
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.d.ts +29 -29
- package/web.js +29 -29
- package/web.js.map +1 -1
- package/web.meta.tree +24 -0
- package/web.mjs +29 -29
- package/web.mjs.map +1 -1
- package/web.test.js +30 -326
- package/web.test.js.map +1 -1
package/node.test.js
CHANGED
|
@@ -2362,34 +2362,34 @@ var $;
|
|
|
2362
2362
|
postfix() {
|
|
2363
2363
|
return this.literal;
|
|
2364
2364
|
}
|
|
2365
|
-
static per(value) { return
|
|
2366
|
-
static px(value) { return
|
|
2367
|
-
static mm(value) { return
|
|
2368
|
-
static cm(value) { return
|
|
2369
|
-
static Q(value) { return
|
|
2370
|
-
static in(value) { return
|
|
2371
|
-
static pc(value) { return
|
|
2372
|
-
static pt(value) { return
|
|
2373
|
-
static cap(value) { return
|
|
2374
|
-
static ch(value) { return
|
|
2375
|
-
static em(value) { return
|
|
2376
|
-
static rem(value) { return
|
|
2377
|
-
static ex(value) { return
|
|
2378
|
-
static ic(value) { return
|
|
2379
|
-
static lh(value) { return
|
|
2380
|
-
static rlh(value) { return
|
|
2381
|
-
static vh(value) { return
|
|
2382
|
-
static vw(value) { return
|
|
2383
|
-
static vi(value) { return
|
|
2384
|
-
static vb(value) { return
|
|
2385
|
-
static vmin(value) { return
|
|
2386
|
-
static vmax(value) { return
|
|
2387
|
-
static deg(value) { return
|
|
2388
|
-
static rad(value) { return
|
|
2389
|
-
static grad(value) { return
|
|
2390
|
-
static turn(value) { return
|
|
2391
|
-
static s(value) { return
|
|
2392
|
-
static ms(value) { return
|
|
2365
|
+
static per(value) { return `${value}%`; }
|
|
2366
|
+
static px(value) { return `${value}px`; }
|
|
2367
|
+
static mm(value) { return `${value}mm`; }
|
|
2368
|
+
static cm(value) { return `${value}cm`; }
|
|
2369
|
+
static Q(value) { return `${value}Q`; }
|
|
2370
|
+
static in(value) { return `${value}in`; }
|
|
2371
|
+
static pc(value) { return `${value}pc`; }
|
|
2372
|
+
static pt(value) { return `${value}pt`; }
|
|
2373
|
+
static cap(value) { return `${value}cap`; }
|
|
2374
|
+
static ch(value) { return `${value}ch`; }
|
|
2375
|
+
static em(value) { return `${value}em`; }
|
|
2376
|
+
static rem(value) { return `${value}rem`; }
|
|
2377
|
+
static ex(value) { return `${value}ex`; }
|
|
2378
|
+
static ic(value) { return `${value}ic`; }
|
|
2379
|
+
static lh(value) { return `${value}lh`; }
|
|
2380
|
+
static rlh(value) { return `${value}rlh`; }
|
|
2381
|
+
static vh(value) { return `${value}vh`; }
|
|
2382
|
+
static vw(value) { return `${value}vw`; }
|
|
2383
|
+
static vi(value) { return `${value}vi`; }
|
|
2384
|
+
static vb(value) { return `${value}vb`; }
|
|
2385
|
+
static vmin(value) { return `${value}vmin`; }
|
|
2386
|
+
static vmax(value) { return `${value}vmax`; }
|
|
2387
|
+
static deg(value) { return `${value}deg`; }
|
|
2388
|
+
static rad(value) { return `${value}rad`; }
|
|
2389
|
+
static grad(value) { return `${value}grad`; }
|
|
2390
|
+
static turn(value) { return `${value}turn`; }
|
|
2391
|
+
static s(value) { return `${value}s`; }
|
|
2392
|
+
static ms(value) { return `${value}ms`; }
|
|
2393
2393
|
}
|
|
2394
2394
|
$.$mol_style_unit = $mol_style_unit;
|
|
2395
2395
|
})($ || ($ = {}));
|
|
@@ -2883,7 +2883,7 @@ var $;
|
|
|
2883
2883
|
"use strict";
|
|
2884
2884
|
var $;
|
|
2885
2885
|
(function ($) {
|
|
2886
|
-
$mol_style_attach("mol/view/view/view.css", "[mol_view] {\n\ttransition-property: height, width, min-height, min-width, max-width, max-height, transform;\n\ttransition-duration: .2s;\n\ttransition-timing-function: ease-out;\n\t-webkit-appearance: none;\n\tbox-sizing: border-box;\n\tdisplay: flex;\n\tflex-shrink: 0;\n\tcontain: style;\n\tscrollbar-color: var(--mol_theme_line) transparent;\n\tscrollbar-width: thin;\n}\t\n\n[mol_view]::selection {\n\tbackground: var(--mol_theme_line);\n}\t\n\n[mol_view]::-webkit-scrollbar {\n\twidth: .25rem;\n\theight: .25rem;\n}\n\n[mol_view]::-webkit-scrollbar-corner {\n\tbackground-color: var(--mol_theme_line);\n}\n\n[mol_view]::-webkit-scrollbar-track {\n\tbackground-color: transparent;\n}\n\n[mol_view]::-webkit-scrollbar-thumb {\n\tbackground-color: var(--mol_theme_line);\n\tborder-radius: var(--mol_gap_round);\n}\n\n[mol_view] > * {\n\tword-break: inherit;\n}\n\n[mol_view_root] {\n\tmargin: 0;\n\tpadding: 0;\n\twidth: 100%;\n\theight: 100%;\n\tbox-sizing: border-box;\n\tfont-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;\n\tfont-size: 1rem;\n\tline-height: 1.5rem;\n\tbackground: var(--mol_theme_back);\n\tcolor: var(--mol_theme_text);\n\tcontain: unset; /** Fixes bg ignoring when applied to body on Chrome */\n\ttab-size: 4;\n}\n\n@media print {\n\t[mol_view_root] {\n\t\theight: auto;\n\t}\n}\n\n[mol_view][mol_view_error]:not([mol_view_error=\"Promise\"]) {\n\tbackground-image: repeating-linear-gradient(\n\t\t-45deg,\n\t\t#f92323,\n\t\t#f92323 .5rem,\n\t\t#ff3d3d .5rem,\n\t\t#ff3d3d 1.5rem\n\t);\n\tcolor: black;\n\talign-items: center;\n\tjustify-content: center;\n}\n\n@keyframes mol_view_wait {\n\tfrom {\n\t\topacity: .
|
|
2886
|
+
$mol_style_attach("mol/view/view/view.css", "[mol_view] {\n\ttransition-property: height, width, min-height, min-width, max-width, max-height, transform;\n\ttransition-duration: .2s;\n\ttransition-timing-function: ease-out;\n\t-webkit-appearance: none;\n\tbox-sizing: border-box;\n\tdisplay: flex;\n\tflex-shrink: 0;\n\tcontain: style;\n\tscrollbar-color: var(--mol_theme_line) transparent;\n\tscrollbar-width: thin;\n}\t\n\n[mol_view]::selection {\n\tbackground: var(--mol_theme_line);\n}\t\n\n[mol_view]::-webkit-scrollbar {\n\twidth: .25rem;\n\theight: .25rem;\n}\n\n[mol_view]::-webkit-scrollbar-corner {\n\tbackground-color: var(--mol_theme_line);\n}\n\n[mol_view]::-webkit-scrollbar-track {\n\tbackground-color: transparent;\n}\n\n[mol_view]::-webkit-scrollbar-thumb {\n\tbackground-color: var(--mol_theme_line);\n\tborder-radius: var(--mol_gap_round);\n}\n\n[mol_view] > * {\n\tword-break: inherit;\n}\n\n[mol_view_root] {\n\tmargin: 0;\n\tpadding: 0;\n\twidth: 100%;\n\theight: 100%;\n\tbox-sizing: border-box;\n\tfont-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;\n\tfont-size: 1rem;\n\tline-height: 1.5rem;\n\tbackground: var(--mol_theme_back);\n\tcolor: var(--mol_theme_text);\n\tcontain: unset; /** Fixes bg ignoring when applied to body on Chrome */\n\ttab-size: 4;\n}\n\n@media print {\n\t[mol_view_root] {\n\t\theight: auto;\n\t}\n}\n\n[mol_view][mol_view_error]:not([mol_view_error=\"Promise\"]) {\n\tbackground-image: repeating-linear-gradient(\n\t\t-45deg,\n\t\t#f92323,\n\t\t#f92323 .5rem,\n\t\t#ff3d3d .5rem,\n\t\t#ff3d3d 1.5rem\n\t);\n\tcolor: black;\n\talign-items: center;\n\tjustify-content: center;\n}\n\n@keyframes mol_view_wait {\n\tfrom {\n\t\topacity: .25;\n\t}\n\t20% {\n\t\topacity: .75;\n\t}\n\tto {\n\t\topacity: .25;\n\t}\n}\n\n:where([mol_view][mol_view_error=\"Promise\"]) {\n\tbackground: var(--mol_theme_hover);\n}\n\n[mol_view][mol_view_error=\"Promise\"] {\n\tanimation: mol_view_wait 1s steps( 20, end ) infinite;\n}\n");
|
|
2887
2887
|
})($ || ($ = {}));
|
|
2888
2888
|
//mol/view/view/-css/view.css.ts
|
|
2889
2889
|
;
|
|
@@ -9412,310 +9412,6 @@ var $;
|
|
|
9412
9412
|
//hyoo/hyoo.ts
|
|
9413
9413
|
;
|
|
9414
9414
|
"use strict";
|
|
9415
|
-
//mol/data/value/value.ts
|
|
9416
|
-
;
|
|
9417
|
-
"use strict";
|
|
9418
|
-
//mol/type/merge/merge.ts
|
|
9419
|
-
;
|
|
9420
|
-
"use strict";
|
|
9421
|
-
//mol/type/merge/merge.test.ts
|
|
9422
|
-
;
|
|
9423
|
-
"use strict";
|
|
9424
|
-
//mol/type/partial/undefined/undefined.ts
|
|
9425
|
-
;
|
|
9426
|
-
"use strict";
|
|
9427
|
-
//mol/type/partial/undefined/undefined.test.ts
|
|
9428
|
-
;
|
|
9429
|
-
"use strict";
|
|
9430
|
-
var $;
|
|
9431
|
-
(function ($) {
|
|
9432
|
-
function $mol_data_setup(value, config) {
|
|
9433
|
-
return Object.assign(value, {
|
|
9434
|
-
config,
|
|
9435
|
-
Value: null
|
|
9436
|
-
});
|
|
9437
|
-
}
|
|
9438
|
-
$.$mol_data_setup = $mol_data_setup;
|
|
9439
|
-
})($ || ($ = {}));
|
|
9440
|
-
//mol/data/setup/setup.ts
|
|
9441
|
-
;
|
|
9442
|
-
"use strict";
|
|
9443
|
-
var $;
|
|
9444
|
-
(function ($) {
|
|
9445
|
-
$mol_test({
|
|
9446
|
-
'config by value'() {
|
|
9447
|
-
const N = $mol_data_setup((a) => a, 5);
|
|
9448
|
-
$mol_assert_equal(N.config, 5);
|
|
9449
|
-
},
|
|
9450
|
-
});
|
|
9451
|
-
})($ || ($ = {}));
|
|
9452
|
-
//mol/data/setup/setup.test.ts
|
|
9453
|
-
;
|
|
9454
|
-
"use strict";
|
|
9455
|
-
var $;
|
|
9456
|
-
(function ($) {
|
|
9457
|
-
function $mol_diff_path(...paths) {
|
|
9458
|
-
const limit = Math.min(...paths.map(path => path.length));
|
|
9459
|
-
lookup: for (var i = 0; i < limit; ++i) {
|
|
9460
|
-
const first = paths[0][i];
|
|
9461
|
-
for (let j = 1; j < paths.length; ++j) {
|
|
9462
|
-
if (paths[j][i] !== first)
|
|
9463
|
-
break lookup;
|
|
9464
|
-
}
|
|
9465
|
-
}
|
|
9466
|
-
return {
|
|
9467
|
-
prefix: paths[0].slice(0, i),
|
|
9468
|
-
suffix: paths.map(path => path.slice(i)),
|
|
9469
|
-
};
|
|
9470
|
-
}
|
|
9471
|
-
$.$mol_diff_path = $mol_diff_path;
|
|
9472
|
-
})($ || ($ = {}));
|
|
9473
|
-
//mol/diff/path/path.ts
|
|
9474
|
-
;
|
|
9475
|
-
"use strict";
|
|
9476
|
-
var $;
|
|
9477
|
-
(function ($) {
|
|
9478
|
-
$mol_test({
|
|
9479
|
-
'equal paths'() {
|
|
9480
|
-
const diff = $mol_diff_path([1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4]);
|
|
9481
|
-
$mol_assert_like(diff, {
|
|
9482
|
-
prefix: [1, 2, 3, 4],
|
|
9483
|
-
suffix: [[], [], []],
|
|
9484
|
-
});
|
|
9485
|
-
},
|
|
9486
|
-
'different suffix'() {
|
|
9487
|
-
const diff = $mol_diff_path([1, 2, 3, 4], [1, 2, 3, 5], [1, 2, 5, 4]);
|
|
9488
|
-
$mol_assert_like(diff, {
|
|
9489
|
-
prefix: [1, 2],
|
|
9490
|
-
suffix: [[3, 4], [3, 5], [5, 4]],
|
|
9491
|
-
});
|
|
9492
|
-
},
|
|
9493
|
-
'one contains other'() {
|
|
9494
|
-
const diff = $mol_diff_path([1, 2, 3, 4], [1, 2], [1, 2, 3]);
|
|
9495
|
-
$mol_assert_like(diff, {
|
|
9496
|
-
prefix: [1, 2],
|
|
9497
|
-
suffix: [[3, 4], [], [3]],
|
|
9498
|
-
});
|
|
9499
|
-
},
|
|
9500
|
-
'fully different'() {
|
|
9501
|
-
const diff = $mol_diff_path([1, 2], [3, 4], [5, 6]);
|
|
9502
|
-
$mol_assert_like(diff, {
|
|
9503
|
-
prefix: [],
|
|
9504
|
-
suffix: [[1, 2], [3, 4], [5, 6]],
|
|
9505
|
-
});
|
|
9506
|
-
},
|
|
9507
|
-
});
|
|
9508
|
-
})($ || ($ = {}));
|
|
9509
|
-
//mol/diff/path/path.test.ts
|
|
9510
|
-
;
|
|
9511
|
-
"use strict";
|
|
9512
|
-
var $;
|
|
9513
|
-
(function ($) {
|
|
9514
|
-
class $mol_error_mix extends Error {
|
|
9515
|
-
errors;
|
|
9516
|
-
constructor(message, ...errors) {
|
|
9517
|
-
super(message);
|
|
9518
|
-
this.errors = errors;
|
|
9519
|
-
if (errors.length) {
|
|
9520
|
-
const stacks = [...errors.map(error => error.stack), this.stack];
|
|
9521
|
-
const diff = $mol_diff_path(...stacks.map(stack => {
|
|
9522
|
-
if (!stack)
|
|
9523
|
-
return [];
|
|
9524
|
-
return stack.split('\n').reverse();
|
|
9525
|
-
}));
|
|
9526
|
-
const head = diff.prefix.reverse().join('\n');
|
|
9527
|
-
const tails = diff.suffix.map(path => path.reverse().map(line => line.replace(/^(?!\s+at)/, '\tat (.) ')).join('\n')).join('\n\tat (.) -----\n');
|
|
9528
|
-
this.stack = `Error: ${this.constructor.name}\n\tat (.) /"""\\\n${tails}\n\tat (.) \\___/\n${head}`;
|
|
9529
|
-
this.message += errors.map(error => '\n' + error.message).join('');
|
|
9530
|
-
}
|
|
9531
|
-
}
|
|
9532
|
-
toJSON() {
|
|
9533
|
-
return this.message;
|
|
9534
|
-
}
|
|
9535
|
-
}
|
|
9536
|
-
$.$mol_error_mix = $mol_error_mix;
|
|
9537
|
-
})($ || ($ = {}));
|
|
9538
|
-
//mol/error/mix/mix.ts
|
|
9539
|
-
;
|
|
9540
|
-
"use strict";
|
|
9541
|
-
var $;
|
|
9542
|
-
(function ($) {
|
|
9543
|
-
class $mol_data_error extends $mol_error_mix {
|
|
9544
|
-
}
|
|
9545
|
-
$.$mol_data_error = $mol_data_error;
|
|
9546
|
-
})($ || ($ = {}));
|
|
9547
|
-
//mol/data/error/error.ts
|
|
9548
|
-
;
|
|
9549
|
-
"use strict";
|
|
9550
|
-
var $;
|
|
9551
|
-
(function ($) {
|
|
9552
|
-
$.$mol_data_number = (val) => {
|
|
9553
|
-
if (typeof val === 'number')
|
|
9554
|
-
return val;
|
|
9555
|
-
return $mol_fail(new $mol_data_error(`${val} is not a number`));
|
|
9556
|
-
};
|
|
9557
|
-
})($ || ($ = {}));
|
|
9558
|
-
//mol/data/number/number.ts
|
|
9559
|
-
;
|
|
9560
|
-
"use strict";
|
|
9561
|
-
var $;
|
|
9562
|
-
(function ($) {
|
|
9563
|
-
$mol_test({
|
|
9564
|
-
'Is number'() {
|
|
9565
|
-
$mol_data_number(0);
|
|
9566
|
-
},
|
|
9567
|
-
'Is not number'() {
|
|
9568
|
-
$mol_assert_fail(() => {
|
|
9569
|
-
$mol_data_number('x');
|
|
9570
|
-
}, 'x is not a number');
|
|
9571
|
-
},
|
|
9572
|
-
'Is object number'() {
|
|
9573
|
-
$mol_assert_fail(() => {
|
|
9574
|
-
$mol_data_number(new Number(''));
|
|
9575
|
-
}, '0 is not a number');
|
|
9576
|
-
},
|
|
9577
|
-
});
|
|
9578
|
-
})($ || ($ = {}));
|
|
9579
|
-
//mol/data/number/number.test.ts
|
|
9580
|
-
;
|
|
9581
|
-
"use strict";
|
|
9582
|
-
var $;
|
|
9583
|
-
(function ($) {
|
|
9584
|
-
$.$mol_data_string = (val) => {
|
|
9585
|
-
if (typeof val === 'string')
|
|
9586
|
-
return val;
|
|
9587
|
-
return $mol_fail(new $mol_data_error(`${val} is not a string`));
|
|
9588
|
-
};
|
|
9589
|
-
})($ || ($ = {}));
|
|
9590
|
-
//mol/data/string/string.ts
|
|
9591
|
-
;
|
|
9592
|
-
"use strict";
|
|
9593
|
-
var $;
|
|
9594
|
-
(function ($) {
|
|
9595
|
-
$mol_test({
|
|
9596
|
-
'Is string'() {
|
|
9597
|
-
$mol_data_string('');
|
|
9598
|
-
},
|
|
9599
|
-
'Is not string'() {
|
|
9600
|
-
$mol_assert_fail(() => {
|
|
9601
|
-
$mol_data_string(0);
|
|
9602
|
-
}, '0 is not a string');
|
|
9603
|
-
},
|
|
9604
|
-
'Is object string'() {
|
|
9605
|
-
$mol_assert_fail(() => {
|
|
9606
|
-
$mol_data_string(new String('x'));
|
|
9607
|
-
}, 'x is not a string');
|
|
9608
|
-
},
|
|
9609
|
-
});
|
|
9610
|
-
})($ || ($ = {}));
|
|
9611
|
-
//mol/data/string/string.test.ts
|
|
9612
|
-
;
|
|
9613
|
-
"use strict";
|
|
9614
|
-
var $;
|
|
9615
|
-
(function ($) {
|
|
9616
|
-
function $mol_data_record(sub) {
|
|
9617
|
-
return $mol_data_setup((val) => {
|
|
9618
|
-
let res = {};
|
|
9619
|
-
for (const field in sub) {
|
|
9620
|
-
try {
|
|
9621
|
-
res[field] = sub[field](val[field]);
|
|
9622
|
-
}
|
|
9623
|
-
catch (error) {
|
|
9624
|
-
if (error instanceof Promise)
|
|
9625
|
-
return $mol_fail_hidden(error);
|
|
9626
|
-
error.message = `[${JSON.stringify(field)}] ${error.message}`;
|
|
9627
|
-
return $mol_fail(error);
|
|
9628
|
-
}
|
|
9629
|
-
}
|
|
9630
|
-
return res;
|
|
9631
|
-
}, sub);
|
|
9632
|
-
}
|
|
9633
|
-
$.$mol_data_record = $mol_data_record;
|
|
9634
|
-
})($ || ($ = {}));
|
|
9635
|
-
//mol/data/record/record.ts
|
|
9636
|
-
;
|
|
9637
|
-
"use strict";
|
|
9638
|
-
var $;
|
|
9639
|
-
(function ($) {
|
|
9640
|
-
$mol_test({
|
|
9641
|
-
'Fit to record'() {
|
|
9642
|
-
const User = $mol_data_record({ age: $mol_data_number });
|
|
9643
|
-
User({ age: 0 });
|
|
9644
|
-
},
|
|
9645
|
-
'Extends record'() {
|
|
9646
|
-
const User = $mol_data_record({ age: $mol_data_number });
|
|
9647
|
-
User({ age: 0, name: 'Jin' });
|
|
9648
|
-
},
|
|
9649
|
-
'Shrinks record'() {
|
|
9650
|
-
$mol_assert_fail(() => {
|
|
9651
|
-
const User = $mol_data_record({ age: $mol_data_number, name: $mol_data_string });
|
|
9652
|
-
User({ age: 0 });
|
|
9653
|
-
}, '["name"] undefined is not a string');
|
|
9654
|
-
},
|
|
9655
|
-
'Shrinks deep record'() {
|
|
9656
|
-
$mol_assert_fail(() => {
|
|
9657
|
-
const User = $mol_data_record({ wife: $mol_data_record({ age: $mol_data_number }) });
|
|
9658
|
-
User({ wife: {} });
|
|
9659
|
-
}, '["wife"] ["age"] undefined is not a number');
|
|
9660
|
-
},
|
|
9661
|
-
});
|
|
9662
|
-
})($ || ($ = {}));
|
|
9663
|
-
//mol/data/record/record.test.ts
|
|
9664
|
-
;
|
|
9665
|
-
"use strict";
|
|
9666
|
-
var $;
|
|
9667
|
-
(function ($) {
|
|
9668
|
-
function $mol_data_array(sub) {
|
|
9669
|
-
return $mol_data_setup((val) => {
|
|
9670
|
-
if (!Array.isArray(val))
|
|
9671
|
-
return $mol_fail(new $mol_data_error(`${val} is not an array`));
|
|
9672
|
-
return val.map((item, index) => {
|
|
9673
|
-
try {
|
|
9674
|
-
return sub(item);
|
|
9675
|
-
}
|
|
9676
|
-
catch (error) {
|
|
9677
|
-
if (error instanceof Promise)
|
|
9678
|
-
return $mol_fail_hidden(error);
|
|
9679
|
-
error.message = `[${index}] ${error.message}`;
|
|
9680
|
-
return $mol_fail(error);
|
|
9681
|
-
}
|
|
9682
|
-
});
|
|
9683
|
-
}, sub);
|
|
9684
|
-
}
|
|
9685
|
-
$.$mol_data_array = $mol_data_array;
|
|
9686
|
-
})($ || ($ = {}));
|
|
9687
|
-
//mol/data/array/array.ts
|
|
9688
|
-
;
|
|
9689
|
-
"use strict";
|
|
9690
|
-
var $;
|
|
9691
|
-
(function ($) {
|
|
9692
|
-
$mol_test({
|
|
9693
|
-
'Is empty array'() {
|
|
9694
|
-
$mol_data_array($mol_data_number)([]);
|
|
9695
|
-
},
|
|
9696
|
-
'Is array'() {
|
|
9697
|
-
$mol_data_array($mol_data_number)([1, 2]);
|
|
9698
|
-
},
|
|
9699
|
-
'Is not array'() {
|
|
9700
|
-
$mol_assert_fail(() => {
|
|
9701
|
-
$mol_data_array($mol_data_number)({ [0]: 1, length: 1, map: () => { } });
|
|
9702
|
-
}, '[object Object] is not an array');
|
|
9703
|
-
},
|
|
9704
|
-
'Has wrong item'() {
|
|
9705
|
-
$mol_assert_fail(() => {
|
|
9706
|
-
$mol_data_array($mol_data_number)([1, '1']);
|
|
9707
|
-
}, '[1] 1 is not a number');
|
|
9708
|
-
},
|
|
9709
|
-
'Has wrong deep item'() {
|
|
9710
|
-
$mol_assert_fail(() => {
|
|
9711
|
-
$mol_data_array($mol_data_array($mol_data_number))([[], [0, 0, false]]);
|
|
9712
|
-
}, '[1] [2] false is not a number');
|
|
9713
|
-
},
|
|
9714
|
-
});
|
|
9715
|
-
})($ || ($ = {}));
|
|
9716
|
-
//mol/data/array/array.test.ts
|
|
9717
|
-
;
|
|
9718
|
-
"use strict";
|
|
9719
9415
|
var $;
|
|
9720
9416
|
(function ($) {
|
|
9721
9417
|
$.$mol_action = $mol_wire_method;
|
|
@@ -9891,37 +9587,43 @@ var $;
|
|
|
9891
9587
|
"use strict";
|
|
9892
9588
|
var $;
|
|
9893
9589
|
(function ($) {
|
|
9894
|
-
const Response = $mol_data_record({
|
|
9895
|
-
data: $mol_data_array($mol_data_string)
|
|
9896
|
-
});
|
|
9897
9590
|
function $mol_huggingface_run(space, method, ...data) {
|
|
9898
|
-
|
|
9899
|
-
|
|
9900
|
-
|
|
9901
|
-
return $mol_wire_sync(this).$
|
|
9591
|
+
while (true) {
|
|
9592
|
+
try {
|
|
9593
|
+
if (typeof method === 'number') {
|
|
9594
|
+
return $mol_wire_sync(this).$mol_huggingface_ws(space, method, ...data);
|
|
9902
9595
|
}
|
|
9903
|
-
|
|
9904
|
-
|
|
9905
|
-
|
|
9906
|
-
|
|
9907
|
-
|
|
9908
|
-
|
|
9909
|
-
}
|
|
9596
|
+
else {
|
|
9597
|
+
return this.$mol_huggingface_rest(space, method, ...data);
|
|
9598
|
+
}
|
|
9599
|
+
}
|
|
9600
|
+
catch (error) {
|
|
9601
|
+
if ($mol_promise_like(error))
|
|
9910
9602
|
$mol_fail_hidden(error);
|
|
9603
|
+
if (error instanceof Error && error.message === `Queue full`) {
|
|
9604
|
+
$mol_fail_log(error);
|
|
9605
|
+
continue;
|
|
9911
9606
|
}
|
|
9607
|
+
$mol_fail_hidden(error);
|
|
9912
9608
|
}
|
|
9913
9609
|
}
|
|
9914
|
-
|
|
9610
|
+
}
|
|
9611
|
+
$.$mol_huggingface_run = $mol_huggingface_run;
|
|
9612
|
+
function $mol_huggingface_rest(space, method, ...data) {
|
|
9613
|
+
const uri = `https://${space}.hf.space/run/${method}`;
|
|
9614
|
+
const response = $mol_fetch.json(uri, {
|
|
9915
9615
|
method: 'post',
|
|
9916
9616
|
headers: { "Content-Type": "application/json" },
|
|
9917
9617
|
body: JSON.stringify({ data }),
|
|
9918
9618
|
});
|
|
9919
|
-
|
|
9619
|
+
if ('error' in response) {
|
|
9620
|
+
$mol_fail(new Error(response.error ?? 'Unknown API error'));
|
|
9621
|
+
}
|
|
9622
|
+
return response.data;
|
|
9920
9623
|
}
|
|
9921
|
-
$.$
|
|
9922
|
-
function $
|
|
9624
|
+
$.$mol_huggingface_rest = $mol_huggingface_rest;
|
|
9625
|
+
function $mol_huggingface_ws(space, fn_index, ...data) {
|
|
9923
9626
|
const session_hash = $mol_guid();
|
|
9924
|
-
const fn_index = method;
|
|
9925
9627
|
const socket = new WebSocket(`wss://${space}.hf.space/queue/join`);
|
|
9926
9628
|
const promise = new Promise((done, fail) => {
|
|
9927
9629
|
socket.onclose = event => {
|
|
@@ -9929,7 +9631,7 @@ var $;
|
|
|
9929
9631
|
fail(new Error(event.reason));
|
|
9930
9632
|
};
|
|
9931
9633
|
socket.onerror = event => {
|
|
9932
|
-
fail(new Error(
|
|
9634
|
+
fail(new Error(`Socket error`));
|
|
9933
9635
|
};
|
|
9934
9636
|
socket.onmessage = event => {
|
|
9935
9637
|
const message = JSON.parse(event.data);
|
|
@@ -9947,10 +9649,10 @@ var $;
|
|
|
9947
9649
|
return done(message.output.data);
|
|
9948
9650
|
}
|
|
9949
9651
|
else {
|
|
9950
|
-
return fail(new Error(message.output.error ??
|
|
9652
|
+
return fail(new Error(message.output.error ?? `Unknown API error`));
|
|
9951
9653
|
}
|
|
9952
9654
|
default:
|
|
9953
|
-
fail(new Error(`Unknown message type ${message.msg}`));
|
|
9655
|
+
return fail(new Error(`Unknown message type: ${message.msg}`));
|
|
9954
9656
|
}
|
|
9955
9657
|
};
|
|
9956
9658
|
});
|
|
@@ -9958,7 +9660,7 @@ var $;
|
|
|
9958
9660
|
destructor: () => socket.close()
|
|
9959
9661
|
});
|
|
9960
9662
|
}
|
|
9961
|
-
$.$
|
|
9663
|
+
$.$mol_huggingface_ws = $mol_huggingface_ws;
|
|
9962
9664
|
})($ || ($ = {}));
|
|
9963
9665
|
//mol/huggingface/huggingface.ts
|
|
9964
9666
|
;
|
|
@@ -9966,6 +9668,8 @@ var $;
|
|
|
9966
9668
|
var $;
|
|
9967
9669
|
(function ($) {
|
|
9968
9670
|
function $hyoo_lingua_translate(lang, text) {
|
|
9671
|
+
if (!text.trim())
|
|
9672
|
+
return '';
|
|
9969
9673
|
const cache_key = `$hyoo_lingua_translate(${JSON.stringify(lang)},${JSON.stringify(text)})`;
|
|
9970
9674
|
const cached = this.$mol_state_local.value(cache_key);
|
|
9971
9675
|
if (cached)
|