pdbe-molstar 3.4.0 → 3.5.0

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 (62) hide show
  1. package/build/pdbe-molstar-component.js +2 -2
  2. package/build/pdbe-molstar-light.css +2 -2
  3. package/build/pdbe-molstar-plugin.js +2 -2
  4. package/build/pdbe-molstar-plugin.js.LICENSE.txt +26 -1
  5. package/build/pdbe-molstar.css +2 -2
  6. package/lib/alphafold-transparency.js +5 -6
  7. package/lib/custom-events.js +1 -1
  8. package/lib/domain-annotations/behavior.d.ts +1 -1
  9. package/lib/domain-annotations/color.js +2 -2
  10. package/lib/domain-annotations/prop.js +1 -2
  11. package/lib/extensions/foldseek/index.d.ts +1 -1
  12. package/lib/extensions/foldseek/index.js +7 -7
  13. package/lib/extensions/interactions/index.d.ts +36 -0
  14. package/lib/extensions/interactions/index.js +112 -0
  15. package/lib/extensions/state-gallery/behavior.d.ts +1 -1
  16. package/lib/extensions/state-gallery/config.js +2 -2
  17. package/lib/extensions/state-gallery/manager.js +5 -4
  18. package/lib/extensions/state-gallery/ui.js +12 -12
  19. package/lib/helpers.d.ts +4 -0
  20. package/lib/helpers.js +68 -19
  21. package/lib/labels.d.ts +1 -1
  22. package/lib/loci-details.js +4 -5
  23. package/lib/plugin-custom-state.js +2 -2
  24. package/lib/sifts-mapping.js +1 -2
  25. package/lib/sifts-mappings-behaviour.d.ts +1 -1
  26. package/lib/spec-from-html.js +1 -2
  27. package/lib/spec.js +3 -3
  28. package/lib/subscribe-events.js +1 -2
  29. package/lib/superposition-export.js +1 -2
  30. package/lib/superposition-focus-representation.d.ts +2 -2
  31. package/lib/superposition-focus-representation.js +1 -1
  32. package/lib/superposition-sifts-mapping.js +1 -2
  33. package/lib/superposition.d.ts +1 -1
  34. package/lib/superposition.js +34 -39
  35. package/lib/ui/alphafold-superposition.js +6 -6
  36. package/lib/ui/annotation-controls.d.ts +1 -1
  37. package/lib/ui/annotation-controls.js +2 -2
  38. package/lib/ui/annotation-row-controls.js +3 -3
  39. package/lib/ui/custom-controls.js +1 -1
  40. package/lib/ui/export-superposition.d.ts +0 -1
  41. package/lib/ui/export-superposition.js +1 -1
  42. package/lib/ui/icons.js +1 -1
  43. package/lib/ui/left-panel/core.d.ts +0 -1
  44. package/lib/ui/left-panel/core.js +5 -6
  45. package/lib/ui/left-panel/pdbe-left-panel.d.ts +0 -1
  46. package/lib/ui/left-panel/tabs.d.ts +1 -1
  47. package/lib/ui/left-panel/tabs.js +2 -2
  48. package/lib/ui/overlay.js +3 -4
  49. package/lib/ui/pdbe-screenshot-controls.js +4 -4
  50. package/lib/ui/pdbe-structure-controls.js +3 -3
  51. package/lib/ui/pdbe-viewport-controls.js +1 -1
  52. package/lib/ui/pdbe-viewport.d.ts +0 -1
  53. package/lib/ui/pdbe-viewport.js +1 -1
  54. package/lib/ui/segment-tree.js +40 -45
  55. package/lib/ui/split-ui/components.d.ts +0 -1
  56. package/lib/ui/split-ui/split-ui.js +6 -7
  57. package/lib/ui/superposition-components.js +16 -21
  58. package/lib/ui/symmetry-annotation-controls.d.ts +4 -4
  59. package/lib/ui/symmetry-annotation-controls.js +18 -25
  60. package/lib/viewer.d.ts +24 -2
  61. package/lib/viewer.js +28 -27
  62. package/package.json +3 -3
@@ -60,13 +60,13 @@ class SegmentTree extends base_1.PurePluginUIComponent {
60
60
  updatedParams.value = val;
61
61
  this.setState({ segment: updatedParams });
62
62
  setTimeout(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
63
- var _b, _c;
63
+ var _a, _b;
64
64
  const updatedSegmentIndex = parseInt(val.segment.split(' ')[0]);
65
65
  customState.superpositionState.activeSegment = updatedSegmentIndex;
66
66
  // Display current segment visible structures
67
67
  yield this.displayStructures(customState.superpositionState.activeSegment - 1);
68
- (_b = customState.events) === null || _b === void 0 ? void 0 : _b.isBusy.next(false);
69
- (_c = customState.events) === null || _c === void 0 ? void 0 : _c.segmentUpdate.next(true);
68
+ (_a = customState.events) === null || _a === void 0 ? void 0 : _a.isBusy.next(false);
69
+ (_b = customState.events) === null || _b === void 0 ? void 0 : _b.segmentUpdate.next(true);
70
70
  }), 100);
71
71
  return false;
72
72
  });
@@ -120,14 +120,14 @@ class SegmentTree extends base_1.PurePluginUIComponent {
120
120
  }
121
121
  };
