mol_wire_lib 1.0.101 → 1.0.104
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 +25 -23
- package/node.deps.json +1 -1
- package/node.esm.js +241 -233
- package/node.esm.js.map +1 -1
- package/node.js +241 -233
- package/node.js.map +1 -1
- package/node.test.js +241 -233
- package/node.test.js.map +1 -1
- package/package.json +5 -5
- package/web.d.ts +25 -23
- package/web.deps.json +1 -1
- package/web.esm.js +241 -233
- package/web.esm.js.map +1 -1
- package/web.js +241 -233
- package/web.js.map +1 -1
package/web.js
CHANGED
|
@@ -566,131 +566,6 @@ var $;
|
|
|
566
566
|
;
|
|
567
567
|
"use strict";
|
|
568
568
|
var $;
|
|
569
|
-
(function ($) {
|
|
570
|
-
$.$mol_compare_deep_cache = new WeakMap();
|
|
571
|
-
function $mol_compare_deep(left, right) {
|
|
572
|
-
if (Object.is(left, right))
|
|
573
|
-
return true;
|
|
574
|
-
if (left === null)
|
|
575
|
-
return false;
|
|
576
|
-
if (right === null)
|
|
577
|
-
return false;
|
|
578
|
-
if (typeof left !== 'object')
|
|
579
|
-
return false;
|
|
580
|
-
if (typeof right !== 'object')
|
|
581
|
-
return false;
|
|
582
|
-
const left_proto = Reflect.getPrototypeOf(left);
|
|
583
|
-
const right_proto = Reflect.getPrototypeOf(right);
|
|
584
|
-
if (left_proto !== right_proto)
|
|
585
|
-
return false;
|
|
586
|
-
if (left instanceof Boolean)
|
|
587
|
-
return Object.is(left.valueOf(), right['valueOf']());
|
|
588
|
-
if (left instanceof Number)
|
|
589
|
-
return Object.is(left.valueOf(), right['valueOf']());
|
|
590
|
-
if (left instanceof String)
|
|
591
|
-
return Object.is(left.valueOf(), right['valueOf']());
|
|
592
|
-
if (left instanceof Date)
|
|
593
|
-
return Object.is(left.valueOf(), right['valueOf']());
|
|
594
|
-
if (left instanceof RegExp)
|
|
595
|
-
return left.source === right['source'] && left.flags === right['flags'];
|
|
596
|
-
let left_cache = $.$mol_compare_deep_cache.get(left);
|
|
597
|
-
if (left_cache) {
|
|
598
|
-
const right_cache = left_cache.get(right);
|
|
599
|
-
if (typeof right_cache === 'boolean')
|
|
600
|
-
return right_cache;
|
|
601
|
-
}
|
|
602
|
-
else {
|
|
603
|
-
left_cache = new WeakMap([[right, true]]);
|
|
604
|
-
$.$mol_compare_deep_cache.set(left, left_cache);
|
|
605
|
-
}
|
|
606
|
-
let result;
|
|
607
|
-
try {
|
|
608
|
-
if (left_proto && !Reflect.getPrototypeOf(left_proto))
|
|
609
|
-
result = compare_pojo(left, right);
|
|
610
|
-
else if (Array.isArray(left))
|
|
611
|
-
result = compare_array(left, right);
|
|
612
|
-
else if (left instanceof Set)
|
|
613
|
-
result = compare_set(left, right);
|
|
614
|
-
else if (left instanceof Map)
|
|
615
|
-
result = compare_map(left, right);
|
|
616
|
-
else if (left instanceof Error)
|
|
617
|
-
result = left.stack === right.stack;
|
|
618
|
-
else if (ArrayBuffer.isView(left))
|
|
619
|
-
result = compare_buffer(left, right);
|
|
620
|
-
else if (Symbol.toPrimitive in left)
|
|
621
|
-
result = compare_primitive(left, right);
|
|
622
|
-
else
|
|
623
|
-
result = false;
|
|
624
|
-
}
|
|
625
|
-
finally {
|
|
626
|
-
left_cache.set(right, result);
|
|
627
|
-
}
|
|
628
|
-
return result;
|
|
629
|
-
}
|
|
630
|
-
$.$mol_compare_deep = $mol_compare_deep;
|
|
631
|
-
function compare_array(left, right) {
|
|
632
|
-
const len = left.length;
|
|
633
|
-
if (len !== right.length)
|
|
634
|
-
return false;
|
|
635
|
-
for (let i = 0; i < len; ++i) {
|
|
636
|
-
if (!$mol_compare_deep(left[i], right[i]))
|
|
637
|
-
return false;
|
|
638
|
-
}
|
|
639
|
-
return true;
|
|
640
|
-
}
|
|
641
|
-
function compare_buffer(left, right) {
|
|
642
|
-
const len = left.byteLength;
|
|
643
|
-
if (len !== right.byteLength)
|
|
644
|
-
return false;
|
|
645
|
-
for (let i = 0; i < len; ++i) {
|
|
646
|
-
if (left[i] !== right[i])
|
|
647
|
-
return false;
|
|
648
|
-
}
|
|
649
|
-
return true;
|
|
650
|
-
}
|
|
651
|
-
function compare_iterator(left, right, compare) {
|
|
652
|
-
while (true) {
|
|
653
|
-
const left_next = left.next();
|
|
654
|
-
const right_next = right.next();
|
|
655
|
-
if (left_next.done !== right_next.done)
|
|
656
|
-
return false;
|
|
657
|
-
if (left_next.done)
|
|
658
|
-
break;
|
|
659
|
-
if (!compare(left_next.value, right_next.value))
|
|
660
|
-
return false;
|
|
661
|
-
}
|
|
662
|
-
return true;
|
|
663
|
-
}
|
|
664
|
-
function compare_set(left, right) {
|
|
665
|
-
if (left.size !== right.size)
|
|
666
|
-
return false;
|
|
667
|
-
return compare_iterator(left.values(), right.values(), $mol_compare_deep);
|
|
668
|
-
}
|
|
669
|
-
function compare_map(left, right) {
|
|
670
|
-
if (left.size !== right.size)
|
|
671
|
-
return false;
|
|
672
|
-
return compare_iterator(left.keys(), right.keys(), Object.is)
|
|
673
|
-
&& compare_iterator(left.values(), right.values(), $mol_compare_deep);
|
|
674
|
-
}
|
|
675
|
-
function compare_pojo(left, right) {
|
|
676
|
-
const left_keys = Object.getOwnPropertyNames(left);
|
|
677
|
-
const right_keys = Object.getOwnPropertyNames(right);
|
|
678
|
-
if (left_keys.length !== right_keys.length)
|
|
679
|
-
return false;
|
|
680
|
-
for (let key of left_keys) {
|
|
681
|
-
if (!$mol_compare_deep(left[key], Reflect.get(right, key)))
|
|
682
|
-
return false;
|
|
683
|
-
}
|
|
684
|
-
return true;
|
|
685
|
-
}
|
|
686
|
-
function compare_primitive(left, right) {
|
|
687
|
-
return Object.is(left[Symbol.toPrimitive]('default'), right[Symbol.toPrimitive]('default'));
|
|
688
|
-
}
|
|
689
|
-
})($ || ($ = {}));
|
|
690
|
-
//mol/compare/deep/deep.ts
|
|
691
|
-
;
|
|
692
|
-
"use strict";
|
|
693
|
-
var $;
|
|
694
569
|
(function ($) {
|
|
695
570
|
const handled = new WeakSet();
|
|
696
571
|
class $mol_wire_fiber extends $mol_wire_pub_sub {
|
|
@@ -842,38 +717,6 @@ var $;
|
|
|
842
717
|
this.track_off(bu);
|
|
843
718
|
this.put(result);
|
|
844
719
|
}
|
|
845
|
-
put(next) {
|
|
846
|
-
const prev = this.cache;
|
|
847
|
-
if (next !== prev) {
|
|
848
|
-
if ($mol_owning_check(this, prev)) {
|
|
849
|
-
prev.destructor();
|
|
850
|
-
}
|
|
851
|
-
this.cache = next;
|
|
852
|
-
if (this instanceof $mol_wire_fiber_persist && $mol_owning_catch(this, next)) {
|
|
853
|
-
try {
|
|
854
|
-
next[Symbol.toStringTag] = this[Symbol.toStringTag];
|
|
855
|
-
}
|
|
856
|
-
catch { }
|
|
857
|
-
}
|
|
858
|
-
if (this.sub_from < this.length) {
|
|
859
|
-
if (!$mol_compare_deep(prev, next)) {
|
|
860
|
-
this.emit();
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
}
|
|
864
|
-
this.cursor = $mol_wire_cursor.fresh;
|
|
865
|
-
if (next instanceof Promise)
|
|
866
|
-
return next;
|
|
867
|
-
if (this instanceof $mol_wire_fiber_persist) {
|
|
868
|
-
this.complete_pubs();
|
|
869
|
-
}
|
|
870
|
-
else {
|
|
871
|
-
this.cursor = $mol_wire_cursor.final;
|
|
872
|
-
if (this.sub_empty)
|
|
873
|
-
this.destructor();
|
|
874
|
-
}
|
|
875
|
-
return next;
|
|
876
|
-
}
|
|
877
720
|
sync() {
|
|
878
721
|
if (!$mol_wire_fiber.warm) {
|
|
879
722
|
return this.result();
|
|
@@ -910,40 +753,137 @@ var $;
|
|
|
910
753
|
"use strict";
|
|
911
754
|
var $;
|
|
912
755
|
(function ($) {
|
|
913
|
-
|
|
914
|
-
|
|
756
|
+
$.$mol_compare_deep_cache = new WeakMap();
|
|
757
|
+
function $mol_compare_deep(left, right) {
|
|
758
|
+
if (Object.is(left, right))
|
|
759
|
+
return true;
|
|
760
|
+
if (left === null)
|
|
761
|
+
return false;
|
|
762
|
+
if (right === null)
|
|
763
|
+
return false;
|
|
764
|
+
if (typeof left !== 'object')
|
|
765
|
+
return false;
|
|
766
|
+
if (typeof right !== 'object')
|
|
767
|
+
return false;
|
|
768
|
+
const left_proto = Reflect.getPrototypeOf(left);
|
|
769
|
+
const right_proto = Reflect.getPrototypeOf(right);
|
|
770
|
+
if (left_proto !== right_proto)
|
|
771
|
+
return false;
|
|
772
|
+
if (left instanceof Boolean)
|
|
773
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
774
|
+
if (left instanceof Number)
|
|
775
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
776
|
+
if (left instanceof String)
|
|
777
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
778
|
+
if (left instanceof Date)
|
|
779
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
780
|
+
if (left instanceof RegExp)
|
|
781
|
+
return left.source === right['source'] && left.flags === right['flags'];
|
|
782
|
+
let left_cache = $.$mol_compare_deep_cache.get(left);
|
|
783
|
+
if (left_cache) {
|
|
784
|
+
const right_cache = left_cache.get(right);
|
|
785
|
+
if (typeof right_cache === 'boolean')
|
|
786
|
+
return right_cache;
|
|
787
|
+
}
|
|
788
|
+
else {
|
|
789
|
+
left_cache = new WeakMap([[right, true]]);
|
|
790
|
+
$.$mol_compare_deep_cache.set(left, left_cache);
|
|
791
|
+
}
|
|
792
|
+
let result;
|
|
915
793
|
try {
|
|
916
|
-
|
|
917
|
-
|
|
794
|
+
if (left_proto && !Reflect.getPrototypeOf(left_proto))
|
|
795
|
+
result = compare_pojo(left, right);
|
|
796
|
+
else if (Array.isArray(left))
|
|
797
|
+
result = compare_array(left, right);
|
|
798
|
+
else if (left instanceof Set)
|
|
799
|
+
result = compare_set(left, right);
|
|
800
|
+
else if (left instanceof Map)
|
|
801
|
+
result = compare_map(left, right);
|
|
802
|
+
else if (left instanceof Error)
|
|
803
|
+
result = left.stack === right.stack;
|
|
804
|
+
else if (ArrayBuffer.isView(left))
|
|
805
|
+
result = compare_buffer(left, right);
|
|
806
|
+
else if (Symbol.toPrimitive in left)
|
|
807
|
+
result = compare_primitive(left, right);
|
|
808
|
+
else
|
|
809
|
+
result = false;
|
|
918
810
|
}
|
|
919
811
|
finally {
|
|
920
|
-
|
|
812
|
+
left_cache.set(right, result);
|
|
921
813
|
}
|
|
814
|
+
return result;
|
|
922
815
|
}
|
|
923
|
-
$.$
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
(
|
|
930
|
-
|
|
931
|
-
|
|
816
|
+
$.$mol_compare_deep = $mol_compare_deep;
|
|
817
|
+
function compare_array(left, right) {
|
|
818
|
+
const len = left.length;
|
|
819
|
+
if (len !== right.length)
|
|
820
|
+
return false;
|
|
821
|
+
for (let i = 0; i < len; ++i) {
|
|
822
|
+
if (!$mol_compare_deep(left[i], right[i]))
|
|
823
|
+
return false;
|
|
824
|
+
}
|
|
825
|
+
return true;
|
|
826
|
+
}
|
|
827
|
+
function compare_buffer(left, right) {
|
|
828
|
+
const len = left.byteLength;
|
|
829
|
+
if (len !== right.byteLength)
|
|
830
|
+
return false;
|
|
831
|
+
for (let i = 0; i < len; ++i) {
|
|
832
|
+
if (left[i] !== right[i])
|
|
833
|
+
return false;
|
|
834
|
+
}
|
|
835
|
+
return true;
|
|
836
|
+
}
|
|
837
|
+
function compare_iterator(left, right, compare) {
|
|
838
|
+
while (true) {
|
|
839
|
+
const left_next = left.next();
|
|
840
|
+
const right_next = right.next();
|
|
841
|
+
if (left_next.done !== right_next.done)
|
|
842
|
+
return false;
|
|
843
|
+
if (left_next.done)
|
|
844
|
+
break;
|
|
845
|
+
if (!compare(left_next.value, right_next.value))
|
|
846
|
+
return false;
|
|
847
|
+
}
|
|
848
|
+
return true;
|
|
849
|
+
}
|
|
850
|
+
function compare_set(left, right) {
|
|
851
|
+
if (left.size !== right.size)
|
|
852
|
+
return false;
|
|
853
|
+
return compare_iterator(left.values(), right.values(), $mol_compare_deep);
|
|
854
|
+
}
|
|
855
|
+
function compare_map(left, right) {
|
|
856
|
+
if (left.size !== right.size)
|
|
857
|
+
return false;
|
|
858
|
+
return compare_iterator(left.keys(), right.keys(), Object.is)
|
|
859
|
+
&& compare_iterator(left.values(), right.values(), $mol_compare_deep);
|
|
860
|
+
}
|
|
861
|
+
function compare_pojo(left, right) {
|
|
862
|
+
const left_keys = Object.getOwnPropertyNames(left);
|
|
863
|
+
const right_keys = Object.getOwnPropertyNames(right);
|
|
864
|
+
if (left_keys.length !== right_keys.length)
|
|
865
|
+
return false;
|
|
866
|
+
for (let key of left_keys) {
|
|
867
|
+
if (!$mol_compare_deep(left[key], Reflect.get(right, key)))
|
|
868
|
+
return false;
|
|
869
|
+
}
|
|
870
|
+
return true;
|
|
871
|
+
}
|
|
872
|
+
function compare_primitive(left, right) {
|
|
873
|
+
return Object.is(left[Symbol.toPrimitive]('default'), right[Symbol.toPrimitive]('default'));
|
|
932
874
|
}
|
|
933
|
-
$.$mol_wire_solid = $mol_wire_solid;
|
|
934
|
-
const nothing = () => { };
|
|
935
875
|
})($ || ($ = {}));
|
|
936
|
-
//mol/
|
|
876
|
+
//mol/compare/deep/deep.ts
|
|
937
877
|
;
|
|
938
878
|
"use strict";
|
|
939
879
|
var $;
|
|
940
880
|
(function ($) {
|
|
941
|
-
class $
|
|
881
|
+
class $mol_wire_task extends $mol_wire_fiber {
|
|
942
882
|
static getter(task) {
|
|
943
883
|
return function $mol_wire_fiber_temp_get(host, args) {
|
|
944
884
|
const existen = $mol_wire_auto()?.track_next();
|
|
945
885
|
reuse: if (existen) {
|
|
946
|
-
if (!(existen instanceof $
|
|
886
|
+
if (!(existen instanceof $mol_wire_task))
|
|
947
887
|
break reuse;
|
|
948
888
|
if (existen.host !== host)
|
|
949
889
|
break reuse;
|
|
@@ -953,61 +893,32 @@ var $;
|
|
|
953
893
|
break reuse;
|
|
954
894
|
return existen;
|
|
955
895
|
}
|
|
956
|
-
return new $
|
|
896
|
+
return new $mol_wire_task(`${host?.[Symbol.toStringTag] ?? host}.${task.name}(#)`, task, host, ...args);
|
|
957
897
|
};
|
|
958
898
|
}
|
|
959
899
|
complete() {
|
|
960
900
|
if (this.sub_empty)
|
|
961
901
|
this.destructor();
|
|
962
902
|
}
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
;
|
|
968
|
-
"use strict";
|
|
969
|
-
var $;
|
|
970
|
-
(function ($) {
|
|
971
|
-
function $mol_wire_sync(obj) {
|
|
972
|
-
return new Proxy(obj, {
|
|
973
|
-
get(obj, field) {
|
|
974
|
-
const val = obj[field];
|
|
975
|
-
if (typeof val !== 'function')
|
|
976
|
-
return val;
|
|
977
|
-
const temp = $mol_wire_fiber_temp.getter(val);
|
|
978
|
-
return function $mol_wire_sync(...args) {
|
|
979
|
-
const fiber = temp(obj, args);
|
|
980
|
-
return fiber.sync();
|
|
981
|
-
};
|
|
903
|
+
put(next) {
|
|
904
|
+
const prev = this.cache;
|
|
905
|
+
if (next !== prev) {
|
|
906
|
+
this.cache = next;
|
|
907
|
+
this.emit();
|
|
982
908
|
}
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
})($ || ($ = {}));
|
|
987
|
-
//mol/wire/sync/sync.ts
|
|
988
|
-
;
|
|
989
|
-
"use strict";
|
|
990
|
-
var $;
|
|
991
|
-
(function ($) {
|
|
992
|
-
function $mol_wire_async(obj) {
|
|
993
|
-
return new Proxy(obj, {
|
|
994
|
-
get(obj, field) {
|
|
995
|
-
const val = obj[field];
|
|
996
|
-
if (typeof val !== 'function')
|
|
997
|
-
return val;
|
|
998
|
-
let fiber;
|
|
999
|
-
const temp = $mol_wire_fiber_temp.getter(val);
|
|
1000
|
-
return function $mol_wire_async(...args) {
|
|
1001
|
-
fiber?.destructor();
|
|
1002
|
-
fiber = temp(obj, args);
|
|
1003
|
-
return fiber.async();
|
|
1004
|
-
};
|
|
909
|
+
if (next instanceof Promise) {
|
|
910
|
+
this.cursor = $mol_wire_cursor.fresh;
|
|
911
|
+
return next;
|
|
1005
912
|
}
|
|
1006
|
-
|
|
913
|
+
this.cursor = $mol_wire_cursor.final;
|
|
914
|
+
if (this.sub_empty)
|
|
915
|
+
this.destructor();
|
|
916
|
+
return next;
|
|
917
|
+
}
|
|
1007
918
|
}
|
|
1008
|
-
$.$
|
|
919
|
+
$.$mol_wire_task = $mol_wire_task;
|
|
1009
920
|
})($ || ($ = {}));
|
|
1010
|
-
//mol/wire/
|
|
921
|
+
//mol/wire/task/task.ts
|
|
1011
922
|
;
|
|
1012
923
|
"use strict";
|
|
1013
924
|
var $;
|
|
@@ -1072,7 +983,7 @@ var $;
|
|
|
1072
983
|
if (typeof sup[field] === 'function') {
|
|
1073
984
|
Object.defineProperty(orig, 'name', { value: sup[field].name });
|
|
1074
985
|
}
|
|
1075
|
-
const temp = $
|
|
986
|
+
const temp = $mol_wire_task.getter(orig);
|
|
1076
987
|
const value = function (...args) {
|
|
1077
988
|
const fiber = temp(this ?? null, args);
|
|
1078
989
|
return fiber.sync();
|
|
@@ -1090,7 +1001,7 @@ var $;
|
|
|
1090
1001
|
"use strict";
|
|
1091
1002
|
var $;
|
|
1092
1003
|
(function ($) {
|
|
1093
|
-
class $
|
|
1004
|
+
class $mol_wire_atom extends $mol_wire_fiber {
|
|
1094
1005
|
static getter(task, keys) {
|
|
1095
1006
|
const field = task.name + '()';
|
|
1096
1007
|
if (keys) {
|
|
@@ -1106,7 +1017,7 @@ var $;
|
|
|
1106
1017
|
else {
|
|
1107
1018
|
dict = (host ?? task)[field] = new Map();
|
|
1108
1019
|
}
|
|
1109
|
-
fiber = new $
|
|
1020
|
+
fiber = new $mol_wire_atom(key, task, host, ...args);
|
|
1110
1021
|
dict.set(key, fiber);
|
|
1111
1022
|
return fiber;
|
|
1112
1023
|
};
|
|
@@ -1117,7 +1028,7 @@ var $;
|
|
|
1117
1028
|
if (existen)
|
|
1118
1029
|
return existen;
|
|
1119
1030
|
const key = `${host?.[Symbol.toStringTag] ?? host}.${field}`;
|
|
1120
|
-
const fiber = new $
|
|
1031
|
+
const fiber = new $mol_wire_atom(key, task, host, ...args);
|
|
1121
1032
|
(host ?? task)[field] = fiber;
|
|
1122
1033
|
return fiber;
|
|
1123
1034
|
};
|
|
@@ -1153,16 +1064,113 @@ var $;
|
|
|
1153
1064
|
(this.host ?? this.task)[this.field()].delete(this[Symbol.toStringTag]);
|
|
1154
1065
|
}
|
|
1155
1066
|
}
|
|
1067
|
+
put(next) {
|
|
1068
|
+
const prev = this.cache;
|
|
1069
|
+
if (next !== prev) {
|
|
1070
|
+
if ($mol_owning_check(this, prev)) {
|
|
1071
|
+
prev.destructor();
|
|
1072
|
+
}
|
|
1073
|
+
this.cache = next;
|
|
1074
|
+
if ($mol_owning_catch(this, next)) {
|
|
1075
|
+
try {
|
|
1076
|
+
next[Symbol.toStringTag] = this[Symbol.toStringTag];
|
|
1077
|
+
}
|
|
1078
|
+
catch { }
|
|
1079
|
+
}
|
|
1080
|
+
if (this.sub_from < this.length) {
|
|
1081
|
+
if (!$mol_compare_deep(prev, next)) {
|
|
1082
|
+
this.emit();
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
this.cursor = $mol_wire_cursor.fresh;
|
|
1087
|
+
if (next instanceof Promise)
|
|
1088
|
+
return next;
|
|
1089
|
+
this.complete_pubs();
|
|
1090
|
+
return next;
|
|
1091
|
+
}
|
|
1156
1092
|
}
|
|
1157
1093
|
__decorate([
|
|
1158
1094
|
$mol_wire_method
|
|
1159
|
-
], $
|
|
1095
|
+
], $mol_wire_atom.prototype, "recall", null);
|
|
1160
1096
|
__decorate([
|
|
1161
1097
|
$mol_wire_method
|
|
1162
|
-
], $
|
|
1163
|
-
$.$
|
|
1098
|
+
], $mol_wire_atom.prototype, "once", null);
|
|
1099
|
+
$.$mol_wire_atom = $mol_wire_atom;
|
|
1100
|
+
})($ || ($ = {}));
|
|
1101
|
+
//mol/wire/atom/atom.ts
|
|
1102
|
+
;
|
|
1103
|
+
"use strict";
|
|
1104
|
+
var $;
|
|
1105
|
+
(function ($) {
|
|
1106
|
+
function $mol_wire_probe(task, next) {
|
|
1107
|
+
const warm = $mol_wire_fiber.warm;
|
|
1108
|
+
try {
|
|
1109
|
+
$mol_wire_fiber.warm = false;
|
|
1110
|
+
return task();
|
|
1111
|
+
}
|
|
1112
|
+
finally {
|
|
1113
|
+
$mol_wire_fiber.warm = warm;
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
$.$mol_wire_probe = $mol_wire_probe;
|
|
1117
|
+
})($ || ($ = {}));
|
|
1118
|
+
//mol/wire/probe/probe.ts
|
|
1119
|
+
;
|
|
1120
|
+
"use strict";
|
|
1121
|
+
var $;
|
|
1122
|
+
(function ($) {
|
|
1123
|
+
function $mol_wire_solid() {
|
|
1124
|
+
$mol_wire_auto().reap = nothing;
|
|
1125
|
+
}
|
|
1126
|
+
$.$mol_wire_solid = $mol_wire_solid;
|
|
1127
|
+
const nothing = () => { };
|
|
1164
1128
|
})($ || ($ = {}));
|
|
1165
|
-
//mol/wire/
|
|
1129
|
+
//mol/wire/solid/solid.ts
|
|
1130
|
+
;
|
|
1131
|
+
"use strict";
|
|
1132
|
+
var $;
|
|
1133
|
+
(function ($) {
|
|
1134
|
+
function $mol_wire_sync(obj) {
|
|
1135
|
+
return new Proxy(obj, {
|
|
1136
|
+
get(obj, field) {
|
|
1137
|
+
const val = obj[field];
|
|
1138
|
+
if (typeof val !== 'function')
|
|
1139
|
+
return val;
|
|
1140
|
+
const temp = $mol_wire_task.getter(val);
|
|
1141
|
+
return function $mol_wire_sync(...args) {
|
|
1142
|
+
const fiber = temp(obj, args);
|
|
1143
|
+
return fiber.sync();
|
|
1144
|
+
};
|
|
1145
|
+
}
|
|
1146
|
+
});
|
|
1147
|
+
}
|
|
1148
|
+
$.$mol_wire_sync = $mol_wire_sync;
|
|
1149
|
+
})($ || ($ = {}));
|
|
1150
|
+
//mol/wire/sync/sync.ts
|
|
1151
|
+
;
|
|
1152
|
+
"use strict";
|
|
1153
|
+
var $;
|
|
1154
|
+
(function ($) {
|
|
1155
|
+
function $mol_wire_async(obj) {
|
|
1156
|
+
return new Proxy(obj, {
|
|
1157
|
+
get(obj, field) {
|
|
1158
|
+
const val = obj[field];
|
|
1159
|
+
if (typeof val !== 'function')
|
|
1160
|
+
return val;
|
|
1161
|
+
let fiber;
|
|
1162
|
+
const temp = $mol_wire_task.getter(val);
|
|
1163
|
+
return function $mol_wire_async(...args) {
|
|
1164
|
+
fiber?.destructor();
|
|
1165
|
+
fiber = temp(obj, args);
|
|
1166
|
+
return fiber.async();
|
|
1167
|
+
};
|
|
1168
|
+
}
|
|
1169
|
+
});
|
|
1170
|
+
}
|
|
1171
|
+
$.$mol_wire_async = $mol_wire_async;
|
|
1172
|
+
})($ || ($ = {}));
|
|
1173
|
+
//mol/wire/async/async.ts
|
|
1166
1174
|
;
|
|
1167
1175
|
"use strict";
|
|
1168
1176
|
var $;
|
|
@@ -1188,11 +1196,11 @@ var $;
|
|
|
1188
1196
|
$.$mol_wire_mem = $mol_wire_mem;
|
|
1189
1197
|
function $mol_wire_mem_func(keys) {
|
|
1190
1198
|
return (func) => {
|
|
1191
|
-
const persist = $
|
|
1199
|
+
const persist = $mol_wire_atom.getter(func, keys);
|
|
1192
1200
|
const wrapper = function (...args) {
|
|
1193
1201
|
let atom = persist(this, args.slice(0, keys));
|
|
1194
1202
|
if (args.length <= keys || args[keys] === undefined) {
|
|
1195
|
-
if ($mol_wire_auto() instanceof $
|
|
1203
|
+
if ($mol_wire_auto() instanceof $mol_wire_task) {
|
|
1196
1204
|
return atom.once();
|
|
1197
1205
|
}
|
|
1198
1206
|
else {
|
|
@@ -1230,7 +1238,7 @@ var $;
|
|
|
1230
1238
|
if (!descr)
|
|
1231
1239
|
descr = Reflect.getOwnPropertyDescriptor(host, field);
|
|
1232
1240
|
const _get = descr?.get || $mol_const(descr?.value);
|
|
1233
|
-
const persist = $
|
|
1241
|
+
const persist = $mol_wire_atom.getter(_get, 0);
|
|
1234
1242
|
const _set = descr?.set || function (next) {
|
|
1235
1243
|
persist(this, []).put(next);
|
|
1236
1244
|
};
|
|
@@ -1241,7 +1249,7 @@ var $;
|
|
|
1241
1249
|
function get() {
|
|
1242
1250
|
return persist(this, []).sync();
|
|
1243
1251
|
}
|
|
1244
|
-
const temp = $
|
|
1252
|
+
const temp = $mol_wire_task.getter(_set);
|
|
1245
1253
|
function set(next) {
|
|
1246
1254
|
temp(this, [next]).sync();
|
|
1247
1255
|
}
|