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