mol_mutable 0.0.731 → 0.0.733
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 -22
- 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,13 +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
|
-
|
|
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
|
+
}
|
|
1269
1277
|
}
|
|
1270
1278
|
}
|
|
1271
1279
|
catch (error) {
|
|
@@ -1275,21 +1283,20 @@ var $;
|
|
|
1275
1283
|
else {
|
|
1276
1284
|
result = new Error(String(error), { cause: error });
|
|
1277
1285
|
}
|
|
1278
|
-
if ($mol_promise_like(result)
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
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
|
+
}
|
|
1283
1298
|
}
|
|
1284
1299
|
}
|
|
1285
|
-
if ($mol_promise_like(result) && !handled.has(result)) {
|
|
1286
|
-
result = Object.assign(result, {
|
|
1287
|
-
destructor: result['destructor'] ?? (() => { })
|
|
1288
|
-
});
|
|
1289
|
-
handled.add(result);
|
|
1290
|
-
const error = new Error(`Promise in ${this}`);
|
|
1291
|
-
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
1292
|
-
}
|
|
1293
1300
|
if (!$mol_promise_like(result)) {
|
|
1294
1301
|
this.track_cut();
|
|
1295
1302
|
}
|
|
@@ -1349,6 +1356,12 @@ var $;
|
|
|
1349
1356
|
};
|
|
1350
1357
|
});
|
|
1351
1358
|
}
|
|
1359
|
+
destructor() {
|
|
1360
|
+
super.destructor();
|
|
1361
|
+
if ($mol_owning_check(this, this.cache)) {
|
|
1362
|
+
this.cache.destructor();
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1352
1365
|
}
|
|
1353
1366
|
$.$mol_wire_fiber = $mol_wire_fiber;
|
|
1354
1367
|
})($ || ($ = {}));
|
|
@@ -1461,7 +1474,8 @@ var $;
|
|
|
1461
1474
|
$$.$mol_log3_warn({
|
|
1462
1475
|
place: '$mol_wire_task',
|
|
1463
1476
|
message: `Non idempotency`,
|
|
1464
|
-
|
|
1477
|
+
sub,
|
|
1478
|
+
pubs: [...sub?.pub_list ?? [], existen],
|
|
1465
1479
|
next,
|
|
1466
1480
|
hint: 'Ignore it',
|
|
1467
1481
|
});
|
|
@@ -1484,6 +1498,14 @@ var $;
|
|
|
1484
1498
|
this.cursor = $mol_wire_cursor.fresh;
|
|
1485
1499
|
if (next !== prev)
|
|
1486
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
|
+
}
|
|
1487
1509
|
return next;
|
|
1488
1510
|
}
|
|
1489
1511
|
this.cursor = $mol_wire_cursor.final;
|
|
@@ -2047,6 +2069,17 @@ var $;
|
|
|
2047
2069
|
;
|
|
2048
2070
|
"use strict";
|
|
2049
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
|
+
|
|
2050
2083
|
;
|
|
2051
2084
|
"use strict";
|
|
2052
2085
|
var $;
|
|
@@ -2204,6 +2237,19 @@ var $;
|
|
|
2204
2237
|
"!");
|
|
2205
2238
|
$mol_assert_equal(dom.outerHTML, '<div>hello<strong>world</strong>!</div>');
|
|
2206
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
|
+
},
|
|
2207
2253
|
'Function as component'() {
|
|
2208
2254
|
const Button = (props, target) => {
|
|
2209
2255
|
return $mol_jsx("button", { title: props.hint }, target());
|