molstar 3.0.0-dev.9 → 3.0.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 (212) hide show
  1. package/README.md +7 -0
  2. package/build/viewer/index.html +2 -2
  3. package/build/viewer/molstar.js +1 -1
  4. package/lib/apps/viewer/app.d.ts +1 -1
  5. package/lib/apps/viewer/app.js +15 -5
  6. package/lib/apps/viewer/index.html +2 -2
  7. package/lib/commonjs/apps/viewer/app.d.ts +1 -1
  8. package/lib/commonjs/apps/viewer/app.js +15 -5
  9. package/lib/commonjs/examples/basic-wrapper/index.js +7 -3
  10. package/lib/commonjs/examples/proteopedia-wrapper/index.js +7 -1
  11. package/lib/commonjs/extensions/anvil/representation.js +1 -1
  12. package/lib/commonjs/extensions/model-export/export.d.ts +9 -0
  13. package/lib/commonjs/extensions/model-export/export.js +129 -0
  14. package/lib/commonjs/extensions/model-export/index.d.ts +7 -0
  15. package/lib/commonjs/extensions/model-export/index.js +36 -0
  16. package/lib/commonjs/extensions/model-export/ui.d.ts +11 -0
  17. package/lib/commonjs/extensions/model-export/ui.js +77 -0
  18. package/lib/commonjs/extensions/mp4-export/encoder.js +1 -1
  19. package/lib/commonjs/extensions/rcsb/assembly-symmetry/behavior.d.ts +2 -2
  20. package/lib/commonjs/extensions/rcsb/graphql/types.d.ts +2 -2
  21. package/lib/commonjs/mol-canvas3d/canvas3d.d.ts +12 -4
  22. package/lib/commonjs/mol-canvas3d/canvas3d.js +1 -1
  23. package/lib/commonjs/mol-canvas3d/controls/trackball.d.ts +9 -4
  24. package/lib/commonjs/mol-canvas3d/controls/trackball.js +50 -11
  25. package/lib/commonjs/mol-io/reader/cif/schema/bird.d.ts +1 -1
  26. package/lib/commonjs/mol-io/reader/cif/schema/bird.js +1 -1
  27. package/lib/commonjs/mol-io/reader/cif/schema/ccd.d.ts +1 -1
  28. package/lib/commonjs/mol-io/reader/cif/schema/ccd.js +1 -1
  29. package/lib/commonjs/mol-io/reader/cif/schema/mmcif.d.ts +2 -2
  30. package/lib/commonjs/mol-io/reader/cif/schema/mmcif.js +1 -1
  31. package/lib/commonjs/mol-io/reader/mol/parser.d.ts +23 -1
  32. package/lib/commonjs/mol-io/reader/mol/parser.js +116 -4
  33. package/lib/commonjs/mol-io/reader/sdf/parser-v3-util.d.ts +6 -0
  34. package/lib/commonjs/mol-io/reader/sdf/parser-v3-util.js +9 -0
  35. package/lib/commonjs/mol-io/reader/sdf/parser.d.ts +3 -1
  36. package/lib/commonjs/mol-io/reader/sdf/parser.js +11 -2
  37. package/lib/commonjs/mol-io/writer/cif/encoder/binary.js +9 -2
  38. package/lib/commonjs/mol-math/geometry/symmetry-operator.d.ts +1 -1
  39. package/lib/commonjs/mol-math/geometry/symmetry-operator.js +10 -4
  40. package/lib/commonjs/mol-model/structure/export/mmcif.d.ts +1 -1
  41. package/lib/commonjs/mol-model/structure/export/mmcif.js +8 -5
  42. package/lib/commonjs/mol-model/structure/model/properties/common.d.ts +1 -1
  43. package/lib/commonjs/mol-model/structure/structure/properties.d.ts +1 -0
  44. package/lib/commonjs/mol-model/structure/structure/properties.js +2 -1
  45. package/lib/commonjs/mol-model/structure/structure/symmetry.js +1 -3
  46. package/lib/commonjs/mol-model/structure/structure/util/superposition-db-mapping.js +10 -5
  47. package/lib/commonjs/mol-model-formats/structure/basic/atomic.d.ts +2 -2
  48. package/lib/commonjs/mol-model-formats/structure/basic/atomic.js +6 -6
  49. package/lib/commonjs/mol-model-formats/structure/basic/coarse.d.ts +1 -1
  50. package/lib/commonjs/mol-model-formats/structure/basic/coarse.js +3 -3
  51. package/lib/commonjs/mol-model-formats/structure/basic/entities.d.ts +2 -1
  52. package/lib/commonjs/mol-model-formats/structure/basic/entities.js +28 -24
  53. package/lib/commonjs/mol-model-formats/structure/basic/parser.js +17 -8
  54. package/lib/commonjs/mol-model-formats/structure/basic/properties.d.ts +6 -1
  55. package/lib/commonjs/mol-model-formats/structure/basic/properties.js +12 -22
  56. package/lib/commonjs/mol-model-formats/structure/mol.d.ts +2 -1
  57. package/lib/commonjs/mol-model-formats/structure/mol.js +19 -5
  58. package/lib/commonjs/mol-model-props/common/custom-property.d.ts +1 -1
  59. package/lib/commonjs/mol-model-props/computed/representations/interactions-intra-unit-cylinder.d.ts +1 -1
  60. package/lib/commonjs/mol-model-props/computed/representations/interactions-intra-unit-cylinder.js +25 -10
  61. package/lib/commonjs/mol-model-props/sequence/best-database-mapping.js +15 -15
  62. package/lib/commonjs/mol-plugin/animation-loop.d.ts +2 -0
  63. package/lib/commonjs/mol-plugin/animation-loop.js +1 -1
  64. package/lib/commonjs/mol-plugin/commands.d.ts +6 -2
  65. package/lib/commonjs/mol-plugin/spec.d.ts +1 -1
  66. package/lib/commonjs/mol-plugin/spec.js +3 -1
  67. package/lib/commonjs/mol-plugin-state/actions/file.d.ts +3 -2
  68. package/lib/commonjs/mol-plugin-state/actions/file.js +67 -31
  69. package/lib/commonjs/mol-plugin-state/animation/built-in/camera-rock.d.ts +16 -0
  70. package/lib/commonjs/mol-plugin-state/animation/built-in/camera-rock.js +62 -0
  71. package/lib/commonjs/mol-plugin-state/animation/built-in/camera-spin.d.ts +1 -1
  72. package/lib/commonjs/mol-plugin-state/animation/built-in/camera-spin.js +9 -8
  73. package/lib/commonjs/mol-plugin-state/animation/model.d.ts +4 -0
  74. package/lib/commonjs/mol-plugin-state/builder/structure/hierarchy-preset.d.ts +6 -6
  75. package/lib/commonjs/mol-plugin-state/builder/structure/hierarchy.d.ts +1 -1
  76. package/lib/commonjs/mol-plugin-state/builder/structure/representation-preset.d.ts +149 -5
  77. package/lib/commonjs/mol-plugin-state/builder/structure/representation-preset.js +74 -2
  78. package/lib/commonjs/mol-plugin-state/manager/animation.d.ts +5 -1
  79. package/lib/commonjs/mol-plugin-state/manager/animation.js +5 -5
  80. package/lib/commonjs/mol-plugin-ui/structure/superposition.js +2 -2
  81. package/lib/commonjs/mol-plugin-ui/viewport/simple-settings.d.ts +1 -1
  82. package/lib/commonjs/mol-plugin-ui/viewport/simple-settings.js +4 -8
  83. package/lib/commonjs/mol-repr/structure/visual/carbohydrate-link-cylinder.d.ts +1 -1
  84. package/lib/commonjs/mol-repr/structure/visual/carbohydrate-link-cylinder.js +8 -4
  85. package/lib/commonjs/mol-repr/structure/visual/carbohydrate-symbol-mesh.d.ts +1 -1
  86. package/lib/commonjs/mol-repr/structure/visual/carbohydrate-symbol-mesh.js +10 -6
  87. package/lib/commonjs/mol-repr/structure/visual/carbohydrate-terminal-link-cylinder.d.ts +1 -1
  88. package/lib/commonjs/mol-repr/structure/visual/carbohydrate-terminal-link-cylinder.js +8 -4
  89. package/lib/commonjs/mol-repr/visual.d.ts +1 -1
  90. package/lib/commonjs/mol-repr/visual.js +2 -1
  91. package/lib/commonjs/mol-state/tree/immutable.d.ts +18 -0
  92. package/lib/commonjs/mol-state/tree/transient.d.ts +3 -4
  93. package/lib/commonjs/mol-theme/color/element-symbol.d.ts +243 -1
  94. package/lib/commonjs/mol-theme/color/element-symbol.js +10 -5
  95. package/lib/commonjs/mol-theme/color/entity-id.d.ts +1 -1
  96. package/lib/commonjs/mol-theme/color/entity-id.js +26 -5
  97. package/lib/commonjs/mol-theme/color/illustrative.d.ts +100 -29
  98. package/lib/commonjs/mol-theme/color/illustrative.js +26 -7
  99. package/lib/commonjs/mol-theme/color/molecule-type.d.ts +19 -1
  100. package/lib/commonjs/mol-theme/color/molecule-type.js +10 -5
  101. package/lib/commonjs/mol-theme/color/residue-name.d.ts +77 -1
  102. package/lib/commonjs/mol-theme/color/residue-name.js +10 -5
  103. package/lib/commonjs/mol-theme/color/secondary-structure.d.ts +27 -1
  104. package/lib/commonjs/mol-theme/color/secondary-structure.js +10 -5
  105. package/lib/commonjs/mol-theme/color.d.ts +230 -14
  106. package/lib/commonjs/mol-util/color/color.d.ts +1 -1
  107. package/lib/commonjs/mol-util/color/color.js +1 -1
  108. package/lib/commonjs/mol-util/color/params.d.ts +10 -0
  109. package/lib/commonjs/mol-util/color/params.js +19 -0
  110. package/lib/examples/basic-wrapper/index.js +7 -3
  111. package/lib/examples/proteopedia-wrapper/index.js +7 -1
  112. package/lib/extensions/anvil/representation.js +1 -1
  113. package/lib/extensions/model-export/export.d.ts +9 -0
  114. package/lib/extensions/model-export/export.js +125 -0
  115. package/lib/extensions/model-export/index.d.ts +7 -0
  116. package/lib/extensions/model-export/index.js +33 -0
  117. package/lib/extensions/model-export/ui.d.ts +11 -0
  118. package/lib/extensions/model-export/ui.js +74 -0
  119. package/lib/extensions/mp4-export/encoder.js +1 -1
  120. package/lib/extensions/rcsb/assembly-symmetry/behavior.d.ts +2 -2
  121. package/lib/extensions/rcsb/graphql/types.d.ts +2 -2
  122. package/lib/mol-canvas3d/canvas3d.d.ts +12 -4
  123. package/lib/mol-canvas3d/canvas3d.js +1 -1
  124. package/lib/mol-canvas3d/controls/trackball.d.ts +9 -4
  125. package/lib/mol-canvas3d/controls/trackball.js +51 -12
  126. package/lib/mol-io/reader/cif/schema/bird.d.ts +1 -1
  127. package/lib/mol-io/reader/cif/schema/bird.js +1 -1
  128. package/lib/mol-io/reader/cif/schema/ccd.d.ts +1 -1
  129. package/lib/mol-io/reader/cif/schema/ccd.js +1 -1
  130. package/lib/mol-io/reader/cif/schema/mmcif.d.ts +2 -2
  131. package/lib/mol-io/reader/cif/schema/mmcif.js +1 -1
  132. package/lib/mol-io/reader/mol/parser.d.ts +23 -1
  133. package/lib/mol-io/reader/mol/parser.js +112 -3
  134. package/lib/mol-io/reader/sdf/parser-v3-util.d.ts +6 -0
  135. package/lib/mol-io/reader/sdf/parser-v3-util.js +9 -0
  136. package/lib/mol-io/reader/sdf/parser.d.ts +3 -1
  137. package/lib/mol-io/reader/sdf/parser.js +12 -3
  138. package/lib/mol-io/writer/cif/encoder/binary.js +9 -2
  139. package/lib/mol-math/geometry/symmetry-operator.d.ts +1 -1
  140. package/lib/mol-math/geometry/symmetry-operator.js +10 -4
  141. package/lib/mol-model/structure/export/mmcif.d.ts +1 -1
  142. package/lib/mol-model/structure/export/mmcif.js +8 -5
  143. package/lib/mol-model/structure/model/properties/common.d.ts +1 -1
  144. package/lib/mol-model/structure/structure/properties.d.ts +1 -0
  145. package/lib/mol-model/structure/structure/properties.js +2 -1
  146. package/lib/mol-model/structure/structure/symmetry.js +1 -3
  147. package/lib/mol-model/structure/structure/util/superposition-db-mapping.js +10 -5
  148. package/lib/mol-model-formats/structure/basic/atomic.d.ts +2 -2
  149. package/lib/mol-model-formats/structure/basic/atomic.js +6 -6
  150. package/lib/mol-model-formats/structure/basic/coarse.d.ts +1 -1
  151. package/lib/mol-model-formats/structure/basic/coarse.js +3 -3
  152. package/lib/mol-model-formats/structure/basic/entities.d.ts +2 -1
  153. package/lib/mol-model-formats/structure/basic/entities.js +25 -22
  154. package/lib/mol-model-formats/structure/basic/parser.js +19 -10
  155. package/lib/mol-model-formats/structure/basic/properties.d.ts +6 -1
  156. package/lib/mol-model-formats/structure/basic/properties.js +12 -25
  157. package/lib/mol-model-formats/structure/mol.d.ts +2 -1
  158. package/lib/mol-model-formats/structure/mol.js +17 -3
  159. package/lib/mol-model-props/common/custom-property.d.ts +1 -1
  160. package/lib/mol-model-props/computed/representations/interactions-intra-unit-cylinder.d.ts +1 -1
  161. package/lib/mol-model-props/computed/representations/interactions-intra-unit-cylinder.js +25 -10
  162. package/lib/mol-model-props/sequence/best-database-mapping.js +15 -15
  163. package/lib/mol-plugin/animation-loop.d.ts +2 -0
  164. package/lib/mol-plugin/animation-loop.js +1 -1
  165. package/lib/mol-plugin/commands.d.ts +6 -2
  166. package/lib/mol-plugin/spec.d.ts +1 -1
  167. package/lib/mol-plugin/spec.js +3 -1
  168. package/lib/mol-plugin/version.js +2 -2
  169. package/lib/mol-plugin-state/actions/file.d.ts +3 -2
  170. package/lib/mol-plugin-state/actions/file.js +67 -31
  171. package/lib/mol-plugin-state/animation/built-in/camera-rock.d.ts +16 -0
  172. package/lib/mol-plugin-state/animation/built-in/camera-rock.js +59 -0
  173. package/lib/mol-plugin-state/animation/built-in/camera-spin.d.ts +1 -1
  174. package/lib/mol-plugin-state/animation/built-in/camera-spin.js +9 -8
  175. package/lib/mol-plugin-state/animation/model.d.ts +4 -0
  176. package/lib/mol-plugin-state/builder/structure/hierarchy-preset.d.ts +6 -6
  177. package/lib/mol-plugin-state/builder/structure/hierarchy.d.ts +1 -1
  178. package/lib/mol-plugin-state/builder/structure/representation-preset.d.ts +149 -5
  179. package/lib/mol-plugin-state/builder/structure/representation-preset.js +74 -2
  180. package/lib/mol-plugin-state/manager/animation.d.ts +5 -1
  181. package/lib/mol-plugin-state/manager/animation.js +5 -5
  182. package/lib/mol-plugin-ui/structure/superposition.js +2 -2
  183. package/lib/mol-plugin-ui/viewport/simple-settings.d.ts +1 -1
  184. package/lib/mol-plugin-ui/viewport/simple-settings.js +4 -8
  185. package/lib/mol-repr/structure/visual/carbohydrate-link-cylinder.d.ts +1 -1
  186. package/lib/mol-repr/structure/visual/carbohydrate-link-cylinder.js +8 -4
  187. package/lib/mol-repr/structure/visual/carbohydrate-symbol-mesh.d.ts +1 -1
  188. package/lib/mol-repr/structure/visual/carbohydrate-symbol-mesh.js +10 -6
  189. package/lib/mol-repr/structure/visual/carbohydrate-terminal-link-cylinder.d.ts +1 -1
  190. package/lib/mol-repr/structure/visual/carbohydrate-terminal-link-cylinder.js +8 -4
  191. package/lib/mol-repr/visual.d.ts +1 -1
  192. package/lib/mol-repr/visual.js +2 -1
  193. package/lib/mol-state/tree/immutable.d.ts +18 -0
  194. package/lib/mol-state/tree/transient.d.ts +3 -4
  195. package/lib/mol-theme/color/element-symbol.d.ts +243 -1
  196. package/lib/mol-theme/color/element-symbol.js +10 -5
  197. package/lib/mol-theme/color/entity-id.d.ts +1 -1
  198. package/lib/mol-theme/color/entity-id.js +26 -5
  199. package/lib/mol-theme/color/illustrative.d.ts +100 -29
  200. package/lib/mol-theme/color/illustrative.js +26 -7
  201. package/lib/mol-theme/color/molecule-type.d.ts +19 -1
  202. package/lib/mol-theme/color/molecule-type.js +10 -5
  203. package/lib/mol-theme/color/residue-name.d.ts +77 -1
  204. package/lib/mol-theme/color/residue-name.js +10 -5
  205. package/lib/mol-theme/color/secondary-structure.d.ts +27 -1
  206. package/lib/mol-theme/color/secondary-structure.js +10 -5
  207. package/lib/mol-theme/color.d.ts +230 -14
  208. package/lib/mol-util/color/color.d.ts +1 -1
  209. package/lib/mol-util/color/color.js +1 -1
  210. package/lib/mol-util/color/params.d.ts +10 -0
  211. package/lib/mol-util/color/params.js +15 -0
  212. package/package.json +36 -35
