mol_plot_all 1.2.507 → 1.2.509

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.test.js CHANGED
@@ -2586,43 +2586,55 @@ var $;
2586
2586
  let current = proto;
2587
2587
  const classes = [];
2588
2588
  while (current) {
2589
- classes.push(current.constructor);
2589
+ if (current.constructor.name !== classes.at(-1)?.name) {
2590
+ classes.push(current.constructor);
2591
+ }
2590
2592
  if (!(current instanceof $mol_view))
2591
2593
  break;
2592
2594
  current = Object.getPrototypeOf(current);
2593
2595
  }
2594
2596
  return classes;
2595
2597
  }
2598
+ static _view_names;
2599
+ static view_names(suffix) {
2600
+ let cache = Reflect.getOwnPropertyDescriptor(this, '_view_names')?.value;
2601
+ if (!cache)
2602
+ cache = this._view_names = new Map;
2603
+ const cached = cache.get(suffix);
2604
+ if (cached)
2605
+ return cached;
2606
+ const names = [];
2607
+ const suffix2 = '_' + suffix[0].toLowerCase() + suffix.substring(1);
2608
+ for (const Class of this.view_classes()) {
2609
+ if (suffix in Class.prototype)
2610
+ names.push(this.$.$mol_func_name(Class) + suffix2);
2611
+ else
2612
+ break;
2613
+ }
2614
+ cache.set(suffix, names);
2615
+ return names;
2616
+ }
2596
2617
  view_names_owned() {
2597
2618
  const names = [];
2598
2619
  let owner = $mol_owning_get(this);
2599
- if (owner?.host instanceof $mol_view) {
2600
- const suffix = owner.task.name.trim();
2601
- const suffix2 = '_' + suffix[0].toLowerCase() + suffix.substring(1);
2602
- for (let Class of owner.host.constructor.view_classes()) {
2603
- if (suffix in Class.prototype)
2604
- names.push(this.$.$mol_func_name(Class) + suffix2);
2605
- else
2606
- break;
2607
- }
2608
- for (let prefix of owner.host.view_names_owned()) {
2609
- names.push(prefix + suffix2);
2610
- }
2620
+ if (!(owner?.host instanceof $mol_view))
2621
+ return names;
2622
+ const suffix = owner.task.name.trim();
2623
+ const suffix2 = '_' + suffix[0].toLowerCase() + suffix.substring(1);
2624
+ names.push(...owner.host.constructor.view_names(suffix));
2625
+ for (let prefix of owner.host.view_names_owned()) {
2626
+ names.push(prefix + suffix2);
2611
2627
  }
2612
2628
  return names;
2613
2629
  }
2614
2630
  view_names() {
2615
- const names = [];
2616
- for (let name of this.view_names_owned()) {
2617
- if (names.indexOf(name) < 0)
2618
- names.push(name);
2619
- }
2631
+ const names = new Set();
2632
+ for (let name of this.view_names_owned())
2633
+ names.add(name);
2620
2634
  for (let Class of this.constructor.view_classes()) {
2621
2635
  const name = this.$.$mol_func_name(Class);
2622
- if (!name)
2623
- continue;
2624
- if (names.indexOf(name) < 0)
2625
- names.push(name);
2636
+ if (name)
2637
+ names.add(name);
2626
2638
  }
2627
2639
  return names;
2628
2640
  }