mol_wire_lib 1.0.100 → 1.0.103
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 +8 -6
- package/node.deps.json +1 -1
- package/node.esm.js +165 -157
- package/node.esm.js.map +1 -1
- package/node.js +165 -157
- package/node.js.map +1 -1
- package/node.test.js +165 -157
- package/node.test.js.map +1 -1
- package/package.json +8 -8
- package/web.d.ts +8 -6
- package/web.deps.json +1 -1
- package/web.esm.js +165 -157
- package/web.esm.js.map +1 -1
- package/web.js +165 -157
- package/web.js.map +1 -1
package/node.test.js
CHANGED
|
@@ -554,131 +554,6 @@ var $;
|
|
|
554
554
|
;
|
|
555
555
|
"use strict";
|
|
556
556
|
var $;
|
|
557
|
-
(function ($) {
|
|
558
|
-
$.$mol_compare_deep_cache = new WeakMap();
|
|
559
|
-
function $mol_compare_deep(left, right) {
|
|
560
|
-
if (Object.is(left, right))
|
|
561
|
-
return true;
|
|
562
|
-
if (left === null)
|
|
563
|
-
return false;
|
|
564
|
-
if (right === null)
|
|
565
|
-
return false;
|
|
566
|
-
if (typeof left !== 'object')
|
|
567
|
-
return false;
|
|
568
|
-
if (typeof right !== 'object')
|
|
569
|
-
return false;
|
|
570
|
-
const left_proto = Reflect.getPrototypeOf(left);
|
|
571
|
-
const right_proto = Reflect.getPrototypeOf(right);
|
|
572
|
-
if (left_proto !== right_proto)
|
|
573
|
-
return false;
|
|
574
|
-
if (left instanceof Boolean)
|
|
575
|
-
return Object.is(left.valueOf(), right['valueOf']());
|
|
576
|
-
if (left instanceof Number)
|
|
577
|
-
return Object.is(left.valueOf(), right['valueOf']());
|
|
578
|
-
if (left instanceof String)
|
|
579
|
-
return Object.is(left.valueOf(), right['valueOf']());
|
|
580
|
-
if (left instanceof Date)
|
|
581
|
-
return Object.is(left.valueOf(), right['valueOf']());
|
|
582
|
-
if (left instanceof RegExp)
|
|
583
|
-
return left.source === right['source'] && left.flags === right['flags'];
|
|
584
|
-
let left_cache = $.$mol_compare_deep_cache.get(left);
|
|
585
|
-
if (left_cache) {
|
|
586
|
-
const right_cache = left_cache.get(right);
|
|
587
|
-
if (typeof right_cache === 'boolean')
|
|
588
|
-
return right_cache;
|
|
589
|
-
}
|
|
590
|
-
else {
|
|
591
|
-
left_cache = new WeakMap([[right, true]]);
|
|
592
|
-
$.$mol_compare_deep_cache.set(left, left_cache);
|
|
593
|
-
}
|
|
594
|
-
let result;
|
|
595
|
-
try {
|
|
596
|
-
if (left_proto && !Reflect.getPrototypeOf(left_proto))
|
|
597
|
-
result = compare_pojo(left, right);
|
|
598
|
-
else if (Array.isArray(left))
|
|
599
|
-
result = compare_array(left, right);
|
|
600
|
-
else if (left instanceof Set)
|
|
601
|
-
result = compare_set(left, right);
|
|
602
|
-
else if (left instanceof Map)
|
|
603
|
-
result = compare_map(left, right);
|
|
604
|
-
else if (left instanceof Error)
|
|
605
|
-
result = left.stack === right.stack;
|
|
606
|
-
else if (ArrayBuffer.isView(left))
|
|
607
|
-
result = compare_buffer(left, right);
|
|
608
|
-
else if (Symbol.toPrimitive in left)
|
|
609
|
-
result = compare_primitive(left, right);
|
|
610
|
-
else
|
|
611
|
-
result = false;
|
|
612
|
-
}
|
|
613
|
-
finally {
|
|
614
|
-
left_cache.set(right, result);
|
|
615
|
-
}
|
|
616
|
-
return result;
|
|
617
|
-
}
|
|
618
|
-
$.$mol_compare_deep = $mol_compare_deep;
|
|
619
|
-
function compare_array(left, right) {
|
|
620
|
-
const len = left.length;
|
|
621
|
-
if (len !== right.length)
|
|
622
|
-
return false;
|
|
623
|
-
for (let i = 0; i < len; ++i) {
|
|
624
|
-
if (!$mol_compare_deep(left[i], right[i]))
|
|
625
|
-
return false;
|
|
626
|
-
}
|
|
627
|
-
return true;
|
|
628
|
-
}
|
|
629
|
-
function compare_buffer(left, right) {
|
|
630
|
-
const len = left.byteLength;
|
|
631
|
-
if (len !== right.byteLength)
|
|
632
|
-
return false;
|
|
633
|
-
for (let i = 0; i < len; ++i) {
|
|
634
|
-
if (left[i] !== right[i])
|
|
635
|
-
return false;
|
|
636
|
-
}
|
|
637
|
-
return true;
|
|
638
|
-
}
|
|
639
|
-
function compare_iterator(left, right, compare) {
|
|
640
|
-
while (true) {
|
|
641
|
-
const left_next = left.next();
|
|
642
|
-
const right_next = right.next();
|
|
643
|
-
if (left_next.done !== right_next.done)
|
|
644
|
-
return false;
|
|
645
|
-
if (left_next.done)
|
|
646
|
-
break;
|
|
647
|
-
if (!compare(left_next.value, right_next.value))
|
|
648
|
-
return false;
|
|
649
|
-
}
|
|
650
|
-
return true;
|
|
651
|
-
}
|
|
652
|
-
function compare_set(left, right) {
|
|
653
|
-
if (left.size !== right.size)
|
|
654
|
-
return false;
|
|
655
|
-
return compare_iterator(left.values(), right.values(), $mol_compare_deep);
|
|
656
|
-
}
|
|
657
|
-
function compare_map(left, right) {
|
|
658
|
-
if (left.size !== right.size)
|
|
659
|
-
return false;
|
|
660
|
-
return compare_iterator(left.keys(), right.keys(), Object.is)
|
|
661
|
-
&& compare_iterator(left.values(), right.values(), $mol_compare_deep);
|
|
662
|
-
}
|
|
663
|
-
function compare_pojo(left, right) {
|
|
664
|
-
const left_keys = Object.getOwnPropertyNames(left);
|
|
665
|
-
const right_keys = Object.getOwnPropertyNames(right);
|
|
666
|
-
if (left_keys.length !== right_keys.length)
|
|
667
|
-
return false;
|
|
668
|
-
for (let key of left_keys) {
|
|
669
|
-
if (!$mol_compare_deep(left[key], Reflect.get(right, key)))
|
|
670
|
-
return false;
|
|
671
|
-
}
|
|
672
|
-
return true;
|
|
673
|
-
}
|
|
674
|
-
function compare_primitive(left, right) {
|
|
675
|
-
return Object.is(left[Symbol.toPrimitive]('default'), right[Symbol.toPrimitive]('default'));
|
|
676
|
-
}
|
|
677
|
-
})($ || ($ = {}));
|
|
678
|
-
//mol/compare/deep/deep.ts
|
|
679
|
-
;
|
|
680
|
-
"use strict";
|
|
681
|
-
var $;
|
|
682
557
|
(function ($) {
|
|
683
558
|
const handled = new WeakSet();
|
|
684
559
|
class $mol_wire_fiber extends $mol_wire_pub_sub {
|
|
@@ -830,38 +705,6 @@ var $;
|
|
|
830
705
|
this.track_off(bu);
|
|
831
706
|
this.put(result);
|
|
832
707
|
}
|
|
833
|
-
put(next) {
|
|
834
|
-
const prev = this.cache;
|
|
835
|
-
if (next !== prev) {
|
|
836
|
-
if ($mol_owning_check(this, prev)) {
|
|
837
|
-
prev.destructor();
|
|
838
|
-
}
|
|
839
|
-
this.cache = next;
|
|
840
|
-
if (this instanceof $mol_wire_fiber_persist && $mol_owning_catch(this, next)) {
|
|
841
|
-
try {
|
|
842
|
-
next[Symbol.toStringTag] = this[Symbol.toStringTag];
|
|
843
|
-
}
|
|
844
|
-
catch { }
|
|
845
|
-
}
|
|
846
|
-
if (this.sub_from < this.length) {
|
|
847
|
-
if (!$mol_compare_deep(prev, next)) {
|
|
848
|
-
this.emit();
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
this.cursor = $mol_wire_cursor.fresh;
|
|
853
|
-
if (next instanceof Promise)
|
|
854
|
-
return next;
|
|
855
|
-
if (this instanceof $mol_wire_fiber_persist) {
|
|
856
|
-
this.complete_pubs();
|
|
857
|
-
}
|
|
858
|
-
else {
|
|
859
|
-
this.cursor = $mol_wire_cursor.final;
|
|
860
|
-
if (this.sub_empty)
|
|
861
|
-
this.destructor();
|
|
862
|
-
}
|
|
863
|
-
return next;
|
|
864
|
-
}
|
|
865
708
|
sync() {
|
|
866
709
|
if (!$mol_wire_fiber.warm) {
|
|
867
710
|
return this.result();
|
|
@@ -925,6 +768,131 @@ var $;
|
|
|
925
768
|
;
|
|
926
769
|
"use strict";
|
|
927
770
|
var $;
|
|
771
|
+
(function ($) {
|
|
772
|
+
$.$mol_compare_deep_cache = new WeakMap();
|
|
773
|
+
function $mol_compare_deep(left, right) {
|
|
774
|
+
if (Object.is(left, right))
|
|
775
|
+
return true;
|
|
776
|
+
if (left === null)
|
|
777
|
+
return false;
|
|
778
|
+
if (right === null)
|
|
779
|
+
return false;
|
|
780
|
+
if (typeof left !== 'object')
|
|
781
|
+
return false;
|
|
782
|
+
if (typeof right !== 'object')
|
|
783
|
+
return false;
|
|
784
|
+
const left_proto = Reflect.getPrototypeOf(left);
|
|
785
|
+
const right_proto = Reflect.getPrototypeOf(right);
|
|
786
|
+
if (left_proto !== right_proto)
|
|
787
|
+
return false;
|
|
788
|
+
if (left instanceof Boolean)
|
|
789
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
790
|
+
if (left instanceof Number)
|
|
791
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
792
|
+
if (left instanceof String)
|
|
793
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
794
|
+
if (left instanceof Date)
|
|
795
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
796
|
+
if (left instanceof RegExp)
|
|
797
|
+
return left.source === right['source'] && left.flags === right['flags'];
|
|
798
|
+
let left_cache = $.$mol_compare_deep_cache.get(left);
|
|
799
|
+
if (left_cache) {
|
|
800
|
+
const right_cache = left_cache.get(right);
|
|
801
|
+
if (typeof right_cache === 'boolean')
|
|
802
|
+
return right_cache;
|
|
803
|
+
}
|
|
804
|
+
else {
|
|
805
|
+
left_cache = new WeakMap([[right, true]]);
|
|
806
|
+
$.$mol_compare_deep_cache.set(left, left_cache);
|
|
807
|
+
}
|
|
808
|
+
let result;
|
|
809
|
+
try {
|
|
810
|
+
if (left_proto && !Reflect.getPrototypeOf(left_proto))
|
|
811
|
+
result = compare_pojo(left, right);
|
|
812
|
+
else if (Array.isArray(left))
|
|
813
|
+
result = compare_array(left, right);
|
|
814
|
+
else if (left instanceof Set)
|
|
815
|
+
result = compare_set(left, right);
|
|
816
|
+
else if (left instanceof Map)
|
|
817
|
+
result = compare_map(left, right);
|
|
818
|
+
else if (left instanceof Error)
|
|
819
|
+
result = left.stack === right.stack;
|
|
820
|
+
else if (ArrayBuffer.isView(left))
|
|
821
|
+
result = compare_buffer(left, right);
|
|
822
|
+
else if (Symbol.toPrimitive in left)
|
|
823
|
+
result = compare_primitive(left, right);
|
|
824
|
+
else
|
|
825
|
+
result = false;
|
|
826
|
+
}
|
|
827
|
+
finally {
|
|
828
|
+
left_cache.set(right, result);
|
|
829
|
+
}
|
|
830
|
+
return result;
|
|
831
|
+
}
|
|
832
|
+
$.$mol_compare_deep = $mol_compare_deep;
|
|
833
|
+
function compare_array(left, right) {
|
|
834
|
+
const len = left.length;
|
|
835
|
+
if (len !== right.length)
|
|
836
|
+
return false;
|
|
837
|
+
for (let i = 0; i < len; ++i) {
|
|
838
|
+
if (!$mol_compare_deep(left[i], right[i]))
|
|
839
|
+
return false;
|
|
840
|
+
}
|
|
841
|
+
return true;
|
|
842
|
+
}
|
|
843
|
+
function compare_buffer(left, right) {
|
|
844
|
+
const len = left.byteLength;
|
|
845
|
+
if (len !== right.byteLength)
|
|
846
|
+
return false;
|
|
847
|
+
for (let i = 0; i < len; ++i) {
|
|
848
|
+
if (left[i] !== right[i])
|
|
849
|
+
return false;
|
|
850
|
+
}
|
|
851
|
+
return true;
|
|
852
|
+
}
|
|
853
|
+
function compare_iterator(left, right, compare) {
|
|
854
|
+
while (true) {
|
|
855
|
+
const left_next = left.next();
|
|
856
|
+
const right_next = right.next();
|
|
857
|
+
if (left_next.done !== right_next.done)
|
|
858
|
+
return false;
|
|
859
|
+
if (left_next.done)
|
|
860
|
+
break;
|
|
861
|
+
if (!compare(left_next.value, right_next.value))
|
|
862
|
+
return false;
|
|
863
|
+
}
|
|
864
|
+
return true;
|
|
865
|
+
}
|
|
866
|
+
function compare_set(left, right) {
|
|
867
|
+
if (left.size !== right.size)
|
|
868
|
+
return false;
|
|
869
|
+
return compare_iterator(left.values(), right.values(), $mol_compare_deep);
|
|
870
|
+
}
|
|
871
|
+
function compare_map(left, right) {
|
|
872
|
+
if (left.size !== right.size)
|
|
873
|
+
return false;
|
|
874
|
+
return compare_iterator(left.keys(), right.keys(), Object.is)
|
|
875
|
+
&& compare_iterator(left.values(), right.values(), $mol_compare_deep);
|
|
876
|
+
}
|
|
877
|
+
function compare_pojo(left, right) {
|
|
878
|
+
const left_keys = Object.getOwnPropertyNames(left);
|
|
879
|
+
const right_keys = Object.getOwnPropertyNames(right);
|
|
880
|
+
if (left_keys.length !== right_keys.length)
|
|
881
|
+
return false;
|
|
882
|
+
for (let key of left_keys) {
|
|
883
|
+
if (!$mol_compare_deep(left[key], Reflect.get(right, key)))
|
|
884
|
+
return false;
|
|
885
|
+
}
|
|
886
|
+
return true;
|
|
887
|
+
}
|
|
888
|
+
function compare_primitive(left, right) {
|
|
889
|
+
return Object.is(left[Symbol.toPrimitive]('default'), right[Symbol.toPrimitive]('default'));
|
|
890
|
+
}
|
|
891
|
+
})($ || ($ = {}));
|
|
892
|
+
//mol/compare/deep/deep.ts
|
|
893
|
+
;
|
|
894
|
+
"use strict";
|
|
895
|
+
var $;
|
|
928
896
|
(function ($) {
|
|
929
897
|
class $mol_wire_fiber_temp extends $mol_wire_fiber {
|
|
930
898
|
static getter(task) {
|
|
@@ -948,6 +916,21 @@ var $;
|
|
|
948
916
|
if (this.sub_empty)
|
|
949
917
|
this.destructor();
|
|
950
918
|
}
|
|
919
|
+
put(next) {
|
|
920
|
+
const prev = this.cache;
|
|
921
|
+
if (next !== prev) {
|
|
922
|
+
this.cache = next;
|
|
923
|
+
this.emit();
|
|
924
|
+
}
|
|
925
|
+
if (next instanceof Promise) {
|
|
926
|
+
this.cursor = $mol_wire_cursor.fresh;
|
|
927
|
+
return next;
|
|
928
|
+
}
|
|
929
|
+
this.cursor = $mol_wire_cursor.final;
|
|
930
|
+
if (this.sub_empty)
|
|
931
|
+
this.destructor();
|
|
932
|
+
return next;
|
|
933
|
+
}
|
|
951
934
|
}
|
|
952
935
|
$.$mol_wire_fiber_temp = $mol_wire_fiber_temp;
|
|
953
936
|
})($ || ($ = {}));
|
|
@@ -1141,6 +1124,31 @@ var $;
|
|
|
1141
1124
|
(this.host ?? this.task)[this.field()].delete(this[Symbol.toStringTag]);
|
|
1142
1125
|
}
|
|
1143
1126
|
}
|
|
1127
|
+
put(next) {
|
|
1128
|
+
const prev = this.cache;
|
|
1129
|
+
if (next !== prev) {
|
|
1130
|
+
if ($mol_owning_check(this, prev)) {
|
|
1131
|
+
prev.destructor();
|
|
1132
|
+
}
|
|
1133
|
+
this.cache = next;
|
|
1134
|
+
if ($mol_owning_catch(this, next)) {
|
|
1135
|
+
try {
|
|
1136
|
+
next[Symbol.toStringTag] = this[Symbol.toStringTag];
|
|
1137
|
+
}
|
|
1138
|
+
catch { }
|
|
1139
|
+
}
|
|
1140
|
+
if (this.sub_from < this.length) {
|
|
1141
|
+
if (!$mol_compare_deep(prev, next)) {
|
|
1142
|
+
this.emit();
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
this.cursor = $mol_wire_cursor.fresh;
|
|
1147
|
+
if (next instanceof Promise)
|
|
1148
|
+
return next;
|
|
1149
|
+
this.complete_pubs();
|
|
1150
|
+
return next;
|
|
1151
|
+
}
|
|
1144
1152
|
}
|
|
1145
1153
|
__decorate([
|
|
1146
1154
|
$mol_wire_method
|