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