drugflow-molstar 0.3.77 → 0.4.1

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.
Files changed (250) hide show
  1. package/build/drugflow-molstar-0.4.1.css +1 -0
  2. package/build/drugflow-molstar-component-0.4.1.js +25 -0
  3. package/build/drugflow-molstar-plugin-0.4.1.js +2 -0
  4. package/build/drugflow-molstar-plugin-0.4.1.js.LICENSE.txt +64 -0
  5. package/lib/alphafold-transparency.js +58 -125
  6. package/lib/contact.d.ts +15 -6
  7. package/lib/contact.js +71 -66
  8. package/lib/custom-events.js +16 -16
  9. package/lib/domain-annotations/behavior.js +20 -24
  10. package/lib/domain-annotations/color.d.ts +1 -1
  11. package/lib/domain-annotations/color.js +23 -22
  12. package/lib/domain-annotations/prop.d.ts +3 -3
  13. package/lib/domain-annotations/prop.js +54 -76
  14. package/lib/drugflow-molstar-component-build-0.3.78.js +2 -0
  15. package/lib/drugflow-molstar-component-build-0.4.1.js +2 -0
  16. package/lib/helpers.d.ts +4 -4
  17. package/lib/helpers.js +94 -99
  18. package/lib/index.js +1785 -2608
  19. package/lib/labels.d.ts +1 -1
  20. package/lib/labels.js +20 -23
  21. package/lib/loci-details.d.ts +2 -2
  22. package/lib/loci-details.js +26 -29
  23. package/lib/sifts-mapping.js +30 -34
  24. package/lib/sifts-mappings-behaviour.js +26 -30
  25. package/lib/spec.d.ts +1 -1
  26. package/lib/spec.js +50 -38
  27. package/lib/structure_contact3d.d.ts +13 -4
  28. package/lib/structure_contact3d.js +25 -46
  29. package/lib/subscribe-events.js +17 -17
  30. package/lib/superposition-export.js +100 -144
  31. package/lib/superposition-focus-representation.d.ts +1 -1
  32. package/lib/superposition-focus-representation.js +74 -112
  33. package/lib/superposition-sifts-mapping.d.ts +1 -1
  34. package/lib/superposition-sifts-mapping.js +56 -62
  35. package/lib/superposition.d.ts +2 -2
  36. package/lib/superposition.js +490 -726
  37. package/lib/ui/alphafold-superposition.d.ts +8 -9
  38. package/lib/ui/alphafold-superposition.js +96 -120
  39. package/lib/ui/alphafold-tranparency.d.ts +1 -2
  40. package/lib/ui/alphafold-tranparency.js +27 -43
  41. package/lib/ui/annotation-controls.d.ts +2 -3
  42. package/lib/ui/annotation-controls.js +81 -87
  43. package/lib/ui/export-superposition.js +33 -51
  44. package/lib/ui/pdbe-left-panel.d.ts +3 -3
  45. package/lib/ui/pdbe-left-panel.js +82 -106
  46. package/lib/ui/pdbe-screenshot-controls.d.ts +1 -1
  47. package/lib/ui/pdbe-screenshot-controls.js +54 -83
  48. package/lib/ui/pdbe-structure-controls.d.ts +4 -5
  49. package/lib/ui/pdbe-structure-controls.js +34 -57
  50. package/lib/ui/pdbe-viewport-controls.d.ts +1 -2
  51. package/lib/ui/pdbe-viewport-controls.js +23 -29
  52. package/lib/ui/segment-tree.d.ts +1 -2
  53. package/lib/ui/segment-tree.js +438 -590
  54. package/lib/ui/superposition-components.d.ts +1 -2
  55. package/lib/ui/superposition-components.js +196 -266
  56. package/lib/ui/superposition-viewport.d.ts +1 -2
  57. package/lib/ui/superposition-viewport.js +11 -18
  58. package/package.json +7 -4
  59. package/build/drugflow-molstar-0.3.62.css +0 -1
  60. package/build/drugflow-molstar-0.3.77.css +0 -1
  61. package/build/drugflow-molstar-component-0.3.62.js +0 -25
  62. package/build/drugflow-molstar-component-0.3.77.js +0 -25
  63. package/build/drugflow-molstar-light.css +0 -1
  64. package/build/drugflow-molstar-plugin-0.3.62.js +0 -2
  65. package/build/drugflow-molstar-plugin-0.3.62.js.LICENSE.txt +0 -39
  66. package/build/drugflow-molstar-plugin-0.3.77.js +0 -2
  67. package/build/drugflow-molstar-plugin-0.3.77.js.LICENSE.txt +0 -39
  68. package/lib/drugflow-molstar-component-build-0.1.2.js +0 -4268
  69. package/lib/drugflow-molstar-component-build-0.1.2.js.map +0 -1
  70. package/lib/drugflow-molstar-component-build-0.1.3.js +0 -2
  71. package/lib/drugflow-molstar-component-build-0.1.4.js +0 -2
  72. package/lib/drugflow-molstar-component-build-0.1.4.js.LICENSE.txt +0 -24
  73. package/lib/drugflow-molstar-component-build-0.1.5.js +0 -2
  74. package/lib/drugflow-molstar-component-build-0.1.5.js.LICENSE.txt +0 -24
  75. package/lib/drugflow-molstar-component-build-0.1.6.js +0 -2
  76. package/lib/drugflow-molstar-component-build-0.1.6.js.LICENSE.txt +0 -24
  77. package/lib/drugflow-molstar-component-build-0.2.10.js +0 -2
  78. package/lib/drugflow-molstar-component-build-0.2.10.js.LICENSE.txt +0 -24
  79. package/lib/drugflow-molstar-component-build-0.2.2.js +0 -2
  80. package/lib/drugflow-molstar-component-build-0.2.2.js.LICENSE.txt +0 -24
  81. package/lib/drugflow-molstar-component-build-0.2.3.js +0 -2
  82. package/lib/drugflow-molstar-component-build-0.2.3.js.LICENSE.txt +0 -24
  83. package/lib/drugflow-molstar-component-build-0.2.4.js +0 -2
  84. package/lib/drugflow-molstar-component-build-0.2.4.js.LICENSE.txt +0 -24
  85. package/lib/drugflow-molstar-component-build-0.2.5.js +0 -2
  86. package/lib/drugflow-molstar-component-build-0.2.5.js.LICENSE.txt +0 -24
  87. package/lib/drugflow-molstar-component-build-0.2.6.js +0 -2
  88. package/lib/drugflow-molstar-component-build-0.2.6.js.LICENSE.txt +0 -24
  89. package/lib/drugflow-molstar-component-build-0.2.7.js +0 -2
  90. package/lib/drugflow-molstar-component-build-0.2.7.js.LICENSE.txt +0 -24
  91. package/lib/drugflow-molstar-component-build-0.2.9.js +0 -2
  92. package/lib/drugflow-molstar-component-build-0.2.9.js.LICENSE.txt +0 -24
  93. package/lib/drugflow-molstar-component-build-0.3.1.js +0 -2
  94. package/lib/drugflow-molstar-component-build-0.3.1.js.LICENSE.txt +0 -24
  95. package/lib/drugflow-molstar-component-build-0.3.10.js +0 -2
  96. package/lib/drugflow-molstar-component-build-0.3.10.js.LICENSE.txt +0 -24
  97. package/lib/drugflow-molstar-component-build-0.3.11.js +0 -2
  98. package/lib/drugflow-molstar-component-build-0.3.11.js.LICENSE.txt +0 -24
  99. package/lib/drugflow-molstar-component-build-0.3.12.js +0 -2
  100. package/lib/drugflow-molstar-component-build-0.3.12.js.LICENSE.txt +0 -24
  101. package/lib/drugflow-molstar-component-build-0.3.13.js +0 -2
  102. package/lib/drugflow-molstar-component-build-0.3.13.js.LICENSE.txt +0 -24
  103. package/lib/drugflow-molstar-component-build-0.3.14.js +0 -2
  104. package/lib/drugflow-molstar-component-build-0.3.14.js.LICENSE.txt +0 -24
  105. package/lib/drugflow-molstar-component-build-0.3.15.js +0 -2
  106. package/lib/drugflow-molstar-component-build-0.3.15.js.LICENSE.txt +0 -24
  107. package/lib/drugflow-molstar-component-build-0.3.16.js +0 -2
  108. package/lib/drugflow-molstar-component-build-0.3.16.js.LICENSE.txt +0 -24
  109. package/lib/drugflow-molstar-component-build-0.3.17.js +0 -2
  110. package/lib/drugflow-molstar-component-build-0.3.17.js.LICENSE.txt +0 -24
  111. package/lib/drugflow-molstar-component-build-0.3.18.js +0 -2
  112. package/lib/drugflow-molstar-component-build-0.3.18.js.LICENSE.txt +0 -24
  113. package/lib/drugflow-molstar-component-build-0.3.19.js +0 -2
  114. package/lib/drugflow-molstar-component-build-0.3.19.js.LICENSE.txt +0 -24
  115. package/lib/drugflow-molstar-component-build-0.3.2.js +0 -2
  116. package/lib/drugflow-molstar-component-build-0.3.2.js.LICENSE.txt +0 -24
  117. package/lib/drugflow-molstar-component-build-0.3.20.js +0 -2
  118. package/lib/drugflow-molstar-component-build-0.3.20.js.LICENSE.txt +0 -24
  119. package/lib/drugflow-molstar-component-build-0.3.21.js +0 -2
  120. package/lib/drugflow-molstar-component-build-0.3.21.js.LICENSE.txt +0 -24
  121. package/lib/drugflow-molstar-component-build-0.3.22.js +0 -2
  122. package/lib/drugflow-molstar-component-build-0.3.22.js.LICENSE.txt +0 -24
  123. package/lib/drugflow-molstar-component-build-0.3.23.js +0 -2
  124. package/lib/drugflow-molstar-component-build-0.3.23.js.LICENSE.txt +0 -24
  125. package/lib/drugflow-molstar-component-build-0.3.24.js +0 -2
  126. package/lib/drugflow-molstar-component-build-0.3.24.js.LICENSE.txt +0 -24
  127. package/lib/drugflow-molstar-component-build-0.3.25.js +0 -2
  128. package/lib/drugflow-molstar-component-build-0.3.25.js.LICENSE.txt +0 -24
  129. package/lib/drugflow-molstar-component-build-0.3.26.js +0 -2
  130. package/lib/drugflow-molstar-component-build-0.3.26.js.LICENSE.txt +0 -24
  131. package/lib/drugflow-molstar-component-build-0.3.27.js +0 -2
  132. package/lib/drugflow-molstar-component-build-0.3.27.js.LICENSE.txt +0 -24
  133. package/lib/drugflow-molstar-component-build-0.3.28.js +0 -2
  134. package/lib/drugflow-molstar-component-build-0.3.28.js.LICENSE.txt +0 -24
  135. package/lib/drugflow-molstar-component-build-0.3.29.js +0 -2
  136. package/lib/drugflow-molstar-component-build-0.3.29.js.LICENSE.txt +0 -24
  137. package/lib/drugflow-molstar-component-build-0.3.3.js +0 -2
  138. package/lib/drugflow-molstar-component-build-0.3.3.js.LICENSE.txt +0 -24
  139. package/lib/drugflow-molstar-component-build-0.3.30.js +0 -2
  140. package/lib/drugflow-molstar-component-build-0.3.30.js.LICENSE.txt +0 -24
  141. package/lib/drugflow-molstar-component-build-0.3.31.js +0 -2
  142. package/lib/drugflow-molstar-component-build-0.3.31.js.LICENSE.txt +0 -24
  143. package/lib/drugflow-molstar-component-build-0.3.32.js +0 -2
  144. package/lib/drugflow-molstar-component-build-0.3.32.js.LICENSE.txt +0 -24
  145. package/lib/drugflow-molstar-component-build-0.3.33.js +0 -2
  146. package/lib/drugflow-molstar-component-build-0.3.33.js.LICENSE.txt +0 -24
  147. package/lib/drugflow-molstar-component-build-0.3.34.js +0 -2
  148. package/lib/drugflow-molstar-component-build-0.3.34.js.LICENSE.txt +0 -24
  149. package/lib/drugflow-molstar-component-build-0.3.35.js +0 -2
  150. package/lib/drugflow-molstar-component-build-0.3.35.js.LICENSE.txt +0 -24
  151. package/lib/drugflow-molstar-component-build-0.3.36.js +0 -2
  152. package/lib/drugflow-molstar-component-build-0.3.36.js.LICENSE.txt +0 -24
  153. package/lib/drugflow-molstar-component-build-0.3.37.js +0 -2
  154. package/lib/drugflow-molstar-component-build-0.3.37.js.LICENSE.txt +0 -24
  155. package/lib/drugflow-molstar-component-build-0.3.38.js +0 -2
  156. package/lib/drugflow-molstar-component-build-0.3.38.js.LICENSE.txt +0 -24
  157. package/lib/drugflow-molstar-component-build-0.3.39.js +0 -2
  158. package/lib/drugflow-molstar-component-build-0.3.39.js.LICENSE.txt +0 -24
  159. package/lib/drugflow-molstar-component-build-0.3.4.js +0 -2
  160. package/lib/drugflow-molstar-component-build-0.3.4.js.LICENSE.txt +0 -24
  161. package/lib/drugflow-molstar-component-build-0.3.40.js +0 -2
  162. package/lib/drugflow-molstar-component-build-0.3.40.js.LICENSE.txt +0 -24
  163. package/lib/drugflow-molstar-component-build-0.3.41.js +0 -2
  164. package/lib/drugflow-molstar-component-build-0.3.41.js.LICENSE.txt +0 -24
  165. package/lib/drugflow-molstar-component-build-0.3.42.js +0 -2
  166. package/lib/drugflow-molstar-component-build-0.3.42.js.LICENSE.txt +0 -24
  167. package/lib/drugflow-molstar-component-build-0.3.43.js +0 -2
  168. package/lib/drugflow-molstar-component-build-0.3.43.js.LICENSE.txt +0 -24
  169. package/lib/drugflow-molstar-component-build-0.3.44.js +0 -2
  170. package/lib/drugflow-molstar-component-build-0.3.44.js.LICENSE.txt +0 -24
  171. package/lib/drugflow-molstar-component-build-0.3.46.js +0 -2
  172. package/lib/drugflow-molstar-component-build-0.3.46.js.LICENSE.txt +0 -24
  173. package/lib/drugflow-molstar-component-build-0.3.47.js +0 -2
  174. package/lib/drugflow-molstar-component-build-0.3.47.js.LICENSE.txt +0 -24
  175. package/lib/drugflow-molstar-component-build-0.3.48.js +0 -2
  176. package/lib/drugflow-molstar-component-build-0.3.48.js.LICENSE.txt +0 -24
  177. package/lib/drugflow-molstar-component-build-0.3.49.js +0 -2
  178. package/lib/drugflow-molstar-component-build-0.3.49.js.LICENSE.txt +0 -24
  179. package/lib/drugflow-molstar-component-build-0.3.5.js +0 -2
  180. package/lib/drugflow-molstar-component-build-0.3.5.js.LICENSE.txt +0 -24
  181. package/lib/drugflow-molstar-component-build-0.3.50.js +0 -2
  182. package/lib/drugflow-molstar-component-build-0.3.50.js.LICENSE.txt +0 -24
  183. package/lib/drugflow-molstar-component-build-0.3.51.js +0 -2
  184. package/lib/drugflow-molstar-component-build-0.3.51.js.LICENSE.txt +0 -24
  185. package/lib/drugflow-molstar-component-build-0.3.52.js +0 -2
  186. package/lib/drugflow-molstar-component-build-0.3.52.js.LICENSE.txt +0 -24
  187. package/lib/drugflow-molstar-component-build-0.3.53.js +0 -2
  188. package/lib/drugflow-molstar-component-build-0.3.53.js.LICENSE.txt +0 -24
  189. package/lib/drugflow-molstar-component-build-0.3.54.js +0 -2
  190. package/lib/drugflow-molstar-component-build-0.3.54.js.LICENSE.txt +0 -24
  191. package/lib/drugflow-molstar-component-build-0.3.55.js +0 -2
  192. package/lib/drugflow-molstar-component-build-0.3.55.js.LICENSE.txt +0 -24
  193. package/lib/drugflow-molstar-component-build-0.3.56.js +0 -2
  194. package/lib/drugflow-molstar-component-build-0.3.56.js.LICENSE.txt +0 -24
  195. package/lib/drugflow-molstar-component-build-0.3.57.js +0 -2
  196. package/lib/drugflow-molstar-component-build-0.3.57.js.LICENSE.txt +0 -24
  197. package/lib/drugflow-molstar-component-build-0.3.58.js +0 -2
  198. package/lib/drugflow-molstar-component-build-0.3.58.js.LICENSE.txt +0 -24
  199. package/lib/drugflow-molstar-component-build-0.3.59.js +0 -2
  200. package/lib/drugflow-molstar-component-build-0.3.59.js.LICENSE.txt +0 -24
  201. package/lib/drugflow-molstar-component-build-0.3.6.js +0 -2
  202. package/lib/drugflow-molstar-component-build-0.3.6.js.LICENSE.txt +0 -24
  203. package/lib/drugflow-molstar-component-build-0.3.60.js +0 -2
  204. package/lib/drugflow-molstar-component-build-0.3.60.js.LICENSE.txt +0 -24
  205. package/lib/drugflow-molstar-component-build-0.3.61.js +0 -2
  206. package/lib/drugflow-molstar-component-build-0.3.61.js.LICENSE.txt +0 -24
  207. package/lib/drugflow-molstar-component-build-0.3.62.js +0 -2
  208. package/lib/drugflow-molstar-component-build-0.3.62.js.LICENSE.txt +0 -24
  209. package/lib/drugflow-molstar-component-build-0.3.63.js +0 -2
  210. package/lib/drugflow-molstar-component-build-0.3.63.js.LICENSE.txt +0 -24
  211. package/lib/drugflow-molstar-component-build-0.3.64.js +0 -2
  212. package/lib/drugflow-molstar-component-build-0.3.64.js.LICENSE.txt +0 -24
  213. package/lib/drugflow-molstar-component-build-0.3.65.js +0 -2
  214. package/lib/drugflow-molstar-component-build-0.3.65.js.LICENSE.txt +0 -24
  215. package/lib/drugflow-molstar-component-build-0.3.66.js +0 -2
  216. package/lib/drugflow-molstar-component-build-0.3.66.js.LICENSE.txt +0 -24
  217. package/lib/drugflow-molstar-component-build-0.3.67.js +0 -2
  218. package/lib/drugflow-molstar-component-build-0.3.67.js.LICENSE.txt +0 -24
  219. package/lib/drugflow-molstar-component-build-0.3.68.js +0 -2
  220. package/lib/drugflow-molstar-component-build-0.3.68.js.LICENSE.txt +0 -24
  221. package/lib/drugflow-molstar-component-build-0.3.69.js +0 -2
  222. package/lib/drugflow-molstar-component-build-0.3.69.js.LICENSE.txt +0 -24
  223. package/lib/drugflow-molstar-component-build-0.3.7.js +0 -2
  224. package/lib/drugflow-molstar-component-build-0.3.7.js.LICENSE.txt +0 -24
  225. package/lib/drugflow-molstar-component-build-0.3.70.js +0 -2
  226. package/lib/drugflow-molstar-component-build-0.3.70.js.LICENSE.txt +0 -24
  227. package/lib/drugflow-molstar-component-build-0.3.71.js +0 -2
  228. package/lib/drugflow-molstar-component-build-0.3.71.js.LICENSE.txt +0 -24
  229. package/lib/drugflow-molstar-component-build-0.3.72.js +0 -2
  230. package/lib/drugflow-molstar-component-build-0.3.72.js.LICENSE.txt +0 -24
  231. package/lib/drugflow-molstar-component-build-0.3.73.js +0 -2
  232. package/lib/drugflow-molstar-component-build-0.3.73.js.LICENSE.txt +0 -24
  233. package/lib/drugflow-molstar-component-build-0.3.74.js +0 -2
  234. package/lib/drugflow-molstar-component-build-0.3.74.js.LICENSE.txt +0 -24
  235. package/lib/drugflow-molstar-component-build-0.3.75.js +0 -2
  236. package/lib/drugflow-molstar-component-build-0.3.75.js.LICENSE.txt +0 -24
  237. package/lib/drugflow-molstar-component-build-0.3.76.js +0 -2
  238. package/lib/drugflow-molstar-component-build-0.3.76.js.LICENSE.txt +0 -24
  239. package/lib/drugflow-molstar-component-build-0.3.77.js +0 -2
  240. package/lib/drugflow-molstar-component-build-0.3.77.js.LICENSE.txt +0 -24
  241. package/lib/drugflow-molstar-component-build-0.3.8.js +0 -2
  242. package/lib/drugflow-molstar-component-build-0.3.8.js.LICENSE.txt +0 -24
  243. package/lib/drugflow-molstar-component-build-0.3.9.js +0 -2
  244. package/lib/drugflow-molstar-component-build-0.3.9.js.LICENSE.txt +0 -24
  245. package/lib/index2.d.ts +0 -1
  246. package/lib/index2.js +0 -1369
  247. package/lib/pdbe-molstar-component-build-3.1.2.js +0 -2
  248. package/lib/pdbe-molstar-component-build-3.1.2.js.LICENSE.txt +0 -24
  249. /package/lib/{drugflow-molstar-component-build-0.1.2.js.LICENSE.txt → drugflow-molstar-component-build-0.3.78.js.LICENSE.txt} +0 -0
  250. /package/lib/{drugflow-molstar-component-build-0.1.3.js.LICENSE.txt → drugflow-molstar-component-build-0.4.1.js.LICENSE.txt} +0 -0
