mol_plot_all 1.2.1646 → 1.2.1648

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/web.js CHANGED
@@ -437,6 +437,14 @@ var $;
437
437
  $.$mol_func_name_from = $mol_func_name_from;
438
438
  })($ || ($ = {}));
439
439
 
440
+ ;
441
+ "use strict";
442
+ var $;
443
+ (function ($) {
444
+ $.$mol_key_handle = Symbol.for('$mol_key_handle');
445
+ $.$mol_key_store = new WeakMap();
446
+ })($ || ($ = {}));
447
+
440
448
  ;
441
449
  "use strict";
442
450
  var $;
@@ -473,6 +481,9 @@ var $;
473
481
  static toJSON() {
474
482
  return this.toString();
475
483
  }
484
+ static [$mol_key_handle]() {
485
+ return this.toString();
486
+ }
476
487
  destructor() { }
477
488
  static destructor() { }
478
489
  [Symbol.dispose]() {
@@ -1254,46 +1265,50 @@ var $;
1254
1265
  "use strict";
1255
1266
  var $;
1256
1267
  (function ($) {
1257
- $.$mol_key_store = new WeakMap();
1258
1268
  const TypedArray = Object.getPrototypeOf(Uint8Array);
1259
1269
  function $mol_key(value) {
1260
- if (typeof value === 'bigint')
1261
- return value.toString() + 'n';
1262
- if (typeof value === 'symbol')
1263
- return value.description;
1264
- if (!value)
1265
- return JSON.stringify(value);
1266
- if (typeof value !== 'object' && typeof value !== 'function')
1267
- return JSON.stringify(value);
1268
- return JSON.stringify(value, (field, value) => {
1270
+ primitives: {
1269
1271
  if (typeof value === 'bigint')
1270
1272
  return value.toString() + 'n';
1271
1273
  if (typeof value === 'symbol')
1272
- return value.description;
1274
+ return `Symbol(${value.description})`;
1273
1275
  if (!value)
1274
- return value;
1276
+ return JSON.stringify(value);
1275
1277
  if (typeof value !== 'object' && typeof value !== 'function')
1276
- return value;
1278
+ return JSON.stringify(value);
1279
+ }
1280
+ caching: {
1281
+ let key = $mol_key_store.get(value);
1282
+ if (key)
1283
+ return key;
1284
+ }
1285
+ objects: {
1286
+ if (value instanceof TypedArray) {
1287
+ return `${value[Symbol.toStringTag]}([${[...value].map(v => $mol_key(v))}])`;
1288
+ }
1277
1289
  if (Array.isArray(value))
1278
- return value;
1279
- const proto = Reflect.getPrototypeOf(value);
1280
- if (!proto)
1281
- return value;
1282
- if (Reflect.getPrototypeOf(proto) === null)
1283
- return value;
1284
- if ('toJSON' in value)
1285
- return value;
1290
+ return `[${value.map(v => $mol_key(v))}]`;
1286
1291
  if (value instanceof RegExp)
1287
1292
  return value.toString();
1288
- if (value instanceof TypedArray)
1289
- return [...value];
1290
- let key = $.$mol_key_store.get(value);
1291
- if (key)
1292
- return key;
1293
- key = $mol_guid();
1294
- $.$mol_key_store.set(value, key);
1293
+ if (value instanceof Date)
1294
+ return `Date(${value.valueOf()})`;
1295
+ }
1296
+ structures: {
1297
+ const proto = Reflect.getPrototypeOf(value);
1298
+ if (!proto || !Reflect.getPrototypeOf(proto)) {
1299
+ return `{${Object.entries(value).map(([k, v]) => JSON.stringify(k) + ':' + $mol_key(v))}}`;
1300
+ }
1301
+ }
1302
+ handlers: {
1303
+ if ($mol_key_handle in value) {
1304
+ return value[$mol_key_handle]();
1305
+ }
1306
+ }
1307
+ containers: {
1308
+ const key = JSON.stringify('#' + $mol_guid());
1309
+ $mol_key_store.set(value, key);
1295
1310
  return key;
1296
- });
1311
+ }
1297
1312
  }
1298
1313
  $.$mol_key = $mol_key;
1299
1314
  })($ || ($ = {}));
@@ -1813,8 +1828,15 @@ var $;
1813
1828
  (this.host ?? this.task)[this.field()] = null;
1814
1829
  }
1815
1830
  else {
1816
- ;
1817
- (this.host ?? this.task)[this.field()].delete($mol_key(this.args[0]));
1831
+ const key = $mol_key(this.args[0]);
1832
+ const map = (this.host ?? this.task)[this.field()];
1833
+ if (!map.has(key))
1834
+ this.$.$mol_log3_warn({
1835
+ place: this,
1836
+ message: 'Absent key on destruction',
1837
+ hint: 'Check for $mol_key(key) is not changed',
1838
+ });
1839
+ map.delete(key);
1818
1840
  }
1819
1841
  }
1820
1842
  put(next) {