122
122
  this.displayStructures = (segmentIndex) => tslib_1.__awaiter(this, void 0, void 0, function* () {
123
- var _d;
123
+ var _a;
124
124
  const customState = this.customState;
125
125
  const spState = customState.superpositionState;
126
126
  if (!spState)
127
127
  throw new Error('customState.superpositionState has not been initialized');
128
128
  if (spState.visibleRefs[segmentIndex].length === 0) {
129
129
  const loadStrs = [];
130
- (_d = spState.segmentData) === null || _d === void 0 ? void 0 : _d[segmentIndex].clusters.forEach(cluster => {
130
+ (_a = spState.segmentData) === null || _a === void 0 ? void 0 : _a[segmentIndex].clusters.forEach(cluster => {
131
131
  var _a, _b;
132
132
  let entryList = [cluster[0]];
133
133
  if ((_b = (_a = customState.initParams) === null || _a === void 0 ? void 0 : _a.superpositionParams) === null || _b === void 0 ? void 0 : _b.superposeAll) {
@@ -243,10 +243,10 @@ class SegmentTree extends base_1.PurePluginUIComponent {
243
243
  if (customState && customState.initParams && customState.initParams.superposition) {
244
244
  sectionHeader = (0, jsx_runtime_1.jsx)(common_1.SectionHeader, { title: `Structure clusters - ${customState.initParams.moleculeId}` });
245
245
  if (customState.superpositionError) {
246
- return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [sectionHeader, (0, jsx_runtime_1.jsx)("div", Object.assign({ style: { textAlign: 'center' } }, { children: customState.superpositionError }))] });
246
+ return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [sectionHeader, (0, jsx_runtime_1.jsx)("div", { style: { textAlign: 'center' }, children: customState.superpositionError })] });
247
247
  }
248
248
  else if (!customState.superpositionState || !customState.superpositionState.segmentData) {
249
- return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [sectionHeader, (0, jsx_runtime_1.jsx)("div", Object.assign({ style: { textAlign: 'center' } }, { children: "Loading Segment Data!" }))] });
249
+ 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!" })] });
250
250
  }
251
251
  }
252
252
  }
@@ -307,44 +307,39 @@ class ClusterNode extends base_1.PluginUIComponent {
307
307
  const currentState = Object.assign({}, this.state);
308
308
  this.setState({ showAll: false, showNone: false });
309
309
  setTimeout(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
310
- var _b, e_1, _c, _d;
311
- var _e;
310
+ var _a, e_1, _b, _c;
311
+ var _d;
312
312
  const loadStrs = [];
313
313
  try {
314
- for (var _f = true, _g = tslib_1.__asyncValues(this.state.cluster), _h; _h = yield _g.next(), _b = _h.done, !_b;) {
315
- _d = _h.value;
316
- _f = false;
317
- try {
318
- const str = _d;
319
- const structStateId = `${str.pdb_id}_${str.struct_asym_id}`;
320
- let structRef = undefined;
321
- if (customState && customState.superpositionState && customState.superpositionState.models[structStateId]) {
322
- structRef = customState.superpositionState.models[structStateId];
323
- }
324
- if (structRef) {
325
- const cell = this.plugin.state.data.cells.get(structRef);
326
- if (cell) {
327
- const isHidden = cell.state.isHidden ? true : false;
328
- if ((isHidden && currentState.showAll) || (!isHidden && currentState.showNone)) {
329
- yield commands_1.PluginCommands.State.ToggleVisibility(this.plugin, { state: cell.parent, ref: structRef });
330
- // await PluginCommands.State.ToggleVisibility(this.plugin, { state: cell.parent!, ref: cell.transform.parent });
331
- }
314
+ for (var _e = true, _f = tslib_1.__asyncValues(this.state.cluster), _g; _g = yield _f.next(), _a = _g.done, !_a; _e = true) {
315
+ _c = _g.value;
316
+ _e = false;
317
+ const str = _c;
318
+ const structStateId = `${str.pdb_id}_${str.struct_asym_id}`;
319
+ let structRef = undefined;
320
+ if (customState && customState.superpositionState && customState.superpositionState.models[structStateId]) {
321
+ structRef = customState.superpositionState.models[structStateId];
322
+ }
323
+ if (structRef) {
324
+ const cell = this.plugin.state.data.cells.get(structRef);
325
+ if (cell) {
326
+ const isHidden = cell.state.isHidden ? true : false;
327
+ if ((isHidden && currentState.showAll) || (!isHidden && currentState.showNone)) {
328
+ yield commands_1.PluginCommands.State.ToggleVisibility(this.plugin, { state: cell.parent, ref: structRef });
329
+ // await PluginCommands.State.ToggleVisibility(this.plugin, { state: cell.parent!, ref: cell.transform.parent });
332
330
  }
333
331
  }
334
- else {
335
- if (currentState.showAll)
336
- loadStrs.push(str);
337
- }
338
332
  }
339
- finally {
340
- _f = true;
333
+ else {
334
+ if (currentState.showAll)
335
+ loadStrs.push(str);
341
336
  }
342
337
  }
343
338
  }
344
339
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
345
340
  finally {
346
341
  try {
347
- if (!_f && !_b && (_c = _g.return)) yield _c.call(_g);
342
+ if (!_e && !_a && (_b = _f.return)) yield _b.call(_f);
348
343
  }
349
344
  finally { if (e_1) throw e_1.error; }
350
345
  }
@@ -353,7 +348,7 @@ class ClusterNode extends base_1.PluginUIComponent {
353
348
  if (loadStrs.length > 0) {
354
349
  yield (0, superposition_1.renderSuperposition)(this.plugin, this.props.segmentIndex, loadStrs);
355
350
  }
356
- (_e = customState.events) === null || _e === void 0 ? void 0 : _e.isBusy.next(false);
351
+ (_d = customState.events) === null || _d === void 0 ? void 0 : _d.isBusy.next(false);
357
352
  }));
358
353
  });
359
354
  this.cancelAction = (e) => {
@@ -383,11 +378,11 @@ class ClusterNode extends base_1.PluginUIComponent {
383
378
  return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
384
379
  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' });
385
380
  const title = `Segment ${customState.superpositionState.activeSegment} Cluster ${this.props.clusterIndex + 1}`;
386
- const label = (0, jsx_runtime_1.jsxs)(common_1.Button, Object.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 ? `${this.state.cluster.length} / ` : '', this.props.cluster.length, " chain", this.props.cluster.length > 1 ? 's' : ''] })] }));
387
- const selectionControls = (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(common_1.Button, Object.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, Object.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" }))] });
388
- const mainRow = (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: `msp-flex-row msp-tree-row`, style: { marginTop: '10px' } }, { children: [expand, label, this.props.cluster.length > 1 && selectionControls] }));
389
- const searchControls = (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: 'msp-mapped-parameter-group', style: { fontSize: '90%' } }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: 'msp-control-row msp-transform-header-brand-gray', style: { height: '33px', marginLeft: '30px' } }, { children: [(0, jsx_runtime_1.jsx)("span", Object.assign({ className: 'msp-control-row-label' }, { children: "Search PDB ID" })), (0, jsx_runtime_1.jsx)("div", Object.assign({ 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' })] }));
390
- 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", Object.assign({ 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", Object.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 ? `${this.state.cluster.length} / ` : 'all ', this.props.cluster.length, " chains"] })), (0, jsx_runtime_1.jsx)(common_1.Button, Object.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, Object.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", Object.assign({ 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}`)) }))] });
381
+ 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' : ''] })] });
382
+ 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" })] });
383
+ 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] });
384
+ 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' })] });
385
+ 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}`)) })] });
391
386
  }
392
387
  }
393
388
  class StructureNode extends base_1.PluginUIComponent {
@@ -572,7 +567,7 @@ class StructureNode extends base_1.PluginUIComponent {
572
567
  showAddChainBtn = false;
573
568
  }
574
569
  if (representations.length > 0) {
575
- return (0, jsx_runtime_1.jsxs)("div", Object.assign({ 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", Object.assign({ className: 'msp-control-group-header', style: { marginTop: '1px' } }, { children: (0, jsx_runtime_1.jsxs)(common_1.Button, Object.assign({ 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"] })) }))] }));
570
+ 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"] }) })] });
576
571
  }
577
572
  }
578
573
  return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
@@ -637,11 +632,11 @@ class StructureNode extends base_1.PluginUIComponent {
637
632
  if (superpositionParams && superpositionParams.ligandView) {
638
633
  strTitle = `${this.props.structure.pdb_id} ${this.props.structure.struct_asym_id}`;
639
634
  }
640
- const label = (0, jsx_runtime_1.jsxs)(common_1.Button, Object.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 })] }));
635
+ 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 })] });
641
636
  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 });
642
637
  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` });
