mol_wire_dom 0.0.1484 → 0.0.1486
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 +8 -4
- package/node.d.ts.map +1 -1
- package/node.deps.json +1 -1
- package/node.js +132 -15
- package/node.js.map +1 -1
- package/node.mjs +132 -15
- package/node.test.js +146 -37
- package/node.test.js.map +1 -1
- package/package.json +3 -2
- package/web.d.ts +8 -4
- package/web.d.ts.map +1 -1
- package/web.deps.json +1 -1
- package/web.js +143 -14
- package/web.js.map +1 -1
- package/web.mjs +143 -14
- package/web.test.js +14 -22
- package/web.test.js.map +1 -1
package/node.mjs
CHANGED
@@ -152,6 +152,16 @@ var $;
|
|
152
152
|
$.$mol_wire_affected = [];
|
153
153
|
})($ || ($ = {}));
|
154
154
|
|
155
|
+
;
|
156
|
+
"use strict";
|
157
|
+
var $;
|
158
|
+
(function ($) {
|
159
|
+
function $mol_fail_hidden(error) {
|
160
|
+
throw error;
|
161
|
+
}
|
162
|
+
$.$mol_fail_hidden = $mol_fail_hidden;
|
163
|
+
})($ || ($ = {}));
|
164
|
+
|
155
165
|
;
|
156
166
|
"use strict";
|
157
167
|
var $;
|
@@ -163,6 +173,17 @@ var $;
|
|
163
173
|
$.$mol_dev_format_register = $mol_dev_format_register;
|
164
174
|
$.$mol_dev_format_head = Symbol('$mol_dev_format_head');
|
165
175
|
$.$mol_dev_format_body = Symbol('$mol_dev_format_body');
|
176
|
+
function $mol_dev_format_button(label, click) {
|
177
|
+
return $mol_dev_format_auto({
|
178
|
+
[$.$mol_dev_format_head]() {
|
179
|
+
return $mol_dev_format_span({ color: 'cornflowerblue' }, label);
|
180
|
+
},
|
181
|
+
[$.$mol_dev_format_body]() {
|
182
|
+
Promise.resolve().then(click);
|
183
|
+
return $mol_dev_format_span({});
|
184
|
+
}
|
185
|
+
});
|
186
|
+
}
|
166
187
|
$mol_dev_format_register({
|
167
188
|
header: (val, config = false) => {
|
168
189
|
if (config)
|
@@ -180,13 +201,41 @@ var $;
|
|
180
201
|
if (typeof val === 'function') {
|
181
202
|
return $mol_dev_format_native(val);
|
182
203
|
}
|
204
|
+
if (Error.isError(val)) {
|
205
|
+
return $mol_dev_format_span({}, $mol_dev_format_native(val), ' ', $mol_dev_format_button('throw', () => $mol_fail_hidden(val)));
|
206
|
+
}
|
207
|
+
if (val instanceof Promise) {
|
208
|
+
return $.$mol_dev_format_shade($mol_dev_format_native(val), ' ', val[Symbol.toStringTag] ?? '');
|
209
|
+
}
|
183
210
|
if (Symbol.toStringTag in val) {
|
184
211
|
return $mol_dev_format_native(val);
|
185
212
|
}
|
186
213
|
return null;
|
187
214
|
},
|
188
|
-
hasBody: val =>
|
189
|
-
|
215
|
+
hasBody: (val, config = false) => {
|
216
|
+
if (config)
|
217
|
+
return false;
|
218
|
+
if (!val)
|
219
|
+
return false;
|
220
|
+
if (val[$.$mol_dev_format_body])
|
221
|
+
return true;
|
222
|
+
return false;
|
223
|
+
},
|
224
|
+
body: (val, config = false) => {
|
225
|
+
if (config)
|
226
|
+
return null;
|
227
|
+
if (!val)
|
228
|
+
return null;
|
229
|
+
if ($.$mol_dev_format_body in val) {
|
230
|
+
try {
|
231
|
+
return val[$.$mol_dev_format_body]();
|
232
|
+
}
|
233
|
+
catch (error) {
|
234
|
+
return $.$mol_dev_format_accent($mol_dev_format_native(val), '💨', $mol_dev_format_native(error), '');
|
235
|
+
}
|
236
|
+
}
|
237
|
+
return null;
|
238
|
+
},
|
190
239
|
});
|
191
240
|
function $mol_dev_format_native(obj) {
|
192
241
|
if (typeof obj === 'undefined')
|
@@ -252,6 +301,69 @@ var $;
|
|
252
301
|
$.$mol_dev_format_indent = $.$mol_dev_format_div.bind(null, {
|
253
302
|
'margin-left': '13px'
|
254
303
|
});
|
304
|
+
class Stack extends Array {
|
305
|
+
toString() {
|
306
|
+
return this.join('\n');
|
307
|
+
}
|
308
|
+
}
|
309
|
+
class Call extends Object {
|
310
|
+
type;
|
311
|
+
function;
|
312
|
+
method;
|
313
|
+
eval;
|
314
|
+
source;
|
315
|
+
offset;
|
316
|
+
pos;
|
317
|
+
object;
|
318
|
+
flags;
|
319
|
+
[Symbol.toStringTag];
|
320
|
+
constructor(call) {
|
321
|
+
super();
|
322
|
+
this.type = call.getTypeName() ?? '';
|
323
|
+
this.function = call.getFunctionName() ?? '';
|
324
|
+
this.method = call.getMethodName() ?? '';
|
325
|
+
if (this.method === this.function)
|
326
|
+
this.method = '';
|
327
|
+
this.pos = [call.getEnclosingLineNumber() ?? 0, call.getEnclosingColumnNumber() ?? 0];
|
328
|
+
this.eval = call.getEvalOrigin() ?? '';
|
329
|
+
this.source = call.getScriptNameOrSourceURL() ?? '';
|
330
|
+
this.object = call.getThis();
|
331
|
+
this.offset = call.getPosition();
|
332
|
+
const flags = [];
|
333
|
+
if (call.isAsync())
|
334
|
+
flags.push('async');
|
335
|
+
if (call.isConstructor())
|
336
|
+
flags.push('constructor');
|
337
|
+
if (call.isEval())
|
338
|
+
flags.push('eval');
|
339
|
+
if (call.isNative())
|
340
|
+
flags.push('native');
|
341
|
+
if (call.isPromiseAll())
|
342
|
+
flags.push('PromiseAll');
|
343
|
+
if (call.isToplevel())
|
344
|
+
flags.push('top');
|
345
|
+
this.flags = flags;
|
346
|
+
const type = this.type ? this.type + '.' : '';
|
347
|
+
const func = this.function || '<anon>';
|
348
|
+
const method = this.method ? ' [' + this.method + '] ' : '';
|
349
|
+
this[Symbol.toStringTag] = `${type}${func}${method}`;
|
350
|
+
}
|
351
|
+
[Symbol.toPrimitive]() {
|
352
|
+
return this.toString();
|
353
|
+
}
|
354
|
+
toString() {
|
355
|
+
const object = this.object || '';
|
356
|
+
const label = this[Symbol.toStringTag];
|
357
|
+
const source = `${this.source}:${this.pos.join(':')} #${this.offset}`;
|
358
|
+
return `\tat ${object}${label} (${source})`;
|
359
|
+
}
|
360
|
+
[$.$mol_dev_format_head]() {
|
361
|
+
return $.$mol_dev_format_div({}, $mol_dev_format_native(this), $.$mol_dev_format_shade(' '), ...this.object ? [
|
362
|
+
$mol_dev_format_native(this.object),
|
363
|
+
] : [], ...this.method ? [$.$mol_dev_format_shade(' ', ' [', this.method, ']')] : [], $.$mol_dev_format_shade(' ', this.flags.join(', ')));
|
364
|
+
}
|
365
|
+
}
|
366
|
+
Error.prepareStackTrace ??= (error, stack) => new Stack(...stack.map(call => new Call(call)));
|
255
367
|
})($ || ($ = {}));
|
256
368
|
|
257
369
|
;
|
@@ -493,16 +605,6 @@ var $;
|
|
493
605
|
$.$mol_owning_catch = $mol_owning_catch;
|
494
606
|
})($ || ($ = {}));
|
495
607
|
|
496
|
-
;
|
497
|
-
"use strict";
|
498
|
-
var $;
|
499
|
-
(function ($) {
|
500
|
-
function $mol_fail_hidden(error) {
|
501
|
-
throw error;
|
502
|
-
}
|
503
|
-
$.$mol_fail_hidden = $mol_fail_hidden;
|
504
|
-
})($ || ($ = {}));
|
505
|
-
|
506
608
|
;
|
507
609
|
"use strict";
|
508
610
|
|
@@ -991,7 +1093,7 @@ var $;
|
|
991
1093
|
if (left instanceof RegExp)
|
992
1094
|
return left.source === right.source && left.flags === right.flags;
|
993
1095
|
if (left instanceof Error)
|
994
|
-
return left.message === right.message && left.stack
|
1096
|
+
return left.message === right.message && $mol_compare_deep(left.stack, right.stack);
|
995
1097
|
let left_cache = $.$mol_compare_deep_cache.get(left);
|
996
1098
|
if (left_cache) {
|
997
1099
|
const right_cache = left_cache.get(right);
|
@@ -1753,6 +1855,21 @@ var $;
|
|
1753
1855
|
$.$mol_fail_catch = $mol_fail_catch;
|
1754
1856
|
})($ || ($ = {}));
|
1755
1857
|
|
1858
|
+
;
|
1859
|
+
"use strict";
|
1860
|
+
var $;
|
1861
|
+
(function ($) {
|
1862
|
+
function $mol_try(handler) {
|
1863
|
+
try {
|
1864
|
+
return handler();
|
1865
|
+
}
|
1866
|
+
catch (error) {
|
1867
|
+
return error;
|
1868
|
+
}
|
1869
|
+
}
|
1870
|
+
$.$mol_try = $mol_try;
|
1871
|
+
})($ || ($ = {}));
|
1872
|
+
|
1756
1873
|
;
|
1757
1874
|
"use strict";
|
1758
1875
|
var $;
|
@@ -1762,7 +1879,7 @@ var $;
|
|
1762
1879
|
return false;
|
1763
1880
|
if (!$mol_fail_catch(error))
|
1764
1881
|
return false;
|
1765
|
-
|
1882
|
+
$mol_try(() => { $mol_fail_hidden(error); });
|
1766
1883
|
return true;
|
1767
1884
|
}
|
1768
1885
|
$.$mol_fail_log = $mol_fail_log;
|
@@ -1982,7 +2099,7 @@ var $;
|
|
1982
2099
|
get: () => stack_get() + '\n' + [
|
1983
2100
|
this.cause ?? 'no cause',
|
1984
2101
|
...this.errors.flatMap(e => [
|
1985
|
-
e.stack,
|
2102
|
+
String(e.stack),
|
1986
2103
|
...e instanceof $mol_error_mix || !e.cause ? [] : [e.cause]
|
1987
2104
|
])
|
1988
2105
|
].map(frame_normalize).join('\n')
|
package/node.test.js
CHANGED
@@ -143,6 +143,16 @@ var $;
|
|
143
143
|
$.$mol_wire_affected = [];
|
144
144
|
})($ || ($ = {}));
|
145
145
|
|
146
|
+
;
|
147
|
+
"use strict";
|
148
|
+
var $;
|
149
|
+
(function ($) {
|
150
|
+
function $mol_fail_hidden(error) {
|
151
|
+
throw error;
|
152
|
+
}
|
153
|
+
$.$mol_fail_hidden = $mol_fail_hidden;
|
154
|
+
})($ || ($ = {}));
|
155
|
+
|
146
156
|
;
|
147
157
|
"use strict";
|
148
158
|
var $;
|
@@ -154,6 +164,17 @@ var $;
|
|
154
164
|
$.$mol_dev_format_register = $mol_dev_format_register;
|
155
165
|
$.$mol_dev_format_head = Symbol('$mol_dev_format_head');
|
156
166
|
$.$mol_dev_format_body = Symbol('$mol_dev_format_body');
|
167
|
+
function $mol_dev_format_button(label, click) {
|
168
|
+
return $mol_dev_format_auto({
|
169
|
+
[$.$mol_dev_format_head]() {
|
170
|
+
return $mol_dev_format_span({ color: 'cornflowerblue' }, label);
|
171
|
+
},
|
172
|
+
[$.$mol_dev_format_body]() {
|
173
|
+
Promise.resolve().then(click);
|
174
|
+
return $mol_dev_format_span({});
|
175
|
+
}
|
176
|
+
});
|
177
|
+
}
|
157
178
|
$mol_dev_format_register({
|
158
179
|
header: (val, config = false) => {
|
159
180
|
if (config)
|
@@ -171,13 +192,41 @@ var $;
|
|
171
192
|
if (typeof val === 'function') {
|
172
193
|
return $mol_dev_format_native(val);
|
173
194
|
}
|
195
|
+
if (Error.isError(val)) {
|
196
|
+
return $mol_dev_format_span({}, $mol_dev_format_native(val), ' ', $mol_dev_format_button('throw', () => $mol_fail_hidden(val)));
|
197
|
+
}
|
198
|
+
if (val instanceof Promise) {
|
199
|
+
return $.$mol_dev_format_shade($mol_dev_format_native(val), ' ', val[Symbol.toStringTag] ?? '');
|
200
|
+
}
|
174
201
|
if (Symbol.toStringTag in val) {
|
175
202
|
return $mol_dev_format_native(val);
|
176
203
|
}
|
177
204
|
return null;
|
178
205
|
},
|
179
|
-
hasBody: val =>
|
180
|
-
|
206
|
+
hasBody: (val, config = false) => {
|
207
|
+
if (config)
|
208
|
+
return false;
|
209
|
+
if (!val)
|
210
|
+
return false;
|
211
|
+
if (val[$.$mol_dev_format_body])
|
212
|
+
return true;
|
213
|
+
return false;
|
214
|
+
},
|
215
|
+
body: (val, config = false) => {
|
216
|
+
if (config)
|
217
|
+
return null;
|
218
|
+
if (!val)
|
219
|
+
return null;
|
220
|
+
if ($.$mol_dev_format_body in val) {
|
221
|
+
try {
|
222
|
+
return val[$.$mol_dev_format_body]();
|
223
|
+
}
|
224
|
+
catch (error) {
|
225
|
+
return $.$mol_dev_format_accent($mol_dev_format_native(val), '💨', $mol_dev_format_native(error), '');
|
226
|
+
}
|
227
|
+
}
|
228
|
+
return null;
|
229
|
+
},
|
181
230
|
});
|
182
231
|
function $mol_dev_format_native(obj) {
|
183
232
|
if (typeof obj === 'undefined')
|
@@ -243,6 +292,69 @@ var $;
|
|
243
292
|
$.$mol_dev_format_indent = $.$mol_dev_format_div.bind(null, {
|
244
293
|
'margin-left': '13px'
|
245
294
|
});
|
295
|
+
class Stack extends Array {
|
296
|
+
toString() {
|
297
|
+
return this.join('\n');
|
298
|
+
}
|
299
|
+
}
|
300
|
+
class Call extends Object {
|
301
|
+
type;
|
302
|
+
function;
|
303
|
+
method;
|
304
|
+
eval;
|
305
|
+
source;
|
306
|
+
offset;
|
307
|
+
pos;
|
308
|
+
object;
|
309
|
+
flags;
|
310
|
+
[Symbol.toStringTag];
|
311
|
+
constructor(call) {
|
312
|
+
super();
|
313
|
+
this.type = call.getTypeName() ?? '';
|
314
|
+
this.function = call.getFunctionName() ?? '';
|
315
|
+
this.method = call.getMethodName() ?? '';
|
316
|
+
if (this.method === this.function)
|
317
|
+
this.method = '';
|
318
|
+
this.pos = [call.getEnclosingLineNumber() ?? 0, call.getEnclosingColumnNumber() ?? 0];
|
319
|
+
this.eval = call.getEvalOrigin() ?? '';
|
320
|
+
this.source = call.getScriptNameOrSourceURL() ?? '';
|
321
|
+
this.object = call.getThis();
|
322
|
+
this.offset = call.getPosition();
|
323
|
+
const flags = [];
|
324
|
+
if (call.isAsync())
|
325
|
+
flags.push('async');
|
326
|
+
if (call.isConstructor())
|
327
|
+
flags.push('constructor');
|
328
|
+
if (call.isEval())
|
329
|
+
flags.push('eval');
|
330
|
+
if (call.isNative())
|
331
|
+
flags.push('native');
|
332
|
+
if (call.isPromiseAll())
|
333
|
+
flags.push('PromiseAll');
|
334
|
+
if (call.isToplevel())
|
335
|
+
flags.push('top');
|
336
|
+
this.flags = flags;
|
337
|
+
const type = this.type ? this.type + '.' : '';
|
338
|
+
const func = this.function || '<anon>';
|
339
|
+
const method = this.method ? ' [' + this.method + '] ' : '';
|
340
|
+
this[Symbol.toStringTag] = `${type}${func}${method}`;
|
341
|
+
}
|
342
|
+
[Symbol.toPrimitive]() {
|
343
|
+
return this.toString();
|
344
|
+
}
|
345
|
+
toString() {
|
346
|
+
const object = this.object || '';
|
347
|
+
const label = this[Symbol.toStringTag];
|
348
|
+
const source = `${this.source}:${this.pos.join(':')} #${this.offset}`;
|
349
|
+
return `\tat ${object}${label} (${source})`;
|
350
|
+
}
|
351
|
+
[$.$mol_dev_format_head]() {
|
352
|
+
return $.$mol_dev_format_div({}, $mol_dev_format_native(this), $.$mol_dev_format_shade(' '), ...this.object ? [
|
353
|
+
$mol_dev_format_native(this.object),
|
354
|
+
] : [], ...this.method ? [$.$mol_dev_format_shade(' ', ' [', this.method, ']')] : [], $.$mol_dev_format_shade(' ', this.flags.join(', ')));
|
355
|
+
}
|
356
|
+
}
|
357
|
+
Error.prepareStackTrace ??= (error, stack) => new Stack(...stack.map(call => new Call(call)));
|
246
358
|
})($ || ($ = {}));
|
247
359
|
|
248
360
|
;
|
@@ -484,16 +596,6 @@ var $;
|
|
484
596
|
$.$mol_owning_catch = $mol_owning_catch;
|
485
597
|
})($ || ($ = {}));
|
486
598
|
|
487
|
-
;
|
488
|
-
"use strict";
|
489
|
-
var $;
|
490
|
-
(function ($) {
|
491
|
-
function $mol_fail_hidden(error) {
|
492
|
-
throw error;
|
493
|
-
}
|
494
|
-
$.$mol_fail_hidden = $mol_fail_hidden;
|
495
|
-
})($ || ($ = {}));
|
496
|
-
|
497
599
|
;
|
498
600
|
"use strict";
|
499
601
|
|
@@ -982,7 +1084,7 @@ var $;
|
|
982
1084
|
if (left instanceof RegExp)
|
983
1085
|
return left.source === right.source && left.flags === right.flags;
|
984
1086
|
if (left instanceof Error)
|
985
|
-
return left.message === right.message && left.stack
|
1087
|
+
return left.message === right.message && $mol_compare_deep(left.stack, right.stack);
|
986
1088
|
let left_cache = $.$mol_compare_deep_cache.get(left);
|
987
1089
|
if (left_cache) {
|
988
1090
|
const right_cache = left_cache.get(right);
|
@@ -1744,6 +1846,21 @@ var $;
|
|
1744
1846
|
$.$mol_fail_catch = $mol_fail_catch;
|
1745
1847
|
})($ || ($ = {}));
|
1746
1848
|
|
1849
|
+
;
|
1850
|
+
"use strict";
|
1851
|
+
var $;
|
1852
|
+
(function ($) {
|
1853
|
+
function $mol_try(handler) {
|
1854
|
+
try {
|
1855
|
+
return handler();
|
1856
|
+
}
|
1857
|
+
catch (error) {
|
1858
|
+
return error;
|
1859
|
+
}
|
1860
|
+
}
|
1861
|
+
$.$mol_try = $mol_try;
|
1862
|
+
})($ || ($ = {}));
|
1863
|
+
|
1747
1864
|
;
|
1748
1865
|
"use strict";
|
1749
1866
|
var $;
|
@@ -1753,7 +1870,7 @@ var $;
|
|
1753
1870
|
return false;
|
1754
1871
|
if (!$mol_fail_catch(error))
|
1755
1872
|
return false;
|
1756
|
-
|
1873
|
+
$mol_try(() => { $mol_fail_hidden(error); });
|
1757
1874
|
return true;
|
1758
1875
|
}
|
1759
1876
|
$.$mol_fail_log = $mol_fail_log;
|
@@ -1973,7 +2090,7 @@ var $;
|
|
1973
2090
|
get: () => stack_get() + '\n' + [
|
1974
2091
|
this.cause ?? 'no cause',
|
1975
2092
|
...this.errors.flatMap(e => [
|
1976
|
-
e.stack,
|
2093
|
+
String(e.stack),
|
1977
2094
|
...e instanceof $mol_error_mix || !e.cause ? [] : [e.cause]
|
1978
2095
|
])
|
1979
2096
|
].map(frame_normalize).join('\n')
|
@@ -2554,6 +2671,17 @@ var $;
|
|
2554
2671
|
$.$mol_test_complete = $mol_test_complete;
|
2555
2672
|
})($ || ($ = {}));
|
2556
2673
|
|
2674
|
+
;
|
2675
|
+
"use strict";
|
2676
|
+
var $;
|
2677
|
+
(function ($) {
|
2678
|
+
$mol_test({
|
2679
|
+
'return result without errors'() {
|
2680
|
+
$mol_assert_equal($mol_try(() => false), false);
|
2681
|
+
},
|
2682
|
+
});
|
2683
|
+
})($ || ($ = {}));
|
2684
|
+
|
2557
2685
|
;
|
2558
2686
|
"use strict";
|
2559
2687
|
var $;
|
@@ -3445,7 +3573,7 @@ var $;
|
|
3445
3573
|
catch (error) {
|
3446
3574
|
$.$mol_fail = fail;
|
3447
3575
|
if (typeof ErrorRight === 'string') {
|
3448
|
-
$mol_assert_equal(error.message, ErrorRight);
|
3576
|
+
$mol_assert_equal(error.message ?? error, ErrorRight);
|
3449
3577
|
}
|
3450
3578
|
else {
|
3451
3579
|
$mol_assert_equal(error instanceof ErrorRight, true);
|
@@ -3469,7 +3597,7 @@ var $;
|
|
3469
3597
|
continue;
|
3470
3598
|
if (!$mol_compare_deep(args[i], args[j]))
|
3471
3599
|
continue;
|
3472
|
-
$mol_fail(new Error(`
|
3600
|
+
return $mol_fail(new Error(`Uniquesess assertion failure`, { cause: { [i]: args[i], [i]: args[i] } }));
|
3473
3601
|
}
|
3474
3602
|
}
|
3475
3603
|
}
|
@@ -3480,29 +3608,10 @@ var $;
|
|
3480
3608
|
continue;
|
3481
3609
|
if (args[0] instanceof $mol_dom_context.Element && args[i] instanceof $mol_dom_context.Element && args[0].outerHTML === args[i].outerHTML)
|
3482
3610
|
continue;
|
3483
|
-
return $mol_fail(new Error(`args[0]
|
3611
|
+
return $mol_fail(new Error(`Equality assertion failure`, { cause: { 0: args[0], [i]: args[i] } }));
|
3484
3612
|
}
|
3485
3613
|
}
|
3486
3614
|
$.$mol_assert_equal = $mol_assert_equal;
|
3487
|
-
const print = (val) => {
|
3488
|
-
if (!val)
|
3489
|
-
return val;
|
3490
|
-
if (typeof val === 'bigint')
|
3491
|
-
return String(val) + 'n';
|
3492
|
-
if (typeof val === 'symbol')
|
3493
|
-
return `Symbol(${val.description})`;
|
3494
|
-
if (typeof val !== 'object')
|
3495
|
-
return val;
|
3496
|
-
if ('outerHTML' in val)
|
3497
|
-
return val.outerHTML;
|
3498
|
-
try {
|
3499
|
-
return JSON.stringify(val, (k, v) => typeof v === 'bigint' ? String(v) : v, '\t');
|
3500
|
-
}
|
3501
|
-
catch (error) {
|
3502
|
-
console.error(error);
|
3503
|
-
return val;
|
3504
|
-
}
|
3505
|
-
};
|
3506
3615
|
})($ || ($ = {}));
|
3507
3616
|
|
3508
3617
|
;
|