mol_mutable 0.0.730 → 0.0.732
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.deps.json +1 -1
- package/node.test.js +68 -24
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.deps.json +1 -1
- package/web.test.js +24 -0
- package/web.test.js.map +1 -1
package/node.deps.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"files":["mam.ts","LICENSE","README.md","mam.jam.js","tsfmt.json","package.json","tsconfig.json","lang.lang.tree","meta.lang.tree","sandbox.config.json","mol/CNAME","mol/LICENSE","mol/readme.md","mol/mol.meta.tree","mol/CONTRIBUTING.md","mol/CODE_OF_CONDUCT.md","mol/type/README.md","mol/type/immutable/deep/deep/deep.ts","mol/mutable/README.md","mol/mutable/mutable.ts"],"mods":{},"deps_in":{"mol":{"mol/mutable":-9007199254740991,"mol/type":-9007199254740991},"":{"mol":-9007199254740991},"mol/type/immutable/deep/deep":{"mol/mutable":-2},"mol/type/immutable/deep":{"mol/type/immutable/deep/deep":-9007199254740991},"mol/type/immutable":{"mol/type/immutable/deep":-9007199254740991},"mol/type":{"mol/type/immutable":-9007199254740991}},"deps_out":{"mol/mutable":{"mol":-9007199254740991,"mol/type/immutable/deep/deep":-2},"mol":{"":-9007199254740991},"mol/type/immutable/deep/deep":{"mol/type/immutable/deep":-9007199254740991},"mol/type/immutable/deep":{"mol/type/immutable":-9007199254740991},"mol/type/immutable":{"mol/type":-9007199254740991},"mol/type":{"mol":-9007199254740991}},"sloc":{"ts":51,"LICENSE":113,"md":511,"js":9,"json":
|
|
1
|
+
{"files":["mam.ts","LICENSE","README.md","mam.jam.js","tsfmt.json","package.json","tsconfig.json","lang.lang.tree","meta.lang.tree","sandbox.config.json","mol/CNAME","mol/LICENSE","mol/readme.md","mol/mol.meta.tree","mol/CONTRIBUTING.md","mol/CODE_OF_CONDUCT.md","mol/type/README.md","mol/type/immutable/deep/deep/deep.ts","mol/mutable/README.md","mol/mutable/mutable.ts"],"mods":{},"deps_in":{"mol":{"mol/mutable":-9007199254740991,"mol/type":-9007199254740991},"":{"mol":-9007199254740991},"mol/type/immutable/deep/deep":{"mol/mutable":-2},"mol/type/immutable/deep":{"mol/type/immutable/deep/deep":-9007199254740991},"mol/type/immutable":{"mol/type/immutable/deep":-9007199254740991},"mol/type":{"mol/type/immutable":-9007199254740991}},"deps_out":{"mol/mutable":{"mol":-9007199254740991,"mol/type/immutable/deep/deep":-2},"mol":{"":-9007199254740991},"mol/type/immutable/deep/deep":{"mol/type/immutable/deep":-9007199254740991},"mol/type/immutable/deep":{"mol/type/immutable":-9007199254740991},"mol/type/immutable":{"mol/type":-9007199254740991},"mol/type":{"mol":-9007199254740991}},"sloc":{"ts":51,"LICENSE":113,"md":511,"js":9,"json":83,"tree":41,"CNAME":1},"deps":{"mol/mutable":{"..":-9007199254740991,"/mol/mutable/wrapper":-1,"/mol/type/immutable/deep":-2,"/mol/mutable":-1},"mol":{"..":-9007199254740991},"":{},"mol/type/immutable/deep/deep":{"..":-9007199254740991,"/mol/type/immutable/deep":-1},"mol/type/immutable/deep":{"..":-9007199254740991},"mol/type/immutable":{"..":-9007199254740991},"mol/type":{"..":-9007199254740991}}}
|
package/node.test.js
CHANGED
|
@@ -1124,7 +1124,7 @@ var $;
|
|
|
1124
1124
|
"use strict";
|
|
1125
1125
|
var $;
|
|
1126
1126
|
(function ($) {
|
|
1127
|
-
const
|
|
1127
|
+
const wrappers = new WeakMap();
|
|
1128
1128
|
class $mol_wire_fiber extends $mol_wire_pub_sub {
|
|
1129
1129
|
task;
|
|
1130
1130
|
host;
|
|
@@ -1259,14 +1259,21 @@ var $;
|
|
|
1259
1259
|
result = this.task.call(this.host, ...this.args);
|
|
1260
1260
|
break;
|
|
1261
1261
|
}
|
|
1262
|
-
if ($mol_promise_like(result)
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1262
|
+
if ($mol_promise_like(result)) {
|
|
1263
|
+
if (wrappers.has(result)) {
|
|
1264
|
+
result = wrappers.get(result).then(a => a);
|
|
1265
|
+
}
|
|
1266
|
+
else {
|
|
1267
|
+
const put = (res) => {
|
|
1268
|
+
if (this.cache === result)
|
|
1269
|
+
this.put(res);
|
|
1270
|
+
return res;
|
|
1271
|
+
};
|
|
1272
|
+
wrappers.set(result, result = Object.assign(result.then(put, put), { destructor: result.destructor || (() => { }) }));
|
|
1273
|
+
wrappers.set(result, result);
|
|
1274
|
+
const error = new Error(`Promise in ${this}`);
|
|
1275
|
+
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
1276
|
+
}
|
|
1270
1277
|
}
|
|
1271
1278
|
}
|
|
1272
1279
|
catch (error) {
|
|
@@ -1276,22 +1283,20 @@ var $;
|
|
|
1276
1283
|
else {
|
|
1277
1284
|
result = new Error(String(error), { cause: error });
|
|
1278
1285
|
}
|
|
1279
|
-
if ($mol_promise_like(result)
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1286
|
+
if ($mol_promise_like(result)) {
|
|
1287
|
+
if (wrappers.has(result)) {
|
|
1288
|
+
result = wrappers.get(result);
|
|
1289
|
+
}
|
|
1290
|
+
else {
|
|
1291
|
+
wrappers.set(result, result = Object.assign(result.finally(() => {
|
|
1292
|
+
if (this.cache === result)
|
|
1293
|
+
this.absorb();
|
|
1294
|
+
}), { destructor: result.destructor || (() => { }) }));
|
|
1295
|
+
const error = new Error(`Promise in ${this}`);
|
|
1296
|
+
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
1297
|
+
}
|
|
1285
1298
|
}
|
|
1286
1299
|
}
|
|
1287
|
-
if ($mol_promise_like(result) && !handled.has(result)) {
|
|
1288
|
-
result = Object.assign(result, {
|
|
1289
|
-
destructor: result['destructor'] ?? (() => { })
|
|
1290
|
-
});
|
|
1291
|
-
handled.add(result);
|
|
1292
|
-
const error = new Error(`Promise in ${this}`);
|
|
1293
|
-
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
1294
|
-
}
|
|
1295
1300
|
if (!$mol_promise_like(result)) {
|
|
1296
1301
|
this.track_cut();
|
|
1297
1302
|
}
|
|
@@ -1351,6 +1356,12 @@ var $;
|
|
|
1351
1356
|
};
|
|
1352
1357
|
});
|
|
1353
1358
|
}
|
|
1359
|
+
destructor() {
|
|
1360
|
+
super.destructor();
|
|
1361
|
+
if ($mol_owning_check(this, this.cache)) {
|
|
1362
|
+
this.cache.destructor();
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1354
1365
|
}
|
|
1355
1366
|
$.$mol_wire_fiber = $mol_wire_fiber;
|
|
1356
1367
|
})($ || ($ = {}));
|
|
@@ -1463,7 +1474,8 @@ var $;
|
|
|
1463
1474
|
$$.$mol_log3_warn({
|
|
1464
1475
|
place: '$mol_wire_task',
|
|
1465
1476
|
message: `Non idempotency`,
|
|
1466
|
-
|
|
1477
|
+
sub,
|
|
1478
|
+
pubs: [...sub?.pub_list ?? [], existen],
|
|
1467
1479
|
next,
|
|
1468
1480
|
hint: 'Ignore it',
|
|
1469
1481
|
});
|
|
@@ -1486,6 +1498,14 @@ var $;
|
|
|
1486
1498
|
this.cursor = $mol_wire_cursor.fresh;
|
|
1487
1499
|
if (next !== prev)
|
|
1488
1500
|
this.emit();
|
|
1501
|
+
if ($mol_owning_catch(this, next)) {
|
|
1502
|
+
try {
|
|
1503
|
+
next[Symbol.toStringTag] = this[Symbol.toStringTag];
|
|
1504
|
+
}
|
|
1505
|
+
catch {
|
|
1506
|
+
Object.defineProperty(next, Symbol.toStringTag, { value: this[Symbol.toStringTag] });
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1489
1509
|
return next;
|
|
1490
1510
|
}
|
|
1491
1511
|
this.cursor = $mol_wire_cursor.final;
|
|
@@ -2049,6 +2069,17 @@ var $;
|
|
|
2049
2069
|
;
|
|
2050
2070
|
"use strict";
|
|
2051
2071
|
|
|
2072
|
+
;
|
|
2073
|
+
"use strict";
|
|
2074
|
+
var $;
|
|
2075
|
+
(function ($) {
|
|
2076
|
+
function $mol_dom_serialize(node) {
|
|
2077
|
+
const serializer = new $mol_dom_context.XMLSerializer;
|
|
2078
|
+
return serializer.serializeToString(node);
|
|
2079
|
+
}
|
|
2080
|
+
$.$mol_dom_serialize = $mol_dom_serialize;
|
|
2081
|
+
})($ || ($ = {}));
|
|
2082
|
+
|
|
2052
2083
|
;
|
|
2053
2084
|
"use strict";
|
|
2054
2085
|
var $;
|
|
@@ -2206,6 +2237,19 @@ var $;
|
|
|
2206
2237
|
"!");
|
|
2207
2238
|
$mol_assert_equal(dom.outerHTML, '<div>hello<strong>world</strong>!</div>');
|
|
2208
2239
|
},
|
|
2240
|
+
'Make fragment'() {
|
|
2241
|
+
const dom = $mol_jsx($mol_jsx_frag, null,
|
|
2242
|
+
$mol_jsx("br", null),
|
|
2243
|
+
$mol_jsx("hr", null));
|
|
2244
|
+
$mol_assert_equal($mol_dom_serialize(dom), '<br xmlns="http://www.w3.org/1999/xhtml" /><hr xmlns="http://www.w3.org/1999/xhtml" />');
|
|
2245
|
+
},
|
|
2246
|
+
'Spread fragment'() {
|
|
2247
|
+
const dom = $mol_jsx("div", null,
|
|
2248
|
+
$mol_jsx($mol_jsx_frag, null,
|
|
2249
|
+
$mol_jsx("br", null),
|
|
2250
|
+
$mol_jsx("hr", null)));
|
|
2251
|
+
$mol_assert_equal(dom.outerHTML, '<div><br><hr></div>');
|
|
2252
|
+
},
|
|
2209
2253
|
'Function as component'() {
|
|
2210
2254
|
const Button = (props, target) => {
|
|
2211
2255
|
return $mol_jsx("button", { title: props.hint }, target());
|