643
- const row = (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: `msp-flex-row msp-tree-row`, style: { marginLeft: !this.state.isHidden ? '10px' : '31px' } }, { children: [!this.state.isHidden && expand, label, visibility] }));
644
- return (0, jsx_runtime_1.jsxs)("div", Object.assign({ style: { marginBottom: '1px' } }, { children: [row, this.state.showControls && this.updates()] }));
638
+ 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] });
639
+ return (0, jsx_runtime_1.jsxs)("div", { style: { marginBottom: '1px' }, children: [row, this.state.showControls && this.updates()] });
645
640
  }
646
641
  }
647
642
  class StructureRepresentationEntry extends base_1.PurePluginUIComponent {
@@ -677,6 +672,6 @@ class StructureRepresentationEntry extends base_1.PurePluginUIComponent {
677
672
  }
678
673
  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')
679
674
  label = 'Custom Selection';
680
- return (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: 'msp-representation-entry' }, { children: [repr.parent && (0, jsx_runtime_1.jsx)(common_1.ExpandGroup, Object.assign({ 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' } })] }));
675
+ 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' } })] });
681
676
  }
682
677
  }
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { ControlsWrapper, Log } from 'molstar/lib/mol-plugin-ui/plugin';
3
2
  import { SequenceView } from 'molstar/lib/mol-plugin-ui/sequence';
4
3
  export declare const UIComponents: {
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveHTMLElement = exports.createPluginSplitUI = exports.LayoutSpecComponent = void 0;
3
+ exports.LayoutSpecComponent = LayoutSpecComponent;
4
+ exports.createPluginSplitUI = createPluginSplitUI;
5
+ exports.resolveHTMLElement = resolveHTMLElement;
4
6
  const tslib_1 = require("tslib");
5
7
  const jsx_runtime_1 = require("react/jsx-runtime");
6
8
  const base_1 = require("molstar/lib/mol-plugin-ui/base");
@@ -11,10 +13,9 @@ const spec_1 = require("../../spec");
11
13
  function LayoutSpecComponent(target, component, props) {
12
14
  return { target, component, props };
13
15
  }
14
- exports.LayoutSpecComponent = LayoutSpecComponent;
15
16
  function createPluginSplitUI(options) {
16
- var _a;
17
17
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
18
+ var _a;
18
19
  const { spec, layout, onBeforeUIRender } = options;
19
20
  const render = (_a = options.render) !== null && _a !== void 0 ? _a : react18_1.renderReact18;
20
21
  const ctx = new context_1.PluginUIContext(spec || (0, spec_1.DefaultPluginUISpec)());
@@ -44,7 +45,6 @@ function createPluginSplitUI(options) {
44
45
  return ctx;
45
46
  });
46
47
  }
47
- exports.createPluginSplitUI = createPluginSplitUI;
48
48
  function resolveHTMLElement(element) {
49
49
  if (typeof element === 'string') {
50
50
  const result = document.getElementById(element);
@@ -56,7 +56,6 @@ function resolveHTMLElement(element) {
56
56
  return element;
57
57
  }
58
58
  }
59
- exports.resolveHTMLElement = resolveHTMLElement;
60
59
  function PluginPanelWrapper({ plugin, component, props }) {
61
60
  const [state, setState] = (0, react_1.useState)({ kind: 'pending' });
62
61
  (0, react_1.useEffect)(() => {
@@ -73,7 +72,7 @@ function PluginPanelWrapper({ plugin, component, props }) {
73
72
  }, [plugin]);
74
73
  if (state.kind !== 'initialized') {
75
74
  const message = state.kind === 'error' ? `Initialization error: ${state.message}` : 'Waiting for plugin initialization';
76
- return (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'msp-plugin', style: { position: 'relative', width: '100%', height: '100%' } }, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'msp-plugin-init-error' }, { children: message })) }));
75
+ return (0, jsx_runtime_1.jsx)("div", { className: 'msp-plugin', style: { position: 'relative', width: '100%', height: '100%' }, children: (0, jsx_runtime_1.jsx)("div", { className: 'msp-plugin-init-error', children: message }) });
77
76
  }
78
- return (0, jsx_runtime_1.jsx)(base_1.PluginReactContext.Provider, Object.assign({ value: plugin }, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'msp-plugin', style: { position: 'relative', width: '100%', height: '100%' } }, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'msp-plugin-content msp-layout-standard msp-layout-static', style: { position: 'relative', width: '100%', height: '100%' } }, { children: (0, react_1.createElement)(component, props) })) })) }));
77
+ return (0, jsx_runtime_1.jsx)(base_1.PluginReactContext.Provider, { value: plugin, children: (0, jsx_runtime_1.jsx)("div", { className: 'msp-plugin', style: { position: 'relative', width: '100%', height: '100%' }, children: (0, jsx_runtime_1.jsx)("div", { className: 'msp-plugin-content msp-layout-standard msp-layout-static', style: { position: 'relative', width: '100%', height: '100%' }, children: (0, react_1.createElement)(component, props) }) }) });
79
78
  }
