mol_wire_lib 1.0.25 → 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 +7 -2
- package/node.esm.js.map +1 -1
- package/node.js +7 -2
- package/node.js.map +1 -1
- package/node.test.js +179 -103
- 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 +7 -2
- package/web.esm.js.map +1 -1
- package/web.js +7 -2
- 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;
|
|
@@ -869,10 +870,11 @@ var $;
|
|
|
869
870
|
return this.task.name + '()';
|
|
870
871
|
}
|
|
871
872
|
constructor(host, task, id, ...args) {
|
|
872
|
-
super(...args, undefined);
|
|
873
|
+
super(...args, undefined, undefined);
|
|
873
874
|
this.host = host;
|
|
874
875
|
this.task = task;
|
|
875
876
|
this.pop();
|
|
877
|
+
this.pop();
|
|
876
878
|
this.pub_from = this.sub_from = args.length;
|
|
877
879
|
this[Symbol.toStringTag] = id;
|
|
878
880
|
}
|
|
@@ -904,6 +906,9 @@ var $;
|
|
|
904
906
|
toString() {
|
|
905
907
|
return this[Symbol.toStringTag];
|
|
906
908
|
}
|
|
909
|
+
toJSON() {
|
|
910
|
+
return this[Symbol.toStringTag];
|
|
911
|
+
}
|
|
907
912
|
[$mol_dev_format_head]() {
|
|
908
913
|
return $mol_dev_format_div({}, $mol_dev_format_native(this), $mol_dev_format_shade(this.cursor.toString() + ' '), $mol_dev_format_auto(this.cache));
|
|
909
914
|
}
|
|
@@ -1845,64 +1850,6 @@ var $;
|
|
|
1845
1850
|
;
|
|
1846
1851
|
"use strict";
|
|
1847
1852
|
var $;
|
|
1848
|
-
(function ($_1) {
|
|
1849
|
-
$mol_test({
|
|
1850
|
-
'Collect deps'() {
|
|
1851
|
-
const pub1 = new $mol_wire_pub;
|
|
1852
|
-
const pub2 = new $mol_wire_pub;
|
|
1853
|
-
const sub = new $mol_wire_pub_sub;
|
|
1854
|
-
const bu1 = sub.track_on();
|
|
1855
|
-
try {
|
|
1856
|
-
pub1.track_promote();
|
|
1857
|
-
pub2.track_promote();
|
|
1858
|
-
pub2.track_promote();
|
|
1859
|
-
}
|
|
1860
|
-
finally {
|
|
1861
|
-
sub.track_cut();
|
|
1862
|
-
sub.track_off(bu1);
|
|
1863
|
-
}
|
|
1864
|
-
pub1.emit();
|
|
1865
|
-
pub2.emit();
|
|
1866
|
-
$mol_assert_like(sub.pub_list, [pub1, pub2, pub2]);
|
|
1867
|
-
const bu2 = sub.track_on();
|
|
1868
|
-
try {
|
|
1869
|
-
pub1.track_promote();
|
|
1870
|
-
pub1.track_promote();
|
|
1871
|
-
pub2.track_promote();
|
|
1872
|
-
}
|
|
1873
|
-
finally {
|
|
1874
|
-
sub.track_cut();
|
|
1875
|
-
sub.track_off(bu2);
|
|
1876
|
-
}
|
|
1877
|
-
pub1.emit();
|
|
1878
|
-
pub2.emit();
|
|
1879
|
-
$mol_assert_like(sub.pub_list, [pub1, pub1, pub2]);
|
|
1880
|
-
},
|
|
1881
|
-
'cyclic detection'($) {
|
|
1882
|
-
const sub1 = new $mol_wire_pub_sub;
|
|
1883
|
-
const sub2 = new $mol_wire_pub_sub;
|
|
1884
|
-
const bu1 = sub1.track_on();
|
|
1885
|
-
try {
|
|
1886
|
-
const bu2 = sub2.track_on();
|
|
1887
|
-
try {
|
|
1888
|
-
$mol_assert_fail(() => sub1.track_promote(), 'Circular subscription');
|
|
1889
|
-
}
|
|
1890
|
-
finally {
|
|
1891
|
-
sub2.track_cut();
|
|
1892
|
-
sub2.track_off(bu2);
|
|
1893
|
-
}
|
|
1894
|
-
}
|
|
1895
|
-
finally {
|
|
1896
|
-
sub1.track_cut();
|
|
1897
|
-
sub1.track_off(bu1);
|
|
1898
|
-
}
|
|
1899
|
-
},
|
|
1900
|
-
});
|
|
1901
|
-
})($ || ($ = {}));
|
|
1902
|
-
//mol/wire/pub/sub/sub.test.ts
|
|
1903
|
-
;
|
|
1904
|
-
"use strict";
|
|
1905
|
-
var $;
|
|
1906
1853
|
(function ($) {
|
|
1907
1854
|
$mol_test({
|
|
1908
1855
|
'get'() {
|
|
@@ -2080,6 +2027,64 @@ var $;
|
|
|
2080
2027
|
;
|
|
2081
2028
|
"use strict";
|
|
2082
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 $;
|
|
2083
2088
|
(function ($) {
|
|
2084
2089
|
$mol_test({
|
|
2085
2090
|
'Primitives'() {
|
|
@@ -2827,50 +2832,12 @@ var $;
|
|
|
2827
2832
|
"use strict";
|
|
2828
2833
|
var $;
|
|
2829
2834
|
(function ($) {
|
|
2830
|
-
$
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
$mol_assert_equal(foo.bar(), foo.bar['()']);
|
|
2835
|
-
},
|
|
2836
|
-
});
|
|
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);
|
|
2837
2839
|
})($ || ($ = {}));
|
|
2838
|
-
//mol/
|
|
2839
|
-
;
|
|
2840
|
-
"use strict";
|
|
2841
|
-
var $;
|
|
2842
|
-
(function ($_1) {
|
|
2843
|
-
$mol_test({
|
|
2844
|
-
'Cached field'($) {
|
|
2845
|
-
class App extends $mol_object2 {
|
|
2846
|
-
static $ = $;
|
|
2847
|
-
static low = 1;
|
|
2848
|
-
static get high() {
|
|
2849
|
-
return this.low + 1;
|
|
2850
|
-
}
|
|
2851
|
-
static set high(next) {
|
|
2852
|
-
this.low = next - 1;
|
|
2853
|
-
}
|
|
2854
|
-
static test() {
|
|
2855
|
-
$mol_assert_equal(App.high, 2);
|
|
2856
|
-
App.high = 3;
|
|
2857
|
-
$mol_assert_equal(App.high, 3);
|
|
2858
|
-
}
|
|
2859
|
-
}
|
|
2860
|
-
__decorate([
|
|
2861
|
-
$mol_wire_field
|
|
2862
|
-
], App, "low", void 0);
|
|
2863
|
-
__decorate([
|
|
2864
|
-
$mol_wire_field
|
|
2865
|
-
], App, "high", null);
|
|
2866
|
-
__decorate([
|
|
2867
|
-
$mol_wire_method
|
|
2868
|
-
], App, "test", null);
|
|
2869
|
-
App.test();
|
|
2870
|
-
},
|
|
2871
|
-
});
|
|
2872
|
-
})($ || ($ = {}));
|
|
2873
|
-
//mol/wire/field/field.test.ts
|
|
2840
|
+
//mol/mem/mem.ts
|
|
2874
2841
|
;
|
|
2875
2842
|
"use strict";
|
|
2876
2843
|
var $;
|
|
@@ -2940,6 +2907,115 @@ var $;
|
|
|
2940
2907
|
;
|
|
2941
2908
|
"use strict";
|
|
2942
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 $;
|
|
2943
3019
|
(function ($) {
|
|
2944
3020
|
function $mol_env() {
|
|
2945
3021
|
return {};
|