mol_jsx_lib 0.0.53 → 0.0.56
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 +95 -0
- package/node.deps.json +1 -1
- package/node.esm.js +407 -0
- package/node.esm.js.map +1 -1
- package/node.js +407 -0
- package/node.js.map +1 -1
- package/node.test.js +679 -164
- package/node.test.js.map +1 -1
- package/package.json +17 -2
- package/web.d.ts +136 -0
- package/web.deps.json +1 -1
- package/web.esm.js +484 -0
- package/web.esm.js.map +1 -1
- package/web.js +484 -0
- package/web.js.map +1 -1
- package/web.test.js +272 -241
- package/web.test.js.map +1 -1
package/node.test.js
CHANGED
|
@@ -1902,6 +1902,413 @@ var $;
|
|
|
1902
1902
|
;
|
|
1903
1903
|
"use strict";
|
|
1904
1904
|
var $;
|
|
1905
|
+
(function ($) {
|
|
1906
|
+
function $mol_wire_probe(task, next) {
|
|
1907
|
+
const warm = $mol_wire_fiber.warm;
|
|
1908
|
+
try {
|
|
1909
|
+
$mol_wire_fiber.warm = false;
|
|
1910
|
+
return task();
|
|
1911
|
+
}
|
|
1912
|
+
finally {
|
|
1913
|
+
$mol_wire_fiber.warm = warm;
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1916
|
+
$.$mol_wire_probe = $mol_wire_probe;
|
|
1917
|
+
})($ || ($ = {}));
|
|
1918
|
+
//mol/wire/probe/probe.ts
|
|
1919
|
+
;
|
|
1920
|
+
"use strict";
|
|
1921
|
+
var $;
|
|
1922
|
+
(function ($) {
|
|
1923
|
+
function $mol_wire_solid() {
|
|
1924
|
+
$mol_wire_auto().reap = nothing;
|
|
1925
|
+
}
|
|
1926
|
+
$.$mol_wire_solid = $mol_wire_solid;
|
|
1927
|
+
const nothing = () => { };
|
|
1928
|
+
})($ || ($ = {}));
|
|
1929
|
+
//mol/wire/solid/solid.ts
|
|
1930
|
+
;
|
|
1931
|
+
"use strict";
|
|
1932
|
+
var $;
|
|
1933
|
+
(function ($) {
|
|
1934
|
+
function $mol_wire_watch() {
|
|
1935
|
+
const atom = $mol_wire_auto();
|
|
1936
|
+
if (atom instanceof $mol_wire_atom) {
|
|
1937
|
+
atom.watch();
|
|
1938
|
+
}
|
|
1939
|
+
else {
|
|
1940
|
+
$mol_fail(new Error('Atom is equired for watching'));
|
|
1941
|
+
}
|
|
1942
|
+
}
|
|
1943
|
+
$.$mol_wire_watch = $mol_wire_watch;
|
|
1944
|
+
})($ || ($ = {}));
|
|
1945
|
+
//mol/wire/watch/watch.ts
|
|
1946
|
+
;
|
|
1947
|
+
"use strict";
|
|
1948
|
+
var $;
|
|
1949
|
+
(function ($) {
|
|
1950
|
+
function $mol_wire_sync(obj) {
|
|
1951
|
+
return new Proxy(obj, {
|
|
1952
|
+
get(obj, field) {
|
|
1953
|
+
const val = obj[field];
|
|
1954
|
+
if (typeof val !== 'function')
|
|
1955
|
+
return val;
|
|
1956
|
+
const temp = $mol_wire_task.getter(val);
|
|
1957
|
+
return function $mol_wire_sync(...args) {
|
|
1958
|
+
const fiber = temp(obj, args);
|
|
1959
|
+
return fiber.sync();
|
|
1960
|
+
};
|
|
1961
|
+
},
|
|
1962
|
+
apply(obj, self, args) {
|
|
1963
|
+
const temp = $mol_wire_task.getter(obj);
|
|
1964
|
+
const fiber = temp(self, args);
|
|
1965
|
+
return fiber.sync();
|
|
1966
|
+
},
|
|
1967
|
+
});
|
|
1968
|
+
}
|
|
1969
|
+
$.$mol_wire_sync = $mol_wire_sync;
|
|
1970
|
+
})($ || ($ = {}));
|
|
1971
|
+
//mol/wire/sync/sync.ts
|
|
1972
|
+
;
|
|
1973
|
+
"use strict";
|
|
1974
|
+
var $;
|
|
1975
|
+
(function ($) {
|
|
1976
|
+
function $mol_wire_async(obj) {
|
|
1977
|
+
let fiber;
|
|
1978
|
+
const temp = $mol_wire_task.getter(obj);
|
|
1979
|
+
return new Proxy(obj, {
|
|
1980
|
+
get(obj, field) {
|
|
1981
|
+
const val = obj[field];
|
|
1982
|
+
if (typeof val !== 'function')
|
|
1983
|
+
return val;
|
|
1984
|
+
let fiber;
|
|
1985
|
+
const temp = $mol_wire_task.getter(val);
|
|
1986
|
+
return function $mol_wire_async(...args) {
|
|
1987
|
+
fiber?.destructor();
|
|
1988
|
+
fiber = temp(obj, args);
|
|
1989
|
+
return fiber.async();
|
|
1990
|
+
};
|
|
1991
|
+
},
|
|
1992
|
+
apply(obj, self, args) {
|
|
1993
|
+
fiber?.destructor();
|
|
1994
|
+
fiber = temp(self, args);
|
|
1995
|
+
return fiber.async();
|
|
1996
|
+
},
|
|
1997
|
+
});
|
|
1998
|
+
}
|
|
1999
|
+
$.$mol_wire_async = $mol_wire_async;
|
|
2000
|
+
})($ || ($ = {}));
|
|
2001
|
+
//mol/wire/async/async.ts
|
|
2002
|
+
;
|
|
2003
|
+
"use strict";
|
|
2004
|
+
var $;
|
|
2005
|
+
(function ($) {
|
|
2006
|
+
function $mol_const(value) {
|
|
2007
|
+
var getter = (() => value);
|
|
2008
|
+
getter['()'] = value;
|
|
2009
|
+
getter[Symbol.toStringTag] = value;
|
|
2010
|
+
return getter;
|
|
2011
|
+
}
|
|
2012
|
+
$.$mol_const = $mol_const;
|
|
2013
|
+
})($ || ($ = {}));
|
|
2014
|
+
//mol/const/const.ts
|
|
2015
|
+
;
|
|
2016
|
+
"use strict";
|
|
2017
|
+
var $;
|
|
2018
|
+
(function ($) {
|
|
2019
|
+
function $mol_wire_field(host, field, descr) {
|
|
2020
|
+
if (!descr)
|
|
2021
|
+
descr = Reflect.getOwnPropertyDescriptor(host, field);
|
|
2022
|
+
const _get = descr?.get || $mol_const(descr?.value);
|
|
2023
|
+
const persist = $mol_wire_atom.getter(_get, 0);
|
|
2024
|
+
const _set = descr?.set || function (next) {
|
|
2025
|
+
persist(this, []).put(next);
|
|
2026
|
+
};
|
|
2027
|
+
const sup = Reflect.getPrototypeOf(host);
|
|
2028
|
+
const sup_descr = Reflect.getOwnPropertyDescriptor(sup, field);
|
|
2029
|
+
Object.defineProperty(_get, 'name', { value: sup_descr?.get?.name ?? field });
|
|
2030
|
+
Object.defineProperty(_set, 'name', { value: sup_descr?.set?.name ?? field });
|
|
2031
|
+
function get() {
|
|
2032
|
+
return persist(this, []).sync();
|
|
2033
|
+
}
|
|
2034
|
+
const temp = $mol_wire_task.getter(_set);
|
|
2035
|
+
function set(next) {
|
|
2036
|
+
temp(this, [next]).sync();
|
|
2037
|
+
}
|
|
2038
|
+
Object.defineProperty(get, 'name', { value: _get.name + '$' });
|
|
2039
|
+
Object.defineProperty(set, 'name', { value: _set.name + '@' });
|
|
2040
|
+
Object.assign(get, { orig: _get });
|
|
2041
|
+
Object.assign(set, { orig: _set });
|
|
2042
|
+
const { value, writable, ...descr2 } = { ...descr, get, set };
|
|
2043
|
+
Reflect.defineProperty(host, field, descr2);
|
|
2044
|
+
return descr2;
|
|
2045
|
+
}
|
|
2046
|
+
$.$mol_wire_field = $mol_wire_field;
|
|
2047
|
+
})($ || ($ = {}));
|
|
2048
|
+
//mol/wire/field/field.ts
|
|
2049
|
+
;
|
|
2050
|
+
"use strict";
|
|
2051
|
+
var $;
|
|
2052
|
+
(function ($) {
|
|
2053
|
+
function $mol_wire_patch(obj) {
|
|
2054
|
+
for (const field of Reflect.ownKeys(obj)) {
|
|
2055
|
+
const descr = Reflect.getOwnPropertyDescriptor(obj, field);
|
|
2056
|
+
if (!descr.configurable)
|
|
2057
|
+
continue;
|
|
2058
|
+
if (!descr.get)
|
|
2059
|
+
continue;
|
|
2060
|
+
const get = descr.get ?? (() => descr.value);
|
|
2061
|
+
const set = descr.set ?? (next => descr.value = next);
|
|
2062
|
+
const persist = $mol_wire_atom.getter(get, 0);
|
|
2063
|
+
Reflect.defineProperty(obj, field, {
|
|
2064
|
+
configurable: true,
|
|
2065
|
+
enumerable: descr.enumerable,
|
|
2066
|
+
get() {
|
|
2067
|
+
const atom = persist(obj, []);
|
|
2068
|
+
atom.watch();
|
|
2069
|
+
return atom.sync();
|
|
2070
|
+
},
|
|
2071
|
+
set(next) {
|
|
2072
|
+
const atom = persist(obj, []);
|
|
2073
|
+
set.call(this, next);
|
|
2074
|
+
atom.refresh();
|
|
2075
|
+
},
|
|
2076
|
+
});
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
2079
|
+
$.$mol_wire_patch = $mol_wire_patch;
|
|
2080
|
+
})($ || ($ = {}));
|
|
2081
|
+
//mol/wire/patch/patch.ts
|
|
2082
|
+
;
|
|
2083
|
+
"use strict";
|
|
2084
|
+
var $;
|
|
2085
|
+
(function ($) {
|
|
2086
|
+
class $mol_wire_set extends Set {
|
|
2087
|
+
pub = new $mol_wire_pub;
|
|
2088
|
+
has(value) {
|
|
2089
|
+
this.pub.promote();
|
|
2090
|
+
return super.has(value);
|
|
2091
|
+
}
|
|
2092
|
+
entries() {
|
|
2093
|
+
this.pub.promote();
|
|
2094
|
+
return super.entries();
|
|
2095
|
+
}
|
|
2096
|
+
keys() {
|
|
2097
|
+
this.pub.promote();
|
|
2098
|
+
return super.keys();
|
|
2099
|
+
}
|
|
2100
|
+
values() {
|
|
2101
|
+
this.pub.promote();
|
|
2102
|
+
return super.values();
|
|
2103
|
+
}
|
|
2104
|
+
forEach(task, self) {
|
|
2105
|
+
this.pub.promote();
|
|
2106
|
+
super.forEach(task, self);
|
|
2107
|
+
}
|
|
2108
|
+
[Symbol.iterator]() {
|
|
2109
|
+
this.pub.promote();
|
|
2110
|
+
return super[Symbol.iterator]();
|
|
2111
|
+
}
|
|
2112
|
+
get size() {
|
|
2113
|
+
this.pub.promote();
|
|
2114
|
+
return super.size;
|
|
2115
|
+
}
|
|
2116
|
+
add(value) {
|
|
2117
|
+
if (super.has(value))
|
|
2118
|
+
return this;
|
|
2119
|
+
super.add(value);
|
|
2120
|
+
this.pub.emit();
|
|
2121
|
+
return this;
|
|
2122
|
+
}
|
|
2123
|
+
delete(value) {
|
|
2124
|
+
const res = super.delete(value);
|
|
2125
|
+
if (res)
|
|
2126
|
+
this.pub.emit();
|
|
2127
|
+
return res;
|
|
2128
|
+
}
|
|
2129
|
+
clear() {
|
|
2130
|
+
if (!super.size)
|
|
2131
|
+
return;
|
|
2132
|
+
super.clear();
|
|
2133
|
+
this.pub.emit();
|
|
2134
|
+
}
|
|
2135
|
+
item(val, next) {
|
|
2136
|
+
if (next === undefined)
|
|
2137
|
+
return this.has(val);
|
|
2138
|
+
if (next)
|
|
2139
|
+
this.add(val);
|
|
2140
|
+
else
|
|
2141
|
+
this.delete(val);
|
|
2142
|
+
return next;
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2145
|
+
$.$mol_wire_set = $mol_wire_set;
|
|
2146
|
+
})($ || ($ = {}));
|
|
2147
|
+
//mol/wire/set/set.ts
|
|
2148
|
+
;
|
|
2149
|
+
"use strict";
|
|
2150
|
+
var $;
|
|
2151
|
+
(function ($) {
|
|
2152
|
+
class $mol_wire_dict extends Map {
|
|
2153
|
+
pub = new $mol_wire_pub;
|
|
2154
|
+
has(key) {
|
|
2155
|
+
this.pub.promote();
|
|
2156
|
+
return super.has(key);
|
|
2157
|
+
}
|
|
2158
|
+
get(key) {
|
|
2159
|
+
this.pub.promote();
|
|
2160
|
+
return super.get(key);
|
|
2161
|
+
}
|
|
2162
|
+
entries() {
|
|
2163
|
+
this.pub.promote();
|
|
2164
|
+
return super.entries();
|
|
2165
|
+
}
|
|
2166
|
+
keys() {
|
|
2167
|
+
this.pub.promote();
|
|
2168
|
+
return super.keys();
|
|
2169
|
+
}
|
|
2170
|
+
values() {
|
|
2171
|
+
this.pub.promote();
|
|
2172
|
+
return super.values();
|
|
2173
|
+
}
|
|
2174
|
+
forEach(task, self) {
|
|
2175
|
+
this.pub.promote();
|
|
2176
|
+
super.forEach(task, self);
|
|
2177
|
+
}
|
|
2178
|
+
[Symbol.iterator]() {
|
|
2179
|
+
this.pub.promote();
|
|
2180
|
+
return super[Symbol.iterator]();
|
|
2181
|
+
}
|
|
2182
|
+
get size() {
|
|
2183
|
+
this.pub.promote();
|
|
2184
|
+
return super.size;
|
|
2185
|
+
}
|
|
2186
|
+
set(key, value) {
|
|
2187
|
+
if (super.get(key) === value)
|
|
2188
|
+
return this;
|
|
2189
|
+
super.set(key, value);
|
|
2190
|
+
this.pub.emit();
|
|
2191
|
+
return this;
|
|
2192
|
+
}
|
|
2193
|
+
delete(key) {
|
|
2194
|
+
const res = super.delete(key);
|
|
2195
|
+
if (res)
|
|
2196
|
+
this.pub.emit();
|
|
2197
|
+
return res;
|
|
2198
|
+
}
|
|
2199
|
+
clear() {
|
|
2200
|
+
if (!super.size)
|
|
2201
|
+
return;
|
|
2202
|
+
super.clear();
|
|
2203
|
+
this.pub.emit();
|
|
2204
|
+
}
|
|
2205
|
+
item(key, next) {
|
|
2206
|
+
if (next === undefined)
|
|
2207
|
+
return this.get(key) ?? null;
|
|
2208
|
+
if (next === null)
|
|
2209
|
+
this.delete(key);
|
|
2210
|
+
else
|
|
2211
|
+
this.set(key, next);
|
|
2212
|
+
return next;
|
|
2213
|
+
}
|
|
2214
|
+
}
|
|
2215
|
+
$.$mol_wire_dict = $mol_wire_dict;
|
|
2216
|
+
})($ || ($ = {}));
|
|
2217
|
+
//mol/wire/dict/dict.ts
|
|
2218
|
+
;
|
|
2219
|
+
"use strict";
|
|
2220
|
+
var $;
|
|
2221
|
+
(function ($) {
|
|
2222
|
+
function $mol_promise() {
|
|
2223
|
+
let done;
|
|
2224
|
+
let fail;
|
|
2225
|
+
const promise = new Promise((d, f) => {
|
|
2226
|
+
done = d;
|
|
2227
|
+
fail = f;
|
|
2228
|
+
});
|
|
2229
|
+
return Object.assign(promise, {
|
|
2230
|
+
done,
|
|
2231
|
+
fail,
|
|
2232
|
+
});
|
|
2233
|
+
}
|
|
2234
|
+
$.$mol_promise = $mol_promise;
|
|
2235
|
+
})($ || ($ = {}));
|
|
2236
|
+
//mol/promise/promise.ts
|
|
2237
|
+
;
|
|
2238
|
+
"use strict";
|
|
2239
|
+
var $;
|
|
2240
|
+
(function ($) {
|
|
2241
|
+
function $mol_wait_timeout_async(timeout) {
|
|
2242
|
+
const promise = $mol_promise();
|
|
2243
|
+
const task = new this.$mol_after_timeout(timeout, () => promise.done());
|
|
2244
|
+
return Object.assign(promise, {
|
|
2245
|
+
destructor: () => task.destructor()
|
|
2246
|
+
});
|
|
2247
|
+
}
|
|
2248
|
+
$.$mol_wait_timeout_async = $mol_wait_timeout_async;
|
|
2249
|
+
function $mol_wait_timeout(timeout) {
|
|
2250
|
+
return this.$mol_wire_sync(this).$mol_wait_timeout_async(timeout);
|
|
2251
|
+
}
|
|
2252
|
+
$.$mol_wait_timeout = $mol_wait_timeout;
|
|
2253
|
+
})($ || ($ = {}));
|
|
2254
|
+
//mol/wait/timeout/timeout.ts
|
|
2255
|
+
;
|
|
2256
|
+
"use strict";
|
|
2257
|
+
var $;
|
|
2258
|
+
(function ($) {
|
|
2259
|
+
class $mol_wire_log extends $mol_object2 {
|
|
2260
|
+
static watch(task) {
|
|
2261
|
+
return task;
|
|
2262
|
+
}
|
|
2263
|
+
static track(fiber) {
|
|
2264
|
+
const prev = $mol_wire_probe(() => this.track(fiber));
|
|
2265
|
+
let next;
|
|
2266
|
+
try {
|
|
2267
|
+
next = fiber.sync();
|
|
2268
|
+
}
|
|
2269
|
+
finally {
|
|
2270
|
+
for (const pub of fiber.pub_list) {
|
|
2271
|
+
if (pub instanceof $mol_wire_fiber) {
|
|
2272
|
+
this.track(pub);
|
|
2273
|
+
}
|
|
2274
|
+
}
|
|
2275
|
+
}
|
|
2276
|
+
if (prev !== undefined && !$mol_compare_deep(prev, next)) {
|
|
2277
|
+
this.$.$mol_log3_rise({
|
|
2278
|
+
message: 'Changed',
|
|
2279
|
+
place: fiber,
|
|
2280
|
+
});
|
|
2281
|
+
}
|
|
2282
|
+
return next;
|
|
2283
|
+
}
|
|
2284
|
+
static active() {
|
|
2285
|
+
try {
|
|
2286
|
+
this.watch()?.();
|
|
2287
|
+
}
|
|
2288
|
+
finally {
|
|
2289
|
+
for (const pub of $mol_wire_auto().pub_list) {
|
|
2290
|
+
if (pub instanceof $mol_wire_fiber) {
|
|
2291
|
+
this.track(pub);
|
|
2292
|
+
}
|
|
2293
|
+
}
|
|
2294
|
+
}
|
|
2295
|
+
}
|
|
2296
|
+
}
|
|
2297
|
+
__decorate([
|
|
2298
|
+
$mol_mem
|
|
2299
|
+
], $mol_wire_log, "watch", null);
|
|
2300
|
+
__decorate([
|
|
2301
|
+
$mol_mem_key
|
|
2302
|
+
], $mol_wire_log, "track", null);
|
|
2303
|
+
__decorate([
|
|
2304
|
+
$mol_mem
|
|
2305
|
+
], $mol_wire_log, "active", null);
|
|
2306
|
+
$.$mol_wire_log = $mol_wire_log;
|
|
2307
|
+
})($ || ($ = {}));
|
|
2308
|
+
//mol/wire/log/log.ts
|
|
2309
|
+
;
|
|
2310
|
+
"use strict";
|
|
2311
|
+
var $;
|
|
1905
2312
|
(function ($) {
|
|
1906
2313
|
function $mol_test_complete() {
|
|
1907
2314
|
process.exit(0);
|
|
@@ -2683,69 +3090,6 @@ var $;
|
|
|
2683
3090
|
;
|
|
2684
3091
|
"use strict";
|
|
2685
3092
|
var $;
|
|
2686
|
-
(function ($) {
|
|
2687
|
-
function $mol_wire_sync(obj) {
|
|
2688
|
-
return new Proxy(obj, {
|
|
2689
|
-
get(obj, field) {
|
|
2690
|
-
const val = obj[field];
|
|
2691
|
-
if (typeof val !== 'function')
|
|
2692
|
-
return val;
|
|
2693
|
-
const temp = $mol_wire_task.getter(val);
|
|
2694
|
-
return function $mol_wire_sync(...args) {
|
|
2695
|
-
const fiber = temp(obj, args);
|
|
2696
|
-
return fiber.sync();
|
|
2697
|
-
};
|
|
2698
|
-
},
|
|
2699
|
-
apply(obj, self, args) {
|
|
2700
|
-
const temp = $mol_wire_task.getter(obj);
|
|
2701
|
-
const fiber = temp(self, args);
|
|
2702
|
-
return fiber.sync();
|
|
2703
|
-
},
|
|
2704
|
-
});
|
|
2705
|
-
}
|
|
2706
|
-
$.$mol_wire_sync = $mol_wire_sync;
|
|
2707
|
-
})($ || ($ = {}));
|
|
2708
|
-
//mol/wire/sync/sync.ts
|
|
2709
|
-
;
|
|
2710
|
-
"use strict";
|
|
2711
|
-
var $;
|
|
2712
|
-
(function ($) {
|
|
2713
|
-
function $mol_promise() {
|
|
2714
|
-
let done;
|
|
2715
|
-
let fail;
|
|
2716
|
-
const promise = new Promise((d, f) => {
|
|
2717
|
-
done = d;
|
|
2718
|
-
fail = f;
|
|
2719
|
-
});
|
|
2720
|
-
return Object.assign(promise, {
|
|
2721
|
-
done,
|
|
2722
|
-
fail,
|
|
2723
|
-
});
|
|
2724
|
-
}
|
|
2725
|
-
$.$mol_promise = $mol_promise;
|
|
2726
|
-
})($ || ($ = {}));
|
|
2727
|
-
//mol/promise/promise.ts
|
|
2728
|
-
;
|
|
2729
|
-
"use strict";
|
|
2730
|
-
var $;
|
|
2731
|
-
(function ($) {
|
|
2732
|
-
function $mol_wait_timeout_async(timeout) {
|
|
2733
|
-
const promise = $mol_promise();
|
|
2734
|
-
const task = new this.$mol_after_timeout(timeout, () => promise.done());
|
|
2735
|
-
return Object.assign(promise, {
|
|
2736
|
-
destructor: () => task.destructor()
|
|
2737
|
-
});
|
|
2738
|
-
}
|
|
2739
|
-
$.$mol_wait_timeout_async = $mol_wait_timeout_async;
|
|
2740
|
-
function $mol_wait_timeout(timeout) {
|
|
2741
|
-
return this.$mol_wire_sync(this).$mol_wait_timeout_async(timeout);
|
|
2742
|
-
}
|
|
2743
|
-
$.$mol_wait_timeout = $mol_wait_timeout;
|
|
2744
|
-
})($ || ($ = {}));
|
|
2745
|
-
//mol/wait/timeout/timeout.ts
|
|
2746
|
-
;
|
|
2747
|
-
"use strict";
|
|
2748
|
-
var $;
|
|
2749
3093
|
(function ($_1) {
|
|
2750
3094
|
$mol_test({
|
|
2751
3095
|
async 'Latest method calls wins'($) {
|
|
@@ -2789,36 +3133,6 @@ var $;
|
|
|
2789
3133
|
;
|
|
2790
3134
|
"use strict";
|
|
2791
3135
|
var $;
|
|
2792
|
-
(function ($) {
|
|
2793
|
-
function $mol_wire_async(obj) {
|
|
2794
|
-
let fiber;
|
|
2795
|
-
const temp = $mol_wire_task.getter(obj);
|
|
2796
|
-
return new Proxy(obj, {
|
|
2797
|
-
get(obj, field) {
|
|
2798
|
-
const val = obj[field];
|
|
2799
|
-
if (typeof val !== 'function')
|
|
2800
|
-
return val;
|
|
2801
|
-
let fiber;
|
|
2802
|
-
const temp = $mol_wire_task.getter(val);
|
|
2803
|
-
return function $mol_wire_async(...args) {
|
|
2804
|
-
fiber?.destructor();
|
|
2805
|
-
fiber = temp(obj, args);
|
|
2806
|
-
return fiber.async();
|
|
2807
|
-
};
|
|
2808
|
-
},
|
|
2809
|
-
apply(obj, self, args) {
|
|
2810
|
-
fiber?.destructor();
|
|
2811
|
-
fiber = temp(self, args);
|
|
2812
|
-
return fiber.async();
|
|
2813
|
-
},
|
|
2814
|
-
});
|
|
2815
|
-
}
|
|
2816
|
-
$.$mol_wire_async = $mol_wire_async;
|
|
2817
|
-
})($ || ($ = {}));
|
|
2818
|
-
//mol/wire/async/async.ts
|
|
2819
|
-
;
|
|
2820
|
-
"use strict";
|
|
2821
|
-
var $;
|
|
2822
3136
|
(function ($_1) {
|
|
2823
3137
|
$mol_test({
|
|
2824
3138
|
'Cached channel'($) {
|
|
@@ -3389,77 +3703,6 @@ var $;
|
|
|
3389
3703
|
;
|
|
3390
3704
|
"use strict";
|
|
3391
3705
|
var $;
|
|
3392
|
-
(function ($) {
|
|
3393
|
-
function $mol_wire_probe(task, next) {
|
|
3394
|
-
const warm = $mol_wire_fiber.warm;
|
|
3395
|
-
try {
|
|
3396
|
-
$mol_wire_fiber.warm = false;
|
|
3397
|
-
return task();
|
|
3398
|
-
}
|
|
3399
|
-
finally {
|
|
3400
|
-
$mol_wire_fiber.warm = warm;
|
|
3401
|
-
}
|
|
3402
|
-
}
|
|
3403
|
-
$.$mol_wire_probe = $mol_wire_probe;
|
|
3404
|
-
})($ || ($ = {}));
|
|
3405
|
-
//mol/wire/probe/probe.ts
|
|
3406
|
-
;
|
|
3407
|
-
"use strict";
|
|
3408
|
-
var $;
|
|
3409
|
-
(function ($) {
|
|
3410
|
-
class $mol_wire_log extends $mol_object2 {
|
|
3411
|
-
static watch(task) {
|
|
3412
|
-
return task;
|
|
3413
|
-
}
|
|
3414
|
-
static track(fiber) {
|
|
3415
|
-
const prev = $mol_wire_probe(() => this.track(fiber));
|
|
3416
|
-
let next;
|
|
3417
|
-
try {
|
|
3418
|
-
next = fiber.sync();
|
|
3419
|
-
}
|
|
3420
|
-
finally {
|
|
3421
|
-
for (const pub of fiber.pub_list) {
|
|
3422
|
-
if (pub instanceof $mol_wire_fiber) {
|
|
3423
|
-
this.track(pub);
|
|
3424
|
-
}
|
|
3425
|
-
}
|
|
3426
|
-
}
|
|
3427
|
-
if (prev !== undefined && !$mol_compare_deep(prev, next)) {
|
|
3428
|
-
this.$.$mol_log3_rise({
|
|
3429
|
-
message: 'Changed',
|
|
3430
|
-
place: fiber,
|
|
3431
|
-
});
|
|
3432
|
-
}
|
|
3433
|
-
return next;
|
|
3434
|
-
}
|
|
3435
|
-
static active() {
|
|
3436
|
-
try {
|
|
3437
|
-
this.watch()?.();
|
|
3438
|
-
}
|
|
3439
|
-
finally {
|
|
3440
|
-
for (const pub of $mol_wire_auto().pub_list) {
|
|
3441
|
-
if (pub instanceof $mol_wire_fiber) {
|
|
3442
|
-
this.track(pub);
|
|
3443
|
-
}
|
|
3444
|
-
}
|
|
3445
|
-
}
|
|
3446
|
-
}
|
|
3447
|
-
}
|
|
3448
|
-
__decorate([
|
|
3449
|
-
$mol_mem
|
|
3450
|
-
], $mol_wire_log, "watch", null);
|
|
3451
|
-
__decorate([
|
|
3452
|
-
$mol_mem_key
|
|
3453
|
-
], $mol_wire_log, "track", null);
|
|
3454
|
-
__decorate([
|
|
3455
|
-
$mol_mem
|
|
3456
|
-
], $mol_wire_log, "active", null);
|
|
3457
|
-
$.$mol_wire_log = $mol_wire_log;
|
|
3458
|
-
})($ || ($ = {}));
|
|
3459
|
-
//mol/wire/log/log.ts
|
|
3460
|
-
;
|
|
3461
|
-
"use strict";
|
|
3462
|
-
var $;
|
|
3463
3706
|
(function ($) {
|
|
3464
3707
|
$mol_test({
|
|
3465
3708
|
'Primitives'() {
|
|
@@ -3615,5 +3858,277 @@ var $;
|
|
|
3615
3858
|
});
|
|
3616
3859
|
})($ || ($ = {}));
|
|
3617
3860
|
//mol/jsx/view/view.test.tsx
|
|
3861
|
+
;
|
|
3862
|
+
"use strict";
|
|
3863
|
+
var $;
|
|
3864
|
+
(function ($) {
|
|
3865
|
+
$mol_test({
|
|
3866
|
+
'const returns stored value'() {
|
|
3867
|
+
const foo = { bar: $mol_const(Math.random()) };
|
|
3868
|
+
$mol_assert_equal(foo.bar(), foo.bar());
|
|
3869
|
+
$mol_assert_equal(foo.bar(), foo.bar['()']);
|
|
3870
|
+
},
|
|
3871
|
+
});
|
|
3872
|
+
})($ || ($ = {}));
|
|
3873
|
+
//mol/const/const.test.ts
|
|
3874
|
+
;
|
|
3875
|
+
"use strict";
|
|
3876
|
+
var $;
|
|
3877
|
+
(function ($_1) {
|
|
3878
|
+
$mol_test({
|
|
3879
|
+
'Cached field'($) {
|
|
3880
|
+
class App extends $mol_object2 {
|
|
3881
|
+
static $ = $;
|
|
3882
|
+
static low = 1;
|
|
3883
|
+
static get high() {
|
|
3884
|
+
return this.low + 1;
|
|
3885
|
+
}
|
|
3886
|
+
static set high(next) {
|
|
3887
|
+
this.low = next - 1;
|
|
3888
|
+
}
|
|
3889
|
+
static test() {
|
|
3890
|
+
$mol_assert_equal(App.high, 2);
|
|
3891
|
+
App.high = 3;
|
|
3892
|
+
$mol_assert_equal(App.high, 3);
|
|
3893
|
+
}
|
|
3894
|
+
}
|
|
3895
|
+
__decorate([
|
|
3896
|
+
$mol_wire_field
|
|
3897
|
+
], App, "low", void 0);
|
|
3898
|
+
__decorate([
|
|
3899
|
+
$mol_wire_field
|
|
3900
|
+
], App, "high", null);
|
|
3901
|
+
__decorate([
|
|
3902
|
+
$mol_wire_method
|
|
3903
|
+
], App, "test", null);
|
|
3904
|
+
App.test();
|
|
3905
|
+
},
|
|
3906
|
+
});
|
|
3907
|
+
})($ || ($ = {}));
|
|
3908
|
+
//mol/wire/field/field.test.ts
|
|
3909
|
+
;
|
|
3910
|
+
"use strict";
|
|
3911
|
+
var $;
|
|
3912
|
+
(function ($_1) {
|
|
3913
|
+
$mol_test({
|
|
3914
|
+
'Watch one value'($) {
|
|
3915
|
+
class App extends $mol_object2 {
|
|
3916
|
+
static $ = $;
|
|
3917
|
+
static set = new $mol_wire_set();
|
|
3918
|
+
static lucky() {
|
|
3919
|
+
return this.set.has(777);
|
|
3920
|
+
}
|
|
3921
|
+
}
|
|
3922
|
+
__decorate([
|
|
3923
|
+
$mol_wire_mem(0)
|
|
3924
|
+
], App, "lucky", null);
|
|
3925
|
+
$mol_assert_equal(App.lucky(), false);
|
|
3926
|
+
App.set.add(666);
|
|
3927
|
+
$mol_assert_equal(App.lucky(), false);
|
|
3928
|
+
App.set.add(777);
|
|
3929
|
+
$mol_assert_equal(App.lucky(), true);
|
|
3930
|
+
App.set.delete(777);
|
|
3931
|
+
$mol_assert_equal(App.lucky(), false);
|
|
3932
|
+
},
|
|
3933
|
+
'Watch item channel'($) {
|
|
3934
|
+
class App extends $mol_object2 {
|
|
3935
|
+
static $ = $;
|
|
3936
|
+
static set = new $mol_wire_set();
|
|
3937
|
+
static lucky() {
|
|
3938
|
+
return this.set.item(777);
|
|
3939
|
+
}
|
|
3940
|
+
}
|
|
3941
|
+
__decorate([
|
|
3942
|
+
$mol_wire_mem(0)
|
|
3943
|
+
], App, "lucky", null);
|
|
3944
|
+
$mol_assert_equal(App.lucky(), false);
|
|
3945
|
+
App.set.item(666, true);
|
|
3946
|
+
$mol_assert_equal(App.lucky(), false);
|
|
3947
|
+
App.set.item(777, true);
|
|
3948
|
+
$mol_assert_equal(App.lucky(), true);
|
|
3949
|
+
App.set.item(777, false);
|
|
3950
|
+
$mol_assert_equal(App.lucky(), false);
|
|
3951
|
+
},
|
|
3952
|
+
'Watch size'($) {
|
|
3953
|
+
class App extends $mol_object2 {
|
|
3954
|
+
static $ = $;
|
|
3955
|
+
static set = new $mol_wire_set();
|
|
3956
|
+
static size() {
|
|
3957
|
+
return this.set.size;
|
|
3958
|
+
}
|
|
3959
|
+
}
|
|
3960
|
+
__decorate([
|
|
3961
|
+
$mol_wire_mem(0)
|
|
3962
|
+
], App, "size", null);
|
|
3963
|
+
$mol_assert_equal(App.size(), 0);
|
|
3964
|
+
App.set.add(666);
|
|
3965
|
+
$mol_assert_equal(App.size(), 1);
|
|
3966
|
+
App.set.add(777);
|
|
3967
|
+
$mol_assert_equal(App.size(), 2);
|
|
3968
|
+
App.set.delete(777);
|
|
3969
|
+
$mol_assert_equal(App.size(), 1);
|
|
3970
|
+
},
|
|
3971
|
+
'Watch for-of'($) {
|
|
3972
|
+
class App extends $mol_object2 {
|
|
3973
|
+
static $ = $;
|
|
3974
|
+
static set = new $mol_wire_set();
|
|
3975
|
+
static sum() {
|
|
3976
|
+
let res = 0;
|
|
3977
|
+
for (const val of this.set) {
|
|
3978
|
+
res += val;
|
|
3979
|
+
}
|
|
3980
|
+
return res;
|
|
3981
|
+
}
|
|
3982
|
+
}
|
|
3983
|
+
__decorate([
|
|
3984
|
+
$mol_wire_mem(0)
|
|
3985
|
+
], App, "sum", null);
|
|
3986
|
+
$mol_assert_equal(App.sum(), 0);
|
|
3987
|
+
App.set.add(111);
|
|
3988
|
+
$mol_assert_equal(App.sum(), 111);
|
|
3989
|
+
App.set.add(222);
|
|
3990
|
+
$mol_assert_equal(App.sum(), 333);
|
|
3991
|
+
App.set.delete(111);
|
|
3992
|
+
$mol_assert_equal(App.sum(), 222);
|
|
3993
|
+
},
|
|
3994
|
+
'Watch forEach'($) {
|
|
3995
|
+
class App extends $mol_object2 {
|
|
3996
|
+
static $ = $;
|
|
3997
|
+
static set = new $mol_wire_set();
|
|
3998
|
+
static sum() {
|
|
3999
|
+
let res = 0;
|
|
4000
|
+
this.set.forEach(val => res += val);
|
|
4001
|
+
return res;
|
|
4002
|
+
}
|
|
4003
|
+
}
|
|
4004
|
+
__decorate([
|
|
4005
|
+
$mol_wire_mem(0)
|
|
4006
|
+
], App, "sum", null);
|
|
4007
|
+
$mol_assert_equal(App.sum(), 0);
|
|
4008
|
+
App.set.add(111);
|
|
4009
|
+
$mol_assert_equal(App.sum(), 111);
|
|
4010
|
+
App.set.add(222);
|
|
4011
|
+
$mol_assert_equal(App.sum(), 333);
|
|
4012
|
+
App.set.delete(111);
|
|
4013
|
+
$mol_assert_equal(App.sum(), 222);
|
|
4014
|
+
},
|
|
4015
|
+
});
|
|
4016
|
+
})($ || ($ = {}));
|
|
4017
|
+
//mol/wire/set/set.test.ts
|
|
4018
|
+
;
|
|
4019
|
+
"use strict";
|
|
4020
|
+
var $;
|
|
4021
|
+
(function ($_1) {
|
|
4022
|
+
$mol_test({
|
|
4023
|
+
'Watch one value'($) {
|
|
4024
|
+
class App extends $mol_object2 {
|
|
4025
|
+
static $ = $;
|
|
4026
|
+
static dict = new $mol_wire_dict();
|
|
4027
|
+
static lucky() {
|
|
4028
|
+
return this.dict.get(777);
|
|
4029
|
+
}
|
|
4030
|
+
}
|
|
4031
|
+
__decorate([
|
|
4032
|
+
$mol_wire_mem(0)
|
|
4033
|
+
], App, "lucky", null);
|
|
4034
|
+
$mol_assert_equal(App.lucky(), undefined);
|
|
4035
|
+
App.dict.set(666, 6666);
|
|
4036
|
+
$mol_assert_equal(App.lucky(), undefined);
|
|
4037
|
+
App.dict.set(777, 7777);
|
|
4038
|
+
$mol_assert_equal(App.lucky(), 7777);
|
|
4039
|
+
App.dict.delete(777);
|
|
4040
|
+
$mol_assert_equal(App.lucky(), undefined);
|
|
4041
|
+
},
|
|
4042
|
+
'Watch item channel'($) {
|
|
4043
|
+
class App extends $mol_object2 {
|
|
4044
|
+
static $ = $;
|
|
4045
|
+
static dict = new $mol_wire_dict();
|
|
4046
|
+
static lucky() {
|
|
4047
|
+
return this.dict.item(777);
|
|
4048
|
+
}
|
|
4049
|
+
}
|
|
4050
|
+
__decorate([
|
|
4051
|
+
$mol_wire_mem(0)
|
|
4052
|
+
], App, "lucky", null);
|
|
4053
|
+
$mol_assert_equal(App.lucky(), null);
|
|
4054
|
+
App.dict.item(666, 6666);
|
|
4055
|
+
$mol_assert_equal(App.lucky(), null);
|
|
4056
|
+
App.dict.item(777, 7777);
|
|
4057
|
+
$mol_assert_equal(App.lucky(), 7777);
|
|
4058
|
+
App.dict.item(777, null);
|
|
4059
|
+
$mol_assert_equal(App.lucky(), null);
|
|
4060
|
+
},
|
|
4061
|
+
'Watch size'($) {
|
|
4062
|
+
class App extends $mol_object2 {
|
|
4063
|
+
static $ = $;
|
|
4064
|
+
static dict = new $mol_wire_dict();
|
|
4065
|
+
static size() {
|
|
4066
|
+
return this.dict.size;
|
|
4067
|
+
}
|
|
4068
|
+
}
|
|
4069
|
+
__decorate([
|
|
4070
|
+
$mol_wire_mem(0)
|
|
4071
|
+
], App, "size", null);
|
|
4072
|
+
$mol_assert_equal(App.size(), 0);
|
|
4073
|
+
App.dict.set(666, 6666);
|
|
4074
|
+
$mol_assert_equal(App.size(), 1);
|
|
4075
|
+
App.dict.set(777, 7777);
|
|
4076
|
+
$mol_assert_equal(App.size(), 2);
|
|
4077
|
+
App.dict.delete(777);
|
|
4078
|
+
$mol_assert_equal(App.size(), 1);
|
|
4079
|
+
},
|
|
4080
|
+
'Watch for-of'($) {
|
|
4081
|
+
class App extends $mol_object2 {
|
|
4082
|
+
static $ = $;
|
|
4083
|
+
static dict = new $mol_wire_dict();
|
|
4084
|
+
static sum() {
|
|
4085
|
+
let keys = 0;
|
|
4086
|
+
let vals = 0;
|
|
4087
|
+
for (const [key, val] of this.dict) {
|
|
4088
|
+
keys += key;
|
|
4089
|
+
vals += val;
|
|
4090
|
+
}
|
|
4091
|
+
return [keys, vals];
|
|
4092
|
+
}
|
|
4093
|
+
}
|
|
4094
|
+
__decorate([
|
|
4095
|
+
$mol_wire_mem(0)
|
|
4096
|
+
], App, "sum", null);
|
|
4097
|
+
$mol_assert_like(App.sum(), [0, 0]);
|
|
4098
|
+
App.dict.set(111, 1111);
|
|
4099
|
+
$mol_assert_like(App.sum(), [111, 1111]);
|
|
4100
|
+
App.dict.set(222, 2222);
|
|
4101
|
+
$mol_assert_like(App.sum(), [333, 3333]);
|
|
4102
|
+
App.dict.delete(111);
|
|
4103
|
+
$mol_assert_like(App.sum(), [222, 2222]);
|
|
4104
|
+
},
|
|
4105
|
+
'Watch forEach'($) {
|
|
4106
|
+
class App extends $mol_object2 {
|
|
4107
|
+
static $ = $;
|
|
4108
|
+
static dict = new $mol_wire_dict();
|
|
4109
|
+
static sum() {
|
|
4110
|
+
let keys = 0;
|
|
4111
|
+
let vals = 0;
|
|
4112
|
+
this.dict.forEach((val, key) => {
|
|
4113
|
+
keys += key;
|
|
4114
|
+
vals += val;
|
|
4115
|
+
});
|
|
4116
|
+
return [keys, vals];
|
|
4117
|
+
}
|
|
4118
|
+
}
|
|
4119
|
+
__decorate([
|
|
4120
|
+
$mol_wire_mem(0)
|
|
4121
|
+
], App, "sum", null);
|
|
4122
|
+
$mol_assert_like(App.sum(), [0, 0]);
|
|
4123
|
+
App.dict.set(111, 1111);
|
|
4124
|
+
$mol_assert_like(App.sum(), [111, 1111]);
|
|
4125
|
+
App.dict.set(222, 2222);
|
|
4126
|
+
$mol_assert_like(App.sum(), [333, 3333]);
|
|
4127
|
+
App.dict.delete(111);
|
|
4128
|
+
$mol_assert_like(App.sum(), [222, 2222]);
|
|
4129
|
+
},
|
|
4130
|
+
});
|
|
4131
|
+
})($ || ($ = {}));
|
|
4132
|
+
//mol/wire/dict/dict.test.ts
|
|
3618
4133
|
|
|
3619
4134
|
//# sourceMappingURL=node.test.js.map
|