mol_key 0.0.392 → 0.0.394
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 +619 -619
- 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 +391 -391
- package/web.test.js.map +1 -1
package/web.test.js
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
function require( path ){ return $node[ path ] };
|
|
3
3
|
"use strict";
|
|
4
4
|
var $;
|
|
5
|
+
(function ($) {
|
|
6
|
+
})($ || ($ = {}));
|
|
7
|
+
//mol/dom/context/context.ts
|
|
8
|
+
;
|
|
9
|
+
"use strict";
|
|
10
|
+
var $;
|
|
11
|
+
(function ($) {
|
|
12
|
+
$.$mol_dom_context = self;
|
|
13
|
+
})($ || ($ = {}));
|
|
14
|
+
//mol/dom/context/context.web.ts
|
|
15
|
+
;
|
|
16
|
+
"use strict";
|
|
17
|
+
var $;
|
|
5
18
|
(function ($) {
|
|
6
19
|
function $mol_fail(error) {
|
|
7
20
|
throw error;
|
|
@@ -12,6 +25,76 @@ var $;
|
|
|
12
25
|
;
|
|
13
26
|
"use strict";
|
|
14
27
|
var $;
|
|
28
|
+
(function ($) {
|
|
29
|
+
function $mol_dom_render_children(el, childNodes) {
|
|
30
|
+
const node_set = new Set(childNodes);
|
|
31
|
+
let nextNode = el.firstChild;
|
|
32
|
+
for (let view of childNodes) {
|
|
33
|
+
if (view == null)
|
|
34
|
+
continue;
|
|
35
|
+
if (view instanceof $mol_dom_context.Node) {
|
|
36
|
+
while (true) {
|
|
37
|
+
if (!nextNode) {
|
|
38
|
+
el.appendChild(view);
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
if (nextNode == view) {
|
|
42
|
+
nextNode = nextNode.nextSibling;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
if (node_set.has(nextNode)) {
|
|
47
|
+
el.insertBefore(view, nextNode);
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
const nn = nextNode.nextSibling;
|
|
52
|
+
el.removeChild(nextNode);
|
|
53
|
+
nextNode = nn;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
if (nextNode && nextNode.nodeName === '#text') {
|
|
60
|
+
const str = String(view);
|
|
61
|
+
if (nextNode.nodeValue !== str)
|
|
62
|
+
nextNode.nodeValue = str;
|
|
63
|
+
nextNode = nextNode.nextSibling;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
const textNode = $mol_dom_context.document.createTextNode(String(view));
|
|
67
|
+
el.insertBefore(textNode, nextNode);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
while (nextNode) {
|
|
72
|
+
const currNode = nextNode;
|
|
73
|
+
nextNode = currNode.nextSibling;
|
|
74
|
+
el.removeChild(currNode);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
$.$mol_dom_render_children = $mol_dom_render_children;
|
|
78
|
+
})($ || ($ = {}));
|
|
79
|
+
//mol/dom/render/children/children.ts
|
|
80
|
+
;
|
|
81
|
+
"use strict";
|
|
82
|
+
//mol/type/error/error.ts
|
|
83
|
+
;
|
|
84
|
+
"use strict";
|
|
85
|
+
//mol/type/assert/assert.ts
|
|
86
|
+
;
|
|
87
|
+
"use strict";
|
|
88
|
+
//mol/type/assert/assert.test.ts
|
|
89
|
+
;
|
|
90
|
+
"use strict";
|
|
91
|
+
//mol/type/partial/deep/deep.ts
|
|
92
|
+
;
|
|
93
|
+
"use strict";
|
|
94
|
+
//mol/type/partial/deep/deep.test.ts
|
|
95
|
+
;
|
|
96
|
+
"use strict";
|
|
97
|
+
var $;
|
|
15
98
|
(function ($) {
|
|
16
99
|
function $mol_fail_hidden(error) {
|
|
17
100
|
throw error;
|
|
@@ -118,19 +201,6 @@ var $;
|
|
|
118
201
|
;
|
|
119
202
|
"use strict";
|
|
120
203
|
var $;
|
|
121
|
-
(function ($) {
|
|
122
|
-
})($ || ($ = {}));
|
|
123
|
-
//mol/dom/context/context.ts
|
|
124
|
-
;
|
|
125
|
-
"use strict";
|
|
126
|
-
var $;
|
|
127
|
-
(function ($) {
|
|
128
|
-
$.$mol_dom_context = self;
|
|
129
|
-
})($ || ($ = {}));
|
|
130
|
-
//mol/dom/context/context.web.ts
|
|
131
|
-
;
|
|
132
|
-
"use strict";
|
|
133
|
-
var $;
|
|
134
204
|
(function ($) {
|
|
135
205
|
function $mol_dom_serialize(node) {
|
|
136
206
|
const serializer = new $mol_dom_context.XMLSerializer;
|
|
@@ -269,197 +339,123 @@ var $;
|
|
|
269
339
|
"use strict";
|
|
270
340
|
var $;
|
|
271
341
|
(function ($) {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
342
|
+
$.$mol_jsx_prefix = '';
|
|
343
|
+
$.$mol_jsx_crumbs = '';
|
|
344
|
+
$.$mol_jsx_booked = null;
|
|
345
|
+
$.$mol_jsx_document = {
|
|
346
|
+
getElementById: () => null,
|
|
347
|
+
createElementNS: (space, name) => $mol_dom_context.document.createElementNS(space, name),
|
|
348
|
+
createDocumentFragment: () => $mol_dom_context.document.createDocumentFragment(),
|
|
349
|
+
};
|
|
350
|
+
$.$mol_jsx_frag = '';
|
|
351
|
+
function $mol_jsx(Elem, props, ...childNodes) {
|
|
352
|
+
const id = props && props.id || '';
|
|
353
|
+
const guid = id ? $.$mol_jsx_prefix ? $.$mol_jsx_prefix + '/' + id : id : $.$mol_jsx_prefix;
|
|
354
|
+
const crumbs_self = id ? $.$mol_jsx_crumbs.replace(/(\S+)/g, `$1_${id.replace(/\/.*/i, '')}`) : $.$mol_jsx_crumbs;
|
|
355
|
+
if (Elem && $.$mol_jsx_booked) {
|
|
356
|
+
if ($.$mol_jsx_booked.has(id)) {
|
|
357
|
+
$mol_fail(new Error(`JSX already has tag with id ${JSON.stringify(guid)}`));
|
|
358
|
+
}
|
|
359
|
+
else {
|
|
360
|
+
$.$mol_jsx_booked.add(id);
|
|
286
361
|
}
|
|
287
|
-
catch { }
|
|
288
362
|
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
;
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
$mol_assert_equal($$.$mol_func_name_test.name, '');
|
|
308
|
-
$mol_assert_equal($$.$mol_func_name($$.$mol_func_name_test), '$mol_func_name_test');
|
|
309
|
-
$mol_assert_equal($$.$mol_func_name_test.name, '$mol_func_name_test');
|
|
310
|
-
},
|
|
311
|
-
});
|
|
312
|
-
})($ || ($ = {}));
|
|
313
|
-
//mol/func/name/name.test.ts
|
|
314
|
-
;
|
|
315
|
-
"use strict";
|
|
316
|
-
var $;
|
|
317
|
-
(function ($) {
|
|
318
|
-
function $mol_dom_render_children(el, childNodes) {
|
|
319
|
-
const node_set = new Set(childNodes);
|
|
320
|
-
let nextNode = el.firstChild;
|
|
321
|
-
for (let view of childNodes) {
|
|
322
|
-
if (view == null)
|
|
323
|
-
continue;
|
|
324
|
-
if (view instanceof $mol_dom_context.Node) {
|
|
325
|
-
while (true) {
|
|
326
|
-
if (!nextNode) {
|
|
327
|
-
el.appendChild(view);
|
|
328
|
-
break;
|
|
329
|
-
}
|
|
330
|
-
if (nextNode == view) {
|
|
331
|
-
nextNode = nextNode.nextSibling;
|
|
332
|
-
break;
|
|
363
|
+
let node = guid ? $.$mol_jsx_document.getElementById(guid) : null;
|
|
364
|
+
if ($.$mol_jsx_prefix) {
|
|
365
|
+
const prefix_ext = $.$mol_jsx_prefix;
|
|
366
|
+
const booked_ext = $.$mol_jsx_booked;
|
|
367
|
+
const crumbs_ext = $.$mol_jsx_crumbs;
|
|
368
|
+
for (const field in props) {
|
|
369
|
+
const func = props[field];
|
|
370
|
+
if (typeof func !== 'function')
|
|
371
|
+
continue;
|
|
372
|
+
const wrapper = function (...args) {
|
|
373
|
+
const prefix = $.$mol_jsx_prefix;
|
|
374
|
+
const booked = $.$mol_jsx_booked;
|
|
375
|
+
const crumbs = $.$mol_jsx_crumbs;
|
|
376
|
+
try {
|
|
377
|
+
$.$mol_jsx_prefix = prefix_ext;
|
|
378
|
+
$.$mol_jsx_booked = booked_ext;
|
|
379
|
+
$.$mol_jsx_crumbs = crumbs_ext;
|
|
380
|
+
return func.call(this, ...args);
|
|
333
381
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
}
|
|
339
|
-
else {
|
|
340
|
-
const nn = nextNode.nextSibling;
|
|
341
|
-
el.removeChild(nextNode);
|
|
342
|
-
nextNode = nn;
|
|
343
|
-
}
|
|
382
|
+
finally {
|
|
383
|
+
$.$mol_jsx_prefix = prefix;
|
|
384
|
+
$.$mol_jsx_booked = booked;
|
|
385
|
+
$.$mol_jsx_crumbs = crumbs;
|
|
344
386
|
}
|
|
345
|
-
}
|
|
387
|
+
};
|
|
388
|
+
$mol_func_name_from(wrapper, func);
|
|
389
|
+
props[field] = wrapper;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
if (typeof Elem !== 'string') {
|
|
393
|
+
if ('prototype' in Elem) {
|
|
394
|
+
const view = node && node[Elem] || new Elem;
|
|
395
|
+
Object.assign(view, props);
|
|
396
|
+
view[Symbol.toStringTag] = guid;
|
|
397
|
+
view.childNodes = childNodes;
|
|
398
|
+
if (!view.ownerDocument)
|
|
399
|
+
view.ownerDocument = $.$mol_jsx_document;
|
|
400
|
+
view.className = (crumbs_self ? crumbs_self + ' ' : '') + (Elem['name'] || Elem);
|
|
401
|
+
node = view.valueOf();
|
|
402
|
+
node[Elem] = view;
|
|
403
|
+
return node;
|
|
346
404
|
}
|
|
347
405
|
else {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
406
|
+
const prefix = $.$mol_jsx_prefix;
|
|
407
|
+
const booked = $.$mol_jsx_booked;
|
|
408
|
+
const crumbs = $.$mol_jsx_crumbs;
|
|
409
|
+
try {
|
|
410
|
+
$.$mol_jsx_prefix = guid;
|
|
411
|
+
$.$mol_jsx_booked = new Set;
|
|
412
|
+
$.$mol_jsx_crumbs = (crumbs_self ? crumbs_self + ' ' : '') + (Elem['name'] || Elem);
|
|
413
|
+
return Elem(props, ...childNodes);
|
|
353
414
|
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
415
|
+
finally {
|
|
416
|
+
$.$mol_jsx_prefix = prefix;
|
|
417
|
+
$.$mol_jsx_booked = booked;
|
|
418
|
+
$.$mol_jsx_crumbs = crumbs;
|
|
357
419
|
}
|
|
358
420
|
}
|
|
359
421
|
}
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
422
|
+
if (!node) {
|
|
423
|
+
node = Elem
|
|
424
|
+
? $.$mol_jsx_document.createElementNS(props?.xmlns ?? 'http://www.w3.org/1999/xhtml', Elem)
|
|
425
|
+
: $.$mol_jsx_document.createDocumentFragment();
|
|
364
426
|
}
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
;
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
;
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
;
|
|
376
|
-
|
|
377
|
-
//mol/type/assert/assert.ts
|
|
378
|
-
;
|
|
379
|
-
"use strict";
|
|
380
|
-
//mol/type/assert/assert.test.ts
|
|
381
|
-
;
|
|
382
|
-
"use strict";
|
|
383
|
-
//mol/type/equals/equals.ts
|
|
384
|
-
;
|
|
385
|
-
"use strict";
|
|
386
|
-
//mol/type/equals/equals.test.ts
|
|
387
|
-
;
|
|
388
|
-
"use strict";
|
|
389
|
-
//mol/type/partial/deep/deep.test.ts
|
|
390
|
-
;
|
|
391
|
-
"use strict";
|
|
392
|
-
var $;
|
|
393
|
-
(function ($) {
|
|
394
|
-
function $mol_log3_area_lazy(event) {
|
|
395
|
-
const self = this;
|
|
396
|
-
const stack = self.$mol_log3_stack;
|
|
397
|
-
const deep = stack.length;
|
|
398
|
-
let logged = false;
|
|
399
|
-
stack.push(() => {
|
|
400
|
-
logged = true;
|
|
401
|
-
self.$mol_log3_area.call(self, event);
|
|
402
|
-
});
|
|
403
|
-
return () => {
|
|
404
|
-
if (logged)
|
|
405
|
-
self.console.groupEnd();
|
|
406
|
-
if (stack.length > deep)
|
|
407
|
-
stack.length = deep;
|
|
408
|
-
};
|
|
409
|
-
}
|
|
410
|
-
$.$mol_log3_area_lazy = $mol_log3_area_lazy;
|
|
411
|
-
$.$mol_log3_stack = [];
|
|
412
|
-
})($ || ($ = {}));
|
|
413
|
-
//mol/log3/log3.ts
|
|
414
|
-
;
|
|
415
|
-
"use strict";
|
|
416
|
-
//mol/type/keys/extract/extract.ts
|
|
417
|
-
;
|
|
418
|
-
"use strict";
|
|
419
|
-
//mol/type/keys/extract/extract.test.ts
|
|
420
|
-
;
|
|
421
|
-
"use strict";
|
|
422
|
-
var $;
|
|
423
|
-
(function ($_1) {
|
|
424
|
-
$mol_test_mocks.push($ => {
|
|
425
|
-
$.$mol_log3_come = () => { };
|
|
426
|
-
$.$mol_log3_done = () => { };
|
|
427
|
-
$.$mol_log3_fail = () => { };
|
|
428
|
-
$.$mol_log3_warn = () => { };
|
|
429
|
-
$.$mol_log3_rise = () => { };
|
|
430
|
-
$.$mol_log3_area = () => () => { };
|
|
431
|
-
});
|
|
432
|
-
})($ || ($ = {}));
|
|
433
|
-
//mol/log3/log3.test.ts
|
|
434
|
-
;
|
|
435
|
-
"use strict";
|
|
436
|
-
var $;
|
|
437
|
-
(function ($) {
|
|
438
|
-
function $mol_log3_web_make(level, color) {
|
|
439
|
-
return function $mol_log3_logger(event) {
|
|
440
|
-
const pending = this.$mol_log3_stack.pop();
|
|
441
|
-
if (pending)
|
|
442
|
-
pending();
|
|
443
|
-
let tpl = '%c';
|
|
444
|
-
const chunks = Object.values(event);
|
|
445
|
-
for (let i = 0; i < chunks.length; ++i) {
|
|
446
|
-
tpl += (typeof chunks[i] === 'string') ? ' ⦙ %s' : ' ⦙ %o';
|
|
427
|
+
$mol_dom_render_children(node, [].concat(...childNodes));
|
|
428
|
+
if (!Elem)
|
|
429
|
+
return node;
|
|
430
|
+
if (guid)
|
|
431
|
+
node.id = guid;
|
|
432
|
+
for (const key in props) {
|
|
433
|
+
if (key === 'id')
|
|
434
|
+
continue;
|
|
435
|
+
if (typeof props[key] === 'string') {
|
|
436
|
+
if (typeof node[key] === 'string')
|
|
437
|
+
node[key] = props[key];
|
|
438
|
+
node.setAttribute(key, props[key]);
|
|
447
439
|
}
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
440
|
+
else if (props[key] &&
|
|
441
|
+
typeof props[key] === 'object' &&
|
|
442
|
+
Reflect.getPrototypeOf(props[key]) === Reflect.getPrototypeOf({})) {
|
|
443
|
+
if (typeof node[key] === 'object') {
|
|
444
|
+
Object.assign(node[key], props[key]);
|
|
445
|
+
continue;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
else {
|
|
449
|
+
node[key] = props[key];
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
if ($.$mol_jsx_crumbs)
|
|
453
|
+
node.className = (props?.['class'] ? props['class'] + ' ' : '') + crumbs_self;
|
|
454
|
+
return node;
|
|
453
455
|
}
|
|
454
|
-
$.$
|
|
455
|
-
$.$mol_log3_come = $mol_log3_web_make('info', 'royalblue');
|
|
456
|
-
$.$mol_log3_done = $mol_log3_web_make('info', 'forestgreen');
|
|
457
|
-
$.$mol_log3_fail = $mol_log3_web_make('error', 'orangered');
|
|
458
|
-
$.$mol_log3_warn = $mol_log3_web_make('warn', 'goldenrod');
|
|
459
|
-
$.$mol_log3_rise = $mol_log3_web_make('log', 'magenta');
|
|
460
|
-
$.$mol_log3_area = $mol_log3_web_make('group', 'cyan');
|
|
456
|
+
$.$mol_jsx = $mol_jsx;
|
|
461
457
|
})($ || ($ = {}));
|
|
462
|
-
//mol/
|
|
458
|
+
//mol/jsx/jsx.ts
|
|
463
459
|
;
|
|
464
460
|
"use strict";
|
|
465
461
|
var $;
|
|
@@ -554,219 +550,127 @@ var $;
|
|
|
554
550
|
"use strict";
|
|
555
551
|
var $;
|
|
556
552
|
(function ($) {
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
};
|
|
603
|
-
$mol_func_name_from(wrapper, func);
|
|
604
|
-
props[field] = wrapper;
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
if (typeof Elem !== 'string') {
|
|
608
|
-
if ('prototype' in Elem) {
|
|
609
|
-
const view = node && node[Elem] || new Elem;
|
|
610
|
-
Object.assign(view, props);
|
|
611
|
-
view[Symbol.toStringTag] = guid;
|
|
612
|
-
view.childNodes = childNodes;
|
|
613
|
-
if (!view.ownerDocument)
|
|
614
|
-
view.ownerDocument = $.$mol_jsx_document;
|
|
615
|
-
view.className = (crumbs_self ? crumbs_self + ' ' : '') + (Elem['name'] || Elem);
|
|
616
|
-
node = view.valueOf();
|
|
617
|
-
node[Elem] = view;
|
|
618
|
-
return node;
|
|
619
|
-
}
|
|
620
|
-
else {
|
|
621
|
-
const prefix = $.$mol_jsx_prefix;
|
|
622
|
-
const booked = $.$mol_jsx_booked;
|
|
623
|
-
const crumbs = $.$mol_jsx_crumbs;
|
|
624
|
-
try {
|
|
625
|
-
$.$mol_jsx_prefix = guid;
|
|
626
|
-
$.$mol_jsx_booked = new Set;
|
|
627
|
-
$.$mol_jsx_crumbs = (crumbs_self ? crumbs_self + ' ' : '') + (Elem['name'] || Elem);
|
|
628
|
-
return Elem(props, ...childNodes);
|
|
629
|
-
}
|
|
630
|
-
finally {
|
|
631
|
-
$.$mol_jsx_prefix = prefix;
|
|
632
|
-
$.$mol_jsx_booked = booked;
|
|
633
|
-
$.$mol_jsx_crumbs = crumbs;
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
if (!node) {
|
|
638
|
-
node = Elem
|
|
639
|
-
? $.$mol_jsx_document.createElementNS(props?.xmlns ?? 'http://www.w3.org/1999/xhtml', Elem)
|
|
640
|
-
: $.$mol_jsx_document.createDocumentFragment();
|
|
641
|
-
}
|
|
642
|
-
$mol_dom_render_children(node, [].concat(...childNodes));
|
|
643
|
-
if (!Elem)
|
|
644
|
-
return node;
|
|
645
|
-
if (guid)
|
|
646
|
-
node.id = guid;
|
|
647
|
-
for (const key in props) {
|
|
648
|
-
if (key === 'id')
|
|
649
|
-
continue;
|
|
650
|
-
if (typeof props[key] === 'string') {
|
|
651
|
-
if (typeof node[key] === 'string')
|
|
652
|
-
node[key] = props[key];
|
|
653
|
-
node.setAttribute(key, props[key]);
|
|
654
|
-
}
|
|
655
|
-
else if (props[key] &&
|
|
656
|
-
typeof props[key] === 'object' &&
|
|
657
|
-
Reflect.getPrototypeOf(props[key]) === Reflect.getPrototypeOf({})) {
|
|
658
|
-
if (typeof node[key] === 'object') {
|
|
659
|
-
Object.assign(node[key], props[key]);
|
|
660
|
-
continue;
|
|
661
|
-
}
|
|
553
|
+
function $mol_log3_area_lazy(event) {
|
|
554
|
+
const self = this;
|
|
555
|
+
const stack = self.$mol_log3_stack;
|
|
556
|
+
const deep = stack.length;
|
|
557
|
+
let logged = false;
|
|
558
|
+
stack.push(() => {
|
|
559
|
+
logged = true;
|
|
560
|
+
self.$mol_log3_area.call(self, event);
|
|
561
|
+
});
|
|
562
|
+
return () => {
|
|
563
|
+
if (logged)
|
|
564
|
+
self.console.groupEnd();
|
|
565
|
+
if (stack.length > deep)
|
|
566
|
+
stack.length = deep;
|
|
567
|
+
};
|
|
568
|
+
}
|
|
569
|
+
$.$mol_log3_area_lazy = $mol_log3_area_lazy;
|
|
570
|
+
$.$mol_log3_stack = [];
|
|
571
|
+
})($ || ($ = {}));
|
|
572
|
+
//mol/log3/log3.ts
|
|
573
|
+
;
|
|
574
|
+
"use strict";
|
|
575
|
+
//mol/type/equals/equals.ts
|
|
576
|
+
;
|
|
577
|
+
"use strict";
|
|
578
|
+
//mol/type/equals/equals.test.ts
|
|
579
|
+
;
|
|
580
|
+
"use strict";
|
|
581
|
+
//mol/type/keys/extract/extract.ts
|
|
582
|
+
;
|
|
583
|
+
"use strict";
|
|
584
|
+
//mol/type/keys/extract/extract.test.ts
|
|
585
|
+
;
|
|
586
|
+
"use strict";
|
|
587
|
+
var $;
|
|
588
|
+
(function ($) {
|
|
589
|
+
function $mol_log3_web_make(level, color) {
|
|
590
|
+
return function $mol_log3_logger(event) {
|
|
591
|
+
const pending = this.$mol_log3_stack.pop();
|
|
592
|
+
if (pending)
|
|
593
|
+
pending();
|
|
594
|
+
let tpl = '%c';
|
|
595
|
+
const chunks = Object.values(event);
|
|
596
|
+
for (let i = 0; i < chunks.length; ++i) {
|
|
597
|
+
tpl += (typeof chunks[i] === 'string') ? ' ⦙ %s' : ' ⦙ %o';
|
|
662
598
|
}
|
|
663
|
-
|
|
664
|
-
|
|
599
|
+
const style = `color:${color};font-weight:bolder`;
|
|
600
|
+
this.console[level](tpl, style, ...chunks);
|
|
601
|
+
const self = this;
|
|
602
|
+
return () => self.console.groupEnd();
|
|
603
|
+
};
|
|
604
|
+
}
|
|
605
|
+
$.$mol_log3_web_make = $mol_log3_web_make;
|
|
606
|
+
$.$mol_log3_come = $mol_log3_web_make('info', 'royalblue');
|
|
607
|
+
$.$mol_log3_done = $mol_log3_web_make('info', 'forestgreen');
|
|
608
|
+
$.$mol_log3_fail = $mol_log3_web_make('error', 'orangered');
|
|
609
|
+
$.$mol_log3_warn = $mol_log3_web_make('warn', 'goldenrod');
|
|
610
|
+
$.$mol_log3_rise = $mol_log3_web_make('log', 'magenta');
|
|
611
|
+
$.$mol_log3_area = $mol_log3_web_make('group', 'cyan');
|
|
612
|
+
})($ || ($ = {}));
|
|
613
|
+
//mol/log3/log3.web.ts
|
|
614
|
+
;
|
|
615
|
+
"use strict";
|
|
616
|
+
var $;
|
|
617
|
+
(function ($_1) {
|
|
618
|
+
$mol_test_mocks.push($ => {
|
|
619
|
+
$.$mol_log3_come = () => { };
|
|
620
|
+
$.$mol_log3_done = () => { };
|
|
621
|
+
$.$mol_log3_fail = () => { };
|
|
622
|
+
$.$mol_log3_warn = () => { };
|
|
623
|
+
$.$mol_log3_rise = () => { };
|
|
624
|
+
$.$mol_log3_area = () => () => { };
|
|
625
|
+
});
|
|
626
|
+
})($ || ($ = {}));
|
|
627
|
+
//mol/log3/log3.test.ts
|
|
628
|
+
;
|
|
629
|
+
"use strict";
|
|
630
|
+
var $;
|
|
631
|
+
(function ($) {
|
|
632
|
+
const named = new WeakSet();
|
|
633
|
+
function $mol_func_name(func) {
|
|
634
|
+
let name = func.name;
|
|
635
|
+
if (name?.length > 1)
|
|
636
|
+
return name;
|
|
637
|
+
if (named.has(func))
|
|
638
|
+
return name;
|
|
639
|
+
for (let key in this) {
|
|
640
|
+
try {
|
|
641
|
+
if (this[key] !== func)
|
|
642
|
+
continue;
|
|
643
|
+
name = key;
|
|
644
|
+
Object.defineProperty(func, 'name', { value: name });
|
|
645
|
+
break;
|
|
665
646
|
}
|
|
647
|
+
catch { }
|
|
666
648
|
}
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
return node;
|
|
649
|
+
named.add(func);
|
|
650
|
+
return name;
|
|
670
651
|
}
|
|
671
|
-
$.$
|
|
652
|
+
$.$mol_func_name = $mol_func_name;
|
|
653
|
+
function $mol_func_name_from(target, source) {
|
|
654
|
+
Object.defineProperty(target, 'name', { value: source.name });
|
|
655
|
+
return target;
|
|
656
|
+
}
|
|
657
|
+
$.$mol_func_name_from = $mol_func_name_from;
|
|
672
658
|
})($ || ($ = {}));
|
|
673
|
-
//mol/
|
|
659
|
+
//mol/func/name/name.ts
|
|
674
660
|
;
|
|
675
661
|
"use strict";
|
|
676
662
|
var $;
|
|
677
|
-
(function ($) {
|
|
663
|
+
(function ($_1) {
|
|
678
664
|
$mol_test({
|
|
679
|
-
'
|
|
680
|
-
|
|
681
|
-
$
|
|
682
|
-
$
|
|
683
|
-
$
|
|
684
|
-
},
|
|
685
|
-
'number'() {
|
|
686
|
-
$mol_assert_ok($mol_compare_deep(1, 1));
|
|
687
|
-
$mol_assert_ok($mol_compare_deep(Number.NaN, Number.NaN));
|
|
688
|
-
$mol_assert_not($mol_compare_deep(1, 2));
|
|
689
|
-
$mol_assert_ok($mol_compare_deep(Object(1), Object(1)));
|
|
690
|
-
$mol_assert_not($mol_compare_deep(Object(1), Object(2)));
|
|
691
|
-
},
|
|
692
|
-
'POJO'() {
|
|
693
|
-
$mol_assert_ok($mol_compare_deep({}, {}));
|
|
694
|
-
$mol_assert_not($mol_compare_deep({ a: 1 }, { b: 2 }));
|
|
695
|
-
$mol_assert_not($mol_compare_deep({ a: 1 }, { a: 2 }));
|
|
696
|
-
$mol_assert_not($mol_compare_deep({}, { a: undefined }));
|
|
697
|
-
$mol_assert_ok($mol_compare_deep({ a: 1, b: 2 }, { b: 2, a: 1 }));
|
|
698
|
-
$mol_assert_ok($mol_compare_deep({ a: { b: 1 } }, { a: { b: 1 } }));
|
|
699
|
-
},
|
|
700
|
-
'Array'() {
|
|
701
|
-
$mol_assert_ok($mol_compare_deep([], []));
|
|
702
|
-
$mol_assert_ok($mol_compare_deep([1, [2]], [1, [2]]));
|
|
703
|
-
$mol_assert_not($mol_compare_deep([1, 2], [1, 3]));
|
|
704
|
-
$mol_assert_not($mol_compare_deep([1, 2,], [1, 3, undefined]));
|
|
705
|
-
},
|
|
706
|
-
'Non POJO are different'() {
|
|
707
|
-
class Thing extends Object {
|
|
708
|
-
}
|
|
709
|
-
$mol_assert_not($mol_compare_deep(new Thing, new Thing));
|
|
710
|
-
$mol_assert_not($mol_compare_deep(() => 1, () => 1));
|
|
711
|
-
$mol_assert_not($mol_compare_deep(new RangeError('Test error'), new RangeError('Test error')));
|
|
712
|
-
},
|
|
713
|
-
'same POJOs with cyclic reference'() {
|
|
714
|
-
const a = { foo: {} };
|
|
715
|
-
a['self'] = a;
|
|
716
|
-
const b = { foo: {} };
|
|
717
|
-
b['self'] = b;
|
|
718
|
-
$mol_assert_ok($mol_compare_deep(a, b));
|
|
719
|
-
},
|
|
720
|
-
'Date'() {
|
|
721
|
-
$mol_assert_ok($mol_compare_deep(new Date(12345), new Date(12345)));
|
|
722
|
-
$mol_assert_not($mol_compare_deep(new Date(12345), new Date(12346)));
|
|
723
|
-
},
|
|
724
|
-
'RegExp'() {
|
|
725
|
-
$mol_assert_ok($mol_compare_deep(/\x22/mig, /\x22/mig));
|
|
726
|
-
$mol_assert_not($mol_compare_deep(/\x22/mig, /\x21/mig));
|
|
727
|
-
$mol_assert_not($mol_compare_deep(/\x22/mig, /\x22/mg));
|
|
728
|
-
},
|
|
729
|
-
'Error'() {
|
|
730
|
-
$mol_assert_not($mol_compare_deep(new Error('xxx'), new Error('xxx')));
|
|
731
|
-
const fail = (message) => new Error(message);
|
|
732
|
-
$mol_assert_ok($mol_compare_deep(...['xxx', 'xxx'].map(msg => new Error(msg))));
|
|
733
|
-
$mol_assert_not($mol_compare_deep(...['xxx', 'yyy'].map(msg => new Error(msg))));
|
|
734
|
-
},
|
|
735
|
-
'Map'() {
|
|
736
|
-
$mol_assert_ok($mol_compare_deep(new Map, new Map));
|
|
737
|
-
$mol_assert_ok($mol_compare_deep(new Map([[1, [2]]]), new Map([[1, [2]]])));
|
|
738
|
-
$mol_assert_ok($mol_compare_deep(new Map([[[1], 2]]), new Map([[[1], 2]])));
|
|
739
|
-
$mol_assert_not($mol_compare_deep(new Map([[1, 2]]), new Map([[1, 3]])));
|
|
740
|
-
$mol_assert_not($mol_compare_deep(new Map([[[1], 2]]), new Map([[[3], 2]])));
|
|
741
|
-
},
|
|
742
|
-
'Set'() {
|
|
743
|
-
$mol_assert_ok($mol_compare_deep(new Set, new Set));
|
|
744
|
-
$mol_assert_ok($mol_compare_deep(new Set([1, [2]]), new Set([1, [2]])));
|
|
745
|
-
$mol_assert_not($mol_compare_deep(new Set([1]), new Set([2])));
|
|
746
|
-
},
|
|
747
|
-
'Uint8Array'() {
|
|
748
|
-
$mol_assert_ok($mol_compare_deep(new Uint8Array, new Uint8Array));
|
|
749
|
-
$mol_assert_ok($mol_compare_deep(new Uint8Array([0]), new Uint8Array([0])));
|
|
750
|
-
$mol_assert_not($mol_compare_deep(new Uint8Array([0]), new Uint8Array([1])));
|
|
751
|
-
},
|
|
752
|
-
'Custom comparator'() {
|
|
753
|
-
class User {
|
|
754
|
-
name;
|
|
755
|
-
rand;
|
|
756
|
-
constructor(name, rand = Math.random()) {
|
|
757
|
-
this.name = name;
|
|
758
|
-
this.rand = rand;
|
|
759
|
-
}
|
|
760
|
-
[Symbol.toPrimitive](mode) {
|
|
761
|
-
return this.name;
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
$mol_assert_ok($mol_compare_deep(new User('Jin'), new User('Jin')));
|
|
765
|
-
$mol_assert_not($mol_compare_deep(new User('Jin'), new User('John')));
|
|
665
|
+
'FQN of anon function'($) {
|
|
666
|
+
const $$ = Object.assign($, { $mol_func_name_test: (() => () => { })() });
|
|
667
|
+
$mol_assert_equal($$.$mol_func_name_test.name, '');
|
|
668
|
+
$mol_assert_equal($$.$mol_func_name($$.$mol_func_name_test), '$mol_func_name_test');
|
|
669
|
+
$mol_assert_equal($$.$mol_func_name_test.name, '$mol_func_name_test');
|
|
766
670
|
},
|
|
767
671
|
});
|
|
768
672
|
})($ || ($ = {}));
|
|
769
|
-
//mol/
|
|
673
|
+
//mol/func/name/name.test.ts
|
|
770
674
|
;
|
|
771
675
|
"use strict";
|
|
772
676
|
var $;
|
|
@@ -895,6 +799,102 @@ var $;
|
|
|
895
799
|
;
|
|
896
800
|
"use strict";
|
|
897
801
|
var $;
|
|
802
|
+
(function ($) {
|
|
803
|
+
$mol_test({
|
|
804
|
+
'nulls & undefineds'() {
|
|
805
|
+
$mol_assert_ok($mol_compare_deep(null, null));
|
|
806
|
+
$mol_assert_ok($mol_compare_deep(undefined, undefined));
|
|
807
|
+
$mol_assert_not($mol_compare_deep(undefined, null));
|
|
808
|
+
$mol_assert_not($mol_compare_deep({}, null));
|
|
809
|
+
},
|
|
810
|
+
'number'() {
|
|
811
|
+
$mol_assert_ok($mol_compare_deep(1, 1));
|
|
812
|
+
$mol_assert_ok($mol_compare_deep(Number.NaN, Number.NaN));
|
|
813
|
+
$mol_assert_not($mol_compare_deep(1, 2));
|
|
814
|
+
$mol_assert_ok($mol_compare_deep(Object(1), Object(1)));
|
|
815
|
+
$mol_assert_not($mol_compare_deep(Object(1), Object(2)));
|
|
816
|
+
},
|
|
817
|
+
'POJO'() {
|
|
818
|
+
$mol_assert_ok($mol_compare_deep({}, {}));
|
|
819
|
+
$mol_assert_not($mol_compare_deep({ a: 1 }, { b: 2 }));
|
|
820
|
+
$mol_assert_not($mol_compare_deep({ a: 1 }, { a: 2 }));
|
|
821
|
+
$mol_assert_not($mol_compare_deep({}, { a: undefined }));
|
|
822
|
+
$mol_assert_ok($mol_compare_deep({ a: 1, b: 2 }, { b: 2, a: 1 }));
|
|
823
|
+
$mol_assert_ok($mol_compare_deep({ a: { b: 1 } }, { a: { b: 1 } }));
|
|
824
|
+
},
|
|
825
|
+
'Array'() {
|
|
826
|
+
$mol_assert_ok($mol_compare_deep([], []));
|
|
827
|
+
$mol_assert_ok($mol_compare_deep([1, [2]], [1, [2]]));
|
|
828
|
+
$mol_assert_not($mol_compare_deep([1, 2], [1, 3]));
|
|
829
|
+
$mol_assert_not($mol_compare_deep([1, 2,], [1, 3, undefined]));
|
|
830
|
+
},
|
|
831
|
+
'Non POJO are different'() {
|
|
832
|
+
class Thing extends Object {
|
|
833
|
+
}
|
|
834
|
+
$mol_assert_not($mol_compare_deep(new Thing, new Thing));
|
|
835
|
+
$mol_assert_not($mol_compare_deep(() => 1, () => 1));
|
|
836
|
+
$mol_assert_not($mol_compare_deep(new RangeError('Test error'), new RangeError('Test error')));
|
|
837
|
+
},
|
|
838
|
+
'same POJOs with cyclic reference'() {
|
|
839
|
+
const a = { foo: {} };
|
|
840
|
+
a['self'] = a;
|
|
841
|
+
const b = { foo: {} };
|
|
842
|
+
b['self'] = b;
|
|
843
|
+
$mol_assert_ok($mol_compare_deep(a, b));
|
|
844
|
+
},
|
|
845
|
+
'Date'() {
|
|
846
|
+
$mol_assert_ok($mol_compare_deep(new Date(12345), new Date(12345)));
|
|
847
|
+
$mol_assert_not($mol_compare_deep(new Date(12345), new Date(12346)));
|
|
848
|
+
},
|
|
849
|
+
'RegExp'() {
|
|
850
|
+
$mol_assert_ok($mol_compare_deep(/\x22/mig, /\x22/mig));
|
|
851
|
+
$mol_assert_not($mol_compare_deep(/\x22/mig, /\x21/mig));
|
|
852
|
+
$mol_assert_not($mol_compare_deep(/\x22/mig, /\x22/mg));
|
|
853
|
+
},
|
|
854
|
+
'Error'() {
|
|
855
|
+
$mol_assert_not($mol_compare_deep(new Error('xxx'), new Error('xxx')));
|
|
856
|
+
const fail = (message) => new Error(message);
|
|
857
|
+
$mol_assert_ok($mol_compare_deep(...['xxx', 'xxx'].map(msg => new Error(msg))));
|
|
858
|
+
$mol_assert_not($mol_compare_deep(...['xxx', 'yyy'].map(msg => new Error(msg))));
|
|
859
|
+
},
|
|
860
|
+
'Map'() {
|
|
861
|
+
$mol_assert_ok($mol_compare_deep(new Map, new Map));
|
|
862
|
+
$mol_assert_ok($mol_compare_deep(new Map([[1, [2]]]), new Map([[1, [2]]])));
|
|
863
|
+
$mol_assert_ok($mol_compare_deep(new Map([[[1], 2]]), new Map([[[1], 2]])));
|
|
864
|
+
$mol_assert_not($mol_compare_deep(new Map([[1, 2]]), new Map([[1, 3]])));
|
|
865
|
+
$mol_assert_not($mol_compare_deep(new Map([[[1], 2]]), new Map([[[3], 2]])));
|
|
866
|
+
},
|
|
867
|
+
'Set'() {
|
|
868
|
+
$mol_assert_ok($mol_compare_deep(new Set, new Set));
|
|
869
|
+
$mol_assert_ok($mol_compare_deep(new Set([1, [2]]), new Set([1, [2]])));
|
|
870
|
+
$mol_assert_not($mol_compare_deep(new Set([1]), new Set([2])));
|
|
871
|
+
},
|
|
872
|
+
'Uint8Array'() {
|
|
873
|
+
$mol_assert_ok($mol_compare_deep(new Uint8Array, new Uint8Array));
|
|
874
|
+
$mol_assert_ok($mol_compare_deep(new Uint8Array([0]), new Uint8Array([0])));
|
|
875
|
+
$mol_assert_not($mol_compare_deep(new Uint8Array([0]), new Uint8Array([1])));
|
|
876
|
+
},
|
|
877
|
+
'Custom comparator'() {
|
|
878
|
+
class User {
|
|
879
|
+
name;
|
|
880
|
+
rand;
|
|
881
|
+
constructor(name, rand = Math.random()) {
|
|
882
|
+
this.name = name;
|
|
883
|
+
this.rand = rand;
|
|
884
|
+
}
|
|
885
|
+
[Symbol.toPrimitive](mode) {
|
|
886
|
+
return this.name;
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
$mol_assert_ok($mol_compare_deep(new User('Jin'), new User('Jin')));
|
|
890
|
+
$mol_assert_not($mol_compare_deep(new User('Jin'), new User('John')));
|
|
891
|
+
},
|
|
892
|
+
});
|
|
893
|
+
})($ || ($ = {}));
|
|
894
|
+
//mol/compare/deep/deep.test.tsx
|
|
895
|
+
;
|
|
896
|
+
"use strict";
|
|
897
|
+
var $;
|
|
898
898
|
(function ($) {
|
|
899
899
|
$mol_test({
|
|
900
900
|
'Primitives'() {
|