@@ -21,7 +21,7 @@ var BestDatabaseSequenceMapping;
21
21
  type: 'static',
22
22
  defaultParams: {},
23
23
  getParams: function () { return ({}); },
24
- isApplicable: function (data) { var _a, _b; return mmcif_1.MmcifFormat.is(data.sourceData) && ((_b = (_a = data.sourceData.data.frame.categories) === null || _a === void 0 ? void 0 : _a.atom_site) === null || _b === void 0 ? void 0 : _b.fieldNames.indexOf('db_name')) >= 0; },
24
+ isApplicable: function (data) { var _a, _b; return mmcif_1.MmcifFormat.is(data.sourceData) && ((_b = (_a = data.sourceData.data.frame.categories) === null || _a === void 0 ? void 0 : _a.atom_site) === null || _b === void 0 ? void 0 : _b.fieldNames.indexOf('pdbx_sifts_xref_db_name')) >= 0; },
25
25
  obtain: function (ctx, data) { return (0, tslib_1.__awaiter)(_this, void 0, void 0, function () {
26
26
  return (0, tslib_1.__generator)(this, function (_a) {
27
27
  return [2 /*return*/, { value: fromCif(data) }];
@@ -34,7 +34,7 @@ var BestDatabaseSequenceMapping;
34
34
  if (!data)
35
35
  return '';
36
36
  var eI = loc.unit.elements[loc.element];
37
- var rI = model.atomicHierarchy.residueAtomSegments.offsets[eI];
37
+ var rI = model.atomicHierarchy.residueAtomSegments.index[eI];
38
38
  return data.accession[rI];
39
39
  }
40
40
  BestDatabaseSequenceMapping.getKey = getKey;
@@ -44,7 +44,7 @@ var BestDatabaseSequenceMapping;
44
44
  if (!data)
45
45
  return;
46
46
  var eI = loc.unit.elements[loc.element];
47
- var rI = model.atomicHierarchy.residueAtomSegments.offsets[eI];
47
+ var rI = model.atomicHierarchy.residueAtomSegments.index[eI];
48
48
  var dbName = data.dbName[rI];
49
49
  if (!dbName)
50
50
  return;
@@ -55,10 +55,10 @@ var BestDatabaseSequenceMapping;
55
55
  if (!mmcif_1.MmcifFormat.is(model.sourceData))
56
56
  return;
57
57
  var atom_site = model.sourceData.data.frame.categories.atom_site;
58
- var db_name = atom_site.getField('db_name');
59
- var db_acc = atom_site.getField('db_acc');
60
- var db_num = atom_site.getField('db_num');
61
- var db_res = atom_site.getField('db_res');
58
+ var db_name = atom_site.getField('pdbx_sifts_xref_db_name');
59
+ var db_acc = atom_site.getField('pdbx_sifts_xref_db_acc');
60
+ var db_num = atom_site.getField('pdbx_sifts_xref_db_num');
61
+ var db_res = atom_site.getField('pdbx_sifts_xref_db_res');
62
62
  if (!db_name || !db_acc || !db_num || !db_res)
63
63
  return;
64
64
  var atomSourceIndex = model.atomicHierarchy.atomSourceIndex;
@@ -70,16 +70,16 @@ var BestDatabaseSequenceMapping;
70
70
  for (var i = 0; i < count; i++) {
71
71
  var row = atomSourceIndex.value(residueOffsets[i]);
72
72
  if (db_name.valueKind(row) !== 0 /* Present */) {
73
- dbName[row] = '';
74
- accession[row] = '';
75
- num[row] = 0;
76
- residue[row] = '';
73
+ dbName[i] = '';
74
+ accession[i] = '';
75
+ num[i] = 0;
76
+ residue[i] = '';
77
77
  continue;
78
78
  }
79
- dbName[row] = db_name.str(row);
80
- accession[row] = db_acc.str(row);
81
- num[row] = db_num.int(row);
82
- residue[row] = db_res.str(row);
79
+ dbName[i] = db_name.str(row);
80
+ accession[i] = db_acc.str(row);
81
+ num[i] = db_num.int(row);
82
+ residue[i] = db_res.str(row);
83
83
  }
84
84
  return { dbName: dbName, accession: accession, num: num, residue: residue };
85
85
  }
@@ -4,6 +4,7 @@
4
4
  * @author David Sehnal <david.sehnal@gmail.com>
5
5
  */
6
6
  import { PluginContext } from './context';
7
+ import { PluginAnimationManager } from '../mol-plugin-state/manager/animation';
7
8
  export declare class PluginAnimationLoop {
8
9
  private plugin;
9
10
  private currentFrame;
@@ -12,6 +13,7 @@ export declare class PluginAnimationLoop {
12
13
  tick(t: number, options?: {
13
14
  isSynchronous?: boolean;
14
15
  manualDraw?: boolean;
16
+ animation?: PluginAnimationManager.AnimationInfo;
15
17
  }): Promise<void>;
16
18
  private frame;
17
19
  resetTime(t?: number): void;
@@ -33,7 +33,7 @@ var PluginAnimationLoop = /** @class */ (function () {
33
33
  return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
34
34
  return (0, tslib_1.__generator)(this, function (_b) {
35
35
  switch (_b.label) {
36
- case 0: return [4 /*yield*/, this.plugin.managers.animation.tick(t, options === null || options === void 0 ? void 0 : options.isSynchronous)];
36
+ case 0: return [4 /*yield*/, this.plugin.managers.animation.tick(t, options === null || options === void 0 ? void 0 : options.isSynchronous, options === null || options === void 0 ? void 0 : options.animation)];
37
37
  case 1:
38
38
  _b.sent();
39
39
  (_a = this.plugin.canvas3d) === null || _a === void 0 ? void 0 : _a.tick(t, options);
@@ -278,8 +278,12 @@ export declare const PluginCommands: {
278
278
  rotateSpeed: number;
279
279
  zoomSpeed: number;
280
280
  panSpeed: number;
281
- spin: boolean;
282
- spinSpeed: number;
281
+ animate: import("../mol-util/param-definition").ParamDefinition.NamedParams<import("../mol-util/param-definition").ParamDefinition.Normalize<unknown>, "off"> | import("../mol-util/param-definition").ParamDefinition.NamedParams<import("../mol-util/param-definition").ParamDefinition.Normalize<{
282
+ speed: any;
283
+ }>, "spin"> | import("../mol-util/param-definition").ParamDefinition.NamedParams<import("../mol-util/param-definition").ParamDefinition.Normalize<{
284
+ speed: any;
285
+ angle: any;
286
+ }>, "rock">;
283
287
  staticMoving: boolean;
284
288
  dynamicDampingFactor: number;
285
289
  minDistance: number;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2018-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
2
+ * Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
3
3
  *
4
4
  * @author David Sehnal <david.sehnal@gmail.com>
5
5
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * Copyright (c) 2018-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
3
+ * Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
4
4
  *
5
5
  * @author David Sehnal <david.sehnal@gmail.com>
6
6
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
@@ -19,6 +19,7 @@ var transforms_1 = require("../mol-plugin-state/transforms");
19
19
  var transformers_1 = require("../mol-plugin/behavior/dynamic/volume-streaming/transformers");
20
20
  var state_interpolation_1 = require("../mol-plugin-state/animation/built-in/state-interpolation");
21
21
  var spin_structure_1 = require("../mol-plugin-state/animation/built-in/spin-structure");
22
+ var camera_rock_1 = require("../mol-plugin-state/animation/built-in/camera-rock");
22
23
  var PluginSpec;
23
24
  (function (PluginSpec) {
24
25
  function Action(action, params) {
@@ -98,6 +99,7 @@ var DefaultPluginSpec = function () { return ({
98
99
  animations: [
99
100
  model_index_1.AnimateModelIndex,
100
101
  camera_spin_1.AnimateCameraSpin,
102
+ camera_rock_1.AnimateCameraRock,
101
103
  state_snapshots_1.AnimateStateSnapshots,
102
104
  assembly_unwind_1.AnimateAssemblyUnwind,
103
105
  spin_structure_1.AnimateStructureSpin,
@@ -4,15 +4,16 @@
4
4
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
5
5
  */
6
6
  import { StateAction } from '../../mol-state';
7
+ import { Asset } from '../../mol-util/assets';
7
8
  import { ParamDefinition as PD } from '../../mol-util/param-definition';
8
9
  import { PluginStateObject } from '../objects';
9
10
  export declare const OpenFiles: StateAction<PluginStateObject.Root, void, PD.Normalize<{
10
- files: import("../../mol-util/assets").Asset.File[] | null;
11
+ files: Asset.File[] | null;
11
12
  format: PD.NamedParams<PD.Normalize<unknown>, "auto"> | PD.NamedParams<string, "specific">;
12
13
  visuals: boolean;
13
14
  }>>;
14
15
  export declare const DownloadFile: StateAction<PluginStateObject.Root, void, PD.Normalize<{
15
- url: string | import("../../mol-util/assets").Asset.Url;
16
+ url: string | Asset.Url;
16
17
  format: string;
17
18
  isBinary: boolean;
18
19
  visuals: boolean;
@@ -9,8 +9,10 @@ exports.DownloadFile = exports.OpenFiles = void 0;
9
9
  var tslib_1 = require("tslib");
10
10
  var mol_state_1 = require("../../mol-state");
11
11
  var mol_task_1 = require("../../mol-task");
12
+ var assets_1 = require("../../mol-util/assets");
12
13
  var file_info_1 = require("../../mol-util/file-info");
13
14
  var param_definition_1 = require("../../mol-util/param-definition");
15
+ var zip_1 = require("../../mol-util/zip/zip");
14
16
  var objects_1 = require("../objects");
15
17
  exports.OpenFiles = mol_state_1.StateAction.build({
16
18
  display: { name: 'Open Files', description: 'Load one or more files and optionally create default visuals' },
@@ -34,53 +36,87 @@ exports.OpenFiles = mol_state_1.StateAction.build({
34
36
  case 0:
35
37
  plugin.behaviors.layout.leftPanelTabName.next('data');
36
38
  return [4 /*yield*/, state.transaction(function () { return (0, tslib_1.__awaiter)(void 0, void 0, void 0, function () {
37
- var _i, _a, file, info, isBinary, data, provider, parsed, e_1;
38
- var _b, _c;
39
- return (0, tslib_1.__generator)(this, function (_d) {
40
- switch (_d.label) {
39
+ var processFile, _i, _a, file, zippedFiles, _b, _c, _d, _e, _f, fn, filedata, asset, e_1;
40
+ return (0, tslib_1.__generator)(this, function (_g) {
41
+ switch (_g.label) {
41
42
  case 0:
42
43
  if (params.files === null) {
43
44
  plugin.log.error('No file(s) selected');
44
45
  return [2 /*return*/];
45
46
  }
47
+ processFile = function (file) { return (0, tslib_1.__awaiter)(void 0, void 0, void 0, function () {
48
+ var info, isBinary, data, provider, parsed;
49
+ var _a, _b;
50
+ return (0, tslib_1.__generator)(this, function (_c) {
51
+ switch (_c.label) {
52
+ case 0:
53
+ info = (0, file_info_1.getFileInfo)(file.file);
54
+ isBinary = plugin.dataFormats.binaryExtensions.has(info.ext);
55
+ return [4 /*yield*/, plugin.builders.data.readFile({ file: file, isBinary: isBinary })];
56
+ case 1:
57
+ data = (_c.sent()).data;
58
+ provider = params.format.name === 'auto'
59
+ ? plugin.dataFormats.auto(info, (_a = data.cell) === null || _a === void 0 ? void 0 : _a.obj)
60
+ : plugin.dataFormats.get(params.format.params);
61
+ if (!provider) {
62
+ plugin.log.warn("OpenFiles: could not find data provider for '".concat(info.name, ".").concat(info.ext, "'"));
63
+ return [2 /*return*/];
64
+ }
65
+ return [4 /*yield*/, provider.parse(plugin, data)];
66
+ case 2:
67
+ parsed = _c.sent();
68
+ if (!params.visuals) return [3 /*break*/, 4];
69
+ return [4 /*yield*/, ((_b = provider.visuals) === null || _b === void 0 ? void 0 : _b.call(provider, plugin, parsed))];
70
+ case 3:
71
+ _c.sent();
72
+ _c.label = 4;
73
+ case 4: return [2 /*return*/];
74
+ }
75
+ });
76
+ }); };
46
77
  _i = 0, _a = params.files;
47
- _d.label = 1;
78
+ _g.label = 1;
48
79
  case 1:
49
- if (!(_i < _a.length)) return [3 /*break*/, 9];
80
+ if (!(_i < _a.length)) return [3 /*break*/, 14];
50
81
  file = _a[_i];
51
- _d.label = 2;
82
+ _g.label = 2;
52
83
  case 2:
53
- _d.trys.push([2, 7, , 8]);
54
- info = (0, file_info_1.getFileInfo)(file.file);
55
- isBinary = plugin.dataFormats.binaryExtensions.has(info.ext);
56
- return [4 /*yield*/, plugin.builders.data.readFile({ file: file, isBinary: isBinary })];
57
- case 3:
58
- data = (_d.sent()).data;
59
- provider = params.format.name === 'auto'
60
- ? plugin.dataFormats.auto(info, (_b = data.cell) === null || _b === void 0 ? void 0 : _b.obj)
61
- : plugin.dataFormats.get(params.format.params);
62
- if (!provider) {
63
- plugin.log.warn("OpenFiles: could not find data provider for '".concat(info.name, ".").concat(info.ext, "'"));
64
- return [3 /*break*/, 8];
65
- }
66
- return [4 /*yield*/, provider.parse(plugin, data)];
84
+ _g.trys.push([2, 12, , 13]);
85
+ if (!(file.file && file.name.toLowerCase().endsWith('.zip'))) return [3 /*break*/, 9];
86
+ _b = zip_1.unzip;
87
+ _c = [taskCtx];
88
+ return [4 /*yield*/, file.file.arrayBuffer()];
89
+ case 3: return [4 /*yield*/, _b.apply(void 0, _c.concat([_g.sent()]))];
67
90
  case 4:
68
- parsed = _d.sent();
69
- if (!params.visuals) return [3 /*break*/, 6];
70
- return [4 /*yield*/, ((_c = provider.visuals) === null || _c === void 0 ? void 0 : _c.call(provider, plugin, parsed))];
91
+ zippedFiles = _g.sent();
92
+ _d = 0, _e = Object.entries(zippedFiles);
93
+ _g.label = 5;
71
94
  case 5:
72
- _d.sent();
73
- _d.label = 6;
74
- case 6: return [3 /*break*/, 8];
95
+ if (!(_d < _e.length)) return [3 /*break*/, 8];
96
+ _f = _e[_d], fn = _f[0], filedata = _f[1];
97
+ asset = assets_1.Asset.File(new File([filedata], fn));
98
+ return [4 /*yield*/, processFile(asset)];
99
+ case 6:
100
+ _g.sent();
101
+ _g.label = 7;
75
102
  case 7:
76
- e_1 = _d.sent();
103
+ _d++;
104
+ return [3 /*break*/, 5];
105
+ case 8: return [3 /*break*/, 11];
106
+ case 9: return [4 /*yield*/, processFile(file)];
107
+ case 10:
108
+ _g.sent();
109
+ _g.label = 11;
110
+ case 11: return [3 /*break*/, 13];
111
+ case 12:
112
+ e_1 = _g.sent();
77
113
  console.error(e_1);
78
114
  plugin.log.error("Error opening file '".concat(file.name, "'"));
79
- return [3 /*break*/, 8];
80
- case 8:
115
+ return [3 /*break*/, 13];
116
+ case 13:
81
117
  _i++;
82
118
  return [3 /*break*/, 1];
83
- case 9: return [2 /*return*/];
119
+ case 14: return [2 /*return*/];
84
120
  }
85
121
  });
86
122
  }); }).runInContext(taskCtx)];
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright (c) 2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
3
+ *
4
+ * @author Alexander Rose <alexander.rose@weirdbyte.de>
5
+ */
6
+ import { Camera } from '../../../mol-canvas3d/camera';
7
+ import { PluginStateAnimation } from '../model';
8
+ declare type State = {
9
+ snapshot: Camera.Snapshot;
10
+ };
11
+ export declare const AnimateCameraRock: PluginStateAnimation<{
12
+ durationInMs: number;
13
+ speed: number;
14
+ angle: number;
15
+ }, State | undefined>;
16
+ export {};
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
4
+ *
5
+ * @author Alexander Rose <alexander.rose@weirdbyte.de>
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.AnimateCameraRock = void 0;
9
+ var tslib_1 = require("tslib");
10
+ var interpolate_1 = require("../../../mol-math/interpolate");
11
+ var quat_1 = require("../../../mol-math/linear-algebra/3d/quat");
12
+ var vec3_1 = require("../../../mol-math/linear-algebra/3d/vec3");
13
+ var misc_1 = require("../../../mol-math/misc");
14
+ var param_definition_1 = require("../../../mol-util/param-definition");
15
+ var model_1 = require("../model");
16
+ var _dir = (0, vec3_1.Vec3)(), _axis = (0, vec3_1.Vec3)(), _rot = (0, quat_1.Quat)();
17
+ exports.AnimateCameraRock = model_1.PluginStateAnimation.create({
18
+ name: 'built-in.animate-camera-rock',
19
+ display: { name: 'Camera Rock', description: 'Rock the 3D scene around the x-axis in view space' },
20
+ isExportable: true,
21
+ params: function () { return ({
22
+ durationInMs: param_definition_1.ParamDefinition.Numeric(4000, { min: 100, max: 20000, step: 100 }),
23
+ speed: param_definition_1.ParamDefinition.Numeric(1, { min: 1, max: 10, step: 1 }, { description: 'How many times to rock from side to side.' }),
24
+ angle: param_definition_1.ParamDefinition.Numeric(10, { min: 0, max: 180, step: 1 }, { description: 'How many degrees to rotate in each direction.' }),
25
+ }); },
26
+ initialState: function (p, ctx) { return ({ snapshot: ctx.canvas3d.camera.getSnapshot() }); },
27
+ getDuration: function (p) { return ({ kind: 'fixed', durationMs: p.durationInMs }); },
28
+ teardown: function (_, state, ctx) {
29
+ var _a;
30
+ (_a = ctx.canvas3d) === null || _a === void 0 ? void 0 : _a.requestCameraReset({ snapshot: state.snapshot, durationMs: 0 });
31
+ },
32
+ apply: function (animState, t, ctx) {
33
+ var _a, _b;
34
+ return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
35
+ var snapshot, phase, angle, position;
36
+ return (0, tslib_1.__generator)(this, function (_c) {
37
+ if (t.current === 0) {
38
+ return [2 /*return*/, { kind: 'next', state: animState }];
39
+ }
40
+ snapshot = animState.snapshot;
41
+ if (snapshot.radiusMax < 0.0001) {
42
+ return [2 /*return*/, { kind: 'finished' }];
43
+ }
44
+ phase = t.animation
45
+ ? ((_a = t.animation) === null || _a === void 0 ? void 0 : _a.currentFrame) / (t.animation.frameCount + 1)
46
+ : (0, interpolate_1.clamp)(t.current / ctx.params.durationInMs, 0, 1);
47
+ angle = Math.sin(phase * ctx.params.speed * Math.PI * 2) * (0, misc_1.degToRad)(ctx.params.angle);
48
+ vec3_1.Vec3.sub(_dir, snapshot.position, snapshot.target);
49
+ vec3_1.Vec3.normalize(_axis, snapshot.up);
50
+ quat_1.Quat.setAxisAngle(_rot, _axis, angle);
51
+ vec3_1.Vec3.transformQuat(_dir, _dir, _rot);
52
+ position = vec3_1.Vec3.add((0, vec3_1.Vec3)(), snapshot.target, _dir);
53
+ (_b = ctx.plugin.canvas3d) === null || _b === void 0 ? void 0 : _b.requestCameraReset({ snapshot: (0, tslib_1.__assign)((0, tslib_1.__assign)({}, snapshot), { position: position }), durationMs: 0 });
54
+ if (phase >= 0.99999) {
55
+ return [2 /*return*/, { kind: 'finished' }];
56
+ }
57
+ return [2 /*return*/, { kind: 'next', state: animState }];
58
+ });
59
+ });
60
+ }
61
+ });
62
+ //# sourceMappingURL=camera-rock.js.map
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
2
+ * Copyright (c) 2020-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
3
3
  *
4
4
  * @author David Sehnal <david.sehnal@gmail.com>
5
5
  */
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * Copyright (c) 2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
3
+ * Copyright (c) 2020-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
4
4
  *
5
5
  * @author David Sehnal <david.sehnal@gmail.com>
6
6
  */
@@ -15,11 +15,11 @@ var model_1 = require("../model");
15
15
  var _dir = (0, vec3_1.Vec3)(), _axis = (0, vec3_1.Vec3)(), _rot = (0, quat_1.Quat)();
16
16
  exports.AnimateCameraSpin = model_1.PluginStateAnimation.create({
17
17
  name: 'built-in.animate-camera-spin',
18
- display: { name: 'Camera Spin' },
18
+ display: { name: 'Camera Spin', description: 'Spin the 3D scene around the x-axis in view space' },
19
19
  isExportable: true,
20
20
  params: function () { return ({
21
21
  durationInMs: param_definition_1.ParamDefinition.Numeric(4000, { min: 100, max: 20000, step: 100 }),
22
- speed: param_definition_1.ParamDefinition.Numeric(1, { min: 1, max: 10, step: 1 }, { description: 'How many times to spin in the specified dutation.' }),
22
+ speed: param_definition_1.ParamDefinition.Numeric(1, { min: 1, max: 10, step: 1 }, { description: 'How many times to spin in the specified duration.' }),
23
23
  direction: param_definition_1.ParamDefinition.Select('cw', [['cw', 'Clockwise'], ['ccw', 'Counter Clockwise']], { cycle: true })
24
24
  }); },
25
25
  initialState: function (_, ctx) { var _a; return ({ snapshot: (_a = ctx.canvas3d) === null || _a === void 0 ? void 0 : _a.camera.getSnapshot() }); },
@@ -40,11 +40,9 @@ exports.AnimateCameraSpin = model_1.PluginStateAnimation.create({
40
40
  if (snapshot.radiusMax < 0.0001) {
41
41
  return [2 /*return*/, { kind: 'finished' }];
42
42
  }
43
- phase = (0, interpolate_1.clamp)(t.current / ctx.params.durationInMs, 0, 1);
44
- if (phase >= 0.99999) {
45
- (_a = ctx.plugin.canvas3d) === null || _a === void 0 ? void 0 : _a.requestCameraReset({ snapshot: snapshot, durationMs: 0 });
46
- return [2 /*return*/, { kind: 'finished' }];
47
- }
43
+ phase = t.animation
44
+ ? ((_a = t.animation) === null || _a === void 0 ? void 0 : _a.currentFrame) / (t.animation.frameCount + 1)
45
+ : (0, interpolate_1.clamp)(t.current / ctx.params.durationInMs, 0, 1);
48
46
  angle = 2 * Math.PI * phase * ctx.params.speed * (ctx.params.direction === 'ccw' ? -1 : 1);
49
47
  vec3_1.Vec3.sub(_dir, snapshot.position, snapshot.target);
50
48
  vec3_1.Vec3.normalize(_axis, snapshot.up);
@@ -52,6 +50,9 @@ exports.AnimateCameraSpin = model_1.PluginStateAnimation.create({
52
50
  vec3_1.Vec3.transformQuat(_dir, _dir, _rot);
53
51
  position = vec3_1.Vec3.add((0, vec3_1.Vec3)(), snapshot.target, _dir);
54
52
  (_b = ctx.plugin.canvas3d) === null || _b === void 0 ? void 0 : _b.requestCameraReset({ snapshot: (0, tslib_1.__assign)((0, tslib_1.__assign)({}, snapshot), { position: position }), durationMs: 0 });
53
+ if (phase >= 0.99999) {
54
+ return [2 /*return*/, { kind: 'finished' }];
55
+ }
55
56
  return [2 /*return*/, { kind: 'next', state: animState }];
56
57
  });
57
58
  });
@@ -56,6 +56,10 @@ declare namespace PluginStateAnimation {
56
56
  interface Time {
57
57
  lastApplied: number;
58
58
  current: number;
59
+ animation?: {
60
+ currentFrame: number;
61
+ frameCount: number;
62
+ };
59
63
  }
60
64
  type ApplyResult<S> = {
61
65
  kind: 'finished';
@@ -28,7 +28,7 @@ export declare namespace TrajectoryHierarchyPresetProvider {
28
28
  [x: string]: any;
29
29
  }>;
30
30
  }>> | undefined>;
31
- representationPreset: PD.Base<"auto" | "empty" | "atomic-detail" | "polymer-cartoon" | "polymer-and-ligand" | "protein-and-nucleic" | "coarse-surface" | undefined>;
31
+ representationPreset: PD.Base<"auto" | "empty" | "illustrative" | "atomic-detail" | "polymer-cartoon" | "polymer-and-ligand" | "protein-and-nucleic" | "coarse-surface" | undefined>;
32
32
  };
33
33
  }
34
34
  export declare const PresetTrajectoryHierarchy: {
@@ -41,7 +41,7 @@ export declare const PresetTrajectoryHierarchy: {
41
41
  autoAttach: any;
42
42
  properties: any;
43
43
  }>> | undefined;
44
- representationPreset: "auto" | "empty" | "atomic-detail" | "polymer-cartoon" | "polymer-and-ligand" | "protein-and-nucleic" | "coarse-surface" | undefined;
44
+ representationPreset: "auto" | "empty" | "illustrative" | "atomic-detail" | "polymer-cartoon" | "polymer-and-ligand" | "protein-and-nucleic" | "coarse-surface" | undefined;
45
45
  model: PD.Normalize<PD.Normalize<{
46
46
  modelIndex: any;
47
47
  }>> | undefined;
@@ -86,7 +86,7 @@ export declare const PresetTrajectoryHierarchy: {
86
86
  autoAttach: any;
87
87
  properties: any;
88
88
  }>> | undefined;
89
- representationPreset: "auto" | "empty" | "atomic-detail" | "polymer-cartoon" | "polymer-and-ligand" | "protein-and-nucleic" | "coarse-surface" | undefined;
89
+ representationPreset: "auto" | "empty" | "illustrative" | "atomic-detail" | "polymer-cartoon" | "polymer-and-ligand" | "protein-and-nucleic" | "coarse-surface" | undefined;
90
90
  useDefaultIfSingleModel: boolean | undefined;
91
91
  representationPresetParams: PD.Normalize<{
92
92
  ignoreHydrogens: any;
@@ -116,7 +116,7 @@ export declare const PresetTrajectoryHierarchy: {
116
116
  autoAttach: any;
117
117
  properties: any;
118
118
  }>> | undefined;
119
- representationPreset: "auto" | "empty" | "atomic-detail" | "polymer-cartoon" | "polymer-and-ligand" | "protein-and-nucleic" | "coarse-surface" | undefined;
119
+ representationPreset: "auto" | "empty" | "illustrative" | "atomic-detail" | "polymer-cartoon" | "polymer-and-ligand" | "protein-and-nucleic" | "coarse-surface" | undefined;
120
120
  model: PD.Normalize<PD.Normalize<{
121
121
  modelIndex: any;
122
122
  }>> | undefined;
@@ -137,7 +137,7 @@ export declare const PresetTrajectoryHierarchy: {
137
137
  autoAttach: any;
138
138
  properties: any;
139
139
  }>> | undefined;
140
- representationPreset: "auto" | "empty" | "atomic-detail" | "polymer-cartoon" | "polymer-and-ligand" | "protein-and-nucleic" | "coarse-surface" | undefined;
140
+ representationPreset: "auto" | "empty" | "illustrative" | "atomic-detail" | "polymer-cartoon" | "polymer-and-ligand" | "protein-and-nucleic" | "coarse-surface" | undefined;
141
141
  model: PD.Normalize<PD.Normalize<{
142
142
  modelIndex: any;
143
143
  }>> | undefined;
@@ -158,7 +158,7 @@ export declare const PresetTrajectoryHierarchy: {
158
158
  autoAttach: any;
159
159
  properties: any;
160
160
  }>> | undefined;
161
- representationPreset: "auto" | "empty" | "atomic-detail" | "polymer-cartoon" | "polymer-and-ligand" | "protein-and-nucleic" | "coarse-surface" | undefined;
161
+ representationPreset: "auto" | "empty" | "illustrative" | "atomic-detail" | "polymer-cartoon" | "polymer-and-ligand" | "protein-and-nucleic" | "coarse-surface" | undefined;
162
162
  model: PD.Normalize<PD.Normalize<{
163
163
  modelIndex: any;
164
164
  }>> | undefined;
@@ -23,7 +23,7 @@ export declare class TrajectoryHierarchyBuilder {
23
23
  autoAttach: any;
24
24
  properties: any;
25
25
  }>> | undefined;
26
- representationPreset: "auto" | "empty" | "atomic-detail" | "polymer-cartoon" | "polymer-and-ligand" | "protein-and-nucleic" | "coarse-surface" | undefined;
26
+ representationPreset: "auto" | "empty" | "illustrative" | "atomic-detail" | "polymer-cartoon" | "polymer-and-ligand" | "protein-and-nucleic" | "coarse-surface" | undefined;
27
27
  model: PD.Normalize<PD.Normalize<{
28
28
  modelIndex: any;
29
29
  }>> | undefined;