mol_time_all 1.1.499 → 1.1.501
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.deps.json +1 -1
- package/node.js +13 -13
- package/node.js.map +1 -1
- package/node.mjs +13 -13
- package/node.mjs.map +1 -1
- package/node.test.js +290 -290
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.deps.json +1 -1
- package/web.js +13 -13
- package/web.js.map +1 -1
- package/web.mjs +13 -13
- package/web.mjs.map +1 -1
- package/web.test.js +188 -188
- package/web.test.js.map +1 -1
package/node.test.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
"use strict";
|
|
3
|
+
Error.stackTraceLimit = 50;
|
|
4
|
+
var $;
|
|
5
|
+
(function ($) {
|
|
6
|
+
})($ || ($ = {}));
|
|
7
|
+
module.exports = $;
|
|
8
|
+
//mam.ts
|
|
9
|
+
;
|
|
2
10
|
"use strict"
|
|
3
11
|
|
|
4
12
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
@@ -11,14 +19,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
11
19
|
var $ = ( typeof module === 'object' ) ? ( module['export'+'s'] = globalThis ) : globalThis
|
|
12
20
|
$.$$ = $
|
|
13
21
|
|
|
14
|
-
;
|
|
15
|
-
"use strict";
|
|
16
|
-
Error.stackTraceLimit = 50;
|
|
17
|
-
var $;
|
|
18
|
-
(function ($) {
|
|
19
|
-
})($ || ($ = {}));
|
|
20
|
-
module.exports = $;
|
|
21
|
-
//mam.ts
|
|
22
22
|
;
|
|
23
23
|
"use strict";
|
|
24
24
|
var $;
|
|
@@ -665,16 +665,6 @@ var $;
|
|
|
665
665
|
;
|
|
666
666
|
"use strict";
|
|
667
667
|
var $;
|
|
668
|
-
(function ($) {
|
|
669
|
-
function $mol_test_complete() {
|
|
670
|
-
process.exit(0);
|
|
671
|
-
}
|
|
672
|
-
$.$mol_test_complete = $mol_test_complete;
|
|
673
|
-
})($ || ($ = {}));
|
|
674
|
-
//mol/test/test.node.test.ts
|
|
675
|
-
;
|
|
676
|
-
"use strict";
|
|
677
|
-
var $;
|
|
678
668
|
(function ($_1) {
|
|
679
669
|
function $mol_test(set) {
|
|
680
670
|
for (let name in set) {
|
|
@@ -762,6 +752,16 @@ var $;
|
|
|
762
752
|
;
|
|
763
753
|
"use strict";
|
|
764
754
|
var $;
|
|
755
|
+
(function ($) {
|
|
756
|
+
function $mol_test_complete() {
|
|
757
|
+
process.exit(0);
|
|
758
|
+
}
|
|
759
|
+
$.$mol_test_complete = $mol_test_complete;
|
|
760
|
+
})($ || ($ = {}));
|
|
761
|
+
//mol/test/test.node.test.ts
|
|
762
|
+
;
|
|
763
|
+
"use strict";
|
|
764
|
+
var $;
|
|
765
765
|
(function ($) {
|
|
766
766
|
})($ || ($ = {}));
|
|
767
767
|
//mol/dom/context/context.ts
|
|
@@ -1027,9 +1027,6 @@ var $;
|
|
|
1027
1027
|
//mol/dom/render/children/children.ts
|
|
1028
1028
|
;
|
|
1029
1029
|
"use strict";
|
|
1030
|
-
//mol/type/partial/deep/deep.ts
|
|
1031
|
-
;
|
|
1032
|
-
"use strict";
|
|
1033
1030
|
//mol/type/error/error.ts
|
|
1034
1031
|
;
|
|
1035
1032
|
"use strict";
|
|
@@ -1039,97 +1036,10 @@ var $;
|
|
|
1039
1036
|
//mol/type/assert/assert.test.ts
|
|
1040
1037
|
;
|
|
1041
1038
|
"use strict";
|
|
1042
|
-
//mol/type/partial/deep/deep.
|
|
1039
|
+
//mol/type/partial/deep/deep.ts
|
|
1043
1040
|
;
|
|
1044
1041
|
"use strict";
|
|
1045
|
-
|
|
1046
|
-
(function ($) {
|
|
1047
|
-
$mol_test({
|
|
1048
|
-
'Make empty div'() {
|
|
1049
|
-
$mol_assert_equal(($mol_jsx("div", null)).outerHTML, '<div></div>');
|
|
1050
|
-
},
|
|
1051
|
-
'Define native field'() {
|
|
1052
|
-
const dom = $mol_jsx("input", { value: '123' });
|
|
1053
|
-
$mol_assert_equal(dom.outerHTML, '<input value="123">');
|
|
1054
|
-
$mol_assert_equal(dom.value, '123');
|
|
1055
|
-
},
|
|
1056
|
-
'Define classes'() {
|
|
1057
|
-
const dom = $mol_jsx("div", { class: 'foo bar' });
|
|
1058
|
-
$mol_assert_equal(dom.outerHTML, '<div class="foo bar"></div>');
|
|
1059
|
-
},
|
|
1060
|
-
'Define styles'() {
|
|
1061
|
-
const dom = $mol_jsx("div", { style: { color: 'red' } });
|
|
1062
|
-
$mol_assert_equal(dom.outerHTML, '<div style="color: red;"></div>');
|
|
1063
|
-
},
|
|
1064
|
-
'Define dataset'() {
|
|
1065
|
-
const dom = $mol_jsx("div", { dataset: { foo: 'bar' } });
|
|
1066
|
-
$mol_assert_equal(dom.outerHTML, '<div data-foo="bar"></div>');
|
|
1067
|
-
},
|
|
1068
|
-
'Define attributes'() {
|
|
1069
|
-
const dom = $mol_jsx("div", { lang: "ru", hidden: true });
|
|
1070
|
-
$mol_assert_equal(dom.outerHTML, '<div lang="ru" hidden=""></div>');
|
|
1071
|
-
},
|
|
1072
|
-
'Define child nodes'() {
|
|
1073
|
-
const dom = $mol_jsx("div", null,
|
|
1074
|
-
"hello",
|
|
1075
|
-
$mol_jsx("strong", null, "world"),
|
|
1076
|
-
"!");
|
|
1077
|
-
$mol_assert_equal(dom.outerHTML, '<div>hello<strong>world</strong>!</div>');
|
|
1078
|
-
},
|
|
1079
|
-
'Function as component'() {
|
|
1080
|
-
const Button = (props, target) => {
|
|
1081
|
-
return $mol_jsx("button", { title: props.hint }, target());
|
|
1082
|
-
};
|
|
1083
|
-
const dom = $mol_jsx(Button, { id: "foo", hint: "click me" }, () => 'hey!');
|
|
1084
|
-
$mol_assert_equal(dom.outerHTML, '<button id="foo" title="click me" class="Button">hey!</button>');
|
|
1085
|
-
},
|
|
1086
|
-
'Nested guid generation'() {
|
|
1087
|
-
const Foo = () => {
|
|
1088
|
-
return $mol_jsx("div", null,
|
|
1089
|
-
$mol_jsx(Bar, { id: "bar" },
|
|
1090
|
-
$mol_jsx("img", { id: "icon" })));
|
|
1091
|
-
};
|
|
1092
|
-
const Bar = (props, icon) => {
|
|
1093
|
-
return $mol_jsx("span", null,
|
|
1094
|
-
icon,
|
|
1095
|
-
$mol_jsx("i", { id: "label" }));
|
|
1096
|
-
};
|
|
1097
|
-
const dom = $mol_jsx(Foo, { id: "foo" });
|
|
1098
|
-
$mol_assert_equal(dom.outerHTML, '<div id="foo" class="Foo"><span id="foo/bar" class="Foo_bar Bar"><img id="foo/icon" class="Foo_icon"><i id="foo/bar/label" class="Foo_bar_label Bar_label"></i></span></div>');
|
|
1099
|
-
},
|
|
1100
|
-
'Fail on non unique ids'() {
|
|
1101
|
-
const App = () => {
|
|
1102
|
-
return $mol_jsx("div", null,
|
|
1103
|
-
$mol_jsx("span", { id: "bar" }),
|
|
1104
|
-
$mol_jsx("span", { id: "bar" }));
|
|
1105
|
-
};
|
|
1106
|
-
$mol_assert_fail(() => $mol_jsx(App, { id: "foo" }), 'JSX already has tag with id "foo/bar"');
|
|
1107
|
-
},
|
|
1108
|
-
'Owner based guid generationn'() {
|
|
1109
|
-
const Foo = () => {
|
|
1110
|
-
return $mol_jsx("div", null,
|
|
1111
|
-
$mol_jsx(Bar, { id: "middle", icon: () => $mol_jsx("img", { id: "icon" }) }));
|
|
1112
|
-
};
|
|
1113
|
-
const Bar = (props) => {
|
|
1114
|
-
return $mol_jsx("span", null, props.icon());
|
|
1115
|
-
};
|
|
1116
|
-
const dom = $mol_jsx(Foo, { id: "app" });
|
|
1117
|
-
$mol_assert_equal(dom.outerHTML, '<div id="app" class="Foo"><span id="app/middle" class="Foo_middle Bar"><img id="app/icon" class="Foo_icon"></span></div>');
|
|
1118
|
-
},
|
|
1119
|
-
'Fail on same ids from different caller'() {
|
|
1120
|
-
const Foo = () => {
|
|
1121
|
-
return $mol_jsx("div", null,
|
|
1122
|
-
$mol_jsx("img", { id: "icon" }),
|
|
1123
|
-
$mol_jsx(Bar, { id: "bar", icon: () => $mol_jsx("img", { id: "icon" }) }));
|
|
1124
|
-
};
|
|
1125
|
-
const Bar = (props) => {
|
|
1126
|
-
return $mol_jsx("span", null, props.icon());
|
|
1127
|
-
};
|
|
1128
|
-
$mol_assert_fail(() => $mol_jsx(Foo, { id: "foo" }), 'JSX already has tag with id "foo/icon"');
|
|
1129
|
-
},
|
|
1130
|
-
});
|
|
1131
|
-
})($ || ($ = {}));
|
|
1132
|
-
//mol/jsx/jsx.test.tsx
|
|
1042
|
+
//mol/type/partial/deep/deep.test.ts
|
|
1133
1043
|
;
|
|
1134
1044
|
"use strict";
|
|
1135
1045
|
var $;
|
|
@@ -1256,97 +1166,91 @@ var $;
|
|
|
1256
1166
|
var $;
|
|
1257
1167
|
(function ($) {
|
|
1258
1168
|
$mol_test({
|
|
1259
|
-
'
|
|
1260
|
-
$
|
|
1261
|
-
$mol_assert_ok($mol_compare_deep(undefined, undefined));
|
|
1262
|
-
$mol_assert_not($mol_compare_deep(undefined, null));
|
|
1263
|
-
$mol_assert_not($mol_compare_deep({}, null));
|
|
1264
|
-
},
|
|
1265
|
-
'number'() {
|
|
1266
|
-
$mol_assert_ok($mol_compare_deep(1, 1));
|
|
1267
|
-
$mol_assert_ok($mol_compare_deep(Number.NaN, Number.NaN));
|
|
1268
|
-
$mol_assert_not($mol_compare_deep(1, 2));
|
|
1269
|
-
$mol_assert_ok($mol_compare_deep(Object(1), Object(1)));
|
|
1270
|
-
$mol_assert_not($mol_compare_deep(Object(1), Object(2)));
|
|
1169
|
+
'Make empty div'() {
|
|
1170
|
+
$mol_assert_equal(($mol_jsx("div", null)).outerHTML, '<div></div>');
|
|
1271
1171
|
},
|
|
1272
|
-
'
|
|
1273
|
-
$
|
|
1274
|
-
$
|
|
1275
|
-
$
|
|
1276
|
-
$mol_assert_not($mol_compare_deep({}, { a: undefined }));
|
|
1277
|
-
$mol_assert_ok($mol_compare_deep({ a: 1, b: 2 }, { b: 2, a: 1 }));
|
|
1278
|
-
$mol_assert_ok($mol_compare_deep({ a: { b: 1 } }, { a: { b: 1 } }));
|
|
1172
|
+
'Define native field'() {
|
|
1173
|
+
const dom = $mol_jsx("input", { value: '123' });
|
|
1174
|
+
$mol_assert_equal(dom.outerHTML, '<input value="123">');
|
|
1175
|
+
$mol_assert_equal(dom.value, '123');
|
|
1279
1176
|
},
|
|
1280
|
-
'
|
|
1281
|
-
$
|
|
1282
|
-
$
|
|
1283
|
-
$mol_assert_not($mol_compare_deep([1, 2], [1, 3]));
|
|
1284
|
-
$mol_assert_not($mol_compare_deep([1, 2,], [1, 3, undefined]));
|
|
1177
|
+
'Define classes'() {
|
|
1178
|
+
const dom = $mol_jsx("div", { class: 'foo bar' });
|
|
1179
|
+
$mol_assert_equal(dom.outerHTML, '<div class="foo bar"></div>');
|
|
1285
1180
|
},
|
|
1286
|
-
'
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
$mol_assert_not($mol_compare_deep(new Thing, new Thing));
|
|
1290
|
-
$mol_assert_not($mol_compare_deep(() => 1, () => 1));
|
|
1291
|
-
$mol_assert_not($mol_compare_deep(new RangeError('Test error'), new RangeError('Test error')));
|
|
1181
|
+
'Define styles'() {
|
|
1182
|
+
const dom = $mol_jsx("div", { style: { color: 'red' } });
|
|
1183
|
+
$mol_assert_equal(dom.outerHTML, '<div style="color: red;"></div>');
|
|
1292
1184
|
},
|
|
1293
|
-
'
|
|
1294
|
-
const
|
|
1295
|
-
|
|
1296
|
-
const b = { foo: {} };
|
|
1297
|
-
b['self'] = b;
|
|
1298
|
-
$mol_assert_ok($mol_compare_deep(a, b));
|
|
1185
|
+
'Define dataset'() {
|
|
1186
|
+
const dom = $mol_jsx("div", { dataset: { foo: 'bar' } });
|
|
1187
|
+
$mol_assert_equal(dom.outerHTML, '<div data-foo="bar"></div>');
|
|
1299
1188
|
},
|
|
1300
|
-
'
|
|
1301
|
-
$
|
|
1302
|
-
$
|
|
1189
|
+
'Define attributes'() {
|
|
1190
|
+
const dom = $mol_jsx("div", { lang: "ru", hidden: true });
|
|
1191
|
+
$mol_assert_equal(dom.outerHTML, '<div lang="ru" hidden=""></div>');
|
|
1303
1192
|
},
|
|
1304
|
-
'
|
|
1305
|
-
$
|
|
1306
|
-
|
|
1307
|
-
|
|
1193
|
+
'Define child nodes'() {
|
|
1194
|
+
const dom = $mol_jsx("div", null,
|
|
1195
|
+
"hello",
|
|
1196
|
+
$mol_jsx("strong", null, "world"),
|
|
1197
|
+
"!");
|
|
1198
|
+
$mol_assert_equal(dom.outerHTML, '<div>hello<strong>world</strong>!</div>');
|
|
1308
1199
|
},
|
|
1309
|
-
'
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
$
|
|
1200
|
+
'Function as component'() {
|
|
1201
|
+
const Button = (props, target) => {
|
|
1202
|
+
return $mol_jsx("button", { title: props.hint }, target());
|
|
1203
|
+
};
|
|
1204
|
+
const dom = $mol_jsx(Button, { id: "foo", hint: "click me" }, () => 'hey!');
|
|
1205
|
+
$mol_assert_equal(dom.outerHTML, '<button id="foo" title="click me" class="Button">hey!</button>');
|
|
1314
1206
|
},
|
|
1315
|
-
'
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1207
|
+
'Nested guid generation'() {
|
|
1208
|
+
const Foo = () => {
|
|
1209
|
+
return $mol_jsx("div", null,
|
|
1210
|
+
$mol_jsx(Bar, { id: "bar" },
|
|
1211
|
+
$mol_jsx("img", { id: "icon" })));
|
|
1212
|
+
};
|
|
1213
|
+
const Bar = (props, icon) => {
|
|
1214
|
+
return $mol_jsx("span", null,
|
|
1215
|
+
icon,
|
|
1216
|
+
$mol_jsx("i", { id: "label" }));
|
|
1217
|
+
};
|
|
1218
|
+
const dom = $mol_jsx(Foo, { id: "foo" });
|
|
1219
|
+
$mol_assert_equal(dom.outerHTML, '<div id="foo" class="Foo"><span id="foo/bar" class="Foo_bar Bar"><img id="foo/icon" class="Foo_icon"><i id="foo/bar/label" class="Foo_bar_label Bar_label"></i></span></div>');
|
|
1321
1220
|
},
|
|
1322
|
-
'
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1221
|
+
'Fail on non unique ids'() {
|
|
1222
|
+
const App = () => {
|
|
1223
|
+
return $mol_jsx("div", null,
|
|
1224
|
+
$mol_jsx("span", { id: "bar" }),
|
|
1225
|
+
$mol_jsx("span", { id: "bar" }));
|
|
1226
|
+
};
|
|
1227
|
+
$mol_assert_fail(() => $mol_jsx(App, { id: "foo" }), 'JSX already has tag with id "foo/bar"');
|
|
1326
1228
|
},
|
|
1327
|
-
'
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1229
|
+
'Owner based guid generationn'() {
|
|
1230
|
+
const Foo = () => {
|
|
1231
|
+
return $mol_jsx("div", null,
|
|
1232
|
+
$mol_jsx(Bar, { id: "middle", icon: () => $mol_jsx("img", { id: "icon" }) }));
|
|
1233
|
+
};
|
|
1234
|
+
const Bar = (props) => {
|
|
1235
|
+
return $mol_jsx("span", null, props.icon());
|
|
1236
|
+
};
|
|
1237
|
+
const dom = $mol_jsx(Foo, { id: "app" });
|
|
1238
|
+
$mol_assert_equal(dom.outerHTML, '<div id="app" class="Foo"><span id="app/middle" class="Foo_middle Bar"><img id="app/icon" class="Foo_icon"></span></div>');
|
|
1331
1239
|
},
|
|
1332
|
-
'
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
}
|
|
1343
|
-
}
|
|
1344
|
-
$mol_assert_ok($mol_compare_deep(new User('Jin'), new User('Jin')));
|
|
1345
|
-
$mol_assert_not($mol_compare_deep(new User('Jin'), new User('John')));
|
|
1240
|
+
'Fail on same ids from different caller'() {
|
|
1241
|
+
const Foo = () => {
|
|
1242
|
+
return $mol_jsx("div", null,
|
|
1243
|
+
$mol_jsx("img", { id: "icon" }),
|
|
1244
|
+
$mol_jsx(Bar, { id: "bar", icon: () => $mol_jsx("img", { id: "icon" }) }));
|
|
1245
|
+
};
|
|
1246
|
+
const Bar = (props) => {
|
|
1247
|
+
return $mol_jsx("span", null, props.icon());
|
|
1248
|
+
};
|
|
1249
|
+
$mol_assert_fail(() => $mol_jsx(Foo, { id: "foo" }), 'JSX already has tag with id "foo/icon"');
|
|
1346
1250
|
},
|
|
1347
1251
|
});
|
|
1348
1252
|
})($ || ($ = {}));
|
|
1349
|
-
//mol/
|
|
1253
|
+
//mol/jsx/jsx.test.tsx
|
|
1350
1254
|
;
|
|
1351
1255
|
"use strict";
|
|
1352
1256
|
var $;
|
|
@@ -1475,6 +1379,102 @@ var $;
|
|
|
1475
1379
|
;
|
|
1476
1380
|
"use strict";
|
|
1477
1381
|
var $;
|
|
1382
|
+
(function ($) {
|
|
1383
|
+
$mol_test({
|
|
1384
|
+
'nulls & undefineds'() {
|
|
1385
|
+
$mol_assert_ok($mol_compare_deep(null, null));
|
|
1386
|
+
$mol_assert_ok($mol_compare_deep(undefined, undefined));
|
|
1387
|
+
$mol_assert_not($mol_compare_deep(undefined, null));
|
|
1388
|
+
$mol_assert_not($mol_compare_deep({}, null));
|
|
1389
|
+
},
|
|
1390
|
+
'number'() {
|
|
1391
|
+
$mol_assert_ok($mol_compare_deep(1, 1));
|
|
1392
|
+
$mol_assert_ok($mol_compare_deep(Number.NaN, Number.NaN));
|
|
1393
|
+
$mol_assert_not($mol_compare_deep(1, 2));
|
|
1394
|
+
$mol_assert_ok($mol_compare_deep(Object(1), Object(1)));
|
|
1395
|
+
$mol_assert_not($mol_compare_deep(Object(1), Object(2)));
|
|
1396
|
+
},
|
|
1397
|
+
'POJO'() {
|
|
1398
|
+
$mol_assert_ok($mol_compare_deep({}, {}));
|
|
1399
|
+
$mol_assert_not($mol_compare_deep({ a: 1 }, { b: 2 }));
|
|
1400
|
+
$mol_assert_not($mol_compare_deep({ a: 1 }, { a: 2 }));
|
|
1401
|
+
$mol_assert_not($mol_compare_deep({}, { a: undefined }));
|
|
1402
|
+
$mol_assert_ok($mol_compare_deep({ a: 1, b: 2 }, { b: 2, a: 1 }));
|
|
1403
|
+
$mol_assert_ok($mol_compare_deep({ a: { b: 1 } }, { a: { b: 1 } }));
|
|
1404
|
+
},
|
|
1405
|
+
'Array'() {
|
|
1406
|
+
$mol_assert_ok($mol_compare_deep([], []));
|
|
1407
|
+
$mol_assert_ok($mol_compare_deep([1, [2]], [1, [2]]));
|
|
1408
|
+
$mol_assert_not($mol_compare_deep([1, 2], [1, 3]));
|
|
1409
|
+
$mol_assert_not($mol_compare_deep([1, 2,], [1, 3, undefined]));
|
|
1410
|
+
},
|
|
1411
|
+
'Non POJO are different'() {
|
|
1412
|
+
class Thing extends Object {
|
|
1413
|
+
}
|
|
1414
|
+
$mol_assert_not($mol_compare_deep(new Thing, new Thing));
|
|
1415
|
+
$mol_assert_not($mol_compare_deep(() => 1, () => 1));
|
|
1416
|
+
$mol_assert_not($mol_compare_deep(new RangeError('Test error'), new RangeError('Test error')));
|
|
1417
|
+
},
|
|
1418
|
+
'same POJOs with cyclic reference'() {
|
|
1419
|
+
const a = { foo: {} };
|
|
1420
|
+
a['self'] = a;
|
|
1421
|
+
const b = { foo: {} };
|
|
1422
|
+
b['self'] = b;
|
|
1423
|
+
$mol_assert_ok($mol_compare_deep(a, b));
|
|
1424
|
+
},
|
|
1425
|
+
'Date'() {
|
|
1426
|
+
$mol_assert_ok($mol_compare_deep(new Date(12345), new Date(12345)));
|
|
1427
|
+
$mol_assert_not($mol_compare_deep(new Date(12345), new Date(12346)));
|
|
1428
|
+
},
|
|
1429
|
+
'RegExp'() {
|
|
1430
|
+
$mol_assert_ok($mol_compare_deep(/\x22/mig, /\x22/mig));
|
|
1431
|
+
$mol_assert_not($mol_compare_deep(/\x22/mig, /\x21/mig));
|
|
1432
|
+
$mol_assert_not($mol_compare_deep(/\x22/mig, /\x22/mg));
|
|
1433
|
+
},
|
|
1434
|
+
'Error'() {
|
|
1435
|
+
$mol_assert_not($mol_compare_deep(new Error('xxx'), new Error('xxx')));
|
|
1436
|
+
const fail = (message) => new Error(message);
|
|
1437
|
+
$mol_assert_ok($mol_compare_deep(...['xxx', 'xxx'].map(msg => new Error(msg))));
|
|
1438
|
+
$mol_assert_not($mol_compare_deep(...['xxx', 'yyy'].map(msg => new Error(msg))));
|
|
1439
|
+
},
|
|
1440
|
+
'Map'() {
|
|
1441
|
+
$mol_assert_ok($mol_compare_deep(new Map, new Map));
|
|
1442
|
+
$mol_assert_ok($mol_compare_deep(new Map([[1, [2]]]), new Map([[1, [2]]])));
|
|
1443
|
+
$mol_assert_ok($mol_compare_deep(new Map([[[1], 2]]), new Map([[[1], 2]])));
|
|
1444
|
+
$mol_assert_not($mol_compare_deep(new Map([[1, 2]]), new Map([[1, 3]])));
|
|
1445
|
+
$mol_assert_not($mol_compare_deep(new Map([[[1], 2]]), new Map([[[3], 2]])));
|
|
1446
|
+
},
|
|
1447
|
+
'Set'() {
|
|
1448
|
+
$mol_assert_ok($mol_compare_deep(new Set, new Set));
|
|
1449
|
+
$mol_assert_ok($mol_compare_deep(new Set([1, [2]]), new Set([1, [2]])));
|
|
1450
|
+
$mol_assert_not($mol_compare_deep(new Set([1]), new Set([2])));
|
|
1451
|
+
},
|
|
1452
|
+
'Uint8Array'() {
|
|
1453
|
+
$mol_assert_ok($mol_compare_deep(new Uint8Array, new Uint8Array));
|
|
1454
|
+
$mol_assert_ok($mol_compare_deep(new Uint8Array([0]), new Uint8Array([0])));
|
|
1455
|
+
$mol_assert_not($mol_compare_deep(new Uint8Array([0]), new Uint8Array([1])));
|
|
1456
|
+
},
|
|
1457
|
+
'Custom comparator'() {
|
|
1458
|
+
class User {
|
|
1459
|
+
name;
|
|
1460
|
+
rand;
|
|
1461
|
+
constructor(name, rand = Math.random()) {
|
|
1462
|
+
this.name = name;
|
|
1463
|
+
this.rand = rand;
|
|
1464
|
+
}
|
|
1465
|
+
[Symbol.toPrimitive](mode) {
|
|
1466
|
+
return this.name;
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
$mol_assert_ok($mol_compare_deep(new User('Jin'), new User('Jin')));
|
|
1470
|
+
$mol_assert_not($mol_compare_deep(new User('Jin'), new User('John')));
|
|
1471
|
+
},
|
|
1472
|
+
});
|
|
1473
|
+
})($ || ($ = {}));
|
|
1474
|
+
//mol/compare/deep/deep.test.tsx
|
|
1475
|
+
;
|
|
1476
|
+
"use strict";
|
|
1477
|
+
var $;
|
|
1478
1478
|
(function ($) {
|
|
1479
1479
|
function $mol_dom_serialize(node) {
|
|
1480
1480
|
const serializer = new $mol_dom_context.XMLSerializer;
|
|
@@ -1678,15 +1678,15 @@ var $;
|
|
|
1678
1678
|
//mol/owning/owning.ts
|
|
1679
1679
|
;
|
|
1680
1680
|
"use strict";
|
|
1681
|
-
//mol/type/writable/writable.ts
|
|
1682
|
-
;
|
|
1683
|
-
"use strict";
|
|
1684
1681
|
//mol/type/equals/equals.ts
|
|
1685
1682
|
;
|
|
1686
1683
|
"use strict";
|
|
1687
1684
|
//mol/type/equals/equals.test.ts
|
|
1688
1685
|
;
|
|
1689
1686
|
"use strict";
|
|
1687
|
+
//mol/type/writable/writable.ts
|
|
1688
|
+
;
|
|
1689
|
+
"use strict";
|
|
1690
1690
|
//mol/type/writable/writable.test.ts
|
|
1691
1691
|
;
|
|
1692
1692
|
"use strict";
|
|
@@ -1734,6 +1734,106 @@ var $;
|
|
|
1734
1734
|
;
|
|
1735
1735
|
"use strict";
|
|
1736
1736
|
var $;
|
|
1737
|
+
(function ($) {
|
|
1738
|
+
const instances = new WeakSet();
|
|
1739
|
+
function $mol_delegate(proto, target) {
|
|
1740
|
+
const proxy = new Proxy(proto, {
|
|
1741
|
+
get: (_, field) => {
|
|
1742
|
+
const obj = target();
|
|
1743
|
+
let val = Reflect.get(obj, field);
|
|
1744
|
+
if (typeof val === 'function') {
|
|
1745
|
+
val = val.bind(obj);
|
|
1746
|
+
}
|
|
1747
|
+
return val;
|
|
1748
|
+
},
|
|
1749
|
+
has: (_, field) => Reflect.has(target(), field),
|
|
1750
|
+
set: (_, field, value) => Reflect.set(target(), field, value),
|
|
1751
|
+
getOwnPropertyDescriptor: (_, field) => Reflect.getOwnPropertyDescriptor(target(), field),
|
|
1752
|
+
ownKeys: () => Reflect.ownKeys(target()),
|
|
1753
|
+
getPrototypeOf: () => Reflect.getPrototypeOf(target()),
|
|
1754
|
+
setPrototypeOf: (_, donor) => Reflect.setPrototypeOf(target(), donor),
|
|
1755
|
+
isExtensible: () => Reflect.isExtensible(target()),
|
|
1756
|
+
preventExtensions: () => Reflect.preventExtensions(target()),
|
|
1757
|
+
apply: (_, self, args) => Reflect.apply(target(), self, args),
|
|
1758
|
+
construct: (_, args, retarget) => Reflect.construct(target(), args, retarget),
|
|
1759
|
+
defineProperty: (_, field, descr) => Reflect.defineProperty(target(), field, descr),
|
|
1760
|
+
deleteProperty: (_, field) => Reflect.deleteProperty(target(), field),
|
|
1761
|
+
});
|
|
1762
|
+
instances.add(proxy);
|
|
1763
|
+
return proxy;
|
|
1764
|
+
}
|
|
1765
|
+
$.$mol_delegate = $mol_delegate;
|
|
1766
|
+
Reflect.defineProperty($mol_delegate, Symbol.hasInstance, {
|
|
1767
|
+
value: (obj) => instances.has(obj),
|
|
1768
|
+
});
|
|
1769
|
+
})($ || ($ = {}));
|
|
1770
|
+
//mol/delegate/delegate.ts
|
|
1771
|
+
;
|
|
1772
|
+
"use strict";
|
|
1773
|
+
var $;
|
|
1774
|
+
(function ($) {
|
|
1775
|
+
$mol_test({
|
|
1776
|
+
'get'() {
|
|
1777
|
+
const proxy = $mol_delegate({}, () => ({ foo: 777 }));
|
|
1778
|
+
$mol_assert_equal(proxy.foo, 777);
|
|
1779
|
+
},
|
|
1780
|
+
'has'() {
|
|
1781
|
+
const proxy = $mol_delegate({}, () => ({ foo: 777 }));
|
|
1782
|
+
$mol_assert_equal('foo' in proxy, true);
|
|
1783
|
+
},
|
|
1784
|
+
'set'() {
|
|
1785
|
+
const target = { foo: 777 };
|
|
1786
|
+
const proxy = $mol_delegate({}, () => target);
|
|
1787
|
+
proxy.foo = 123;
|
|
1788
|
+
$mol_assert_equal(target.foo, 123);
|
|
1789
|
+
},
|
|
1790
|
+
'getOwnPropertyDescriptor'() {
|
|
1791
|
+
const proxy = $mol_delegate({}, () => ({ foo: 777 }));
|
|
1792
|
+
$mol_assert_like(Object.getOwnPropertyDescriptor(proxy, 'foo'), {
|
|
1793
|
+
value: 777,
|
|
1794
|
+
writable: true,
|
|
1795
|
+
enumerable: true,
|
|
1796
|
+
configurable: true,
|
|
1797
|
+
});
|
|
1798
|
+
},
|
|
1799
|
+
'ownKeys'() {
|
|
1800
|
+
const proxy = $mol_delegate({}, () => ({ foo: 777, [Symbol.toStringTag]: 'bar' }));
|
|
1801
|
+
$mol_assert_like(Reflect.ownKeys(proxy), ['foo', Symbol.toStringTag]);
|
|
1802
|
+
},
|
|
1803
|
+
'getPrototypeOf'() {
|
|
1804
|
+
class Foo {
|
|
1805
|
+
}
|
|
1806
|
+
const proxy = $mol_delegate({}, () => new Foo);
|
|
1807
|
+
$mol_assert_equal(Object.getPrototypeOf(proxy), Foo.prototype);
|
|
1808
|
+
},
|
|
1809
|
+
'setPrototypeOf'() {
|
|
1810
|
+
class Foo {
|
|
1811
|
+
}
|
|
1812
|
+
const target = {};
|
|
1813
|
+
const proxy = $mol_delegate({}, () => target);
|
|
1814
|
+
Object.setPrototypeOf(proxy, Foo.prototype);
|
|
1815
|
+
$mol_assert_equal(Object.getPrototypeOf(target), Foo.prototype);
|
|
1816
|
+
},
|
|
1817
|
+
'instanceof'() {
|
|
1818
|
+
class Foo {
|
|
1819
|
+
}
|
|
1820
|
+
const proxy = $mol_delegate({}, () => new Foo);
|
|
1821
|
+
$mol_assert_ok(proxy instanceof Foo);
|
|
1822
|
+
$mol_assert_ok(proxy instanceof $mol_delegate);
|
|
1823
|
+
},
|
|
1824
|
+
'autobind'() {
|
|
1825
|
+
class Foo {
|
|
1826
|
+
}
|
|
1827
|
+
const proxy = $mol_delegate({}, () => new Foo);
|
|
1828
|
+
$mol_assert_ok(proxy instanceof Foo);
|
|
1829
|
+
$mol_assert_ok(proxy instanceof $mol_delegate);
|
|
1830
|
+
},
|
|
1831
|
+
});
|
|
1832
|
+
})($ || ($ = {}));
|
|
1833
|
+
//mol/delegate/delegate.test.ts
|
|
1834
|
+
;
|
|
1835
|
+
"use strict";
|
|
1836
|
+
var $;
|
|
1737
1837
|
(function ($) {
|
|
1738
1838
|
$.$mol_tree_convert = Symbol('$mol_tree_convert');
|
|
1739
1839
|
class $mol_tree extends $mol_object2 {
|
|
@@ -2064,106 +2164,6 @@ var $;
|
|
|
2064
2164
|
;
|
|
2065
2165
|
"use strict";
|
|
2066
2166
|
var $;
|
|
2067
|
-
(function ($) {
|
|
2068
|
-
const instances = new WeakSet();
|
|
2069
|
-
function $mol_delegate(proto, target) {
|
|
2070
|
-
const proxy = new Proxy(proto, {
|
|
2071
|
-
get: (_, field) => {
|
|
2072
|
-
const obj = target();
|
|
2073
|
-
let val = Reflect.get(obj, field);
|
|
2074
|
-
if (typeof val === 'function') {
|
|
2075
|
-
val = val.bind(obj);
|
|
2076
|
-
}
|
|
2077
|
-
return val;
|
|
2078
|
-
},
|
|
2079
|
-
has: (_, field) => Reflect.has(target(), field),
|
|
2080
|
-
set: (_, field, value) => Reflect.set(target(), field, value),
|
|
2081
|
-
getOwnPropertyDescriptor: (_, field) => Reflect.getOwnPropertyDescriptor(target(), field),
|
|
2082
|
-
ownKeys: () => Reflect.ownKeys(target()),
|
|
2083
|
-
getPrototypeOf: () => Reflect.getPrototypeOf(target()),
|
|
2084
|
-
setPrototypeOf: (_, donor) => Reflect.setPrototypeOf(target(), donor),
|
|
2085
|
-
isExtensible: () => Reflect.isExtensible(target()),
|
|
2086
|
-
preventExtensions: () => Reflect.preventExtensions(target()),
|
|
2087
|
-
apply: (_, self, args) => Reflect.apply(target(), self, args),
|
|
2088
|
-
construct: (_, args, retarget) => Reflect.construct(target(), args, retarget),
|
|
2089
|
-
defineProperty: (_, field, descr) => Reflect.defineProperty(target(), field, descr),
|
|
2090
|
-
deleteProperty: (_, field) => Reflect.deleteProperty(target(), field),
|
|
2091
|
-
});
|
|
2092
|
-
instances.add(proxy);
|
|
2093
|
-
return proxy;
|
|
2094
|
-
}
|
|
2095
|
-
$.$mol_delegate = $mol_delegate;
|
|
2096
|
-
Reflect.defineProperty($mol_delegate, Symbol.hasInstance, {
|
|
2097
|
-
value: (obj) => instances.has(obj),
|
|
2098
|
-
});
|
|
2099
|
-
})($ || ($ = {}));
|
|
2100
|
-
//mol/delegate/delegate.ts
|
|
2101
|
-
;
|
|
2102
|
-
"use strict";
|
|
2103
|
-
var $;
|
|
2104
|
-
(function ($) {
|
|
2105
|
-
$mol_test({
|
|
2106
|
-
'get'() {
|
|
2107
|
-
const proxy = $mol_delegate({}, () => ({ foo: 777 }));
|
|
2108
|
-
$mol_assert_equal(proxy.foo, 777);
|
|
2109
|
-
},
|
|
2110
|
-
'has'() {
|
|
2111
|
-
const proxy = $mol_delegate({}, () => ({ foo: 777 }));
|
|
2112
|
-
$mol_assert_equal('foo' in proxy, true);
|
|
2113
|
-
},
|
|
2114
|
-
'set'() {
|
|
2115
|
-
const target = { foo: 777 };
|
|
2116
|
-
const proxy = $mol_delegate({}, () => target);
|
|
2117
|
-
proxy.foo = 123;
|
|
2118
|
-
$mol_assert_equal(target.foo, 123);
|
|
2119
|
-
},
|
|
2120
|
-
'getOwnPropertyDescriptor'() {
|
|
2121
|
-
const proxy = $mol_delegate({}, () => ({ foo: 777 }));
|
|
2122
|
-
$mol_assert_like(Object.getOwnPropertyDescriptor(proxy, 'foo'), {
|
|
2123
|
-
value: 777,
|
|
2124
|
-
writable: true,
|
|
2125
|
-
enumerable: true,
|
|
2126
|
-
configurable: true,
|
|
2127
|
-
});
|
|
2128
|
-
},
|
|
2129
|
-
'ownKeys'() {
|
|
2130
|
-
const proxy = $mol_delegate({}, () => ({ foo: 777, [Symbol.toStringTag]: 'bar' }));
|
|
2131
|
-
$mol_assert_like(Reflect.ownKeys(proxy), ['foo', Symbol.toStringTag]);
|
|
2132
|
-
},
|
|
2133
|
-
'getPrototypeOf'() {
|
|
2134
|
-
class Foo {
|
|
2135
|
-
}
|
|
2136
|
-
const proxy = $mol_delegate({}, () => new Foo);
|
|
2137
|
-
$mol_assert_equal(Object.getPrototypeOf(proxy), Foo.prototype);
|
|
2138
|
-
},
|
|
2139
|
-
'setPrototypeOf'() {
|
|
2140
|
-
class Foo {
|
|
2141
|
-
}
|
|
2142
|
-
const target = {};
|
|
2143
|
-
const proxy = $mol_delegate({}, () => target);
|
|
2144
|
-
Object.setPrototypeOf(proxy, Foo.prototype);
|
|
2145
|
-
$mol_assert_equal(Object.getPrototypeOf(target), Foo.prototype);
|
|
2146
|
-
},
|
|
2147
|
-
'instanceof'() {
|
|
2148
|
-
class Foo {
|
|
2149
|
-
}
|
|
2150
|
-
const proxy = $mol_delegate({}, () => new Foo);
|
|
2151
|
-
$mol_assert_ok(proxy instanceof Foo);
|
|
2152
|
-
$mol_assert_ok(proxy instanceof $mol_delegate);
|
|
2153
|
-
},
|
|
2154
|
-
'autobind'() {
|
|
2155
|
-
class Foo {
|
|
2156
|
-
}
|
|
2157
|
-
const proxy = $mol_delegate({}, () => new Foo);
|
|
2158
|
-
$mol_assert_ok(proxy instanceof Foo);
|
|
2159
|
-
$mol_assert_ok(proxy instanceof $mol_delegate);
|
|
2160
|
-
},
|
|
2161
|
-
});
|
|
2162
|
-
})($ || ($ = {}));
|
|
2163
|
-
//mol/delegate/delegate.test.ts
|
|
2164
|
-
;
|
|
2165
|
-
"use strict";
|
|
2166
|
-
var $;
|
|
2167
2167
|
(function ($_1) {
|
|
2168
2168
|
$mol_test({
|
|
2169
2169
|
'tree parsing'() {
|