mol_wire_lib 1.0.28 → 1.0.29
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 +1 -0
- package/node.deps.json +1 -1
- package/node.esm.js +5 -1
- package/node.esm.js.map +1 -1
- package/node.js +5 -1
- package/node.js.map +1 -1
- package/node.test.js +177 -102
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.d.ts +1 -0
- package/web.deps.json +1 -1
- package/web.esm.js +5 -1
- package/web.esm.js.map +1 -1
- package/web.js +5 -1
- package/web.js.map +1 -1
- package/web.test.js +172 -101
- package/web.test.js.map +1 -1
package/node.test.js
CHANGED
|
@@ -250,7 +250,8 @@ var $;
|
|
|
250
250
|
cursor = $mol_wire_cursor.stale;
|
|
251
251
|
get pub_list() {
|
|
252
252
|
const res = [];
|
|
253
|
-
|
|
253
|
+
const max = this.cursor >= 0 ? this.cursor : this.sub_from;
|
|
254
|
+
for (let i = this.pub_from; i < max; i += 2) {
|
|
254
255
|
res.push(this[i]);
|
|
255
256
|
}
|
|
256
257
|
return res;
|
|
@@ -905,6 +906,9 @@ var $;
|
|
|
905
906
|
toString() {
|
|
906
907
|
return this[Symbol.toStringTag];
|
|
907
908
|
}
|
|
909
|
+
toJSON() {
|
|
910
|
+
return this[Symbol.toStringTag];
|
|
911
|
+
}
|
|
908
912
|
[$mol_dev_format_head]() {
|
|
909
913
|
return $mol_dev_format_div({}, $mol_dev_format_native(this), $mol_dev_format_shade(this.cursor.toString() + ' '), $mol_dev_format_auto(this.cache));
|
|
910
914
|
}
|
|
@@ -1846,64 +1850,6 @@ var $;
|
|
|
1846
1850
|
;
|
|
1847
1851
|
"use strict";
|
|
1848
1852
|
var $;
|
|
1849
|
-
(function ($_1) {
|
|
1850
|
-
$mol_test({
|
|
1851
|
-
'Collect deps'() {
|
|
1852
|
-
const pub1 = new $mol_wire_pub;
|
|
1853
|
-
const pub2 = new $mol_wire_pub;
|
|
1854
|
-
const sub = new $mol_wire_pub_sub;
|
|
1855
|
-
const bu1 = sub.track_on();
|
|
1856
|
-
try {
|
|
1857
|
-
pub1.track_promote();
|
|
1858
|
-
pub2.track_promote();
|
|
1859
|
-
pub2.track_promote();
|
|
1860
|
-
}
|
|
1861
|
-
finally {
|
|
1862
|
-
sub.track_cut();
|
|
1863
|
-
sub.track_off(bu1);
|
|
1864
|
-
}
|
|
1865
|
-
pub1.emit();
|
|
1866
|
-
pub2.emit();
|
|
1867
|
-
$mol_assert_like(sub.pub_list, [pub1, pub2, pub2]);
|
|
1868
|
-
const bu2 = sub.track_on();
|
|
1869
|
-
try {
|
|
1870
|
-
pub1.track_promote();
|
|
1871
|
-
pub1.track_promote();
|
|
1872
|
-
pub2.track_promote();
|
|
1873
|
-
}
|
|
1874
|
-
finally {
|
|
1875
|
-
sub.track_cut();
|
|
1876
|
-
sub.track_off(bu2);
|
|
1877
|
-
}
|
|
1878
|
-
pub1.emit();
|
|
1879
|
-
pub2.emit();
|
|
1880
|
-
$mol_assert_like(sub.pub_list, [pub1, pub1, pub2]);
|
|
1881
|
-
},
|
|
1882
|
-
'cyclic detection'($) {
|
|
1883
|
-
const sub1 = new $mol_wire_pub_sub;
|
|
1884
|
-
const sub2 = new $mol_wire_pub_sub;
|
|
1885
|
-
const bu1 = sub1.track_on();
|
|
1886
|
-
try {
|
|
1887
|
-
const bu2 = sub2.track_on();
|
|
1888
|
-
try {
|
|
1889
|
-
$mol_assert_fail(() => sub1.track_promote(), 'Circular subscription');
|
|
1890
|
-
}
|
|
1891
|
-
finally {
|
|
1892
|
-
sub2.track_cut();
|
|
1893
|
-
sub2.track_off(bu2);
|
|
1894
|
-
}
|
|
1895
|
-
}
|
|
1896
|
-
finally {
|
|
1897
|
-
sub1.track_cut();
|
|
1898
|
-
sub1.track_off(bu1);
|
|
1899
|
-
}
|
|
1900
|
-
},
|
|
1901
|
-
});
|
|
1902
|
-
})($ || ($ = {}));
|
|
1903
|
-
//mol/wire/pub/sub/sub.test.ts
|
|
1904
|
-
;
|
|
1905
|
-
"use strict";
|
|
1906
|
-
var $;
|
|
1907
1853
|
(function ($) {
|
|
1908
1854
|
$mol_test({
|
|
1909
1855
|
'get'() {
|
|
@@ -2081,6 +2027,64 @@ var $;
|
|
|
2081
2027
|
;
|
|
2082
2028
|
"use strict";
|
|
2083
2029
|
var $;
|
|
2030
|
+
(function ($_1) {
|
|
2031
|
+
$mol_test({
|
|
2032
|
+
'Collect deps'() {
|
|
2033
|
+
const pub1 = new $mol_wire_pub;
|
|
2034
|
+
const pub2 = new $mol_wire_pub;
|
|
2035
|
+
const sub = new $mol_wire_pub_sub;
|
|
2036
|
+
const bu1 = sub.track_on();
|
|
2037
|
+
try {
|
|
2038
|
+
pub1.track_promote();
|
|
2039
|
+
pub2.track_promote();
|
|
2040
|
+
pub2.track_promote();
|
|
2041
|
+
}
|
|
2042
|
+
finally {
|
|
2043
|
+
sub.track_cut();
|
|
2044
|
+
sub.track_off(bu1);
|
|
2045
|
+
}
|
|
2046
|
+
pub1.emit();
|
|
2047
|
+
pub2.emit();
|
|
2048
|
+
$mol_assert_like(sub.pub_list, [pub1, pub2, pub2]);
|
|
2049
|
+
const bu2 = sub.track_on();
|
|
2050
|
+
try {
|
|
2051
|
+
pub1.track_promote();
|
|
2052
|
+
pub1.track_promote();
|
|
2053
|
+
pub2.track_promote();
|
|
2054
|
+
}
|
|
2055
|
+
finally {
|
|
2056
|
+
sub.track_cut();
|
|
2057
|
+
sub.track_off(bu2);
|
|
2058
|
+
}
|
|
2059
|
+
pub1.emit();
|
|
2060
|
+
pub2.emit();
|
|
2061
|
+
$mol_assert_like(sub.pub_list, [pub1, pub1, pub2]);
|
|
2062
|
+
},
|
|
2063
|
+
'cyclic detection'($) {
|
|
2064
|
+
const sub1 = new $mol_wire_pub_sub;
|
|
2065
|
+
const sub2 = new $mol_wire_pub_sub;
|
|
2066
|
+
const bu1 = sub1.track_on();
|
|
2067
|
+
try {
|
|
2068
|
+
const bu2 = sub2.track_on();
|
|
2069
|
+
try {
|
|
2070
|
+
$mol_assert_fail(() => sub1.track_promote(), 'Circular subscription');
|
|
2071
|
+
}
|
|
2072
|
+
finally {
|
|
2073
|
+
sub2.track_cut();
|
|
2074
|
+
sub2.track_off(bu2);
|
|
2075
|
+
}
|
|
2076
|
+
}
|
|
2077
|
+
finally {
|
|
2078
|
+
sub1.track_cut();
|
|
2079
|
+
sub1.track_off(bu1);
|
|
2080
|
+
}
|
|
2081
|
+
},
|
|
2082
|
+
});
|
|
2083
|
+
})($ || ($ = {}));
|
|
2084
|
+
//mol/wire/pub/sub/sub.test.ts
|
|
2085
|
+
;
|
|
2086
|
+
"use strict";
|
|
2087
|
+
var $;
|
|
2084
2088
|
(function ($) {
|
|
2085
2089
|
$mol_test({
|
|
2086
2090
|
'Primitives'() {
|
|
@@ -2828,50 +2832,12 @@ var $;
|
|
|
2828
2832
|
"use strict";
|
|
2829
2833
|
var $;
|
|
2830
2834
|
(function ($) {
|
|
2831
|
-
$
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
$mol_assert_equal(foo.bar(), foo.bar['()']);
|
|
2836
|
-
},
|
|
2837
|
-
});
|
|
2835
|
+
$.$mol_mem = $mol_wire_mem(0);
|
|
2836
|
+
$.$mol_mem_key = $mol_wire_mem(1);
|
|
2837
|
+
$.$mol_mem_key2 = $mol_wire_mem(2);
|
|
2838
|
+
$.$mol_mem_key3 = $mol_wire_mem(3);
|
|
2838
2839
|
})($ || ($ = {}));
|
|
2839
|
-
//mol/
|
|
2840
|
-
;
|
|
2841
|
-
"use strict";
|
|
2842
|
-
var $;
|
|
2843
|
-
(function ($_1) {
|
|
2844
|
-
$mol_test({
|
|
2845
|
-
'Cached field'($) {
|
|
2846
|
-
class App extends $mol_object2 {
|
|
2847
|
-
static $ = $;
|
|
2848
|
-
static low = 1;
|
|
2849
|
-
static get high() {
|
|
2850
|
-
return this.low + 1;
|
|
2851
|
-
}
|
|
2852
|
-
static set high(next) {
|
|
2853
|
-
this.low = next - 1;
|
|
2854
|
-
}
|
|
2855
|
-
static test() {
|
|
2856
|
-
$mol_assert_equal(App.high, 2);
|
|
2857
|
-
App.high = 3;
|
|
2858
|
-
$mol_assert_equal(App.high, 3);
|
|
2859
|
-
}
|
|
2860
|
-
}
|
|
2861
|
-
__decorate([
|
|
2862
|
-
$mol_wire_field
|
|
2863
|
-
], App, "low", void 0);
|
|
2864
|
-
__decorate([
|
|
2865
|
-
$mol_wire_field
|
|
2866
|
-
], App, "high", null);
|
|
2867
|
-
__decorate([
|
|
2868
|
-
$mol_wire_method
|
|
2869
|
-
], App, "test", null);
|
|
2870
|
-
App.test();
|
|
2871
|
-
},
|
|
2872
|
-
});
|
|
2873
|
-
})($ || ($ = {}));
|
|
2874
|
-
//mol/wire/field/field.test.ts
|
|
2840
|
+
//mol/mem/mem.ts
|
|
2875
2841
|
;
|
|
2876
2842
|
"use strict";
|
|
2877
2843
|
var $;
|
|
@@ -2941,6 +2907,115 @@ var $;
|
|
|
2941
2907
|
;
|
|
2942
2908
|
"use strict";
|
|
2943
2909
|
var $;
|
|
2910
|
+
(function ($) {
|
|
2911
|
+
class $mol_wire_log extends $mol_object2 {
|
|
2912
|
+
static watch(task) {
|
|
2913
|
+
return task;
|
|
2914
|
+
}
|
|
2915
|
+
static track(fiber) {
|
|
2916
|
+
const prev = $mol_wire_probe(() => this.track(fiber));
|
|
2917
|
+
let next;
|
|
2918
|
+
try {
|
|
2919
|
+
next = fiber.sync();
|
|
2920
|
+
}
|
|
2921
|
+
finally {
|
|
2922
|
+
for (const pub of fiber.pub_list) {
|
|
2923
|
+
if (pub instanceof $mol_wire_fiber) {
|
|
2924
|
+
this.track(pub);
|
|
2925
|
+
}
|
|
2926
|
+
}
|
|
2927
|
+
}
|
|
2928
|
+
if (prev !== undefined && !$mol_compare_deep(prev, next)) {
|
|
2929
|
+
this.$.$mol_log3_rise({
|
|
2930
|
+
message: 'Changed',
|
|
2931
|
+
place: fiber,
|
|
2932
|
+
});
|
|
2933
|
+
}
|
|
2934
|
+
return next;
|
|
2935
|
+
}
|
|
2936
|
+
static active() {
|
|
2937
|
+
try {
|
|
2938
|
+
this.watch()?.();
|
|
2939
|
+
}
|
|
2940
|
+
finally {
|
|
2941
|
+
for (const pub of $mol_wire_auto.pub_list) {
|
|
2942
|
+
if (pub instanceof $mol_wire_fiber) {
|
|
2943
|
+
this.track(pub);
|
|
2944
|
+
}
|
|
2945
|
+
}
|
|
2946
|
+
}
|
|
2947
|
+
}
|
|
2948
|
+
}
|
|
2949
|
+
__decorate([
|
|
2950
|
+
$mol_mem
|
|
2951
|
+
], $mol_wire_log, "watch", null);
|
|
2952
|
+
__decorate([
|
|
2953
|
+
$mol_mem_key
|
|
2954
|
+
], $mol_wire_log, "track", null);
|
|
2955
|
+
__decorate([
|
|
2956
|
+
$mol_mem
|
|
2957
|
+
], $mol_wire_log, "active", null);
|
|
2958
|
+
$.$mol_wire_log = $mol_wire_log;
|
|
2959
|
+
})($ || ($ = {}));
|
|
2960
|
+
//mol/wire/log/log.ts
|
|
2961
|
+
;
|
|
2962
|
+
"use strict";
|
|
2963
|
+
var $;
|
|
2964
|
+
(function ($) {
|
|
2965
|
+
$mol_wire_log.active();
|
|
2966
|
+
})($ || ($ = {}));
|
|
2967
|
+
//mol/wire/wire.test.ts
|
|
2968
|
+
;
|
|
2969
|
+
"use strict";
|
|
2970
|
+
var $;
|
|
2971
|
+
(function ($) {
|
|
2972
|
+
$mol_test({
|
|
2973
|
+
'const returns stored value'() {
|
|
2974
|
+
const foo = { bar: $mol_const(Math.random()) };
|
|
2975
|
+
$mol_assert_equal(foo.bar(), foo.bar());
|
|
2976
|
+
$mol_assert_equal(foo.bar(), foo.bar['()']);
|
|
2977
|
+
},
|
|
2978
|
+
});
|
|
2979
|
+
})($ || ($ = {}));
|
|
2980
|
+
//mol/const/const.test.ts
|
|
2981
|
+
;
|
|
2982
|
+
"use strict";
|
|
2983
|
+
var $;
|
|
2984
|
+
(function ($_1) {
|
|
2985
|
+
$mol_test({
|
|
2986
|
+
'Cached field'($) {
|
|
2987
|
+
class App extends $mol_object2 {
|
|
2988
|
+
static $ = $;
|
|
2989
|
+
static low = 1;
|
|
2990
|
+
static get high() {
|
|
2991
|
+
return this.low + 1;
|
|
2992
|
+
}
|
|
2993
|
+
static set high(next) {
|
|
2994
|
+
this.low = next - 1;
|
|
2995
|
+
}
|
|
2996
|
+
static test() {
|
|
2997
|
+
$mol_assert_equal(App.high, 2);
|
|
2998
|
+
App.high = 3;
|
|
2999
|
+
$mol_assert_equal(App.high, 3);
|
|
3000
|
+
}
|
|
3001
|
+
}
|
|
3002
|
+
__decorate([
|
|
3003
|
+
$mol_wire_field
|
|
3004
|
+
], App, "low", void 0);
|
|
3005
|
+
__decorate([
|
|
3006
|
+
$mol_wire_field
|
|
3007
|
+
], App, "high", null);
|
|
3008
|
+
__decorate([
|
|
3009
|
+
$mol_wire_method
|
|
3010
|
+
], App, "test", null);
|
|
3011
|
+
App.test();
|
|
3012
|
+
},
|
|
3013
|
+
});
|
|
3014
|
+
})($ || ($ = {}));
|
|
3015
|
+
//mol/wire/field/field.test.ts
|
|
3016
|
+
;
|
|
3017
|
+
"use strict";
|
|
3018
|
+
var $;
|
|
2944
3019
|
(function ($) {
|
|
2945
3020
|
function $mol_env() {
|
|
2946
3021
|
return {};
|