mol_plot_all 1.2.506 → 1.2.508

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
@@ -2109,43 +2109,55 @@ var $;
2109
2109
  let current = proto;
2110
2110
  const classes = [];
2111
2111
  while (current) {
2112
- classes.push(current.constructor);
2112
+ if (current.constructor.name !== classes.at(-1)?.name) {
2113
+ classes.push(current.constructor);
2114
+ }
2113
2115
  if (!(current instanceof $mol_view))
2114
2116
  break;
2115
2117
  current = Object.getPrototypeOf(current);
2116
2118
  }
2117
2119
  return classes;
2118
2120
  }
2121
+ static _view_names;
2122
+ static view_names(suffix) {
2123
+ let cache = Reflect.getOwnPropertyDescriptor(this, '_view_names')?.value;
2124
+ if (!cache)
2125
+ cache = this._view_names = new Map;
2126
+ const cached = cache.get(suffix);
2127
+ if (cached)
2128
+ return cached;
2129
+ const names = [];
2130
+ const suffix2 = '_' + suffix[0].toLowerCase() + suffix.substring(1);
2131
+ for (const Class of this.view_classes()) {
2132
+ if (suffix in Class.prototype)
2133
+ names.push(this.$.$mol_func_name(Class) + suffix2);
2134
+ else
2135
+ break;
2136
+ }
2137
+ cache.set(suffix, names);
2138
+ return names;
2139
+ }
2119
2140
  view_names_owned() {
2120
2141
  const names = [];
2121
2142
  let owner = $mol_owning_get(this);
2122
- if (owner?.host instanceof $mol_view) {
2123
- const suffix = owner.task.name.trim();
2124
- const suffix2 = '_' + suffix[0].toLowerCase() + suffix.substring(1);
2125
- for (let Class of owner.host.constructor.view_classes()) {
2126
- if (suffix in Class.prototype)
2127
- names.push(this.$.$mol_func_name(Class) + suffix2);
2128
- else
2129
- break;
2130
- }
2131
- for (let prefix of owner.host.view_names_owned()) {
2132
- names.push(prefix + suffix2);
2133
- }
2143
+ if (!(owner?.host instanceof $mol_view))
2144
+ return names;
2145
+ const suffix = owner.task.name.trim();
2146
+ const suffix2 = '_' + suffix[0].toLowerCase() + suffix.substring(1);
2147
+ names.push(...owner.host.constructor.view_names(suffix));
2148
+ for (let prefix of owner.host.view_names_owned()) {
2149
+ names.push(prefix + suffix2);
2134
2150
  }
2135
2151
  return names;
2136
2152
  }
2137
2153
  view_names() {
2138
- const names = [];
2139
- for (let name of this.view_names_owned()) {
2140
- if (names.indexOf(name) < 0)
2141
- names.push(name);
2142
- }
2154
+ const names = new Set();
2155
+ for (let name of this.view_names_owned())
2156
+ names.add(name);
2143
2157
  for (let Class of this.constructor.view_classes()) {
2144
2158
  const name = this.$.$mol_func_name(Class);
2145
- if (!name)
2146
- continue;
2147
- if (names.indexOf(name) < 0)
2148
- names.push(name);
2159
+ if (name)
2160
+ names.add(name);
2149
2161
  }
2150
2162
  return names;
2151
2163
  }