react-cheminfo 0.134.1 → 0.136.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 (454) hide show
  1. package/README.md +13 -0
  2. package/lib/crystal/core/bondGrid.d.ts +26 -0
  3. package/lib/crystal/core/bondGrid.d.ts.map +1 -0
  4. package/lib/crystal/core/bondGrid.js +76 -0
  5. package/lib/crystal/core/bondGrid.js.map +1 -0
  6. package/lib/crystal/core/cellAtoms.d.ts +43 -0
  7. package/lib/crystal/core/cellAtoms.d.ts.map +1 -0
  8. package/lib/crystal/core/cellAtoms.js +70 -0
  9. package/lib/crystal/core/cellAtoms.js.map +1 -0
  10. package/lib/crystal/core/cellBonds.d.ts +21 -0
  11. package/lib/crystal/core/cellBonds.d.ts.map +1 -0
  12. package/lib/crystal/core/cellBonds.js +100 -0
  13. package/lib/crystal/core/cellBonds.js.map +1 -0
  14. package/lib/crystal/core/cif/element.d.ts +9 -0
  15. package/lib/crystal/core/cif/element.d.ts.map +1 -0
  16. package/lib/crystal/core/cif/element.js +41 -0
  17. package/lib/crystal/core/cif/element.js.map +1 -0
  18. package/lib/crystal/core/cif/index.d.ts +4 -0
  19. package/lib/crystal/core/cif/index.d.ts.map +1 -0
  20. package/lib/crystal/core/cif/index.js +3 -0
  21. package/lib/crystal/core/cif/index.js.map +1 -0
  22. package/lib/crystal/core/cif/number.d.ts +27 -0
  23. package/lib/crystal/core/cif/number.d.ts.map +1 -0
  24. package/lib/crystal/core/cif/number.js +57 -0
  25. package/lib/crystal/core/cif/number.js.map +1 -0
  26. package/lib/crystal/core/cif/read.d.ts +12 -0
  27. package/lib/crystal/core/cif/read.d.ts.map +1 -0
  28. package/lib/crystal/core/cif/read.js +183 -0
  29. package/lib/crystal/core/cif/read.js.map +1 -0
  30. package/lib/crystal/core/cif/readGeometry.d.ts +17 -0
  31. package/lib/crystal/core/cif/readGeometry.d.ts.map +1 -0
  32. package/lib/crystal/core/cif/readGeometry.js +93 -0
  33. package/lib/crystal/core/cif/readGeometry.js.map +1 -0
  34. package/lib/crystal/core/cif/tags.d.ts +62 -0
  35. package/lib/crystal/core/cif/tags.d.ts.map +1 -0
  36. package/lib/crystal/core/cif/tags.js +115 -0
  37. package/lib/crystal/core/cif/tags.js.map +1 -0
  38. package/lib/crystal/core/cif/types.d.ts +158 -0
  39. package/lib/crystal/core/cif/types.d.ts.map +1 -0
  40. package/lib/crystal/core/cif/types.js +2 -0
  41. package/lib/crystal/core/cif/types.js.map +1 -0
  42. package/lib/crystal/core/components.d.ts +56 -0
  43. package/lib/crystal/core/components.d.ts.map +1 -0
  44. package/lib/crystal/core/components.js +132 -0
  45. package/lib/crystal/core/components.js.map +1 -0
  46. package/lib/crystal/core/covalentRadii.d.ts +24 -0
  47. package/lib/crystal/core/covalentRadii.d.ts.map +1 -0
  48. package/lib/crystal/core/covalentRadii.js +55 -0
  49. package/lib/crystal/core/covalentRadii.js.map +1 -0
  50. package/lib/crystal/core/disorder.d.ts +59 -0
  51. package/lib/crystal/core/disorder.d.ts.map +1 -0
  52. package/lib/crystal/core/disorder.js +168 -0
  53. package/lib/crystal/core/disorder.js.map +1 -0
  54. package/lib/crystal/core/expand.d.ts +62 -0
  55. package/lib/crystal/core/expand.d.ts.map +1 -0
  56. package/lib/crystal/core/expand.js +61 -0
  57. package/lib/crystal/core/expand.js.map +1 -0
  58. package/lib/crystal/core/index.d.ts +20 -0
  59. package/lib/crystal/core/index.d.ts.map +1 -0
  60. package/lib/crystal/core/index.js +13 -0
  61. package/lib/crystal/core/index.js.map +1 -0
  62. package/lib/crystal/core/moleculeOf.d.ts +31 -0
  63. package/lib/crystal/core/moleculeOf.d.ts.map +1 -0
  64. package/lib/crystal/core/moleculeOf.js +128 -0
  65. package/lib/crystal/core/moleculeOf.js.map +1 -0
  66. package/lib/crystal/core/moleculeTypes.d.ts +80 -0
  67. package/lib/crystal/core/moleculeTypes.d.ts.map +1 -0
  68. package/lib/crystal/core/moleculeTypes.js +2 -0
  69. package/lib/crystal/core/moleculeTypes.js.map +1 -0
  70. package/lib/crystal/core/molecules.d.ts +39 -0
  71. package/lib/crystal/core/molecules.d.ts.map +1 -0
  72. package/lib/crystal/core/molecules.js +106 -0
  73. package/lib/crystal/core/molecules.js.map +1 -0
  74. package/lib/crystal/core/operations.d.ts +19 -0
  75. package/lib/crystal/core/operations.d.ts.map +1 -0
  76. package/lib/crystal/core/operations.js +68 -0
  77. package/lib/crystal/core/operations.js.map +1 -0
  78. package/lib/crystal/core/packing.d.ts +43 -0
  79. package/lib/crystal/core/packing.d.ts.map +1 -0
  80. package/lib/crystal/core/packing.js +89 -0
  81. package/lib/crystal/core/packing.js.map +1 -0
  82. package/lib/crystal/core/periodicBonds.d.ts +57 -0
  83. package/lib/crystal/core/periodicBonds.d.ts.map +1 -0
  84. package/lib/crystal/core/periodicBonds.js +167 -0
  85. package/lib/crystal/core/periodicBonds.js.map +1 -0
  86. package/lib/crystal/core/resolve.d.ts +61 -0
  87. package/lib/crystal/core/resolve.d.ts.map +1 -0
  88. package/lib/crystal/core/resolve.js +149 -0
  89. package/lib/crystal/core/resolve.js.map +1 -0
  90. package/lib/crystal/core/spaceGroups/index.d.ts +5 -0
  91. package/lib/crystal/core/spaceGroups/index.d.ts.map +1 -0
  92. package/lib/crystal/core/spaceGroups/index.js +4 -0
  93. package/lib/crystal/core/spaceGroups/index.js.map +1 -0
  94. package/lib/crystal/core/spaceGroups/spaceGroupOperations.d.ts +14 -0
  95. package/lib/crystal/core/spaceGroups/spaceGroupOperations.d.ts.map +1 -0
  96. package/lib/crystal/core/spaceGroups/spaceGroupOperations.js +24 -0
  97. package/lib/crystal/core/spaceGroups/spaceGroupOperations.js.map +1 -0
  98. package/lib/crystal/core/spaceGroups/spaceGroupRows.d.ts +3 -0
  99. package/lib/crystal/core/spaceGroups/spaceGroupRows.d.ts.map +1 -0
  100. package/lib/crystal/core/spaceGroups/spaceGroupRows.js +536 -0
  101. package/lib/crystal/core/spaceGroups/spaceGroupRows.js.map +1 -0
  102. package/lib/crystal/core/spaceGroups/spaceGroupSymbols.d.ts +43 -0
  103. package/lib/crystal/core/spaceGroups/spaceGroupSymbols.d.ts.map +1 -0
  104. package/lib/crystal/core/spaceGroups/spaceGroupSymbols.js +169 -0
  105. package/lib/crystal/core/spaceGroups/spaceGroupSymbols.js.map +1 -0
  106. package/lib/crystal/core/spaceGroups/spaceGroups.d.ts +78 -0
  107. package/lib/crystal/core/spaceGroups/spaceGroups.d.ts.map +1 -0
  108. package/lib/crystal/core/spaceGroups/spaceGroups.js +83 -0
  109. package/lib/crystal/core/spaceGroups/spaceGroups.js.map +1 -0
  110. package/lib/crystal/core/symmetry/group.d.ts +15 -0
  111. package/lib/crystal/core/symmetry/group.d.ts.map +1 -0
  112. package/lib/crystal/core/symmetry/group.js +37 -0
  113. package/lib/crystal/core/symmetry/group.js.map +1 -0
  114. package/lib/crystal/core/symmetry/index.d.ts +8 -0
  115. package/lib/crystal/core/symmetry/index.d.ts.map +1 -0
  116. package/lib/crystal/core/symmetry/index.js +6 -0
  117. package/lib/crystal/core/symmetry/index.js.map +1 -0
  118. package/lib/crystal/core/symmetry/integerMatrix.d.ts +45 -0
  119. package/lib/crystal/core/symmetry/integerMatrix.d.ts.map +1 -0
  120. package/lib/crystal/core/symmetry/integerMatrix.js +139 -0
  121. package/lib/crystal/core/symmetry/integerMatrix.js.map +1 -0
  122. package/lib/crystal/core/symmetry/lattice.d.ts +64 -0
  123. package/lib/crystal/core/symmetry/lattice.d.ts.map +1 -0
  124. package/lib/crystal/core/symmetry/lattice.js +113 -0
  125. package/lib/crystal/core/symmetry/lattice.js.map +1 -0
  126. package/lib/crystal/core/symmetry/operation.d.ts +91 -0
  127. package/lib/crystal/core/symmetry/operation.d.ts.map +1 -0
  128. package/lib/crystal/core/symmetry/operation.js +184 -0
  129. package/lib/crystal/core/symmetry/operation.js.map +1 -0
  130. package/lib/crystal/core/symmetry/parseOperation.d.ts +18 -0
  131. package/lib/crystal/core/symmetry/parseOperation.d.ts.map +1 -0
  132. package/lib/crystal/core/symmetry/parseOperation.js +145 -0
  133. package/lib/crystal/core/symmetry/parseOperation.js.map +1 -0
  134. package/lib/crystal/core/symmetry/types.d.ts +29 -0
  135. package/lib/crystal/core/symmetry/types.d.ts.map +1 -0
  136. package/lib/crystal/core/symmetry/types.js +5 -0
  137. package/lib/crystal/core/symmetry/types.js.map +1 -0
  138. package/lib/crystal/core/symmetryClasses.d.ts +28 -0
  139. package/lib/crystal/core/symmetryClasses.d.ts.map +1 -0
  140. package/lib/crystal/core/symmetryClasses.js +93 -0
  141. package/lib/crystal/core/symmetryClasses.js.map +1 -0
  142. package/lib/crystal.d.ts +12 -0
  143. package/lib/crystal.d.ts.map +1 -0
  144. package/lib/crystal.js +12 -0
  145. package/lib/crystal.js.map +1 -0
  146. package/lib/crystal3d/core/cellClip.d.ts +46 -0
  147. package/lib/crystal3d/core/cellClip.d.ts.map +1 -0
  148. package/lib/crystal3d/core/cellClip.js +198 -0
  149. package/lib/crystal3d/core/cellClip.js.map +1 -0
  150. package/lib/crystal3d/core/cellGeometry.d.ts +63 -0
  151. package/lib/crystal3d/core/cellGeometry.d.ts.map +1 -0
  152. package/lib/crystal3d/core/cellGeometry.js +153 -0
  153. package/lib/crystal3d/core/cellGeometry.js.map +1 -0
  154. package/lib/crystal3d/core/cellStack.d.ts +51 -0
  155. package/lib/crystal3d/core/cellStack.d.ts.map +1 -0
  156. package/lib/crystal3d/core/cellStack.js +79 -0
  157. package/lib/crystal3d/core/cellStack.js.map +1 -0
  158. package/lib/crystal3d/core/crystalView.d.ts +71 -0
  159. package/lib/crystal3d/core/crystalView.d.ts.map +1 -0
  160. package/lib/crystal3d/core/crystalView.js +48 -0
  161. package/lib/crystal3d/core/crystalView.js.map +1 -0
  162. package/lib/crystal3d/core/drawingSet.d.ts +31 -0
  163. package/lib/crystal3d/core/drawingSet.d.ts.map +1 -0
  164. package/lib/crystal3d/core/drawingSet.js +63 -0
  165. package/lib/crystal3d/core/drawingSet.js.map +1 -0
  166. package/lib/crystal3d/core/elementDrawing.d.ts +50 -0
  167. package/lib/crystal3d/core/elementDrawing.d.ts.map +1 -0
  168. package/lib/crystal3d/core/elementDrawing.js +100 -0
  169. package/lib/crystal3d/core/elementDrawing.js.map +1 -0
  170. package/lib/crystal3d/core/elementExtent.d.ts +42 -0
  171. package/lib/crystal3d/core/elementExtent.d.ts.map +1 -0
  172. package/lib/crystal3d/core/elementExtent.js +56 -0
  173. package/lib/crystal3d/core/elementExtent.js.map +1 -0
  174. package/lib/crystal3d/core/elementLabels.d.ts +31 -0
  175. package/lib/crystal3d/core/elementLabels.d.ts.map +1 -0
  176. package/lib/crystal3d/core/elementLabels.js +99 -0
  177. package/lib/crystal3d/core/elementLabels.js.map +1 -0
  178. package/lib/crystal3d/core/elementShapes.d.ts +43 -0
  179. package/lib/crystal3d/core/elementShapes.d.ts.map +1 -0
  180. package/lib/crystal3d/core/elementShapes.js +115 -0
  181. package/lib/crystal3d/core/elementShapes.js.map +1 -0
  182. package/lib/crystal3d/core/frame.d.ts +36 -0
  183. package/lib/crystal3d/core/frame.d.ts.map +1 -0
  184. package/lib/crystal3d/core/frame.js +35 -0
  185. package/lib/crystal3d/core/frame.js.map +1 -0
  186. package/lib/crystal3d/core/framing.d.ts +41 -0
  187. package/lib/crystal3d/core/framing.d.ts.map +1 -0
  188. package/lib/crystal3d/core/framing.js +79 -0
  189. package/lib/crystal3d/core/framing.js.map +1 -0
  190. package/lib/crystal3d/core/index.d.ts +42 -0
  191. package/lib/crystal3d/core/index.d.ts.map +1 -0
  192. package/lib/crystal3d/core/index.js +29 -0
  193. package/lib/crystal3d/core/index.js.map +1 -0
  194. package/lib/crystal3d/core/labelText.d.ts +19 -0
  195. package/lib/crystal3d/core/labelText.d.ts.map +1 -0
  196. package/lib/crystal3d/core/labelText.js +42 -0
  197. package/lib/crystal3d/core/labelText.js.map +1 -0
  198. package/lib/crystal3d/core/latticeBasis.d.ts +49 -0
  199. package/lib/crystal3d/core/latticeBasis.d.ts.map +1 -0
  200. package/lib/crystal3d/core/latticeBasis.js +89 -0
  201. package/lib/crystal3d/core/latticeBasis.js.map +1 -0
  202. package/lib/crystal3d/core/mat3.d.ts +68 -0
  203. package/lib/crystal3d/core/mat3.d.ts.map +1 -0
  204. package/lib/crystal3d/core/mat3.js +146 -0
  205. package/lib/crystal3d/core/mat3.js.map +1 -0
  206. package/lib/crystal3d/core/operationMatrix.d.ts +44 -0
  207. package/lib/crystal3d/core/operationMatrix.d.ts.map +1 -0
  208. package/lib/crystal3d/core/operationMatrix.js +172 -0
  209. package/lib/crystal3d/core/operationMatrix.js.map +1 -0
  210. package/lib/crystal3d/core/orientation.d.ts +62 -0
  211. package/lib/crystal3d/core/orientation.d.ts.map +1 -0
  212. package/lib/crystal3d/core/orientation.js +166 -0
  213. package/lib/crystal3d/core/orientation.js.map +1 -0
  214. package/lib/crystal3d/core/palette.d.ts +24 -0
  215. package/lib/crystal3d/core/palette.d.ts.map +1 -0
  216. package/lib/crystal3d/core/palette.js +34 -0
  217. package/lib/crystal3d/core/palette.js.map +1 -0
  218. package/lib/crystal3d/core/primitives.d.ts +133 -0
  219. package/lib/crystal3d/core/primitives.d.ts.map +1 -0
  220. package/lib/crystal3d/core/primitives.js +80 -0
  221. package/lib/crystal3d/core/primitives.js.map +1 -0
  222. package/lib/crystal3d/core/structureText.d.ts +20 -0
  223. package/lib/crystal3d/core/structureText.d.ts.map +1 -0
  224. package/lib/crystal3d/core/structureText.js +37 -0
  225. package/lib/crystal3d/core/structureText.js.map +1 -0
  226. package/lib/crystal3d/core/supercell.d.ts +20 -0
  227. package/lib/crystal3d/core/supercell.d.ts.map +1 -0
  228. package/lib/crystal3d/core/supercell.js +35 -0
  229. package/lib/crystal3d/core/supercell.js.map +1 -0
  230. package/lib/crystal3d/core/types.d.ts +166 -0
  231. package/lib/crystal3d/core/types.d.ts.map +1 -0
  232. package/lib/crystal3d/core/types.js +10 -0
  233. package/lib/crystal3d/core/types.js.map +1 -0
  234. package/lib/crystal3d/core/vec3.d.ts +75 -0
  235. package/lib/crystal3d/core/vec3.d.ts.map +1 -0
  236. package/lib/crystal3d/core/vec3.js +119 -0
  237. package/lib/crystal3d/core/vec3.js.map +1 -0
  238. package/lib/crystal3d/ui/CrystalCanvas3D.d.ts +52 -0
  239. package/lib/crystal3d/ui/CrystalCanvas3D.d.ts.map +1 -0
  240. package/lib/crystal3d/ui/CrystalCanvas3D.js +242 -0
  241. package/lib/crystal3d/ui/CrystalCanvas3D.js.map +1 -0
  242. package/lib/crystal3d/ui/CrystalStructureView.d.ts +17 -0
  243. package/lib/crystal3d/ui/CrystalStructureView.d.ts.map +1 -0
  244. package/lib/crystal3d/ui/CrystalStructureView.js +76 -0
  245. package/lib/crystal3d/ui/CrystalStructureView.js.map +1 -0
  246. package/lib/crystal3d/ui/CrystalStructureViewer.d.ts +22 -0
  247. package/lib/crystal3d/ui/CrystalStructureViewer.d.ts.map +1 -0
  248. package/lib/crystal3d/ui/CrystalStructureViewer.js +29 -0
  249. package/lib/crystal3d/ui/CrystalStructureViewer.js.map +1 -0
  250. package/lib/crystal3d/ui/CrystalViewControls.d.ts +25 -0
  251. package/lib/crystal3d/ui/CrystalViewControls.d.ts.map +1 -0
  252. package/lib/crystal3d/ui/CrystalViewControls.js +22 -0
  253. package/lib/crystal3d/ui/CrystalViewControls.js.map +1 -0
  254. package/lib/crystal3d/ui/CrystalViewer3D.d.ts +72 -0
  255. package/lib/crystal3d/ui/CrystalViewer3D.d.ts.map +1 -0
  256. package/lib/crystal3d/ui/CrystalViewer3D.js +70 -0
  257. package/lib/crystal3d/ui/CrystalViewer3D.js.map +1 -0
  258. package/lib/crystal3d/ui/crystalScene.d.ts +91 -0
  259. package/lib/crystal3d/ui/crystalScene.d.ts.map +1 -0
  260. package/lib/crystal3d/ui/crystalScene.js +10 -0
  261. package/lib/crystal3d/ui/crystalScene.js.map +1 -0
  262. package/lib/crystal3d/ui/crystalStructureViewerProps.d.ts +52 -0
  263. package/lib/crystal3d/ui/crystalStructureViewerProps.d.ts.map +1 -0
  264. package/lib/crystal3d/ui/crystalStructureViewerProps.js +2 -0
  265. package/lib/crystal3d/ui/crystalStructureViewerProps.js.map +1 -0
  266. package/lib/crystal3d/ui/index.d.ts +16 -0
  267. package/lib/crystal3d/ui/index.d.ts.map +1 -0
  268. package/lib/crystal3d/ui/index.js +12 -0
  269. package/lib/crystal3d/ui/index.js.map +1 -0
  270. package/lib/crystal3d/ui/useCrystalCaption.d.ts +14 -0
  271. package/lib/crystal3d/ui/useCrystalCaption.d.ts.map +1 -0
  272. package/lib/crystal3d/ui/useCrystalCaption.js +32 -0
  273. package/lib/crystal3d/ui/useCrystalCaption.js.map +1 -0
  274. package/lib/crystal3d/viewer/animate.d.ts +49 -0
  275. package/lib/crystal3d/viewer/animate.d.ts.map +1 -0
  276. package/lib/crystal3d/viewer/animate.js +83 -0
  277. package/lib/crystal3d/viewer/animate.js.map +1 -0
  278. package/lib/crystal3d/viewer/camera.d.ts +44 -0
  279. package/lib/crystal3d/viewer/camera.d.ts.map +1 -0
  280. package/lib/crystal3d/viewer/camera.js +103 -0
  281. package/lib/crystal3d/viewer/camera.js.map +1 -0
  282. package/lib/crystal3d/viewer/index.d.ts +13 -0
  283. package/lib/crystal3d/viewer/index.d.ts.map +1 -0
  284. package/lib/crystal3d/viewer/index.js +8 -0
  285. package/lib/crystal3d/viewer/index.js.map +1 -0
  286. package/lib/crystal3d/viewer/layerRegistry.d.ts +24 -0
  287. package/lib/crystal3d/viewer/layerRegistry.d.ts.map +1 -0
  288. package/lib/crystal3d/viewer/layerRegistry.js +39 -0
  289. package/lib/crystal3d/viewer/layerRegistry.js.map +1 -0
  290. package/lib/crystal3d/viewer/meshPrimitives.d.ts +13 -0
  291. package/lib/crystal3d/viewer/meshPrimitives.d.ts.map +1 -0
  292. package/lib/crystal3d/viewer/meshPrimitives.js +76 -0
  293. package/lib/crystal3d/viewer/meshPrimitives.js.map +1 -0
  294. package/lib/crystal3d/viewer/plugin.d.ts +133 -0
  295. package/lib/crystal3d/viewer/plugin.d.ts.map +1 -0
  296. package/lib/crystal3d/viewer/plugin.js +181 -0
  297. package/lib/crystal3d/viewer/plugin.js.map +1 -0
  298. package/lib/crystal3d/viewer/renderCell.d.ts +43 -0
  299. package/lib/crystal3d/viewer/renderCell.d.ts.map +1 -0
  300. package/lib/crystal3d/viewer/renderCell.js +53 -0
  301. package/lib/crystal3d/viewer/renderCell.js.map +1 -0
  302. package/lib/crystal3d/viewer/renderElements.d.ts +54 -0
  303. package/lib/crystal3d/viewer/renderElements.d.ts.map +1 -0
  304. package/lib/crystal3d/viewer/renderElements.js +77 -0
  305. package/lib/crystal3d/viewer/renderElements.js.map +1 -0
  306. package/lib/crystal3d/viewer/renderStructure.d.ts +55 -0
  307. package/lib/crystal3d/viewer/renderStructure.d.ts.map +1 -0
  308. package/lib/crystal3d/viewer/renderStructure.js +103 -0
  309. package/lib/crystal3d/viewer/renderStructure.js.map +1 -0
  310. package/lib/crystal3d/viewer/sceneParts.d.ts +32 -0
  311. package/lib/crystal3d/viewer/sceneParts.d.ts.map +1 -0
  312. package/lib/crystal3d/viewer/sceneParts.js +77 -0
  313. package/lib/crystal3d/viewer/sceneParts.js.map +1 -0
  314. package/lib/crystal3d/viewer/shapeLayer.d.ts +41 -0
  315. package/lib/crystal3d/viewer/shapeLayer.d.ts.map +1 -0
  316. package/lib/crystal3d/viewer/shapeLayer.js +57 -0
  317. package/lib/crystal3d/viewer/shapeLayer.js.map +1 -0
  318. package/lib/crystal3d/viewer/textLayer.d.ts +21 -0
  319. package/lib/crystal3d/viewer/textLayer.d.ts.map +1 -0
  320. package/lib/crystal3d/viewer/textLayer.js +59 -0
  321. package/lib/crystal3d/viewer/textLayer.js.map +1 -0
  322. package/lib/crystal3d/viewer/viewer.d.ts +110 -0
  323. package/lib/crystal3d/viewer/viewer.d.ts.map +1 -0
  324. package/lib/crystal3d/viewer/viewer.js +157 -0
  325. package/lib/crystal3d/viewer/viewer.js.map +1 -0
  326. package/lib/crystal3d.d.ts +12 -0
  327. package/lib/crystal3d.d.ts.map +1 -0
  328. package/lib/crystal3d.js +12 -0
  329. package/lib/crystal3d.js.map +1 -0
  330. package/lib/i18n/core/chromeCatalog.d.ts +1 -1
  331. package/lib/i18n/core/chromeCatalog.d.ts.map +1 -1
  332. package/lib/locales/de.json +19 -1
  333. package/lib/locales/en.json +19 -1
  334. package/lib/locales/es.json +19 -1
  335. package/lib/locales/fr.json +19 -1
  336. package/lib/locales/it.json +19 -1
  337. package/lib/molecule3d/ui/MoleculeCanvas3D.d.ts.map +1 -1
  338. package/lib/molecule3d/ui/MoleculeCanvas3D.js +16 -27
  339. package/lib/molecule3d/ui/MoleculeCanvas3D.js.map +1 -1
  340. package/lib/molstar/bonds/bondRule.d.ts +16 -0
  341. package/lib/molstar/bonds/bondRule.d.ts.map +1 -0
  342. package/lib/molstar/bonds/bondRule.js +23 -0
  343. package/lib/molstar/bonds/bondRule.js.map +1 -0
  344. package/lib/molstar/bonds/index.d.ts +9 -0
  345. package/lib/molstar/bonds/index.d.ts.map +1 -0
  346. package/lib/molstar/bonds/index.js +9 -0
  347. package/lib/molstar/bonds/index.js.map +1 -0
  348. package/lib/molstar/ui/MolstarToolbar.d.ts +47 -0
  349. package/lib/molstar/ui/MolstarToolbar.d.ts.map +1 -0
  350. package/lib/molstar/ui/MolstarToolbar.js +28 -0
  351. package/lib/molstar/ui/MolstarToolbar.js.map +1 -0
  352. package/lib/molstar/ui/index.d.ts +10 -0
  353. package/lib/molstar/ui/index.d.ts.map +1 -0
  354. package/lib/molstar/ui/index.js +8 -0
  355. package/lib/molstar/ui/index.js.map +1 -0
  356. package/lib/molstar/ui/useMolstarTools.d.ts +63 -0
  357. package/lib/molstar/ui/useMolstarTools.d.ts.map +1 -0
  358. package/lib/molstar/ui/useMolstarTools.js +36 -0
  359. package/lib/molstar/ui/useMolstarTools.js.map +1 -0
  360. package/package.json +4 -1
  361. package/src/crystal/core/bondGrid.ts +98 -0
  362. package/src/crystal/core/cellAtoms.ts +106 -0
  363. package/src/crystal/core/cellBonds.ts +121 -0
  364. package/src/crystal/core/cif/element.ts +40 -0
  365. package/src/crystal/core/cif/index.ts +12 -0
  366. package/src/crystal/core/cif/number.ts +62 -0
  367. package/src/crystal/core/cif/read.ts +218 -0
  368. package/src/crystal/core/cif/readGeometry.ts +104 -0
  369. package/src/crystal/core/cif/tags.ts +143 -0
  370. package/src/crystal/core/cif/types.ts +164 -0
  371. package/src/crystal/core/components.ts +183 -0
  372. package/src/crystal/core/covalentRadii.ts +56 -0
  373. package/src/crystal/core/disorder.ts +190 -0
  374. package/src/crystal/core/expand.ts +105 -0
  375. package/src/crystal/core/index.ts +46 -0
  376. package/src/crystal/core/moleculeOf.ts +169 -0
  377. package/src/crystal/core/moleculeTypes.ts +85 -0
  378. package/src/crystal/core/molecules.ts +128 -0
  379. package/src/crystal/core/operations.ts +79 -0
  380. package/src/crystal/core/packing.ts +116 -0
  381. package/src/crystal/core/periodicBonds.ts +234 -0
  382. package/src/crystal/core/resolve.ts +187 -0
  383. package/src/crystal/core/spaceGroups/index.ts +16 -0
  384. package/src/crystal/core/spaceGroups/spaceGroupOperations.ts +32 -0
  385. package/src/crystal/core/spaceGroups/spaceGroupRows.ts +536 -0
  386. package/src/crystal/core/spaceGroups/spaceGroupSymbols.ts +179 -0
  387. package/src/crystal/core/spaceGroups/spaceGroups.ts +154 -0
  388. package/src/crystal/core/symmetry/group.ts +42 -0
  389. package/src/crystal/core/symmetry/index.ts +23 -0
  390. package/src/crystal/core/symmetry/integerMatrix.ts +153 -0
  391. package/src/crystal/core/symmetry/lattice.ts +152 -0
  392. package/src/crystal/core/symmetry/operation.ts +223 -0
  393. package/src/crystal/core/symmetry/parseOperation.ts +180 -0
  394. package/src/crystal/core/symmetry/types.ts +32 -0
  395. package/src/crystal/core/symmetryClasses.ts +105 -0
  396. package/src/crystal.ts +12 -0
  397. package/src/crystal3d/core/cellClip.ts +229 -0
  398. package/src/crystal3d/core/cellGeometry.ts +193 -0
  399. package/src/crystal3d/core/cellStack.ts +87 -0
  400. package/src/crystal3d/core/crystalView.ts +114 -0
  401. package/src/crystal3d/core/drawingSet.ts +71 -0
  402. package/src/crystal3d/core/elementDrawing.ts +147 -0
  403. package/src/crystal3d/core/elementExtent.ts +81 -0
  404. package/src/crystal3d/core/elementLabels.ts +130 -0
  405. package/src/crystal3d/core/elementShapes.ts +141 -0
  406. package/src/crystal3d/core/frame.ts +56 -0
  407. package/src/crystal3d/core/framing.ts +101 -0
  408. package/src/crystal3d/core/index.ts +132 -0
  409. package/src/crystal3d/core/labelText.ts +44 -0
  410. package/src/crystal3d/core/latticeBasis.ts +110 -0
  411. package/src/crystal3d/core/mat3.ts +163 -0
  412. package/src/crystal3d/core/operationMatrix.ts +255 -0
  413. package/src/crystal3d/core/orientation.ts +229 -0
  414. package/src/crystal3d/core/palette.ts +43 -0
  415. package/src/crystal3d/core/primitives.ts +183 -0
  416. package/src/crystal3d/core/structureText.ts +43 -0
  417. package/src/crystal3d/core/supercell.ts +40 -0
  418. package/src/crystal3d/core/types.ts +186 -0
  419. package/src/crystal3d/core/vec3.ts +127 -0
  420. package/src/crystal3d/ui/CrystalCanvas3D.tsx +384 -0
  421. package/src/crystal3d/ui/CrystalStructureView.tsx +148 -0
  422. package/src/crystal3d/ui/CrystalStructureViewer.tsx +39 -0
  423. package/src/crystal3d/ui/CrystalViewControls.tsx +100 -0
  424. package/src/crystal3d/ui/CrystalViewer3D.tsx +183 -0
  425. package/src/crystal3d/ui/crystalScene.ts +100 -0
  426. package/src/crystal3d/ui/crystalStructureViewerProps.ts +54 -0
  427. package/src/crystal3d/ui/index.ts +20 -0
  428. package/src/crystal3d/ui/useCrystalCaption.ts +38 -0
  429. package/src/crystal3d/viewer/animate.ts +113 -0
  430. package/src/crystal3d/viewer/camera.ts +139 -0
  431. package/src/crystal3d/viewer/index.ts +13 -0
  432. package/src/crystal3d/viewer/layerRegistry.ts +47 -0
  433. package/src/crystal3d/viewer/meshPrimitives.ts +102 -0
  434. package/src/crystal3d/viewer/plugin.ts +258 -0
  435. package/src/crystal3d/viewer/renderCell.ts +98 -0
  436. package/src/crystal3d/viewer/renderElements.ts +121 -0
  437. package/src/crystal3d/viewer/renderStructure.ts +144 -0
  438. package/src/crystal3d/viewer/sceneParts.ts +119 -0
  439. package/src/crystal3d/viewer/shapeLayer.ts +108 -0
  440. package/src/crystal3d/viewer/textLayer.ts +85 -0
  441. package/src/crystal3d/viewer/viewer.ts +207 -0
  442. package/src/crystal3d.ts +12 -0
  443. package/src/locales/de.json +19 -1
  444. package/src/locales/en.json +19 -1
  445. package/src/locales/es.json +19 -1
  446. package/src/locales/fr.json +19 -1
  447. package/src/locales/it.json +19 -1
  448. package/src/molecule3d/ui/MoleculeCanvas3D.tsx +45 -71
  449. package/src/molstar/bonds/bondRule.ts +34 -0
  450. package/src/molstar/bonds/index.ts +9 -0
  451. package/src/molstar/ui/MolstarToolbar.tsx +103 -0
  452. package/src/molstar/ui/index.ts +14 -0
  453. package/src/molstar/ui/useMolstarTools.ts +98 -0
  454. package/styles/chrome.css +90 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"camera.js","sourceRoot":"","sources":["../../../src/crystal3d/viewer/camera.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,wCAAwC,CAAC;AAK9D,OAAO,EACL,uBAAuB,EACvB,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,WAAW,IAAI,UAAU,EACzB,WAAW,GACZ,MAAM,6BAA6B,CAAC;AAIrC;;;;;;;;GAQG;AACH,MAAM,YAAY,GAAG,CAAC,IAAI,CAAC;AAE3B;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAC5B,MAAqB,EACrB,GAAW,EACX,MAA0B;IAE1B,IAAI,KAAK,GAAG,OAAO,CAAC,GAAG,C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crystal viewer: the canvas, and everything drawn on
3
+ * it. Reaching it pulls molstar in, so only the lazy canvas imports it.
4
+ */
5
+ export type { PlayOptions } from './animate.ts';
6
+ export { DEFAULT_CAMERA_DURATION } from './camera.ts';
7
+ export type { CrystalViewerOptions } from './plugin.ts';
8
+ export { CrystalViewerPlugin } from './plugin.ts';
9
+ export type { CellStyle } from './renderCell.ts';
10
+ export type { ElementLayerStyle } from './renderElements.ts';
11
+ export type { StructureStyle } from './renderStructure.ts';
12
+ export { CrystalViewer, createCrystalViewer } from './viewer.ts';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/crystal3d/viewer/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The molstar half of the crystal viewer: the canvas, and everything drawn on
3
+ * it. Reaching it pulls molstar in, so only the lazy canvas imports it.
4
+ */
5
+ export { DEFAULT_CAMERA_DURATION } from "./camera.js";
6
+ export { CrystalViewerPlugin } from "./plugin.js";
7
+ export { CrystalViewer, createCrystalViewer } from "./viewer.js";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/crystal3d/viewer/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAIlD,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Which drawn layers a canvas is carrying.
3
+ *
4
+ * A layer lives outside the state tree, keyed by name on the plugin, the way
5
+ * `lcao`'s lobes and nodal surfaces do: it is rebuilt whole on every toggle, and
6
+ * the state tree has nothing to add to that. Keeping the register here lets the
7
+ * mesh layers and the text layers share one place to be removed from.
8
+ */
9
+ import type { PluginContext } from 'molstar/lib/mol-plugin/context.js';
10
+ import type { Representation } from 'molstar/lib/mol-repr/representation.js';
11
+ /**
12
+ * Remember a layer, so a later call can take it off again.
13
+ * @param plugin - The molstar context.
14
+ * @param key - Which layer.
15
+ * @param representation - What was added to the canvas.
16
+ */
17
+ export declare function storeLayer(plugin: PluginContext, key: string, representation: Representation.Any): void;
18
+ /**
19
+ * Remove one layer, leaving every other in place.
20
+ * @param plugin - The molstar context.
21
+ * @param key - Which layer; an unknown one is ignored.
22
+ */
23
+ export declare function clearShapeLayer(plugin: PluginContext, key: string): void;
24
+ //# sourceMappingURL=layerRegistry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layerRegistry.d.ts","sourceRoot":"","sources":["../../../src/crystal3d/viewer/layerRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAE7E;;;;;GAKG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,aAAa,EACrB,GAAG,EAAE,MAAM,EACX,cAAc,EAAE,cAAc,CAAC,GAAG,GACjC,IAAI,CAON;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAOxE"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Which drawn layers a canvas is carrying.
3
+ *
4
+ * A layer lives outside the state tree, keyed by name on the plugin, the way
5
+ * `lcao`'s lobes and nodal surfaces do: it is rebuilt whole on every toggle, and
6
+ * the state tree has nothing to add to that. Keeping the register here lets the
7
+ * mesh layers and the text layers share one place to be removed from.
8
+ */
9
+ /**
10
+ * Remember a layer, so a later call can take it off again.
11
+ * @param plugin - The molstar context.
12
+ * @param key - Which layer.
13
+ * @param representation - What was added to the canvas.
14
+ */
15
+ export function storeLayer(plugin, key, representation) {
16
+ let layers = registry.get(plugin);
17
+ if (layers === undefined) {
18
+ layers = new Map();
19
+ registry.set(plugin, layers);
20
+ }
21
+ layers.set(key, representation);
22
+ }
23
+ /**
24
+ * Remove one layer, leaving every other in place.
25
+ * @param plugin - The molstar context.
26
+ * @param key - Which layer; an unknown one is ignored.
27
+ */
28
+ export function clearShapeLayer(plugin, key) {
29
+ const layers = registry.get(plugin);
30
+ const previous = layers?.get(key);
31
+ if (layers === undefined || previous === undefined)
32
+ return;
33
+ layers.delete(key);
34
+ plugin.canvas3d?.remove(previous);
35
+ plugin.canvas3d?.commit();
36
+ }
37
+ /** Every layer drawn on a plugin, so each can be removed on its own. */
38
+ const registry = new WeakMap();
39
+ //# sourceMappingURL=layerRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layerRegistry.js","sourceRoot":"","sources":["../../../src/crystal3d/viewer/layerRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CACxB,MAAqB,EACrB,GAAW,EACX,cAAkC;IAElC,IAAI,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAClC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,GAAG,IAAI,GAAG,EAA8B,CAAC;QAC/C,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,CAAC;IACD,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;AAClC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,MAAqB,EAAE,GAAW;IAChE,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACpC,MAAM,QAAQ,GAAG,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,MAAM,KAAK,SAAS,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO;IAC3D,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACnB,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;IAClC,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;AAC5B,CAAC;AAED,wEAAwE;AACxE,MAAM,QAAQ,GAAG,IAAI,OAAO,EAAkD,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The one place a shape worked out in `primitives.ts` becomes molstar geometry.
3
+ */
4
+ import { MeshBuilder } from 'molstar/lib/mol-geo/geometry/mesh/mesh-builder.js';
5
+ import type { MeshPrimitive } from '../core/primitives.ts';
6
+ /**
7
+ * Add one shape to a mesh under construction.
8
+ * @param state - The builder; its `currentGroup` decides which item the
9
+ * triangles belong to, and so what colour and label they take.
10
+ * @param primitive - The shape.
11
+ */
12
+ export declare function addMeshPrimitive(state: MeshBuilder.State, primitive: MeshPrimitive): void;
13
+ //# sourceMappingURL=meshPrimitives.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meshPrimitives.d.ts","sourceRoot":"","sources":["../../../src/crystal3d/viewer/meshPrimitives.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,OAAO,EAAE,WAAW,EAAE,MAAM,mDAAmD,CAAC;AAGhF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAG3D;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,WAAW,CAAC,KAAK,EACxB,SAAS,EAAE,aAAa,GACvB,IAAI,CAoEN"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * The one place a shape worked out in `primitives.ts` becomes molstar geometry.
3
+ */
4
+ import { addFixedCountDashedCylinder, addSimpleCylinder, } from 'molstar/lib/mol-geo/geometry/mesh/builder/cylinder.js';
5
+ import { addPlane } from 'molstar/lib/mol-geo/geometry/mesh/builder/plane.js';
6
+ import { addSphere } from 'molstar/lib/mol-geo/geometry/mesh/builder/sphere.js';
7
+ import { MeshBuilder } from 'molstar/lib/mol-geo/geometry/mesh/mesh-builder.js';
8
+ import { Vec3 } from 'molstar/lib/mol-math/linear-algebra.js';
9
+ /**
10
+ * Add one shape to a mesh under construction.
11
+ * @param state - The builder; its `currentGroup` decides which item the
12
+ * triangles belong to, and so what colour and label they take.
13
+ * @param primitive - The shape.
14
+ */
15
+ export function addMeshPrimitive(state, primitive) {
16
+ switch (primitive.shape) {
17
+ case 'rod': {
18
+ addSimpleCylinder(state, vec(primitive.start), vec(primitive.end), {
19
+ radiusTop: primitive.radius,
20
+ radiusBottom: primitive.radius,
21
+ radialSegments: ROD_SEGMENTS,
22
+ });
23
+ return;
24
+ }
25
+ case 'dashes': {
26
+ addFixedCountDashedCylinder(state, vec(primitive.start), vec(primitive.end), 1, primitive.segments, true, {
27
+ radiusTop: primitive.radius,
28
+ radiusBottom: primitive.radius,
29
+ radialSegments: ROD_SEGMENTS,
30
+ });
31
+ return;
32
+ }
33
+ case 'cone': {
34
+ addSimpleCylinder(state, vec(primitive.base), vec(primitive.tip), {
35
+ radiusTop: 0,
36
+ radiusBottom: primitive.radius,
37
+ radialSegments: CONE_SEGMENTS,
38
+ bottomCap: true,
39
+ });
40
+ return;
41
+ }
42
+ case 'sphere': {
43
+ addSphere(state, vec(primitive.centre), primitive.radius, SPHERE_DETAIL);
44
+ return;
45
+ }
46
+ case 'face': {
47
+ // A fan from the first corner; the corners come round the plane in
48
+ // order, so the face is convex and the fan covers it exactly.
49
+ const { points } = primitive;
50
+ const first = points[0];
51
+ if (first === undefined)
52
+ return;
53
+ for (let index = 1; index + 1 < points.length; index++) {
54
+ const second = points[index];
55
+ const third = points[index + 1];
56
+ if (second === undefined || third === undefined)
57
+ continue;
58
+ MeshBuilder.addTriangle(state, vec(first), vec(second), vec(third));
59
+ }
60
+ return;
61
+ }
62
+ case 'plate': {
63
+ // The unit plane is ±0.5, so the scale is the side of the square; the
64
+ // third component is the (zero-thickness) normal direction.
65
+ addPlane(state, vec(primitive.centre), vec(primitive.major), vec(primitive.minor), Vec3.create(primitive.size, primitive.size, 1), 1, 1);
66
+ }
67
+ // no default
68
+ }
69
+ }
70
+ function vec(point) {
71
+ return Vec3.create(point[0], point[1], point[2]);
72
+ }
73
+ const ROD_SEGMENTS = 12;
74
+ const CONE_SEGMENTS = 16;
75
+ const SPHERE_DETAIL = 2;
76
+ //# sourceMappingURL=meshPrimitives.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meshPrimitives.js","sourceRoot":"","sources":["../../../src/crystal3d/viewer/meshPrimitives.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,2BAA2B,EAC3B,iBAAiB,GAClB,MAAM,uDAAuD,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,oDAAoD,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,qDAAqD,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,mDAAmD,CAAC;AAChF,OAAO,EAAE,IAAI,EAAE,MAAM,wCAAwC,CAAC;AAK9D;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAC9B,KAAwB,EACxB,SAAwB;IAExB,QAAQ,SAAS,CAAC,KAAK,EAAE,CAAC;QACxB,KAAK,KAAK,CAAC,CAAC,CAAC;YAC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 * Lifecycle of one molstar canvas: created now, disposed whenever, every call
3
+ * queued behind initialisation.
4
+ *
5
+ * The constructor is **synchronous** on purpose. React 19 runs an effect, its
6
+ * cleanup and the effect again on every mount in development, so an `await`ed
7
+ * constructor hands the cleanup nothing to dispose and leaks a WebGL context per
8
+ * mount — browsers drop the oldest after about sixteen, and the viewer silently
9
+ * goes blank. Returning the handle immediately means `dispose()` can always be
10
+ * called, even before initialisation has finished.
11
+ *
12
+ * molstar's own UI is never mounted: every control is the page's.
13
+ */
14
+ import type { PluginContext } from 'molstar/lib/mol-plugin/context.js';
15
+ import type { Molecule3DCamera } from '../../molecule3d/core/camera.ts';
16
+ import type { ImageSize } from '../../molecule3d/core/exportImage.ts';
17
+ import type { RenderedFigure } from '../../molecule3d/core/figureFrame.ts';
18
+ import type { Measurement, MeasurementKind } from '../../molecule3d/core/measurement.ts';
19
+ import type { SceneCapture } from '../../molecule3d/ui/exportMoleculeImage.ts';
20
+ import type { ViewOrientation } from '../core/orientation.ts';
21
+ import type { Point3 } from '../core/types.ts';
22
+ /** Settings fixed for the life of a viewer. */
23
+ export interface CrystalViewerOptions {
24
+ /**
25
+ * Scene background, as `#rrggbb`.
26
+ * @default '#ffffff'
27
+ */
28
+ background?: string;
29
+ /**
30
+ * Called with each measurement once its atoms are picked; measuring is off
31
+ * without it.
32
+ * @default undefined
33
+ */
34
+ onMeasure?: (measurement: Measurement) => void;
35
+ }
36
+ /** One molstar canvas, and the queue everything drawn on it goes through. */
37
+ export declare class CrystalViewerPlugin implements SceneCapture {
38
+ #private;
39
+ /** Resolves once the canvas exists; every call awaits it internally. */
40
+ readonly ready: Promise<void>;
41
+ constructor(container: HTMLElement, options?: CrystalViewerOptions);
42
+ /**
43
+ * Whether {@link dispose} has been called.
44
+ * @returns True once the viewer is disposed.
45
+ */
46
+ get disposed(): boolean;
47
+ /**
48
+ * Wait for initialisation, then run `action` on the plugin.
49
+ * @param action - What to do with the molstar context.
50
+ * @returns Nothing once the viewer has been disposed — before the call or
51
+ * while `action` was still running. An initialisation failure, and any
52
+ * error `action` throws while the viewer is alive, still reach the caller.
53
+ */
54
+ run(action: (plugin: PluginContext) => void | Promise<void>): Promise<void>;
55
+ /**
56
+ * Frame everything on screen.
57
+ * @param durationMs - Transition length; 0 jumps.
58
+ * @param orientation - Where to look from, from `sceneOrientation`. Left out,
59
+ * the camera keeps the direction it is already pointing.
60
+ * @returns Resolves once the camera has been told where to go.
61
+ */
62
+ resetCamera(durationMs?: number, orientation?: ViewOrientation): Promise<void>;
63
+ /**
64
+ * Where the camera stands, against what is drawn.
65
+ * @returns The camera, or `null` while nothing is drawn.
66
+ */
67
+ readCamera(): Promise<Molecule3DCamera | null>;
68
+ /**
69
+ * Put the camera back where {@link readCamera} found it.
70
+ * @param camera - Where to stand.
71
+ * @returns Resolves once the camera stands there.
72
+ */
73
+ applyCamera(camera: Molecule3DCamera): Promise<void>;
74
+ /**
75
+ * Render the scene off screen at a size of its own, for a picture to save.
76
+ * @param size - Pixel size of the picture.
77
+ * @returns The PNG as a data URI; `undefined` once the viewer is disposed.
78
+ */
79
+ captureImage(size: ImageSize): Promise<string | undefined>;
80
+ /**
81
+ * Render the part of the scene holding the crystal, for a figure handed on.
82
+ * @param size - Pixel size of the frame the crystal is cut from.
83
+ * @param longest - Longest side of the figure, in pixels.
84
+ * @returns The figure; `undefined` once the viewer is disposed.
85
+ */
86
+ captureFigure(size: ImageSize, longest: number): Promise<RenderedFigure | undefined>;
87
+ /**
88
+ * Zoom onto one point of the scene.
89
+ * @param centre - What to frame, Cartesian ångström.
90
+ * @param radius - Radius of the ball to fit, ångström.
91
+ * @param durationMs - Transition length; 0 jumps.
92
+ * @param orientation - Where to look from; the current direction when absent.
93
+ * @returns Resolves once the camera has been told where to go.
94
+ */
95
+ focus(centre: Point3, radius: number, durationMs?: number, orientation?: ViewOrientation): Promise<void>;
96
+ /**
97
+ * Turn the automatic spin on or off. It moves the camera, never the object:
98
+ * showing that a molecule maps onto itself is a different button.
99
+ * @param spinning - Whether the scene should keep turning.
100
+ * @param speed - molstar's own spin unit.
101
+ * @returns Resolves once the spin is set.
102
+ */
103
+ setSpin(spinning: boolean, speed?: number): Promise<void>;
104
+ /**
105
+ * Report what the pointer rests on, by the label its drawing carries. Every
106
+ * axis, plane and centre is drawn with a label already — `C3 along [111]`,
107
+ * `n glide at x = ¼` — and an atom is named `O 1`, never by the row molstar
108
+ * parsed it from.
109
+ * @param listener - Called with the label, or `null` over nothing.
110
+ * @returns A function that stops the reporting; safe to call at any time.
111
+ */
112
+ onHover(listener: (label: string | null) => void): () => void;
113
+ /**
114
+ * Make clicks on atoms build a measurement, or give them back to the camera.
115
+ * @param kind - The measurement to build, or `null`.
116
+ * @returns Resolves once clicks build that measurement.
117
+ */
118
+ setMeasureKind(kind: MeasurementKind | null): Promise<void>;
119
+ /**
120
+ * Draw exactly these measurements over the atoms on screen.
121
+ * @param measurements - Replaces whatever is drawn; empty clears them.
122
+ * @returns Resolves once they are drawn.
123
+ */
124
+ showMeasurements(measurements: readonly Measurement[]): Promise<void>;
125
+ /** Re-read the container's size. Call from a `ResizeObserver`. */
126
+ handleResize(): void;
127
+ /**
128
+ * Tear the canvas down and release its WebGL context. Idempotent, and safe to
129
+ * call before initialisation has finished.
130
+ */
131
+ dispose(): void;
132
+ }
133
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/crystal3d/viewer/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAEvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,KAAK,EACV,WAAW,EACX,eAAe,EA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;;;;OAOG;IACH,KAAK,CACH,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,UAAU,SAA0B,EACpC,WAAW,CAAC,EAAE,eAAe,GAC5B,OAAO,CAAC,IAAI,CAAC;IAMhB;;;;;;OAMG;IACH,OAAO,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,SAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAMpD;;;;;;;OAOG;IACH,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,GAAG,MAAM,IAAI;IAQ7D;;;;OAIG;IACH,cAAc,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAM3D;;;;OAIG;IACH,gBAAgB,CAAC,YAAY,EAAE,SAAS,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAUrE,kEAAkE;IAClE,YAAY,IAAI,IAAI;IAIpB;;;OAGG;IACH,OAAO,IAAI,IAAI;CAIhB"}
@@ -0,0 +1,181 @@
1
+ /**
2
+ * Lifecycle of one molstar canvas: created now, disposed whenever, every call
3
+ * queued behind initialisation.
4
+ *
5
+ * The constructor is **synchronous** on purpose. React 19 runs an effect, its
6
+ * cleanup and the effect again on every mount in development, so an `await`ed
7
+ * constructor hands the cleanup nothing to dispose and leaks a WebGL context per
8
+ * mount — browsers drop the oldest after about sixteen, and the viewer silently
9
+ * goes blank. Returning the handle immediately means `dispose()` can always be
10
+ * called, even before initialisation has finished.
11
+ *
12
+ * molstar's own UI is never mounted: every control is the page's.
13
+ */
14
+ import { MeasurementPicker, MolstarPlugin, captureFigure, captureScene, clearMeasurements, focusPoint, renderMeasurements, setSpin, subscribeHoverLabel, } from "../../molstar/core/index.js";
15
+ import { DEFAULT_CAMERA_DURATION, applyCamera, readCamera, resetCamera, } from "./camera.js";
16
+ import { crystalStructure } from "./renderStructure.js";
17
+ /** One molstar canvas, and the queue everything drawn on it goes through. */
18
+ export class CrystalViewerPlugin {
19
+ #plugin;
20
+ #picker;
21
+ /** Resolves once the canvas exists; every call awaits it internally. */
22
+ ready;
23
+ constructor(container, options = {}) {
24
+ this.#plugin = new MolstarPlugin(container, {
25
+ background: options.background,
26
+ // Replacing a scene commits several times, and molstar's own default
27
+ // glides the camera on each, so the structure appears to drift into
28
+ // place. Reframing is right; animating it between two unrelated
29
+ // structures is not.
30
+ cameraResetDurationMilliseconds: 0,
31
+ });
32
+ this.ready = this.#plugin.ready;
33
+ const { onMeasure } = options;
34
+ if (onMeasure !== undefined) {
35
+ // A failed initialisation is reported by the next call the page makes.
36
+ void this.#plugin
37
+ .run((plugin) => {
38
+ this.#picker = new MeasurementPicker(plugin, onMeasure, crystalStructure);
39
+ })
40
+ .catch(() => undefined);
41
+ }
42
+ }
43
+ /**
44
+ * Whether {@link dispose} has been called.
45
+ * @returns True once the viewer is disposed.
46
+ */
47
+ get disposed() {
48
+ return this.#plugin.disposed;
49
+ }
50
+ /**
51
+ * Wait for initialisation, then run `action` on the plugin.
52
+ * @param action - What to do with the molstar context.
53
+ * @returns Nothing once the viewer has been disposed — before the call or
54
+ * while `action` was still running. An initialisation failure, and any
55
+ * error `action` throws while the viewer is alive, still reach the caller.
56
+ */
57
+ run(action) {
58
+ return this.#plugin.run(action).then(() => undefined);
59
+ }
60
+ /**
61
+ * Frame everything on screen.
62
+ * @param durationMs - Transition length; 0 jumps.
63
+ * @param orientation - Where to look from, from `sceneOrientation`. Left out,
64
+ * the camera keeps the direction it is already pointing.
65
+ * @returns Resolves once the camera has been told where to go.
66
+ */
67
+ resetCamera(durationMs = DEFAULT_CAMERA_DURATION, orientation) {
68
+ return this.run((plugin) => {
69
+ resetCamera(plugin, durationMs, orientation);
70
+ });
71
+ }
72
+ /**
73
+ * Where the camera stands, against what is drawn.
74
+ * @returns The camera, or `null` while nothing is drawn.
75
+ */
76
+ async readCamera() {
77
+ return (await this.#plugin.run(readCamera)) ?? null;
78
+ }
79
+ /**
80
+ * Put the camera back where {@link readCamera} found it.
81
+ * @param camera - Where to stand.
82
+ * @returns Resolves once the camera stands there.
83
+ */
84
+ applyCamera(camera) {
85
+ return this.run((plugin) => {
86
+ applyCamera(plugin, camera);
87
+ });
88
+ }
89
+ /**
90
+ * Render the scene off screen at a size of its own, for a picture to save.
91
+ * @param size - Pixel size of the picture.
92
+ * @returns The PNG as a data URI; `undefined` once the viewer is disposed.
93
+ */
94
+ captureImage(size) {
95
+ return this.#plugin.run((plugin) => captureScene(plugin, size));
96
+ }
97
+ /**
98
+ * Render the part of the scene holding the crystal, for a figure handed on.
99
+ * @param size - Pixel size of the frame the crystal is cut from.
100
+ * @param longest - Longest side of the figure, in pixels.
101
+ * @returns The figure; `undefined` once the viewer is disposed.
102
+ */
103
+ captureFigure(size, longest) {
104
+ return this.#plugin.run((plugin) => captureFigure(plugin, size, longest));
105
+ }
106
+ /**
107
+ * Zoom onto one point of the scene.
108
+ * @param centre - What to frame, Cartesian ångström.
109
+ * @param radius - Radius of the ball to fit, ångström.
110
+ * @param durationMs - Transition length; 0 jumps.
111
+ * @param orientation - Where to look from; the current direction when absent.
112
+ * @returns Resolves once the camera has been told where to go.
113
+ */
114
+ focus(centre, radius, durationMs = DEFAULT_CAMERA_DURATION, orientation) {
115
+ return this.run((plugin) => {
116
+ focusPoint(plugin, centre, radius, { durationMs, orientation });
117
+ });
118
+ }
119
+ /**
120
+ * Turn the automatic spin on or off. It moves the camera, never the object:
121
+ * showing that a molecule maps onto itself is a different button.
122
+ * @param spinning - Whether the scene should keep turning.
123
+ * @param speed - molstar's own spin unit.
124
+ * @returns Resolves once the spin is set.
125
+ */
126
+ setSpin(spinning, speed = 1) {
127
+ return this.run((plugin) => {
128
+ setSpin(plugin, spinning, speed);
129
+ });
130
+ }
131
+ /**
132
+ * Report what the pointer rests on, by the label its drawing carries. Every
133
+ * axis, plane and centre is drawn with a label already — `C3 along [111]`,
134
+ * `n glide at x = ¼` — and an atom is named `O 1`, never by the row molstar
135
+ * parsed it from.
136
+ * @param listener - Called with the label, or `null` over nothing.
137
+ * @returns A function that stops the reporting; safe to call at any time.
138
+ */
139
+ onHover(listener) {
140
+ return this.#plugin.subscribe((plugin) => subscribeHoverLabel(plugin, (hover) => {
141
+ listener(hover === null ? null : hover.label);
142
+ }));
143
+ }
144
+ /**
145
+ * Make clicks on atoms build a measurement, or give them back to the camera.
146
+ * @param kind - The measurement to build, or `null`.
147
+ * @returns Resolves once clicks build that measurement.
148
+ */
149
+ setMeasureKind(kind) {
150
+ return this.run(() => {
151
+ this.#picker?.setKind(kind);
152
+ });
153
+ }
154
+ /**
155
+ * Draw exactly these measurements over the atoms on screen.
156
+ * @param measurements - Replaces whatever is drawn; empty clears them.
157
+ * @returns Resolves once they are drawn.
158
+ */
159
+ showMeasurements(measurements) {
160
+ return this.run(async (plugin) => {
161
+ if (measurements.length === 0) {
162
+ await clearMeasurements(plugin);
163
+ return;
164
+ }
165
+ await renderMeasurements(plugin, measurements, crystalStructure);
166
+ });
167
+ }
168
+ /** Re-read the container's size. Call from a `ResizeObserver`. */
169
+ handleResize() {
170
+ this.#plugin.handleResize();
171
+ }
172
+ /**
173
+ * Tear the canvas down and release its WebGL context. Idempotent, and safe to
174
+ * call before initialisation has finished.
175
+ */
176
+ dispose() {
177
+ this.#picker?.dispose();
178
+ this.#plugin.dispose();
179
+ }
180
+ }
181
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../src/crystal3d/viewer/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAYH,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,UAAU,EACV,kBAAkB,EAClB,OAAO,EACP,mBAAmB,GACpB,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EACL,uBAAuB,EACvB,WAAW,EACX,UAAU,EACV,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB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QAAQ,EAAE,KAAK,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACH,OAAO,CAAC,QAAwC;QAC9C,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,EAAE,CACvC,mBAAmB,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;YACpC,QAAQ,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAChD,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,cAAc,CAAC,IAA4B;QACzC,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE;YACnB,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,gBAAgB,CAAC,YAAoC;QACnD,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;YAC/B,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC9B,MAAM,iBAAiB,CAAC,MAAM,CAAC,CAAC;gBAChC,OAAO;YACT,CAAC;YACD,MAAM,kBAAkB,CAAC,MAAM,EAAE,YAAY,EAAE,gBAAgB,CAAC,CAAC;QACnE,CAAC,CAAC,CAAC;IACL,CAAC;IAED,kEAAkE;IAClE,YAAY;QACV,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;IAC9B,CAAC;IAED;;;OAGG;IACH,OAAO;QACL,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC;QACxB,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;IACzB,CAAC;CACF"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * The unit cell, and the stack of cells around it.
3
+ *
4
+ * molstar's own unit-cell shape reads the space group off the model, and this
5
+ * site gives it none — it has applied its own operations already — so the box is
6
+ * drawn here, which also lets an n×n×n stack be drawn at all.
7
+ */
8
+ import type { PluginContext } from 'molstar/lib/mol-plugin/context.js';
9
+ import type { CellRepeat, UnitCell } from '../core/types.ts';
10
+ /** How the box is drawn. */
11
+ export interface CellStyle {
12
+ /**
13
+ * Radius of an edge, ångström.
14
+ * @default 0.035
15
+ */
16
+ radius?: number;
17
+ /**
18
+ * Whether the a, b and c letters are drawn on the cell at the origin.
19
+ * @default true
20
+ */
21
+ labels?: boolean;
22
+ /**
23
+ * Height of those letters, ångström.
24
+ * @default 0.7
25
+ */
26
+ labelSize?: number;
27
+ }
28
+ /**
29
+ * Replace the drawn cell.
30
+ * @param plugin - The molstar context.
31
+ * @param cell - The six cell parameters, or `null` to draw none.
32
+ * @param repeat - Cells along a, b and c.
33
+ * @param style - See {@link CellStyle}.
34
+ * @throws {Error} When the canvas is not ready.
35
+ * @throws {RangeError} When the angles describe no cell.
36
+ */
37
+ export declare function renderUnitCell(plugin: PluginContext, cell: UnitCell | null, repeat?: CellRepeat, style?: CellStyle): Promise<void>;
38
+ /**
39
+ * Remove the cell and its letters.
40
+ * @param plugin - The molstar context.
41
+ */
42
+ export declare function clearUnitCell(plugin: PluginContext): void;
43
+ //# sourceMappingURL=renderCell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderCell.d.ts","sourceRoot":"","sources":["../../../src/crystal3d/viewer/renderCell.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAKvE,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAM7D,4BAA4B;AAC5B,MAAM,WAAW,SAAS;IACxB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,QAAQ,GAAG,IAAI,EACrB,MAAM,GAAE,UAAsB,EAC9B,KAAK,GAAE,SAAc,GACpB,OAAO,CAAC,IAAI,CAAC,CAwBf;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAGzD"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * The unit cell, and the stack of cells around it.
3
+ *
4
+ * molstar's own unit-cell shape reads the space group off the model, and this
5
+ * site gives it none — it has applied its own operations already — so the box is
6
+ * drawn here, which also lets an n×n×n stack be drawn at all.
7
+ */
8
+ import { cellAxisLabelPoints, cellEdges } from "../core/cellGeometry.js";
9
+ import { CELL_COLOUR, LABEL_COLOUR } from "../core/palette.js";
10
+ import { clearShapeLayer } from "./layerRegistry.js";
11
+ import { renderShapeLayer } from "./shapeLayer.js";
12
+ import { renderTextLayer } from "./textLayer.js";
13
+ /**
14
+ * Replace the drawn cell.
15
+ * @param plugin - The molstar context.
16
+ * @param cell - The six cell parameters, or `null` to draw none.
17
+ * @param repeat - Cells along a, b and c.
18
+ * @param style - See {@link CellStyle}.
19
+ * @throws {Error} When the canvas is not ready.
20
+ * @throws {RangeError} When the angles describe no cell.
21
+ */
22
+ export async function renderUnitCell(plugin, cell, repeat = [1, 1, 1], style = {}) {
23
+ if (cell === null) {
24
+ clearUnitCell(plugin);
25
+ return;
26
+ }
27
+ const radius = style.radius ?? 0.035;
28
+ const primitives = [];
29
+ for (const edge of cellEdges(cell, repeat)) {
30
+ primitives.push({ shape: 'rod', start: edge.start, end: edge.end, radius });
31
+ }
32
+ await renderShapeLayer(plugin, CELL_LAYER, 'Unit cell', [{ label: 'Unit cell', colour: CELL_COLOUR, primitives }], { alpha: 1 });
33
+ await renderTextLayer(plugin, CELL_LABEL_LAYER, 'Cell axes', style.labels === false ? [] : axisLabels(cell, style.labelSize ?? 0.7), LABEL_COLOUR);
34
+ }
35
+ /**
36
+ * Remove the cell and its letters.
37
+ * @param plugin - The molstar context.
38
+ */
39
+ export function clearUnitCell(plugin) {
40
+ clearShapeLayer(plugin, CELL_LAYER);
41
+ clearShapeLayer(plugin, CELL_LABEL_LAYER);
42
+ }
43
+ function axisLabels(cell, size) {
44
+ const points = cellAxisLabelPoints(cell);
45
+ return [
46
+ { text: 'a', position: points[0], size },
47
+ { text: 'b', position: points[1], size },
48
+ { text: 'c', position: points[2], size },
49
+ ];
50
+ }
51
+ const CELL_LAYER = 'crystal3d-unit-cell';
52
+ const CELL_LABEL_LAYER = 'crystal3d-unit-cell-labels';
53
+ //# sourceMappingURL=renderCell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderCell.js","sourceRoot":"","sources":["../../../src/crystal3d/viewer/renderCell.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAI/D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAqBjD;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAAqB,EACrB,IAAqB,EACrB,SAAqB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAC9B,QAAmB,EAAE;IAErB,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAClB,aAAa,CAAC,MAAM,CAAC,CAAC;QACtB,OAAO;IACT,CAAC;IACD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC;IACrC,MAAM,UAAU,GAAoB,EAAE,CAAC;IACvC,KAAK,MAAM,I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