@@ -72,34 +72,29 @@ class ComponentListControls extends base_1.PurePluginUIComponent {
72
72
  (_a = customState.events) === null || _a === void 0 ? void 0 : _a.isBusy.next(true);
73
73
  const visualEntites = (type === 'ligands') ? this.state.ligGroups : this.state.carbGroups;
74
74
  setTimeout(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
75
- var _b, e_1, _c, _d;
76
- var _e;
75
+ var _a, e_1, _b, _c;
76
+ var _d;
77
77
  try {
78
- for (var _f = true, visualEntites_1 = tslib_1.__asyncValues(visualEntites), visualEntites_1_1; visualEntites_1_1 = yield visualEntites_1.next(), _b = visualEntites_1_1.done, !_b;) {
79
- _d = visualEntites_1_1.value;
80
- _f = false;
81
- try {
82
- const visualEntity = _d;
83
- this.plugin.managers.structure.hierarchy.toggleVisibility(visualEntity, action);
84
- }
85
- finally {
86
- _f = true;
87
- }
78
+ for (var _e = true, visualEntites_1 = tslib_1.__asyncValues(visualEntites), visualEntites_1_1; visualEntites_1_1 = yield visualEntites_1.next(), _a = visualEntites_1_1.done, !_a; _e = true) {
79
+ _c = visualEntites_1_1.value;
80
+ _e = false;
81
+ const visualEntity = _c;
82
+ this.plugin.managers.structure.hierarchy.toggleVisibility(visualEntity, action);
88
83
  }
89
84
  }
90
85
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
91
86
  finally {
92
87
  try {
93
- if (!_f && !_b && (_c = visualEntites_1.return)) yield _c.call(visualEntites_1);
88
+ if (!_e && !_a && (_b = visualEntites_1.return)) yield _b.call(visualEntites_1);
94
89
  }
95
90
  finally { if (e_1) throw e_1.error; }
96
91
  }
97
92
  ;
98
- (_e = customState.events) === null || _e === void 0 ? void 0 : _e.isBusy.next(false);
93
+ (_d = customState.events) === null || _d === void 0 ? void 0 : _d.isBusy.next(false);
99
94
  }));
100
95
  };
101
96
  this.showHideAllControls = (type) => {
102
- return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(common_1.Button, Object.assign({ icon: icons_1.CheckSvg, flex: true, onClick: (e) => this.toggleVisible(e, 'show', type), style: { flex: '0 0 50px', textAlign: 'center', fontSize: '80%', color: '#9cacc3', padding: 0 }, title: `Show all ${type}`, disabled: false }, { children: "All" })), (0, jsx_runtime_1.jsx)(common_1.Button, Object.assign({ icon: icons_1.CloseSvg, flex: true, onClick: (e) => this.toggleVisible(e, 'hide', type), style: { flex: '0 0 50px', textAlign: 'center', fontSize: '80%', color: '#9cacc3', padding: 0 }, title: `Hide all ${type}`, disabled: false }, { children: "None" }))] });
97
+ return (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: (e) => this.toggleVisible(e, 'show', type), style: { flex: '0 0 50px', textAlign: 'center', fontSize: '80%', color: '#9cacc3', padding: 0 }, title: `Show all ${type}`, disabled: false, children: "All" }), (0, jsx_runtime_1.jsx)(common_1.Button, { icon: icons_1.CloseSvg, flex: true, onClick: (e) => this.toggleVisible(e, 'hide', type), style: { flex: '0 0 50px', textAlign: 'center', fontSize: '80%', color: '#9cacc3', padding: 0 }, title: `Hide all ${type}`, disabled: false, children: "None" })] });
103
98
  };
104
99
  this.clearLigSearch = (e) => {
105
100
  e.preventDefault();
@@ -128,7 +123,7 @@ class ComponentListControls extends base_1.PurePluginUIComponent {
128
123
  const title = (type === 'ligands') ? 'Ligand' : 'Carbohydrates';
129
124
  const visibleVisuals = (type === 'ligands') ? this.state.ligGroups.length : this.state.carbGroups.length;
130
125
  const totalVisuals = (type === 'ligands') ? this.state.componentGroups.ligGroups.length : this.state.componentGroups.carbGroups.length;
131
- return (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: 'msp-flex-row', style: { marginTop: '6px' } }, { children: [(0, jsx_runtime_1.jsxs)("button", Object.assign({ className: 'msp-form-control msp-control-button-label msp-transform-header-brand-gray', style: { textAlign: 'left' }, onClick: (e) => this.collapseSection(e, type) }, { children: [(0, jsx_runtime_1.jsx)("span", { children: (0, jsx_runtime_1.jsx)("strong", { children: title }) }), (0, jsx_runtime_1.jsxs)("small", Object.assign({ style: { color: '#7d91b0' } }, { children: [" ( ", visibleVisuals, visibleVisuals < totalVisuals ? ` / ${totalVisuals}` : '', " )"] }))] })), visibleVisuals > 1 && showHideAllControls] }));
126
+ return (0, jsx_runtime_1.jsxs)("div", { className: 'msp-flex-row', style: { marginTop: '6px' }, children: [(0, jsx_runtime_1.jsxs)("button", { className: 'msp-form-control msp-control-button-label msp-transform-header-brand-gray', style: { textAlign: 'left' }, onClick: (e) => this.collapseSection(e, type), children: [(0, jsx_runtime_1.jsx)("span", { children: (0, jsx_runtime_1.jsx)("strong", { children: title }) }), (0, jsx_runtime_1.jsxs)("small", { style: { color: '#7d91b0' }, children: [" ( ", visibleVisuals, visibleVisuals < totalVisuals ? ` / ${totalVisuals}` : '', " )"] })] }), visibleVisuals > 1 && showHideAllControls] });
132
127
  };
133
128
  }
