mol_plot_all 1.2.205 → 1.2.208
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 +1448 -0
- package/node.deps.json +1 -1
- package/node.esm.js +4447 -4349
- package/node.esm.js.map +1 -1
- package/node.js +4447 -4349
- package/node.js.map +1 -1
- package/node.test.js +5150 -4998
- package/node.test.js.map +1 -1
- package/node.view.tree +1 -0
- package/package.json +111 -3
- package/web.d.ts +1387 -0
- package/web.deps.json +1 -1
- package/web.esm.js +689 -670
- package/web.esm.js.map +1 -1
- package/web.js +689 -670
- package/web.js.map +1 -1
- package/web.test.js +496 -364
- package/web.test.js.map +1 -1
- package/web.view.tree +1 -0
package/web.esm.js
CHANGED
|
@@ -358,6 +358,9 @@ var $;
|
|
|
358
358
|
static rgba(red, green, blue, alpha) {
|
|
359
359
|
return new $mol_style_func('rgba', [red, green, blue, alpha]);
|
|
360
360
|
}
|
|
361
|
+
static scale(zoom) {
|
|
362
|
+
return new $mol_style_func('scale', [zoom]);
|
|
363
|
+
}
|
|
361
364
|
}
|
|
362
365
|
$.$mol_style_func = $mol_style_func;
|
|
363
366
|
})($ || ($ = {}));
|
|
@@ -366,7 +369,7 @@ var $;
|
|
|
366
369
|
"use strict";
|
|
367
370
|
var $;
|
|
368
371
|
(function ($) {
|
|
369
|
-
$mol_style_attach("mol/theme/theme.css", "[mol_theme] {\n\tbackground-color: var(--mol_theme_back);\n\tcolor: var(--mol_theme_text);\n\tfill: var(--mol_theme_text);\n
|
|
372
|
+
$mol_style_attach("mol/theme/theme.css", ":root {\n\t--mol_theme_hue: 210deg;\n\t--mol_theme_luma: 1;\n\t--mol_theme_image: none;\n}\n\n[mol_theme] {\n\t\n\tbackground-color: var(--mol_theme_back);\n\tcolor: var(--mol_theme_text);\n\tfill: var(--mol_theme_text);\n\t\n\t--mol_theme_back: hsl( var(--mol_theme_hue), 50% , calc( 53% + 43% * var(--mol_theme_luma) ) );\n\t--mol_theme_text: hsl( var(--mol_theme_hue), 0% , calc( 50% - 30% * var(--mol_theme_luma) ) );\n\t--mol_theme_field: hsl( var(--mol_theme_hue), 0%, calc( 50% + 50% * var(--mol_theme_luma) ), .2 );\n\t\n\t--mol_theme_card: hsl( var(--mol_theme_hue), 0%, 50%, .05 );\n\t--mol_theme_hover: hsl( var(--mol_theme_hue), 0%, 50%, .1 );\n\t--mol_theme_line: hsl( var(--mol_theme_hue), 0%, 50%, .25 );\n\t--mol_theme_shade: hsl( var(--mol_theme_hue), 0%, 50%, 1 );\n\t\n\t--mol_theme_control: hsl( var(--mol_theme_hue), 60%, calc( 50% - 5% * var(--mol_theme_luma) ) );\n\t--mol_theme_current: hsl( calc( var(--mol_theme_hue) + 90deg ), 70%, 50% );\n\t--mol_theme_focus: hsl( calc( var(--mol_theme_hue) + 180deg ), 100%, calc( 50% - 5% * var(--mol_theme_luma) ) );\n\t\n}\n\n[mol_theme=\"$mol_theme_light\"] {\n\t--mol_theme_luma: 1;\n\t--mol_theme_image: none;\n}\n\n[mol_theme=\"$mol_theme_dark\"] {\n\t--mol_theme_luma: -1;\n\t--mol_theme_image: invert(1) hue-rotate( 180deg );\n}\n\n[mol_theme=\"$mol_theme_base\"] {\n\t--mol_theme_luma: -2;\n\t--mol_theme_back: hsl( var(--mol_theme_hue), 50%, 40% );\n\t--mol_theme_hover: hsl( var(--mol_theme_hue), 60%, 30% );\n\t--mol_theme_current: hsl( var(--mol_theme_hue), 100%, 20% );\n}\n\n[mol_theme=\"$mol_theme_current\"] {\n\t--mol_theme_back: hsl( calc( var(--mol_theme_hue) + 90deg ), 50%, calc( 50% + 20% * var(--mol_theme_luma) ) );\n}\n\n[mol_theme=\"$mol_theme_accent\"] {\n\t--mol_theme_luma: -2;\n\t--mol_theme_back: hsl( calc( var(--mol_theme_hue) + 180deg ), 70%, 45% );\n\t--mol_theme_hover: hsl( calc( var(--mol_theme_hue) + 180deg ), 70%, 40% );\n}\n\n[mol_theme=\"$mol_theme_accent\"] [mol_theme=\"$mol_theme_accent\"] {\n\t--mol_theme_back: black;\n}\n");
|
|
370
373
|
})($ || ($ = {}));
|
|
371
374
|
//mol/theme/-css/theme.css.ts
|
|
372
375
|
;
|
|
@@ -377,6 +380,7 @@ var $;
|
|
|
377
380
|
$.$mol_theme = {
|
|
378
381
|
back: vary('--mol_theme_back'),
|
|
379
382
|
hover: vary('--mol_theme_hover'),
|
|
383
|
+
card: vary('--mol_theme_card'),
|
|
380
384
|
current: vary('--mol_theme_current'),
|
|
381
385
|
text: vary('--mol_theme_text'),
|
|
382
386
|
control: vary('--mol_theme_control'),
|
|
@@ -421,14 +425,10 @@ var $;
|
|
|
421
425
|
(function ($) {
|
|
422
426
|
let $mol_wire_cursor;
|
|
423
427
|
(function ($mol_wire_cursor) {
|
|
424
|
-
$mol_wire_cursor[$mol_wire_cursor["stale"] =
|
|
425
|
-
|
|
426
|
-
$mol_wire_cursor[$mol_wire_cursor["
|
|
427
|
-
|
|
428
|
-
$mol_wire_cursor[$mol_wire_cursor["fresh"] = new (class fresh extends Number {
|
|
429
|
-
})(-3)] = "fresh";
|
|
430
|
-
$mol_wire_cursor[$mol_wire_cursor["final"] = new (class solid extends Number {
|
|
431
|
-
})(-4)] = "final";
|
|
428
|
+
$mol_wire_cursor[$mol_wire_cursor["stale"] = -1] = "stale";
|
|
429
|
+
$mol_wire_cursor[$mol_wire_cursor["doubt"] = -2] = "doubt";
|
|
430
|
+
$mol_wire_cursor[$mol_wire_cursor["fresh"] = -3] = "fresh";
|
|
431
|
+
$mol_wire_cursor[$mol_wire_cursor["final"] = -4] = "final";
|
|
432
432
|
})($mol_wire_cursor = $.$mol_wire_cursor || ($.$mol_wire_cursor = {}));
|
|
433
433
|
})($ || ($ = {}));
|
|
434
434
|
//mol/wire/cursor/cursor.ts
|
|
@@ -436,76 +436,61 @@ var $;
|
|
|
436
436
|
"use strict";
|
|
437
437
|
var $;
|
|
438
438
|
(function ($) {
|
|
439
|
-
class $mol_wire_pub extends
|
|
439
|
+
class $mol_wire_pub extends Object {
|
|
440
|
+
data = [];
|
|
440
441
|
static get [Symbol.species]() {
|
|
441
442
|
return Array;
|
|
442
443
|
}
|
|
443
444
|
sub_from = 0;
|
|
444
445
|
get sub_list() {
|
|
445
446
|
const res = [];
|
|
446
|
-
for (let i = this.sub_from; i < this.length; i += 2) {
|
|
447
|
-
res.push(this[i]);
|
|
447
|
+
for (let i = this.sub_from; i < this.data.length; i += 2) {
|
|
448
|
+
res.push(this.data[i]);
|
|
448
449
|
}
|
|
449
450
|
return res;
|
|
450
451
|
}
|
|
451
452
|
get sub_empty() {
|
|
452
|
-
return this.sub_from === this.length;
|
|
453
|
+
return this.sub_from === this.data.length;
|
|
453
454
|
}
|
|
454
455
|
sub_on(sub, pub_pos) {
|
|
455
|
-
const pos = this.length;
|
|
456
|
-
this.push(sub, pub_pos);
|
|
456
|
+
const pos = this.data.length;
|
|
457
|
+
this.data.push(sub, pub_pos);
|
|
457
458
|
return pos;
|
|
458
459
|
}
|
|
459
460
|
sub_off(sub_pos) {
|
|
460
|
-
if (!(sub_pos < this.length)) {
|
|
461
|
+
if (!(sub_pos < this.data.length)) {
|
|
461
462
|
$mol_fail(new Error(`Wrong pos ${sub_pos}`));
|
|
462
463
|
}
|
|
463
|
-
const end = this.length - 2;
|
|
464
|
+
const end = this.data.length - 2;
|
|
464
465
|
if (sub_pos !== end) {
|
|
465
466
|
this.peer_move(end, sub_pos);
|
|
466
467
|
}
|
|
467
|
-
this.pop();
|
|
468
|
-
this.pop();
|
|
469
|
-
if (this.length === this.sub_from)
|
|
468
|
+
this.data.pop();
|
|
469
|
+
this.data.pop();
|
|
470
|
+
if (this.data.length === this.sub_from)
|
|
470
471
|
this.reap();
|
|
471
472
|
}
|
|
472
473
|
reap() { }
|
|
473
|
-
|
|
474
|
-
$mol_wire_auto?.track_next(this);
|
|
474
|
+
promote() {
|
|
475
|
+
$mol_wire_auto()?.track_next(this);
|
|
475
476
|
}
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
emit() {
|
|
479
|
-
for (let i = this.sub_from; i < this.length; i += 2) {
|
|
477
|
+
refresh() { }
|
|
478
|
+
complete() { }
|
|
479
|
+
emit(quant = $mol_wire_cursor.stale) {
|
|
480
|
+
for (let i = this.sub_from; i < this.data.length; i += 2) {
|
|
480
481
|
;
|
|
481
|
-
this[i].
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
stale() {
|
|
485
|
-
if (!this.affect($mol_wire_cursor.stale))
|
|
486
|
-
return false;
|
|
487
|
-
while ($mol_wire_affected.length) {
|
|
488
|
-
const next = $mol_wire_affected.pop();
|
|
489
|
-
next.affect($mol_wire_cursor.doubt);
|
|
482
|
+
this.data[i].absorb(quant);
|
|
490
483
|
}
|
|
491
|
-
return true;
|
|
492
|
-
}
|
|
493
|
-
affect(quant) {
|
|
494
|
-
for (let i = this.sub_from; i < this.length; i += 2) {
|
|
495
|
-
const sub = this[i];
|
|
496
|
-
$mol_wire_affected.push(sub);
|
|
497
|
-
}
|
|
498
|
-
return true;
|
|
499
484
|
}
|
|
500
485
|
peer_move(from_pos, to_pos) {
|
|
501
|
-
const peer = this[from_pos];
|
|
502
|
-
const self_pos = this[from_pos + 1];
|
|
503
|
-
this[to_pos] = peer;
|
|
504
|
-
this[to_pos + 1] = self_pos;
|
|
486
|
+
const peer = this.data[from_pos];
|
|
487
|
+
const self_pos = this.data[from_pos + 1];
|
|
488
|
+
this.data[to_pos] = peer;
|
|
489
|
+
this.data[to_pos + 1] = self_pos;
|
|
505
490
|
peer.peer_repos(self_pos, to_pos);
|
|
506
491
|
}
|
|
507
492
|
peer_repos(peer_pos, self_pos) {
|
|
508
|
-
this[peer_pos + 1] = self_pos;
|
|
493
|
+
this.data[peer_pos + 1] = self_pos;
|
|
509
494
|
}
|
|
510
495
|
}
|
|
511
496
|
$.$mol_wire_pub = $mol_wire_pub;
|
|
@@ -518,7 +503,11 @@ var $;
|
|
|
518
503
|
"use strict";
|
|
519
504
|
var $;
|
|
520
505
|
(function ($) {
|
|
521
|
-
|
|
506
|
+
let auto = null;
|
|
507
|
+
function $mol_wire_auto(next = auto) {
|
|
508
|
+
return auto = next;
|
|
509
|
+
}
|
|
510
|
+
$.$mol_wire_auto = $mol_wire_auto;
|
|
522
511
|
$.$mol_wire_affected = [];
|
|
523
512
|
})($ || ($ = {}));
|
|
524
513
|
//mol/wire/wire.ts
|
|
@@ -631,107 +620,126 @@ var $;
|
|
|
631
620
|
cursor = $mol_wire_cursor.stale;
|
|
632
621
|
get pub_list() {
|
|
633
622
|
const res = [];
|
|
634
|
-
|
|
635
|
-
|
|
623
|
+
const max = this.cursor >= 0 ? this.cursor : this.sub_from;
|
|
624
|
+
for (let i = this.pub_from; i < max; i += 2) {
|
|
625
|
+
res.push(this.data[i]);
|
|
636
626
|
}
|
|
637
627
|
return res;
|
|
638
628
|
}
|
|
639
629
|
track_on() {
|
|
640
630
|
this.cursor = this.pub_from;
|
|
641
|
-
const sub = $mol_wire_auto;
|
|
642
|
-
$mol_wire_auto
|
|
631
|
+
const sub = $mol_wire_auto();
|
|
632
|
+
$mol_wire_auto(this);
|
|
643
633
|
return sub;
|
|
644
634
|
}
|
|
645
|
-
|
|
635
|
+
promote() {
|
|
646
636
|
if (this.cursor >= this.pub_from) {
|
|
647
637
|
$mol_fail(new Error('Circular subscription'));
|
|
648
638
|
}
|
|
649
|
-
super.
|
|
639
|
+
super.promote();
|
|
650
640
|
}
|
|
651
641
|
track_next(pub) {
|
|
652
642
|
if (this.cursor < 0)
|
|
653
643
|
$mol_fail(new Error('Promo to non begun sub'));
|
|
654
644
|
if (this.cursor < this.sub_from) {
|
|
655
|
-
const next = this[this.cursor];
|
|
645
|
+
const next = this.data[this.cursor];
|
|
656
646
|
if (pub === undefined)
|
|
657
647
|
return next ?? null;
|
|
658
648
|
if (next === pub) {
|
|
659
649
|
this.cursor += 2;
|
|
660
650
|
return next;
|
|
661
651
|
}
|
|
662
|
-
next
|
|
652
|
+
if (next) {
|
|
653
|
+
if (this.sub_from < this.data.length) {
|
|
654
|
+
this.peer_move(this.sub_from, this.data.length);
|
|
655
|
+
}
|
|
656
|
+
this.peer_move(this.cursor, this.sub_from);
|
|
657
|
+
this.sub_from += 2;
|
|
658
|
+
}
|
|
663
659
|
}
|
|
664
660
|
else {
|
|
665
661
|
if (pub === undefined)
|
|
666
662
|
return null;
|
|
667
|
-
if (this.sub_from < this.length) {
|
|
668
|
-
this.peer_move(this.sub_from, this.length);
|
|
663
|
+
if (this.sub_from < this.data.length) {
|
|
664
|
+
this.peer_move(this.sub_from, this.data.length);
|
|
669
665
|
}
|
|
670
666
|
this.sub_from += 2;
|
|
671
667
|
}
|
|
672
|
-
this[this.cursor] = pub;
|
|
673
|
-
this[this.cursor + 1] = pub.sub_on(this, this.cursor);
|
|
668
|
+
this.data[this.cursor] = pub;
|
|
669
|
+
this.data[this.cursor + 1] = pub.sub_on(this, this.cursor);
|
|
674
670
|
this.cursor += 2;
|
|
675
671
|
return pub;
|
|
676
672
|
}
|
|
677
673
|
track_off(sub) {
|
|
678
|
-
$mol_wire_auto
|
|
679
|
-
if (this.cursor < 0)
|
|
674
|
+
$mol_wire_auto(sub);
|
|
675
|
+
if (this.cursor < 0) {
|
|
680
676
|
$mol_fail(new Error('End of non begun sub'));
|
|
681
|
-
|
|
682
|
-
for (let cursor = this.pub_from; cursor < this.
|
|
683
|
-
const pub = this[cursor];
|
|
684
|
-
pub.
|
|
677
|
+
}
|
|
678
|
+
for (let cursor = this.pub_from; cursor < this.cursor; cursor += 2) {
|
|
679
|
+
const pub = this.data[cursor];
|
|
680
|
+
pub.refresh();
|
|
685
681
|
}
|
|
686
682
|
this.cursor = $mol_wire_cursor.fresh;
|
|
687
683
|
}
|
|
688
684
|
pub_off(sub_pos) {
|
|
689
|
-
this[sub_pos] = undefined;
|
|
690
|
-
this[sub_pos + 1] = undefined;
|
|
685
|
+
this.data[sub_pos] = undefined;
|
|
686
|
+
this.data[sub_pos + 1] = undefined;
|
|
691
687
|
}
|
|
692
688
|
destructor() {
|
|
693
|
-
for (let cursor = this.length - 2; cursor >= this.sub_from; cursor -= 2) {
|
|
694
|
-
const sub = this[cursor];
|
|
695
|
-
const pos = this[cursor + 1];
|
|
689
|
+
for (let cursor = this.data.length - 2; cursor >= this.sub_from; cursor -= 2) {
|
|
690
|
+
const sub = this.data[cursor];
|
|
691
|
+
const pos = this.data[cursor + 1];
|
|
696
692
|
sub.pub_off(pos);
|
|
697
|
-
this.pop();
|
|
698
|
-
this.pop();
|
|
693
|
+
this.data.pop();
|
|
694
|
+
this.data.pop();
|
|
699
695
|
}
|
|
700
|
-
this.
|
|
696
|
+
this.cursor = this.pub_from;
|
|
697
|
+
this.track_cut();
|
|
701
698
|
this.cursor = $mol_wire_cursor.final;
|
|
702
699
|
}
|
|
703
|
-
|
|
700
|
+
track_cut() {
|
|
701
|
+
if (this.cursor < this.pub_from) {
|
|
702
|
+
$mol_fail(new Error('Cut of non begun sub'));
|
|
703
|
+
}
|
|
704
704
|
let tail = 0;
|
|
705
|
-
for (let cursor =
|
|
706
|
-
const pub = this[cursor];
|
|
707
|
-
pub?.sub_off(this[cursor + 1]);
|
|
708
|
-
if (this.sub_from < this.length) {
|
|
709
|
-
this.peer_move(this.length - 2, cursor);
|
|
710
|
-
this.pop();
|
|
711
|
-
this.pop();
|
|
705
|
+
for (let cursor = this.cursor; cursor < this.sub_from; cursor += 2) {
|
|
706
|
+
const pub = this.data[cursor];
|
|
707
|
+
pub?.sub_off(this.data[cursor + 1]);
|
|
708
|
+
if (this.sub_from < this.data.length) {
|
|
709
|
+
this.peer_move(this.data.length - 2, cursor);
|
|
710
|
+
this.data.pop();
|
|
711
|
+
this.data.pop();
|
|
712
712
|
}
|
|
713
713
|
else {
|
|
714
714
|
++tail;
|
|
715
715
|
}
|
|
716
716
|
}
|
|
717
717
|
for (; tail; --tail) {
|
|
718
|
-
this.pop();
|
|
719
|
-
this.pop();
|
|
718
|
+
this.data.pop();
|
|
719
|
+
this.data.pop();
|
|
720
|
+
}
|
|
721
|
+
this.sub_from = this.cursor;
|
|
722
|
+
}
|
|
723
|
+
complete() { }
|
|
724
|
+
complete_pubs() {
|
|
725
|
+
const limit = this.cursor < 0 ? this.sub_from : this.cursor;
|
|
726
|
+
for (let cursor = this.pub_from; cursor < limit; cursor += 2) {
|
|
727
|
+
const pub = this.data[cursor];
|
|
728
|
+
pub?.complete();
|
|
720
729
|
}
|
|
721
|
-
this.sub_from = from;
|
|
722
730
|
}
|
|
723
|
-
|
|
731
|
+
absorb(quant = $mol_wire_cursor.stale) {
|
|
724
732
|
if (this.cursor === $mol_wire_cursor.final)
|
|
725
|
-
return
|
|
733
|
+
return;
|
|
726
734
|
if (this.cursor >= quant)
|
|
727
|
-
return
|
|
735
|
+
return;
|
|
728
736
|
this.cursor = quant;
|
|
729
|
-
|
|
737
|
+
this.emit($mol_wire_cursor.doubt);
|
|
730
738
|
}
|
|
731
739
|
[$mol_dev_format_head]() {
|
|
732
740
|
return $mol_dev_format_native(this);
|
|
733
741
|
}
|
|
734
|
-
get
|
|
742
|
+
get pub_empty() {
|
|
735
743
|
return this.sub_from === this.pub_from;
|
|
736
744
|
}
|
|
737
745
|
}
|
|
@@ -741,6 +749,289 @@ var $;
|
|
|
741
749
|
;
|
|
742
750
|
"use strict";
|
|
743
751
|
var $;
|
|
752
|
+
(function ($) {
|
|
753
|
+
class $mol_after_frame extends $mol_object2 {
|
|
754
|
+
task;
|
|
755
|
+
static _promise = null;
|
|
756
|
+
static _timeout = null;
|
|
757
|
+
static get promise() {
|
|
758
|
+
if (this._promise)
|
|
759
|
+
return this._promise;
|
|
760
|
+
return this._promise = new Promise(done => {
|
|
761
|
+
const complete = () => {
|
|
762
|
+
this._promise = null;
|
|
763
|
+
clearTimeout(this._timeout);
|
|
764
|
+
done();
|
|
765
|
+
};
|
|
766
|
+
requestAnimationFrame(complete);
|
|
767
|
+
this._timeout = setTimeout(complete, 100);
|
|
768
|
+
});
|
|
769
|
+
}
|
|
770
|
+
cancelled = false;
|
|
771
|
+
promise;
|
|
772
|
+
constructor(task) {
|
|
773
|
+
super();
|
|
774
|
+
this.task = task;
|
|
775
|
+
this.promise = $mol_after_frame.promise.then(() => {
|
|
776
|
+
if (this.cancelled)
|
|
777
|
+
return;
|
|
778
|
+
task();
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
destructor() {
|
|
782
|
+
this.cancelled = true;
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
$.$mol_after_frame = $mol_after_frame;
|
|
786
|
+
})($ || ($ = {}));
|
|
787
|
+
//mol/after/frame/frame.web.ts
|
|
788
|
+
;
|
|
789
|
+
"use strict";
|
|
790
|
+
var $;
|
|
791
|
+
(function ($) {
|
|
792
|
+
const handled = new WeakSet();
|
|
793
|
+
class $mol_wire_fiber extends $mol_wire_pub_sub {
|
|
794
|
+
task;
|
|
795
|
+
host;
|
|
796
|
+
static warm = true;
|
|
797
|
+
static planning = new Set();
|
|
798
|
+
static reaping = new Set();
|
|
799
|
+
static plan_task = null;
|
|
800
|
+
static plan() {
|
|
801
|
+
if (this.plan_task)
|
|
802
|
+
return;
|
|
803
|
+
this.plan_task = new $mol_after_frame(() => {
|
|
804
|
+
try {
|
|
805
|
+
this.sync();
|
|
806
|
+
}
|
|
807
|
+
finally {
|
|
808
|
+
$mol_wire_fiber.plan_task = null;
|
|
809
|
+
}
|
|
810
|
+
});
|
|
811
|
+
}
|
|
812
|
+
static sync() {
|
|
813
|
+
while (this.planning.size) {
|
|
814
|
+
const fibers = this.planning;
|
|
815
|
+
this.planning = new Set;
|
|
816
|
+
for (const fiber of fibers) {
|
|
817
|
+
fiber.refresh();
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
while (this.reaping.size) {
|
|
821
|
+
const fibers = this.reaping;
|
|
822
|
+
this.reaping = new Set;
|
|
823
|
+
for (const fiber of fibers) {
|
|
824
|
+
if (!fiber.sub_empty)
|
|
825
|
+
continue;
|
|
826
|
+
fiber.destructor();
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
cache = undefined;
|
|
831
|
+
get args() {
|
|
832
|
+
return this.data.slice(0, this.pub_from);
|
|
833
|
+
}
|
|
834
|
+
result() {
|
|
835
|
+
if (this.cache instanceof Promise)
|
|
836
|
+
return;
|
|
837
|
+
if (this.cache instanceof Error)
|
|
838
|
+
return;
|
|
839
|
+
return this.cache;
|
|
840
|
+
}
|
|
841
|
+
field() {
|
|
842
|
+
return this.task.name + '()';
|
|
843
|
+
}
|
|
844
|
+
constructor(id, task, host, ...args) {
|
|
845
|
+
super();
|
|
846
|
+
this.task = task;
|
|
847
|
+
this.host = host;
|
|
848
|
+
this.data.push(...args);
|
|
849
|
+
this.pub_from = this.sub_from = args.length;
|
|
850
|
+
this[Symbol.toStringTag] = id;
|
|
851
|
+
}
|
|
852
|
+
plan() {
|
|
853
|
+
$mol_wire_fiber.planning.add(this);
|
|
854
|
+
$mol_wire_fiber.plan();
|
|
855
|
+
}
|
|
856
|
+
reap() {
|
|
857
|
+
$mol_wire_fiber.reaping.add(this);
|
|
858
|
+
$mol_wire_fiber.plan();
|
|
859
|
+
}
|
|
860
|
+
toString() {
|
|
861
|
+
return this[Symbol.toStringTag];
|
|
862
|
+
}
|
|
863
|
+
toJSON() {
|
|
864
|
+
return this[Symbol.toStringTag];
|
|
865
|
+
}
|
|
866
|
+
[$mol_dev_format_head]() {
|
|
867
|
+
const cursor = {
|
|
868
|
+
[-1]: '🔴',
|
|
869
|
+
[-2]: '🟡',
|
|
870
|
+
[-3]: '🟢',
|
|
871
|
+
[-4]: '🔵',
|
|
872
|
+
}[this.cursor] ?? this.cursor.toString();
|
|
873
|
+
return $mol_dev_format_div({}, $mol_dev_format_native(this), $mol_dev_format_shade(cursor + ' '), $mol_dev_format_auto(this.cache));
|
|
874
|
+
}
|
|
875
|
+
get $() {
|
|
876
|
+
return (this.host ?? this.task)['$'];
|
|
877
|
+
}
|
|
878
|
+
emit(quant = $mol_wire_cursor.stale) {
|
|
879
|
+
if (this.sub_empty)
|
|
880
|
+
this.plan();
|
|
881
|
+
else
|
|
882
|
+
super.emit(quant);
|
|
883
|
+
}
|
|
884
|
+
refresh() {
|
|
885
|
+
if (this.cursor === $mol_wire_cursor.fresh)
|
|
886
|
+
return;
|
|
887
|
+
if (this.cursor === $mol_wire_cursor.final)
|
|
888
|
+
return;
|
|
889
|
+
check: if (this.cursor === $mol_wire_cursor.doubt) {
|
|
890
|
+
for (let i = this.pub_from; i < this.sub_from; i += 2) {
|
|
891
|
+
;
|
|
892
|
+
this.data[i]?.refresh();
|
|
893
|
+
if (this.cursor !== $mol_wire_cursor.doubt)
|
|
894
|
+
break check;
|
|
895
|
+
}
|
|
896
|
+
this.cursor = $mol_wire_cursor.fresh;
|
|
897
|
+
return;
|
|
898
|
+
}
|
|
899
|
+
const bu = this.track_on();
|
|
900
|
+
let result;
|
|
901
|
+
try {
|
|
902
|
+
switch (this.pub_from) {
|
|
903
|
+
case 0:
|
|
904
|
+
result = this.task.call(this.host);
|
|
905
|
+
break;
|
|
906
|
+
case 1:
|
|
907
|
+
result = this.task.call(this.host, this.data[0]);
|
|
908
|
+
break;
|
|
909
|
+
default:
|
|
910
|
+
result = this.task.call(this.host, ...this.data.slice(0, this.pub_from));
|
|
911
|
+
break;
|
|
912
|
+
}
|
|
913
|
+
if (result instanceof Promise) {
|
|
914
|
+
const put = (res) => {
|
|
915
|
+
if (this.cache === result)
|
|
916
|
+
this.put(res);
|
|
917
|
+
return res;
|
|
918
|
+
};
|
|
919
|
+
result = Object.assign(result.then(put, put), {
|
|
920
|
+
destructor: result['destructor']
|
|
921
|
+
});
|
|
922
|
+
handled.add(result);
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
catch (error) {
|
|
926
|
+
if (error instanceof Error || error instanceof Promise) {
|
|
927
|
+
result = error;
|
|
928
|
+
}
|
|
929
|
+
else {
|
|
930
|
+
result = new Error(String(error), { cause: error });
|
|
931
|
+
}
|
|
932
|
+
if (result instanceof Promise && !handled.has(result)) {
|
|
933
|
+
result = Object.assign(result.finally(() => {
|
|
934
|
+
if (this.cache === result)
|
|
935
|
+
this.absorb();
|
|
936
|
+
}), {
|
|
937
|
+
destructor: result['destructor']
|
|
938
|
+
});
|
|
939
|
+
handled.add(result);
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
if (!(result instanceof Promise)) {
|
|
943
|
+
this.track_cut();
|
|
944
|
+
}
|
|
945
|
+
this.track_off(bu);
|
|
946
|
+
this.put(result);
|
|
947
|
+
}
|
|
948
|
+
sync() {
|
|
949
|
+
if (!$mol_wire_fiber.warm) {
|
|
950
|
+
return this.result();
|
|
951
|
+
}
|
|
952
|
+
this.promote();
|
|
953
|
+
this.refresh();
|
|
954
|
+
if (this.cache instanceof Error) {
|
|
955
|
+
return $mol_fail_hidden(this.cache);
|
|
956
|
+
}
|
|
957
|
+
if (this.cache instanceof Promise) {
|
|
958
|
+
return $mol_fail_hidden(this.cache);
|
|
959
|
+
}
|
|
960
|
+
return this.cache;
|
|
961
|
+
}
|
|
962
|
+
async async() {
|
|
963
|
+
while (true) {
|
|
964
|
+
this.refresh();
|
|
965
|
+
if (this.cache instanceof Error) {
|
|
966
|
+
$mol_fail_hidden(this.cache);
|
|
967
|
+
}
|
|
968
|
+
if (!(this.cache instanceof Promise))
|
|
969
|
+
return this.cache;
|
|
970
|
+
await this.cache;
|
|
971
|
+
if (this.cursor === $mol_wire_cursor.final) {
|
|
972
|
+
await new Promise(() => { });
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
$.$mol_wire_fiber = $mol_wire_fiber;
|
|
978
|
+
})($ || ($ = {}));
|
|
979
|
+
//mol/wire/fiber/fiber.ts
|
|
980
|
+
;
|
|
981
|
+
"use strict";
|
|
982
|
+
var $;
|
|
983
|
+
(function ($) {
|
|
984
|
+
function $mol_guid(length = 8, exists = () => false) {
|
|
985
|
+
for (;;) {
|
|
986
|
+
let id = Math.random().toString(36).substring(2, length + 2).toUpperCase();
|
|
987
|
+
if (exists(id))
|
|
988
|
+
continue;
|
|
989
|
+
return id;
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
$.$mol_guid = $mol_guid;
|
|
993
|
+
})($ || ($ = {}));
|
|
994
|
+
//mol/guid/guid.ts
|
|
995
|
+
;
|
|
996
|
+
"use strict";
|
|
997
|
+
var $;
|
|
998
|
+
(function ($) {
|
|
999
|
+
$.$mol_key_store = new WeakMap();
|
|
1000
|
+
function $mol_key(value) {
|
|
1001
|
+
if (!value)
|
|
1002
|
+
return JSON.stringify(value);
|
|
1003
|
+
if (typeof value !== 'object' && typeof value !== 'function')
|
|
1004
|
+
return JSON.stringify(value);
|
|
1005
|
+
return JSON.stringify(value, (field, value) => {
|
|
1006
|
+
if (!value)
|
|
1007
|
+
return value;
|
|
1008
|
+
if (typeof value !== 'object' && typeof value !== 'function')
|
|
1009
|
+
return value;
|
|
1010
|
+
if (Array.isArray(value))
|
|
1011
|
+
return value;
|
|
1012
|
+
const proto = Reflect.getPrototypeOf(value);
|
|
1013
|
+
if (!proto)
|
|
1014
|
+
return value;
|
|
1015
|
+
if (Reflect.getPrototypeOf(proto) === null)
|
|
1016
|
+
return value;
|
|
1017
|
+
if ('toJSON' in value)
|
|
1018
|
+
return value;
|
|
1019
|
+
if (value instanceof RegExp)
|
|
1020
|
+
return value.toString();
|
|
1021
|
+
let key = $.$mol_key_store.get(value);
|
|
1022
|
+
if (key)
|
|
1023
|
+
return key;
|
|
1024
|
+
key = $mol_guid();
|
|
1025
|
+
$.$mol_key_store.set(value, key);
|
|
1026
|
+
return key;
|
|
1027
|
+
});
|
|
1028
|
+
}
|
|
1029
|
+
$.$mol_key = $mol_key;
|
|
1030
|
+
})($ || ($ = {}));
|
|
1031
|
+
//mol/key/key.ts
|
|
1032
|
+
;
|
|
1033
|
+
"use strict";
|
|
1034
|
+
var $;
|
|
744
1035
|
(function ($) {
|
|
745
1036
|
$.$mol_compare_deep_cache = new WeakMap();
|
|
746
1037
|
function $mol_compare_deep(left, right) {
|
|
@@ -788,6 +1079,8 @@ var $;
|
|
|
788
1079
|
result = compare_set(left, right);
|
|
789
1080
|
else if (left instanceof Map)
|
|
790
1081
|
result = compare_map(left, right);
|
|
1082
|
+
else if (left instanceof Error)
|
|
1083
|
+
result = left.stack === right.stack;
|
|
791
1084
|
else if (ArrayBuffer.isView(left))
|
|
792
1085
|
result = compare_buffer(left, right);
|
|
793
1086
|
else if (Symbol.toPrimitive in left)
|
|
@@ -865,93 +1158,48 @@ var $;
|
|
|
865
1158
|
"use strict";
|
|
866
1159
|
var $;
|
|
867
1160
|
(function ($) {
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
if (!value)
|
|
886
|
-
return JSON.stringify(value);
|
|
887
|
-
if (typeof value !== 'object' && typeof value !== 'function')
|
|
888
|
-
return JSON.stringify(value);
|
|
889
|
-
return JSON.stringify(value, (field, value) => {
|
|
890
|
-
if (!value)
|
|
891
|
-
return value;
|
|
892
|
-
if (typeof value !== 'object' && typeof value !== 'function')
|
|
893
|
-
return value;
|
|
894
|
-
if (Array.isArray(value))
|
|
895
|
-
return value;
|
|
896
|
-
const proto = Reflect.getPrototypeOf(value);
|
|
897
|
-
if (!proto)
|
|
898
|
-
return value;
|
|
899
|
-
if (Reflect.getPrototypeOf(proto) === null)
|
|
900
|
-
return value;
|
|
901
|
-
if ('toJSON' in value)
|
|
902
|
-
return value;
|
|
903
|
-
if (value instanceof RegExp)
|
|
904
|
-
return value.toString();
|
|
905
|
-
let key = $.$mol_key_store.get(value);
|
|
906
|
-
if (key)
|
|
907
|
-
return key;
|
|
908
|
-
key = $mol_guid();
|
|
909
|
-
$.$mol_key_store.set(value, key);
|
|
910
|
-
return key;
|
|
911
|
-
});
|
|
912
|
-
}
|
|
913
|
-
$.$mol_key = $mol_key;
|
|
914
|
-
})($ || ($ = {}));
|
|
915
|
-
//mol/key/key.ts
|
|
916
|
-
;
|
|
917
|
-
"use strict";
|
|
918
|
-
var $;
|
|
919
|
-
(function ($) {
|
|
920
|
-
class $mol_after_frame extends $mol_object2 {
|
|
921
|
-
task;
|
|
922
|
-
static _promise = null;
|
|
923
|
-
static get promise() {
|
|
924
|
-
if (this._promise)
|
|
925
|
-
return this._promise;
|
|
926
|
-
return this._promise = new Promise(done => {
|
|
927
|
-
requestAnimationFrame(() => {
|
|
928
|
-
this._promise = null;
|
|
929
|
-
done();
|
|
930
|
-
});
|
|
931
|
-
setTimeout(() => {
|
|
932
|
-
this._promise = null;
|
|
933
|
-
done();
|
|
934
|
-
}, 100);
|
|
935
|
-
});
|
|
1161
|
+
class $mol_wire_task extends $mol_wire_fiber {
|
|
1162
|
+
static getter(task) {
|
|
1163
|
+
return function $mol_wire_task_get(host, args) {
|
|
1164
|
+
const existen = $mol_wire_auto()?.track_next();
|
|
1165
|
+
reuse: if (existen) {
|
|
1166
|
+
if (!(existen instanceof $mol_wire_task))
|
|
1167
|
+
break reuse;
|
|
1168
|
+
if (existen.host !== host)
|
|
1169
|
+
break reuse;
|
|
1170
|
+
if (existen.task !== task)
|
|
1171
|
+
break reuse;
|
|
1172
|
+
if (!$mol_compare_deep(existen.args, args))
|
|
1173
|
+
break reuse;
|
|
1174
|
+
return existen;
|
|
1175
|
+
}
|
|
1176
|
+
return new $mol_wire_task(`${host?.[Symbol.toStringTag] ?? host}.${task.name}(#)`, task, host, ...args);
|
|
1177
|
+
};
|
|
936
1178
|
}
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
super();
|
|
941
|
-
this.task = task;
|
|
942
|
-
this.promise = $mol_after_frame.promise.then(() => {
|
|
943
|
-
if (this.cancelled)
|
|
944
|
-
return;
|
|
945
|
-
task();
|
|
946
|
-
});
|
|
1179
|
+
complete() {
|
|
1180
|
+
if (this.sub_empty)
|
|
1181
|
+
this.destructor();
|
|
947
1182
|
}
|
|
948
|
-
|
|
949
|
-
|
|
1183
|
+
put(next) {
|
|
1184
|
+
const prev = this.cache;
|
|
1185
|
+
this.cache = next;
|
|
1186
|
+
if (next instanceof Promise) {
|
|
1187
|
+
this.cursor = $mol_wire_cursor.fresh;
|
|
1188
|
+
if (next !== prev)
|
|
1189
|
+
this.emit();
|
|
1190
|
+
return next;
|
|
1191
|
+
}
|
|
1192
|
+
this.cursor = $mol_wire_cursor.final;
|
|
1193
|
+
if (this.sub_empty)
|
|
1194
|
+
this.destructor();
|
|
1195
|
+
else if (next !== prev)
|
|
1196
|
+
this.emit();
|
|
1197
|
+
return next;
|
|
950
1198
|
}
|
|
951
1199
|
}
|
|
952
|
-
$.$
|
|
1200
|
+
$.$mol_wire_task = $mol_wire_task;
|
|
953
1201
|
})($ || ($ = {}));
|
|
954
|
-
//mol/
|
|
1202
|
+
//mol/wire/task/task.ts
|
|
955
1203
|
;
|
|
956
1204
|
"use strict";
|
|
957
1205
|
var $;
|
|
@@ -964,8 +1212,9 @@ var $;
|
|
|
964
1212
|
if (typeof sup[field] === 'function') {
|
|
965
1213
|
Object.defineProperty(orig, 'name', { value: sup[field].name });
|
|
966
1214
|
}
|
|
1215
|
+
const temp = $mol_wire_task.getter(orig);
|
|
967
1216
|
const value = function (...args) {
|
|
968
|
-
const fiber =
|
|
1217
|
+
const fiber = temp(this ?? null, args);
|
|
969
1218
|
return fiber.sync();
|
|
970
1219
|
};
|
|
971
1220
|
Object.defineProperty(value, 'name', { value: orig.name + ' ' });
|
|
@@ -981,113 +1230,53 @@ var $;
|
|
|
981
1230
|
"use strict";
|
|
982
1231
|
var $;
|
|
983
1232
|
(function ($) {
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
host;
|
|
987
|
-
task;
|
|
988
|
-
static temp(host, task, ...args) {
|
|
989
|
-
const existen = $mol_wire_auto?.track_next();
|
|
990
|
-
reuse: if (existen) {
|
|
991
|
-
if (!(existen instanceof $mol_wire_fiber))
|
|
992
|
-
break reuse;
|
|
993
|
-
if (existen.host !== host)
|
|
994
|
-
break reuse;
|
|
995
|
-
if (existen.task !== task)
|
|
996
|
-
break reuse;
|
|
997
|
-
if (!$mol_compare_deep(existen.args, args))
|
|
998
|
-
break reuse;
|
|
999
|
-
return existen;
|
|
1000
|
-
}
|
|
1001
|
-
return new this(host, task, host + '.' + task.name + '(#)', ...args);
|
|
1002
|
-
}
|
|
1003
|
-
static persist(host, task, ...args) {
|
|
1233
|
+
class $mol_wire_atom extends $mol_wire_fiber {
|
|
1234
|
+
static getter(task, keys) {
|
|
1004
1235
|
const field = task.name + '()';
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1236
|
+
if (keys) {
|
|
1237
|
+
return function $mol_wire_atom_get(host, args) {
|
|
1238
|
+
let dict, key, fiber;
|
|
1239
|
+
key = `${host?.[Symbol.toStringTag] ?? host}.${task.name}(${args.map(v => $mol_key(v)).join(',')})`;
|
|
1240
|
+
dict = Object.getOwnPropertyDescriptor(host ?? task, field)?.value;
|
|
1241
|
+
if (dict) {
|
|
1242
|
+
const existen = dict.get(key);
|
|
1243
|
+
if (existen)
|
|
1244
|
+
return existen;
|
|
1245
|
+
}
|
|
1246
|
+
else {
|
|
1247
|
+
dict = (host ?? task)[field] = new Map();
|
|
1248
|
+
}
|
|
1249
|
+
fiber = new $mol_wire_atom(key, task, host, ...args);
|
|
1250
|
+
dict.set(key, fiber);
|
|
1251
|
+
return fiber;
|
|
1252
|
+
};
|
|
1013
1253
|
}
|
|
1014
1254
|
else {
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
return existen;
|
|
1026
|
-
}
|
|
1027
|
-
fiber = new this(host, task, key, ...args);
|
|
1028
|
-
if (args.length)
|
|
1029
|
-
dict.set(key, fiber);
|
|
1030
|
-
else
|
|
1031
|
-
host[field] = fiber;
|
|
1032
|
-
return fiber;
|
|
1255
|
+
return function $mol_wire_atom_get(host, args) {
|
|
1256
|
+
const existen = Object.getOwnPropertyDescriptor(host ?? task, field)?.value;
|
|
1257
|
+
if (existen)
|
|
1258
|
+
return existen;
|
|
1259
|
+
const key = `${host?.[Symbol.toStringTag] ?? host}.${field}`;
|
|
1260
|
+
const fiber = new $mol_wire_atom(key, task, host, ...args);
|
|
1261
|
+
(host ?? task)[field] = fiber;
|
|
1262
|
+
return fiber;
|
|
1263
|
+
};
|
|
1264
|
+
}
|
|
1033
1265
|
}
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
static reaping = [];
|
|
1037
|
-
static plan_task = null;
|
|
1038
|
-
static plan() {
|
|
1039
|
-
if (this.plan_task)
|
|
1040
|
-
return;
|
|
1041
|
-
this.plan_task = new $mol_after_frame(() => {
|
|
1266
|
+
recall(...args) {
|
|
1267
|
+
if (this.cursor > $mol_wire_cursor.fresh) {
|
|
1042
1268
|
try {
|
|
1043
|
-
this.
|
|
1044
|
-
}
|
|
1045
|
-
finally {
|
|
1046
|
-
$mol_wire_fiber.plan_task = null;
|
|
1047
|
-
}
|
|
1048
|
-
});
|
|
1049
|
-
}
|
|
1050
|
-
static sync() {
|
|
1051
|
-
while (this.planning.length) {
|
|
1052
|
-
const fibers = this.planning.splice(0, this.planning.length);
|
|
1053
|
-
for (const fiber of fibers) {
|
|
1054
|
-
fiber.up();
|
|
1269
|
+
this.once();
|
|
1055
1270
|
}
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
for (const fiber of fibers) {
|
|
1060
|
-
if (!fiber.sub_empty)
|
|
1061
|
-
continue;
|
|
1062
|
-
fiber.destructor();
|
|
1271
|
+
catch (error) {
|
|
1272
|
+
if (error instanceof Promise)
|
|
1273
|
+
$mol_fail_hidden(error);
|
|
1063
1274
|
}
|
|
1064
1275
|
}
|
|
1276
|
+
return this.put(this.task.call(this.host, ...args));
|
|
1065
1277
|
}
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
return this.slice(0, this.pub_from);
|
|
1069
|
-
}
|
|
1070
|
-
get result() {
|
|
1071
|
-
if (this.cache instanceof Promise)
|
|
1072
|
-
return;
|
|
1073
|
-
if (this.cache instanceof Error)
|
|
1074
|
-
return;
|
|
1075
|
-
return this.cache;
|
|
1076
|
-
}
|
|
1077
|
-
get persist() {
|
|
1078
|
-
const id = this[Symbol.toStringTag];
|
|
1079
|
-
return id[id.length - 2] !== '#';
|
|
1080
|
-
}
|
|
1081
|
-
field() {
|
|
1082
|
-
return this.task.name + '()';
|
|
1083
|
-
}
|
|
1084
|
-
constructor(host, task, id, ...args) {
|
|
1085
|
-
super(...args, undefined);
|
|
1086
|
-
this.host = host;
|
|
1087
|
-
this.task = task;
|
|
1088
|
-
this.pop();
|
|
1089
|
-
this.pub_from = this.sub_from = args.length;
|
|
1090
|
-
this[Symbol.toStringTag] = id;
|
|
1278
|
+
once() {
|
|
1279
|
+
return this.sync();
|
|
1091
1280
|
}
|
|
1092
1281
|
destructor() {
|
|
1093
1282
|
super.destructor();
|
|
@@ -1095,92 +1284,14 @@ var $;
|
|
|
1095
1284
|
if ($mol_owning_check(this, prev)) {
|
|
1096
1285
|
prev.destructor();
|
|
1097
1286
|
}
|
|
1098
|
-
this.
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
this.host[this.field()] = null;
|
|
1102
|
-
}
|
|
1103
|
-
else {
|
|
1104
|
-
this.host[this.field()].delete(this[Symbol.toStringTag]);
|
|
1105
|
-
}
|
|
1106
|
-
}
|
|
1107
|
-
}
|
|
1108
|
-
plan() {
|
|
1109
|
-
$mol_wire_fiber.planning.push(this);
|
|
1110
|
-
$mol_wire_fiber.plan();
|
|
1111
|
-
}
|
|
1112
|
-
reap() {
|
|
1113
|
-
$mol_wire_fiber.reaping.push(this);
|
|
1114
|
-
$mol_wire_fiber.plan();
|
|
1115
|
-
}
|
|
1116
|
-
toString() {
|
|
1117
|
-
return this[Symbol.toStringTag];
|
|
1118
|
-
}
|
|
1119
|
-
[$mol_dev_format_head]() {
|
|
1120
|
-
const cursor = this.cursor >= 0
|
|
1121
|
-
? '@' + this.cursor
|
|
1122
|
-
: this.cursor?.constructor?.name;
|
|
1123
|
-
return $mol_dev_format_div({}, $mol_dev_format_native(this), $mol_dev_format_shade(' ' + cursor + ' = '), $mol_dev_format_auto(this.cache));
|
|
1124
|
-
}
|
|
1125
|
-
get $() {
|
|
1126
|
-
return this.host['$'];
|
|
1127
|
-
}
|
|
1128
|
-
affect(quant) {
|
|
1129
|
-
if (!super.affect(quant))
|
|
1130
|
-
return false;
|
|
1131
|
-
if (this.sub_from === this.length) {
|
|
1132
|
-
this.plan();
|
|
1133
|
-
}
|
|
1134
|
-
return true;
|
|
1135
|
-
}
|
|
1136
|
-
down() {
|
|
1137
|
-
if (this.persist)
|
|
1138
|
-
return;
|
|
1139
|
-
this.destructor();
|
|
1140
|
-
}
|
|
1141
|
-
up() {
|
|
1142
|
-
if (this.cursor === $mol_wire_cursor.fresh)
|
|
1143
|
-
return;
|
|
1144
|
-
check: if (this.cursor === $mol_wire_cursor.doubt) {
|
|
1145
|
-
for (let i = this.pub_from; i < this.sub_from; i += 2) {
|
|
1146
|
-
;
|
|
1147
|
-
this[i]?.up();
|
|
1148
|
-
if (this.cursor !== $mol_wire_cursor.doubt)
|
|
1149
|
-
break check;
|
|
1150
|
-
}
|
|
1151
|
-
this.cursor = $mol_wire_cursor.fresh;
|
|
1152
|
-
return;
|
|
1153
|
-
}
|
|
1154
|
-
const bu = this.track_on();
|
|
1155
|
-
let result;
|
|
1156
|
-
try {
|
|
1157
|
-
result = this.task.call(this.host, ...this.args);
|
|
1158
|
-
if (result instanceof Promise) {
|
|
1159
|
-
const put = (res) => {
|
|
1160
|
-
if (this.cache === result)
|
|
1161
|
-
this.put(res);
|
|
1162
|
-
return res;
|
|
1163
|
-
};
|
|
1164
|
-
result = Object.assign(result.then(put, put), {
|
|
1165
|
-
destructor: result['destructor']
|
|
1166
|
-
});
|
|
1167
|
-
handled.add(result);
|
|
1168
|
-
}
|
|
1287
|
+
if (this.pub_from === 0) {
|
|
1288
|
+
;
|
|
1289
|
+
(this.host ?? this.task)[this.field()] = null;
|
|
1169
1290
|
}
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
result = Object.assign(result.finally(() => {
|
|
1174
|
-
if (this.cache === result)
|
|
1175
|
-
this.stale();
|
|
1176
|
-
}), {
|
|
1177
|
-
destructor: result['destructor']
|
|
1178
|
-
});
|
|
1179
|
-
handled.add(result);
|
|
1180
|
-
}
|
|
1291
|
+
else {
|
|
1292
|
+
;
|
|
1293
|
+
(this.host ?? this.task)[this.field()].delete(this[Symbol.toStringTag]);
|
|
1181
1294
|
}
|
|
1182
|
-
this.track_off(bu);
|
|
1183
|
-
this.put(result);
|
|
1184
1295
|
}
|
|
1185
1296
|
put(next) {
|
|
1186
1297
|
const prev = this.cache;
|
|
@@ -1189,13 +1300,13 @@ var $;
|
|
|
1189
1300
|
prev.destructor();
|
|
1190
1301
|
}
|
|
1191
1302
|
this.cache = next;
|
|
1192
|
-
if (
|
|
1303
|
+
if ($mol_owning_catch(this, next)) {
|
|
1193
1304
|
try {
|
|
1194
1305
|
next[Symbol.toStringTag] = this[Symbol.toStringTag];
|
|
1195
1306
|
}
|
|
1196
1307
|
catch { }
|
|
1197
1308
|
}
|
|
1198
|
-
if (this.sub_from < this.length) {
|
|
1309
|
+
if (this.sub_from < this.data.length) {
|
|
1199
1310
|
if (!$mol_compare_deep(prev, next)) {
|
|
1200
1311
|
this.emit();
|
|
1201
1312
|
}
|
|
@@ -1204,118 +1315,65 @@ var $;
|
|
|
1204
1315
|
this.cursor = $mol_wire_cursor.fresh;
|
|
1205
1316
|
if (next instanceof Promise)
|
|
1206
1317
|
return next;
|
|
1207
|
-
|
|
1208
|
-
for (let cursor = this.pub_from; cursor < this.sub_from; cursor += 2) {
|
|
1209
|
-
const pub = this[cursor];
|
|
1210
|
-
pub?.down();
|
|
1211
|
-
}
|
|
1212
|
-
}
|
|
1213
|
-
else {
|
|
1214
|
-
this.cursor = this.pub_from;
|
|
1215
|
-
this.forget();
|
|
1216
|
-
this.cursor = $mol_wire_cursor.fresh;
|
|
1217
|
-
}
|
|
1318
|
+
this.complete_pubs();
|
|
1218
1319
|
return next;
|
|
1219
1320
|
}
|
|
1220
|
-
recall(...args) {
|
|
1221
|
-
return this.put(this.task.call(this.host, ...args));
|
|
1222
|
-
}
|
|
1223
|
-
sync() {
|
|
1224
|
-
if (!$mol_wire_fiber.warm) {
|
|
1225
|
-
return this.result;
|
|
1226
|
-
}
|
|
1227
|
-
this.track_promote();
|
|
1228
|
-
this.up();
|
|
1229
|
-
if (this.cache instanceof Error) {
|
|
1230
|
-
return $mol_fail_hidden(this.cache);
|
|
1231
|
-
}
|
|
1232
|
-
if (this.cache instanceof Promise) {
|
|
1233
|
-
return $mol_fail_hidden(this.cache);
|
|
1234
|
-
}
|
|
1235
|
-
return this.cache;
|
|
1236
|
-
}
|
|
1237
|
-
async async() {
|
|
1238
|
-
while (true) {
|
|
1239
|
-
this.up();
|
|
1240
|
-
if (this.cache instanceof Error) {
|
|
1241
|
-
$mol_fail_hidden(this.cache);
|
|
1242
|
-
}
|
|
1243
|
-
if (!(this.cache instanceof Promise))
|
|
1244
|
-
return this.cache;
|
|
1245
|
-
await this.cache;
|
|
1246
|
-
if (this.cursor === $mol_wire_cursor.final) {
|
|
1247
|
-
await new Promise(() => { });
|
|
1248
|
-
}
|
|
1249
|
-
}
|
|
1250
|
-
}
|
|
1251
1321
|
}
|
|
1252
1322
|
__decorate([
|
|
1253
1323
|
$mol_wire_method
|
|
1254
|
-
], $
|
|
1255
|
-
|
|
1324
|
+
], $mol_wire_atom.prototype, "recall", null);
|
|
1325
|
+
__decorate([
|
|
1326
|
+
$mol_wire_method
|
|
1327
|
+
], $mol_wire_atom.prototype, "once", null);
|
|
1328
|
+
$.$mol_wire_atom = $mol_wire_atom;
|
|
1256
1329
|
})($ || ($ = {}));
|
|
1257
|
-
//mol/wire/
|
|
1330
|
+
//mol/wire/atom/atom.ts
|
|
1258
1331
|
;
|
|
1259
1332
|
"use strict";
|
|
1260
1333
|
var $;
|
|
1261
1334
|
(function ($) {
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1335
|
+
function $mol_wire_mem(keys) {
|
|
1336
|
+
const wrap = $mol_wire_mem_func(keys);
|
|
1337
|
+
return (host, field, descr) => {
|
|
1338
|
+
if (!descr)
|
|
1339
|
+
descr = Reflect.getOwnPropertyDescriptor(host, field);
|
|
1340
|
+
const orig = descr?.value ?? host[field];
|
|
1341
|
+
const sup = Reflect.getPrototypeOf(host);
|
|
1342
|
+
if (typeof sup[field] === 'function') {
|
|
1343
|
+
Object.defineProperty(orig, 'name', { value: sup[field].name });
|
|
1344
|
+
}
|
|
1345
|
+
const descr2 = {
|
|
1346
|
+
...descr,
|
|
1347
|
+
value: wrap(orig)
|
|
1348
|
+
};
|
|
1349
|
+
Reflect.defineProperty(host, field, descr2);
|
|
1350
|
+
return descr2;
|
|
1351
|
+
};
|
|
1270
1352
|
}
|
|
1271
|
-
$.$
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
;
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
(
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1353
|
+
$.$mol_wire_mem = $mol_wire_mem;
|
|
1354
|
+
function $mol_wire_mem_func(keys) {
|
|
1355
|
+
return (func) => {
|
|
1356
|
+
const persist = $mol_wire_atom.getter(func, keys);
|
|
1357
|
+
const wrapper = function (...args) {
|
|
1358
|
+
let atom = persist(this, args.slice(0, keys));
|
|
1359
|
+
if (args.length <= keys || args[keys] === undefined) {
|
|
1360
|
+
if (!$mol_wire_fiber.warm)
|
|
1361
|
+
return atom.sync();
|
|
1362
|
+
if ($mol_wire_auto() instanceof $mol_wire_task) {
|
|
1363
|
+
return atom.once();
|
|
1364
|
+
}
|
|
1365
|
+
else {
|
|
1366
|
+
return atom.sync();
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
return atom.recall(...args);
|
|
1370
|
+
};
|
|
1371
|
+
Object.defineProperty(wrapper, 'name', { value: func.name + ' ' });
|
|
1372
|
+
Object.assign(wrapper, { orig: func });
|
|
1373
|
+
return wrapper;
|
|
1374
|
+
};
|
|
1285
1375
|
}
|
|
1286
|
-
$.$
|
|
1287
|
-
})($ || ($ = {}));
|
|
1288
|
-
//mol/fail/log/log.ts
|
|
1289
|
-
;
|
|
1290
|
-
"use strict";
|
|
1291
|
-
var $;
|
|
1292
|
-
(function ($) {
|
|
1293
|
-
$.$mol_wire_mem = (keys) => (host, field, descr) => {
|
|
1294
|
-
if (!descr)
|
|
1295
|
-
descr = Reflect.getOwnPropertyDescriptor(host, field);
|
|
1296
|
-
const orig = descr?.value ?? host[field];
|
|
1297
|
-
const sup = Reflect.getPrototypeOf(host);
|
|
1298
|
-
if (typeof sup[field] === 'function') {
|
|
1299
|
-
Object.defineProperty(orig, 'name', { value: sup[field].name });
|
|
1300
|
-
}
|
|
1301
|
-
function value(...args) {
|
|
1302
|
-
let atom = $mol_wire_fiber.persist(this, orig, ...args.slice(0, keys));
|
|
1303
|
-
if (args[keys] === undefined)
|
|
1304
|
-
return atom.sync();
|
|
1305
|
-
try {
|
|
1306
|
-
atom.sync();
|
|
1307
|
-
}
|
|
1308
|
-
catch (error) {
|
|
1309
|
-
$mol_fail_log(error);
|
|
1310
|
-
}
|
|
1311
|
-
return atom.recall(...args);
|
|
1312
|
-
}
|
|
1313
|
-
Object.defineProperty(value, 'name', { value: orig.name + ' ' });
|
|
1314
|
-
Object.assign(value, { orig });
|
|
1315
|
-
const descr2 = { ...descr, value };
|
|
1316
|
-
Reflect.defineProperty(host, field, descr2);
|
|
1317
|
-
return descr2;
|
|
1318
|
-
};
|
|
1376
|
+
$.$mol_wire_mem_func = $mol_wire_mem_func;
|
|
1319
1377
|
})($ || ($ = {}));
|
|
1320
1378
|
//mol/wire/mem/mem.ts
|
|
1321
1379
|
;
|
|
@@ -1351,7 +1409,38 @@ var $;
|
|
|
1351
1409
|
$.$mol_window = $mol_window;
|
|
1352
1410
|
self.addEventListener('resize', event => $mol_window.resizes(event));
|
|
1353
1411
|
})($ || ($ = {}));
|
|
1354
|
-
//mol/window/window.web.ts
|
|
1412
|
+
//mol/window/window.web.ts
|
|
1413
|
+
;
|
|
1414
|
+
"use strict";
|
|
1415
|
+
var $;
|
|
1416
|
+
(function ($) {
|
|
1417
|
+
const cacthed = new WeakMap();
|
|
1418
|
+
function $mol_fail_catch(error) {
|
|
1419
|
+
if (typeof error !== 'object')
|
|
1420
|
+
return false;
|
|
1421
|
+
if (cacthed.get(error))
|
|
1422
|
+
return false;
|
|
1423
|
+
cacthed.set(error, true);
|
|
1424
|
+
return true;
|
|
1425
|
+
}
|
|
1426
|
+
$.$mol_fail_catch = $mol_fail_catch;
|
|
1427
|
+
})($ || ($ = {}));
|
|
1428
|
+
//mol/fail/catch/catch.ts
|
|
1429
|
+
;
|
|
1430
|
+
"use strict";
|
|
1431
|
+
var $;
|
|
1432
|
+
(function ($) {
|
|
1433
|
+
function $mol_fail_log(error) {
|
|
1434
|
+
if (error instanceof Promise)
|
|
1435
|
+
return false;
|
|
1436
|
+
if (!$mol_fail_catch(error))
|
|
1437
|
+
return false;
|
|
1438
|
+
console.error(error);
|
|
1439
|
+
return true;
|
|
1440
|
+
}
|
|
1441
|
+
$.$mol_fail_log = $mol_fail_log;
|
|
1442
|
+
})($ || ($ = {}));
|
|
1443
|
+
//mol/fail/log/log.ts
|
|
1355
1444
|
;
|
|
1356
1445
|
"use strict";
|
|
1357
1446
|
var $;
|
|
@@ -1404,6 +1493,63 @@ var $;
|
|
|
1404
1493
|
;
|
|
1405
1494
|
"use strict";
|
|
1406
1495
|
var $;
|
|
1496
|
+
(function ($) {
|
|
1497
|
+
class $mol_wrapper extends $mol_object2 {
|
|
1498
|
+
static wrap;
|
|
1499
|
+
static run(task) {
|
|
1500
|
+
return this.func(task)();
|
|
1501
|
+
}
|
|
1502
|
+
static func(func) {
|
|
1503
|
+
return this.wrap(func);
|
|
1504
|
+
}
|
|
1505
|
+
static get class() {
|
|
1506
|
+
return (Class) => {
|
|
1507
|
+
const construct = (target, args) => new Class(...args);
|
|
1508
|
+
const handler = {
|
|
1509
|
+
construct: this.func(construct)
|
|
1510
|
+
};
|
|
1511
|
+
handler[Symbol.toStringTag] = Class.name + '#';
|
|
1512
|
+
return new Proxy(Class, handler);
|
|
1513
|
+
};
|
|
1514
|
+
}
|
|
1515
|
+
static get method() {
|
|
1516
|
+
return (obj, name, descr) => {
|
|
1517
|
+
descr.value = this.func(descr.value);
|
|
1518
|
+
return descr;
|
|
1519
|
+
};
|
|
1520
|
+
}
|
|
1521
|
+
static get field() {
|
|
1522
|
+
return (obj, name, descr) => {
|
|
1523
|
+
descr.get = descr.set = this.func(descr.get);
|
|
1524
|
+
return descr;
|
|
1525
|
+
};
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
$.$mol_wrapper = $mol_wrapper;
|
|
1529
|
+
})($ || ($ = {}));
|
|
1530
|
+
//mol/wrapper/wrapper.ts
|
|
1531
|
+
;
|
|
1532
|
+
"use strict";
|
|
1533
|
+
var $;
|
|
1534
|
+
(function ($) {
|
|
1535
|
+
class $mol_memo extends $mol_wrapper {
|
|
1536
|
+
static wrap(task) {
|
|
1537
|
+
const store = new WeakMap();
|
|
1538
|
+
return function (next) {
|
|
1539
|
+
if (next === undefined && store.has(this))
|
|
1540
|
+
return store.get(this);
|
|
1541
|
+
const val = task.call(this, next) ?? next;
|
|
1542
|
+
store.set(this, val);
|
|
1543
|
+
return val;
|
|
1544
|
+
};
|
|
1545
|
+
}
|
|
1546
|
+
}
|
|
1547
|
+
$.$mol_memo = $mol_memo;
|
|
1548
|
+
})($ || ($ = {}));
|
|
1549
|
+
//mol/memo/memo.ts
|
|
1550
|
+
;
|
|
1551
|
+
"use strict";
|
|
1552
|
+
var $;
|
|
1407
1553
|
(function ($) {
|
|
1408
1554
|
function $mol_dom_qname(name) {
|
|
1409
1555
|
return name.replace(/\W/g, '').replace(/^(?=\d+)/, '_');
|
|
@@ -1458,9 +1604,10 @@ var $;
|
|
|
1458
1604
|
if (typeof val !== 'function')
|
|
1459
1605
|
return val;
|
|
1460
1606
|
let fiber;
|
|
1607
|
+
const temp = $mol_wire_task.getter(val);
|
|
1461
1608
|
return function $mol_wire_async(...args) {
|
|
1462
1609
|
fiber?.destructor();
|
|
1463
|
-
fiber =
|
|
1610
|
+
fiber = temp(obj, args);
|
|
1464
1611
|
return fiber.async();
|
|
1465
1612
|
};
|
|
1466
1613
|
}
|
|
@@ -1561,63 +1708,6 @@ var $;
|
|
|
1561
1708
|
;
|
|
1562
1709
|
"use strict";
|
|
1563
1710
|
var $;
|
|
1564
|
-
(function ($) {
|
|
1565
|
-
class $mol_wrapper extends $mol_object2 {
|
|
1566
|
-
static wrap;
|
|
1567
|
-
static run(task) {
|
|
1568
|
-
return this.func(task)();
|
|
1569
|
-
}
|
|
1570
|
-
static func(func) {
|
|
1571
|
-
return this.wrap(func);
|
|
1572
|
-
}
|
|
1573
|
-
static get class() {
|
|
1574
|
-
return (Class) => {
|
|
1575
|
-
const construct = (target, args) => new Class(...args);
|
|
1576
|
-
const handler = {
|
|
1577
|
-
construct: this.func(construct)
|
|
1578
|
-
};
|
|
1579
|
-
handler[Symbol.toStringTag] = Class.name + '#';
|
|
1580
|
-
return new Proxy(Class, handler);
|
|
1581
|
-
};
|
|
1582
|
-
}
|
|
1583
|
-
static get method() {
|
|
1584
|
-
return (obj, name, descr) => {
|
|
1585
|
-
descr.value = this.func(descr.value);
|
|
1586
|
-
return descr;
|
|
1587
|
-
};
|
|
1588
|
-
}
|
|
1589
|
-
static get field() {
|
|
1590
|
-
return (obj, name, descr) => {
|
|
1591
|
-
descr.get = descr.set = this.func(descr.get);
|
|
1592
|
-
return descr;
|
|
1593
|
-
};
|
|
1594
|
-
}
|
|
1595
|
-
}
|
|
1596
|
-
$.$mol_wrapper = $mol_wrapper;
|
|
1597
|
-
})($ || ($ = {}));
|
|
1598
|
-
//mol/wrapper/wrapper.ts
|
|
1599
|
-
;
|
|
1600
|
-
"use strict";
|
|
1601
|
-
var $;
|
|
1602
|
-
(function ($) {
|
|
1603
|
-
class $mol_memo extends $mol_wrapper {
|
|
1604
|
-
static wrap(task) {
|
|
1605
|
-
const store = new WeakMap();
|
|
1606
|
-
return function (next) {
|
|
1607
|
-
if (next === undefined && store.has(this))
|
|
1608
|
-
return store.get(this);
|
|
1609
|
-
const val = task.call(this, next) ?? next;
|
|
1610
|
-
store.set(this, val);
|
|
1611
|
-
return val;
|
|
1612
|
-
};
|
|
1613
|
-
}
|
|
1614
|
-
}
|
|
1615
|
-
$.$mol_memo = $mol_memo;
|
|
1616
|
-
})($ || ($ = {}));
|
|
1617
|
-
//mol/memo/memo.ts
|
|
1618
|
-
;
|
|
1619
|
-
"use strict";
|
|
1620
|
-
var $;
|
|
1621
1711
|
(function ($) {
|
|
1622
1712
|
function $mol_func_name(func) {
|
|
1623
1713
|
let name = func.name;
|
|
@@ -1645,86 +1735,9 @@ var $;
|
|
|
1645
1735
|
//mol/func/name/name.ts
|
|
1646
1736
|
;
|
|
1647
1737
|
"use strict";
|
|
1648
|
-
var $;
|
|
1649
|
-
(function ($) {
|
|
1650
|
-
function $mol_log3_area_lazy(event) {
|
|
1651
|
-
const self = this;
|
|
1652
|
-
const stack = self.$mol_log3_stack;
|
|
1653
|
-
const deep = stack.length;
|
|
1654
|
-
let logged = false;
|
|
1655
|
-
stack.push(() => {
|
|
1656
|
-
logged = true;
|
|
1657
|
-
self.$mol_log3_area.call(self, event);
|
|
1658
|
-
});
|
|
1659
|
-
return () => {
|
|
1660
|
-
if (logged)
|
|
1661
|
-
self.console.groupEnd();
|
|
1662
|
-
if (stack.length > deep)
|
|
1663
|
-
stack.length = deep;
|
|
1664
|
-
};
|
|
1665
|
-
}
|
|
1666
|
-
$.$mol_log3_area_lazy = $mol_log3_area_lazy;
|
|
1667
|
-
$.$mol_log3_stack = [];
|
|
1668
|
-
})($ || ($ = {}));
|
|
1669
|
-
//mol/log3/log3.ts
|
|
1670
|
-
;
|
|
1671
|
-
"use strict";
|
|
1672
1738
|
//mol/type/keys/extract/extract.ts
|
|
1673
1739
|
;
|
|
1674
1740
|
"use strict";
|
|
1675
|
-
var $;
|
|
1676
|
-
(function ($) {
|
|
1677
|
-
function $mol_log3_web_make(level, color) {
|
|
1678
|
-
return function $mol_log3_logger(event) {
|
|
1679
|
-
const pending = this.$mol_log3_stack.pop();
|
|
1680
|
-
if (pending)
|
|
1681
|
-
pending();
|
|
1682
|
-
let tpl = '%c';
|
|
1683
|
-
const chunks = Object.values(event);
|
|
1684
|
-
for (let i = 0; i < chunks.length; ++i) {
|
|
1685
|
-
tpl += (typeof chunks[i] === 'string') ? ' ⦙ %s' : ' ⦙ %o';
|
|
1686
|
-
}
|
|
1687
|
-
const style = `color:${color};font-weight:bolder`;
|
|
1688
|
-
this.console[level](tpl, style, ...chunks);
|
|
1689
|
-
const self = this;
|
|
1690
|
-
return () => self.console.groupEnd();
|
|
1691
|
-
};
|
|
1692
|
-
}
|
|
1693
|
-
$.$mol_log3_web_make = $mol_log3_web_make;
|
|
1694
|
-
$.$mol_log3_come = $mol_log3_web_make('info', 'royalblue');
|
|
1695
|
-
$.$mol_log3_done = $mol_log3_web_make('info', 'forestgreen');
|
|
1696
|
-
$.$mol_log3_fail = $mol_log3_web_make('error', 'orangered');
|
|
1697
|
-
$.$mol_log3_warn = $mol_log3_web_make('warn', 'goldenrod');
|
|
1698
|
-
$.$mol_log3_rise = $mol_log3_web_make('log', 'magenta');
|
|
1699
|
-
$.$mol_log3_area = $mol_log3_web_make('group', 'cyan');
|
|
1700
|
-
})($ || ($ = {}));
|
|
1701
|
-
//mol/log3/log3.web.ts
|
|
1702
|
-
;
|
|
1703
|
-
"use strict";
|
|
1704
|
-
var $;
|
|
1705
|
-
(function ($) {
|
|
1706
|
-
function $mol_deprecated(message) {
|
|
1707
|
-
return (host, field, descr) => {
|
|
1708
|
-
const value = descr.value;
|
|
1709
|
-
let warned = false;
|
|
1710
|
-
descr.value = function $mol_deprecated_wrapper(...args) {
|
|
1711
|
-
if (!warned) {
|
|
1712
|
-
$$.$mol_log3_warn({
|
|
1713
|
-
place: `${host.constructor.name}::${field}`,
|
|
1714
|
-
message: `Deprecated`,
|
|
1715
|
-
hint: message,
|
|
1716
|
-
});
|
|
1717
|
-
warned = true;
|
|
1718
|
-
}
|
|
1719
|
-
return value.call(this, ...args);
|
|
1720
|
-
};
|
|
1721
|
-
};
|
|
1722
|
-
}
|
|
1723
|
-
$.$mol_deprecated = $mol_deprecated;
|
|
1724
|
-
})($ || ($ = {}));
|
|
1725
|
-
//mol/deprecated/deprecated.ts
|
|
1726
|
-
;
|
|
1727
|
-
"use strict";
|
|
1728
1741
|
//mol/type/pick/pick.ts
|
|
1729
1742
|
;
|
|
1730
1743
|
"use strict";
|
|
@@ -1756,7 +1769,7 @@ var $;
|
|
|
1756
1769
|
}
|
|
1757
1770
|
}
|
|
1758
1771
|
static autobind() {
|
|
1759
|
-
const nodes = $mol_dom_context.document.querySelectorAll('[mol_view_root]');
|
|
1772
|
+
const nodes = $mol_dom_context.document.querySelectorAll('[mol_view_root]:not([mol_view_root=""])');
|
|
1760
1773
|
for (let i = nodes.length - 1; i >= 0; --i) {
|
|
1761
1774
|
const name = nodes.item(i).getAttribute('mol_view_root');
|
|
1762
1775
|
const View = $[name];
|
|
@@ -1853,6 +1866,18 @@ var $;
|
|
|
1853
1866
|
}
|
|
1854
1867
|
return node;
|
|
1855
1868
|
}
|
|
1869
|
+
dom_final() {
|
|
1870
|
+
this.render();
|
|
1871
|
+
const sub = this.sub_visible();
|
|
1872
|
+
if (!sub)
|
|
1873
|
+
return;
|
|
1874
|
+
for (const el of sub) {
|
|
1875
|
+
if (el && typeof el === 'object' && 'dom_final' in el) {
|
|
1876
|
+
el['dom_final']();
|
|
1877
|
+
}
|
|
1878
|
+
}
|
|
1879
|
+
return this.dom_node();
|
|
1880
|
+
}
|
|
1856
1881
|
dom_tree(next) {
|
|
1857
1882
|
const node = this.dom_node(next);
|
|
1858
1883
|
try {
|
|
@@ -1867,6 +1892,7 @@ var $;
|
|
|
1867
1892
|
}
|
|
1868
1893
|
}
|
|
1869
1894
|
}
|
|
1895
|
+
this.auto();
|
|
1870
1896
|
}
|
|
1871
1897
|
catch (error) {
|
|
1872
1898
|
$mol_dom_render_attributes(node, { mol_view_error: error.name || error.constructor.name });
|
|
@@ -1877,15 +1903,11 @@ var $;
|
|
|
1877
1903
|
catch { }
|
|
1878
1904
|
}
|
|
1879
1905
|
}
|
|
1880
|
-
this.auto();
|
|
1881
1906
|
return node;
|
|
1882
1907
|
}
|
|
1883
1908
|
dom_node_actual() {
|
|
1884
1909
|
const node = this.dom_node();
|
|
1885
|
-
$mol_dom_render_styles(node,
|
|
1886
|
-
minHeight: this.minimal_height(),
|
|
1887
|
-
minWidth: this.minimal_width(),
|
|
1888
|
-
});
|
|
1910
|
+
$mol_dom_render_styles(node, this.style_size());
|
|
1889
1911
|
const attr = this.attr();
|
|
1890
1912
|
const style = this.style();
|
|
1891
1913
|
const fields = this.field();
|
|
@@ -1893,7 +1915,9 @@ var $;
|
|
|
1893
1915
|
$mol_dom_render_styles(node, style);
|
|
1894
1916
|
return node;
|
|
1895
1917
|
}
|
|
1896
|
-
auto() {
|
|
1918
|
+
auto() {
|
|
1919
|
+
return null;
|
|
1920
|
+
}
|
|
1897
1921
|
render() {
|
|
1898
1922
|
const node = this.dom_node_actual();
|
|
1899
1923
|
const sub = this.sub_visible();
|
|
@@ -1968,6 +1992,12 @@ var $;
|
|
|
1968
1992
|
attr() {
|
|
1969
1993
|
return {};
|
|
1970
1994
|
}
|
|
1995
|
+
style_size() {
|
|
1996
|
+
return {
|
|
1997
|
+
minHeight: this.minimal_height(),
|
|
1998
|
+
minWidth: this.minimal_width(),
|
|
1999
|
+
};
|
|
2000
|
+
}
|
|
1971
2001
|
style() {
|
|
1972
2002
|
return {};
|
|
1973
2003
|
}
|
|
@@ -1977,9 +2007,6 @@ var $;
|
|
|
1977
2007
|
event() {
|
|
1978
2008
|
return {};
|
|
1979
2009
|
}
|
|
1980
|
-
event_async() {
|
|
1981
|
-
return {};
|
|
1982
|
-
}
|
|
1983
2010
|
plugins() {
|
|
1984
2011
|
return [];
|
|
1985
2012
|
}
|
|
@@ -2022,6 +2049,9 @@ var $;
|
|
|
2022
2049
|
__decorate([
|
|
2023
2050
|
$mol_mem
|
|
2024
2051
|
], $mol_view.prototype, "focused", null);
|
|
2052
|
+
__decorate([
|
|
2053
|
+
$mol_memo.method
|
|
2054
|
+
], $mol_view.prototype, "dom_name", null);
|
|
2025
2055
|
__decorate([
|
|
2026
2056
|
$mol_mem
|
|
2027
2057
|
], $mol_view.prototype, "minimal_width", null);
|
|
@@ -2040,18 +2070,24 @@ var $;
|
|
|
2040
2070
|
__decorate([
|
|
2041
2071
|
$mol_mem
|
|
2042
2072
|
], $mol_view.prototype, "dom_node", null);
|
|
2073
|
+
__decorate([
|
|
2074
|
+
$mol_mem
|
|
2075
|
+
], $mol_view.prototype, "dom_final", null);
|
|
2043
2076
|
__decorate([
|
|
2044
2077
|
$mol_mem
|
|
2045
2078
|
], $mol_view.prototype, "dom_tree", null);
|
|
2046
2079
|
__decorate([
|
|
2047
2080
|
$mol_mem
|
|
2048
2081
|
], $mol_view.prototype, "dom_node_actual", null);
|
|
2082
|
+
__decorate([
|
|
2083
|
+
$mol_mem
|
|
2084
|
+
], $mol_view.prototype, "render", null);
|
|
2049
2085
|
__decorate([
|
|
2050
2086
|
$mol_memo.method
|
|
2051
|
-
], $mol_view.prototype, "
|
|
2087
|
+
], $mol_view.prototype, "view_names_owned", null);
|
|
2052
2088
|
__decorate([
|
|
2053
|
-
$
|
|
2054
|
-
], $mol_view.prototype, "
|
|
2089
|
+
$mol_memo.method
|
|
2090
|
+
], $mol_view.prototype, "view_names", null);
|
|
2055
2091
|
__decorate([
|
|
2056
2092
|
$mol_mem_key
|
|
2057
2093
|
], $mol_view, "Root", null);
|
|
@@ -2068,7 +2104,7 @@ var $;
|
|
|
2068
2104
|
"use strict";
|
|
2069
2105
|
var $;
|
|
2070
2106
|
(function ($) {
|
|
2071
|
-
$mol_style_attach("mol/view/view/view.css", "[mol_view] {\n\ttransition-property: height, width, min-height, min-width, max-width, max-height, transform;\n\ttransition-duration: .2s;\n\ttransition-timing-function: ease-out;\n\t-webkit-appearance: none;\n\tword-break: break-word;\n\tbox-sizing: border-box;\n\tdisplay: flex;\n\tflex-shrink: 0;\n\
|
|
2107
|
+
$mol_style_attach("mol/view/view/view.css", "[mol_view] {\n\ttransition-property: height, width, min-height, min-width, max-width, max-height, transform;\n\ttransition-duration: .2s;\n\ttransition-timing-function: ease-out;\n\t-webkit-appearance: none;\n\tword-break: break-word;\n\tbox-sizing: border-box;\n\tdisplay: flex;\n\tflex-shrink: 0;\n\tcontain: style;\n\ttab-size: 4;\n}\n\n[mol_view]::selection {\n\tbackground: var(--mol_theme_line);\n}\n\n[mol_view] > * {\n\tword-break: inherit;\n}\n\n[mol_view_root] {\n\tmargin: 0;\n\tpadding: 0;\n\twidth: 100%;\n\theight: 100%;\n}\n\n[mol_view_root]:not([mol_view_root=\"\"]) {\n\tbox-sizing: border-box;\n\tfont: var(--mol_skin_font);\n\tbackground: var(--mol_theme_back);\n\tcolor: var(--mol_theme_text);\n\tcontain: unset; /** Fixes bg ignoring when applied to body on Chrome */\n}\n\n[mol_view][mol_view_error]:not([mol_view_error=\"Promise\"]) {\n\tbackground-image: repeating-linear-gradient(\n\t\t-45deg,\n\t\t#f92323,\n\t\t#f92323 10px,\n\t\t#ff3d3d 10px,\n\t\t#ff3d3d 30px\n\t);\n\tcolor: black;\n}\n\n@keyframes mol_view_wait_move {\n\tfrom {\n\t\tbackground-position: 0 0;\n\t}\n\tto {\n\t\tbackground-position: 200vmax 0;\n\t}\n}\n\n@keyframes mol_view_wait_show {\n\tto {\n\t\tbackground-image: repeating-linear-gradient(\n\t\t\t45deg,\n\t\t\thsla( 0 , 0% , 50% , .5 ) 0% ,\n\t\t\thsla( 0 , 0% , 50% , 0 ) 5% ,\n\t\t\thsla( 0 , 0% , 50% , 0 ) 45% ,\n\t\t\thsla( 0 , 0% , 50% , .5 ) 50% ,\n\t\t\thsla( 0 , 0% , 50% , 0 ) 55% ,\n\t\t\thsla( 0 , 0% , 50% , 0 ) 95% ,\n\t\t\thsla( 0 , 0% , 50% , .5 ) 100%\n\t\t);\n\t\tbackground-size: 200vmax 200vmax;\n\t}\n}\n\n[mol_view][mol_view_error=\"Promise\"] {\n\tanimation: mol_view_wait_show .5s .5s linear forwards , mol_view_wait_move 1s linear infinite;\n\topacity: .75;\n}\n");
|
|
2072
2108
|
})($ || ($ = {}));
|
|
2073
2109
|
//mol/view/view/-css/view.css.ts
|
|
2074
2110
|
;
|
|
@@ -2076,9 +2112,7 @@ var $;
|
|
|
2076
2112
|
var $;
|
|
2077
2113
|
(function ($) {
|
|
2078
2114
|
if ($mol_dom_context.document) {
|
|
2079
|
-
|
|
2080
|
-
$mol_view.autobind();
|
|
2081
|
-
});
|
|
2115
|
+
setTimeout(() => $mol_view.autobind());
|
|
2082
2116
|
function $mol_view_watch() {
|
|
2083
2117
|
new $mol_after_frame($mol_view_watch);
|
|
2084
2118
|
for (const view of $mol_view.watchers) {
|
|
@@ -2106,6 +2140,9 @@ var $;
|
|
|
2106
2140
|
font_family() {
|
|
2107
2141
|
return "";
|
|
2108
2142
|
}
|
|
2143
|
+
style_size() {
|
|
2144
|
+
return {};
|
|
2145
|
+
}
|
|
2109
2146
|
}
|
|
2110
2147
|
$.$mol_svg = $mol_svg;
|
|
2111
2148
|
})($ || ($ = {}));
|
|
@@ -2134,42 +2171,24 @@ var $;
|
|
|
2134
2171
|
;
|
|
2135
2172
|
"use strict";
|
|
2136
2173
|
var $;
|
|
2137
|
-
(function ($) {
|
|
2138
|
-
class $mol_after_work extends $mol_object2 {
|
|
2139
|
-
delay;
|
|
2140
|
-
task;
|
|
2141
|
-
id;
|
|
2142
|
-
constructor(delay, task) {
|
|
2143
|
-
super();
|
|
2144
|
-
this.delay = delay;
|
|
2145
|
-
this.task = task;
|
|
2146
|
-
this.id = requestIdleCallback(task, { timeout: delay });
|
|
2147
|
-
}
|
|
2148
|
-
destructor() {
|
|
2149
|
-
cancelIdleCallback(this.id);
|
|
2150
|
-
}
|
|
2151
|
-
}
|
|
2152
|
-
$.$mol_after_work = $mol_after_work;
|
|
2153
|
-
if (typeof requestIdleCallback !== 'function') {
|
|
2154
|
-
$.$mol_after_work = $mol_after_timeout;
|
|
2155
|
-
}
|
|
2156
|
-
})($ || ($ = {}));
|
|
2157
|
-
//mol/after/work/work.ts
|
|
2158
|
-
;
|
|
2159
|
-
"use strict";
|
|
2160
|
-
var $;
|
|
2161
2174
|
(function ($) {
|
|
2162
2175
|
class $mol_state_time extends $mol_object {
|
|
2163
|
-
static
|
|
2164
|
-
if (precision
|
|
2165
|
-
new $
|
|
2176
|
+
static task(precision, reset) {
|
|
2177
|
+
if (precision) {
|
|
2178
|
+
return new $mol_after_timeout(precision, () => this.task(precision, null));
|
|
2166
2179
|
}
|
|
2167
2180
|
else {
|
|
2168
|
-
new $
|
|
2181
|
+
return new $mol_after_frame(() => this.task(precision, null));
|
|
2169
2182
|
}
|
|
2183
|
+
}
|
|
2184
|
+
static now(precision) {
|
|
2185
|
+
this.task(precision);
|
|
2170
2186
|
return Date.now();
|
|
2171
2187
|
}
|
|
2172
2188
|
}
|
|
2189
|
+
__decorate([
|
|
2190
|
+
$mol_mem_key
|
|
2191
|
+
], $mol_state_time, "task", null);
|
|
2173
2192
|
__decorate([
|
|
2174
2193
|
$mol_mem_key
|
|
2175
2194
|
], $mol_state_time, "now", null);
|
|
@@ -2179,6 +2198,36 @@ var $;
|
|
|
2179
2198
|
;
|
|
2180
2199
|
"use strict";
|
|
2181
2200
|
var $;
|
|
2201
|
+
(function ($) {
|
|
2202
|
+
class $mol_plugin extends $mol_view {
|
|
2203
|
+
dom_node(next) {
|
|
2204
|
+
const node = next || $mol_owning_get(this).host.dom_node();
|
|
2205
|
+
$mol_dom_render_attributes(node, this.attr_static());
|
|
2206
|
+
const events = $mol_wire_async(this.event());
|
|
2207
|
+
for (let event_name in events) {
|
|
2208
|
+
node.addEventListener(event_name, events[event_name], { passive: false });
|
|
2209
|
+
}
|
|
2210
|
+
return node;
|
|
2211
|
+
}
|
|
2212
|
+
attr_static() {
|
|
2213
|
+
return {};
|
|
2214
|
+
}
|
|
2215
|
+
event() {
|
|
2216
|
+
return {};
|
|
2217
|
+
}
|
|
2218
|
+
render() {
|
|
2219
|
+
this.dom_node_actual();
|
|
2220
|
+
}
|
|
2221
|
+
}
|
|
2222
|
+
__decorate([
|
|
2223
|
+
$mol_mem
|
|
2224
|
+
], $mol_plugin.prototype, "dom_node", null);
|
|
2225
|
+
$.$mol_plugin = $mol_plugin;
|
|
2226
|
+
})($ || ($ = {}));
|
|
2227
|
+
//mol/plugin/plugin.ts
|
|
2228
|
+
;
|
|
2229
|
+
"use strict";
|
|
2230
|
+
var $;
|
|
2182
2231
|
(function ($) {
|
|
2183
2232
|
var $$;
|
|
2184
2233
|
(function ($$) {
|
|
@@ -2187,7 +2236,7 @@ var $;
|
|
|
2187
2236
|
const win = this.$.$mol_dom_context;
|
|
2188
2237
|
const style = win.getComputedStyle(this.dom_node());
|
|
2189
2238
|
if (!style['font-size'])
|
|
2190
|
-
$mol_state_time.now();
|
|
2239
|
+
$mol_state_time.now(0);
|
|
2191
2240
|
return style;
|
|
2192
2241
|
}
|
|
2193
2242
|
font_size() {
|
|
@@ -2655,36 +2704,6 @@ var $;
|
|
|
2655
2704
|
;
|
|
2656
2705
|
"use strict";
|
|
2657
2706
|
var $;
|
|
2658
|
-
(function ($) {
|
|
2659
|
-
class $mol_plugin extends $mol_view {
|
|
2660
|
-
dom_node(next) {
|
|
2661
|
-
const node = next || $mol_owning_get(this).host.dom_node();
|
|
2662
|
-
$mol_dom_render_attributes(node, this.attr_static());
|
|
2663
|
-
const events = $mol_wire_async(this.event());
|
|
2664
|
-
for (let event_name in events) {
|
|
2665
|
-
node.addEventListener(event_name, events[event_name], { passive: false });
|
|
2666
|
-
}
|
|
2667
|
-
return node;
|
|
2668
|
-
}
|
|
2669
|
-
attr_static() {
|
|
2670
|
-
return {};
|
|
2671
|
-
}
|
|
2672
|
-
event() {
|
|
2673
|
-
return {};
|
|
2674
|
-
}
|
|
2675
|
-
render() {
|
|
2676
|
-
this.dom_node_actual();
|
|
2677
|
-
}
|
|
2678
|
-
}
|
|
2679
|
-
__decorate([
|
|
2680
|
-
$mol_mem
|
|
2681
|
-
], $mol_plugin.prototype, "dom_node", null);
|
|
2682
|
-
$.$mol_plugin = $mol_plugin;
|
|
2683
|
-
})($ || ($ = {}));
|
|
2684
|
-
//mol/plugin/plugin.ts
|
|
2685
|
-
;
|
|
2686
|
-
"use strict";
|
|
2687
|
-
var $;
|
|
2688
2707
|
(function ($) {
|
|
2689
2708
|
class $mol_touch extends $mol_plugin {
|
|
2690
2709
|
start_zoom(val) {
|