mol_dump_lib 0.0.1026 → 0.0.1028
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 +693 -3
- package/node.d.ts.map +1 -1
- package/node.deps.json +1 -1
- package/node.js +487 -19
- package/node.js.map +1 -1
- package/node.mjs +487 -19
- package/node.test.js +612 -20
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.d.ts +642 -2
- package/web.d.ts.map +1 -1
- package/web.deps.json +1 -1
- package/web.js +429 -15
- package/web.js.map +1 -1
- package/web.mjs +429 -15
- package/web.test.js +128 -4
- package/web.test.js.map +1 -1
package/node.mjs
CHANGED
|
@@ -41,7 +41,7 @@ var $;
|
|
|
41
41
|
"use strict";
|
|
42
42
|
var $;
|
|
43
43
|
(function ($) {
|
|
44
|
-
const mod = require('module');
|
|
44
|
+
const mod = require /****/('module');
|
|
45
45
|
const internals = mod.builtinModules;
|
|
46
46
|
function $node_internal_check(name) {
|
|
47
47
|
if (name.startsWith('node:'))
|
|
@@ -81,7 +81,7 @@ var $;
|
|
|
81
81
|
var $;
|
|
82
82
|
(function ($) {
|
|
83
83
|
function $mol_fail_hidden(error) {
|
|
84
|
-
throw error;
|
|
84
|
+
throw error; /// Use 'Never Pause Here' breakpoint in DevTools or simply blackbox this script
|
|
85
85
|
}
|
|
86
86
|
$.$mol_fail_hidden = $mol_fail_hidden;
|
|
87
87
|
})($ || ($ = {}));
|
|
@@ -139,8 +139,8 @@ var $;
|
|
|
139
139
|
"use strict";
|
|
140
140
|
var $;
|
|
141
141
|
(function ($) {
|
|
142
|
-
const path = require('path');
|
|
143
|
-
const mod = require('module');
|
|
142
|
+
const path = require /****/('path');
|
|
143
|
+
const mod = require /****/('module');
|
|
144
144
|
const localRequire = mod.createRequire(path.join(process.cwd(), 'package.json'));
|
|
145
145
|
function $node_autoinstall(name) {
|
|
146
146
|
try {
|
|
@@ -247,6 +247,7 @@ var $;
|
|
|
247
247
|
])
|
|
248
248
|
].map(frame_normalize).join('\n')
|
|
249
249
|
});
|
|
250
|
+
// в nodejs, что б не дублировалось cause в консоли
|
|
250
251
|
Object.defineProperty(this, 'cause', {
|
|
251
252
|
get: () => cause
|
|
252
253
|
});
|
|
@@ -280,6 +281,11 @@ var $;
|
|
|
280
281
|
var $;
|
|
281
282
|
(function ($) {
|
|
282
283
|
const instances = new WeakSet();
|
|
284
|
+
/**
|
|
285
|
+
* Proxy that delegates all to lazy returned target.
|
|
286
|
+
*
|
|
287
|
+
* $mol_delegate( Array.prototype , ()=> fetch_array() )
|
|
288
|
+
*/
|
|
283
289
|
function $mol_delegate(proto, target) {
|
|
284
290
|
const proxy = new Proxy(proto, {
|
|
285
291
|
get: (_, field) => {
|
|
@@ -423,6 +429,9 @@ var $;
|
|
|
423
429
|
[Symbol.dispose]() {
|
|
424
430
|
this.destructor();
|
|
425
431
|
}
|
|
432
|
+
//[ Symbol.toPrimitive ]( hint: string ) {
|
|
433
|
+
// return hint === 'number' ? this.valueOf() : this.toString()
|
|
434
|
+
//}
|
|
426
435
|
toString() {
|
|
427
436
|
return this[Symbol.toStringTag] || this.constructor.name + '<>';
|
|
428
437
|
}
|
|
@@ -473,6 +482,7 @@ var $;
|
|
|
473
482
|
"use strict";
|
|
474
483
|
var $;
|
|
475
484
|
(function ($) {
|
|
485
|
+
/** Generates unique identifier. */
|
|
476
486
|
function $mol_guid(length = 8, exists = () => false) {
|
|
477
487
|
for (;;) {
|
|
478
488
|
let id = Math.random().toString(36).substring(2, length + 2).toUpperCase();
|
|
@@ -488,11 +498,16 @@ var $;
|
|
|
488
498
|
"use strict";
|
|
489
499
|
var $;
|
|
490
500
|
(function ($) {
|
|
501
|
+
/** Special status statuses. */
|
|
491
502
|
let $mol_wire_cursor;
|
|
492
503
|
(function ($mol_wire_cursor) {
|
|
504
|
+
/** Update required. */
|
|
493
505
|
$mol_wire_cursor[$mol_wire_cursor["stale"] = -1] = "stale";
|
|
506
|
+
/** Some of (transitive) pub update required. */
|
|
494
507
|
$mol_wire_cursor[$mol_wire_cursor["doubt"] = -2] = "doubt";
|
|
508
|
+
/** Actual state but may be dropped. */
|
|
495
509
|
$mol_wire_cursor[$mol_wire_cursor["fresh"] = -3] = "fresh";
|
|
510
|
+
/** State will never be changed. */
|
|
496
511
|
$mol_wire_cursor[$mol_wire_cursor["final"] = -4] = "final";
|
|
497
512
|
})($mol_wire_cursor = $.$mol_wire_cursor || ($.$mol_wire_cursor = {}));
|
|
498
513
|
})($ || ($ = {}));
|
|
@@ -501,6 +516,9 @@ var $;
|
|
|
501
516
|
"use strict";
|
|
502
517
|
var $;
|
|
503
518
|
(function ($) {
|
|
519
|
+
/**
|
|
520
|
+
* Collects subscribers in compact array. 28B
|
|
521
|
+
*/
|
|
504
522
|
class $mol_wire_pub extends Object {
|
|
505
523
|
constructor(id = `$mol_wire_pub:${$mol_guid()}`) {
|
|
506
524
|
super();
|
|
@@ -508,10 +526,17 @@ var $;
|
|
|
508
526
|
}
|
|
509
527
|
[Symbol.toStringTag];
|
|
510
528
|
data = [];
|
|
529
|
+
// Derived objects should be Arrays.
|
|
511
530
|
static get [Symbol.species]() {
|
|
512
531
|
return Array;
|
|
513
532
|
}
|
|
514
|
-
|
|
533
|
+
/**
|
|
534
|
+
* Index of first subscriber.
|
|
535
|
+
*/
|
|
536
|
+
sub_from = 0; // 4B
|
|
537
|
+
/**
|
|
538
|
+
* All current subscribers.
|
|
539
|
+
*/
|
|
515
540
|
get sub_list() {
|
|
516
541
|
const res = [];
|
|
517
542
|
for (let i = this.sub_from; i < this.data.length; i += 2) {
|
|
@@ -519,14 +544,23 @@ var $;
|
|
|
519
544
|
}
|
|
520
545
|
return res;
|
|
521
546
|
}
|
|
547
|
+
/**
|
|
548
|
+
* Has any subscribers or not.
|
|
549
|
+
*/
|
|
522
550
|
get sub_empty() {
|
|
523
551
|
return this.sub_from === this.data.length;
|
|
524
552
|
}
|
|
553
|
+
/**
|
|
554
|
+
* Subscribe subscriber to this publisher events and return position of subscriber that required to unsubscribe.
|
|
555
|
+
*/
|
|
525
556
|
sub_on(sub, pub_pos) {
|
|
526
557
|
const pos = this.data.length;
|
|
527
558
|
this.data.push(sub, pub_pos);
|
|
528
559
|
return pos;
|
|
529
560
|
}
|
|
561
|
+
/**
|
|
562
|
+
* Unsubscribe subscriber from this publisher events by subscriber position provided by `on(pub)`.
|
|
563
|
+
*/
|
|
530
564
|
sub_off(sub_pos) {
|
|
531
565
|
if (!(sub_pos < this.data.length)) {
|
|
532
566
|
$mol_fail(new Error(`Wrong pos ${sub_pos}`));
|
|
@@ -539,21 +573,39 @@ var $;
|
|
|
539
573
|
if (end === this.sub_from)
|
|
540
574
|
this.reap();
|
|
541
575
|
}
|
|
576
|
+
/**
|
|
577
|
+
* Called when last sub was unsubscribed.
|
|
578
|
+
**/
|
|
542
579
|
reap() { }
|
|
580
|
+
/**
|
|
581
|
+
* Autowire this publisher with current subscriber.
|
|
582
|
+
**/
|
|
543
583
|
promote() {
|
|
544
584
|
$mol_wire_auto()?.track_next(this);
|
|
545
585
|
}
|
|
586
|
+
/**
|
|
587
|
+
* Enforce actualization. Should not throw errors.
|
|
588
|
+
*/
|
|
546
589
|
fresh() { }
|
|
590
|
+
/**
|
|
591
|
+
* Allow to put data to caches in the subtree.
|
|
592
|
+
*/
|
|
547
593
|
complete() { }
|
|
548
594
|
get incompleted() {
|
|
549
595
|
return false;
|
|
550
596
|
}
|
|
597
|
+
/**
|
|
598
|
+
* Notify subscribers about self changes.
|
|
599
|
+
*/
|
|
551
600
|
emit(quant = $mol_wire_cursor.stale) {
|
|
552
601
|
for (let i = this.sub_from; i < this.data.length; i += 2) {
|
|
553
602
|
;
|
|
554
603
|
this.data[i].absorb(quant, this.data[i + 1]);
|
|
555
604
|
}
|
|
556
605
|
}
|
|
606
|
+
/**
|
|
607
|
+
* Moves peer from one position to another. Doesn't clear data at old position!
|
|
608
|
+
*/
|
|
557
609
|
peer_move(from_pos, to_pos) {
|
|
558
610
|
const peer = this.data[from_pos];
|
|
559
611
|
const self_pos = this.data[from_pos + 1];
|
|
@@ -561,6 +613,9 @@ var $;
|
|
|
561
613
|
this.data[to_pos + 1] = self_pos;
|
|
562
614
|
peer.peer_repos(self_pos, to_pos);
|
|
563
615
|
}
|
|
616
|
+
/**
|
|
617
|
+
* Updates self position in the peer.
|
|
618
|
+
*/
|
|
564
619
|
peer_repos(peer_pos, self_pos) {
|
|
565
620
|
this.data[peer_pos + 1] = self_pos;
|
|
566
621
|
}
|
|
@@ -576,10 +631,16 @@ var $;
|
|
|
576
631
|
var $;
|
|
577
632
|
(function ($) {
|
|
578
633
|
$.$mol_wire_auto_sub = null;
|
|
634
|
+
/**
|
|
635
|
+
* When fulfilled, all publishers are promoted to this subscriber on access to its.
|
|
636
|
+
*/
|
|
579
637
|
function $mol_wire_auto(next = $.$mol_wire_auto_sub) {
|
|
580
638
|
return $.$mol_wire_auto_sub = next;
|
|
581
639
|
}
|
|
582
640
|
$.$mol_wire_auto = $mol_wire_auto;
|
|
641
|
+
/**
|
|
642
|
+
* Affection queue. Used to prevent accidental stack overflow on emit.
|
|
643
|
+
*/
|
|
583
644
|
$.$mol_wire_affected = [];
|
|
584
645
|
})($ || ($ = {}));
|
|
585
646
|
|
|
@@ -587,6 +648,7 @@ var $;
|
|
|
587
648
|
"use strict";
|
|
588
649
|
var $;
|
|
589
650
|
(function ($) {
|
|
651
|
+
// https://docs.google.com/document/d/1FTascZXT9cxfetuPRT2eXPQKXui4nWFivUnS_335T3U/preview#
|
|
590
652
|
$['devtoolsFormatters'] ||= [];
|
|
591
653
|
function $mol_dev_format_register(config) {
|
|
592
654
|
$['devtoolsFormatters'].push(config);
|
|
@@ -638,6 +700,7 @@ var $;
|
|
|
638
700
|
return false;
|
|
639
701
|
if (!val)
|
|
640
702
|
return false;
|
|
703
|
+
// if( Error.isError( val ) ) true
|
|
641
704
|
if (val[$.$mol_dev_format_body])
|
|
642
705
|
return true;
|
|
643
706
|
return false;
|
|
@@ -655,12 +718,16 @@ var $;
|
|
|
655
718
|
return $.$mol_dev_format_accent($mol_dev_format_native(val), '💨', $mol_dev_format_native(error), '');
|
|
656
719
|
}
|
|
657
720
|
}
|
|
721
|
+
// if( Error.isError( val ) ) {
|
|
722
|
+
// return $mol_dev_format_native( val )
|
|
723
|
+
// }
|
|
658
724
|
return null;
|
|
659
725
|
},
|
|
660
726
|
});
|
|
661
727
|
function $mol_dev_format_native(obj) {
|
|
662
728
|
if (typeof obj === 'undefined')
|
|
663
729
|
return $.$mol_dev_format_shade('undefined');
|
|
730
|
+
// if( ![ 'object', 'function', 'symbol' ].includes( typeof obj ) ) return obj
|
|
664
731
|
return [
|
|
665
732
|
'object',
|
|
666
733
|
{
|
|
@@ -718,6 +785,9 @@ var $;
|
|
|
718
785
|
'margin-left': '13px'
|
|
719
786
|
});
|
|
720
787
|
class Stack extends Array {
|
|
788
|
+
// [ Symbol.toPrimitive ]() {
|
|
789
|
+
// return this.toString()
|
|
790
|
+
// }
|
|
721
791
|
toString() {
|
|
722
792
|
return this.join('\n');
|
|
723
793
|
}
|
|
@@ -740,6 +810,7 @@ var $;
|
|
|
740
810
|
this.method = call.getMethodName() ?? '';
|
|
741
811
|
if (this.method === this.function)
|
|
742
812
|
this.method = '';
|
|
813
|
+
// const func = c.getFunction()
|
|
743
814
|
this.pos = [call.getEnclosingLineNumber() ?? 0, call.getEnclosingColumnNumber() ?? 0];
|
|
744
815
|
this.eval = call.getEvalOrigin() ?? '';
|
|
745
816
|
this.source = call.getScriptNameOrSourceURL() ?? '';
|
|
@@ -786,9 +857,16 @@ var $;
|
|
|
786
857
|
"use strict";
|
|
787
858
|
var $;
|
|
788
859
|
(function ($) {
|
|
860
|
+
/**
|
|
861
|
+
* Publisher that can auto collect other publishers. 32B
|
|
862
|
+
*
|
|
863
|
+
* P1 P2 P3 P4 S1 S2 S3
|
|
864
|
+
* ^ ^
|
|
865
|
+
* pubs_from subs_from
|
|
866
|
+
*/
|
|
789
867
|
class $mol_wire_pub_sub extends $mol_wire_pub {
|
|
790
|
-
pub_from = 0;
|
|
791
|
-
cursor = $mol_wire_cursor.stale;
|
|
868
|
+
pub_from = 0; // 4B
|
|
869
|
+
cursor = $mol_wire_cursor.stale; // 4B
|
|
792
870
|
get temp() {
|
|
793
871
|
return false;
|
|
794
872
|
}
|
|
@@ -906,10 +984,27 @@ var $;
|
|
|
906
984
|
return;
|
|
907
985
|
this.cursor = quant;
|
|
908
986
|
this.emit($mol_wire_cursor.doubt);
|
|
987
|
+
// if( pos >= 0 && pos < this.sub_from - 2 ) {
|
|
988
|
+
// const pub = this.data[ pos ] as $mol_wire_pub
|
|
989
|
+
// if( pub instanceof $mol_wire_task ) return
|
|
990
|
+
// for(
|
|
991
|
+
// let cursor = this.pub_from;
|
|
992
|
+
// cursor < this.sub_from;
|
|
993
|
+
// cursor += 2
|
|
994
|
+
// ) {
|
|
995
|
+
// const pub = this.data[ cursor ] as $mol_wire_pub
|
|
996
|
+
// if( pub instanceof $mol_wire_task ) {
|
|
997
|
+
// pub.destructor()
|
|
998
|
+
// }
|
|
999
|
+
// }
|
|
1000
|
+
// }
|
|
909
1001
|
}
|
|
910
1002
|
[$mol_dev_format_head]() {
|
|
911
1003
|
return $mol_dev_format_native(this);
|
|
912
1004
|
}
|
|
1005
|
+
/**
|
|
1006
|
+
* Is subscribed to any publisher or not.
|
|
1007
|
+
*/
|
|
913
1008
|
get pub_empty() {
|
|
914
1009
|
return this.sub_from === this.pub_from;
|
|
915
1010
|
}
|
|
@@ -950,6 +1045,13 @@ var $;
|
|
|
950
1045
|
var $;
|
|
951
1046
|
(function ($) {
|
|
952
1047
|
const wrappers = new WeakMap();
|
|
1048
|
+
/**
|
|
1049
|
+
* Suspendable task with support both sync/async api.
|
|
1050
|
+
*
|
|
1051
|
+
* A1 A2 A3 A4 P1 P2 P3 P4 S1 S2 S3
|
|
1052
|
+
* ^ ^ ^
|
|
1053
|
+
* args_from pubs_from subs_from
|
|
1054
|
+
**/
|
|
953
1055
|
class $mol_wire_fiber extends $mol_wire_pub_sub {
|
|
954
1056
|
task;
|
|
955
1057
|
host;
|
|
@@ -970,6 +1072,7 @@ var $;
|
|
|
970
1072
|
});
|
|
971
1073
|
}
|
|
972
1074
|
static sync() {
|
|
1075
|
+
// Sync whole fiber graph
|
|
973
1076
|
while (this.planning.size) {
|
|
974
1077
|
for (const fiber of this.planning) {
|
|
975
1078
|
this.planning.delete(fiber);
|
|
@@ -980,6 +1083,7 @@ var $;
|
|
|
980
1083
|
fiber.fresh();
|
|
981
1084
|
}
|
|
982
1085
|
}
|
|
1086
|
+
// Collect garbage
|
|
983
1087
|
while (this.reaping.size) {
|
|
984
1088
|
const fibers = this.reaping;
|
|
985
1089
|
this.reaping = new Set;
|
|
@@ -1131,6 +1235,10 @@ var $;
|
|
|
1131
1235
|
this.cursor = $mol_wire_cursor.stale;
|
|
1132
1236
|
this.fresh();
|
|
1133
1237
|
}
|
|
1238
|
+
/**
|
|
1239
|
+
* Synchronous execution. Throws Promise when waits async task (SuspenseAPI provider).
|
|
1240
|
+
* Should be called inside SuspenseAPI consumer (ie fiber).
|
|
1241
|
+
*/
|
|
1134
1242
|
sync() {
|
|
1135
1243
|
if (!$mol_wire_fiber.warm) {
|
|
1136
1244
|
return this.result();
|
|
@@ -1145,6 +1253,10 @@ var $;
|
|
|
1145
1253
|
}
|
|
1146
1254
|
return this.cache;
|
|
1147
1255
|
}
|
|
1256
|
+
/**
|
|
1257
|
+
* Asynchronous execution.
|
|
1258
|
+
* It's SuspenseAPI consumer. So SuspenseAPI providers can be called inside.
|
|
1259
|
+
*/
|
|
1148
1260
|
async async_raw() {
|
|
1149
1261
|
while (true) {
|
|
1150
1262
|
this.fresh();
|
|
@@ -1157,6 +1269,7 @@ var $;
|
|
|
1157
1269
|
if (!$mol_promise_like(this.cache))
|
|
1158
1270
|
return this.cache;
|
|
1159
1271
|
if (this.cursor === $mol_wire_cursor.final) {
|
|
1272
|
+
// never ends on destructed fiber
|
|
1160
1273
|
await new Promise(() => { });
|
|
1161
1274
|
}
|
|
1162
1275
|
}
|
|
@@ -1204,6 +1317,10 @@ var $;
|
|
|
1204
1317
|
var $;
|
|
1205
1318
|
(function ($) {
|
|
1206
1319
|
$.$mol_compare_deep_cache = new WeakMap();
|
|
1320
|
+
/**
|
|
1321
|
+
* Deeply compares two values. Returns true if equal.
|
|
1322
|
+
* Define `Symbol.toPrimitive` to customize.
|
|
1323
|
+
*/
|
|
1207
1324
|
function $mol_compare_deep(left, right) {
|
|
1208
1325
|
if (Object.is(left, right))
|
|
1209
1326
|
return true;
|
|
@@ -1343,6 +1460,7 @@ var $;
|
|
|
1343
1460
|
"use strict";
|
|
1344
1461
|
var $;
|
|
1345
1462
|
(function ($) {
|
|
1463
|
+
/** Log begin of collapsed group only when some logged inside, returns func to close group */
|
|
1346
1464
|
function $mol_log3_area_lazy(event) {
|
|
1347
1465
|
const self = this.$;
|
|
1348
1466
|
const stack = self.$mol_log3_stack;
|
|
@@ -1367,6 +1485,7 @@ var $;
|
|
|
1367
1485
|
"use strict";
|
|
1368
1486
|
var $;
|
|
1369
1487
|
(function ($) {
|
|
1488
|
+
/** Position in any resource. */
|
|
1370
1489
|
class $mol_span extends $mol_object2 {
|
|
1371
1490
|
uri;
|
|
1372
1491
|
source;
|
|
@@ -1382,13 +1501,17 @@ var $;
|
|
|
1382
1501
|
this.length = length;
|
|
1383
1502
|
this[Symbol.toStringTag] = this.uri + ('#' + this.row + ':' + this.col + '/' + this.length);
|
|
1384
1503
|
}
|
|
1504
|
+
/** Span for begin of unknown resource */
|
|
1385
1505
|
static unknown = $mol_span.begin('?');
|
|
1506
|
+
/** Makes new span for begin of resource. */
|
|
1386
1507
|
static begin(uri, source = '') {
|
|
1387
1508
|
return new $mol_span(uri, source, 1, 1, 0);
|
|
1388
1509
|
}
|
|
1510
|
+
/** Makes new span for end of resource. */
|
|
1389
1511
|
static end(uri, source) {
|
|
1390
1512
|
return new $mol_span(uri, source, 1, source.length + 1, 0);
|
|
1391
1513
|
}
|
|
1514
|
+
/** Makes new span for entire resource. */
|
|
1392
1515
|
static entire(uri, source) {
|
|
1393
1516
|
return new $mol_span(uri, source, 1, 1, source.length);
|
|
1394
1517
|
}
|
|
@@ -1403,15 +1526,19 @@ var $;
|
|
|
1403
1526
|
length: this.length
|
|
1404
1527
|
};
|
|
1405
1528
|
}
|
|
1529
|
+
/** Makes new error for this span. */
|
|
1406
1530
|
error(message, Class = Error) {
|
|
1407
1531
|
return new Class(`${message} (${this})`);
|
|
1408
1532
|
}
|
|
1533
|
+
/** Makes new span for same uri. */
|
|
1409
1534
|
span(row, col, length) {
|
|
1410
1535
|
return new $mol_span(this.uri, this.source, row, col, length);
|
|
1411
1536
|
}
|
|
1537
|
+
/** Makes new span after end of this. */
|
|
1412
1538
|
after(length = 0) {
|
|
1413
1539
|
return new $mol_span(this.uri, this.source, this.row, this.col + this.length, length);
|
|
1414
1540
|
}
|
|
1541
|
+
/** Makes new span between begin and end. */
|
|
1415
1542
|
slice(begin, end = -1) {
|
|
1416
1543
|
let len = this.length;
|
|
1417
1544
|
if (begin < 0)
|
|
@@ -1434,6 +1561,7 @@ var $;
|
|
|
1434
1561
|
"use strict";
|
|
1435
1562
|
var $;
|
|
1436
1563
|
(function ($) {
|
|
1564
|
+
/** Serializes tree to string in tree format. */
|
|
1437
1565
|
function $mol_tree2_to_string(tree) {
|
|
1438
1566
|
let output = [];
|
|
1439
1567
|
function dump(tree, prefix = '') {
|
|
@@ -1477,12 +1605,25 @@ var $;
|
|
|
1477
1605
|
"use strict";
|
|
1478
1606
|
var $;
|
|
1479
1607
|
(function ($) {
|
|
1608
|
+
/**
|
|
1609
|
+
* Abstract Syntax Tree with human readable serialization.
|
|
1610
|
+
* Avoid direct instantiation. Use static factories instead.
|
|
1611
|
+
* @see https://github.com/nin-jin/tree.d
|
|
1612
|
+
*/
|
|
1480
1613
|
class $mol_tree2 extends Object {
|
|
1481
1614
|
type;
|
|
1482
1615
|
value;
|
|
1483
1616
|
kids;
|
|
1484
1617
|
span;
|
|
1485
|
-
constructor(
|
|
1618
|
+
constructor(
|
|
1619
|
+
/** Type of structural node, `value` should be empty */
|
|
1620
|
+
type,
|
|
1621
|
+
/** Content of data node, `type` should be empty */
|
|
1622
|
+
value,
|
|
1623
|
+
/** Child nodes */
|
|
1624
|
+
kids,
|
|
1625
|
+
/** Position in most far source resource */
|
|
1626
|
+
span) {
|
|
1486
1627
|
super();
|
|
1487
1628
|
this.type = type;
|
|
1488
1629
|
this.value = value;
|
|
@@ -1490,12 +1631,15 @@ var $;
|
|
|
1490
1631
|
this.span = span;
|
|
1491
1632
|
this[Symbol.toStringTag] = type || '\\' + value;
|
|
1492
1633
|
}
|
|
1634
|
+
/** Makes collection node. */
|
|
1493
1635
|
static list(kids, span = $mol_span.unknown) {
|
|
1494
1636
|
return new $mol_tree2('', '', kids, span);
|
|
1495
1637
|
}
|
|
1638
|
+
/** Makes new derived collection node. */
|
|
1496
1639
|
list(kids) {
|
|
1497
1640
|
return $mol_tree2.list(kids, this.span);
|
|
1498
1641
|
}
|
|
1642
|
+
/** Makes data node for any string. */
|
|
1499
1643
|
static data(value, kids = [], span = $mol_span.unknown) {
|
|
1500
1644
|
const chunks = value.split('\n');
|
|
1501
1645
|
if (chunks.length > 1) {
|
|
@@ -1509,21 +1653,26 @@ var $;
|
|
|
1509
1653
|
}
|
|
1510
1654
|
return new $mol_tree2('', value, kids, span);
|
|
1511
1655
|
}
|
|
1656
|
+
/** Makes new derived data node. */
|
|
1512
1657
|
data(value, kids = []) {
|
|
1513
1658
|
return $mol_tree2.data(value, kids, this.span);
|
|
1514
1659
|
}
|
|
1660
|
+
/** Makes struct node. */
|
|
1515
1661
|
static struct(type, kids = [], span = $mol_span.unknown) {
|
|
1516
1662
|
if (/[ \n\t\\]/.test(type)) {
|
|
1517
1663
|
$$.$mol_fail(span.error(`Wrong type ${JSON.stringify(type)}`));
|
|
1518
1664
|
}
|
|
1519
1665
|
return new $mol_tree2(type, '', kids, span);
|
|
1520
1666
|
}
|
|
1667
|
+
/** Makes new derived structural node. */
|
|
1521
1668
|
struct(type, kids = []) {
|
|
1522
1669
|
return $mol_tree2.struct(type, kids, this.span);
|
|
1523
1670
|
}
|
|
1671
|
+
/** Makes new derived node with different kids id defined. */
|
|
1524
1672
|
clone(kids, span = this.span) {
|
|
1525
1673
|
return new $mol_tree2(this.type, this.value, kids, span);
|
|
1526
1674
|
}
|
|
1675
|
+
/** Returns multiline text content. */
|
|
1527
1676
|
text() {
|
|
1528
1677
|
var values = [];
|
|
1529
1678
|
for (var kid of this.kids) {
|
|
@@ -1533,15 +1682,20 @@ var $;
|
|
|
1533
1682
|
}
|
|
1534
1683
|
return this.value + values.join('\n');
|
|
1535
1684
|
}
|
|
1685
|
+
/** Parses tree format. */
|
|
1686
|
+
/** @deprecated Use $mol_tree2_from_string */
|
|
1536
1687
|
static fromString(str, uri = 'unknown') {
|
|
1537
1688
|
return $$.$mol_tree2_from_string(str, uri);
|
|
1538
1689
|
}
|
|
1690
|
+
/** Serializes to tree format. */
|
|
1539
1691
|
toString() {
|
|
1540
1692
|
return $$.$mol_tree2_to_string(this);
|
|
1541
1693
|
}
|
|
1694
|
+
/** Makes new tree with node overrided by path. */
|
|
1542
1695
|
insert(value, ...path) {
|
|
1543
1696
|
return this.update($mol_maybe(value), ...path)[0];
|
|
1544
1697
|
}
|
|
1698
|
+
/** Makes new tree with node overrided by path. */
|
|
1545
1699
|
update(value, ...path) {
|
|
1546
1700
|
if (path.length === 0)
|
|
1547
1701
|
return value;
|
|
@@ -1574,6 +1728,7 @@ var $;
|
|
|
1574
1728
|
return [this.clone(kids)];
|
|
1575
1729
|
}
|
|
1576
1730
|
}
|
|
1731
|
+
/** Query nodes by path. */
|
|
1577
1732
|
select(...path) {
|
|
1578
1733
|
let next = [this];
|
|
1579
1734
|
for (const type of path) {
|
|
@@ -1600,6 +1755,7 @@ var $;
|
|
|
1600
1755
|
}
|
|
1601
1756
|
return this.list(next);
|
|
1602
1757
|
}
|
|
1758
|
+
/** Filter kids by path or value. */
|
|
1603
1759
|
filter(path, value) {
|
|
1604
1760
|
const sub = this.kids.filter(item => {
|
|
1605
1761
|
var found = item.select(...path);
|
|
@@ -1627,9 +1783,11 @@ var $;
|
|
|
1627
1783
|
$mol_fail_hidden(error);
|
|
1628
1784
|
}
|
|
1629
1785
|
}
|
|
1786
|
+
/** Transform tree through context with transformers */
|
|
1630
1787
|
hack(belt, context = {}) {
|
|
1631
1788
|
return [].concat(...this.kids.map(child => child.hack_self(belt, context)));
|
|
1632
1789
|
}
|
|
1790
|
+
/** Makes Error with node coordinates. */
|
|
1633
1791
|
error(message, Class = Error) {
|
|
1634
1792
|
return this.span.error(`${message}\n${this.clone([])}`, Class);
|
|
1635
1793
|
}
|
|
@@ -1647,6 +1805,7 @@ var $;
|
|
|
1647
1805
|
"use strict";
|
|
1648
1806
|
var $;
|
|
1649
1807
|
(function ($) {
|
|
1808
|
+
/** Syntax error with cordinates and source line snippet. */
|
|
1650
1809
|
class $mol_error_syntax extends SyntaxError {
|
|
1651
1810
|
reason;
|
|
1652
1811
|
line;
|
|
@@ -1665,6 +1824,7 @@ var $;
|
|
|
1665
1824
|
"use strict";
|
|
1666
1825
|
var $;
|
|
1667
1826
|
(function ($) {
|
|
1827
|
+
/** Parses tree format from string. */
|
|
1668
1828
|
function $mol_tree2_from_string(str, uri = '?') {
|
|
1669
1829
|
const span = $mol_span.entire(uri, str);
|
|
1670
1830
|
var root = $mol_tree2.list([], span);
|
|
@@ -1674,6 +1834,7 @@ var $;
|
|
|
1674
1834
|
var indent = 0;
|
|
1675
1835
|
var line_start = pos;
|
|
1676
1836
|
row++;
|
|
1837
|
+
// read indent
|
|
1677
1838
|
while (str.length > pos && str[pos] == '\t') {
|
|
1678
1839
|
indent++;
|
|
1679
1840
|
pos++;
|
|
@@ -1682,8 +1843,10 @@ var $;
|
|
|
1682
1843
|
min_indent = indent;
|
|
1683
1844
|
}
|
|
1684
1845
|
indent -= min_indent;
|
|
1846
|
+
// invalid tab size
|
|
1685
1847
|
if (indent < 0 || indent >= stack.length) {
|
|
1686
1848
|
const sp = span.span(row, 1, pos - line_start);
|
|
1849
|
+
// skip error line
|
|
1687
1850
|
while (str.length > pos && str[pos] != '\n') {
|
|
1688
1851
|
pos++;
|
|
1689
1852
|
}
|
|
@@ -1698,7 +1861,9 @@ var $;
|
|
|
1698
1861
|
}
|
|
1699
1862
|
stack.length = indent + 1;
|
|
1700
1863
|
var parent = stack[indent];
|
|
1864
|
+
// parse types
|
|
1701
1865
|
while (str.length > pos && str[pos] != '\\' && str[pos] != '\n') {
|
|
1866
|
+
// type can not contain space and tab
|
|
1702
1867
|
var error_start = pos;
|
|
1703
1868
|
while (str.length > pos && (str[pos] == ' ' || str[pos] == '\t')) {
|
|
1704
1869
|
pos++;
|
|
@@ -1710,6 +1875,7 @@ var $;
|
|
|
1710
1875
|
const sp = span.span(row, error_start - line_start + 1, pos - error_start);
|
|
1711
1876
|
this.$mol_fail(new this.$mol_error_syntax(`Wrong nodes separator`, str.substring(line_start, line_end), sp));
|
|
1712
1877
|
}
|
|
1878
|
+
// read type
|
|
1713
1879
|
var type_start = pos;
|
|
1714
1880
|
while (str.length > pos &&
|
|
1715
1881
|
str[pos] != '\\' &&
|
|
@@ -1724,10 +1890,12 @@ var $;
|
|
|
1724
1890
|
parent_kids.push(next);
|
|
1725
1891
|
parent = next;
|
|
1726
1892
|
}
|
|
1893
|
+
// read one space if exists
|
|
1727
1894
|
if (str.length > pos && str[pos] == ' ') {
|
|
1728
1895
|
pos++;
|
|
1729
1896
|
}
|
|
1730
1897
|
}
|
|
1898
|
+
// read data
|
|
1731
1899
|
if (str.length > pos && str[pos] == '\\') {
|
|
1732
1900
|
var data_start = pos;
|
|
1733
1901
|
while (str.length > pos && str[pos] != '\n') {
|
|
@@ -1738,6 +1906,7 @@ var $;
|
|
|
1738
1906
|
parent_kids.push(next);
|
|
1739
1907
|
parent = next;
|
|
1740
1908
|
}
|
|
1909
|
+
// now must be end of text
|
|
1741
1910
|
if (str.length === pos && stack.length > 0) {
|
|
1742
1911
|
const sp = span.span(row, pos - line_start + 1, 1);
|
|
1743
1912
|
this.$mol_fail(new this.$mol_error_syntax(`Unexpected EOF, LF required`, str.substring(line_start, str.length), sp));
|
|
@@ -1830,6 +1999,7 @@ var $;
|
|
|
1830
1999
|
"use strict";
|
|
1831
2000
|
var $;
|
|
1832
2001
|
(function ($) {
|
|
2002
|
+
/** Module for working with terminal. Text coloring when output in terminal */
|
|
1833
2003
|
class $mol_term_color {
|
|
1834
2004
|
static reset = this.ansi(0, 0);
|
|
1835
2005
|
static bold = this.ansi(1, 22);
|
|
@@ -1901,6 +2071,7 @@ var $;
|
|
|
1901
2071
|
"use strict";
|
|
1902
2072
|
var $;
|
|
1903
2073
|
(function ($) {
|
|
2074
|
+
/** One-shot fiber */
|
|
1904
2075
|
class $mol_wire_task extends $mol_wire_fiber {
|
|
1905
2076
|
static getter(task) {
|
|
1906
2077
|
return function $mol_wire_task_get(host, args) {
|
|
@@ -1926,6 +2097,7 @@ var $;
|
|
|
1926
2097
|
}
|
|
1927
2098
|
const key = (host?.[Symbol.toStringTag] ?? host) + ('.' + task.name + '<#>');
|
|
1928
2099
|
const next = new $mol_wire_task(key, task, host, args);
|
|
2100
|
+
// Disabled because non-idempotency is required for try-catch
|
|
1929
2101
|
if (existen?.temp) {
|
|
1930
2102
|
$$.$mol_log3_warn({
|
|
1931
2103
|
place: '$mol_wire_task',
|
|
@@ -1958,7 +2130,7 @@ var $;
|
|
|
1958
2130
|
try {
|
|
1959
2131
|
next[Symbol.toStringTag] = this[Symbol.toStringTag];
|
|
1960
2132
|
}
|
|
1961
|
-
catch {
|
|
2133
|
+
catch { // Promises throw in strict mode
|
|
1962
2134
|
Object.defineProperty(next, Symbol.toStringTag, { value: this[Symbol.toStringTag] });
|
|
1963
2135
|
}
|
|
1964
2136
|
}
|
|
@@ -2011,6 +2183,10 @@ var $;
|
|
|
2011
2183
|
props[field] = get_val;
|
|
2012
2184
|
return get_val;
|
|
2013
2185
|
}
|
|
2186
|
+
/**
|
|
2187
|
+
* Convert asynchronous (promise-based) API to synchronous by wrapping function and method calls in a fiber.
|
|
2188
|
+
* @see https://mol.hyoo.ru/#!section=docs/=1fcpsq_1wh0h2
|
|
2189
|
+
*/
|
|
2014
2190
|
function $mol_wire_sync(obj) {
|
|
2015
2191
|
return new Proxy(obj, {
|
|
2016
2192
|
get(obj, field) {
|
|
@@ -2252,6 +2428,10 @@ var $;
|
|
|
2252
2428
|
"use strict";
|
|
2253
2429
|
var $;
|
|
2254
2430
|
(function ($) {
|
|
2431
|
+
/**
|
|
2432
|
+
* CSS Units
|
|
2433
|
+
* @see https://mol.hyoo.ru/#!section=docs/=xwq9q5_f966fg
|
|
2434
|
+
*/
|
|
2255
2435
|
class $mol_style_unit extends $mol_decor {
|
|
2256
2436
|
literal;
|
|
2257
2437
|
constructor(value, literal) {
|
|
@@ -2298,6 +2478,10 @@ var $;
|
|
|
2298
2478
|
var $;
|
|
2299
2479
|
(function ($) {
|
|
2300
2480
|
const { per } = $mol_style_unit;
|
|
2481
|
+
/**
|
|
2482
|
+
* CSS Functions
|
|
2483
|
+
* @see https://mol.hyoo.ru/#!section=docs/=xwq9q5_f966fg
|
|
2484
|
+
*/
|
|
2301
2485
|
class $mol_style_func extends $mol_decor {
|
|
2302
2486
|
name;
|
|
2303
2487
|
constructor(name, value) {
|
|
@@ -2392,6 +2576,7 @@ var $;
|
|
|
2392
2576
|
"use strict";
|
|
2393
2577
|
var $;
|
|
2394
2578
|
(function ($) {
|
|
2579
|
+
/** Create record of CSS variables. */
|
|
2395
2580
|
function $mol_style_prop(prefix, keys) {
|
|
2396
2581
|
const record = keys.reduce((rec, key) => {
|
|
2397
2582
|
rec[key] = $mol_style_func.vary(`--${prefix}_${key}`);
|
|
@@ -2406,6 +2591,10 @@ var $;
|
|
|
2406
2591
|
"use strict";
|
|
2407
2592
|
var $;
|
|
2408
2593
|
(function ($) {
|
|
2594
|
+
/**
|
|
2595
|
+
* Theme css variables
|
|
2596
|
+
* @see https://mol.hyoo.ru/#!section=demos/demo=mol_textarea_demo
|
|
2597
|
+
*/
|
|
2409
2598
|
$.$mol_theme = $mol_style_prop('mol_theme', [
|
|
2410
2599
|
'back',
|
|
2411
2600
|
'hover',
|
|
@@ -2434,11 +2623,18 @@ var $;
|
|
|
2434
2623
|
|
|
2435
2624
|
;
|
|
2436
2625
|
"use strict";
|
|
2626
|
+
// namespace $ {
|
|
2627
|
+
// $mol_style_attach( '$mol_theme_lights', `:root { --mol_theme_back: oklch( ${ $$.$mol_lights() ? 92 : 20 }% .01 var(--mol_theme_hue) ) }` )
|
|
2628
|
+
// }
|
|
2437
2629
|
|
|
2438
2630
|
;
|
|
2439
2631
|
"use strict";
|
|
2440
2632
|
var $;
|
|
2441
2633
|
(function ($) {
|
|
2634
|
+
/**
|
|
2635
|
+
* Gap in CSS
|
|
2636
|
+
* @see https://page.hyoo.ru/#!=msdb74_bm7nsq
|
|
2637
|
+
*/
|
|
2442
2638
|
$.$mol_gap = $mol_style_prop('mol_gap', [
|
|
2443
2639
|
'page',
|
|
2444
2640
|
'block',
|
|
@@ -2528,6 +2724,12 @@ var $;
|
|
|
2528
2724
|
createDocumentFragment: () => $mol_dom_context.document.createDocumentFragment(),
|
|
2529
2725
|
};
|
|
2530
2726
|
$.$mol_jsx_frag = '';
|
|
2727
|
+
/**
|
|
2728
|
+
* JSX adapter that makes DOM tree.
|
|
2729
|
+
* Generates global unique ids for every DOM-element by components tree with ids.
|
|
2730
|
+
* Ensures all local ids are unique.
|
|
2731
|
+
* Can reuse an existing nodes by GUIDs when used inside [`mol_jsx_attach`](https://github.com/hyoo-ru/mam_mol/tree/master/jsx/attach).
|
|
2732
|
+
*/
|
|
2531
2733
|
function $mol_jsx(Elem, props, ...childNodes) {
|
|
2532
2734
|
const id = props && props.id || '';
|
|
2533
2735
|
const guid = id ? $.$mol_jsx_prefix ? $.$mol_jsx_prefix + '/' + id : id : $.$mol_jsx_prefix;
|
|
@@ -2656,6 +2858,7 @@ var $;
|
|
|
2656
2858
|
var $;
|
|
2657
2859
|
(function ($) {
|
|
2658
2860
|
const TypedArray = Object.getPrototypeOf(Uint8Array);
|
|
2861
|
+
/** Returns string key for any value. */
|
|
2659
2862
|
function $mol_key(value) {
|
|
2660
2863
|
primitives: {
|
|
2661
2864
|
if (typeof value === 'bigint')
|
|
@@ -2663,9 +2866,9 @@ var $;
|
|
|
2663
2866
|
if (typeof value === 'symbol')
|
|
2664
2867
|
return `Symbol(${value.description})`;
|
|
2665
2868
|
if (!value)
|
|
2666
|
-
return JSON.stringify(value);
|
|
2869
|
+
return JSON.stringify(value); // 0, null, ""
|
|
2667
2870
|
if (typeof value !== 'object' && typeof value !== 'function')
|
|
2668
|
-
return JSON.stringify(value);
|
|
2871
|
+
return JSON.stringify(value); // boolean, number, string
|
|
2669
2872
|
}
|
|
2670
2873
|
caching: {
|
|
2671
2874
|
let key = $mol_key_store.get(value);
|
|
@@ -2742,6 +2945,9 @@ var $;
|
|
|
2742
2945
|
"use strict";
|
|
2743
2946
|
var $;
|
|
2744
2947
|
(function ($) {
|
|
2948
|
+
/**
|
|
2949
|
+
* Decorates method to fiber to ensure it is executed only once inside other fiber.
|
|
2950
|
+
*/
|
|
2745
2951
|
function $mol_wire_method(host, field, descr) {
|
|
2746
2952
|
if (!descr)
|
|
2747
2953
|
descr = Reflect.getOwnPropertyDescriptor(host, field);
|
|
@@ -2774,6 +2980,7 @@ var $;
|
|
|
2774
2980
|
"use strict";
|
|
2775
2981
|
var $;
|
|
2776
2982
|
(function ($) {
|
|
2983
|
+
/** Long-living fiber. */
|
|
2777
2984
|
class $mol_wire_atom extends $mol_wire_fiber {
|
|
2778
2985
|
static solo(host, task) {
|
|
2779
2986
|
const field = task.name + '()';
|
|
@@ -2824,7 +3031,11 @@ var $;
|
|
|
2824
3031
|
}
|
|
2825
3032
|
$mol_wire_atom.watching.add(this);
|
|
2826
3033
|
}
|
|
3034
|
+
/**
|
|
3035
|
+
* Update atom value through another temp fiber.
|
|
3036
|
+
*/
|
|
2827
3037
|
resync(args) {
|
|
3038
|
+
// enforce pulling tasks abort
|
|
2828
3039
|
for (let cursor = this.pub_from; cursor < this.sub_from; cursor += 2) {
|
|
2829
3040
|
const pub = this.data[cursor];
|
|
2830
3041
|
if (pub && pub instanceof $mol_wire_task) {
|
|
@@ -2885,7 +3096,7 @@ var $;
|
|
|
2885
3096
|
try {
|
|
2886
3097
|
next[Symbol.toStringTag] = this[Symbol.toStringTag];
|
|
2887
3098
|
}
|
|
2888
|
-
catch {
|
|
3099
|
+
catch { // Promises throw in strict mode
|
|
2889
3100
|
Object.defineProperty(next, Symbol.toStringTag, { value: this[Symbol.toStringTag] });
|
|
2890
3101
|
}
|
|
2891
3102
|
}
|
|
@@ -2913,6 +3124,7 @@ var $;
|
|
|
2913
3124
|
"use strict";
|
|
2914
3125
|
var $;
|
|
2915
3126
|
(function ($) {
|
|
3127
|
+
/** Decorates solo object channel to [mol_wire_atom](../atom/atom.ts). */
|
|
2916
3128
|
function $mol_wire_solo(host, field, descr) {
|
|
2917
3129
|
if (!descr)
|
|
2918
3130
|
descr = Reflect.getOwnPropertyDescriptor(host, field);
|
|
@@ -2951,6 +3163,7 @@ var $;
|
|
|
2951
3163
|
"use strict";
|
|
2952
3164
|
var $;
|
|
2953
3165
|
(function ($) {
|
|
3166
|
+
/** Reactive memoizing multiplexed property decorator. */
|
|
2954
3167
|
function $mol_wire_plex(host, field, descr) {
|
|
2955
3168
|
if (!descr)
|
|
2956
3169
|
descr = Reflect.getOwnPropertyDescriptor(host, field);
|
|
@@ -2989,7 +3202,25 @@ var $;
|
|
|
2989
3202
|
"use strict";
|
|
2990
3203
|
var $;
|
|
2991
3204
|
(function ($) {
|
|
3205
|
+
/**
|
|
3206
|
+
* Reactive memoizing solo property decorator from [mol_wire](../wire/README.md)
|
|
3207
|
+
* @example
|
|
3208
|
+
* '@' $mol_mem
|
|
3209
|
+
* name(next?: string) {
|
|
3210
|
+
* return next ?? 'default'
|
|
3211
|
+
* }
|
|
3212
|
+
* @see https://mol.hyoo.ru/#!section=docs/=qxmh6t_sinbmb
|
|
3213
|
+
*/
|
|
2992
3214
|
$.$mol_mem = $mol_wire_solo;
|
|
3215
|
+
/**
|
|
3216
|
+
* Reactive memoizing multiplexed property decorator [mol_wire](../wire/README.md)
|
|
3217
|
+
* @example
|
|
3218
|
+
* '@' $mol_mem_key
|
|
3219
|
+
* name(id: number, next?: string) {
|
|
3220
|
+
* return next ?? 'default'
|
|
3221
|
+
* }
|
|
3222
|
+
* @see https://mol.hyoo.ru/#!section=docs/=qxmh6t_sinbmb
|
|
3223
|
+
*/
|
|
2993
3224
|
$.$mol_mem_key = $mol_wire_plex;
|
|
2994
3225
|
})($ || ($ = {}));
|
|
2995
3226
|
|
|
@@ -3113,6 +3344,7 @@ var $;
|
|
|
3113
3344
|
"use strict";
|
|
3114
3345
|
var $;
|
|
3115
3346
|
(function ($) {
|
|
3347
|
+
/** Run code without state changes */
|
|
3116
3348
|
function $mol_wire_probe(task, def) {
|
|
3117
3349
|
const warm = $mol_wire_fiber.warm;
|
|
3118
3350
|
try {
|
|
@@ -3133,6 +3365,10 @@ var $;
|
|
|
3133
3365
|
"use strict";
|
|
3134
3366
|
var $;
|
|
3135
3367
|
(function ($) {
|
|
3368
|
+
/**
|
|
3369
|
+
* Real-time refresh current atom.
|
|
3370
|
+
* Don't use if possible. May reduce performance.
|
|
3371
|
+
*/
|
|
3136
3372
|
function $mol_wire_watch() {
|
|
3137
3373
|
const atom = $mol_wire_auto();
|
|
3138
3374
|
if (atom instanceof $mol_wire_atom) {
|
|
@@ -3149,6 +3385,11 @@ var $;
|
|
|
3149
3385
|
"use strict";
|
|
3150
3386
|
var $;
|
|
3151
3387
|
(function ($) {
|
|
3388
|
+
/**
|
|
3389
|
+
* Returns closure that returns constant value.
|
|
3390
|
+
* @example
|
|
3391
|
+
* const rnd = $mol_const( Math.random() )
|
|
3392
|
+
*/
|
|
3152
3393
|
function $mol_const(value) {
|
|
3153
3394
|
const getter = (() => value);
|
|
3154
3395
|
getter['()'] = value;
|
|
@@ -3163,6 +3404,9 @@ var $;
|
|
|
3163
3404
|
"use strict";
|
|
3164
3405
|
var $;
|
|
3165
3406
|
(function ($) {
|
|
3407
|
+
/**
|
|
3408
|
+
* Disable reaping of current subscriber
|
|
3409
|
+
*/
|
|
3166
3410
|
function $mol_wire_solid() {
|
|
3167
3411
|
let current = $mol_wire_auto();
|
|
3168
3412
|
if (current.temp)
|
|
@@ -3266,6 +3510,7 @@ var $;
|
|
|
3266
3510
|
"use strict";
|
|
3267
3511
|
var $;
|
|
3268
3512
|
(function ($) {
|
|
3513
|
+
/** Convert a pseudo-synchronous (Suspense API) API to an explicit asynchronous one (for integrating with external systems). */
|
|
3269
3514
|
function $mol_wire_async(obj) {
|
|
3270
3515
|
let fiber;
|
|
3271
3516
|
const temp = $mol_wire_task.getter(obj);
|
|
@@ -3307,6 +3552,7 @@ var $;
|
|
|
3307
3552
|
|
|
3308
3553
|
;
|
|
3309
3554
|
"use strict";
|
|
3555
|
+
/** @jsx $mol_jsx */
|
|
3310
3556
|
var $;
|
|
3311
3557
|
(function ($) {
|
|
3312
3558
|
function $mol_view_visible_width() {
|
|
@@ -3321,6 +3567,11 @@ var $;
|
|
|
3321
3567
|
return suffix;
|
|
3322
3568
|
}
|
|
3323
3569
|
$.$mol_view_state_key = $mol_view_state_key;
|
|
3570
|
+
/**
|
|
3571
|
+
* The base class for all visual components. It provides the infrastructure for reactive lazy rendering, handling exceptions.
|
|
3572
|
+
* @see https://mol.hyoo.ru/#!section=docs/=vv2nig_s5zr0f
|
|
3573
|
+
*/
|
|
3574
|
+
/// Reactive statefull lazy ViewModel
|
|
3324
3575
|
class $mol_view extends $mol_object {
|
|
3325
3576
|
static Root(id) {
|
|
3326
3577
|
return new this;
|
|
@@ -3385,16 +3636,22 @@ var $;
|
|
|
3385
3636
|
state_key(suffix = '') {
|
|
3386
3637
|
return this.$.$mol_view_state_key(suffix);
|
|
3387
3638
|
}
|
|
3639
|
+
/// Name of element that created when element not found in DOM
|
|
3388
3640
|
dom_name() {
|
|
3389
3641
|
return $mol_dom_qname(this.constructor.toString()) || 'div';
|
|
3390
3642
|
}
|
|
3643
|
+
/// NameSpace of element that created when element not found in DOM
|
|
3391
3644
|
dom_name_space() { return 'http://www.w3.org/1999/xhtml'; }
|
|
3645
|
+
/// Raw child views
|
|
3392
3646
|
sub() {
|
|
3393
3647
|
return [];
|
|
3394
3648
|
}
|
|
3649
|
+
/// Visible sub views with defined ambient context
|
|
3650
|
+
/// Render all by default
|
|
3395
3651
|
sub_visible() {
|
|
3396
3652
|
return this.sub();
|
|
3397
3653
|
}
|
|
3654
|
+
/// Minimal width that used for lazy rendering
|
|
3398
3655
|
minimal_width() {
|
|
3399
3656
|
let min = 0;
|
|
3400
3657
|
try {
|
|
@@ -3416,6 +3673,7 @@ var $;
|
|
|
3416
3673
|
maximal_width() {
|
|
3417
3674
|
return this.minimal_width();
|
|
3418
3675
|
}
|
|
3676
|
+
/// Minimal height that used for lazy rendering
|
|
3419
3677
|
minimal_height() {
|
|
3420
3678
|
let min = 0;
|
|
3421
3679
|
try {
|
|
@@ -3435,11 +3693,11 @@ var $;
|
|
|
3435
3693
|
view_rect() {
|
|
3436
3694
|
if ($mol_wire_probe(() => this.view_rect()) === undefined) {
|
|
3437
3695
|
$mol_wire_watch();
|
|
3438
|
-
return null;
|
|
3696
|
+
return null; // don't touch DOM to prevent instant reflow
|
|
3439
3697
|
}
|
|
3440
3698
|
else {
|
|
3441
3699
|
const { width, height, left, right, top, bottom } = this.dom_node().getBoundingClientRect();
|
|
3442
|
-
return { width, height, left, right, top, bottom };
|
|
3700
|
+
return { width, height, left, right, top, bottom }; // pick to optimize compare
|
|
3443
3701
|
}
|
|
3444
3702
|
}
|
|
3445
3703
|
dom_id() {
|
|
@@ -3629,6 +3887,7 @@ var $;
|
|
|
3629
3887
|
[$mol_dev_format_head]() {
|
|
3630
3888
|
return $mol_dev_format_span({}, $mol_dev_format_native(this));
|
|
3631
3889
|
}
|
|
3890
|
+
/** Deep search view by predicate. */
|
|
3632
3891
|
*view_find(check, path = []) {
|
|
3633
3892
|
if (path.length === 0 && check(this))
|
|
3634
3893
|
return yield [this];
|
|
@@ -3657,6 +3916,7 @@ var $;
|
|
|
3657
3916
|
$mol_fail_log(error);
|
|
3658
3917
|
}
|
|
3659
3918
|
}
|
|
3919
|
+
/** Renders path of views to DOM. */
|
|
3660
3920
|
force_render(path) {
|
|
3661
3921
|
const kids = this.sub();
|
|
3662
3922
|
const index = kids.findIndex(item => {
|
|
@@ -3671,6 +3931,7 @@ var $;
|
|
|
3671
3931
|
kids[index].force_render(path);
|
|
3672
3932
|
}
|
|
3673
3933
|
}
|
|
3934
|
+
/** Renders view to DOM and scroll to it. */
|
|
3674
3935
|
ensure_visible(view, align = "start") {
|
|
3675
3936
|
const path = this.view_find(v => v === view).next().value;
|
|
3676
3937
|
this.force_render(new Set(path));
|
|
@@ -3685,6 +3946,9 @@ var $;
|
|
|
3685
3946
|
const win = this.$.$mol_dom_context;
|
|
3686
3947
|
if (win.parent !== win.self && !win.document.hasFocus())
|
|
3687
3948
|
return;
|
|
3949
|
+
// new this.$.$mol_after_frame( ()=> {
|
|
3950
|
+
// this.dom_node().scrollIntoView({ block: 'start', inline: 'nearest' })
|
|
3951
|
+
// } )
|
|
3688
3952
|
new this.$.$mol_after_timeout(0, () => {
|
|
3689
3953
|
this.focused(true);
|
|
3690
3954
|
});
|
|
@@ -3765,6 +4029,7 @@ var $;
|
|
|
3765
4029
|
"use strict";
|
|
3766
4030
|
var $;
|
|
3767
4031
|
(function ($) {
|
|
4032
|
+
/** Plugin is component without its own DOM element, but instead uses the owner DOM element */
|
|
3768
4033
|
class $mol_plugin extends $mol_view {
|
|
3769
4034
|
dom_node_external(next) {
|
|
3770
4035
|
return next ?? $mol_owning_get(this).host.dom_node();
|
|
@@ -3781,6 +4046,7 @@ var $;
|
|
|
3781
4046
|
var $;
|
|
3782
4047
|
(function ($) {
|
|
3783
4048
|
function $mol_view_component(View) {
|
|
4049
|
+
// service worker
|
|
3784
4050
|
if (typeof HTMLElement !== 'function')
|
|
3785
4051
|
return;
|
|
3786
4052
|
class Component extends HTMLElement {
|
|
@@ -3792,6 +4058,7 @@ var $;
|
|
|
3792
4058
|
if (!this.shadowRoot) {
|
|
3793
4059
|
this.attachShadow({ mode: 'open' });
|
|
3794
4060
|
const node = this.view.dom_node();
|
|
4061
|
+
// node.setAttribute( 'mol_view_root', '' )
|
|
3795
4062
|
for (const style of $mol_dom_context.document.getElementsByTagName('style')) {
|
|
3796
4063
|
this.shadowRoot.append(style.cloneNode(true));
|
|
3797
4064
|
}
|
|
@@ -3833,6 +4100,7 @@ var $;
|
|
|
3833
4100
|
const descr = Reflect.getOwnPropertyDescriptor(proto, field);
|
|
3834
4101
|
if (typeof descr.value !== 'function')
|
|
3835
4102
|
continue;
|
|
4103
|
+
// if( descr.value.length === 0 ) continue
|
|
3836
4104
|
Component.observedAttributes.add(field);
|
|
3837
4105
|
Component.observedAttributes.add('#' + field);
|
|
3838
4106
|
}
|
|
@@ -3859,6 +4127,7 @@ var $;
|
|
|
3859
4127
|
;
|
|
3860
4128
|
"use strict";
|
|
3861
4129
|
|
|
4130
|
+
|
|
3862
4131
|
;
|
|
3863
4132
|
($.$mol_paragraph) = class $mol_paragraph extends ($.$mol_view) {
|
|
3864
4133
|
line_height(){
|
|
@@ -3882,6 +4151,7 @@ var $;
|
|
|
3882
4151
|
;
|
|
3883
4152
|
"use strict";
|
|
3884
4153
|
|
|
4154
|
+
|
|
3885
4155
|
;
|
|
3886
4156
|
"use strict";
|
|
3887
4157
|
var $;
|
|
@@ -3986,8 +4256,10 @@ var $;
|
|
|
3986
4256
|
var $;
|
|
3987
4257
|
(function ($) {
|
|
3988
4258
|
let x = /x/[Symbol.matchAll];
|
|
4259
|
+
/** Type safe reguar expression builder */
|
|
3989
4260
|
class $mol_regexp extends RegExp {
|
|
3990
4261
|
groups;
|
|
4262
|
+
/** Prefer to use $mol_regexp.from */
|
|
3991
4263
|
constructor(source, flags = 'gsu', groups = []) {
|
|
3992
4264
|
super(source, flags);
|
|
3993
4265
|
this.groups = groups;
|
|
@@ -4007,12 +4279,14 @@ var $;
|
|
|
4007
4279
|
this.lastIndex = index;
|
|
4008
4280
|
}
|
|
4009
4281
|
}
|
|
4282
|
+
/** Parses input and returns found capture groups or null */
|
|
4010
4283
|
[Symbol.match](str) {
|
|
4011
4284
|
const res = [...this[Symbol.matchAll](str)].filter(r => r.groups).map(r => r[0]);
|
|
4012
4285
|
if (!res.length)
|
|
4013
4286
|
return null;
|
|
4014
4287
|
return res;
|
|
4015
4288
|
}
|
|
4289
|
+
/** Splits string by regexp edges */
|
|
4016
4290
|
[Symbol.split](str) {
|
|
4017
4291
|
const res = [];
|
|
4018
4292
|
let token_last = null;
|
|
@@ -4067,12 +4341,14 @@ var $;
|
|
|
4067
4341
|
get native() {
|
|
4068
4342
|
return new RegExp(this.source, this.flags);
|
|
4069
4343
|
}
|
|
4344
|
+
/** Makes regexp that greedy repeats this pattern with delimiter */
|
|
4070
4345
|
static separated(chunk, sep) {
|
|
4071
4346
|
return $mol_regexp.from([
|
|
4072
4347
|
$mol_regexp.repeat_greedy([[chunk], sep], 0),
|
|
4073
4348
|
chunk,
|
|
4074
4349
|
]);
|
|
4075
4350
|
}
|
|
4351
|
+
/** Makes regexp that non-greedy repeats this pattern from min to max count */
|
|
4076
4352
|
static repeat(source, min = 0, max = Number.POSITIVE_INFINITY) {
|
|
4077
4353
|
const regexp = $mol_regexp.from(source);
|
|
4078
4354
|
const upper = Number.isFinite(max) ? max : '';
|
|
@@ -4088,6 +4364,7 @@ var $;
|
|
|
4088
4364
|
};
|
|
4089
4365
|
return regexp2;
|
|
4090
4366
|
}
|
|
4367
|
+
/** Makes regexp that greedy repeats this pattern from min to max count */
|
|
4091
4368
|
static repeat_greedy(source, min = 0, max = Number.POSITIVE_INFINITY) {
|
|
4092
4369
|
const regexp = $mol_regexp.from(source);
|
|
4093
4370
|
const upper = Number.isFinite(max) ? max : '';
|
|
@@ -4103,6 +4380,7 @@ var $;
|
|
|
4103
4380
|
};
|
|
4104
4381
|
return regexp2;
|
|
4105
4382
|
}
|
|
4383
|
+
/** Makes regexp that match any of options */
|
|
4106
4384
|
static vary(sources, flags = 'gsu') {
|
|
4107
4385
|
const groups = [];
|
|
4108
4386
|
const chunks = sources.map(source => {
|
|
@@ -4112,17 +4390,21 @@ var $;
|
|
|
4112
4390
|
});
|
|
4113
4391
|
return new $mol_regexp(`(?:${chunks.join('|')})`, flags, groups);
|
|
4114
4392
|
}
|
|
4393
|
+
/** Makes regexp that allow absent of this pattern */
|
|
4115
4394
|
static optional(source) {
|
|
4116
4395
|
return $mol_regexp.repeat_greedy(source, 0, 1);
|
|
4117
4396
|
}
|
|
4397
|
+
/** Makes regexp that look ahead for pattern */
|
|
4118
4398
|
static force_after(source) {
|
|
4119
4399
|
const regexp = $mol_regexp.from(source);
|
|
4120
4400
|
return new $mol_regexp(`(?=${regexp.source})`, regexp.flags, regexp.groups);
|
|
4121
4401
|
}
|
|
4402
|
+
/** Makes regexp that look ahead for pattern */
|
|
4122
4403
|
static forbid_after(source) {
|
|
4123
4404
|
const regexp = $mol_regexp.from(source);
|
|
4124
4405
|
return new $mol_regexp(`(?!${regexp.source})`, regexp.flags, regexp.groups);
|
|
4125
4406
|
}
|
|
4407
|
+
/** Converts some js values to regexp */
|
|
4126
4408
|
static from(source, { ignoreCase, multiline } = {
|
|
4127
4409
|
ignoreCase: false,
|
|
4128
4410
|
multiline: false,
|
|
@@ -4223,9 +4505,11 @@ var $;
|
|
|
4223
4505
|
return regexp;
|
|
4224
4506
|
}
|
|
4225
4507
|
}
|
|
4508
|
+
/** Makes regexp which includes only unicode category */
|
|
4226
4509
|
static unicode_only(...category) {
|
|
4227
4510
|
return new $mol_regexp(`\\p{${category.join('=')}}`);
|
|
4228
4511
|
}
|
|
4512
|
+
/** Makes regexp which excludes unicode category */
|
|
4229
4513
|
static unicode_except(...category) {
|
|
4230
4514
|
return new $mol_regexp(`\\P{${category.join('=')}}`);
|
|
4231
4515
|
}
|
|
@@ -4269,12 +4553,17 @@ var $;
|
|
|
4269
4553
|
;
|
|
4270
4554
|
"use strict";
|
|
4271
4555
|
|
|
4556
|
+
|
|
4272
4557
|
;
|
|
4273
4558
|
"use strict";
|
|
4274
4559
|
var $;
|
|
4275
4560
|
(function ($) {
|
|
4276
4561
|
var $$;
|
|
4277
4562
|
(function ($$) {
|
|
4563
|
+
/**
|
|
4564
|
+
* Output text with dimmed mismatched substrings.
|
|
4565
|
+
* @see https://mol.hyoo.ru/#!section=demos/demo=mol_dimmer_demo
|
|
4566
|
+
*/
|
|
4278
4567
|
class $mol_dimmer extends $.$mol_dimmer {
|
|
4279
4568
|
parts() {
|
|
4280
4569
|
const needle = this.needle();
|
|
@@ -4469,6 +4758,11 @@ var $;
|
|
|
4469
4758
|
"use strict";
|
|
4470
4759
|
var $;
|
|
4471
4760
|
(function ($) {
|
|
4761
|
+
/**
|
|
4762
|
+
* CSS in TS.
|
|
4763
|
+
* Statically typed CSS style sheets. Following samples show which CSS code are generated from TS code.
|
|
4764
|
+
* @see https://mol.hyoo.ru/#!section=docs/=xwq9q5_f966fg
|
|
4765
|
+
*/
|
|
4472
4766
|
function $mol_style_define(Component, config) {
|
|
4473
4767
|
return $mol_style_attach(Component.name, $mol_style_sheet(Component, config));
|
|
4474
4768
|
}
|
|
@@ -4478,6 +4772,7 @@ var $;
|
|
|
4478
4772
|
;
|
|
4479
4773
|
"use strict";
|
|
4480
4774
|
|
|
4775
|
+
|
|
4481
4776
|
;
|
|
4482
4777
|
"use strict";
|
|
4483
4778
|
var $;
|
|
@@ -4599,6 +4894,7 @@ var $;
|
|
|
4599
4894
|
"use strict";
|
|
4600
4895
|
var $;
|
|
4601
4896
|
(function ($) {
|
|
4897
|
+
/** Creates lexer by dictionary of lexems. Lexem that started first wins. Then lexem that declared earlier wins. Use regexp capture to take parts of token. */
|
|
4602
4898
|
class $mol_syntax2 {
|
|
4603
4899
|
lexems;
|
|
4604
4900
|
constructor(lexems) {
|
|
@@ -4670,6 +4966,8 @@ var $;
|
|
|
4670
4966
|
'code': /```(.+?)```|;;(.+?);;|`(.+?)`/,
|
|
4671
4967
|
'insert': /\+\+(.+?)\+\+/,
|
|
4672
4968
|
'delete': /~~(.+?)~~|--(.+?)--/,
|
|
4969
|
+
// 'remark' : /(\()(.+?)(\))/ ,
|
|
4970
|
+
// 'quote' : /(")(.+?)(")/ ,
|
|
4673
4971
|
'embed': /""(?:(.*?)\\)?(.*?)""/,
|
|
4674
4972
|
'link': /\\\\(?:(.*?)\\)?(.*?)\\\\/,
|
|
4675
4973
|
'image-link': /!\[([^\[\]]*?)\]\((.*?)\)/,
|
|
@@ -4699,6 +4997,7 @@ var $;
|
|
|
4699
4997
|
;
|
|
4700
4998
|
"use strict";
|
|
4701
4999
|
|
|
5000
|
+
|
|
4702
5001
|
;
|
|
4703
5002
|
"use strict";
|
|
4704
5003
|
var $;
|
|
@@ -4715,6 +5014,7 @@ var $;
|
|
|
4715
5014
|
tokens(path) {
|
|
4716
5015
|
const tokens = [];
|
|
4717
5016
|
const text = (path.length > 0)
|
|
5017
|
+
// @FIXME: this logic compatible only with `string`
|
|
4718
5018
|
? this.tokens(path.slice(0, path.length - 1))[path[path.length - 1]].found.slice(1, -1)
|
|
4719
5019
|
: this.text();
|
|
4720
5020
|
this.syntax().tokenize(text, (name, found, chunks) => {
|
|
@@ -4980,12 +5280,18 @@ var $;
|
|
|
4980
5280
|
;
|
|
4981
5281
|
"use strict";
|
|
4982
5282
|
|
|
5283
|
+
|
|
4983
5284
|
;
|
|
4984
5285
|
"use strict";
|
|
4985
5286
|
var $;
|
|
4986
5287
|
(function ($) {
|
|
4987
5288
|
var $$;
|
|
4988
5289
|
(function ($$) {
|
|
5290
|
+
/**
|
|
5291
|
+
* The list of rows with lazy/virtual rendering support based on `minimal_height` of rows.
|
|
5292
|
+
* `mol_list` should contain only components that inherits `mol_view`. You should not place raw strings or numbers in list.
|
|
5293
|
+
* @see https://mol.hyoo.ru/#!section=demos/demo=mol_list_demo
|
|
5294
|
+
*/
|
|
4989
5295
|
class $mol_list extends $.$mol_list {
|
|
4990
5296
|
sub() {
|
|
4991
5297
|
const rows = this.rows();
|
|
@@ -5027,9 +5333,11 @@ var $;
|
|
|
5027
5333
|
const gap_after = $mol_mem_cached(() => this.gap_after()) ?? 0;
|
|
5028
5334
|
let top = Math.ceil(rect?.top ?? 0) + gap_before;
|
|
5029
5335
|
let bottom = Math.ceil(rect?.bottom ?? 0) - gap_after;
|
|
5336
|
+
// change nothing when already covers all limits
|
|
5030
5337
|
if (top <= limit_top && bottom >= limit_bottom) {
|
|
5031
5338
|
return [min2, max2];
|
|
5032
5339
|
}
|
|
5340
|
+
// jumps when fully over limits
|
|
5033
5341
|
if (anchoring && ((bottom < limit_top) || (top > limit_bottom))) {
|
|
5034
5342
|
min = 0;
|
|
5035
5343
|
top = Math.ceil(rect?.top ?? 0);
|
|
@@ -5046,18 +5354,22 @@ var $;
|
|
|
5046
5354
|
}
|
|
5047
5355
|
let top2 = top;
|
|
5048
5356
|
let bottom2 = bottom;
|
|
5357
|
+
// force recalc min when overlapse top limit
|
|
5049
5358
|
if (anchoring && (top < limit_top) && (bottom < limit_bottom) && (max < kids.length)) {
|
|
5050
5359
|
min2 = max;
|
|
5051
5360
|
top2 = bottom;
|
|
5052
5361
|
}
|
|
5362
|
+
// force recalc max when overlapse bottom limit
|
|
5053
5363
|
if ((bottom > limit_bottom) && (top > limit_top) && (min > 0)) {
|
|
5054
5364
|
max2 = min;
|
|
5055
5365
|
bottom2 = top;
|
|
5056
5366
|
}
|
|
5367
|
+
// extend min to cover top limit
|
|
5057
5368
|
while (anchoring && ((top2 > limit_top) && (min2 > 0))) {
|
|
5058
5369
|
--min2;
|
|
5059
5370
|
top2 -= this.item_height_min(min2);
|
|
5060
5371
|
}
|
|
5372
|
+
// extend max to cover bottom limit
|
|
5061
5373
|
while (bottom2 < limit_bottom && max2 < kids.length) {
|
|
5062
5374
|
bottom2 += this.item_height_min(max2);
|
|
5063
5375
|
++max2;
|
|
@@ -5180,6 +5492,10 @@ var $;
|
|
|
5180
5492
|
"use strict";
|
|
5181
5493
|
var $;
|
|
5182
5494
|
(function ($) {
|
|
5495
|
+
/**
|
|
5496
|
+
* Z-index values for layers
|
|
5497
|
+
* https://page.hyoo.ru/#!=xthcpx_wqmiba
|
|
5498
|
+
*/
|
|
5183
5499
|
$.$mol_layer = $mol_style_prop('mol_layer', [
|
|
5184
5500
|
'hover',
|
|
5185
5501
|
'focus',
|
|
@@ -5206,6 +5522,7 @@ var $;
|
|
|
5206
5522
|
;
|
|
5207
5523
|
"use strict";
|
|
5208
5524
|
|
|
5525
|
+
|
|
5209
5526
|
;
|
|
5210
5527
|
($.$mol_button) = class $mol_button extends ($.$mol_view) {
|
|
5211
5528
|
event_activate(next){
|
|
@@ -5295,6 +5612,10 @@ var $;
|
|
|
5295
5612
|
"use strict";
|
|
5296
5613
|
var $;
|
|
5297
5614
|
(function ($) {
|
|
5615
|
+
/**
|
|
5616
|
+
* Key names code for hotkey
|
|
5617
|
+
* @see [mol_hotkey](../../hotkey/hotkey.view.ts)
|
|
5618
|
+
*/
|
|
5298
5619
|
let $mol_keyboard_code;
|
|
5299
5620
|
(function ($mol_keyboard_code) {
|
|
5300
5621
|
$mol_keyboard_code[$mol_keyboard_code["backspace"] = 8] = "backspace";
|
|
@@ -5403,12 +5724,17 @@ var $;
|
|
|
5403
5724
|
;
|
|
5404
5725
|
"use strict";
|
|
5405
5726
|
|
|
5727
|
+
|
|
5406
5728
|
;
|
|
5407
5729
|
"use strict";
|
|
5408
5730
|
var $;
|
|
5409
5731
|
(function ($) {
|
|
5410
5732
|
var $$;
|
|
5411
5733
|
(function ($$) {
|
|
5734
|
+
/**
|
|
5735
|
+
* Simple button.
|
|
5736
|
+
* @see https://mol.hyoo.ru/#!section=demos/demo=mol_button_demo
|
|
5737
|
+
*/
|
|
5412
5738
|
class $mol_button extends $.$mol_button {
|
|
5413
5739
|
disabled() {
|
|
5414
5740
|
return !this.enabled();
|
|
@@ -5424,6 +5750,7 @@ var $;
|
|
|
5424
5750
|
this.status([null]);
|
|
5425
5751
|
}
|
|
5426
5752
|
catch (error) {
|
|
5753
|
+
// Calling actions from catch section, if throwing promise breaks idempotency
|
|
5427
5754
|
Promise.resolve().then(() => this.status([error]));
|
|
5428
5755
|
$mol_fail_hidden(error);
|
|
5429
5756
|
}
|
|
@@ -5493,6 +5820,7 @@ var $;
|
|
|
5493
5820
|
;
|
|
5494
5821
|
"use strict";
|
|
5495
5822
|
|
|
5823
|
+
|
|
5496
5824
|
;
|
|
5497
5825
|
($.$mol_button_minor) = class $mol_button_minor extends ($.$mol_button_typed) {};
|
|
5498
5826
|
|
|
@@ -5507,6 +5835,7 @@ var $;
|
|
|
5507
5835
|
;
|
|
5508
5836
|
"use strict";
|
|
5509
5837
|
|
|
5838
|
+
|
|
5510
5839
|
;
|
|
5511
5840
|
"use strict";
|
|
5512
5841
|
var $;
|
|
@@ -5538,6 +5867,7 @@ var $;
|
|
|
5538
5867
|
"use strict";
|
|
5539
5868
|
var $;
|
|
5540
5869
|
(function ($) {
|
|
5870
|
+
/** State of time moment */
|
|
5541
5871
|
class $mol_state_time extends $mol_object {
|
|
5542
5872
|
static task(precision, reset) {
|
|
5543
5873
|
if (precision) {
|
|
@@ -5564,12 +5894,14 @@ var $;
|
|
|
5564
5894
|
;
|
|
5565
5895
|
"use strict";
|
|
5566
5896
|
|
|
5897
|
+
|
|
5567
5898
|
;
|
|
5568
5899
|
"use strict";
|
|
5569
5900
|
var $;
|
|
5570
5901
|
(function ($) {
|
|
5571
5902
|
var $$;
|
|
5572
5903
|
(function ($$) {
|
|
5904
|
+
/** Base SVG component to display SVG images or icons. */
|
|
5573
5905
|
class $mol_svg extends $.$mol_svg {
|
|
5574
5906
|
computed_style() {
|
|
5575
5907
|
const win = this.$.$mol_dom_context;
|
|
@@ -5629,6 +5961,7 @@ var $;
|
|
|
5629
5961
|
;
|
|
5630
5962
|
"use strict";
|
|
5631
5963
|
|
|
5964
|
+
|
|
5632
5965
|
;
|
|
5633
5966
|
($.$mol_svg_path) = class $mol_svg_path extends ($.$mol_svg) {
|
|
5634
5967
|
geometry(){
|
|
@@ -5646,6 +5979,7 @@ var $;
|
|
|
5646
5979
|
;
|
|
5647
5980
|
"use strict";
|
|
5648
5981
|
|
|
5982
|
+
|
|
5649
5983
|
;
|
|
5650
5984
|
($.$mol_icon) = class $mol_icon extends ($.$mol_svg_root) {
|
|
5651
5985
|
path(){
|
|
@@ -5682,6 +6016,7 @@ var $;
|
|
|
5682
6016
|
;
|
|
5683
6017
|
"use strict";
|
|
5684
6018
|
|
|
6019
|
+
|
|
5685
6020
|
;
|
|
5686
6021
|
($.$mol_icon_clipboard) = class $mol_icon_clipboard extends ($.$mol_icon) {
|
|
5687
6022
|
path(){
|
|
@@ -5693,6 +6028,7 @@ var $;
|
|
|
5693
6028
|
;
|
|
5694
6029
|
"use strict";
|
|
5695
6030
|
|
|
6031
|
+
|
|
5696
6032
|
;
|
|
5697
6033
|
($.$mol_icon_clipboard_outline) = class $mol_icon_clipboard_outline extends ($.$mol_icon) {
|
|
5698
6034
|
path(){
|
|
@@ -5704,6 +6040,7 @@ var $;
|
|
|
5704
6040
|
;
|
|
5705
6041
|
"use strict";
|
|
5706
6042
|
|
|
6043
|
+
|
|
5707
6044
|
;
|
|
5708
6045
|
($.$mol_button_copy) = class $mol_button_copy extends ($.$mol_button_minor) {
|
|
5709
6046
|
text(){
|
|
@@ -5763,12 +6100,17 @@ var $;
|
|
|
5763
6100
|
;
|
|
5764
6101
|
"use strict";
|
|
5765
6102
|
|
|
6103
|
+
|
|
5766
6104
|
;
|
|
5767
6105
|
"use strict";
|
|
5768
6106
|
var $;
|
|
5769
6107
|
(function ($) {
|
|
5770
6108
|
var $$;
|
|
5771
6109
|
(function ($$) {
|
|
6110
|
+
/**
|
|
6111
|
+
* Button copy text() value to clipboard
|
|
6112
|
+
* @see https://mol.hyoo.ru/#!section=demos/demo=mol_button_demo
|
|
6113
|
+
*/
|
|
5772
6114
|
class $mol_button_copy extends $.$mol_button_copy {
|
|
5773
6115
|
data() {
|
|
5774
6116
|
return Object.fromEntries(this.blobs().map(blob => [blob.type, blob]));
|
|
@@ -5933,6 +6275,10 @@ var $;
|
|
|
5933
6275
|
"use strict";
|
|
5934
6276
|
var $;
|
|
5935
6277
|
(function ($) {
|
|
6278
|
+
/**
|
|
6279
|
+
* Decorates method to fiber to ensure it is executed only once inside other fiber from [mol_wire](../wire/README.md)
|
|
6280
|
+
* @see https://mol.hyoo.ru/#!section=docs/=1fcpsq_1wh0h2
|
|
6281
|
+
*/
|
|
5936
6282
|
$.$mol_action = $mol_wire_method;
|
|
5937
6283
|
})($ || ($ = {}));
|
|
5938
6284
|
|
|
@@ -6009,7 +6355,8 @@ var $;
|
|
|
6009
6355
|
"use strict";
|
|
6010
6356
|
var $;
|
|
6011
6357
|
(function ($) {
|
|
6012
|
-
let buf = new Uint8Array(2 ** 12);
|
|
6358
|
+
let buf = new Uint8Array(2 ** 12); // 4KB Mem Page
|
|
6359
|
+
/** Temporary buffer. Recursive usage isn't supported. */
|
|
6013
6360
|
function $mol_charset_buffer(size) {
|
|
6014
6361
|
if (buf.byteLength < size)
|
|
6015
6362
|
buf = new Uint8Array(size);
|
|
@@ -6031,19 +6378,19 @@ var $;
|
|
|
6031
6378
|
let pos = from;
|
|
6032
6379
|
for (let i = 0; i < str.length; i++) {
|
|
6033
6380
|
let code = str.charCodeAt(i);
|
|
6034
|
-
if (code < 0x80) {
|
|
6381
|
+
if (code < 0x80) { // ASCII - 1 octet
|
|
6035
6382
|
buf[pos++] = code;
|
|
6036
6383
|
}
|
|
6037
|
-
else if (code < 0x800) {
|
|
6384
|
+
else if (code < 0x800) { // 2 octet
|
|
6038
6385
|
buf[pos++] = 0xc0 | (code >> 6);
|
|
6039
6386
|
buf[pos++] = 0x80 | (code & 0x3f);
|
|
6040
6387
|
}
|
|
6041
|
-
else if (code < 0xd800 || code >= 0xe000) {
|
|
6388
|
+
else if (code < 0xd800 || code >= 0xe000) { // 3 octet
|
|
6042
6389
|
buf[pos++] = 0xe0 | (code >> 12);
|
|
6043
6390
|
buf[pos++] = 0x80 | ((code >> 6) & 0x3f);
|
|
6044
6391
|
buf[pos++] = 0x80 | (code & 0x3f);
|
|
6045
6392
|
}
|
|
6046
|
-
else {
|
|
6393
|
+
else { // surrogate pair
|
|
6047
6394
|
const point = ((code - 0xd800) << 10) + str.charCodeAt(++i) + 0x2400;
|
|
6048
6395
|
buf[pos++] = 0xf0 | (point >> 18);
|
|
6049
6396
|
buf[pos++] = 0x80 | ((point >> 12) & 0x3f);
|
|
@@ -6107,12 +6454,16 @@ var $;
|
|
|
6107
6454
|
(function ($) {
|
|
6108
6455
|
let file_modes;
|
|
6109
6456
|
(function (file_modes) {
|
|
6457
|
+
/** create if it doesn't already exist */
|
|
6110
6458
|
file_modes[file_modes["create"] = $node.fs.constants.O_CREAT] = "create";
|
|
6459
|
+
/** truncate to zero size if it already exists */
|
|
6111
6460
|
file_modes[file_modes["exists_truncate"] = $node.fs.constants.O_TRUNC] = "exists_truncate";
|
|
6461
|
+
/** throw exception if it already exists */
|
|
6112
6462
|
file_modes[file_modes["exists_fail"] = $node.fs.constants.O_EXCL] = "exists_fail";
|
|
6113
6463
|
file_modes[file_modes["read_only"] = $node.fs.constants.O_RDONLY] = "read_only";
|
|
6114
6464
|
file_modes[file_modes["write_only"] = $node.fs.constants.O_WRONLY] = "write_only";
|
|
6115
6465
|
file_modes[file_modes["read_write"] = $node.fs.constants.O_RDWR] = "read_write";
|
|
6466
|
+
/** data will be appended to the end */
|
|
6116
6467
|
file_modes[file_modes["append"] = $node.fs.constants.O_APPEND] = "append";
|
|
6117
6468
|
})(file_modes || (file_modes = {}));
|
|
6118
6469
|
function mode_mask(modes) {
|
|
@@ -6177,12 +6528,24 @@ var $;
|
|
|
6177
6528
|
root() {
|
|
6178
6529
|
const path = this.path();
|
|
6179
6530
|
const base = this.constructor.base;
|
|
6531
|
+
// Если путь выше или равен base или если parent такойже как и this - считаем это корнем
|
|
6180
6532
|
return base.startsWith(path) || this == this.parent();
|
|
6181
6533
|
}
|
|
6182
6534
|
stat(next, virt) {
|
|
6183
6535
|
const path = this.path();
|
|
6184
6536
|
const parent = this.parent();
|
|
6537
|
+
// Отслеживать проверку наличия родительской папки не стоит до корня диска
|
|
6538
|
+
// Лучше ограничить mam-ом
|
|
6185
6539
|
if (!this.root()) {
|
|
6540
|
+
/*
|
|
6541
|
+
Если parent папка удалилась, надо ресетнуть все объекты в ней на любой глубине.
|
|
6542
|
+
Например, rm -rf с последующим git pull: parent папка может удалиться, потом создасться,
|
|
6543
|
+
а текущая папка успеет только удалиться до момента выполнения stat.
|
|
6544
|
+
Поэтому parent.exists() не запустит перевычисления, нужна именно parent.version()
|
|
6545
|
+
|
|
6546
|
+
Однако, parent.version() меняется не только при удалении, будет ложное срабатывание
|
|
6547
|
+
С этим придется мириться, красивого решения пока нет.
|
|
6548
|
+
*/
|
|
6186
6549
|
parent.version();
|
|
6187
6550
|
}
|
|
6188
6551
|
parent.watcher();
|
|
@@ -6196,9 +6559,19 @@ var $;
|
|
|
6196
6559
|
if (/([\/\\]\.|___$)/.test(path))
|
|
6197
6560
|
return;
|
|
6198
6561
|
const file = this.relative(path.at(-1) === '/' ? path.slice(0, -1) : path);
|
|
6562
|
+
// console.log(type, path)
|
|
6563
|
+
// add (change): добавился файл - у parent надо обновить список sub, если он был заюзан
|
|
6564
|
+
// change, unlink (rename): обновился или удалился файл - ресетим
|
|
6565
|
+
// addDir (change), добавилась папка, у parent обновляем список директорий в sub
|
|
6566
|
+
// дочерние ресетим
|
|
6567
|
+
// unlinkDir (rename), удалилась папка, ресетим ее
|
|
6568
|
+
// stat у всех дочерних обновится сам, т.к. связан с parent.version()
|
|
6199
6569
|
this.changed.add(file);
|
|
6200
6570
|
if (!this.watching)
|
|
6201
6571
|
return;
|
|
6572
|
+
// throttle, пока события поступают не сбрасываем.
|
|
6573
|
+
// аналог awaitWriteFinish из chokidar
|
|
6574
|
+
// интервалы между change-сообщениями модифицируемого файла должны быть меньше watch_debounce
|
|
6202
6575
|
this.frame?.destructor();
|
|
6203
6576
|
this.frame = new this.$.$mol_after_timeout(this.watch_debounce(), () => {
|
|
6204
6577
|
if (!this.watching)
|
|
@@ -6207,8 +6580,16 @@ var $;
|
|
|
6207
6580
|
$mol_wire_async(this).flush();
|
|
6208
6581
|
});
|
|
6209
6582
|
}
|
|
6583
|
+
/**
|
|
6584
|
+
* Должно быть больше, чем время между событиями от вотчера при записи внешним процессом.
|
|
6585
|
+
* Иначе запуск ресетов паралельно с изменением может привести к неконсистентности.
|
|
6586
|
+
*/
|
|
6210
6587
|
static watch_debounce() { return 500; }
|
|
6211
6588
|
static flush() {
|
|
6589
|
+
// Пока flush работает, вотчер сюда не заходит, но может добавлять новые изменения
|
|
6590
|
+
// на каждом перезапуске они применятся
|
|
6591
|
+
// Пока run выполняется, изменения накапливаются, в конце run вызывается flush
|
|
6592
|
+
// Пока применяются изменения, run должен ожидать конца flush
|
|
6212
6593
|
for (const file of this.changed) {
|
|
6213
6594
|
const parent = file.parent();
|
|
6214
6595
|
try {
|
|
@@ -6223,16 +6604,32 @@ var $;
|
|
|
6223
6604
|
}
|
|
6224
6605
|
this.changed.clear();
|
|
6225
6606
|
this.watching = true;
|
|
6607
|
+
// this.watch_wd?.destructor()
|
|
6608
|
+
// this.watch_wd = null
|
|
6226
6609
|
}
|
|
6227
6610
|
static watching = true;
|
|
6228
6611
|
static lock = new $mol_lock;
|
|
6229
6612
|
static watch_off(path) {
|
|
6230
6613
|
this.watching = false;
|
|
6614
|
+
// run должен ожидать конца flush
|
|
6231
6615
|
this.flush();
|
|
6232
6616
|
this.watching = false;
|
|
6617
|
+
/*
|
|
6618
|
+
watch запаздывает и событие может прилететь через 3 сек после окончания сайд эффекта
|
|
6619
|
+
поэтому добавляем папку, которую меняет side_effect
|
|
6620
|
+
Когда дойдет до выполнения flush, он ресетнет ее
|
|
6621
|
+
|
|
6622
|
+
Иначе будут лишние срабатывания
|
|
6623
|
+
Например, удалили hyoo/board, watch ресетит и exists начинает отдавать false, срабатывает git clone
|
|
6624
|
+
Сразу после него событие addDir еще не успело прийти,
|
|
6625
|
+
на следующем перезапуске вызывается git pull, т.к.
|
|
6626
|
+
с точки зрения реактивной системы hyoo/board еще не существует.
|
|
6627
|
+
*/
|
|
6233
6628
|
this.changed.add(this.absolute(path));
|
|
6234
6629
|
}
|
|
6630
|
+
// protected static watch_wd = null as null | $mol_after_timeout
|
|
6235
6631
|
static unwatched(side_effect, affected_dir) {
|
|
6632
|
+
// ждем, пока выполнится предыдущий unwatched
|
|
6236
6633
|
const unlock = this.lock.grab();
|
|
6237
6634
|
this.watch_off(affected_dir);
|
|
6238
6635
|
try {
|
|
@@ -6255,6 +6652,7 @@ var $;
|
|
|
6255
6652
|
modified() { return this.stat()?.mtime ?? null; }
|
|
6256
6653
|
version() {
|
|
6257
6654
|
const next = this.stat()?.mtime.getTime().toString(36).toUpperCase() ?? '';
|
|
6655
|
+
// console.log('version', next, this.path())
|
|
6258
6656
|
return next;
|
|
6259
6657
|
}
|
|
6260
6658
|
info(path) { return null; }
|
|
@@ -6272,15 +6670,19 @@ var $;
|
|
|
6272
6670
|
writable(opts) {
|
|
6273
6671
|
return new WritableStream;
|
|
6274
6672
|
}
|
|
6673
|
+
// open( ... modes: readonly $mol_file_mode[] ) { return 0 }
|
|
6275
6674
|
buffer(next) {
|
|
6675
|
+
// Если версия пустая - возвращаем пустой буфер
|
|
6276
6676
|
let readed = new Uint8Array();
|
|
6277
6677
|
if (next === undefined) {
|
|
6678
|
+
// Если меняется версия файла, буфер надо перечитать
|
|
6278
6679
|
if (this.version())
|
|
6279
6680
|
readed = this.read();
|
|
6280
6681
|
}
|
|
6281
6682
|
const prev = $mol_mem_cached(() => this.buffer());
|
|
6282
6683
|
const changed = prev === undefined || !$mol_compare_array(prev, next ?? readed);
|
|
6283
6684
|
if (prev !== undefined && changed) {
|
|
6685
|
+
// Логируем, если повторно читаем/пишем и буфер поменялся
|
|
6284
6686
|
this.$.$mol_log3_rise({
|
|
6285
6687
|
place: `$mol_file_node.buffer()`,
|
|
6286
6688
|
message: 'Changed',
|
|
@@ -6289,6 +6691,11 @@ var $;
|
|
|
6289
6691
|
}
|
|
6290
6692
|
if (next === undefined)
|
|
6291
6693
|
return changed ? readed : prev;
|
|
6694
|
+
// Если буфер при записи не поменялся и файл не удаляли перед этим - не записываем новую версию.
|
|
6695
|
+
// Если записывать, это приведет к смене mtime и вотчер снова триггернется, даже если содержимое файла не поменялось.
|
|
6696
|
+
// В этом алгоритме есть изъян.
|
|
6697
|
+
// Если файл записали, потом отключили вотчер, кто-то из вне его поменял, потом включили вотчер, снова записали тот же буфер,
|
|
6698
|
+
// то буфер не запишется на диск, т.к. кэш не консистентен с диском.
|
|
6292
6699
|
if (!changed && this.exists())
|
|
6293
6700
|
return prev;
|
|
6294
6701
|
this.parent().exists(true);
|
|
@@ -6324,13 +6731,21 @@ var $;
|
|
|
6324
6731
|
}
|
|
6325
6732
|
return null;
|
|
6326
6733
|
}
|
|
6734
|
+
// static watch_root = ''
|
|
6735
|
+
// static watcher_warned = false
|
|
6327
6736
|
watcher() {
|
|
6737
|
+
// const constructor = this.constructor as typeof $mol_file_base
|
|
6738
|
+
// if (! constructor.watcher_warned) {
|
|
6739
|
+
// console.warn(`${constructor}.watcher() not implemented`)
|
|
6740
|
+
// constructor.watcher_warned = true
|
|
6741
|
+
// }
|
|
6328
6742
|
return {
|
|
6329
6743
|
destructor() { }
|
|
6330
6744
|
};
|
|
6331
6745
|
}
|
|
6332
6746
|
exists(next) {
|
|
6333
6747
|
const exists = Boolean(this.stat());
|
|
6748
|
+
// console.log('exists current', exists, 'next', next, this.path())
|
|
6334
6749
|
if (next === undefined)
|
|
6335
6750
|
return exists;
|
|
6336
6751
|
if (next === exists)
|
|
@@ -6356,6 +6771,10 @@ var $;
|
|
|
6356
6771
|
return match ? match[1].substring(1) : '';
|
|
6357
6772
|
}
|
|
6358
6773
|
text(next, virt) {
|
|
6774
|
+
// Если записываем text, и вотчер ресетнул записанный файл,
|
|
6775
|
+
// то надо снова его обновить, вызвать логику, которая делала пуш в text.
|
|
6776
|
+
// Например файл удалили, потом снова создали, версия поменялась - перезаписываем
|
|
6777
|
+
// Если использовать version, то вновь созданный файл, через вотчер запустит свое пересоздание
|
|
6359
6778
|
if (next !== undefined)
|
|
6360
6779
|
this.exists();
|
|
6361
6780
|
return this.text_int(next, virt);
|
|
@@ -6380,6 +6799,7 @@ var $;
|
|
|
6380
6799
|
if (this.type() !== 'dir')
|
|
6381
6800
|
return [];
|
|
6382
6801
|
this.version();
|
|
6802
|
+
// Если дочерний file удалился, список надо обновить
|
|
6383
6803
|
return this.kids().filter(file => file.exists());
|
|
6384
6804
|
}
|
|
6385
6805
|
resolve(path) {
|
|
@@ -6524,10 +6944,15 @@ var $;
|
|
|
6524
6944
|
watcher(reset) {
|
|
6525
6945
|
const path = this.path();
|
|
6526
6946
|
const root = this.root();
|
|
6947
|
+
// Если папки/файла нет, watch упадет с ошибкой
|
|
6948
|
+
// exists обратится к parent.version и parent.watcher
|
|
6949
|
+
// Поэтому у root-папки и выше не надо вызывать exists, иначе поднимется выше base до корня диска
|
|
6950
|
+
// exists вызывать надо, что б пересоздавать вотчер при появлении папки или файла
|
|
6527
6951
|
if (!root && !this.exists())
|
|
6528
6952
|
return super.watcher();
|
|
6529
6953
|
let watcher;
|
|
6530
6954
|
try {
|
|
6955
|
+
// Между exists и watch файл может удалиться, в любом случае надо обрабатывать ENOENT
|
|
6531
6956
|
watcher = $node.fs.watch(path);
|
|
6532
6957
|
}
|
|
6533
6958
|
catch (error) {
|
|
@@ -6537,6 +6962,8 @@ var $;
|
|
|
6537
6962
|
if (root || error.code !== 'ENOENT') {
|
|
6538
6963
|
this.$.$mol_fail_log(error);
|
|
6539
6964
|
}
|
|
6965
|
+
// Если файла нет - вотчер не создается, создастся потом, когда exists поменяется на true.
|
|
6966
|
+
// Если создание упало с другой ошибкой - не ломаем работу mol_file, деградируем до не реактивной fs.
|
|
6540
6967
|
return super.watcher();
|
|
6541
6968
|
}
|
|
6542
6969
|
watcher.on('change', (type, name) => {
|
|
@@ -6548,6 +6975,7 @@ var $;
|
|
|
6548
6975
|
watcher.on('error', e => this.$.$mol_fail_log(e));
|
|
6549
6976
|
let destructed = false;
|
|
6550
6977
|
watcher.on('close', () => {
|
|
6978
|
+
// Если в процессе работы вотчер сам закрылся, надо его переоткрыть
|
|
6551
6979
|
if (!destructed)
|
|
6552
6980
|
setTimeout(() => $mol_wire_async(this).watcher(null), 500);
|
|
6553
6981
|
});
|
|
@@ -6729,6 +7157,10 @@ var $;
|
|
|
6729
7157
|
"use strict";
|
|
6730
7158
|
var $;
|
|
6731
7159
|
(function ($) {
|
|
7160
|
+
/**
|
|
7161
|
+
* Localisation in $mol framework
|
|
7162
|
+
* @see https://mol.hyoo.ru/#!section=docs/=s5aqnb_odub8l
|
|
7163
|
+
*/
|
|
6732
7164
|
class $mol_locale extends $mol_object {
|
|
6733
7165
|
static lang_default() {
|
|
6734
7166
|
return 'en';
|
|
@@ -6876,12 +7308,17 @@ var $;
|
|
|
6876
7308
|
;
|
|
6877
7309
|
"use strict";
|
|
6878
7310
|
|
|
7311
|
+
|
|
6879
7312
|
;
|
|
6880
7313
|
"use strict";
|
|
6881
7314
|
var $;
|
|
6882
7315
|
(function ($) {
|
|
6883
7316
|
var $$;
|
|
6884
7317
|
(function ($$) {
|
|
7318
|
+
/**
|
|
7319
|
+
* Code visualizer.
|
|
7320
|
+
* @see https://mol.hyoo.ru/#!section=demos/demo=mol_text_code_demo
|
|
7321
|
+
*/
|
|
6885
7322
|
class $mol_text_code extends $.$mol_text_code {
|
|
6886
7323
|
render_visible_only() {
|
|
6887
7324
|
return this.$.$mol_support_css_overflow_anchor();
|
|
@@ -7082,12 +7519,17 @@ var $;
|
|
|
7082
7519
|
;
|
|
7083
7520
|
"use strict";
|
|
7084
7521
|
|
|
7522
|
+
|
|
7085
7523
|
;
|
|
7086
7524
|
"use strict";
|
|
7087
7525
|
var $;
|
|
7088
7526
|
(function ($) {
|
|
7089
7527
|
var $$;
|
|
7090
7528
|
(function ($$) {
|
|
7529
|
+
/**
|
|
7530
|
+
* Checkbox UI component. See Variants for more concrete implementations.
|
|
7531
|
+
* @see https://mol.hyoo.ru/#!section=demos/demo=mol_check_box_demo
|
|
7532
|
+
*/
|
|
7091
7533
|
class $mol_check extends $.$mol_check {
|
|
7092
7534
|
click(next) {
|
|
7093
7535
|
const event = next ? $mol_dom_event.wrap(next) : null;
|
|
@@ -7124,6 +7566,7 @@ var $;
|
|
|
7124
7566
|
;
|
|
7125
7567
|
"use strict";
|
|
7126
7568
|
|
|
7569
|
+
|
|
7127
7570
|
;
|
|
7128
7571
|
($.$mol_check_expand) = class $mol_check_expand extends ($.$mol_check) {
|
|
7129
7572
|
level_style(){
|
|
@@ -7160,12 +7603,17 @@ var $;
|
|
|
7160
7603
|
;
|
|
7161
7604
|
"use strict";
|
|
7162
7605
|
|
|
7606
|
+
|
|
7163
7607
|
;
|
|
7164
7608
|
"use strict";
|
|
7165
7609
|
var $;
|
|
7166
7610
|
(function ($) {
|
|
7167
7611
|
var $$;
|
|
7168
7612
|
(function ($$) {
|
|
7613
|
+
/**
|
|
7614
|
+
* Expander for trees, lists, etc
|
|
7615
|
+
* @see https://mol.hyoo.ru/#!section=demos/demo=mol_check_expand_demo
|
|
7616
|
+
*/
|
|
7169
7617
|
class $mol_check_expand extends $.$mol_check_expand {
|
|
7170
7618
|
level_style() {
|
|
7171
7619
|
return `${this.level() * 1 - 1}rem`;
|
|
@@ -7222,12 +7670,17 @@ var $;
|
|
|
7222
7670
|
;
|
|
7223
7671
|
"use strict";
|
|
7224
7672
|
|
|
7673
|
+
|
|
7225
7674
|
;
|
|
7226
7675
|
"use strict";
|
|
7227
7676
|
var $;
|
|
7228
7677
|
(function ($) {
|
|
7229
7678
|
var $$;
|
|
7230
7679
|
(function ($$) {
|
|
7680
|
+
/**
|
|
7681
|
+
* Dumps any JS values.
|
|
7682
|
+
* @see https://mol.hyoo.ru/#!section=demos/demo=mol_dump_demo
|
|
7683
|
+
*/
|
|
7231
7684
|
class $mol_dump_list extends $.$mol_dump_list {
|
|
7232
7685
|
sub() {
|
|
7233
7686
|
return this.values().map((_, index) => this.Dump(index));
|
|
@@ -7301,12 +7754,17 @@ var $;
|
|
|
7301
7754
|
;
|
|
7302
7755
|
"use strict";
|
|
7303
7756
|
|
|
7757
|
+
|
|
7304
7758
|
;
|
|
7305
7759
|
"use strict";
|
|
7306
7760
|
var $;
|
|
7307
7761
|
(function ($) {
|
|
7308
7762
|
var $$;
|
|
7309
7763
|
(function ($$) {
|
|
7764
|
+
/**
|
|
7765
|
+
* Component which expands any content on title click.
|
|
7766
|
+
* @see https://mol.hyoo.ru/#!section=demos/demo=mol_expander_demo
|
|
7767
|
+
*/
|
|
7310
7768
|
class $mol_expander extends $.$mol_expander {
|
|
7311
7769
|
rows() {
|
|
7312
7770
|
return [
|
|
@@ -7439,12 +7897,17 @@ var $;
|
|
|
7439
7897
|
;
|
|
7440
7898
|
"use strict";
|
|
7441
7899
|
|
|
7900
|
+
|
|
7442
7901
|
;
|
|
7443
7902
|
"use strict";
|
|
7444
7903
|
var $;
|
|
7445
7904
|
(function ($) {
|
|
7446
7905
|
var $$;
|
|
7447
7906
|
(function ($$) {
|
|
7907
|
+
/**
|
|
7908
|
+
* Dumps any JS values.
|
|
7909
|
+
* @see https://mol.hyoo.ru/#!section=demos/demo=mol_dump_demo
|
|
7910
|
+
*/
|
|
7448
7911
|
class $mol_dump_value extends $.$mol_dump_value {
|
|
7449
7912
|
sub() {
|
|
7450
7913
|
const value = this.value();
|
|
@@ -7533,6 +7996,11 @@ var $;
|
|
|
7533
7996
|
const descr = Reflect.getOwnPropertyDescriptor(value, key);
|
|
7534
7997
|
if ('value' in descr) {
|
|
7535
7998
|
const line = [prefix, descr.value];
|
|
7999
|
+
// let proto = descr.value
|
|
8000
|
+
// while( proto && typeof proto === 'object' ) {
|
|
8001
|
+
// proto = Reflect.getPrototypeOf( proto )
|
|
8002
|
+
// if( proto ) line.push( ' - ', proto )
|
|
8003
|
+
// }
|
|
7536
8004
|
res.push(line);
|
|
7537
8005
|
}
|
|
7538
8006
|
else {
|