mol_plot_all 1.2.128 → 1.2.132
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 -14
- package/node.deps.json +1 -1
- package/node.esm.js +145 -104
- package/node.esm.js.map +1 -1
- package/node.js +145 -104
- package/node.js.map +1 -1
- package/node.test.js +172 -468
- package/node.test.js.map +1 -1
- package/node.view.tree +6 -1
- package/package.json +1 -1
- package/web.d.ts +7 -14
- package/web.deps.json +1 -1
- package/web.esm.js +145 -104
- package/web.esm.js.map +1 -1
- package/web.js +145 -104
- package/web.js.map +1 -1
- package/web.test.js +24 -361
- package/web.test.js.map +1 -1
- package/web.view.tree +6 -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
|
-
|
|
988
|
-
$.$
|
|
989
|
-
function
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
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);
|
|
1011
|
+
}
|
|
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;
|
|
1023
1032
|
}
|
|
1024
|
-
|
|
1025
|
-
|
|
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,
|
|
@@ -3174,6 +3207,15 @@ var $;
|
|
|
3174
3207
|
return val;
|
|
3175
3208
|
return 1;
|
|
3176
3209
|
}
|
|
3210
|
+
allow_draw() {
|
|
3211
|
+
return true;
|
|
3212
|
+
}
|
|
3213
|
+
allow_pan() {
|
|
3214
|
+
return true;
|
|
3215
|
+
}
|
|
3216
|
+
allow_zoom() {
|
|
3217
|
+
return true;
|
|
3218
|
+
}
|
|
3177
3219
|
action_type(val) {
|
|
3178
3220
|
if (val !== undefined)
|
|
3179
3221
|
return val;
|
|
@@ -3290,8 +3332,7 @@ var $;
|
|
|
3290
3332
|
pointermove: (event) => this.event_move(event),
|
|
3291
3333
|
pointerup: (event) => this.event_end(event),
|
|
3292
3334
|
pointerleave: (event) => this.event_end(event),
|
|
3293
|
-
wheel: (event) => this.event_wheel(event)
|
|
3294
|
-
contextmenu: (event) => this.event_menu(event)
|
|
3335
|
+
wheel: (event) => this.event_wheel(event)
|
|
3295
3336
|
};
|
|
3296
3337
|
}
|
|
3297
3338
|
event_start(event) {
|
|
@@ -3314,11 +3355,6 @@ var $;
|
|
|
3314
3355
|
return event;
|
|
3315
3356
|
return null;
|
|
3316
3357
|
}
|
|
3317
|
-
event_menu(event) {
|
|
3318
|
-
if (event !== undefined)
|
|
3319
|
-
return event;
|
|
3320
|
-
return null;
|
|
3321
|
-
}
|
|
3322
3358
|
}
|
|
3323
3359
|
__decorate([
|
|
3324
3360
|
$.$mol_mem
|
|
@@ -3398,9 +3434,6 @@ var $;
|
|
|
3398
3434
|
__decorate([
|
|
3399
3435
|
$.$mol_mem
|
|
3400
3436
|
], $mol_touch.prototype, "event_wheel", null);
|
|
3401
|
-
__decorate([
|
|
3402
|
-
$.$mol_mem
|
|
3403
|
-
], $mol_touch.prototype, "event_menu", null);
|
|
3404
3437
|
$.$mol_touch = $mol_touch;
|
|
3405
3438
|
})($ || ($ = {}));
|
|
3406
3439
|
//touch.view.tree.js.map
|
|
@@ -3447,16 +3480,22 @@ var $;
|
|
|
3447
3480
|
if (event.type !== 'pointerleave')
|
|
3448
3481
|
events.push(event);
|
|
3449
3482
|
this.pointer_events(events);
|
|
3450
|
-
if (events.filter(e => e.pointerType === 'touch').length === 2) {
|
|
3483
|
+
if (this.allow_zoom() && events.filter(e => e.pointerType === 'touch').length === 2) {
|
|
3451
3484
|
return this.action_type('zoom');
|
|
3452
3485
|
}
|
|
3486
|
+
let button;
|
|
3487
|
+
(function (button) {
|
|
3488
|
+
button[button["left"] = 1] = "left";
|
|
3489
|
+
button[button["right"] = 2] = "right";
|
|
3490
|
+
button[button["middle"] = 4] = "middle";
|
|
3491
|
+
})(button || (button = {}));
|
|
3453
3492
|
if (events.length > 0) {
|
|
3454
|
-
if (event.ctrlKey)
|
|
3493
|
+
if (event.ctrlKey && this.allow_zoom())
|
|
3455
3494
|
return this.action_type('zoom');
|
|
3456
|
-
if (event.buttons ===
|
|
3457
|
-
return this.action_type('pan');
|
|
3458
|
-
if (event.buttons === 1)
|
|
3495
|
+
if (event.buttons === button.left && this.allow_draw())
|
|
3459
3496
|
return this.action_type('draw');
|
|
3497
|
+
if (event.buttons && this.allow_pan())
|
|
3498
|
+
return this.action_type('pan');
|
|
3460
3499
|
}
|
|
3461
3500
|
return this.action_type('');
|
|
3462
3501
|
}
|
|
@@ -3500,11 +3539,7 @@ var $;
|
|
|
3500
3539
|
if (!start_pos)
|
|
3501
3540
|
return;
|
|
3502
3541
|
if (action_type === 'pan') {
|
|
3503
|
-
|
|
3504
|
-
if (distance >= 4) {
|
|
3505
|
-
this._menu_mute = true;
|
|
3506
|
-
this.dom_node().setPointerCapture(event.pointerId);
|
|
3507
|
-
}
|
|
3542
|
+
this.dom_node().setPointerCapture(event.pointerId);
|
|
3508
3543
|
this.pan(new $.$mol_vector_2d(start_pan[0] + pos[0] - start_pos[0], start_pan[1] + pos[1] - start_pos[1]));
|
|
3509
3544
|
}
|
|
3510
3545
|
const precision = this.swipe_precision();
|
|
@@ -3556,7 +3591,6 @@ var $;
|
|
|
3556
3591
|
return;
|
|
3557
3592
|
}
|
|
3558
3593
|
this.start_pos(null);
|
|
3559
|
-
new $.$mol_after_timeout(0, () => this._menu_mute = false);
|
|
3560
3594
|
}
|
|
3561
3595
|
swipe_left(event) {
|
|
3562
3596
|
if (this.view_rect().right - this.start_pos()[0] < this.swipe_precision() * 2)
|
|
@@ -3586,11 +3620,6 @@ var $;
|
|
|
3586
3620
|
this.swipe_to_bottom(event);
|
|
3587
3621
|
this.event_end(event);
|
|
3588
3622
|
}
|
|
3589
|
-
_menu_mute = false;
|
|
3590
|
-
event_menu(event) {
|
|
3591
|
-
if (this._menu_mute)
|
|
3592
|
-
event.preventDefault();
|
|
3593
|
-
}
|
|
3594
3623
|
event_wheel(event) {
|
|
3595
3624
|
if (this.pan === $mol_touch.prototype.pan && this.zoom === $mol_touch.prototype.zoom)
|
|
3596
3625
|
return;
|
|
@@ -3794,6 +3823,15 @@ var $;
|
|
|
3794
3823
|
return val;
|
|
3795
3824
|
return 1;
|
|
3796
3825
|
}
|
|
3826
|
+
allow_draw() {
|
|
3827
|
+
return true;
|
|
3828
|
+
}
|
|
3829
|
+
allow_pan() {
|
|
3830
|
+
return true;
|
|
3831
|
+
}
|
|
3832
|
+
allow_zoom() {
|
|
3833
|
+
return true;
|
|
3834
|
+
}
|
|
3797
3835
|
draw(event) {
|
|
3798
3836
|
if (event !== undefined)
|
|
3799
3837
|
return event;
|
|
@@ -3812,6 +3850,9 @@ var $;
|
|
|
3812
3850
|
const obj = new this.$.$mol_touch();
|
|
3813
3851
|
obj.zoom = (val) => this.zoom(val);
|
|
3814
3852
|
obj.pan = (val) => this.shift(val);
|
|
3853
|
+
obj.allow_draw = () => this.allow_draw();
|
|
3854
|
+
obj.allow_pan = () => this.allow_pan();
|
|
3855
|
+
obj.allow_zoom = () => this.allow_zoom();
|
|
3815
3856
|
obj.draw = (event) => this.draw(event);
|
|
3816
3857
|
return obj;
|
|
3817
3858
|
}
|
|
@@ -6092,23 +6133,16 @@ var $;
|
|
|
6092
6133
|
$.$mol_assert_ok($.$mol_compare_deep(1, 1));
|
|
6093
6134
|
$.$mol_assert_ok($.$mol_compare_deep(Number.NaN, Number.NaN));
|
|
6094
6135
|
$.$mol_assert_not($.$mol_compare_deep(1, 2));
|
|
6095
|
-
},
|
|
6096
|
-
'Number'() {
|
|
6097
6136
|
$.$mol_assert_ok($.$mol_compare_deep(Object(1), Object(1)));
|
|
6098
|
-
$.$mol_assert_ok($.$mol_compare_deep(Object(Number.NaN), Object(Number.NaN)));
|
|
6099
6137
|
$.$mol_assert_not($.$mol_compare_deep(Object(1), Object(2)));
|
|
6100
6138
|
},
|
|
6101
|
-
'
|
|
6139
|
+
'POJO'() {
|
|
6102
6140
|
$.$mol_assert_ok($.$mol_compare_deep({}, {}));
|
|
6103
|
-
},
|
|
6104
|
-
'different POJOs'() {
|
|
6105
6141
|
$.$mol_assert_not($.$mol_compare_deep({ a: 1 }, { b: 2 }));
|
|
6106
|
-
},
|
|
6107
|
-
'different POJOs with same keys but different values'() {
|
|
6108
6142
|
$.$mol_assert_not($.$mol_compare_deep({ a: 1 }, { a: 2 }));
|
|
6109
|
-
},
|
|
6110
|
-
'different POJOs with different keys but same values'() {
|
|
6111
6143
|
$.$mol_assert_not($.$mol_compare_deep({}, { a: undefined }));
|
|
6144
|
+
$.$mol_assert_ok($.$mol_compare_deep({ a: 1, b: 2 }, { b: 2, a: 1 }));
|
|
6145
|
+
$.$mol_assert_ok($.$mol_compare_deep({ a: { b: 1 } }, { a: { b: 1 } }));
|
|
6112
6146
|
},
|
|
6113
6147
|
'Array'() {
|
|
6114
6148
|
$.$mol_assert_ok($.$mol_compare_deep([], []));
|
|
@@ -6116,17 +6150,12 @@ var $;
|
|
|
6116
6150
|
$.$mol_assert_not($.$mol_compare_deep([1, 2], [1, 3]));
|
|
6117
6151
|
$.$mol_assert_not($.$mol_compare_deep([1, 2,], [1, 3, undefined]));
|
|
6118
6152
|
},
|
|
6119
|
-
'
|
|
6120
|
-
|
|
6121
|
-
},
|
|
6122
|
-
'different classes with same values'() {
|
|
6123
|
-
class Obj {
|
|
6124
|
-
foo = 1;
|
|
6153
|
+
'Non POJO are different'() {
|
|
6154
|
+
class Thing extends Object {
|
|
6125
6155
|
}
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
$.$mol_assert_not($.$mol_compare_deep(a, b));
|
|
6156
|
+
$.$mol_assert_not($.$mol_compare_deep(new Thing, new Thing));
|
|
6157
|
+
$.$mol_assert_not($.$mol_compare_deep(() => 1, () => 1));
|
|
6158
|
+
$.$mol_assert_not($.$mol_compare_deep(new RangeError('Test error'), new RangeError('Test error')));
|
|
6130
6159
|
},
|
|
6131
6160
|
'same POJOs with cyclic reference'() {
|
|
6132
6161
|
const a = { foo: {} };
|
|
@@ -6135,41 +6164,6 @@ var $;
|
|
|
6135
6164
|
b['self'] = b;
|
|
6136
6165
|
$.$mol_assert_ok($.$mol_compare_deep(a, b));
|
|
6137
6166
|
},
|
|
6138
|
-
'empty Element'() {
|
|
6139
|
-
$.$mol_assert_ok($.$mol_compare_deep($.$mol_jsx("div", null), $.$mol_jsx("div", null)));
|
|
6140
|
-
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", null), $.$mol_jsx("span", null)));
|
|
6141
|
-
},
|
|
6142
|
-
'Element with attributes'() {
|
|
6143
|
-
$.$mol_assert_ok($.$mol_compare_deep($.$mol_jsx("div", { dir: "rtl" }), $.$mol_jsx("div", { dir: "rtl" })));
|
|
6144
|
-
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", { dir: "rtl" }), $.$mol_jsx("div", null)));
|
|
6145
|
-
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", { dir: "rtl" }), $.$mol_jsx("div", { dir: "ltr" })));
|
|
6146
|
-
},
|
|
6147
|
-
'Element with styles'() {
|
|
6148
|
-
$.$mol_assert_ok($.$mol_compare_deep($.$mol_jsx("div", { style: { color: 'red' } }), $.$mol_jsx("div", { style: { color: 'red' } })));
|
|
6149
|
-
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", { style: { color: 'red' } }), $.$mol_jsx("div", { style: {} })));
|
|
6150
|
-
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", { style: { color: 'red' } }), $.$mol_jsx("div", { style: { color: 'blue' } })));
|
|
6151
|
-
},
|
|
6152
|
-
'Element with content'() {
|
|
6153
|
-
$.$mol_assert_ok($.$mol_compare_deep($.$mol_jsx("div", null,
|
|
6154
|
-
"foo",
|
|
6155
|
-
$.$mol_jsx("br", null)), $.$mol_jsx("div", null,
|
|
6156
|
-
"foo",
|
|
6157
|
-
$.$mol_jsx("br", null))));
|
|
6158
|
-
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", null,
|
|
6159
|
-
"foo",
|
|
6160
|
-
$.$mol_jsx("br", null)), $.$mol_jsx("div", null,
|
|
6161
|
-
"bar",
|
|
6162
|
-
$.$mol_jsx("br", null))));
|
|
6163
|
-
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", null,
|
|
6164
|
-
"foo",
|
|
6165
|
-
$.$mol_jsx("br", null)), $.$mol_jsx("div", null,
|
|
6166
|
-
"foo",
|
|
6167
|
-
$.$mol_jsx("hr", null))));
|
|
6168
|
-
},
|
|
6169
|
-
'Element with handlers'() {
|
|
6170
|
-
$.$mol_assert_ok($.$mol_compare_deep($.$mol_jsx("div", { onclick: () => 1 }), $.$mol_jsx("div", { onclick: () => 1 })));
|
|
6171
|
-
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", { onclick: () => 1 }), $.$mol_jsx("div", { onclick: () => 2 })));
|
|
6172
|
-
},
|
|
6173
6167
|
'Date'() {
|
|
6174
6168
|
$.$mol_assert_ok($.$mol_compare_deep(new Date(12345), new Date(12345)));
|
|
6175
6169
|
$.$mol_assert_not($.$mol_compare_deep(new Date(12345), new Date(12346)));
|
|
@@ -6181,8 +6175,9 @@ var $;
|
|
|
6181
6175
|
},
|
|
6182
6176
|
'Map'() {
|
|
6183
6177
|
$.$mol_assert_ok($.$mol_compare_deep(new Map, new Map));
|
|
6184
|
-
$.$mol_assert_ok($.$mol_compare_deep(new Map([[
|
|
6178
|
+
$.$mol_assert_ok($.$mol_compare_deep(new Map([[1, [2]]]), new Map([[1, [2]]])));
|
|
6185
6179
|
$.$mol_assert_not($.$mol_compare_deep(new Map([[1, 2]]), new Map([[1, 3]])));
|
|
6180
|
+
$.$mol_assert_not($.$mol_compare_deep(new Map([[[1], 2]]), new Map([[[1], 2]])));
|
|
6186
6181
|
},
|
|
6187
6182
|
'Set'() {
|
|
6188
6183
|
$.$mol_assert_ok($.$mol_compare_deep(new Set, new Set));
|
|
@@ -6194,106 +6189,24 @@ var $;
|
|
|
6194
6189
|
$.$mol_assert_ok($.$mol_compare_deep(new Uint8Array([0]), new Uint8Array([0])));
|
|
6195
6190
|
$.$mol_assert_not($.$mol_compare_deep(new Uint8Array([0]), new Uint8Array([1])));
|
|
6196
6191
|
},
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
;
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
const a_stack = [];
|
|
6205
|
-
const b_stack = [];
|
|
6206
|
-
let cache = null;
|
|
6207
|
-
function $mol_compare_deep(a, b) {
|
|
6208
|
-
if (Object.is(a, b))
|
|
6209
|
-
return true;
|
|
6210
|
-
const a_type = typeof a;
|
|
6211
|
-
const b_type = typeof b;
|
|
6212
|
-
if (a_type !== b_type)
|
|
6213
|
-
return false;
|
|
6214
|
-
if (a_type === 'function')
|
|
6215
|
-
return a['toString']() === b['toString']();
|
|
6216
|
-
if (a_type !== 'object')
|
|
6217
|
-
return false;
|
|
6218
|
-
if (!a || !b)
|
|
6219
|
-
return false;
|
|
6220
|
-
if (a instanceof Error)
|
|
6221
|
-
return false;
|
|
6222
|
-
if (a['constructor'] !== b['constructor'])
|
|
6223
|
-
return false;
|
|
6224
|
-
if (a instanceof RegExp)
|
|
6225
|
-
return a.toString() === b['toString']();
|
|
6226
|
-
const ref = a_stack.indexOf(a);
|
|
6227
|
-
if (ref >= 0) {
|
|
6228
|
-
return Object.is(b_stack[ref], b);
|
|
6229
|
-
}
|
|
6230
|
-
if (!cache)
|
|
6231
|
-
cache = new WeakMap;
|
|
6232
|
-
let a_cache = cache.get(a);
|
|
6233
|
-
if (a_cache) {
|
|
6234
|
-
const b_cache = a_cache.get(b);
|
|
6235
|
-
if (typeof b_cache === 'boolean')
|
|
6236
|
-
return b_cache;
|
|
6237
|
-
}
|
|
6238
|
-
else {
|
|
6239
|
-
a_cache = new WeakMap();
|
|
6240
|
-
cache.set(a, a_cache);
|
|
6241
|
-
}
|
|
6242
|
-
a_stack.push(a);
|
|
6243
|
-
b_stack.push(b);
|
|
6244
|
-
let result;
|
|
6245
|
-
try {
|
|
6246
|
-
if (Symbol.iterator in a) {
|
|
6247
|
-
const a_iter = a[Symbol.iterator]();
|
|
6248
|
-
const b_iter = b[Symbol.iterator]();
|
|
6249
|
-
while (true) {
|
|
6250
|
-
const a_next = a_iter.next();
|
|
6251
|
-
const b_next = b_iter.next();
|
|
6252
|
-
if (a_next.done !== b_next.done)
|
|
6253
|
-
return result = false;
|
|
6254
|
-
if (a_next.done)
|
|
6255
|
-
break;
|
|
6256
|
-
if (!$mol_compare_deep(a_next.value, b_next.value))
|
|
6257
|
-
return result = false;
|
|
6192
|
+
'Custom comparator'() {
|
|
6193
|
+
class User {
|
|
6194
|
+
name;
|
|
6195
|
+
rand;
|
|
6196
|
+
constructor(name, rand = Math.random()) {
|
|
6197
|
+
this.name = name;
|
|
6198
|
+
this.rand = rand;
|
|
6258
6199
|
}
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
let count = 0;
|
|
6262
|
-
for (let key in a) {
|
|
6263
|
-
try {
|
|
6264
|
-
if (!$mol_compare_deep(a[key], b[key]))
|
|
6265
|
-
return result = false;
|
|
6266
|
-
}
|
|
6267
|
-
catch (error) {
|
|
6268
|
-
$.$mol_fail_hidden(new $.$mol_error_mix(`Failed ${JSON.stringify(key)} fields comparison of ${a} and ${b}`, error));
|
|
6200
|
+
[Symbol.toPrimitive](mode) {
|
|
6201
|
+
return this.name;
|
|
6269
6202
|
}
|
|
6270
|
-
++count;
|
|
6271
6203
|
}
|
|
6272
|
-
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
}
|
|
6277
|
-
if (a instanceof Number || a instanceof String || a instanceof Symbol || a instanceof Boolean || a instanceof Date) {
|
|
6278
|
-
if (!Object.is(a['valueOf'](), b['valueOf']()))
|
|
6279
|
-
return result = false;
|
|
6280
|
-
}
|
|
6281
|
-
return result = true;
|
|
6282
|
-
}
|
|
6283
|
-
finally {
|
|
6284
|
-
a_stack.pop();
|
|
6285
|
-
b_stack.pop();
|
|
6286
|
-
if (a_stack.length === 0) {
|
|
6287
|
-
cache = null;
|
|
6288
|
-
}
|
|
6289
|
-
else {
|
|
6290
|
-
a_cache.set(b, result);
|
|
6291
|
-
}
|
|
6292
|
-
}
|
|
6293
|
-
}
|
|
6294
|
-
$.$mol_compare_deep = $mol_compare_deep;
|
|
6204
|
+
$.$mol_assert_ok($.$mol_compare_deep(new User('Jin'), new User('Jin')));
|
|
6205
|
+
$.$mol_assert_not($.$mol_compare_deep(new User('Jin'), new User('John')));
|
|
6206
|
+
},
|
|
6207
|
+
});
|
|
6295
6208
|
})($ || ($ = {}));
|
|
6296
|
-
//deep.js.map
|
|
6209
|
+
//deep.test.js.map
|
|
6297
6210
|
;
|
|
6298
6211
|
"use strict";
|
|
6299
6212
|
var $;
|
|
@@ -6701,129 +6614,6 @@ var $;
|
|
|
6701
6614
|
;
|
|
6702
6615
|
"use strict";
|
|
6703
6616
|
var $;
|
|
6704
|
-
(function ($) {
|
|
6705
|
-
$.$mol_test({
|
|
6706
|
-
'return source when same object'() {
|
|
6707
|
-
const target = {};
|
|
6708
|
-
$.$mol_assert_equal($.$mol_conform(target, target), target);
|
|
6709
|
-
},
|
|
6710
|
-
'return target when some is not object'() {
|
|
6711
|
-
const obj = { a: 1 };
|
|
6712
|
-
$.$mol_assert_equal($.$mol_conform(true, obj), true);
|
|
6713
|
-
$.$mol_assert_equal($.$mol_conform(obj, true), obj);
|
|
6714
|
-
},
|
|
6715
|
-
'return target when some is null'() {
|
|
6716
|
-
const obj = { a: 1 };
|
|
6717
|
-
$.$mol_assert_equal($.$mol_conform(null, obj), null);
|
|
6718
|
-
$.$mol_assert_equal($.$mol_conform(obj, null), obj);
|
|
6719
|
-
},
|
|
6720
|
-
'return target when some is undefined'() {
|
|
6721
|
-
const obj = { a: 1 };
|
|
6722
|
-
$.$mol_assert_equal($.$mol_conform(undefined, obj), undefined);
|
|
6723
|
-
$.$mol_assert_equal($.$mol_conform(obj, undefined), obj);
|
|
6724
|
-
},
|
|
6725
|
-
'return target when different keys count'() {
|
|
6726
|
-
const target = [1, 2, 3];
|
|
6727
|
-
const source = [1, 2, 3, undefined];
|
|
6728
|
-
const result = $.$mol_conform(target, source);
|
|
6729
|
-
$.$mol_assert_equal(result, target);
|
|
6730
|
-
$.$mol_assert_equal(result.join(','), '1,2,3');
|
|
6731
|
-
},
|
|
6732
|
-
'return source when array values are strong equal'() {
|
|
6733
|
-
const source = [1, 2, 3];
|
|
6734
|
-
$.$mol_assert_equal($.$mol_conform([1, 2, 3], source), source);
|
|
6735
|
-
},
|
|
6736
|
-
'return source when object values are strong equal'() {
|
|
6737
|
-
const source = { a: 1, b: 2 };
|
|
6738
|
-
$.$mol_assert_equal($.$mol_conform({ a: 1, b: 2 }, source), source);
|
|
6739
|
-
},
|
|
6740
|
-
'return target when some values are not equal'() {
|
|
6741
|
-
const target = [1, 2, 3];
|
|
6742
|
-
const source = [1, 2, 5];
|
|
6743
|
-
const result = $.$mol_conform(target, source);
|
|
6744
|
-
$.$mol_assert_equal(result, target);
|
|
6745
|
-
$.$mol_assert_equal(result.join(','), '1,2,3');
|
|
6746
|
-
},
|
|
6747
|
-
'return source when values are deep equal'() {
|
|
6748
|
-
const source = { foo: { bar: 1 } };
|
|
6749
|
-
$.$mol_assert_equal($.$mol_conform({ foo: { bar: 1 } }, source), source);
|
|
6750
|
-
},
|
|
6751
|
-
'return target with equal values from source and not equal from target'() {
|
|
6752
|
-
const source = { foo: { xxx: 1 }, bar: { xxx: 2 } };
|
|
6753
|
-
const target = { foo: { xxx: 1 }, bar: { xxx: 3 } };
|
|
6754
|
-
const result = $.$mol_conform(target, source);
|
|
6755
|
-
$.$mol_assert_equal(result, target);
|
|
6756
|
-
$.$mol_assert_equal(result.foo, source.foo);
|
|
6757
|
-
$.$mol_assert_equal(result.bar, target.bar);
|
|
6758
|
-
},
|
|
6759
|
-
'return target when equal but with different class'() {
|
|
6760
|
-
const target = { '0': 1 };
|
|
6761
|
-
$.$mol_assert_equal($.$mol_conform(target, [1]), target);
|
|
6762
|
-
},
|
|
6763
|
-
'return target when conformer for class is not defined'() {
|
|
6764
|
-
const Obj = class {
|
|
6765
|
-
};
|
|
6766
|
-
const source = new Obj;
|
|
6767
|
-
const target = new Obj;
|
|
6768
|
-
const result = $.$mol_conform(target, source);
|
|
6769
|
-
$.$mol_assert_equal(result, target);
|
|
6770
|
-
},
|
|
6771
|
-
'return target when has cyclic reference'() {
|
|
6772
|
-
const source = { foo: {} };
|
|
6773
|
-
source['self'] = source;
|
|
6774
|
-
const target = { foo: {} };
|
|
6775
|
-
target['self'] = target;
|
|
6776
|
-
const result = $.$mol_conform(target, source);
|
|
6777
|
-
$.$mol_assert_equal(result, target);
|
|
6778
|
-
$.$mol_assert_equal(result['self'], target);
|
|
6779
|
-
$.$mol_assert_equal(result.foo, source.foo);
|
|
6780
|
-
},
|
|
6781
|
-
'return source when equal dates'() {
|
|
6782
|
-
const source = new Date(12345);
|
|
6783
|
-
const target = new Date(12345);
|
|
6784
|
-
const result = $.$mol_conform(target, source);
|
|
6785
|
-
$.$mol_assert_equal(result, source);
|
|
6786
|
-
},
|
|
6787
|
-
'return source when equal regular expressions'() {
|
|
6788
|
-
const source = /\x22/mig;
|
|
6789
|
-
const target = /\x22/mig;
|
|
6790
|
-
const result = $.$mol_conform(target, source);
|
|
6791
|
-
$.$mol_assert_equal(result, source);
|
|
6792
|
-
},
|
|
6793
|
-
'return cached value if already conformed'() {
|
|
6794
|
-
const source = { foo: { xxx: 1 }, bar: { xxx: 3 } };
|
|
6795
|
-
const target = { foo: { xxx: 2 }, bar: { xxx: 3 } };
|
|
6796
|
-
const result = $.$mol_conform(target, source);
|
|
6797
|
-
target.foo.xxx = 1;
|
|
6798
|
-
$.$mol_assert_equal($.$mol_conform(target.foo, source.foo), target.foo);
|
|
6799
|
-
},
|
|
6800
|
-
'skip readlony fields'() {
|
|
6801
|
-
const source = { foo: {}, bar: {} };
|
|
6802
|
-
const target = { foo: {}, bar: {} };
|
|
6803
|
-
Object.defineProperty(target, 'bar', { value: {}, writable: false });
|
|
6804
|
-
const result = $.$mol_conform(target, source);
|
|
6805
|
-
$.$mol_assert_equal(result, target);
|
|
6806
|
-
$.$mol_assert_equal(result.foo, source.foo);
|
|
6807
|
-
$.$mol_assert_equal(result.bar, target.bar);
|
|
6808
|
-
},
|
|
6809
|
-
'object with NaN'() {
|
|
6810
|
-
const source = { foo: Number.NaN };
|
|
6811
|
-
const target = { foo: Number.NaN };
|
|
6812
|
-
const result = $.$mol_conform(target, source);
|
|
6813
|
-
$.$mol_assert_equal(result, source);
|
|
6814
|
-
},
|
|
6815
|
-
'array with NaN'() {
|
|
6816
|
-
const source = [Number.NaN];
|
|
6817
|
-
const target = [Number.NaN];
|
|
6818
|
-
const result = $.$mol_conform(target, source);
|
|
6819
|
-
$.$mol_assert_equal(result, source);
|
|
6820
|
-
},
|
|
6821
|
-
});
|
|
6822
|
-
})($ || ($ = {}));
|
|
6823
|
-
//conform.test.js.map
|
|
6824
|
-
;
|
|
6825
|
-
"use strict";
|
|
6826
|
-
var $;
|
|
6827
6617
|
(function ($) {
|
|
6828
6618
|
$.$mol_test({
|
|
6829
6619
|
'trim array'() {
|
|
@@ -7466,92 +7256,6 @@ var $;
|
|
|
7466
7256
|
;
|
|
7467
7257
|
"use strict";
|
|
7468
7258
|
var $;
|
|
7469
|
-
(function ($) {
|
|
7470
|
-
$.$mol_test({
|
|
7471
|
-
'equal paths'() {
|
|
7472
|
-
const diff = $.$mol_diff_path([1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4]);
|
|
7473
|
-
$.$mol_assert_like(diff, {
|
|
7474
|
-
prefix: [1, 2, 3, 4],
|
|
7475
|
-
suffix: [[], [], []],
|
|
7476
|
-
});
|
|
7477
|
-
},
|
|
7478
|
-
'different suffix'() {
|
|
7479
|
-
const diff = $.$mol_diff_path([1, 2, 3, 4], [1, 2, 3, 5], [1, 2, 5, 4]);
|
|
7480
|
-
$.$mol_assert_like(diff, {
|
|
7481
|
-
prefix: [1, 2],
|
|
7482
|
-
suffix: [[3, 4], [3, 5], [5, 4]],
|
|
7483
|
-
});
|
|
7484
|
-
},
|
|
7485
|
-
'one contains other'() {
|
|
7486
|
-
const diff = $.$mol_diff_path([1, 2, 3, 4], [1, 2], [1, 2, 3]);
|
|
7487
|
-
$.$mol_assert_like(diff, {
|
|
7488
|
-
prefix: [1, 2],
|
|
7489
|
-
suffix: [[3, 4], [], [3]],
|
|
7490
|
-
});
|
|
7491
|
-
},
|
|
7492
|
-
'fully different'() {
|
|
7493
|
-
const diff = $.$mol_diff_path([1, 2], [3, 4], [5, 6]);
|
|
7494
|
-
$.$mol_assert_like(diff, {
|
|
7495
|
-
prefix: [],
|
|
7496
|
-
suffix: [[1, 2], [3, 4], [5, 6]],
|
|
7497
|
-
});
|
|
7498
|
-
},
|
|
7499
|
-
});
|
|
7500
|
-
})($ || ($ = {}));
|
|
7501
|
-
//path.test.js.map
|
|
7502
|
-
;
|
|
7503
|
-
"use strict";
|
|
7504
|
-
var $;
|
|
7505
|
-
(function ($) {
|
|
7506
|
-
function $mol_diff_path(...paths) {
|
|
7507
|
-
const limit = Math.min(...paths.map(path => path.length));
|
|
7508
|
-
lookup: for (var i = 0; i < limit; ++i) {
|
|
7509
|
-
const first = paths[0][i];
|
|
7510
|
-
for (let j = 1; j < paths.length; ++j) {
|
|
7511
|
-
if (paths[j][i] !== first)
|
|
7512
|
-
break lookup;
|
|
7513
|
-
}
|
|
7514
|
-
}
|
|
7515
|
-
return {
|
|
7516
|
-
prefix: paths[0].slice(0, i),
|
|
7517
|
-
suffix: paths.map(path => path.slice(i)),
|
|
7518
|
-
};
|
|
7519
|
-
}
|
|
7520
|
-
$.$mol_diff_path = $mol_diff_path;
|
|
7521
|
-
})($ || ($ = {}));
|
|
7522
|
-
//path.js.map
|
|
7523
|
-
;
|
|
7524
|
-
"use strict";
|
|
7525
|
-
var $;
|
|
7526
|
-
(function ($) {
|
|
7527
|
-
class $mol_error_mix extends Error {
|
|
7528
|
-
errors;
|
|
7529
|
-
constructor(message, ...errors) {
|
|
7530
|
-
super(message);
|
|
7531
|
-
this.errors = errors;
|
|
7532
|
-
if (errors.length) {
|
|
7533
|
-
const stacks = [...errors.map(error => error.stack), this.stack];
|
|
7534
|
-
const diff = $.$mol_diff_path(...stacks.map(stack => {
|
|
7535
|
-
if (!stack)
|
|
7536
|
-
return [];
|
|
7537
|
-
return stack.split('\n').reverse();
|
|
7538
|
-
}));
|
|
7539
|
-
const head = diff.prefix.reverse().join('\n');
|
|
7540
|
-
const tails = diff.suffix.map(path => path.reverse().map(line => line.replace(/^(?!\s+at)/, '\tat (.) ')).join('\n')).join('\n\tat (.) -----\n');
|
|
7541
|
-
this.stack = `Error: ${this.constructor.name}\n\tat (.) /"""\\\n${tails}\n\tat (.) \\___/\n${head}`;
|
|
7542
|
-
this.message += errors.map(error => '\n' + error.message).join('');
|
|
7543
|
-
}
|
|
7544
|
-
}
|
|
7545
|
-
toJSON() {
|
|
7546
|
-
return this.message;
|
|
7547
|
-
}
|
|
7548
|
-
}
|
|
7549
|
-
$.$mol_error_mix = $mol_error_mix;
|
|
7550
|
-
})($ || ($ = {}));
|
|
7551
|
-
//mix.js.map
|
|
7552
|
-
;
|
|
7553
|
-
"use strict";
|
|
7554
|
-
var $;
|
|
7555
7259
|
(function ($) {
|
|
7556
7260
|
class $mol_view_tree_test_attributes_super extends $.$mol_view {
|
|
7557
7261
|
some() {
|