134
129
  componentDidMount() {
@@ -200,11 +195,11 @@ class ComponentListControls extends base_1.PurePluginUIComponent {
200
195
  this.setState({ componentGroups: componentGroupsVal, ligGroups: componentGroupsVal.ligGroups, carbGroups: componentGroupsVal.carbGroups, ligSearchText: '', carbSearchText: '' });
201
196
  }
202
197
  render() {
203
- const ligSearchControls = (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: 'msp-mapped-parameter-group', style: { fontSize: '90%' } }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: 'msp-control-row msp-transform-header-brand-gray', style: { height: '33px' } }, { children: [(0, jsx_runtime_1.jsx)("span", Object.assign({ className: 'msp-control-row-label' }, { children: "Search Ligand" })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'msp-control-row-ctrl' }, { children: (0, jsx_runtime_1.jsx)("input", { type: 'text', placeholder: 'Enter HET code', disabled: this.state.isBusy, onChange: e => this.ligInputStream.next(e.target.value), value: this.state.ligSearchText, maxLength: 3 }) }))] })), (0, jsx_runtime_1.jsx)(common_1.IconButton, { svg: icons_1.CloseSvg, flex: true, onClick: this.clearLigSearch, style: { flex: '0 0 24px', padding: 0 }, disabled: this.state.ligSearchText === '' || this.state.isBusy, toggleState: this.state.ligSearchText !== '', title: 'Clear search input' })] }));
204
- const carbSearchControls = (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: 'msp-mapped-parameter-group', style: { fontSize: '90%' } }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: 'msp-control-row msp-transform-header-brand-gray', style: { height: '33px' } }, { children: [(0, jsx_runtime_1.jsx)("span", Object.assign({ className: 'msp-control-row-label' }, { children: "Search Carbohydrate" })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'msp-control-row-ctrl' }, { children: (0, jsx_runtime_1.jsx)("input", { type: 'text', placeholder: 'Enter HET code', disabled: this.state.isBusy, onChange: e => this.carbInputStream.next(e.target.value), value: this.state.carbSearchText, maxLength: 3 }) }))] })), (0, jsx_runtime_1.jsx)(common_1.IconButton, { svg: icons_1.CloseSvg, flex: true, onClick: this.clearCarbSearch, style: { flex: '0 0 24px', padding: 0 }, disabled: this.state.carbSearchText === '' || this.state.isBusy, toggleState: this.state.carbSearchText !== '', title: 'Clear search input' })] }));
198
+ const ligSearchControls = (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' }, children: [(0, jsx_runtime_1.jsx)("span", { className: 'msp-control-row-label', children: "Search Ligand" }), (0, jsx_runtime_1.jsx)("div", { className: 'msp-control-row-ctrl', children: (0, jsx_runtime_1.jsx)("input", { type: 'text', placeholder: 'Enter HET code', disabled: this.state.isBusy, onChange: e => this.ligInputStream.next(e.target.value), value: this.state.ligSearchText, maxLength: 3 }) })] }), (0, jsx_runtime_1.jsx)(common_1.IconButton, { svg: icons_1.CloseSvg, flex: true, onClick: this.clearLigSearch, style: { flex: '0 0 24px', padding: 0 }, disabled: this.state.ligSearchText === '' || this.state.isBusy, toggleState: this.state.ligSearchText !== '', title: 'Clear search input' })] });
199
+ const carbSearchControls = (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' }, children: [(0, jsx_runtime_1.jsx)("span", { className: 'msp-control-row-label', children: "Search Carbohydrate" }), (0, jsx_runtime_1.jsx)("div", { className: 'msp-control-row-ctrl', children: (0, jsx_runtime_1.jsx)("input", { type: 'text', placeholder: 'Enter HET code', disabled: this.state.isBusy, onChange: e => this.carbInputStream.next(e.target.value), value: this.state.carbSearchText, maxLength: 3 }) })] }), (0, jsx_runtime_1.jsx)(common_1.IconButton, { svg: icons_1.CloseSvg, flex: true, onClick: this.clearCarbSearch, style: { flex: '0 0 24px', padding: 0 }, disabled: this.state.carbSearchText === '' || this.state.isBusy, toggleState: this.state.carbSearchText !== '', title: 'Clear search input' })] });
205
200
  const ligSectionHeader = this.sectionHeader('ligands');
206
201
  const carbSectionHeader = this.sectionHeader('carbohydrates');
207
- return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(this.state.componentGroups.nonLigGroups.length > 0) && (0, jsx_runtime_1.jsx)("div", { children: this.state.componentGroups.nonLigGroups.map((g) => (0, jsx_runtime_1.jsx)(StructureComponentGroup, { group: g, boldHeader: true }, g[0].cell.transform.ref)) }), (this.state.componentGroups.alphafold.length > 0) && (0, jsx_runtime_1.jsx)("div", { children: this.state.componentGroups.alphafold.map((g) => (0, jsx_runtime_1.jsx)(StructureComponentGroup, { group: g, boldHeader: true, type: 'alphafold' }, g[0].cell.transform.ref)) }), (this.state.componentGroups.ligGroups.length > 0) && ligSectionHeader, (!this.state.isLigCollapsed && this.state.componentGroups.ligGroups.length > 5) && ligSearchControls, (this.state.componentGroups.ligGroups.length > 0) && (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'msp-control-offset', style: { maxHeight: '800px', overflowY: 'auto' } }, { children: !this.state.isLigCollapsed && this.state.ligGroups.map((g) => (0, jsx_runtime_1.jsx)(StructureComponentGroup, { group: g, boldHeader: false }, g[0].cell.transform.ref)) })), (this.state.componentGroups.carbGroups.length > 0) && carbSectionHeader, (!this.state.isCarbCollapsed && this.state.componentGroups.carbGroups.length > 5) && carbSearchControls, (this.state.componentGroups.carbGroups.length > 0) && (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'msp-control-offset', style: { maxHeight: '800px', overflowY: 'auto' } }, { children: !this.state.isCarbCollapsed && this.state.carbGroups.map((g) => (0, jsx_runtime_1.jsx)(StructureComponentGroup, { group: g, boldHeader: false }, g[0].cell.transform.ref)) }))] });
202
+ return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(this.state.componentGroups.nonLigGroups.length > 0) && (0, jsx_runtime_1.jsx)("div", { children: this.state.componentGroups.nonLigGroups.map((g) => (0, jsx_runtime_1.jsx)(StructureComponentGroup, { group: g, boldHeader: true }, g[0].cell.transform.ref)) }), (this.state.componentGroups.alphafold.length > 0) && (0, jsx_runtime_1.jsx)("div", { children: this.state.componentGroups.alphafold.map((g) => (0, jsx_runtime_1.jsx)(StructureComponentGroup, { group: g, boldHeader: true, type: 'alphafold' }, g[0].cell.transform.ref)) }), (this.state.componentGroups.ligGroups.length > 0) && ligSectionHeader, (!this.state.isLigCollapsed && this.state.componentGroups.ligGroups.length > 5) && ligSearchControls, (this.state.componentGroups.ligGroups.length > 0) && (0, jsx_runtime_1.jsx)("div", { className: 'msp-control-offset', style: { maxHeight: '800px', overflowY: 'auto' }, children: !this.state.isLigCollapsed && this.state.ligGroups.map((g) => (0, jsx_runtime_1.jsx)(StructureComponentGroup, { group: g, boldHeader: false }, g[0].cell.transform.ref)) }), (this.state.componentGroups.carbGroups.length > 0) && carbSectionHeader, (!this.state.isCarbCollapsed && this.state.componentGroups.carbGroups.length > 5) && carbSearchControls, (this.state.componentGroups.carbGroups.length > 0) && (0, jsx_runtime_1.jsx)("div", { className: 'msp-control-offset', style: { maxHeight: '800px', overflowY: 'auto' }, children: !this.state.isCarbCollapsed && this.state.carbGroups.map((g) => (0, jsx_runtime_1.jsx)(StructureComponentGroup, { group: g, boldHeader: false }, g[0].cell.transform.ref)) })] });
208
203
  }
