mol_plot_all 1.2.130 → 1.2.134
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 +7 -10
- package/node.deps.json +1 -1
- package/node.esm.js +176 -89
- package/node.esm.js.map +1 -1
- package/node.js +176 -89
- package/node.js.map +1 -1
- package/node.test.js +203 -453
- package/node.test.js.map +1 -1
- package/node.view.tree +5 -1
- package/package.json +1 -1
- package/web.d.ts +7 -10
- package/web.deps.json +1 -1
- package/web.esm.js +176 -89
- package/web.esm.js.map +1 -1
- package/web.js +176 -89
- package/web.js.map +1 -1
- package/web.test.js +24 -361
- package/web.test.js.map +1 -1
- package/web.view.tree +5 -1
package/node.test.js
CHANGED
|
@@ -953,91 +953,125 @@ var $;
|
|
|
953
953
|
"use strict";
|
|
954
954
|
var $;
|
|
955
955
|
(function ($) {
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
956
|
+
let cache = new WeakMap();
|
|
957
|
+
function $mol_compare_deep(left, right) {
|
|
958
|
+
if (Object.is(left, right))
|
|
959
|
+
return true;
|
|
960
|
+
if (left === null)
|
|
961
|
+
return false;
|
|
962
|
+
if (right === null)
|
|
963
|
+
return false;
|
|
964
|
+
if (typeof left !== 'object')
|
|
965
|
+
return false;
|
|
966
|
+
if (typeof right !== 'object')
|
|
967
|
+
return false;
|
|
968
|
+
const left_proto = Reflect.getPrototypeOf(left);
|
|
969
|
+
const right_proto = Reflect.getPrototypeOf(right);
|
|
970
|
+
if (left_proto !== right_proto)
|
|
971
|
+
return false;
|
|
972
|
+
if (left instanceof Boolean)
|
|
973
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
974
|
+
if (left instanceof Number)
|
|
975
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
976
|
+
if (left instanceof String)
|
|
977
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
978
|
+
if (left instanceof Date)
|
|
979
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
980
|
+
if (left instanceof RegExp)
|
|
981
|
+
return left.source === right['source'] && left.flags === right['flags'];
|
|
982
|
+
let left_cache = cache.get(left);
|
|
983
|
+
if (left_cache) {
|
|
984
|
+
const right_cache = left_cache.get(right);
|
|
985
|
+
if (typeof right_cache === 'boolean')
|
|
986
|
+
return right_cache;
|
|
987
|
+
}
|
|
988
|
+
else {
|
|
989
|
+
left_cache = new WeakMap([[right, true]]);
|
|
990
|
+
cache.set(left, left_cache);
|
|
991
|
+
}
|
|
992
|
+
let result;
|
|
980
993
|
try {
|
|
981
|
-
|
|
994
|
+
if (left_proto && !Reflect.getPrototypeOf(left_proto))
|
|
995
|
+
result = compare_pojo(left, right);
|
|
996
|
+
else if (Array.isArray(left))
|
|
997
|
+
result = compare_array(left, right);
|
|
998
|
+
else if (left instanceof Set)
|
|
999
|
+
result = compare_set(left, right);
|
|
1000
|
+
else if (left instanceof Map)
|
|
1001
|
+
result = compare_map(left, right);
|
|
1002
|
+
else if (ArrayBuffer.isView(left))
|
|
1003
|
+
result = compare_buffer(left, right);
|
|
1004
|
+
else if (Symbol.toPrimitive in left)
|
|
1005
|
+
result = compare_primitive(left, right);
|
|
1006
|
+
else
|
|
1007
|
+
result = false;
|
|
982
1008
|
}
|
|
983
1009
|
finally {
|
|
984
|
-
|
|
985
|
-
}
|
|
986
|
-
}
|
|
987
|
-
$.$mol_conform = $mol_conform;
|
|
988
|
-
$.$mol_conform_handlers = new WeakMap();
|
|
989
|
-
function $mol_conform_handler(cl, handler) {
|
|
990
|
-
$.$mol_conform_handlers.set(cl, handler);
|
|
991
|
-
}
|
|
992
|
-
$.$mol_conform_handler = $mol_conform_handler;
|
|
993
|
-
function $mol_conform_array(target, source) {
|
|
994
|
-
if (source.length !== target.length)
|
|
995
|
-
return target;
|
|
996
|
-
for (let i = 0; i < target.length; ++i) {
|
|
997
|
-
if (!Object.is(source[i], target[i]))
|
|
998
|
-
return target;
|
|
999
|
-
}
|
|
1000
|
-
return source;
|
|
1001
|
-
}
|
|
1002
|
-
$.$mol_conform_array = $mol_conform_array;
|
|
1003
|
-
$mol_conform_handler(Array, $mol_conform_array);
|
|
1004
|
-
$mol_conform_handler(Uint8Array, $mol_conform_array);
|
|
1005
|
-
$mol_conform_handler(Uint16Array, $mol_conform_array);
|
|
1006
|
-
$mol_conform_handler(Uint32Array, $mol_conform_array);
|
|
1007
|
-
$mol_conform_handler(({})['constructor'], (target, source) => {
|
|
1008
|
-
let count = 0;
|
|
1009
|
-
let equal = true;
|
|
1010
|
-
for (let key in target) {
|
|
1011
|
-
const conformed = $mol_conform(target[key], source[key]);
|
|
1012
|
-
if (conformed !== target[key]) {
|
|
1013
|
-
try {
|
|
1014
|
-
target[key] = conformed;
|
|
1015
|
-
}
|
|
1016
|
-
catch (error) { }
|
|
1017
|
-
if (!Object.is(conformed, target[key]))
|
|
1018
|
-
equal = false;
|
|
1019
|
-
}
|
|
1020
|
-
if (!Object.is(conformed, source[key]))
|
|
1021
|
-
equal = false;
|
|
1022
|
-
++count;
|
|
1010
|
+
left_cache.set(right, result);
|
|
1023
1011
|
}
|
|
1024
|
-
|
|
1025
|
-
|
|
1012
|
+
return result;
|
|
1013
|
+
}
|
|
1014
|
+
$.$mol_compare_deep = $mol_compare_deep;
|
|
1015
|
+
function compare_array(left, right) {
|
|
1016
|
+
const len = left.length;
|
|
1017
|
+
if (len !== right.length)
|
|
1018
|
+
return false;
|
|
1019
|
+
for (let i = 0; i < len; ++i) {
|
|
1020
|
+
if (!$mol_compare_deep(left[i], right[i]))
|
|
1021
|
+
return false;
|
|
1022
|
+
}
|
|
1023
|
+
return true;
|
|
1024
|
+
}
|
|
1025
|
+
function compare_buffer(left, right) {
|
|
1026
|
+
const len = left.byteLength;
|
|
1027
|
+
if (len !== right.byteLength)
|
|
1028
|
+
return false;
|
|
1029
|
+
for (let i = 0; i < len; ++i) {
|
|
1030
|
+
if (left[i] !== right[i])
|
|
1031
|
+
return false;
|
|
1032
|
+
}
|
|
1033
|
+
return true;
|
|
1034
|
+
}
|
|
1035
|
+
function compare_iterator(left, right, compare) {
|
|
1036
|
+
while (true) {
|
|
1037
|
+
const left_next = left.next();
|
|
1038
|
+
const right_next = right.next();
|
|
1039
|
+
if (left_next.done !== right_next.done)
|
|
1040
|
+
return false;
|
|
1041
|
+
if (left_next.done)
|
|
1026
1042
|
break;
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1043
|
+
if (!compare(left_next.value, right_next.value))
|
|
1044
|
+
return false;
|
|
1045
|
+
}
|
|
1046
|
+
return true;
|
|
1047
|
+
}
|
|
1048
|
+
function compare_set(left, right) {
|
|
1049
|
+
if (left.size !== right.size)
|
|
1050
|
+
return false;
|
|
1051
|
+
return compare_iterator(left.values(), right.values(), $mol_compare_deep);
|
|
1052
|
+
}
|
|
1053
|
+
function compare_map(left, right) {
|
|
1054
|
+
if (left.size !== right.size)
|
|
1055
|
+
return false;
|
|
1056
|
+
return compare_iterator(left.keys(), right.keys(), Object.is)
|
|
1057
|
+
&& compare_iterator(left.values(), right.values(), $mol_compare_deep);
|
|
1058
|
+
}
|
|
1059
|
+
function compare_pojo(left, right) {
|
|
1060
|
+
const left_keys = Object.getOwnPropertyNames(left);
|
|
1061
|
+
const right_keys = Object.getOwnPropertyNames(right);
|
|
1062
|
+
if (left_keys.length !== right_keys.length)
|
|
1063
|
+
return false;
|
|
1064
|
+
for (let key of left_keys) {
|
|
1065
|
+
if (!$mol_compare_deep(left[key], Reflect.get(right, key)))
|
|
1066
|
+
return false;
|
|
1067
|
+
}
|
|
1068
|
+
return true;
|
|
1069
|
+
}
|
|
1070
|
+
function compare_primitive(left, right) {
|
|
1071
|
+
return Object.is(left[Symbol.toPrimitive]('default'), right[Symbol.toPrimitive]('default'));
|
|
1072
|
+
}
|
|
1039
1073
|
})($ || ($ = {}));
|
|
1040
|
-
//
|
|
1074
|
+
//deep.js.map
|
|
1041
1075
|
;
|
|
1042
1076
|
"use strict";
|
|
1043
1077
|
var $;
|
|
@@ -1364,8 +1398,7 @@ var $;
|
|
|
1364
1398
|
}
|
|
1365
1399
|
}
|
|
1366
1400
|
push(value) {
|
|
1367
|
-
|
|
1368
|
-
if (this.error !== null || !Object.is(this.value, value)) {
|
|
1401
|
+
if (this.error !== null || !$.$mol_compare_deep(this.value, value)) {
|
|
1369
1402
|
if ($mol_fiber.logs)
|
|
1370
1403
|
this.$.$mol_log3_done({
|
|
1371
1404
|
place: this,
|
|
@@ -3280,11 +3313,21 @@ var $;
|
|
|
3280
3313
|
return val;
|
|
3281
3314
|
return null;
|
|
3282
3315
|
}
|
|
3316
|
+
draw_start(event) {
|
|
3317
|
+
if (event !== undefined)
|
|
3318
|
+
return event;
|
|
3319
|
+
return null;
|
|
3320
|
+
}
|
|
3283
3321
|
draw(event) {
|
|
3284
3322
|
if (event !== undefined)
|
|
3285
3323
|
return event;
|
|
3286
3324
|
return null;
|
|
3287
3325
|
}
|
|
3326
|
+
draw_end(event) {
|
|
3327
|
+
if (event !== undefined)
|
|
3328
|
+
return event;
|
|
3329
|
+
return null;
|
|
3330
|
+
}
|
|
3288
3331
|
style() {
|
|
3289
3332
|
return {
|
|
3290
3333
|
...super.style(),
|
|
@@ -3298,7 +3341,7 @@ var $;
|
|
|
3298
3341
|
pointerdown: (event) => this.event_start(event),
|
|
3299
3342
|
pointermove: (event) => this.event_move(event),
|
|
3300
3343
|
pointerup: (event) => this.event_end(event),
|
|
3301
|
-
pointerleave: (event) => this.
|
|
3344
|
+
pointerleave: (event) => this.event_leave(event),
|
|
3302
3345
|
wheel: (event) => this.event_wheel(event)
|
|
3303
3346
|
};
|
|
3304
3347
|
}
|
|
@@ -3317,6 +3360,11 @@ var $;
|
|
|
3317
3360
|
return event;
|
|
3318
3361
|
return null;
|
|
3319
3362
|
}
|
|
3363
|
+
event_leave(event) {
|
|
3364
|
+
if (event !== undefined)
|
|
3365
|
+
return event;
|
|
3366
|
+
return null;
|
|
3367
|
+
}
|
|
3320
3368
|
event_wheel(event) {
|
|
3321
3369
|
if (event !== undefined)
|
|
3322
3370
|
return event;
|
|
@@ -3386,9 +3434,15 @@ var $;
|
|
|
3386
3434
|
__decorate([
|
|
3387
3435
|
$.$mol_mem
|
|
3388
3436
|
], $mol_touch.prototype, "swipe_to_top", null);
|
|
3437
|
+
__decorate([
|
|
3438
|
+
$.$mol_mem
|
|
3439
|
+
], $mol_touch.prototype, "draw_start", null);
|
|
3389
3440
|
__decorate([
|
|
3390
3441
|
$.$mol_mem
|
|
3391
3442
|
], $mol_touch.prototype, "draw", null);
|
|
3443
|
+
__decorate([
|
|
3444
|
+
$.$mol_mem
|
|
3445
|
+
], $mol_touch.prototype, "draw_end", null);
|
|
3392
3446
|
__decorate([
|
|
3393
3447
|
$.$mol_mem
|
|
3394
3448
|
], $mol_touch.prototype, "event_start", null);
|
|
@@ -3398,6 +3452,9 @@ var $;
|
|
|
3398
3452
|
__decorate([
|
|
3399
3453
|
$.$mol_mem
|
|
3400
3454
|
], $mol_touch.prototype, "event_end", null);
|
|
3455
|
+
__decorate([
|
|
3456
|
+
$.$mol_mem
|
|
3457
|
+
], $mol_touch.prototype, "event_leave", null);
|
|
3401
3458
|
__decorate([
|
|
3402
3459
|
$.$mol_mem
|
|
3403
3460
|
], $mol_touch.prototype, "event_wheel", null);
|
|
@@ -3444,10 +3501,14 @@ var $;
|
|
|
3444
3501
|
event_eat(event) {
|
|
3445
3502
|
if (event instanceof PointerEvent) {
|
|
3446
3503
|
const events = this.pointer_events().filter(e => e.pointerId !== event.pointerId);
|
|
3447
|
-
if (event.type !== 'pointerleave')
|
|
3504
|
+
if (event.type !== 'pointerup' && event.type !== 'pointerleave')
|
|
3448
3505
|
events.push(event);
|
|
3449
3506
|
this.pointer_events(events);
|
|
3450
|
-
|
|
3507
|
+
const touch_count = events.filter(e => e.pointerType === 'touch').length;
|
|
3508
|
+
if (this.allow_zoom() && touch_count === 2) {
|
|
3509
|
+
return this.action_type('zoom');
|
|
3510
|
+
}
|
|
3511
|
+
if (this.action_type() === 'zoom' && touch_count === 1) {
|
|
3451
3512
|
return this.action_type('zoom');
|
|
3452
3513
|
}
|
|
3453
3514
|
let button;
|
|
@@ -3480,10 +3541,12 @@ var $;
|
|
|
3480
3541
|
const action_type = this.event_eat(event);
|
|
3481
3542
|
if (!action_type)
|
|
3482
3543
|
return;
|
|
3483
|
-
if (action_type === 'draw')
|
|
3484
|
-
return;
|
|
3485
3544
|
const coords = this.pointer_coords();
|
|
3486
3545
|
this.start_pos(coords.center());
|
|
3546
|
+
if (action_type === 'draw') {
|
|
3547
|
+
this.draw_start(event);
|
|
3548
|
+
return;
|
|
3549
|
+
}
|
|
3487
3550
|
this.start_distance(coords.distance());
|
|
3488
3551
|
this.start_zoom(this.zoom());
|
|
3489
3552
|
}
|
|
@@ -3495,14 +3558,17 @@ var $;
|
|
|
3495
3558
|
return;
|
|
3496
3559
|
const start_pan = this.start_pan();
|
|
3497
3560
|
const action_type = this.event_eat(event);
|
|
3561
|
+
const start_pos = this.start_pos();
|
|
3498
3562
|
let pos = this.pointer_center();
|
|
3499
3563
|
if (!action_type)
|
|
3500
3564
|
return;
|
|
3501
3565
|
if (action_type === 'draw') {
|
|
3502
|
-
|
|
3566
|
+
const distance = new $.$mol_vector(start_pos, pos).distance();
|
|
3567
|
+
if (distance >= 4) {
|
|
3568
|
+
this.draw(event);
|
|
3569
|
+
}
|
|
3503
3570
|
return;
|
|
3504
3571
|
}
|
|
3505
|
-
const start_pos = this.start_pos();
|
|
3506
3572
|
if (!start_pos)
|
|
3507
3573
|
return;
|
|
3508
3574
|
if (action_type === 'pan') {
|
|
@@ -3551,12 +3617,15 @@ var $;
|
|
|
3551
3617
|
}
|
|
3552
3618
|
}
|
|
3553
3619
|
event_end(event) {
|
|
3620
|
+
const action = this.action_type();
|
|
3621
|
+
if (action === 'draw') {
|
|
3622
|
+
this.draw_end(event);
|
|
3623
|
+
}
|
|
3624
|
+
this.event_leave(event);
|
|
3625
|
+
}
|
|
3626
|
+
event_leave(event) {
|
|
3554
3627
|
this.event_eat(event);
|
|
3555
3628
|
this.dom_node().releasePointerCapture(event.pointerId);
|
|
3556
|
-
if (!this.start_pos()) {
|
|
3557
|
-
this.draw(event);
|
|
3558
|
-
return;
|
|
3559
|
-
}
|
|
3560
3629
|
this.start_pos(null);
|
|
3561
3630
|
}
|
|
3562
3631
|
swipe_left(event) {
|
|
@@ -3799,11 +3868,21 @@ var $;
|
|
|
3799
3868
|
allow_zoom() {
|
|
3800
3869
|
return true;
|
|
3801
3870
|
}
|
|
3871
|
+
draw_start(event) {
|
|
3872
|
+
if (event !== undefined)
|
|
3873
|
+
return event;
|
|
3874
|
+
return null;
|
|
3875
|
+
}
|
|
3802
3876
|
draw(event) {
|
|
3803
3877
|
if (event !== undefined)
|
|
3804
3878
|
return event;
|
|
3805
3879
|
return null;
|
|
3806
3880
|
}
|
|
3881
|
+
draw_end(event) {
|
|
3882
|
+
if (event !== undefined)
|
|
3883
|
+
return event;
|
|
3884
|
+
return null;
|
|
3885
|
+
}
|
|
3807
3886
|
cursor_position() {
|
|
3808
3887
|
return this.Touch().pointer_center();
|
|
3809
3888
|
}
|
|
@@ -3820,7 +3899,9 @@ var $;
|
|
|
3820
3899
|
obj.allow_draw = () => this.allow_draw();
|
|
3821
3900
|
obj.allow_pan = () => this.allow_pan();
|
|
3822
3901
|
obj.allow_zoom = () => this.allow_zoom();
|
|
3902
|
+
obj.draw_start = (event) => this.draw_start(event);
|
|
3823
3903
|
obj.draw = (event) => this.draw(event);
|
|
3904
|
+
obj.draw_end = (event) => this.draw_end(event);
|
|
3824
3905
|
return obj;
|
|
3825
3906
|
}
|
|
3826
3907
|
}
|
|
@@ -3902,9 +3983,15 @@ var $;
|
|
|
3902
3983
|
__decorate([
|
|
3903
3984
|
$.$mol_mem
|
|
3904
3985
|
], $mol_plot_pane.prototype, "zoom", null);
|
|
3986
|
+
__decorate([
|
|
3987
|
+
$.$mol_mem
|
|
3988
|
+
], $mol_plot_pane.prototype, "draw_start", null);
|
|
3905
3989
|
__decorate([
|
|
3906
3990
|
$.$mol_mem
|
|
3907
3991
|
], $mol_plot_pane.prototype, "draw", null);
|
|
3992
|
+
__decorate([
|
|
3993
|
+
$.$mol_mem
|
|
3994
|
+
], $mol_plot_pane.prototype, "draw_end", null);
|
|
3908
3995
|
__decorate([
|
|
3909
3996
|
$.$mol_mem
|
|
3910
3997
|
], $mol_plot_pane.prototype, "Touch", null);
|
|
@@ -6100,23 +6187,16 @@ var $;
|
|
|
6100
6187
|
$.$mol_assert_ok($.$mol_compare_deep(1, 1));
|
|
6101
6188
|
$.$mol_assert_ok($.$mol_compare_deep(Number.NaN, Number.NaN));
|
|
6102
6189
|
$.$mol_assert_not($.$mol_compare_deep(1, 2));
|
|
6103
|
-
},
|
|
6104
|
-
'Number'() {
|
|
6105
6190
|
$.$mol_assert_ok($.$mol_compare_deep(Object(1), Object(1)));
|
|
6106
|
-
$.$mol_assert_ok($.$mol_compare_deep(Object(Number.NaN), Object(Number.NaN)));
|
|
6107
6191
|
$.$mol_assert_not($.$mol_compare_deep(Object(1), Object(2)));
|
|
6108
6192
|
},
|
|
6109
|
-
'
|
|
6193
|
+
'POJO'() {
|
|
6110
6194
|
$.$mol_assert_ok($.$mol_compare_deep({}, {}));
|
|
6111
|
-
},
|
|
6112
|
-
'different POJOs'() {
|
|
6113
6195
|
$.$mol_assert_not($.$mol_compare_deep({ a: 1 }, { b: 2 }));
|
|
6114
|
-
},
|
|
6115
|
-
'different POJOs with same keys but different values'() {
|
|
6116
6196
|
$.$mol_assert_not($.$mol_compare_deep({ a: 1 }, { a: 2 }));
|
|
6117
|
-
},
|
|
6118
|
-
'different POJOs with different keys but same values'() {
|
|
6119
6197
|
$.$mol_assert_not($.$mol_compare_deep({}, { a: undefined }));
|
|
6198
|
+
$.$mol_assert_ok($.$mol_compare_deep({ a: 1, b: 2 }, { b: 2, a: 1 }));
|
|
6199
|
+
$.$mol_assert_ok($.$mol_compare_deep({ a: { b: 1 } }, { a: { b: 1 } }));
|
|
6120
6200
|
},
|
|
6121
6201
|
'Array'() {
|
|
6122
6202
|
$.$mol_assert_ok($.$mol_compare_deep([], []));
|
|
@@ -6124,17 +6204,12 @@ var $;
|
|
|
6124
6204
|
$.$mol_assert_not($.$mol_compare_deep([1, 2], [1, 3]));
|
|
6125
6205
|
$.$mol_assert_not($.$mol_compare_deep([1, 2,], [1, 3, undefined]));
|
|
6126
6206
|
},
|
|
6127
|
-
'
|
|
6128
|
-
|
|
6129
|
-
},
|
|
6130
|
-
'different classes with same values'() {
|
|
6131
|
-
class Obj {
|
|
6132
|
-
foo = 1;
|
|
6207
|
+
'Non POJO are different'() {
|
|
6208
|
+
class Thing extends Object {
|
|
6133
6209
|
}
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
$.$mol_assert_not($.$mol_compare_deep(a, b));
|
|
6210
|
+
$.$mol_assert_not($.$mol_compare_deep(new Thing, new Thing));
|
|
6211
|
+
$.$mol_assert_not($.$mol_compare_deep(() => 1, () => 1));
|
|
6212
|
+
$.$mol_assert_not($.$mol_compare_deep(new RangeError('Test error'), new RangeError('Test error')));
|
|
6138
6213
|
},
|
|
6139
6214
|
'same POJOs with cyclic reference'() {
|
|
6140
6215
|
const a = { foo: {} };
|
|
@@ -6143,41 +6218,6 @@ var $;
|
|
|
6143
6218
|
b['self'] = b;
|
|
6144
6219
|
$.$mol_assert_ok($.$mol_compare_deep(a, b));
|
|
6145
6220
|
},
|
|
6146
|
-
'empty Element'() {
|
|
6147
|
-
$.$mol_assert_ok($.$mol_compare_deep($.$mol_jsx("div", null), $.$mol_jsx("div", null)));
|
|
6148
|
-
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", null), $.$mol_jsx("span", null)));
|
|
6149
|
-
},
|
|
6150
|
-
'Element with attributes'() {
|
|
6151
|
-
$.$mol_assert_ok($.$mol_compare_deep($.$mol_jsx("div", { dir: "rtl" }), $.$mol_jsx("div", { dir: "rtl" })));
|
|
6152
|
-
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", { dir: "rtl" }), $.$mol_jsx("div", null)));
|
|
6153
|
-
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", { dir: "rtl" }), $.$mol_jsx("div", { dir: "ltr" })));
|
|
6154
|
-
},
|
|
6155
|
-
'Element with styles'() {
|
|
6156
|
-
$.$mol_assert_ok($.$mol_compare_deep($.$mol_jsx("div", { style: { color: 'red' } }), $.$mol_jsx("div", { style: { color: 'red' } })));
|
|
6157
|
-
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", { style: { color: 'red' } }), $.$mol_jsx("div", { style: {} })));
|
|
6158
|
-
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", { style: { color: 'red' } }), $.$mol_jsx("div", { style: { color: 'blue' } })));
|
|
6159
|
-
},
|
|
6160
|
-
'Element with content'() {
|
|
6161
|
-
$.$mol_assert_ok($.$mol_compare_deep($.$mol_jsx("div", null,
|
|
6162
|
-
"foo",
|
|
6163
|
-
$.$mol_jsx("br", null)), $.$mol_jsx("div", null,
|
|
6164
|
-
"foo",
|
|
6165
|
-
$.$mol_jsx("br", null))));
|
|
6166
|
-
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", null,
|
|
6167
|
-
"foo",
|
|
6168
|
-
$.$mol_jsx("br", null)), $.$mol_jsx("div", null,
|
|
6169
|
-
"bar",
|
|
6170
|
-
$.$mol_jsx("br", null))));
|
|
6171
|
-
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", null,
|
|
6172
|
-
"foo",
|
|
6173
|
-
$.$mol_jsx("br", null)), $.$mol_jsx("div", null,
|
|
6174
|
-
"foo",
|
|
6175
|
-
$.$mol_jsx("hr", null))));
|
|
6176
|
-
},
|
|
6177
|
-
'Element with handlers'() {
|
|
6178
|
-
$.$mol_assert_ok($.$mol_compare_deep($.$mol_jsx("div", { onclick: () => 1 }), $.$mol_jsx("div", { onclick: () => 1 })));
|
|
6179
|
-
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", { onclick: () => 1 }), $.$mol_jsx("div", { onclick: () => 2 })));
|
|
6180
|
-
},
|
|
6181
6221
|
'Date'() {
|
|
6182
6222
|
$.$mol_assert_ok($.$mol_compare_deep(new Date(12345), new Date(12345)));
|
|
6183
6223
|
$.$mol_assert_not($.$mol_compare_deep(new Date(12345), new Date(12346)));
|
|
@@ -6189,8 +6229,9 @@ var $;
|
|
|
6189
6229
|
},
|
|
6190
6230
|
'Map'() {
|
|
6191
6231
|
$.$mol_assert_ok($.$mol_compare_deep(new Map, new Map));
|
|
6192
|
-
$.$mol_assert_ok($.$mol_compare_deep(new Map([[
|
|
6232
|
+
$.$mol_assert_ok($.$mol_compare_deep(new Map([[1, [2]]]), new Map([[1, [2]]])));
|
|
6193
6233
|
$.$mol_assert_not($.$mol_compare_deep(new Map([[1, 2]]), new Map([[1, 3]])));
|
|
6234
|
+
$.$mol_assert_not($.$mol_compare_deep(new Map([[[1], 2]]), new Map([[[1], 2]])));
|
|
6194
6235
|
},
|
|
6195
6236
|
'Set'() {
|
|
6196
6237
|
$.$mol_assert_ok($.$mol_compare_deep(new Set, new Set));
|
|
@@ -6202,106 +6243,24 @@ var $;
|
|
|
6202
6243
|
$.$mol_assert_ok($.$mol_compare_deep(new Uint8Array([0]), new Uint8Array([0])));
|
|
6203
6244
|
$.$mol_assert_not($.$mol_compare_deep(new Uint8Array([0]), new Uint8Array([1])));
|
|
6204
6245
|
},
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
;
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6212
|
-
const a_stack = [];
|
|
6213
|
-
const b_stack = [];
|
|
6214
|
-
let cache = null;
|
|
6215
|
-
function $mol_compare_deep(a, b) {
|
|
6216
|
-
if (Object.is(a, b))
|
|
6217
|
-
return true;
|
|
6218
|
-
const a_type = typeof a;
|
|
6219
|
-
const b_type = typeof b;
|
|
6220
|
-
if (a_type !== b_type)
|
|
6221
|
-
return false;
|
|
6222
|
-
if (a_type === 'function')
|
|
6223
|
-
return a['toString']() === b['toString']();
|
|
6224
|
-
if (a_type !== 'object')
|
|
6225
|
-
return false;
|
|
6226
|
-
if (!a || !b)
|
|
6227
|
-
return false;
|
|
6228
|
-
if (a instanceof Error)
|
|
6229
|
-
return false;
|
|
6230
|
-
if (a['constructor'] !== b['constructor'])
|
|
6231
|
-
return false;
|
|
6232
|
-
if (a instanceof RegExp)
|
|
6233
|
-
return a.toString() === b['toString']();
|
|
6234
|
-
const ref = a_stack.indexOf(a);
|
|
6235
|
-
if (ref >= 0) {
|
|
6236
|
-
return Object.is(b_stack[ref], b);
|
|
6237
|
-
}
|
|
6238
|
-
if (!cache)
|
|
6239
|
-
cache = new WeakMap;
|
|
6240
|
-
let a_cache = cache.get(a);
|
|
6241
|
-
if (a_cache) {
|
|
6242
|
-
const b_cache = a_cache.get(b);
|
|
6243
|
-
if (typeof b_cache === 'boolean')
|
|
6244
|
-
return b_cache;
|
|
6245
|
-
}
|
|
6246
|
-
else {
|
|
6247
|
-
a_cache = new WeakMap();
|
|
6248
|
-
cache.set(a, a_cache);
|
|
6249
|
-
}
|
|
6250
|
-
a_stack.push(a);
|
|
6251
|
-
b_stack.push(b);
|
|
6252
|
-
let result;
|
|
6253
|
-
try {
|
|
6254
|
-
if (Symbol.iterator in a) {
|
|
6255
|
-
const a_iter = a[Symbol.iterator]();
|
|
6256
|
-
const b_iter = b[Symbol.iterator]();
|
|
6257
|
-
while (true) {
|
|
6258
|
-
const a_next = a_iter.next();
|
|
6259
|
-
const b_next = b_iter.next();
|
|
6260
|
-
if (a_next.done !== b_next.done)
|
|
6261
|
-
return result = false;
|
|
6262
|
-
if (a_next.done)
|
|
6263
|
-
break;
|
|
6264
|
-
if (!$mol_compare_deep(a_next.value, b_next.value))
|
|
6265
|
-
return result = false;
|
|
6266
|
-
}
|
|
6267
|
-
return result = true;
|
|
6268
|
-
}
|
|
6269
|
-
let count = 0;
|
|
6270
|
-
for (let key in a) {
|
|
6271
|
-
try {
|
|
6272
|
-
if (!$mol_compare_deep(a[key], b[key]))
|
|
6273
|
-
return result = false;
|
|
6246
|
+
'Custom comparator'() {
|
|
6247
|
+
class User {
|
|
6248
|
+
name;
|
|
6249
|
+
rand;
|
|
6250
|
+
constructor(name, rand = Math.random()) {
|
|
6251
|
+
this.name = name;
|
|
6252
|
+
this.rand = rand;
|
|
6274
6253
|
}
|
|
6275
|
-
|
|
6276
|
-
|
|
6254
|
+
[Symbol.toPrimitive](mode) {
|
|
6255
|
+
return this.name;
|
|
6277
6256
|
}
|
|
6278
|
-
++count;
|
|
6279
|
-
}
|
|
6280
|
-
for (let key in b) {
|
|
6281
|
-
--count;
|
|
6282
|
-
if (count < 0)
|
|
6283
|
-
return result = false;
|
|
6284
6257
|
}
|
|
6285
|
-
|
|
6286
|
-
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
return result = true;
|
|
6290
|
-
}
|
|
6291
|
-
finally {
|
|
6292
|
-
a_stack.pop();
|
|
6293
|
-
b_stack.pop();
|
|
6294
|
-
if (a_stack.length === 0) {
|
|
6295
|
-
cache = null;
|
|
6296
|
-
}
|
|
6297
|
-
else {
|
|
6298
|
-
a_cache.set(b, result);
|
|
6299
|
-
}
|
|
6300
|
-
}
|
|
6301
|
-
}
|
|
6302
|
-
$.$mol_compare_deep = $mol_compare_deep;
|
|
6258
|
+
$.$mol_assert_ok($.$mol_compare_deep(new User('Jin'), new User('Jin')));
|
|
6259
|
+
$.$mol_assert_not($.$mol_compare_deep(new User('Jin'), new User('John')));
|
|
6260
|
+
},
|
|
6261
|
+
});
|
|
6303
6262
|
})($ || ($ = {}));
|
|
6304
|
-
//deep.js.map
|
|
6263
|
+
//deep.test.js.map
|
|
6305
6264
|
;
|
|
6306
6265
|
"use strict";
|
|
6307
6266
|
var $;
|
|
@@ -6709,129 +6668,6 @@ var $;
|
|
|
6709
6668
|
;
|
|
6710
6669
|
"use strict";
|
|
6711
6670
|
var $;
|
|
6712
|
-
(function ($) {
|
|
6713
|
-
$.$mol_test({
|
|
6714
|
-
'return source when same object'() {
|
|
6715
|
-
const target = {};
|
|
6716
|
-
$.$mol_assert_equal($.$mol_conform(target, target), target);
|
|
6717
|
-
},
|
|
6718
|
-
'return target when some is not object'() {
|
|
6719
|
-
const obj = { a: 1 };
|
|
6720
|
-
$.$mol_assert_equal($.$mol_conform(true, obj), true);
|
|
6721
|
-
$.$mol_assert_equal($.$mol_conform(obj, true), obj);
|
|
6722
|
-
},
|
|
6723
|
-
'return target when some is null'() {
|
|
6724
|
-
const obj = { a: 1 };
|
|
6725
|
-
$.$mol_assert_equal($.$mol_conform(null, obj), null);
|
|
6726
|
-
$.$mol_assert_equal($.$mol_conform(obj, null), obj);
|
|
6727
|
-
},
|
|
6728
|
-
'return target when some is undefined'() {
|
|
6729
|
-
const obj = { a: 1 };
|
|
6730
|
-
$.$mol_assert_equal($.$mol_conform(undefined, obj), undefined);
|
|
6731
|
-
$.$mol_assert_equal($.$mol_conform(obj, undefined), obj);
|
|
6732
|
-
},
|
|
6733
|
-
'return target when different keys count'() {
|
|
6734
|
-
const target = [1, 2, 3];
|
|
6735
|
-
const source = [1, 2, 3, undefined];
|
|
6736
|
-
const result = $.$mol_conform(target, source);
|
|
6737
|
-
$.$mol_assert_equal(result, target);
|
|
6738
|
-
$.$mol_assert_equal(result.join(','), '1,2,3');
|
|
6739
|
-
},
|
|
6740
|
-
'return source when array values are strong equal'() {
|
|
6741
|
-
const source = [1, 2, 3];
|
|
6742
|
-
$.$mol_assert_equal($.$mol_conform([1, 2, 3], source), source);
|
|
6743
|
-
},
|
|
6744
|
-
'return source when object values are strong equal'() {
|
|
6745
|
-
const source = { a: 1, b: 2 };
|
|
6746
|
-
$.$mol_assert_equal($.$mol_conform({ a: 1, b: 2 }, source), source);
|
|
6747
|
-
},
|
|
6748
|
-
'return target when some values are not equal'() {
|
|
6749
|
-
const target = [1, 2, 3];
|
|
6750
|
-
const source = [1, 2, 5];
|
|
6751
|
-
const result = $.$mol_conform(target, source);
|
|
6752
|
-
$.$mol_assert_equal(result, target);
|
|
6753
|
-
$.$mol_assert_equal(result.join(','), '1,2,3');
|
|
6754
|
-
},
|
|
6755
|
-
'return source when values are deep equal'() {
|
|
6756
|
-
const source = { foo: { bar: 1 } };
|
|
6757
|
-
$.$mol_assert_equal($.$mol_conform({ foo: { bar: 1 } }, source), source);
|
|
6758
|
-
},
|
|
6759
|
-
'return target with equal values from source and not equal from target'() {
|
|
6760
|
-
const source = { foo: { xxx: 1 }, bar: { xxx: 2 } };
|
|
6761
|
-
const target = { foo: { xxx: 1 }, bar: { xxx: 3 } };
|
|
6762
|
-
const result = $.$mol_conform(target, source);
|
|
6763
|
-
$.$mol_assert_equal(result, target);
|
|
6764
|
-
$.$mol_assert_equal(result.foo, source.foo);
|
|
6765
|
-
$.$mol_assert_equal(result.bar, target.bar);
|
|
6766
|
-
},
|
|
6767
|
-
'return target when equal but with different class'() {
|
|
6768
|
-
const target = { '0': 1 };
|
|
6769
|
-
$.$mol_assert_equal($.$mol_conform(target, [1]), target);
|
|
6770
|
-
},
|
|
6771
|
-
'return target when conformer for class is not defined'() {
|
|
6772
|
-
const Obj = class {
|
|
6773
|
-
};
|
|
6774
|
-
const source = new Obj;
|
|
6775
|
-
const target = new Obj;
|
|
6776
|
-
const result = $.$mol_conform(target, source);
|
|
6777
|
-
$.$mol_assert_equal(result, target);
|
|
6778
|
-
},
|
|
6779
|
-
'return target when has cyclic reference'() {
|
|
6780
|
-
const source = { foo: {} };
|
|
6781
|
-
source['self'] = source;
|
|
6782
|
-
const target = { foo: {} };
|
|
6783
|
-
target['self'] = target;
|
|
6784
|
-
const result = $.$mol_conform(target, source);
|
|
6785
|
-
$.$mol_assert_equal(result, target);
|
|
6786
|
-
$.$mol_assert_equal(result['self'], target);
|
|
6787
|
-
$.$mol_assert_equal(result.foo, source.foo);
|
|
6788
|
-
},
|
|
6789
|
-
'return source when equal dates'() {
|
|
6790
|
-
const source = new Date(12345);
|
|
6791
|
-
const target = new Date(12345);
|
|
6792
|
-
const result = $.$mol_conform(target, source);
|
|
6793
|
-
$.$mol_assert_equal(result, source);
|
|
6794
|
-
},
|
|
6795
|
-
'return source when equal regular expressions'() {
|
|
6796
|
-
const source = /\x22/mig;
|
|
6797
|
-
const target = /\x22/mig;
|
|
6798
|
-
const result = $.$mol_conform(target, source);
|
|
6799
|
-
$.$mol_assert_equal(result, source);
|
|
6800
|
-
},
|
|
6801
|
-
'return cached value if already conformed'() {
|
|
6802
|
-
const source = { foo: { xxx: 1 }, bar: { xxx: 3 } };
|
|
6803
|
-
const target = { foo: { xxx: 2 }, bar: { xxx: 3 } };
|
|
6804
|
-
const result = $.$mol_conform(target, source);
|
|
6805
|
-
target.foo.xxx = 1;
|
|
6806
|
-
$.$mol_assert_equal($.$mol_conform(target.foo, source.foo), target.foo);
|
|
6807
|
-
},
|
|
6808
|
-
'skip readlony fields'() {
|
|
6809
|
-
const source = { foo: {}, bar: {} };
|
|
6810
|
-
const target = { foo: {}, bar: {} };
|
|
6811
|
-
Object.defineProperty(target, 'bar', { value: {}, writable: false });
|
|
6812
|
-
const result = $.$mol_conform(target, source);
|
|
6813
|
-
$.$mol_assert_equal(result, target);
|
|
6814
|
-
$.$mol_assert_equal(result.foo, source.foo);
|
|
6815
|
-
$.$mol_assert_equal(result.bar, target.bar);
|
|
6816
|
-
},
|
|
6817
|
-
'object with NaN'() {
|
|
6818
|
-
const source = { foo: Number.NaN };
|
|
6819
|
-
const target = { foo: Number.NaN };
|
|
6820
|
-
const result = $.$mol_conform(target, source);
|
|
6821
|
-
$.$mol_assert_equal(result, source);
|
|
6822
|
-
},
|
|
6823
|
-
'array with NaN'() {
|
|
6824
|
-
const source = [Number.NaN];
|
|
6825
|
-
const target = [Number.NaN];
|
|
6826
|
-
const result = $.$mol_conform(target, source);
|
|
6827
|
-
$.$mol_assert_equal(result, source);
|
|
6828
|
-
},
|
|
6829
|
-
});
|
|
6830
|
-
})($ || ($ = {}));
|
|
6831
|
-
//conform.test.js.map
|
|
6832
|
-
;
|
|
6833
|
-
"use strict";
|
|
6834
|
-
var $;
|
|
6835
6671
|
(function ($) {
|
|
6836
6672
|
$.$mol_test({
|
|
6837
6673
|
'trim array'() {
|
|
@@ -7474,92 +7310,6 @@ var $;
|
|
|
7474
7310
|
;
|
|
7475
7311
|
"use strict";
|
|
7476
7312
|
var $;
|
|
7477
|
-
(function ($) {
|
|
7478
|
-
$.$mol_test({
|
|
7479
|
-
'equal paths'() {
|
|
7480
|
-
const diff = $.$mol_diff_path([1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4]);
|
|
7481
|
-
$.$mol_assert_like(diff, {
|
|
7482
|
-
prefix: [1, 2, 3, 4],
|
|
7483
|
-
suffix: [[], [], []],
|
|
7484
|
-
});
|
|
7485
|
-
},
|
|
7486
|
-
'different suffix'() {
|
|
7487
|
-
const diff = $.$mol_diff_path([1, 2, 3, 4], [1, 2, 3, 5], [1, 2, 5, 4]);
|
|
7488
|
-
$.$mol_assert_like(diff, {
|
|
7489
|
-
prefix: [1, 2],
|
|
7490
|
-
suffix: [[3, 4], [3, 5], [5, 4]],
|
|
7491
|
-
});
|
|
7492
|
-
},
|
|
7493
|
-
'one contains other'() {
|
|
7494
|
-
const diff = $.$mol_diff_path([1, 2, 3, 4], [1, 2], [1, 2, 3]);
|
|
7495
|
-
$.$mol_assert_like(diff, {
|
|
7496
|
-
prefix: [1, 2],
|
|
7497
|
-
suffix: [[3, 4], [], [3]],
|
|
7498
|
-
});
|
|
7499
|
-
},
|
|
7500
|
-
'fully different'() {
|
|
7501
|
-
const diff = $.$mol_diff_path([1, 2], [3, 4], [5, 6]);
|
|
7502
|
-
$.$mol_assert_like(diff, {
|
|
7503
|
-
prefix: [],
|
|
7504
|
-
suffix: [[1, 2], [3, 4], [5, 6]],
|
|
7505
|
-
});
|
|
7506
|
-
},
|
|
7507
|
-
});
|
|
7508
|
-
})($ || ($ = {}));
|
|
7509
|
-
//path.test.js.map
|
|
7510
|
-
;
|
|
7511
|
-
"use strict";
|
|
7512
|
-
var $;
|
|
7513
|
-
(function ($) {
|
|
7514
|
-
function $mol_diff_path(...paths) {
|
|
7515
|
-
const limit = Math.min(...paths.map(path => path.length));
|
|
7516
|
-
lookup: for (var i = 0; i < limit; ++i) {
|
|
7517
|
-
const first = paths[0][i];
|
|
7518
|
-
for (let j = 1; j < paths.length; ++j) {
|
|
7519
|
-
if (paths[j][i] !== first)
|
|
7520
|
-
break lookup;
|
|
7521
|
-
}
|
|
7522
|
-
}
|
|
7523
|
-
return {
|
|
7524
|
-
prefix: paths[0].slice(0, i),
|
|
7525
|
-
suffix: paths.map(path => path.slice(i)),
|
|
7526
|
-
};
|
|
7527
|
-
}
|
|
7528
|
-
$.$mol_diff_path = $mol_diff_path;
|
|
7529
|
-
})($ || ($ = {}));
|
|
7530
|
-
//path.js.map
|
|
7531
|
-
;
|
|
7532
|
-
"use strict";
|
|
7533
|
-
var $;
|
|
7534
|
-
(function ($) {
|
|
7535
|
-
class $mol_error_mix extends Error {
|
|
7536
|
-
errors;
|
|
7537
|
-
constructor(message, ...errors) {
|
|
7538
|
-
super(message);
|
|
7539
|
-
this.errors = errors;
|
|
7540
|
-
if (errors.length) {
|
|
7541
|
-
const stacks = [...errors.map(error => error.stack), this.stack];
|
|
7542
|
-
const diff = $.$mol_diff_path(...stacks.map(stack => {
|
|
7543
|
-
if (!stack)
|
|
7544
|
-
return [];
|
|
7545
|
-
return stack.split('\n').reverse();
|
|
7546
|
-
}));
|
|
7547
|
-
const head = diff.prefix.reverse().join('\n');
|
|
7548
|
-
const tails = diff.suffix.map(path => path.reverse().map(line => line.replace(/^(?!\s+at)/, '\tat (.) ')).join('\n')).join('\n\tat (.) -----\n');
|
|
7549
|
-
this.stack = `Error: ${this.constructor.name}\n\tat (.) /"""\\\n${tails}\n\tat (.) \\___/\n${head}`;
|
|
7550
|
-
this.message += errors.map(error => '\n' + error.message).join('');
|
|
7551
|
-
}
|
|
7552
|
-
}
|
|
7553
|
-
toJSON() {
|
|
7554
|
-
return this.message;
|
|
7555
|
-
}
|
|
7556
|
-
}
|
|
7557
|
-
$.$mol_error_mix = $mol_error_mix;
|
|
7558
|
-
})($ || ($ = {}));
|
|
7559
|
-
//mix.js.map
|
|
7560
|
-
;
|
|
7561
|
-
"use strict";
|
|
7562
|
-
var $;
|
|
7563
7313
|
(function ($) {
|
|
7564
7314
|
class $mol_view_tree_test_attributes_super extends $.$mol_view {
|
|
7565
7315
|
some() {
|