mol_plot_all 1.2.1706 → 1.2.1707
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 +597 -1
- package/node.d.ts.map +1 -1
- package/node.deps.json +1 -1
- package/node.js +318 -14
- package/node.js.map +1 -1
- package/node.mjs +318 -14
- package/node.test.js +443 -15
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.d.ts +546 -0
- package/web.d.ts.map +1 -1
- package/web.deps.json +1 -1
- package/web.js +262 -10
- package/web.js.map +1 -1
- package/web.mjs +262 -10
- package/web.test.js +135 -7
- package/web.test.js.map +1 -1
package/web.test.js
CHANGED
|
@@ -11,6 +11,15 @@ function require( path ){ return $node[ path ] };
|
|
|
11
11
|
;
|
|
12
12
|
"use strict";
|
|
13
13
|
|
|
14
|
+
;
|
|
15
|
+
"use strict";
|
|
16
|
+
|
|
17
|
+
;
|
|
18
|
+
"use strict";
|
|
19
|
+
|
|
20
|
+
;
|
|
21
|
+
"use strict";
|
|
22
|
+
|
|
14
23
|
;
|
|
15
24
|
"use strict";
|
|
16
25
|
var $;
|
|
@@ -111,18 +120,34 @@ var $;
|
|
|
111
120
|
"use strict";
|
|
112
121
|
var $;
|
|
113
122
|
(function ($) {
|
|
123
|
+
/**
|
|
124
|
+
* Argument must be Truthy
|
|
125
|
+
* @deprecated use $mol_assert_equal instead
|
|
126
|
+
*/
|
|
114
127
|
function $mol_assert_ok(value) {
|
|
115
128
|
if (value)
|
|
116
129
|
return;
|
|
117
130
|
$mol_fail(new Error(`${value} ≠ true`));
|
|
118
131
|
}
|
|
119
132
|
$.$mol_assert_ok = $mol_assert_ok;
|
|
133
|
+
/**
|
|
134
|
+
* Argument must be Falsy
|
|
135
|
+
* @deprecated use $mol_assert_equal instead
|
|
136
|
+
*/
|
|
120
137
|
function $mol_assert_not(value) {
|
|
121
138
|
if (!value)
|
|
122
139
|
return;
|
|
123
140
|
$mol_fail(new Error(`${value} ≠ false`));
|
|
124
141
|
}
|
|
125
142
|
$.$mol_assert_not = $mol_assert_not;
|
|
143
|
+
/**
|
|
144
|
+
* Handler must throw an error.
|
|
145
|
+
* @example
|
|
146
|
+
* $mol_assert_fail( ()=>{ throw new Error( 'Parse error' ) } ) // Passes because throws error
|
|
147
|
+
* $mol_assert_fail( ()=>{ throw new Error( 'Parse error' ) } , 'Parse error' ) // Passes because throws right message
|
|
148
|
+
* $mol_assert_fail( ()=>{ throw new Error( 'Parse error' ) } , Error ) // Passes because throws right class
|
|
149
|
+
* @see https://mol.hyoo.ru/#!section=docs/=9q9dv3_fgxjsf
|
|
150
|
+
*/
|
|
126
151
|
function $mol_assert_fail(handler, ErrorRight) {
|
|
127
152
|
const fail = $.$mol_fail;
|
|
128
153
|
try {
|
|
@@ -145,10 +170,18 @@ var $;
|
|
|
145
170
|
$mol_fail(new Error('Not failed', { cause: { expect: ErrorRight } }));
|
|
146
171
|
}
|
|
147
172
|
$.$mol_assert_fail = $mol_assert_fail;
|
|
173
|
+
/** @deprecated Use $mol_assert_equal */
|
|
148
174
|
function $mol_assert_like(...args) {
|
|
149
175
|
$mol_assert_equal(...args);
|
|
150
176
|
}
|
|
151
177
|
$.$mol_assert_like = $mol_assert_like;
|
|
178
|
+
/**
|
|
179
|
+
* All arguments must not be structural equal to each other.
|
|
180
|
+
* @example
|
|
181
|
+
* $mol_assert_unique( 1 , 2 , 3 ) // Passes
|
|
182
|
+
* $mol_assert_unique( 1 , 1 , 2 ) // Fails because 1 === 1
|
|
183
|
+
* @see https://mol.hyoo.ru/#!section=docs/=9q9dv3_fgxjsf
|
|
184
|
+
*/
|
|
152
185
|
function $mol_assert_unique(...args) {
|
|
153
186
|
for (let i = 0; i < args.length; ++i) {
|
|
154
187
|
for (let j = 0; j < args.length; ++j) {
|
|
@@ -161,6 +194,13 @@ var $;
|
|
|
161
194
|
}
|
|
162
195
|
}
|
|
163
196
|
$.$mol_assert_unique = $mol_assert_unique;
|
|
197
|
+
/**
|
|
198
|
+
* All arguments must be structural equal each other.
|
|
199
|
+
* @example
|
|
200
|
+
* $mol_assert_like( [1] , [1] , [1] ) // Passes
|
|
201
|
+
* $mol_assert_like( [1] , [1] , [2] ) // Fails because 1 !== 2
|
|
202
|
+
* @see https://mol.hyoo.ru/#!section=docs/=9q9dv3_fgxjsf
|
|
203
|
+
*/
|
|
164
204
|
function $mol_assert_equal(...args) {
|
|
165
205
|
for (let i = 1; i < args.length; ++i) {
|
|
166
206
|
if ($mol_compare_deep(args[0], args[i]))
|
|
@@ -222,6 +262,8 @@ var $;
|
|
|
222
262
|
|
|
223
263
|
;
|
|
224
264
|
"use strict";
|
|
265
|
+
/** @jsx $mol_jsx */
|
|
266
|
+
/** @jsxFrag $mol_jsx_frag */
|
|
225
267
|
var $;
|
|
226
268
|
(function ($) {
|
|
227
269
|
$mol_test({
|
|
@@ -392,12 +434,6 @@ var $;
|
|
|
392
434
|
;
|
|
393
435
|
"use strict";
|
|
394
436
|
|
|
395
|
-
;
|
|
396
|
-
"use strict";
|
|
397
|
-
|
|
398
|
-
;
|
|
399
|
-
"use strict";
|
|
400
|
-
|
|
401
437
|
;
|
|
402
438
|
"use strict";
|
|
403
439
|
var $;
|
|
@@ -514,6 +550,7 @@ var $;
|
|
|
514
550
|
"use strict";
|
|
515
551
|
var $;
|
|
516
552
|
(function ($) {
|
|
553
|
+
/// @todo right orderinng
|
|
517
554
|
$.$mol_after_mock_queue = [];
|
|
518
555
|
function $mol_after_mock_warp() {
|
|
519
556
|
const queue = $.$mol_after_mock_queue.splice(0);
|
|
@@ -646,6 +683,7 @@ var $;
|
|
|
646
683
|
"use strict";
|
|
647
684
|
var $;
|
|
648
685
|
(function ($) {
|
|
686
|
+
/** Lazy computed lists with native Array interface. $mol_range2_array is mutable but all derived ranges are immutable. */
|
|
649
687
|
function $mol_range2(item = index => index, size = () => Number.POSITIVE_INFINITY) {
|
|
650
688
|
const source = typeof item === 'function' ? new $mol_range2_array() : item;
|
|
651
689
|
if (typeof item !== 'function') {
|
|
@@ -694,6 +732,7 @@ var $;
|
|
|
694
732
|
}
|
|
695
733
|
$.$mol_range2 = $mol_range2;
|
|
696
734
|
class $mol_range2_array extends Array {
|
|
735
|
+
// Lazy
|
|
697
736
|
concat(...tail) {
|
|
698
737
|
if (tail.length === 0)
|
|
699
738
|
return this;
|
|
@@ -705,6 +744,7 @@ var $;
|
|
|
705
744
|
}
|
|
706
745
|
return $mol_range2(index => index < this.length ? this[index] : tail[0][index - this.length], () => this.length + tail[0].length);
|
|
707
746
|
}
|
|
747
|
+
// Lazy
|
|
708
748
|
filter(check, context) {
|
|
709
749
|
const filtered = [];
|
|
710
750
|
let cursor = -1;
|
|
@@ -717,13 +757,16 @@ var $;
|
|
|
717
757
|
return filtered[index];
|
|
718
758
|
}, () => cursor < this.length ? Number.POSITIVE_INFINITY : filtered.length);
|
|
719
759
|
}
|
|
760
|
+
// Diligent
|
|
720
761
|
forEach(proceed, context) {
|
|
721
762
|
for (let [key, value] of this.entries())
|
|
722
763
|
proceed.call(context, value, key, this);
|
|
723
764
|
}
|
|
765
|
+
// Lazy
|
|
724
766
|
map(proceed, context) {
|
|
725
767
|
return $mol_range2(index => proceed.call(context, this[index], index, this), () => this.length);
|
|
726
768
|
}
|
|
769
|
+
// Diligent
|
|
727
770
|
reduce(merge, result) {
|
|
728
771
|
let index = 0;
|
|
729
772
|
if (arguments.length === 1) {
|
|
@@ -734,12 +777,15 @@ var $;
|
|
|
734
777
|
}
|
|
735
778
|
return result;
|
|
736
779
|
}
|
|
780
|
+
// Lazy
|
|
737
781
|
toReversed() {
|
|
738
782
|
return $mol_range2(index => this[this.length - 1 - index], () => this.length);
|
|
739
783
|
}
|
|
784
|
+
// Lazy
|
|
740
785
|
slice(from = 0, to = this.length) {
|
|
741
786
|
return $mol_range2(index => this[from + index], () => Math.min(to, this.length) - from);
|
|
742
787
|
}
|
|
788
|
+
// Lazy
|
|
743
789
|
some(check, context) {
|
|
744
790
|
for (let index = 0; index < this.length; ++index) {
|
|
745
791
|
if (check.call(context, this[index], index, this))
|
|
@@ -932,6 +978,7 @@ var $;
|
|
|
932
978
|
|
|
933
979
|
;
|
|
934
980
|
"use strict";
|
|
981
|
+
/** @jsx $mol_jsx */
|
|
935
982
|
var $;
|
|
936
983
|
(function ($) {
|
|
937
984
|
$mol_test({
|
|
@@ -993,6 +1040,7 @@ var $;
|
|
|
993
1040
|
const obj3_copy = { test: 3, obj2: obj2_copy };
|
|
994
1041
|
obj1.obj3 = obj3;
|
|
995
1042
|
obj1_copy.obj3 = obj3_copy;
|
|
1043
|
+
// warmup cache
|
|
996
1044
|
$mol_assert_not($mol_compare_deep(obj1, {}));
|
|
997
1045
|
$mol_assert_not($mol_compare_deep(obj2, {}));
|
|
998
1046
|
$mol_assert_not($mol_compare_deep(obj3, {}));
|
|
@@ -1152,6 +1200,10 @@ var $;
|
|
|
1152
1200
|
props[field] = get_val;
|
|
1153
1201
|
return get_val;
|
|
1154
1202
|
}
|
|
1203
|
+
/**
|
|
1204
|
+
* Convert asynchronous (promise-based) API to synchronous by wrapping function and method calls in a fiber.
|
|
1205
|
+
* @see https://mol.hyoo.ru/#!section=docs/=1fcpsq_1wh0h2
|
|
1206
|
+
*/
|
|
1155
1207
|
function $mol_wire_sync(obj) {
|
|
1156
1208
|
return new Proxy(obj, {
|
|
1157
1209
|
get(obj, field) {
|
|
@@ -1333,6 +1385,7 @@ var $;
|
|
|
1333
1385
|
var $;
|
|
1334
1386
|
(function ($_1) {
|
|
1335
1387
|
$mol_test({
|
|
1388
|
+
// https://github.com/nin-jin/slides/tree/master/reactivity#component-states
|
|
1336
1389
|
'Cached channel'($) {
|
|
1337
1390
|
class App extends $mol_object2 {
|
|
1338
1391
|
static $ = $;
|
|
@@ -1390,6 +1443,7 @@ var $;
|
|
|
1390
1443
|
$mol_assert_equal(App.value(5), 21);
|
|
1391
1444
|
$mol_assert_equal(App.value(), 21);
|
|
1392
1445
|
},
|
|
1446
|
+
// https://github.com/nin-jin/slides/tree/master/reactivity#wish-consistency
|
|
1393
1447
|
'Auto recalculation of cached values'($) {
|
|
1394
1448
|
class App extends $mol_object2 {
|
|
1395
1449
|
static $ = $;
|
|
@@ -1417,6 +1471,7 @@ var $;
|
|
|
1417
1471
|
App.xxx(5);
|
|
1418
1472
|
$mol_assert_equal(App.zzz(), 7);
|
|
1419
1473
|
},
|
|
1474
|
+
// https://github.com/nin-jin/slides/tree/master/reactivity#wish-reasonability
|
|
1420
1475
|
'Skip recalculation when actually no dependency changes'($) {
|
|
1421
1476
|
const log = [];
|
|
1422
1477
|
class App extends $mol_object2 {
|
|
@@ -1450,6 +1505,7 @@ var $;
|
|
|
1450
1505
|
App.zzz();
|
|
1451
1506
|
$mol_assert_like(log, ['zzz', 'yyy', 'xxx', 'xxx', 'yyy']);
|
|
1452
1507
|
},
|
|
1508
|
+
// https://github.com/nin-jin/slides/tree/master/reactivity#flow-auto
|
|
1453
1509
|
'Flow: Auto'($) {
|
|
1454
1510
|
class App extends $mol_object2 {
|
|
1455
1511
|
static get $() { return $; }
|
|
@@ -1487,6 +1543,7 @@ var $;
|
|
|
1487
1543
|
$mol_assert_equal(App.result(), 23);
|
|
1488
1544
|
$mol_assert_equal(App.counter, 4);
|
|
1489
1545
|
},
|
|
1546
|
+
// https://github.com/nin-jin/slides/tree/master/reactivity#dupes-equality
|
|
1490
1547
|
'Dupes: Equality'($) {
|
|
1491
1548
|
let counter = 0;
|
|
1492
1549
|
class App extends $mol_object2 {
|
|
@@ -1510,6 +1567,7 @@ var $;
|
|
|
1510
1567
|
App.foo({ numbs: [2] });
|
|
1511
1568
|
$mol_assert_like(App.bar(), { numbs: [2], count: 2 });
|
|
1512
1569
|
},
|
|
1570
|
+
// https://github.com/nin-jin/slides/tree/master/reactivity#cycle-fail
|
|
1513
1571
|
'Cycle: Fail'($) {
|
|
1514
1572
|
class App extends $mol_object2 {
|
|
1515
1573
|
static $ = $;
|
|
@@ -1534,6 +1592,29 @@ var $;
|
|
|
1534
1592
|
], App, "test", null);
|
|
1535
1593
|
App.test();
|
|
1536
1594
|
},
|
|
1595
|
+
// https://github.com/nin-jin/slides/tree/master/reactivity#wish-stability
|
|
1596
|
+
// 'Update deps on push'( $ ) {
|
|
1597
|
+
// class App extends $mol_object2 {
|
|
1598
|
+
// static $ = $
|
|
1599
|
+
// @ $mol_wire_solo
|
|
1600
|
+
// static left( next = false ) {
|
|
1601
|
+
// return next
|
|
1602
|
+
// }
|
|
1603
|
+
// @ $mol_wire_solo
|
|
1604
|
+
// static right( next = false ) {
|
|
1605
|
+
// return next
|
|
1606
|
+
// }
|
|
1607
|
+
// @ $mol_wire_solo
|
|
1608
|
+
// static res( next?: boolean ) {
|
|
1609
|
+
// return this.left( next ) && this.right()
|
|
1610
|
+
// }
|
|
1611
|
+
// }
|
|
1612
|
+
// $mol_assert_equal( App.res(), false )
|
|
1613
|
+
// $mol_assert_equal( App.res( true ), false )
|
|
1614
|
+
// $mol_assert_equal( App.right( true ), true )
|
|
1615
|
+
// $mol_assert_equal( App.res(), true )
|
|
1616
|
+
// } ,
|
|
1617
|
+
// https://github.com/nin-jin/slides/tree/master/reactivity#wish-stability
|
|
1537
1618
|
'Different order of pull and push'($) {
|
|
1538
1619
|
class App extends $mol_object2 {
|
|
1539
1620
|
static $ = $;
|
|
@@ -1545,7 +1626,7 @@ var $;
|
|
|
1545
1626
|
}
|
|
1546
1627
|
static slow(next) {
|
|
1547
1628
|
if (next !== undefined)
|
|
1548
|
-
this.slow();
|
|
1629
|
+
this.slow(); // enforce pull before push
|
|
1549
1630
|
return this.store(next);
|
|
1550
1631
|
}
|
|
1551
1632
|
}
|
|
@@ -1564,6 +1645,7 @@ var $;
|
|
|
1564
1645
|
App.store(777);
|
|
1565
1646
|
$mol_assert_equal(App.fast(), App.slow(), 777);
|
|
1566
1647
|
},
|
|
1648
|
+
// https://github.com/nin-jin/slides/tree/master/reactivity#wish-stability
|
|
1567
1649
|
'Actions inside invariant'($) {
|
|
1568
1650
|
class App extends $mol_object2 {
|
|
1569
1651
|
static $ = $;
|
|
@@ -1603,6 +1685,7 @@ var $;
|
|
|
1603
1685
|
static toggle() {
|
|
1604
1686
|
const prev = this.checked();
|
|
1605
1687
|
$mol_assert_unique(this.checked(!prev), prev);
|
|
1688
|
+
// $mol_assert_equal( this.checked() , prev )
|
|
1606
1689
|
}
|
|
1607
1690
|
static res() {
|
|
1608
1691
|
return this.checked();
|
|
@@ -1627,6 +1710,39 @@ var $;
|
|
|
1627
1710
|
], App, "test", null);
|
|
1628
1711
|
await $mol_wire_async(App).test();
|
|
1629
1712
|
},
|
|
1713
|
+
// // https://github.com/nin-jin/slides/tree/master/reactivity#wish-stability
|
|
1714
|
+
// 'Stable order of multiple root'( $ ) {
|
|
1715
|
+
// class App extends $mol_object2 {
|
|
1716
|
+
// static $ = $
|
|
1717
|
+
// static counter = 0
|
|
1718
|
+
// @ $mol_wire_solo
|
|
1719
|
+
// static left_trigger( next = 0 ) {
|
|
1720
|
+
// return next
|
|
1721
|
+
// }
|
|
1722
|
+
// @ $mol_wire_solo
|
|
1723
|
+
// static left_root() {
|
|
1724
|
+
// this.left_trigger()
|
|
1725
|
+
// return ++ this.counter
|
|
1726
|
+
// }
|
|
1727
|
+
// @ $mol_wire_solo
|
|
1728
|
+
// static right_trigger( next = 0 ) {
|
|
1729
|
+
// return next
|
|
1730
|
+
// }
|
|
1731
|
+
// @ $mol_wire_solo
|
|
1732
|
+
// static right_root() {
|
|
1733
|
+
// this.right_trigger()
|
|
1734
|
+
// return ++ this.counter
|
|
1735
|
+
// }
|
|
1736
|
+
// }
|
|
1737
|
+
// $mol_assert_equal( App.left_root(), 1 )
|
|
1738
|
+
// $mol_assert_equal( App.right_root(), 2 )
|
|
1739
|
+
// App.right_trigger( 1 )
|
|
1740
|
+
// App.left_trigger( 1 )
|
|
1741
|
+
// $mol_wire_fiber.sync()
|
|
1742
|
+
// $mol_assert_equal( App.right_root(), 4 )
|
|
1743
|
+
// $mol_assert_equal( App.left_root(), 3 )
|
|
1744
|
+
// } ,
|
|
1745
|
+
// https://github.com/nin-jin/slides/tree/master/reactivity#error-store
|
|
1630
1746
|
'Restore after error'($) {
|
|
1631
1747
|
class App extends $mol_object2 {
|
|
1632
1748
|
static get $() { return $; }
|
|
@@ -1724,6 +1840,7 @@ var $;
|
|
|
1724
1840
|
App.showing(true);
|
|
1725
1841
|
$mol_assert_unique(App.render(), details);
|
|
1726
1842
|
},
|
|
1843
|
+
// https://github.com/nin-jin/slides/tree/master/reactivity#wish-stability
|
|
1727
1844
|
async 'Hold pubs while wait async task'($) {
|
|
1728
1845
|
class App extends $mol_object2 {
|
|
1729
1846
|
static $ = $;
|
|
@@ -1939,6 +2056,7 @@ var $;
|
|
|
1939
2056
|
|
|
1940
2057
|
;
|
|
1941
2058
|
"use strict";
|
|
2059
|
+
/** @jsx $mol_jsx */
|
|
1942
2060
|
var $;
|
|
1943
2061
|
(function ($) {
|
|
1944
2062
|
$mol_test({
|
|
@@ -2024,6 +2142,12 @@ var $;
|
|
|
2024
2142
|
'return result without errors'() {
|
|
2025
2143
|
$mol_assert_equal($mol_try(() => false), false);
|
|
2026
2144
|
},
|
|
2145
|
+
//'return error if thrown'() {
|
|
2146
|
+
//
|
|
2147
|
+
// const error = new Error( '$mol_try test error' )
|
|
2148
|
+
// $mol_assert_equal( $mol_try( ()=> { throw error } ) , error )
|
|
2149
|
+
//
|
|
2150
|
+
//} ,
|
|
2027
2151
|
});
|
|
2028
2152
|
})($ || ($ = {}));
|
|
2029
2153
|
|
|
@@ -2038,6 +2162,7 @@ var $;
|
|
|
2038
2162
|
"use strict";
|
|
2039
2163
|
var $;
|
|
2040
2164
|
(function ($) {
|
|
2165
|
+
/** Watch and logs reactive states. Logger automatically added to test bundle which is adding to `test.html`. */
|
|
2041
2166
|
class $mol_wire_log extends $mol_object2 {
|
|
2042
2167
|
static watch(task) {
|
|
2043
2168
|
return task;
|
|
@@ -2279,6 +2404,9 @@ var $;
|
|
|
2279
2404
|
});
|
|
2280
2405
|
})($ || ($ = {}));
|
|
2281
2406
|
|
|
2407
|
+
;
|
|
2408
|
+
"use strict";
|
|
2409
|
+
|
|
2282
2410
|
;
|
|
2283
2411
|
"use strict";
|
|
2284
2412
|
var $;
|