209
204
  }
210
205
  class StructureComponentGroup extends base_1.PurePluginUIComponent {
@@ -298,7 +293,7 @@ class StructureComponentGroup extends base_1.PurePluginUIComponent {
298
293
  const cell = component.cell;
299
294
  const label = (_a = cell.obj) === null || _a === void 0 ? void 0 : _a.label;
300
295
  const labelEle = this.props.boldHeader ? (0, jsx_runtime_1.jsx)("strong", { children: label }) : label;
301
- return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: 'msp-flex-row' }, { children: [(0, jsx_runtime_1.jsx)(common_1.Button, Object.assign({ noOverflow: true, className: 'msp-control-button-label', title: `${label} - Click to focus.`, onClick: this.focus, style: { textAlign: 'left' }, disabled: this.state.isBusy }, { children: labelEle })), (0, jsx_runtime_1.jsx)(common_1.IconButton, { disabled: this.state.isBusy, svg: this.state.isHidden ? icons_1.VisibilityOffOutlinedSvg : icons_1.VisibilityOutlinedSvg, toggleState: false, onClick: this.toggleVisible, title: `${this.state.isHidden ? 'Show' : 'Hide'} component`, small: true, className: 'msp-form-control', flex: true }), (0, jsx_runtime_1.jsx)(common_1.IconButton, { disabled: this.state.isBusy, svg: icons_1.MoreHorizSvg, onClick: this.toggleAction, title: 'Actions', toggleState: this.state.action === 'action', className: 'msp-form-control', flex: true })] })), this.state.action === 'action' && (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'msp-accent-offset' }, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ style: { marginBottom: '6px' } }, { children: component.representations.map(r => (0, jsx_runtime_1.jsx)(StructureRepresentationEntry, { group: this.props.group, representation: r }, r.cell.transform.ref)) })) }))] });
296
+ return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: 'msp-flex-row', children: [(0, jsx_runtime_1.jsx)(common_1.Button, { noOverflow: true, className: 'msp-control-button-label', title: `${label} - Click to focus.`, onClick: this.focus, style: { textAlign: 'left' }, disabled: this.state.isBusy, children: labelEle }), (0, jsx_runtime_1.jsx)(common_1.IconButton, { disabled: this.state.isBusy, svg: this.state.isHidden ? icons_1.VisibilityOffOutlinedSvg : icons_1.VisibilityOutlinedSvg, toggleState: false, onClick: this.toggleVisible, title: `${this.state.isHidden ? 'Show' : 'Hide'} component`, small: true, className: 'msp-form-control', flex: true }), (0, jsx_runtime_1.jsx)(common_1.IconButton, { disabled: this.state.isBusy, svg: icons_1.MoreHorizSvg, onClick: this.toggleAction, title: 'Actions', toggleState: this.state.action === 'action', className: 'msp-form-control', flex: true })] }), this.state.action === 'action' && (0, jsx_runtime_1.jsx)("div", { className: 'msp-accent-offset', children: (0, jsx_runtime_1.jsx)("div", { style: { marginBottom: '6px' }, children: component.representations.map(r => (0, jsx_runtime_1.jsx)(StructureRepresentationEntry, { group: this.props.group, representation: r }, r.cell.transform.ref)) }) })] });
302
297
  }
303
298
  }
304
299
  class StructureRepresentationEntry extends base_1.PurePluginUIComponent {
@@ -398,6 +393,6 @@ class StructureRepresentationEntry extends base_1.PurePluginUIComponent {
398
393
  if (reprObj.tags && reprObj.tags.indexOf('af-superposition-visual') >= 0)
399
394
  isAlphafold = true;
400
395
  }
401
- return (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'msp-representation-entry' }, { children: repr.parent && (0, jsx_runtime_1.jsxs)("div", { children: [(clusterSelectArr.length > 2 && !isSurrVisual && !isAlphafold) && (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'msp-representation-entry' }, { children: (0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: clusterOptions, values: this.state.clusterVal, onChangeValues: this.selectCluster, isDisabled: this.state.isBusy }) })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'msp-representation-entry' }, { children: (0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: { type: (_a = repr.params) === null || _a === void 0 ? void 0 : _a.definition.type }, values: { type: (_b = repr.params) === null || _b === void 0 ? void 0 : _b.values.type }, onChangeValues: this.update, isDisabled: this.state.isBusy }) })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'msp-representation-entry' }, { children: (0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: { colorTheme: (_c = repr.params) === null || _c === void 0 ? void 0 : _c.definition.colorTheme }, values: { colorTheme: (_d = repr.params) === null || _d === void 0 ? void 0 : _d.values.colorTheme }, onChangeValues: this.update, isDisabled: this.state.isBusy }) })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'msp-representation-entry' }, { children: (0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: { sizeTheme: (_e = repr.params) === null || _e === void 0 ? void 0 : _e.definition.sizeTheme }, values: { sizeTheme: (_f = repr.params) === null || _f === void 0 ? void 0 : _f.values.sizeTheme }, onChangeValues: this.update, isDisabled: this.state.isBusy }) }))] }) }));
396
+ return (0, jsx_runtime_1.jsx)("div", { className: 'msp-representation-entry', children: repr.parent && (0, jsx_runtime_1.jsxs)("div", { children: [(clusterSelectArr.length > 2 && !isSurrVisual && !isAlphafold) && (0, jsx_runtime_1.jsx)("div", { className: 'msp-representation-entry', children: (0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: clusterOptions, values: this.state.clusterVal, onChangeValues: this.selectCluster, isDisabled: this.state.isBusy }) }), (0, jsx_runtime_1.jsx)("div", { className: 'msp-representation-entry', children: (0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: { type: (_a = repr.params) === null || _a === void 0 ? void 0 : _a.definition.type }, values: { type: (_b = repr.params) === null || _b === void 0 ? void 0 : _b.values.type }, onChangeValues: this.update, isDisabled: this.state.isBusy }) }), (0, jsx_runtime_1.jsx)("div", { className: 'msp-representation-entry', children: (0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: { colorTheme: (_c = repr.params) === null || _c === void 0 ? void 0 : _c.definition.colorTheme }, values: { colorTheme: (_d = repr.params) === null || _d === void 0 ? void 0 : _d.values.colorTheme }, onChangeValues: this.update, isDisabled: this.state.isBusy }) }), (0, jsx_runtime_1.jsx)("div", { className: 'msp-representation-entry', children: (0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: { sizeTheme: (_e = repr.params) === null || _e === void 0 ? void 0 : _e.definition.sizeTheme }, values: { sizeTheme: (_f = repr.params) === null || _f === void 0 ? void 0 : _f.values.sizeTheme }, onChangeValues: this.update, isDisabled: this.state.isBusy }) })] }) });
402
397
  }
