mol_jsx_lib 0.0.128 → 0.0.129
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 +21 -0
- package/node.deps.json +1 -1
- package/node.esm.js +68 -0
- package/node.esm.js.map +1 -1
- package/node.js +68 -0
- package/node.js.map +1 -1
- package/node.test.js +87 -0
- package/node.test.js.map +1 -1
- package/package.json +5 -1
- package/web.d.ts +31 -10
- package/web.deps.json +1 -1
- package/web.esm.js +89 -21
- package/web.esm.js.map +1 -1
- package/web.js +89 -21
- package/web.js.map +1 -1
- package/web.test.js +19 -0
- package/web.test.js.map +1 -1
package/node.test.js
CHANGED
|
@@ -2161,6 +2161,74 @@ var $;
|
|
|
2161
2161
|
;
|
|
2162
2162
|
"use strict";
|
|
2163
2163
|
var $;
|
|
2164
|
+
(function ($_1) {
|
|
2165
|
+
let $$;
|
|
2166
|
+
(function ($$) {
|
|
2167
|
+
let $;
|
|
2168
|
+
})($$ = $_1.$$ || ($_1.$$ = {}));
|
|
2169
|
+
$_1.$mol_object_field = Symbol('$mol_object_field');
|
|
2170
|
+
class $mol_object extends $mol_object2 {
|
|
2171
|
+
static make(config) {
|
|
2172
|
+
return super.create(obj => {
|
|
2173
|
+
for (let key in config)
|
|
2174
|
+
obj[key] = config[key];
|
|
2175
|
+
});
|
|
2176
|
+
}
|
|
2177
|
+
}
|
|
2178
|
+
$_1.$mol_object = $mol_object;
|
|
2179
|
+
})($ || ($ = {}));
|
|
2180
|
+
//mol/object/object.ts
|
|
2181
|
+
;
|
|
2182
|
+
"use strict";
|
|
2183
|
+
var $;
|
|
2184
|
+
(function ($) {
|
|
2185
|
+
class $mol_state_time extends $mol_object {
|
|
2186
|
+
static task(precision, reset) {
|
|
2187
|
+
if (precision) {
|
|
2188
|
+
return new $mol_after_timeout(precision, () => this.task(precision, null));
|
|
2189
|
+
}
|
|
2190
|
+
else {
|
|
2191
|
+
return new $mol_after_frame(() => this.task(precision, null));
|
|
2192
|
+
}
|
|
2193
|
+
}
|
|
2194
|
+
static now(precision) {
|
|
2195
|
+
this.task(precision);
|
|
2196
|
+
return Date.now();
|
|
2197
|
+
}
|
|
2198
|
+
}
|
|
2199
|
+
__decorate([
|
|
2200
|
+
$mol_mem_key
|
|
2201
|
+
], $mol_state_time, "task", null);
|
|
2202
|
+
__decorate([
|
|
2203
|
+
$mol_mem_key
|
|
2204
|
+
], $mol_state_time, "now", null);
|
|
2205
|
+
$.$mol_state_time = $mol_state_time;
|
|
2206
|
+
})($ || ($ = {}));
|
|
2207
|
+
//mol/state/time/time.ts
|
|
2208
|
+
;
|
|
2209
|
+
"use strict";
|
|
2210
|
+
var $;
|
|
2211
|
+
(function ($) {
|
|
2212
|
+
function $mol_wire_trans(next) {
|
|
2213
|
+
const atom = $mol_wire_auto();
|
|
2214
|
+
if (!(atom instanceof $mol_wire_atom))
|
|
2215
|
+
$mol_fail(new Error('Allowed only inside atom'));
|
|
2216
|
+
const prev = atom.result() ?? next;
|
|
2217
|
+
if (typeof prev !== 'number')
|
|
2218
|
+
return next;
|
|
2219
|
+
const current = (prev * 2 + next) / 3;
|
|
2220
|
+
const diff = Math.abs(current - next);
|
|
2221
|
+
if (diff < 1)
|
|
2222
|
+
return next;
|
|
2223
|
+
$mol_state_time.now(0);
|
|
2224
|
+
return current;
|
|
2225
|
+
}
|
|
2226
|
+
$.$mol_wire_trans = $mol_wire_trans;
|
|
2227
|
+
})($ || ($ = {}));
|
|
2228
|
+
//mol/wire/trans/trans.ts
|
|
2229
|
+
;
|
|
2230
|
+
"use strict";
|
|
2231
|
+
var $;
|
|
2164
2232
|
(function ($) {
|
|
2165
2233
|
function $mol_wire_patch(obj) {
|
|
2166
2234
|
for (const field of Reflect.ownKeys(obj)) {
|
|
@@ -4072,6 +4140,25 @@ var $;
|
|
|
4072
4140
|
;
|
|
4073
4141
|
"use strict";
|
|
4074
4142
|
var $;
|
|
4143
|
+
(function ($) {
|
|
4144
|
+
$mol_test({
|
|
4145
|
+
'init with overload'() {
|
|
4146
|
+
class X extends $mol_object {
|
|
4147
|
+
foo() {
|
|
4148
|
+
return 1;
|
|
4149
|
+
}
|
|
4150
|
+
}
|
|
4151
|
+
var x = X.make({
|
|
4152
|
+
foo: () => 2,
|
|
4153
|
+
});
|
|
4154
|
+
$mol_assert_equal(x.foo(), 2);
|
|
4155
|
+
},
|
|
4156
|
+
});
|
|
4157
|
+
})($ || ($ = {}));
|
|
4158
|
+
//mol/object/object.test.ts
|
|
4159
|
+
;
|
|
4160
|
+
"use strict";
|
|
4161
|
+
var $;
|
|
4075
4162
|
(function ($_1) {
|
|
4076
4163
|
$mol_test({
|
|
4077
4164
|
'Watch one value'($) {
|