@@ -1,602 +1,475 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SegmentTree = void 0;
4
- var tslib_1 = require("tslib");
5
- var jsx_runtime_1 = require("react/jsx-runtime");
6
- var operators_1 = require("rxjs/operators");
7
- var commands_1 = require("Molstar/mol-plugin/commands");
8
- var mol_state_1 = require("Molstar/mol-state");
9
- var base_1 = require("Molstar/mol-plugin-ui/base");
10
- var common_1 = require("Molstar/mol-plugin-ui/controls/common");
11
- var param_definition_1 = require("Molstar/mol-util/param-definition");
12
- var parameters_1 = require("Molstar/mol-plugin-ui/controls/parameters");
13
- var mol_state_2 = require("Molstar/mol-state");
14
- var superposition_1 = require("../superposition");
15
- var update_transform_1 = require("Molstar/mol-plugin-ui/state/update-transform");
16
- var icons_1 = require("Molstar/mol-plugin-ui/controls/icons");
17
- var lists_1 = require("Molstar/mol-util/color/lists");
18
- var color_1 = require("Molstar/mol-util/color");
19
- var builder_1 = require("Molstar/mol-script/language/builder");
20
- var rxjs_1 = require("rxjs");
21
- var transforms_1 = require("Molstar/mol-plugin-state/transforms");
22
- var superposition_2 = require("../superposition");
23
- var SuperpositionTag = 'SuperpositionTransform';
24
- var SegmentTree = /** @class */ (function (_super) {
25
- tslib_1.__extends(SegmentTree, _super);
26
- function SegmentTree() {
27
- var _this = _super !== null && _super.apply(this, arguments) || this;
28
- _this.getSegmentParams = function () {
29
- var customState = _this.customState;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const operators_1 = require("rxjs/operators");
6
+ const commands_1 = require("Molstar/mol-plugin/commands");
7
+ const mol_state_1 = require("Molstar/mol-state");
8
+ const base_1 = require("Molstar/mol-plugin-ui/base");
9
+ const common_1 = require("Molstar/mol-plugin-ui/controls/common");
10
+ const param_definition_1 = require("Molstar/mol-util/param-definition");
11
+ const parameters_1 = require("Molstar/mol-plugin-ui/controls/parameters");
12
+ const mol_state_2 = require("Molstar/mol-state");
13
+ const superposition_1 = require("../superposition");
14
+ const update_transform_1 = require("Molstar/mol-plugin-ui/state/update-transform");
15
+ const icons_1 = require("Molstar/mol-plugin-ui/controls/icons");
16
+ const lists_1 = require("Molstar/mol-util/color/lists");
17
+ const color_1 = require("Molstar/mol-util/color");
18
+ const builder_1 = require("Molstar/mol-script/language/builder");
19
+ const rxjs_1 = require("rxjs");
20
+ const transforms_1 = require("Molstar/mol-plugin-state/transforms");
21
+ const superposition_2 = require("../superposition");
22
+ const SuperpositionTag = 'SuperpositionTransform';
23
+ class SegmentTree extends base_1.PurePluginUIComponent {
24
+ constructor() {
25
+ super(...arguments);
26
+ this.getSegmentParams = () => {
27
+ const customState = this.customState;
30
28
  if (!customState.superpositionState || !customState.superpositionState.segmentData)
31
29
  return;
32
- var segmentData = customState.superpositionState.segmentData;
33
- var segmentArr = segmentData.map(function (segment, i) {
34
- var segmentLabel = "".concat(i + 1, " ( ").concat(segment.segment_start, " - ").concat(segment.segment_end, " )");
30
+ const segmentData = customState.superpositionState.segmentData;
31
+ const segmentArr = segmentData.map((segment, i) => {
32
+ const segmentLabel = `${i + 1} ( ${segment.segment_start} - ${segment.segment_end} )`;
35
33
  return [segmentLabel, segmentLabel];
36
34
  });
37
- var segmentOptions = {
35
+ const segmentOptions = {
38
36
  segment: param_definition_1.ParamDefinition.Select('', segmentArr, { label: 'Select Segment', description: 'Select segment to view its clusters below' })
39
37
  };
40
- var segmentIndex = customState.superpositionState.activeSegment - 1;
41
- _this.setState({ segment: {
38
+ const segmentIndex = customState.superpositionState.activeSegment - 1;
39
+ this.setState({ segment: {
42
40
  params: segmentOptions,
43
41
  value: { segment: segmentArr[segmentIndex][0] }
44
42
  } });
45
- _this.setState({ isBusy: false });
43
+ this.setState({ isBusy: false });
46
44
  };
47
- _this.updateSegment = function (val) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
48
- var customState, updatedParams;
49
- var _this = this;
50
- return tslib_1.__generator(this, function (_a) {
51
- if (!this.state.segment)
52
- return [2 /*return*/];
53
- customState = this.customState;
54
- customState.events.isBusy.next(true);
55
- // Hide pervious segement structures
56
- this.hideStructures(customState.superpositionState.activeSegment - 1);
57
- updatedParams = tslib_1.__assign({}, this.state.segment);
58
- updatedParams.value = val;
59
- this.setState({ segment: updatedParams });
60
- setTimeout(function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
61
- var updatedSegmentIndex;
62
- return tslib_1.__generator(this, function (_a) {
63
- switch (_a.label) {
64
- case 0:
65
- updatedSegmentIndex = parseInt(val.segment.split(' ')[0]);
66
- customState.superpositionState.activeSegment = updatedSegmentIndex;
67
- // Display current segment visible structures
68
- return [4 /*yield*/, this.displayStructures(customState.superpositionState.activeSegment - 1)];
69
- case 1:
70
- // Display current segment visible structures
71
- _a.sent();
72
- customState.events.isBusy.next(false);
73
- this.plugin.customState.events.segmentUpdate.next(true);
74
- return [2 /*return*/];
75
- }
76
- });
77
- }); }, 100);
78
- return [2 /*return*/, false];
79
- });
80
- }); };
81
- _this.hideStructures = function (segmentIndex) {
45
+ this.updateSegment = async (val) => {
46
+ if (!this.state.segment)
47
+ return;
48
+ const customState = this.customState;
49
+ customState.events.isBusy.next(true);
50
+ // Hide pervious segement structures
51
+ this.hideStructures(customState.superpositionState.activeSegment - 1);
52
+ // Set current segment params
53
+ const updatedParams = { ...this.state.segment };
54
+ updatedParams.value = val;
55
+ this.setState({ segment: updatedParams });
56
+ setTimeout(async () => {
57
+ const updatedSegmentIndex = parseInt(val.segment.split(' ')[0]);
58
+ customState.superpositionState.activeSegment = updatedSegmentIndex;
59
+ // Display current segment visible structures
60
+ await this.displayStructures(customState.superpositionState.activeSegment - 1);
61
+ customState.events.isBusy.next(false);
62
+ this.plugin.customState.events.segmentUpdate.next(true);
63
+ }, 100);
64
+ return false;
65
+ };
66
+ this.hideStructures = (segmentIndex) => {
82
67
  // clear selections
83
- _this.plugin.managers.interactivity.lociSelects.deselectAll();
68
+ this.plugin.managers.interactivity.lociSelects.deselectAll();
84
69
  // clear Focus
85
- _this.plugin.managers.structure.focus.clear();
70
+ this.plugin.managers.structure.focus.clear();
86
71
  // remove measurements
87
- var measurements = _this.plugin.managers.structure.measurement.state;
88
- var measureTypes = ['labels', 'distances', 'angles', 'dihedrals'];
89
- var measurementCell = void 0;
90
- measureTypes.forEach(function (type) {
72
+ const measurements = this.plugin.managers.structure.measurement.state;
73
+ const measureTypes = ['labels', 'distances', 'angles', 'dihedrals'];
74
+ let measurementCell = void 0;
75
+ measureTypes.forEach((type) => {
91
76
  if (measurementCell)
92
77
  return;
93
78
  if (measurements[type][0]) {
94
- measurementCell = _this.plugin.state.data.cells.get(measurements[type][0].transform.parent);
79
+ measurementCell = this.plugin.state.data.cells.get(measurements[type][0].transform.parent);
95
80
  }
96
81
  });
97
82
  if (measurementCell) {
98
- commands_1.PluginCommands.State.RemoveObject(_this.plugin, { state: measurementCell.parent, ref: measurementCell.transform.parent, removeParentGhosts: true });
83
+ commands_1.PluginCommands.State.RemoveObject(this.plugin, { state: measurementCell.parent, ref: measurementCell.transform.parent, removeParentGhosts: true });
99
84
  }
100
85
  // hide structures
101
- var customState = _this.customState;
86
+ const customState = this.customState;
102
87
  customState.superpositionState.visibleRefs[segmentIndex] = [];
103
- for (var _i = 0, _a = customState.superpositionState.loadedStructs[segmentIndex]; _i < _a.length; _i++) {
104
- var struct = _a[_i];
105
- var structRef = _this.customState.superpositionState.models[struct];
88
+ for (const struct of customState.superpositionState.loadedStructs[segmentIndex]) {
89
+ const structRef = this.customState.superpositionState.models[struct];
106
90
  if (structRef) {
107
- var structHierarchy = _this.plugin.managers.structure.hierarchy.current.refs.get(structRef);
91
+ const structHierarchy = this.plugin.managers.structure.hierarchy.current.refs.get(structRef);
108
92
  if (structHierarchy && structHierarchy.components) {
109
- for (var _b = 0, _c = structHierarchy.components; _b < _c.length; _b++) {
110
- var c = _c[_b];
93
+ for (const c of structHierarchy.components) {
111
94
  if (c && c.cell && !c.cell.state.isHidden) {
112
95
  customState.superpositionState.visibleRefs[segmentIndex].push(c.cell.transform.ref);
113
- commands_1.PluginCommands.State.ToggleVisibility(_this.plugin, { state: c.cell.parent, ref: c.cell.transform.ref });
96
+ commands_1.PluginCommands.State.ToggleVisibility(this.plugin, { state: c.cell.parent, ref: c.cell.transform.ref });
114
97
  }
115
98
  }
116
99
  }
117
100
  }
118
101
  }
119
102
  if (customState.superpositionState.alphafold.ref) {
120
- var afStr = _this.plugin.managers.structure.hierarchy.current.refs.get(customState.superpositionState.alphafold.ref);
103
+ const afStr = this.plugin.managers.structure.hierarchy.current.refs.get(customState.superpositionState.alphafold.ref);
121
104
  if (afStr && afStr.components) {
122
- for (var _d = 0, _e = afStr.components; _d < _e.length; _d++) {
123
- var c = _e[_d];
105
+ for (const c of afStr.components) {
124
106
  if (c && c.cell && !c.cell.state.isHidden) {
125
- commands_1.PluginCommands.State.ToggleVisibility(_this.plugin, { state: c.cell.parent, ref: c.cell.transform.ref });
107
+ commands_1.PluginCommands.State.ToggleVisibility(this.plugin, { state: c.cell.parent, ref: c.cell.transform.ref });
126
108
  }
127
109
  }
128
110
  }
129
111
  }
130
112
  };
131
- _this.displayStructures = function (segmentIndex) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
132
- var customState, spState, loadStrs_1, _i, _a, ref, cell, afStr, _b, _c, c;
133
- var _this = this;
134
- return tslib_1.__generator(this, function (_d) {
135
- switch (_d.label) {
136
- case 0:
137
- customState = this.customState;
138
- spState = customState.superpositionState;
139
- if (!(customState.superpositionState.visibleRefs[segmentIndex].length === 0)) return [3 /*break*/, 3];
140
- loadStrs_1 = [];
141
- customState.superpositionState.segmentData[segmentIndex].clusters.forEach(function (cluster) {
142
- var entryList = [cluster[0]];
143
- if (customState.initParams.superpositionParams && customState.initParams.superpositionParams.superposeAll) {
144
- entryList = cluster;
145
- }
146
- entryList.forEach(function (str) {
147
- var structStateId = "".concat(str.pdb_id, "_").concat(str.struct_asym_id);
148
- var structRef = customState.superpositionState.models[structStateId];
149
- if (structRef) {
150
- var cell = _this.plugin.state.data.cells.get(structRef);
151
- var isHidden = cell.state.isHidden ? true : false;
152
- if (isHidden) {
153
- commands_1.PluginCommands.State.ToggleVisibility(_this.plugin, { state: cell.parent, ref: structRef });
154
- // PluginCommands.State.ToggleVisibility(this.plugin, { state: cell.parent!, ref: cell.transform.parent });
155
- }
156
- }
157
- else {
158
- loadStrs_1.push(str);
159
- }
160
- });
161
- });
162
- commands_1.PluginCommands.Camera.Reset(this.plugin);
163
- if (!(loadStrs_1.length > 0)) return [3 /*break*/, 2];
164
- return [4 /*yield*/, (0, superposition_1.renderSuperposition)(this.plugin, segmentIndex, loadStrs_1)];
165
- case 1:
166
- _d.sent();
167
- commands_1.PluginCommands.Camera.Reset(this.plugin);
168
- _d.label = 2;
169
- case 2: return [3 /*break*/, 4];
170
- case 3:
171
- for (_i = 0, _a = customState.superpositionState.visibleRefs[segmentIndex]; _i < _a.length; _i++) {
172
- ref = _a[_i];
173
- cell = this.plugin.state.data.cells.get(ref);
174
- if (cell && cell.state.isHidden) {
175
- commands_1.PluginCommands.State.ToggleVisibility(this.plugin, { state: cell.parent, ref: ref });
113
+ this.displayStructures = async (segmentIndex) => {
114
+ const customState = this.customState;
115
+ const spState = customState.superpositionState;
116
+ if (customState.superpositionState.visibleRefs[segmentIndex].length === 0) {
117
+ let loadStrs = [];
118
+ customState.superpositionState.segmentData[segmentIndex].clusters.forEach((cluster) => {
119
+ let entryList = [cluster[0]];
120
+ if (customState.initParams.superpositionParams && customState.initParams.superpositionParams.superposeAll) {
121
+ entryList = cluster;
122
+ }
123
+ entryList.forEach((str) => {
124
+ const structStateId = `${str.pdb_id}_${str.struct_asym_id}`;
125
+ const structRef = customState.superpositionState.models[structStateId];
126
+ if (structRef) {
127
+ const cell = this.plugin.state.data.cells.get(structRef);
128
+ const isHidden = cell.state.isHidden ? true : false;
129
+ if (isHidden) {
130
+ commands_1.PluginCommands.State.ToggleVisibility(this.plugin, { state: cell.parent, ref: structRef });
131
+ // PluginCommands.State.ToggleVisibility(this.plugin, { state: cell.parent!, ref: cell.transform.parent });
176
132
  }
177
133
  }
178
- commands_1.PluginCommands.Camera.Reset(this.plugin);
179
- _d.label = 4;
180
- case 4:
181
- if (spState.alphafold.ref) {
182
- (0, superposition_2.superposeAf)(this.plugin, spState.alphafold.traceOnly);
183
- commands_1.PluginCommands.Camera.Reset(this.plugin);
134
+ else {
135
+ loadStrs.push(str);
184
136
  }
185
- if (spState.alphafold.ref && spState.alphafold.visibility[segmentIndex]) {
186
- afStr = this.plugin.managers.structure.hierarchy.current.refs.get(customState.superpositionState.alphafold.ref);
187
- if (afStr && afStr.components) {
188
- for (_b = 0, _c = afStr.components; _b < _c.length; _b++) {
189
- c = _c[_b];
190
- if (c && c.cell && c.cell.state.isHidden) {
191
- commands_1.PluginCommands.State.ToggleVisibility(this.plugin, { state: c.cell.parent, ref: c.cell.transform.ref });
192
- }
193
- }
194
- }
137
+ });
138
+ });
139
+ commands_1.PluginCommands.Camera.Reset(this.plugin);
140
+ if (loadStrs.length > 0) {
141
+ await (0, superposition_1.renderSuperposition)(this.plugin, segmentIndex, loadStrs);
142
+ commands_1.PluginCommands.Camera.Reset(this.plugin);
143
+ }
144
+ }
145
+ else {
146
+ for (const ref of customState.superpositionState.visibleRefs[segmentIndex]) {
147
+ const cell = this.plugin.state.data.cells.get(ref);
148
+ if (cell && cell.state.isHidden) {
149
+ commands_1.PluginCommands.State.ToggleVisibility(this.plugin, { state: cell.parent, ref });
150
+ }
151
+ }
152
+ commands_1.PluginCommands.Camera.Reset(this.plugin);
153
+ }
154
+ if (spState.alphafold.ref) {
155
+ (0, superposition_2.superposeAf)(this.plugin, spState.alphafold.traceOnly);
156
+ commands_1.PluginCommands.Camera.Reset(this.plugin);
157
+ }
158
+ if (spState.alphafold.ref && spState.alphafold.visibility[segmentIndex]) {
159
+ const afStr = this.plugin.managers.structure.hierarchy.current.refs.get(customState.superpositionState.alphafold.ref);
160
+ if (afStr && afStr.components) {
161
+ for (const c of afStr.components) {
162
+ if (c && c.cell && c.cell.state.isHidden) {
163
+ commands_1.PluginCommands.State.ToggleVisibility(this.plugin, { state: c.cell.parent, ref: c.cell.transform.ref });
195
164
  }
196
- return [2 /*return*/];
165
+ }
197
166
  }
198
- });
199
- }); };
200
- return _this;
167
+ }
168
+ };
201
169
  }
202
- SegmentTree.prototype.componentDidMount = function () {
203
- var _this = this;
204
- this.subscribe(this.plugin.customState.events.superpositionInit, function () {
205
- var customState = _this.customState;
170
+ componentDidMount() {
171
+ this.subscribe(this.plugin.customState.events.superpositionInit, () => {
172
+ const customState = this.customState;
206
173
  if (customState && !customState.superpositionError) {
207
- _this.getSegmentParams();
174
+ this.getSegmentParams();
208
175
  }
209
- _this.forceUpdate();
176
+ this.forceUpdate();
210
177
  });
211
- this.subscribe(this.plugin.customState.events.isBusy, function (e) {
212
- _this.setState({ isBusy: e });
178
+ this.subscribe(this.plugin.customState.events.isBusy, (e) => {
179
+ this.setState({ isBusy: e });
213
180
  if (e) {
214
- commands_1.PluginCommands.Toast.Show(_this.plugin, {
181
+ commands_1.PluginCommands.Toast.Show(this.plugin, {
215
182
  title: 'Process',
216
183
  message: 'Loading / computing large dataset!',
217
184
  key: 'is-busy-toast'
218
185
  });
219
186
  }
220
187
  else {
221
- commands_1.PluginCommands.Toast.Hide(_this.plugin, { key: 'is-busy-toast' });
188
+ commands_1.PluginCommands.Toast.Hide(this.plugin, { key: 'is-busy-toast' });
222
189
  }
223
190
  });
224
- this.subscribe(this.plugin.behaviors.layout.leftPanelTabName, function (e) {
191
+ this.subscribe(this.plugin.behaviors.layout.leftPanelTabName, (e) => {
225
192
  if (e !== 'segments')
226
193
  return;
227
- _this.getSegmentParams();
228
- _this.forceUpdate();
229
- });
230
- };
231
- Object.defineProperty(SegmentTree.prototype, "customState", {
232
- get: function () {
233
- return this.plugin.customState;
234
- },
235
- enumerable: false,
236
- configurable: true
237
- });
238
- SegmentTree.prototype.transform = function (s, matrix) {
239
- return tslib_1.__awaiter(this, void 0, void 0, function () {
240
- var r, o, params, b;
241
- return tslib_1.__generator(this, function (_a) {
242
- switch (_a.label) {
243
- case 0:
244
- r = mol_state_2.StateObjectRef.resolveAndCheck(this.plugin.state.data, s);
245
- if (!r)
246
- return [2 /*return*/];
247
- o = mol_state_2.StateSelection.findTagInSubtree(this.plugin.state.data.tree, r.transform.ref, SuperpositionTag);
248
- params = {
249
- transform: {
250
- name: 'matrix',
251
- params: { data: matrix, transpose: false }
252
- }
253
- };
254
- b = o
255
- ? this.plugin.state.data.build().to(o).update(params)
256
- : this.plugin.state.data.build().to(s)
257
- .insert(transforms_1.StateTransforms.Model.TransformStructureConformation, params, { tags: SuperpositionTag });
258
- return [4 /*yield*/, this.plugin.runTask(this.plugin.state.data.updateTree(b))];
259
- case 1:
260
- _a.sent();
261
- return [2 /*return*/];
262
- }
263
- });
194
+ this.getSegmentParams();
195
+ this.forceUpdate();
264
196
  });
265
- };
266
- SegmentTree.prototype.render = function () {
267
- var sectionHeader = (0, jsx_runtime_1.jsx)(common_1.SectionHeader, { title: "Structure clusters" });
268
- var customState = this.customState;
197
+ }
198
+ get customState() {
199
+ return this.plugin.customState;
200
+ }
201
+ async transform(s, matrix) {
202
+ const r = mol_state_2.StateObjectRef.resolveAndCheck(this.plugin.state.data, s);
203
+ if (!r)
204
+ return;
205
+ // TODO should find any TransformStructureConformation decorator instance
206
+ const o = mol_state_2.StateSelection.findTagInSubtree(this.plugin.state.data.tree, r.transform.ref, SuperpositionTag);
207
+ const params = {
208
+ transform: {
209
+ name: 'matrix',
210
+ params: { data: matrix, transpose: false }
211
+ }
212
+ };
213
+ // TODO add .insertOrUpdate to StateBuilder?
214
+ const b = o
215
+ ? this.plugin.state.data.build().to(o).update(params)
216
+ : this.plugin.state.data.build().to(s)
217
+ .insert(transforms_1.StateTransforms.Model.TransformStructureConformation, params, { tags: SuperpositionTag });
218
+ await this.plugin.runTask(this.plugin.state.data.updateTree(b));
219
+ }
220
+ render() {
221
+ let sectionHeader = (0, jsx_runtime_1.jsx)(common_1.SectionHeader, { title: `Structure clusters` });
222
+ const customState = this.customState;
269
223
  if (customState && customState.initParams && !customState.initParams.superposition) {
270
224
  return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [sectionHeader, (0, jsx_runtime_1.jsx)("div", { children: "Functionality unavailable!" })] });
271
225
  }
272
226
  else {
273
227
  if (customState && customState.initParams && customState.initParams.superposition) {
274
- sectionHeader = (0, jsx_runtime_1.jsx)(common_1.SectionHeader, { title: "Structure clusters - ".concat(customState.initParams.moleculeId) });
228
+ sectionHeader = (0, jsx_runtime_1.jsx)(common_1.SectionHeader, { title: `Structure clusters - ${customState.initParams.moleculeId}` });
275
229
  if (customState.superpositionError) {
276
- return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [sectionHeader, (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ style: { textAlign: 'center' } }, { children: customState.superpositionError }))] });
230
+ return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [sectionHeader, (0, jsx_runtime_1.jsx)("div", { style: { textAlign: 'center' }, children: customState.superpositionError })] });
277
231
  }
278
232
  else if (!customState.superpositionState || !customState.superpositionState.segmentData) {
279
- return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [sectionHeader, (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ style: { textAlign: 'center' } }, { children: "Loading Segment Data!" }))] });
233
+ return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [sectionHeader, (0, jsx_runtime_1.jsx)("div", { style: { textAlign: 'center' }, children: "Loading Segment Data!" })] });
280
234
  }
281
235
  }
282
236
  }
283
237
  if (this.state) {
284
- var segmentIndex_1 = parseInt(this.state.segment.value.segment.split(' ')[0]) - 1;
285
- var segmentData_1 = customState.superpositionState.segmentData;
286
- var fullSegmentRange = "( ".concat(segmentData_1[0].segment_start, " - ").concat(segmentData_1[segmentData_1.length - 1].segment_end, " )");
287
- sectionHeader = (0, jsx_runtime_1.jsx)(common_1.SectionHeader, { title: "Structure clusters ".concat(customState.initParams.moleculeId), desc: fullSegmentRange });
288
- return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [sectionHeader, (0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: this.state.segment.params, values: this.state.segment.value, onChangeValues: this.updateSegment, isDisabled: this.state.isBusy }), segmentData_1[segmentIndex_1].clusters.map(function (c, i) { return (0, jsx_runtime_1.jsx)(ClusterNode, { cluster: c, totalClusters: segmentData_1[segmentIndex_1].clusters.length, segmentIndex: segmentIndex_1, clusterIndex: i }, "cluster-".concat(segmentIndex_1, "-").concat(i)); })] });
238
+ const segmentIndex = parseInt(this.state.segment.value.segment.split(' ')[0]) - 1;
239
+ const segmentData = customState.superpositionState.segmentData;
240
+ const fullSegmentRange = `( ${segmentData[0].segment_start} - ${segmentData[segmentData.length - 1].segment_end} )`;
241
+ sectionHeader = (0, jsx_runtime_1.jsx)(common_1.SectionHeader, { title: `Structure clusters ${customState.initParams.moleculeId}`, desc: fullSegmentRange });
242
+ return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [sectionHeader, (0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: this.state.segment.params, values: this.state.segment.value, onChangeValues: this.updateSegment, isDisabled: this.state.isBusy }), segmentData[segmentIndex].clusters.map((c, i) => (0, jsx_runtime_1.jsx)(ClusterNode, { cluster: c, totalClusters: segmentData[segmentIndex].clusters.length, segmentIndex: segmentIndex, clusterIndex: i }, `cluster-${segmentIndex}-${i}`))] });
289
243
  }
290
244
  return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
291
- };
292
- return SegmentTree;
293
- }(base_1.PurePluginUIComponent));
245
+ }
246
+ }
294
247
  exports.SegmentTree = SegmentTree;