403
398
  }
@@ -9,8 +9,8 @@ declare const DefaultSymmetryParams: {
9
9
  on: PD.BooleanParam;
10
10
  /** Index of the currently selected symmetry (in case there a more symmetries for an assembly), regardless of whether visibility is on of off */
11
11
  symmetryIndex: PD.Select<number>;
12
- /** `true` if symmetry data have been retrieved but do not contain any non-trivial symmetry */
13
- noSymmetries: PD.BooleanParam;
12
+ /** `true` if visibility is on and symmetry data have been retrieved and contain at least one non-trivial symmetry. */
13
+ hasSymmetries: PD.BooleanParam;
14
14
  };
15
15
  type SymmetryParams = typeof DefaultSymmetryParams;
16
16
  type SymmetryProps = PD.ValuesFor<SymmetryParams>;
@@ -25,8 +25,8 @@ export declare class SymmetryAnnotationControls extends PurePluginUIComponent<{}
25
25
  componentDidMount(): void;
26
26
  /** Synchronize parameters and values in UI with real parameters currently applied in `AssemblySymmetryProvider` */
27
27
  syncParams(): void;
28
- /** Return `true` if symmetry data have been retrieved and do not contain any non-trivial symmetry. */
29
- noSymmetriesAvailable(): boolean;
28
+ /** Return `true` if symmetry data have been retrieved and contain at least one non-trivial symmetry. */
29
+ hasSymmetriesAvailable(): boolean;
30
30
  /** Get the first loaded structure, if any. */
31
31
  getPivotStructure(): StructureRef | undefined;
32
32
  /** Get parameters currently applied in `AssemblySymmetryProvider` */
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isAssemblySymmetryAnnotationApplicable = exports.SymmetryAnnotationControls = void 0;
3
+ exports.SymmetryAnnotationControls = void 0;
4
+ exports.isAssemblySymmetryAnnotationApplicable = isAssemblySymmetryAnnotationApplicable;
4
5
  const tslib_1 = require("tslib");
5
6
  const jsx_runtime_1 = require("react/jsx-runtime");
6
7
  const behavior_1 = require("molstar/lib/extensions/assembly-symmetry/behavior");
@@ -15,8 +16,8 @@ const DefaultSymmetryParams = {
15
16
  on: param_definition_1.ParamDefinition.Boolean(false, { isHidden: true }),
16
17
  /** Index of the currently selected symmetry (in case there a more symmetries for an assembly), regardless of whether visibility is on of off */
17
18
  symmetryIndex: param_definition_1.ParamDefinition.Select(0, [[0, 'Auto']]),
18
- /** `true` if symmetry data have been retrieved but do not contain any non-trivial symmetry */
19
- noSymmetries: param_definition_1.ParamDefinition.Boolean(false, { isHidden: true }),
19
+ /** `true` if visibility is on and symmetry data have been retrieved and contain at least one non-trivial symmetry. */
20
+ hasSymmetries: param_definition_1.ParamDefinition.Boolean(false, { isHidden: true }),
20
21
  };
21
22
  const DefaultSymmetryControlsState = {
22
23
  params: DefaultSymmetryParams,
@@ -54,21 +55,21 @@ class SymmetryAnnotationControls extends base_1.PurePluginUIComponent {
54
55
  /** Synchronize parameters and values in UI with real parameters currently applied in `AssemblySymmetryProvider` */
55
56
  syncParams() {
56
57
  if (this.hasAssemblySymmetry3D()) {
57
- const noSymmetries = this.noSymmetriesAvailable();
58
+ const hasSymmetries = this.hasSymmetriesAvailable();
58
59
  const realParams = this.getRealParams();
59
60
  const realValues = this.getRealValues();
60
- const options = noSymmetries ?
61
- [[0, 'None']]
62
- : realParams.symmetryIndex.options.filter(([index, label]) => index >= 0); // Removing the 'off' option (having index -1)
61
+ const options = hasSymmetries ?
62
+ realParams.symmetryIndex.options.filter(([index, label]) => index >= 0) // Removing the 'off' option (having index -1)
63
+ : [[0, 'None']];
63
64
  const params = Object.assign(Object.assign({}, this.state.params), { symmetryIndex: param_definition_1.ParamDefinition.Select(0, options) });
64
65
  const values = (realValues.symmetryIndex >= 0) ? {
65
66
  on: true,
66
67
  symmetryIndex: realValues.symmetryIndex,
67
- noSymmetries: noSymmetries,
68
+ hasSymmetries,
68
69
  } : {
69
70
  on: false,
70
71
  symmetryIndex: this.state.values.symmetryIndex,
71
- noSymmetries: noSymmetries,
72
+ hasSymmetries,
72
73
  };
73
74
  this.setState({ params, values });
74
75
  }
@@ -79,12 +80,12 @@ class SymmetryAnnotationControls extends base_1.PurePluginUIComponent {
79
80
  });
80
81
  }
81
82
  }
82
- /** Return `true` if symmetry data have been retrieved and do not contain any non-trivial symmetry. */
83
- noSymmetriesAvailable() {
83
+ /** Return `true` if symmetry data have been retrieved and contain at least one non-trivial symmetry. */
84
+ hasSymmetriesAvailable() {
84
85
  var _a, _b;
85
86
  const structure = (_b = (_a = this.getPivotStructure()) === null || _a === void 0 ? void 0 : _a.cell.obj) === null || _b === void 0 ? void 0 : _b.data;
86
87
  const symmetryData = structure && prop_1.AssemblySymmetryDataProvider.get(structure).value;
87
- return symmetryData !== undefined && symmetryData.filter(sym => sym.symbol !== 'C1').length === 0;
88
+ return symmetryData !== undefined && symmetryData.filter(sym => sym.symbol !== 'C1').length > 0;
88
89
  }
89
90
  /** Get the first loaded structure, if any. */
90
91
  getPivotStructure() {
@@ -145,8 +146,8 @@ class SymmetryAnnotationControls extends base_1.PurePluginUIComponent {
145
146
  }
146
147
  /** Run changes needed to change parameter values, and set UI accordingly */
147
148
  changeParamValues(values) {
148
- var _a;
149
149
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
150
+ var _a;
150
151
  const struct = this.getPivotStructure();
151
152
  if (!struct)
152
153
  return;
@@ -201,20 +202,13 @@ class SymmetryAnnotationControls extends base_1.PurePluginUIComponent {
201
202
  });
202
203
  }
203
204
  render() {
204
- const shortTitle = 'Assembly Symmetry' + (this.state.values.noSymmetries ? ' [Not Available]' : '');
205
- const title = 'Assembly Symmetry' + (this.state.values.noSymmetries ? ' [Not Available]\nSymmetry information for this assembly is not available' : '');
206
- return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(SymmetryAnnotationRowControls, { shortTitle: shortTitle, title: title, applied: this.state.values.on, onChangeApplied: applied => this.apply(applied), params: this.state.params, values: this.state.values, onChangeValues: v => this.changeParamValues(v) }) });
205
+ const notAvailable = this.state.values.on && !this.state.values.hasSymmetries;
206
+ const shortTitle = 'Assembly Symmetry' + (notAvailable ? ' [Not Available]' : '');
207
+ const title = 'Assembly Symmetry' + (notAvailable ? ' [Not Available]\nSymmetry information for this assembly is not available' : '');
208
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(annotation_row_controls_1.AnnotationRowControls, { shortTitle: shortTitle, title: title, applied: this.state.values.on, onChangeApplied: applied => this.apply(applied), params: this.state.params, values: this.state.values, onChangeValues: v => this.changeParamValues(v), errorMessage: !this.state.values.on ? 'First activate annotation to show options' : notAvailable ? 'Symmetry information not available' : undefined }) });
207
209
  }
208
210
  }
209
211
  exports.SymmetryAnnotationControls = SymmetryAnnotationControls;
210
- class SymmetryAnnotationRowControls extends annotation_row_controls_1.AnnotationRowControls {
211
- renderOptions() {
212
- if (this.props.values.noSymmetries) {
213
- return (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'msp-row-text' }, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ title: 'Symmetry information for this assembly is not available' }, { children: "Symmetry information not available" })) }));
214
- }
215
- return super.renderOptions();
216
- }
217
- }
218
212
  /** Get the first loaded structure, if any. */
219
213
  function getPivotStructure(plugin) {
220
214
  return plugin.managers.structure.hierarchy.selection.structures[0];
@@ -229,4 +223,3 @@ function isAssemblySymmetryAnnotationApplicable(plugin) {
229
223
  // by `AssemblySymmetry.isApplicable = struct => struct?.units[0].conformation.operator.assembly !== undefined;`
230
224
  // But we cannot easily override the `fetch` function which calls the original `isApplicable`.
231
225
  }
232
- exports.isAssemblySymmetryAnnotationApplicable = isAssemblySymmetryAnnotationApplicable;
package/lib/viewer.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- /// <reference types="react" />
1
+ import { loadMVS } from 'molstar/lib/extensions/mvs/load';
2
+ import { MVSData } from 'molstar/lib/extensions/mvs/mvs-data';
2
3
  import { Canvas3DProps } from 'molstar/lib/mol-canvas3d/canvas3d';
3
4
  import { EmptyLoci } from 'molstar/lib/mol-model/loci';
4
5
  import { StructureElement } from 'molstar/lib/mol-model/structure';
@@ -6,6 +7,7 @@ import { StructureRef } from 'molstar/lib/mol-plugin-state/manager/structure/hie
6
7
  import { PluginContext } from 'molstar/lib/mol-plugin/context';
7
8
  import { Color } from 'molstar/lib/mol-util/color/color';
8
9
  import * as Foldseek from './extensions/foldseek';
10
+ import * as Interactions from './extensions/interactions';
9
11
  import { StateGalleryManager } from './extensions/state-gallery/manager';
10
12
  import { StateGalleryControls } from './extensions/state-gallery/ui';
11
13
  import { LoadParams, QueryParam } from './helpers';
@@ -37,7 +39,7 @@ export declare class PDBeMolstarPlugin {
37
39
  format: string;
38
40
  isBinary: boolean;
39
41
  };
40
- get state(): import("molstar/lib/mol-state/state").State;
42
+ get state(): import("molstar/lib/mol-state").State;
41
43
  createLigandStructure(isBranched: boolean): Promise<void>;
42
44
  load({ url, format, isBinary, assemblyId, progressMessage, id }: LoadParams, fullLoad?: boolean): Promise<void>;
43
45
  /** Remove loaded structure(s).
@@ -189,6 +191,25 @@ export declare class PDBeMolstarPlugin {
189
191
  /** Helper functions related to specific views or use cases */
190
192
  static extensions: {
191
193
  Foldseek: typeof Foldseek;
194
+ Interactions: typeof Interactions;
195
+ MVS: {
196
+ MVSData: {
197
+ SupportedVersion: number;
198
+ fromMVSJ(mvsjString: string): MVSData;
199
+ toMVSJ(mvsData: MVSData, space?: string | number): string;
200
+ isValid(mvsData: MVSData, options?: {
201
+ noExtra?: boolean;
202
+ }): boolean;
203
+ validationIssues(mvsData: MVSData, options?: {
204
+ noExtra?: boolean;
205
+ }): string[] | undefined;
206
+ toPrettyString(mvsData: MVSData): string;
207
+ createBuilder(): import("molstar/lib/extensions/mvs/tree/mvs/mvs-builder").Root;
208
+ createMultistate(snapshots: import("molstar/lib/extensions/mvs/mvs-data").Snapshot[], metadata?: Pick<import("molstar/lib/extensions/mvs/mvs-data").GlobalMetadata, "title" | "description" | "description_format">): import("molstar/lib/extensions/mvs/mvs-data").MVSData_States;
209
+ stateToStates(state: import("molstar/lib/extensions/mvs/mvs-data").MVSData_State): import("molstar/lib/extensions/mvs/mvs-data").MVSData_States;
210
+ };
211
+ loadMVS: typeof loadMVS;
212
+ };
192
213
  StateGallery: {
193
214
  StateGalleryManager: typeof StateGalleryManager;
194
215
  StateGalleryCustomState: (plugin: PluginContext) => Partial<import("./extensions/state-gallery/behavior").StateGalleryCustomState>;
@@ -206,4 +227,5 @@ export declare class PDBeMolstarPlugin {
206
227
  readonly DefaultLeftPanelControls: import("react").ComponentClass<{}, any>;
207
228
  readonly DefaultRightPanelControls: typeof import("molstar/lib/mol-plugin-ui/plugin").ControlsWrapper;
208
229
  };
230
+ static MAIN_STRUCTURE_ID: string;
209
231
  }