295
- var ClusterNode = /** @class */ (function (_super) {
296
- tslib_1.__extends(ClusterNode, _super);
297
- function ClusterNode() {
298
- var _this = _super !== null && _super.apply(this, arguments) || this;
299
- _this.state = {
248
+ class ClusterNode extends base_1.PluginUIComponent {
249
+ constructor() {
250
+ super(...arguments);
251
+ this.state = {
300
252
  isCollapsed: false,
301
253
  showAll: false,
302
254
  showNone: false,
303
255
  showSearch: false,
304
256
  isBusy: false,
305
- cluster: _this.props.cluster,
257
+ cluster: this.props.cluster,
306
258
  searchText: ''
307
259
  };
308
- _this.inputStream = new rxjs_1.Subject();
309
- _this.handleInputStream = function (inputStr) {
310
- _this.setState({ searchText: inputStr });
311
- var filteredRes = _this.props.cluster.filter(function (item) {
260
+ this.inputStream = new rxjs_1.Subject();
261
+ this.handleInputStream = (inputStr) => {
262
+ this.setState({ searchText: inputStr });
263
+ const filteredRes = this.props.cluster.filter((item) => {
312
264
  return item.pdb_id.toLowerCase().indexOf(inputStr.toLowerCase()) >= 0;
313
265
  });
314
- _this.setState({ cluster: filteredRes });
266
+ this.setState({ cluster: filteredRes });
315
267
  };
316
- _this.toggleExpanded = function (e) {
268
+ this.toggleExpanded = (e) => {
317
269
  e.preventDefault();
318
- _this.setState({ isCollapsed: !_this.state.isCollapsed });
270
+ this.setState({ isCollapsed: !this.state.isCollapsed });
319
271
  e.currentTarget.blur();
320
272
  };
321
- _this.selectAll = function (e) {
273
+ this.selectAll = (e) => {
322
274
  e.preventDefault();
323
- _this.setState({ showAll: !_this.state.showAll, showNone: false });
275
+ this.setState({ showAll: !this.state.showAll, showNone: false });
324
276
  e.currentTarget.blur();
325
277
  };
326
- _this.selectNone = function (e) {
278
+ this.selectNone = (e) => {
327
279
  e.preventDefault();
328
- _this.setState({ showAll: false, showNone: !_this.state.showNone });
280
+ this.setState({ showAll: false, showNone: !this.state.showNone });
329
281
  e.currentTarget.blur();
330
282
  };
331
- _this.applyAction = function (e) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
332
- var customState, currentState;
333
- var _this = this;
334
- return tslib_1.__generator(this, function (_a) {
335
- e.preventDefault();
336
- e.currentTarget.blur();
337
- customState = this.customState;
338
- customState.events.isBusy.next(true);
339
- currentState = tslib_1.__assign({}, this.state);
340
- this.setState({ showAll: false, showNone: false });
341
- setTimeout(function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
342
- var loadStrs, _a, _b, str, structStateId, structRef, cell, isHidden, e_1_1;
343
- var e_1, _c;
344
- return tslib_1.__generator(this, function (_d) {
345
- switch (_d.label) {
346
- case 0:
347
- loadStrs = [];
348
- _d.label = 1;
349
- case 1:
350
- _d.trys.push([1, 9, 10, 15]);
351
- _a = tslib_1.__asyncValues(this.state.cluster);
352
- _d.label = 2;
353
- case 2: return [4 /*yield*/, _a.next()];
354
- case 3:
355
- if (!(_b = _d.sent(), !_b.done)) return [3 /*break*/, 8];
356
- str = _b.value;
357
- structStateId = "".concat(str.pdb_id, "_").concat(str.struct_asym_id);
358
- structRef = undefined;
359
- if (customState && customState.superpositionState && customState.superpositionState.models[structStateId]) {
360
- structRef = this.customState.superpositionState.models[structStateId];
361
- }
362
- if (!structRef) return [3 /*break*/, 6];
363
- cell = this.plugin.state.data.cells.get(structRef);
364
- if (!cell) return [3 /*break*/, 5];
365
- isHidden = cell.state.isHidden ? true : false;
366
- if (!((isHidden && currentState.showAll) || (!isHidden && currentState.showNone))) return [3 /*break*/, 5];
367
- return [4 /*yield*/, commands_1.PluginCommands.State.ToggleVisibility(this.plugin, { state: cell.parent, ref: structRef })];
368
- case 4:
369
- _d.sent();
370
- _d.label = 5;
371
- case 5: return [3 /*break*/, 7];
372
- case 6:
373
- if (currentState.showAll)
374
- loadStrs.push(str);
375
- _d.label = 7;
376
- case 7: return [3 /*break*/, 2];
377
- case 8: return [3 /*break*/, 15];
378
- case 9:
379
- e_1_1 = _d.sent();
380
- e_1 = { error: e_1_1 };
381
- return [3 /*break*/, 15];
382
- case 10:
383
- _d.trys.push([10, , 13, 14]);
384
- if (!(_b && !_b.done && (_c = _a.return))) return [3 /*break*/, 12];
385
- return [4 /*yield*/, _c.call(_a)];
386
- case 11:
387
- _d.sent();
388
- _d.label = 12;
389
- case 12: return [3 /*break*/, 14];
390
- case 13:
391
- if (e_1) throw e_1.error;
392
- return [7 /*endfinally*/];
393
- case 14: return [7 /*endfinally*/];
394
- case 15:
395
- ;
396
- commands_1.PluginCommands.Camera.Reset(this.plugin);
397
- if (!(loadStrs.length > 0)) return [3 /*break*/, 17];
398
- return [4 /*yield*/, (0, superposition_1.renderSuperposition)(this.plugin, this.props.segmentIndex, loadStrs)];
399
- case 16:
400
- _d.sent();
401
- _d.label = 17;
402
- case 17:
403
- customState.events.isBusy.next(false);
404
- return [2 /*return*/];
283
+ this.applyAction = async (e) => {
284
+ e.preventDefault();
285
+ e.currentTarget.blur();
286
+ const customState = this.customState;
287
+ customState.events.isBusy.next(true);
288
+ const currentState = { ...this.state };
289
+ this.setState({ showAll: false, showNone: false });
290
+ setTimeout(async () => {
291
+ let loadStrs = [];
292
+ for await (const str of this.state.cluster) {
293
+ const structStateId = `${str.pdb_id}_${str.struct_asym_id}`;
294
+ let structRef = undefined;
295
+ if (customState && customState.superpositionState && customState.superpositionState.models[structStateId]) {
296
+ structRef = this.customState.superpositionState.models[structStateId];
297
+ }
298
+ if (structRef) {
299
+ const cell = this.plugin.state.data.cells.get(structRef);
300
+ if (cell) {
301
+ const isHidden = cell.state.isHidden ? true : false;
302
+ if ((isHidden && currentState.showAll) || (!isHidden && currentState.showNone)) {
303
+ await commands_1.PluginCommands.State.ToggleVisibility(this.plugin, { state: cell.parent, ref: structRef });
304
+ // await PluginCommands.State.ToggleVisibility(this.plugin, { state: cell.parent!, ref: cell.transform.parent });
305
+ }
405
306
  }
406
- });
407
- }); });
408
- return [2 /*return*/];
307
+ }
308
+ else {
309
+ if (currentState.showAll)
310
+ loadStrs.push(str);
311
+ }
312
+ }
313
+ ;
314
+ commands_1.PluginCommands.Camera.Reset(this.plugin);
315
+ if (loadStrs.length > 0) {
316
+ await (0, superposition_1.renderSuperposition)(this.plugin, this.props.segmentIndex, loadStrs);
317
+ }
318
+ customState.events.isBusy.next(false);
409
319
  });
410
- }); };
411
- _this.cancelAction = function (e) {
320
+ };
321
+ this.cancelAction = (e) => {
412
322
  e.preventDefault();
413
- _this.setState({ showAll: false, showNone: false });
323
+ this.setState({ showAll: false, showNone: false });
414
324
  e.currentTarget.blur();
415
325
  };
416
- _this.clearSearch = function (e) {
326
+ this.clearSearch = (e) => {
417
327
  e.preventDefault();
418
- _this.setState({ searchText: '' });
419
- _this.inputStream.next('');
328
+ this.setState({ searchText: '' });
329
+ this.inputStream.next('');
420
330
  e.currentTarget.blur();
421
331
  };
422
- return _this;
423
332
  }
424
- ClusterNode.prototype.componentDidMount = function () {
425
- var _this = this;
426
- this.subscribe(this.plugin.customState.events.isBusy, function (e) {
427
- _this.setState({ isBusy: e, showAll: false, showNone: false });
333
+ componentDidMount() {
334
+ this.subscribe(this.plugin.customState.events.isBusy, (e) => {
335
+ this.setState({ isBusy: e, showAll: false, showNone: false });
428
336
  });
429
- this.subscribe(this.inputStream.pipe((0, operators_1.debounceTime)(1000 / 24)), function (e) { return _this.handleInputStream(e); });
430
- };
431
- Object.defineProperty(ClusterNode.prototype, "customState", {
432
- get: function () {
433
- return this.plugin.customState;
434
- },
435
- enumerable: false,
436
- configurable: true
437
- });
438
- ClusterNode.prototype.render = function () {
439
- var _this = this;
440
- var customState = this.customState;
337
+ this.subscribe(this.inputStream.pipe((0, operators_1.debounceTime)(1000 / 24)), (e) => this.handleInputStream(e));
338
+ }
339
+ get customState() {
340
+ return this.plugin.customState;
341
+ }
342
+ render() {
343
+ const customState = this.customState;
441
344
  if (!customState.superpositionState || !customState.superpositionState.segmentData)
442
345
  return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
443
- var expand = (0, jsx_runtime_1.jsx)(common_1.IconButton, { svg: this.state.isCollapsed ? icons_1.ArrowRightSvg : icons_1.ArrowDropDownSvg, flex: '20px', onClick: this.toggleExpanded, transparent: true, disabled: this.state.isBusy, className: 'msp-no-hover-outline' });
444
- var title = "Segment ".concat(customState.superpositionState.activeSegment, " Cluster ").concat(this.props.clusterIndex + 1);
445
- var label = (0, jsx_runtime_1.jsxs)(common_1.Button, tslib_1.__assign({ className: "msp-btn-tree-label", noOverflow: true, title: title, disabled: this.state.isBusy }, { children: [(0, jsx_runtime_1.jsxs)("span", { children: ["Cluster ", this.props.clusterIndex + 1] }), " ", (0, jsx_runtime_1.jsxs)("small", { children: [this.state.cluster.length < this.props.cluster.length ? "".concat(this.state.cluster.length, " / ") : '', this.props.cluster.length, " chain", this.props.cluster.length > 1 ? 's' : ''] })] }));
446
- var selectionControls = (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(common_1.Button, tslib_1.__assign({ icon: icons_1.CheckSvg, flex: true, onClick: this.selectAll, style: { flex: '0 0 50px', textAlign: 'center', fontSize: '80%', color: '#9cacc3', padding: 0 }, disabled: this.state.isBusy, title: "Show all chains" }, { children: "All" })), (0, jsx_runtime_1.jsx)(common_1.Button, tslib_1.__assign({ icon: icons_1.CloseSvg, flex: true, onClick: this.selectNone, style: { flex: '0 0 50px', textAlign: 'center', fontSize: '80%', color: '#9cacc3', padding: 0 }, disabled: this.state.isBusy, title: "Hide all chains" }, { children: "None" }))] });
447
- var mainRow = (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: "msp-flex-row msp-tree-row", style: { marginTop: '10px' } }, { children: [expand, label, this.props.cluster.length > 1 && selectionControls] }));
448
- var searchControls = (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: 'msp-mapped-parameter-group', style: { fontSize: '90%' } }, { children: [(0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: 'msp-control-row msp-transform-header-brand-gray', style: { height: '33px', marginLeft: '30px' } }, { children: [(0, jsx_runtime_1.jsx)("span", tslib_1.__assign({ className: 'msp-control-row-label' }, { children: "Search PDB ID" })), (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: 'msp-control-row-ctrl' }, { children: (0, jsx_runtime_1.jsx)("input", { type: 'text', placeholder: 'Enter PDB ID..', disabled: this.state.isBusy, onChange: function (e) { return _this.inputStream.next(e.target.value); }, value: this.state.searchText, maxLength: 4 }) }))] })), (0, jsx_runtime_1.jsx)(common_1.IconButton, { svg: icons_1.CloseSvg, flex: true, onClick: this.clearSearch, style: { flex: '0 0 24px', padding: 0 }, disabled: this.state.isBusy || this.state.searchText === '', toggleState: this.state.searchText !== '', title: 'Clear search input' })] }));
449
- return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [mainRow, (this.state.showAll || this.state.showNone) && (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: "msp-control-row msp-transform-header-brand-".concat(this.state.showAll ? 'green' : 'red'), style: { display: 'flex', marginLeft: '20px', height: '35px' } }, { children: [(0, jsx_runtime_1.jsxs)("span", tslib_1.__assign({ className: 'msp-control-row-label', style: { flex: '1 1 auto', textAlign: 'left', fontSize: '85%' } }, { children: [this.state.showAll ? 'Display' : 'Hide', " ", this.state.cluster.length < this.props.cluster.length ? "".concat(this.state.cluster.length, " / ") : 'all ', this.props.cluster.length, " chains"] })), (0, jsx_runtime_1.jsx)(common_1.Button, tslib_1.__assign({ icon: icons_1.CheckSvg, flex: true, onClick: this.applyAction, style: { flex: '0 0 60px', textAlign: 'center', fontSize: '78%', color: '#9cacc3', padding: 0, margin: '0 1px' }, title: "Apply action" }, { children: "Apply" })), (0, jsx_runtime_1.jsx)(common_1.Button, tslib_1.__assign({ icon: icons_1.CloseSvg, flex: true, onClick: this.cancelAction, style: { flex: '0 0 60px', textAlign: 'center', fontSize: '78%', color: '#9cacc3', padding: 0, margin: '0 1px' }, title: "Cancel action" }, { children: "Cancel" }))] })) }), (!this.state.isCollapsed && this.props.cluster.length > 5) && searchControls, !this.state.isCollapsed && (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: 'msp-tree-updates-wrapper', style: { maxHeight: (this.props.totalClusters > 1) ? '330px' : '87%', overflowY: 'auto' } }, { children: this.state.cluster.map(function (s, i) { return (0, jsx_runtime_1.jsx)(StructureNode, { segmentIndex: _this.props.segmentIndex, structure: s, isRep: i === 0 ? true : false }, "str-".concat(s.pdb_id).concat(s.struct_asym_id).concat(i)); }) }))] });
450
- };
451
- return ClusterNode;
452
- }(base_1.PluginUIComponent));
453
- var StructureNode = /** @class */ (function (_super) {
454
- tslib_1.__extends(StructureNode, _super);
455
- function StructureNode() {
456
- var _this = _super !== null && _super.apply(this, arguments) || this;
457
- _this.state = {
346
+ const expand = (0, jsx_runtime_1.jsx)(common_1.IconButton, { svg: this.state.isCollapsed ? icons_1.ArrowRightSvg : icons_1.ArrowDropDownSvg, flex: '20px', onClick: this.toggleExpanded, transparent: true, disabled: this.state.isBusy, className: 'msp-no-hover-outline' });
347
+ const title = `Segment ${customState.superpositionState.activeSegment} Cluster ${this.props.clusterIndex + 1}`;
348
+ const label = (0, jsx_runtime_1.jsxs)(common_1.Button, { className: `msp-btn-tree-label`, noOverflow: true, title: title, disabled: this.state.isBusy, children: [(0, jsx_runtime_1.jsxs)("span", { children: ["Cluster ", this.props.clusterIndex + 1] }), " ", (0, jsx_runtime_1.jsxs)("small", { children: [this.state.cluster.length < this.props.cluster.length ? `${this.state.cluster.length} / ` : '', this.props.cluster.length, " chain", this.props.cluster.length > 1 ? 's' : ''] })] });
349
+ const selectionControls = (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(common_1.Button, { icon: icons_1.CheckSvg, flex: true, onClick: this.selectAll, style: { flex: '0 0 50px', textAlign: 'center', fontSize: '80%', color: '#9cacc3', padding: 0 }, disabled: this.state.isBusy, title: `Show all chains`, children: "All" }), (0, jsx_runtime_1.jsx)(common_1.Button, { icon: icons_1.CloseSvg, flex: true, onClick: this.selectNone, style: { flex: '0 0 50px', textAlign: 'center', fontSize: '80%', color: '#9cacc3', padding: 0 }, disabled: this.state.isBusy, title: `Hide all chains`, children: "None" })] });
350
+ const mainRow = (0, jsx_runtime_1.jsxs)("div", { className: `msp-flex-row msp-tree-row`, style: { marginTop: '10px' }, children: [expand, label, this.props.cluster.length > 1 && selectionControls] });
351
+ const searchControls = (0, jsx_runtime_1.jsxs)("div", { className: 'msp-mapped-parameter-group', style: { fontSize: '90%' }, children: [(0, jsx_runtime_1.jsxs)("div", { className: 'msp-control-row msp-transform-header-brand-gray', style: { height: '33px', marginLeft: '30px' }, children: [(0, jsx_runtime_1.jsx)("span", { className: 'msp-control-row-label', children: "Search PDB ID" }), (0, jsx_runtime_1.jsx)("div", { className: 'msp-control-row-ctrl', children: (0, jsx_runtime_1.jsx)("input", { type: 'text', placeholder: 'Enter PDB ID..', disabled: this.state.isBusy, onChange: e => this.inputStream.next(e.target.value), value: this.state.searchText, maxLength: 4 }) })] }), (0, jsx_runtime_1.jsx)(common_1.IconButton, { svg: icons_1.CloseSvg, flex: true, onClick: this.clearSearch, style: { flex: '0 0 24px', padding: 0 }, disabled: this.state.isBusy || this.state.searchText === '', toggleState: this.state.searchText !== '', title: 'Clear search input' })] });
352
+ return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [mainRow, (this.state.showAll || this.state.showNone) && (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("div", { className: `msp-control-row msp-transform-header-brand-${this.state.showAll ? 'green' : 'red'}`, style: { display: 'flex', marginLeft: '20px', height: '35px' }, children: [(0, jsx_runtime_1.jsxs)("span", { className: 'msp-control-row-label', style: { flex: '1 1 auto', textAlign: 'left', fontSize: '85%' }, children: [this.state.showAll ? 'Display' : 'Hide', " ", this.state.cluster.length < this.props.cluster.length ? `${this.state.cluster.length} / ` : 'all ', this.props.cluster.length, " chains"] }), (0, jsx_runtime_1.jsx)(common_1.Button, { icon: icons_1.CheckSvg, flex: true, onClick: this.applyAction, style: { flex: '0 0 60px', textAlign: 'center', fontSize: '78%', color: '#9cacc3', padding: 0, margin: '0 1px' }, title: `Apply action`, children: "Apply" }), (0, jsx_runtime_1.jsx)(common_1.Button, { icon: icons_1.CloseSvg, flex: true, onClick: this.cancelAction, style: { flex: '0 0 60px', textAlign: 'center', fontSize: '78%', color: '#9cacc3', padding: 0, margin: '0 1px' }, title: `Cancel action`, children: "Cancel" })] }) }), (!this.state.isCollapsed && this.props.cluster.length > 5) && searchControls, !this.state.isCollapsed && (0, jsx_runtime_1.jsx)("div", { className: 'msp-tree-updates-wrapper', style: { maxHeight: (this.props.totalClusters > 1) ? '330px' : '87%', overflowY: 'auto' }, children: this.state.cluster.map((s, i) => (0, jsx_runtime_1.jsx)(StructureNode, { segmentIndex: this.props.segmentIndex, structure: s, isRep: i === 0 ? true : false }, `str-${s.pdb_id}${s.struct_asym_id}${i}`)) })] });
353
+ }
354
+ }
355
+ class StructureNode extends base_1.PluginUIComponent {
356
+ constructor() {
357
+ super(...arguments);
358
+ this.state = {
458
359
  showControls: false,
459
360
  isBusy: false,
460
361
  isProcessing: false,
461
362
  isHidden: true,
462
363
  };
463
- _this.toggleVisible = function (e) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
464
- var structHierarchy, _i, _a, c, currentHiddenState;
465
- return tslib_1.__generator(this, function (_b) {
466
- switch (_b.label) {
467
- case 0:
468
- e.preventDefault();
469
- e.currentTarget.blur();
470
- this.setState({ isProcessing: true, showControls: false });
471
- if (!this.ref) return [3 /*break*/, 1];
472
- structHierarchy = this.plugin.managers.structure.hierarchy.current.refs.get(this.ref);
473
- if (structHierarchy && structHierarchy.components) {
474
- for (_i = 0, _a = structHierarchy.components; _i < _a.length; _i++) {
475
- c = _a[_i];
476
- currentHiddenState = c.cell.state.isHidden ? true : false;
477
- if (currentHiddenState === this.state.isHidden) {
478
- commands_1.PluginCommands.State.ToggleVisibility(this.plugin, { state: c.cell.parent, ref: c.cell.transform.ref });
479
- }
480
- }
481
- this.setState({ isHidden: !this.state.isHidden });
364
+ this.toggleVisible = async (e) => {
365
+ e.preventDefault();
366
+ e.currentTarget.blur();
367
+ this.setState({ isProcessing: true, showControls: false });
368
+ if (this.ref) {
369
+ const structHierarchy = this.plugin.managers.structure.hierarchy.current.refs.get(this.ref);
370
+ if (structHierarchy && structHierarchy.components) {
371
+ for (const c of structHierarchy.components) {
372
+ const currentHiddenState = c.cell.state.isHidden ? true : false;
373
+ if (currentHiddenState === this.state.isHidden) {
374
+ commands_1.PluginCommands.State.ToggleVisibility(this.plugin, { state: c.cell.parent, ref: c.cell.transform.ref });
482
375
  }
483
- return [3 /*break*/, 3];
484
- case 1: return [4 /*yield*/, (0, superposition_1.renderSuperposition)(this.plugin, this.props.segmentIndex, [this.props.structure])];
485
- case 2:
486
- _b.sent();
487
- _b.label = 3;
488
- case 3:
489
- this.setState({ isProcessing: false });
490
- commands_1.PluginCommands.Camera.Reset(this.plugin);
491
- return [2 /*return*/];
376
+ }
377
+ this.setState({ isHidden: !this.state.isHidden });
492
378
  }
493
- });
494
- }); };
495
- _this.selectAction = function (item) {
379
+ }
380
+ else {
381
+ await (0, superposition_1.renderSuperposition)(this.plugin, this.props.segmentIndex, [this.props.structure]);
382
+ }
383
+ this.setState({ isProcessing: false });
384
+ commands_1.PluginCommands.Camera.Reset(this.plugin);
385
+ };
386
+ this.selectAction = item => {
496
387
  if (!item)
497
388
  return;
498
- _this.setState({ showControls: false });
499
- (item === null || item === void 0 ? void 0 : item.value)();
389
+ this.setState({ showControls: false });
390
+ (item?.value)();
500
391
  };
501
- _this.highlight = function (e) {
392
+ this.highlight = (e) => {
502
393
  e.preventDefault();
503
- if (_this.ref) {
504
- var cell = _this.plugin.state.data.cells.get(_this.ref);
505
- commands_1.PluginCommands.Interactivity.Object.Highlight(_this.plugin, { state: cell.parent, ref: _this.ref });
394
+ if (this.ref) {
395
+ const cell = this.plugin.state.data.cells.get(this.ref);
396
+ commands_1.PluginCommands.Interactivity.Object.Highlight(this.plugin, { state: cell.parent, ref: this.ref });
506
397
  }
507
398
  e.currentTarget.blur();
508
399
  };
509
- _this.clearHighlight = function (e) {
400
+ this.clearHighlight = (e) => {
510
401
  e.preventDefault();
511
- commands_1.PluginCommands.Interactivity.ClearHighlights(_this.plugin);
402
+ commands_1.PluginCommands.Interactivity.ClearHighlights(this.plugin);
512
403
  e.currentTarget.blur();
513
404
  };
514
- _this.toggleControls = function (e) {
405
+ this.toggleControls = (e) => {
515
406
  e.preventDefault();
516
- _this.setState({ showControls: !_this.state.showControls });
407
+ this.setState({ showControls: !this.state.showControls });
517
408
  e.currentTarget.blur();
518
409
  };
519
- return _this;
520
410
  }
521
- Object.defineProperty(StructureNode.prototype, "customState", {
522
- get: function () {
523
- return this.plugin.customState;
524
- },
525
- enumerable: false,
526
- configurable: true
527
- });
528
- Object.defineProperty(StructureNode.prototype, "ref", {
529
- get: function () {
530
- if (this.customState && this.customState.superpositionState && this.customState.superpositionState.models["".concat(this.props.structure.pdb_id, "_").concat(this.props.structure.struct_asym_id)]) {
531
- return this.customState.superpositionState.models["".concat(this.props.structure.pdb_id, "_").concat(this.props.structure.struct_asym_id)];
532
- }
533
- else {
534
- return undefined;
535
- }
536
- },
537
- enumerable: false,
538
- configurable: true
539
- });
540
- Object.defineProperty(StructureNode.prototype, "modelCell", {
541
- get: function () {
542
- if (this.ref) {
543
- return this.plugin.state.data.cells.get(this.ref);
544
- }
545
- else {
546
- return undefined;
547
- }
548
- },
549
- enumerable: false,
550
- configurable: true
551
- });
552
- Object.defineProperty(StructureNode.prototype, "isAllHidden", {
553
- get: function () {
554
- var isHidden = true;
555
- if (this.ref) {
556
- var structHierarchy = this.plugin.managers.structure.hierarchy.current.refs.get(this.ref);
557
- if (structHierarchy && structHierarchy.components) {
558
- for (var _i = 0, _a = structHierarchy.components; _i < _a.length; _i++) {
559
- var c = _a[_i];
560
- if (c && c.cell && !c.cell.state.isHidden) {
561
- isHidden = false;
562
- break;
563
- }
411
+ get customState() {
412
+ return this.plugin.customState;
413
+ }
414
+ get ref() {
415
+ if (this.customState && this.customState.superpositionState && this.customState.superpositionState.models[`${this.props.structure.pdb_id}_${this.props.structure.struct_asym_id}`]) {
416
+ return this.customState.superpositionState.models[`${this.props.structure.pdb_id}_${this.props.structure.struct_asym_id}`];
417
+ }
418
+ else {
419
+ return undefined;
420
+ }
421
+ }
422
+ get modelCell() {
423
+ if (this.ref) {
424
+ return this.plugin.state.data.cells.get(this.ref);
425
+ }
426
+ else {
427
+ return undefined;
428
+ }
429
+ }
430
+ get isAllHidden() {
431
+ let isHidden = true;
432
+ if (this.ref) {
433
+ const structHierarchy = this.plugin.managers.structure.hierarchy.current.refs.get(this.ref);
434
+ if (structHierarchy && structHierarchy.components) {
435
+ for (const c of structHierarchy.components) {
436
+ if (c && c.cell && !c.cell.state.isHidden) {
437
+ isHidden = false;
438
+ break;
564
439
  }
565
440
  }
566
- else {
567
- isHidden = false;
568
- }
569
441
  }
570
- return isHidden;
571
- },
572
- enumerable: false,
573
- configurable: true
574
- });
575
- StructureNode.prototype.checkRelation = function (ref) {
576
- var isRelated = false;
577
- var cell = this.plugin.state.data.cells.get(ref);
442
+ else {
443
+ isHidden = false;
444
+ }
445
+ }
446
+ return isHidden;
447
+ }
448
+ checkRelation(ref) {
449
+ let isRelated = false;
450
+ const cell = this.plugin.state.data.cells.get(ref);
578
451
  if (cell && cell.transform.parent) {
579
452
  if (cell && cell.transform.parent === this.ref) {
580
453
  isRelated = true;
581
454
  }
582
455
  else {
583
- var pcell = this.plugin.state.data.cells.get(cell.transform.parent);
456
+ const pcell = this.plugin.state.data.cells.get(cell.transform.parent);
584
457
  if (pcell && pcell.transform.parent === this.ref)
585
458
  isRelated = true;
586
459
  }
587
460
  }
588
461
  else {
589
- var currentNodeCell = this.plugin.state.data.cells.get(this.ref);
462
+ const currentNodeCell = this.plugin.state.data.cells.get(this.ref);
590
463
  if (currentNodeCell && currentNodeCell.transform.parent === cell.transform.parent) {
591
464
  isRelated = true;
592
465
  }
593
466
  }
594
467
  return isRelated;
595
- };
596
- StructureNode.prototype.is = function (e) {
468
+ }
469
+ is(e) {
597
470
  if (!this.ref)
598
471
  return false;
599
- var isRelated = false;
472
+ let isRelated = false;
600
473
  if (this.ref && e.ref !== this.ref) {
601
474
  isRelated = this.checkRelation(e.ref);
602
475
  }
@@ -604,31 +477,30 @@ var StructureNode = /** @class */ (function (_super) {
604
477
  return true;
605
478
  }
606
479
  else {
607
- var invalidStruct = (this.customState.superpositionState.invalidStruct.indexOf("".concat(this.props.structure.pdb_id, "_").concat(this.props.structure.struct_asym_id)) > -1) ? true : false;
480
+ const invalidStruct = (this.customState.superpositionState.invalidStruct.indexOf(`${this.props.structure.pdb_id}_${this.props.structure.struct_asym_id}`) > -1) ? true : false;
608
481
  return invalidStruct ? true : false;
609
482
  }
610
- };
611
- StructureNode.prototype.componentDidMount = function () {
612
- var _this = this;
483
+ }
484
+ componentDidMount() {
613
485
  this.setState({ isHidden: this.isAllHidden });
614
- this.subscribe(this.plugin.customState.events.isBusy, function (e) {
615
- _this.setState({ isBusy: e, showControls: false });
486
+ this.subscribe(this.plugin.customState.events.isBusy, (e) => {
487
+ this.setState({ isBusy: e, showControls: false });
616
488
  });
617
- this.subscribe(this.plugin.state.events.cell.stateUpdated.pipe((0, operators_1.filter)(function (e) { return _this.is(e); }), (0, operators_1.debounceTime)(33)), function (e) {
618
- _this.setState({ isHidden: _this.isAllHidden });
489
+ this.subscribe(this.plugin.state.events.cell.stateUpdated.pipe((0, operators_1.filter)(e => this.is(e)), (0, operators_1.debounceTime)(33)), e => {
490
+ this.setState({ isHidden: this.isAllHidden });
619
491
  // this.forceUpdate();
620
492
  });
621
- };
622
- StructureNode.prototype.getTagRefs = function (tags) {
623
- var TagSet = new Set(tags);
624
- var tree = this.plugin.state.data.tree;
493
+ }
494
+ getTagRefs(tags) {
495
+ const TagSet = new Set(tags);
496
+ const tree = this.plugin.state.data.tree;
625
497
  return mol_state_2.StateSelection.findUniqueTagsInSubtree(tree, this.modelCell.transform.ref, TagSet);
626
- };
627
- StructureNode.prototype.getRandomColor = function () {
628
- var clList = lists_1.ColorLists;
629
- var spState = this.plugin.customState.superpositionState;
630
- var palleteIndex = spState.colorState[this.props.segmentIndex].palleteIndex;
631
- var colorIndex = spState.colorState[this.props.segmentIndex].colorIndex;
498
+ }
499
+ getRandomColor() {
500
+ const clList = lists_1.ColorLists;
501
+ const spState = this.plugin.customState.superpositionState;
502
+ let palleteIndex = spState.colorState[this.props.segmentIndex].palleteIndex;
503
+ let colorIndex = spState.colorState[this.props.segmentIndex].colorIndex;
632
504
  if (clList[spState.colorPalette[palleteIndex]].list[colorIndex + 1]) {
633
505
  colorIndex += 1;
634
506
  }
@@ -636,169 +508,145 @@ var StructureNode = /** @class */ (function (_super) {
636
508
  colorIndex = 0;
637
509
  palleteIndex = spState.colorPalette[palleteIndex + 1] ? palleteIndex + 1 : 0;
638
510
  }
639
- var palleteName = spState.colorPalette[palleteIndex];
511
+ const palleteName = spState.colorPalette[palleteIndex];
640
512
  this.plugin.customState.superpositionState.colorState[this.props.segmentIndex].palleteIndex = palleteIndex;
641
513
  this.plugin.customState.superpositionState.colorState[this.props.segmentIndex].colorIndex = colorIndex;
642
514
  return clList[palleteName].list[colorIndex];
643
- };
644
- StructureNode.prototype.addChainRepr = function () {
645
- return tslib_1.__awaiter(this, void 0, void 0, function () {
646
- var uniformColor1, strInstance, query, chainSel;
647
- return tslib_1.__generator(this, function (_a) {
648
- switch (_a.label) {
649
- case 0:
650
- uniformColor1 = this.getRandomColor();
651
- strInstance = this.plugin.state.data.select(this.ref)[0];
652
- query = builder_1.MolScriptBuilder.struct.generator.atomGroups({
653
- 'chain-test': builder_1.MolScriptBuilder.core.rel.eq([builder_1.MolScriptBuilder.struct.atomProperty.macromolecular.label_asym_id(), this.props.structure.struct_asym_id])
654
- });
655
- return [4 /*yield*/, this.plugin.builders.structure.tryCreateComponentFromExpression(strInstance, query, "Chain-".concat(this.props.segmentIndex), { label: "Chain", tags: ["superposition-sel"] })];
656
- case 1:
657
- chainSel = _a.sent();
658
- if (!chainSel) return [3 /*break*/, 3];
659
- return [4 /*yield*/, this.plugin.builders.structure.representation.addRepresentation(chainSel, { type: 'cartoon', color: 'uniform', colorParams: { value: uniformColor1 } }, { tag: "superposition-visual" })];
660
- case 2:
661
- _a.sent();
662
- _a.label = 3;
663
- case 3: return [2 /*return*/];
664
- }
665
- });
515
+ }
516
+ async addChainRepr() {
517
+ const uniformColor1 = this.getRandomColor();
518
+ const strInstance = this.plugin.state.data.select(this.ref)[0];
519
+ const query = builder_1.MolScriptBuilder.struct.generator.atomGroups({
520
+ 'chain-test': builder_1.MolScriptBuilder.core.rel.eq([builder_1.MolScriptBuilder.struct.atomProperty.macromolecular.label_asym_id(), this.props.structure.struct_asym_id])
666
521
  });
667
- };
668
- StructureNode.prototype.updates = function () {
669
- var _this = this;
670
- var structHierarchy = this.plugin.managers.structure.hierarchy.current.refs.get(this.ref);
522
+ const chainSel = await this.plugin.builders.structure.tryCreateComponentFromExpression(strInstance, query, `Chain-${this.props.segmentIndex}`, { label: `Chain`, tags: [`superposition-sel`] });
523
+ if (chainSel) {
524
+ await this.plugin.builders.structure.representation.addRepresentation(chainSel, { type: 'cartoon', color: 'uniform', colorParams: { value: uniformColor1 } }, { tag: `superposition-visual` });
525
+ }
526
+ }
527
+ updates() {
528
+ const structHierarchy = this.plugin.managers.structure.hierarchy.current.refs.get(this.ref);
671
529
  if (structHierarchy && structHierarchy.components) {
672
- var representations_1 = [];
673
- var showAddChainBtn_1 = true;
674
- structHierarchy.components.forEach(function (comps) {
675
- var gKeys = comps.key.split(',');
676
- var cId1Arr = gKeys[0].split('-');
530
+ const representations = [];
531
+ let showAddChainBtn = true;
532
+ structHierarchy.components.forEach((comps) => {
533
+ const gKeys = comps.key.split(',');
534
+ const cId1Arr = gKeys[0].split('-');
677
535
  if (cId1Arr[2] === 'Chain')
678
- showAddChainBtn_1 = false;
536
+ showAddChainBtn = false;
679
537
  if (comps.representations) {
680
- comps.representations.forEach(function (repr) {
681
- representations_1.push(repr);
538
+ comps.representations.forEach((repr) => {
539
+ representations.push(repr);
682
540
  });
683
541
  }
684
542
  });
685
- var customState = this.plugin.customState;
543
+ const customState = this.plugin.customState;
686
544
  if (customState.initParams && customState.initParams.superpositionParams && !customState.initParams.superpositionParams.ligandView) {
687
- showAddChainBtn_1 = false;
545
+ showAddChainBtn = false;
688
546
  }
689
- if (representations_1.length > 0) {
690
- return (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: 'msp-accent-offset', style: { marginLeft: '40px' } }, { children: [representations_1.length > 0 && representations_1.map(function (r, i) { return (0, jsx_runtime_1.jsx)(StructureRepresentationEntry, { group: [structHierarchy], representation: r }, "".concat(r.cell.transform.ref, "-").concat(i)); }), showAddChainBtn_1 && (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: 'msp-control-group-header', style: { marginTop: '1px' } }, { children: (0, jsx_runtime_1.jsxs)(common_1.Button, tslib_1.__assign({ noOverflow: true, className: 'msp-control-button-label', title: "Click to add chain representaion", onClick: function () { return _this.addChainRepr(); } }, { children: ["\u00A0\u00A0Add Chain ", this.props.structure.struct_asym_id, " Representation"] })) }))] }));
547
+ if (representations.length > 0) {
548
+ return (0, jsx_runtime_1.jsxs)("div", { className: 'msp-accent-offset', style: { marginLeft: '40px' }, children: [representations.length > 0 && representations.map((r, i) => (0, jsx_runtime_1.jsx)(StructureRepresentationEntry, { group: [structHierarchy], representation: r }, `${r.cell.transform.ref}-${i}`)), showAddChainBtn && (0, jsx_runtime_1.jsx)("div", { className: 'msp-control-group-header', style: { marginTop: '1px' }, children: (0, jsx_runtime_1.jsxs)(common_1.Button, { noOverflow: true, className: 'msp-control-button-label', title: `Click to add chain representaion`, onClick: () => this.addChainRepr(), children: ["\u00A0\u00A0Add Chain ", this.props.structure.struct_asym_id, " Representation"] }) })] });
691
549
  }
692
550
  }
693
551
  return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
694
- };
695
- StructureNode.prototype.getSubtitle = function () {
696
- var customState = this.plugin.customState;
697
- var hetList = customState.superpositionState.hets["".concat(this.props.structure.pdb_id, "_").concat(this.props.structure.struct_asym_id)];
698
- var subtitle;
552
+ }
553
+ getSubtitle() {
554
+ const customState = this.plugin.customState;
555
+ const hetList = customState.superpositionState.hets[`${this.props.structure.pdb_id}_${this.props.structure.struct_asym_id}`];
556
+ let subtitle;
699
557
  if (hetList) {
700
- var hetLimit = this.props.structure.is_representative ? 1 : 4;
701
- var totalHets = hetList.length;
702
- var hetStr = hetList.join(', ');
558
+ const hetLimit = this.props.structure.is_representative ? 1 : 4;
559
+ const totalHets = hetList.length;
560
+ let hetStr = hetList.join(', ');
703
561
  if (totalHets > hetLimit) {
704
562
  hetStr = hetList.slice(0, hetLimit).join(', ');
705
- hetStr += " + ".concat(totalHets - hetLimit);
563
+ hetStr += ` + ${totalHets - hetLimit}`;
706
564
  }
707
- subtitle = " ( ".concat(hetStr, " )");
565
+ subtitle = ` ( ${hetStr} )`;
708
566
  if (this.props.structure.is_representative)
709
- subtitle = " ".concat(subtitle, " ( Representative )");
567
+ subtitle = ` ${subtitle} ( Representative )`;
710
568
  }
711
569
  else if (this.props.structure.is_representative) {
712
570
  subtitle = ' ( Representative )';
713
571
  }
714
572
  return subtitle;
715
- };
716
- Object.defineProperty(StructureNode.prototype, "panelColor", {
717
- get: function () {
718
- var panelColor = '#808080';
719
- if (!this.state.isHidden) {
720
- if (this.modelCell) {
721
- var refs = this.getTagRefs(["superposition-visual", "superposition-ligand-visual"]);
722
- var visualRef = refs["superposition-ligand-visual"] ? refs["superposition-ligand-visual"] : refs["superposition-visual"] ? refs["superposition-visual"] : undefined;
723
- if (visualRef) {
724
- var visualCell = this.plugin.state.data.cells.get(visualRef);
725
- if (visualCell.params && visualCell.params.values && visualCell.params.values.colorTheme) {
726
- var colorTheme = visualCell.params.values.colorTheme;
727
- if (colorTheme.params && colorTheme.params.value) {
728
- panelColor = "".concat(color_1.Color.toStyle(colorTheme.params.value));
729
- }
730
- else if (colorTheme.params && colorTheme.params.palette) {
731
- var colorList1 = colorTheme.params.palette.params.list.colors;
732
- panelColor = "".concat(color_1.Color.toStyle(colorList1[0]));
733
- }
734
- else if (colorTheme.params && colorTheme.params.list) {
735
- var colorList2 = colorTheme.params.list.colors;
736
- panelColor = "".concat(color_1.Color.toStyle(colorList2[0]));
737
- }
573
+ }
574
+ get panelColor() {
575
+ let panelColor = '#808080';
576
+ if (!this.state.isHidden) {
577
+ if (this.modelCell) {
578
+ const refs = this.getTagRefs([`superposition-visual`, `superposition-ligand-visual`]);
579
+ const visualRef = refs[`superposition-ligand-visual`] ? refs[`superposition-ligand-visual`] : refs[`superposition-visual`] ? refs[`superposition-visual`] : undefined;
580
+ if (visualRef) {
581
+ const visualCell = this.plugin.state.data.cells.get(visualRef);
582
+ if (visualCell.params && visualCell.params.values && visualCell.params.values.colorTheme) {
583
+ const colorTheme = visualCell.params.values.colorTheme;
584
+ if (colorTheme.params && colorTheme.params.value) {
585
+ panelColor = `${color_1.Color.toStyle(colorTheme.params.value)}`;
586
+ }
587
+ else if (colorTheme.params && colorTheme.params.palette) {
588
+ const colorList1 = colorTheme.params.palette.params.list.colors;
589
+ panelColor = `${color_1.Color.toStyle(colorList1[0])}`;
590
+ }
591
+ else if (colorTheme.params && colorTheme.params.list) {
592
+ const colorList2 = colorTheme.params.list.colors;
593
+ panelColor = `${color_1.Color.toStyle(colorList2[0])}`;
738
594
  }
739
595
  }
740
596
  }
741
597
  }
742
- return panelColor;
743
- },
744
- enumerable: false,
745
- configurable: true
746
- });
747
- StructureNode.prototype.render = function () {
748
- var superpositionParams = this.customState.initParams.superpositionParams;
749
- var strutStateId = "".concat(this.props.structure.pdb_id, "_").concat(this.props.structure.struct_asym_id);
750
- var invalidStruct = (this.customState.superpositionState.invalidStruct.indexOf(strutStateId) > -1) ? true : false;
751
- var noMatrixStruct = (this.customState.superpositionState.noMatrixStruct.indexOf(strutStateId) > -1) ? true : false;
752
- var subTitle = invalidStruct ? noMatrixStruct ? " Matrix not available!" : " No Ligand found!" : this.getSubtitle();
753
- var strTitle = "".concat(this.props.structure.pdb_id, " chain ").concat(this.props.structure.auth_asym_id);
598
+ }
599
+ return panelColor;
600
+ }
601
+ render() {
602
+ const superpositionParams = this.customState.initParams.superpositionParams;
603
+ const strutStateId = `${this.props.structure.pdb_id}_${this.props.structure.struct_asym_id}`;
604
+ const invalidStruct = (this.customState.superpositionState.invalidStruct.indexOf(strutStateId) > -1) ? true : false;
605
+ const noMatrixStruct = (this.customState.superpositionState.noMatrixStruct.indexOf(strutStateId) > -1) ? true : false;
606
+ const subTitle = invalidStruct ? noMatrixStruct ? ` Matrix not available!` : ` No Ligand found!` : this.getSubtitle();
607
+ let strTitle = `${this.props.structure.pdb_id} chain ${this.props.structure.auth_asym_id}`;
754
608
  if (superpositionParams && superpositionParams.ligandView) {
755
- strTitle = "".concat(this.props.structure.pdb_id, " ").concat(this.props.structure.struct_asym_id);
609
+ strTitle = `${this.props.structure.pdb_id} ${this.props.structure.struct_asym_id}`;
756
610
  }
757
- var label = (0, jsx_runtime_1.jsxs)(common_1.Button, tslib_1.__assign({ className: "msp-btn-tree-label", style: { borderLeftColor: this.panelColor }, noOverflow: true, title: strTitle, disabled: (invalidStruct || this.state.isBusy || this.state.isProcessing) ? true : false, onMouseEnter: this.highlight, onMouseLeave: this.clearHighlight }, { children: [(0, jsx_runtime_1.jsx)("span", { children: strTitle }), subTitle && (0, jsx_runtime_1.jsx)("small", { children: subTitle })] }));
758
- var expand = (0, jsx_runtime_1.jsx)(common_1.IconButton, { svg: !this.state.showControls ? icons_1.ArrowRightSvg : icons_1.ArrowDropDownSvg, flex: '20px', onClick: this.toggleControls, transparent: true, className: 'msp-no-hover-outline', disabled: (invalidStruct || this.state.isBusy || this.state.isProcessing) ? true : false });
759
- var visibility = (0, jsx_runtime_1.jsx)(common_1.IconButton, { svg: this.state.isHidden ? icons_1.VisibilityOffOutlinedSvg : icons_1.VisibilityOutlinedSvg, toggleState: false, small: true, onClick: this.toggleVisible, disabled: (invalidStruct || this.state.isBusy || this.state.isProcessing) ? true : false, title: this.state.isHidden ? "Show chain" : "Hide chain" });
760
- var row = (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: "msp-flex-row msp-tree-row", style: { marginLeft: !this.state.isHidden ? '10px' : '31px' } }, { children: [!this.state.isHidden && expand, label, visibility] }));
761
- return (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ style: { marginBottom: '1px' } }, { children: [row, this.state.showControls && this.updates()] }));
762
- };
763
- return StructureNode;
764
- }(base_1.PluginUIComponent));
765
- var StructureRepresentationEntry = /** @class */ (function (_super) {
766
- tslib_1.__extends(StructureRepresentationEntry, _super);
767
- function StructureRepresentationEntry() {
768
- var _this = _super !== null && _super.apply(this, arguments) || this;
769
- _this.toggleVisible = function (e) {
611
+ const label = (0, jsx_runtime_1.jsxs)(common_1.Button, { className: `msp-btn-tree-label`, style: { borderLeftColor: this.panelColor }, noOverflow: true, title: strTitle, disabled: (invalidStruct || this.state.isBusy || this.state.isProcessing) ? true : false, onMouseEnter: this.highlight, onMouseLeave: this.clearHighlight, children: [(0, jsx_runtime_1.jsx)("span", { children: strTitle }), subTitle && (0, jsx_runtime_1.jsx)("small", { children: subTitle })] });
612
+ const expand = (0, jsx_runtime_1.jsx)(common_1.IconButton, { svg: !this.state.showControls ? icons_1.ArrowRightSvg : icons_1.ArrowDropDownSvg, flex: '20px', onClick: this.toggleControls, transparent: true, className: 'msp-no-hover-outline', disabled: (invalidStruct || this.state.isBusy || this.state.isProcessing) ? true : false });
613
+ const visibility = (0, jsx_runtime_1.jsx)(common_1.IconButton, { svg: this.state.isHidden ? icons_1.VisibilityOffOutlinedSvg : icons_1.VisibilityOutlinedSvg, toggleState: false, small: true, onClick: this.toggleVisible, disabled: (invalidStruct || this.state.isBusy || this.state.isProcessing) ? true : false, title: this.state.isHidden ? `Show chain` : `Hide chain` });
614
+ const row = (0, jsx_runtime_1.jsxs)("div", { className: `msp-flex-row msp-tree-row`, style: { marginLeft: !this.state.isHidden ? '10px' : '31px' }, children: [!this.state.isHidden && expand, label, visibility] });
615
+ return (0, jsx_runtime_1.jsxs)("div", { style: { marginBottom: '1px' }, children: [row, this.state.showControls && this.updates()] });
616
+ }
617
+ }
618
+ class StructureRepresentationEntry extends base_1.PurePluginUIComponent {
619
+ constructor() {
620
+ super(...arguments);
621
+ this.toggleVisible = (e) => {
770
622
  e.preventDefault();
771
623
  e.currentTarget.blur();
772
- var cell = _this.props.representation.cell;
773
- commands_1.PluginCommands.State.ToggleVisibility(_this.plugin, { state: cell.parent, ref: cell.transform.parent });
624
+ const cell = this.props.representation.cell;
625
+ commands_1.PluginCommands.State.ToggleVisibility(this.plugin, { state: cell.parent, ref: cell.transform.parent });
774
626
  };
775
- return _this;
776
627
  }
777
- StructureRepresentationEntry.prototype.componentDidMount = function () {
778
- var _this = this;
779
- this.subscribe(this.plugin.state.events.cell.stateUpdated, function (e) {
780
- if (mol_state_1.State.ObjectEvent.isCell(e, _this.props.representation.cell))
781
- _this.forceUpdate();
628
+ componentDidMount() {
629
+ this.subscribe(this.plugin.state.events.cell.stateUpdated, e => {
630
+ if (mol_state_1.State.ObjectEvent.isCell(e, this.props.representation.cell))
631
+ this.forceUpdate();
782
632
  });
783
- };
784
- StructureRepresentationEntry.prototype.render = function () {
785
- var _a, _b, _c, _d, _e, _f, _g;
786
- var repr = this.props.representation.cell;
787
- var label = (_a = repr.obj) === null || _a === void 0 ? void 0 : _a.label;
788
- if (((_b = repr.obj) === null || _b === void 0 ? void 0 : _b.data.repr) && ((_c = repr.obj) === null || _c === void 0 ? void 0 : _c.data.repr.label)) {
789
- var sourceLabel = (((_d = repr.obj) === null || _d === void 0 ? void 0 : _d.data.repr.label.indexOf('[Focus]')) >= 0) ? '[Focus]' : (_e = repr.obj) === null || _e === void 0 ? void 0 : _e.data.repr.label;
790
- var isLargeLabel = sourceLabel.length > 10 ? true : false;
791
- sourceLabel = "".concat(isLargeLabel ? "".concat(sourceLabel.substring(0, 28), "...") : sourceLabel);
633
+ }
634
+ render() {
635
+ const repr = this.props.representation.cell;
636
+ let label = repr.obj?.label;
637
+ if (repr.obj?.data.repr && repr.obj?.data.repr.label) {
638
+ let sourceLabel = (repr.obj?.data.repr.label.indexOf('[Focus]') >= 0) ? '[Focus]' : repr.obj?.data.repr.label;
639
+ const isLargeLabel = sourceLabel.length > 10 ? true : false;
640
+ sourceLabel = `${isLargeLabel ? `${sourceLabel.substring(0, 28)}...` : sourceLabel}`;
792
641
  if (isLargeLabel) {
793
642
  label = sourceLabel;
794
643
  }
795
644
  else {
796
- label = "".concat(sourceLabel, " ").concat((label && label.length < 21) ? ' - ' + label : '');
645
+ label = `${sourceLabel} ${(label && label.length < 21) ? ' - ' + label : ''}`;
797
646
  }
798
647
  }
799
- if (((_f = repr.obj) === null || _f === void 0 ? void 0 : _f.data.repr) && ((_g = repr.obj) === null || _g === void 0 ? void 0 : _g.data.repr.label) === 'Custom Selection')
648
+ if (repr.obj?.data.repr && repr.obj?.data.repr.label === 'Custom Selection')
800
649
  label = 'Custom Selection';
801
- return (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: 'msp-representation-entry' }, { children: [repr.parent && (0, jsx_runtime_1.jsx)(common_1.ExpandGroup, tslib_1.__assign({ header: "".concat(label || 'Representation'), noOffset: true, headerStyle: { overflow: 'hidden' } }, { children: (0, jsx_runtime_1.jsx)(update_transform_1.UpdateTransformControl, { state: repr.parent, transform: repr.transform, customHeader: 'none', noMargin: true }) })), (0, jsx_runtime_1.jsx)(common_1.IconButton, { svg: this.props.representation.cell.state.isHidden ? icons_1.VisibilityOffOutlinedSvg : icons_1.VisibilityOutlinedSvg, toggleState: false, onClick: this.toggleVisible, title: this.props.representation.cell.state.isHidden ? "Show representation" : "Hide representation", small: true, className: 'msp-default-bg', style: { position: 'absolute', top: 0, right: 0, lineHeight: '24px', height: '24px', textAlign: 'right', width: '32px', paddingRight: '6px', background: 'none' } })] }));
802
- };
803
- return StructureRepresentationEntry;
804
- }(base_1.PurePluginUIComponent));
650
+ return (0, jsx_runtime_1.jsxs)("div", { className: 'msp-representation-entry', children: [repr.parent && (0, jsx_runtime_1.jsx)(common_1.ExpandGroup, { header: `${label || 'Representation'}`, noOffset: true, headerStyle: { overflow: 'hidden' }, children: (0, jsx_runtime_1.jsx)(update_transform_1.UpdateTransformControl, { state: repr.parent, transform: repr.transform, customHeader: 'none', noMargin: true }) }), (0, jsx_runtime_1.jsx)(common_1.IconButton, { svg: this.props.representation.cell.state.isHidden ? icons_1.VisibilityOffOutlinedSvg : icons_1.VisibilityOutlinedSvg, toggleState: false, onClick: this.toggleVisible, title: this.props.representation.cell.state.isHidden ? `Show representation` : `Hide representation`, small: true, className: 'msp-default-bg', style: { position: 'absolute', top: 0, right: 0, lineHeight: '24px', height: '24px', textAlign: 'right', width: '32px', paddingRight: '6px', background: 'none' } })] });
651
+ }
652
+ }