react-cheminfo 0.135.0 → 0.137.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 (311) hide show
  1. package/README.md +1 -1
  2. package/lib/crystal/core/cellAtoms.d.ts +43 -0
  3. package/lib/crystal/core/cellAtoms.d.ts.map +1 -0
  4. package/lib/crystal/core/cellAtoms.js +70 -0
  5. package/lib/crystal/core/cellAtoms.js.map +1 -0
  6. package/lib/crystal/core/index.d.ts +2 -0
  7. package/lib/crystal/core/index.d.ts.map +1 -1
  8. package/lib/crystal/core/index.js +1 -0
  9. package/lib/crystal/core/index.js.map +1 -1
  10. package/lib/crystal/core/molecules.d.ts.map +1 -1
  11. package/lib/crystal/core/molecules.js +6 -40
  12. package/lib/crystal/core/molecules.js.map +1 -1
  13. package/lib/crystal3d/core/cellClip.d.ts +46 -0
  14. package/lib/crystal3d/core/cellClip.d.ts.map +1 -0
  15. package/lib/crystal3d/core/cellClip.js +198 -0
  16. package/lib/crystal3d/core/cellClip.js.map +1 -0
  17. package/lib/crystal3d/core/cellGeometry.d.ts +63 -0
  18. package/lib/crystal3d/core/cellGeometry.d.ts.map +1 -0
  19. package/lib/crystal3d/core/cellGeometry.js +153 -0
  20. package/lib/crystal3d/core/cellGeometry.js.map +1 -0
  21. package/lib/crystal3d/core/cellStack.d.ts +51 -0
  22. package/lib/crystal3d/core/cellStack.d.ts.map +1 -0
  23. package/lib/crystal3d/core/cellStack.js +79 -0
  24. package/lib/crystal3d/core/cellStack.js.map +1 -0
  25. package/lib/crystal3d/core/crystalView.d.ts +81 -0
  26. package/lib/crystal3d/core/crystalView.d.ts.map +1 -0
  27. package/lib/crystal3d/core/crystalView.js +55 -0
  28. package/lib/crystal3d/core/crystalView.js.map +1 -0
  29. package/lib/crystal3d/core/drawingSet.d.ts +31 -0
  30. package/lib/crystal3d/core/drawingSet.d.ts.map +1 -0
  31. package/lib/crystal3d/core/drawingSet.js +63 -0
  32. package/lib/crystal3d/core/drawingSet.js.map +1 -0
  33. package/lib/crystal3d/core/elementDrawing.d.ts +50 -0
  34. package/lib/crystal3d/core/elementDrawing.d.ts.map +1 -0
  35. package/lib/crystal3d/core/elementDrawing.js +100 -0
  36. package/lib/crystal3d/core/elementDrawing.js.map +1 -0
  37. package/lib/crystal3d/core/elementExtent.d.ts +42 -0
  38. package/lib/crystal3d/core/elementExtent.d.ts.map +1 -0
  39. package/lib/crystal3d/core/elementExtent.js +56 -0
  40. package/lib/crystal3d/core/elementExtent.js.map +1 -0
  41. package/lib/crystal3d/core/elementLabels.d.ts +31 -0
  42. package/lib/crystal3d/core/elementLabels.d.ts.map +1 -0
  43. package/lib/crystal3d/core/elementLabels.js +99 -0
  44. package/lib/crystal3d/core/elementLabels.js.map +1 -0
  45. package/lib/crystal3d/core/elementShapes.d.ts +43 -0
  46. package/lib/crystal3d/core/elementShapes.d.ts.map +1 -0
  47. package/lib/crystal3d/core/elementShapes.js +115 -0
  48. package/lib/crystal3d/core/elementShapes.js.map +1 -0
  49. package/lib/crystal3d/core/frame.d.ts +36 -0
  50. package/lib/crystal3d/core/frame.d.ts.map +1 -0
  51. package/lib/crystal3d/core/frame.js +35 -0
  52. package/lib/crystal3d/core/frame.js.map +1 -0
  53. package/lib/crystal3d/core/framing.d.ts +41 -0
  54. package/lib/crystal3d/core/framing.d.ts.map +1 -0
  55. package/lib/crystal3d/core/framing.js +79 -0
  56. package/lib/crystal3d/core/framing.js.map +1 -0
  57. package/lib/crystal3d/core/index.d.ts +42 -0
  58. package/lib/crystal3d/core/index.d.ts.map +1 -0
  59. package/lib/crystal3d/core/index.js +29 -0
  60. package/lib/crystal3d/core/index.js.map +1 -0
  61. package/lib/crystal3d/core/labelText.d.ts +19 -0
  62. package/lib/crystal3d/core/labelText.d.ts.map +1 -0
  63. package/lib/crystal3d/core/labelText.js +42 -0
  64. package/lib/crystal3d/core/labelText.js.map +1 -0
  65. package/lib/crystal3d/core/latticeBasis.d.ts +49 -0
  66. package/lib/crystal3d/core/latticeBasis.d.ts.map +1 -0
  67. package/lib/crystal3d/core/latticeBasis.js +89 -0
  68. package/lib/crystal3d/core/latticeBasis.js.map +1 -0
  69. package/lib/crystal3d/core/mat3.d.ts +68 -0
  70. package/lib/crystal3d/core/mat3.d.ts.map +1 -0
  71. package/lib/crystal3d/core/mat3.js +146 -0
  72. package/lib/crystal3d/core/mat3.js.map +1 -0
  73. package/lib/crystal3d/core/operationMatrix.d.ts +44 -0
  74. package/lib/crystal3d/core/operationMatrix.d.ts.map +1 -0
  75. package/lib/crystal3d/core/operationMatrix.js +172 -0
  76. package/lib/crystal3d/core/operationMatrix.js.map +1 -0
  77. package/lib/crystal3d/core/orientation.d.ts +62 -0
  78. package/lib/crystal3d/core/orientation.d.ts.map +1 -0
  79. package/lib/crystal3d/core/orientation.js +166 -0
  80. package/lib/crystal3d/core/orientation.js.map +1 -0
  81. package/lib/crystal3d/core/palette.d.ts +24 -0
  82. package/lib/crystal3d/core/palette.d.ts.map +1 -0
  83. package/lib/crystal3d/core/palette.js +34 -0
  84. package/lib/crystal3d/core/palette.js.map +1 -0
  85. package/lib/crystal3d/core/primitives.d.ts +133 -0
  86. package/lib/crystal3d/core/primitives.d.ts.map +1 -0
  87. package/lib/crystal3d/core/primitives.js +80 -0
  88. package/lib/crystal3d/core/primitives.js.map +1 -0
  89. package/lib/crystal3d/core/structureText.d.ts +20 -0
  90. package/lib/crystal3d/core/structureText.d.ts.map +1 -0
  91. package/lib/crystal3d/core/structureText.js +37 -0
  92. package/lib/crystal3d/core/structureText.js.map +1 -0
  93. package/lib/crystal3d/core/supercell.d.ts +20 -0
  94. package/lib/crystal3d/core/supercell.d.ts.map +1 -0
  95. package/lib/crystal3d/core/supercell.js +35 -0
  96. package/lib/crystal3d/core/supercell.js.map +1 -0
  97. package/lib/crystal3d/core/types.d.ts +166 -0
  98. package/lib/crystal3d/core/types.d.ts.map +1 -0
  99. package/lib/crystal3d/core/types.js +10 -0
  100. package/lib/crystal3d/core/types.js.map +1 -0
  101. package/lib/crystal3d/core/vec3.d.ts +75 -0
  102. package/lib/crystal3d/core/vec3.d.ts.map +1 -0
  103. package/lib/crystal3d/core/vec3.js +119 -0
  104. package/lib/crystal3d/core/vec3.js.map +1 -0
  105. package/lib/crystal3d/ui/CrystalCanvas3D.d.ts +52 -0
  106. package/lib/crystal3d/ui/CrystalCanvas3D.d.ts.map +1 -0
  107. package/lib/crystal3d/ui/CrystalCanvas3D.js +250 -0
  108. package/lib/crystal3d/ui/CrystalCanvas3D.js.map +1 -0
  109. package/lib/crystal3d/ui/CrystalStructureView.d.ts +17 -0
  110. package/lib/crystal3d/ui/CrystalStructureView.d.ts.map +1 -0
  111. package/lib/crystal3d/ui/CrystalStructureView.js +79 -0
  112. package/lib/crystal3d/ui/CrystalStructureView.js.map +1 -0
  113. package/lib/crystal3d/ui/CrystalStructureViewer.d.ts +22 -0
  114. package/lib/crystal3d/ui/CrystalStructureViewer.d.ts.map +1 -0
  115. package/lib/crystal3d/ui/CrystalStructureViewer.js +29 -0
  116. package/lib/crystal3d/ui/CrystalStructureViewer.js.map +1 -0
  117. package/lib/crystal3d/ui/CrystalViewControls.d.ts +29 -0
  118. package/lib/crystal3d/ui/CrystalViewControls.d.ts.map +1 -0
  119. package/lib/crystal3d/ui/CrystalViewControls.js +24 -0
  120. package/lib/crystal3d/ui/CrystalViewControls.js.map +1 -0
  121. package/lib/crystal3d/ui/CrystalViewer3D.d.ts +72 -0
  122. package/lib/crystal3d/ui/CrystalViewer3D.d.ts.map +1 -0
  123. package/lib/crystal3d/ui/CrystalViewer3D.js +70 -0
  124. package/lib/crystal3d/ui/CrystalViewer3D.js.map +1 -0
  125. package/lib/crystal3d/ui/crystalScene.d.ts +97 -0
  126. package/lib/crystal3d/ui/crystalScene.d.ts.map +1 -0
  127. package/lib/crystal3d/ui/crystalScene.js +10 -0
  128. package/lib/crystal3d/ui/crystalScene.js.map +1 -0
  129. package/lib/crystal3d/ui/crystalStructureViewerProps.d.ts +52 -0
  130. package/lib/crystal3d/ui/crystalStructureViewerProps.d.ts.map +1 -0
  131. package/lib/crystal3d/ui/crystalStructureViewerProps.js +2 -0
  132. package/lib/crystal3d/ui/crystalStructureViewerProps.js.map +1 -0
  133. package/lib/crystal3d/ui/index.d.ts +16 -0
  134. package/lib/crystal3d/ui/index.d.ts.map +1 -0
  135. package/lib/crystal3d/ui/index.js +12 -0
  136. package/lib/crystal3d/ui/index.js.map +1 -0
  137. package/lib/crystal3d/ui/useCrystalCaption.d.ts +14 -0
  138. package/lib/crystal3d/ui/useCrystalCaption.d.ts.map +1 -0
  139. package/lib/crystal3d/ui/useCrystalCaption.js +32 -0
  140. package/lib/crystal3d/ui/useCrystalCaption.js.map +1 -0
  141. package/lib/crystal3d/viewer/animate.d.ts +49 -0
  142. package/lib/crystal3d/viewer/animate.d.ts.map +1 -0
  143. package/lib/crystal3d/viewer/animate.js +83 -0
  144. package/lib/crystal3d/viewer/animate.js.map +1 -0
  145. package/lib/crystal3d/viewer/camera.d.ts +44 -0
  146. package/lib/crystal3d/viewer/camera.d.ts.map +1 -0
  147. package/lib/crystal3d/viewer/camera.js +103 -0
  148. package/lib/crystal3d/viewer/camera.js.map +1 -0
  149. package/lib/crystal3d/viewer/index.d.ts +13 -0
  150. package/lib/crystal3d/viewer/index.d.ts.map +1 -0
  151. package/lib/crystal3d/viewer/index.js +8 -0
  152. package/lib/crystal3d/viewer/index.js.map +1 -0
  153. package/lib/crystal3d/viewer/layerRegistry.d.ts +24 -0
  154. package/lib/crystal3d/viewer/layerRegistry.d.ts.map +1 -0
  155. package/lib/crystal3d/viewer/layerRegistry.js +39 -0
  156. package/lib/crystal3d/viewer/layerRegistry.js.map +1 -0
  157. package/lib/crystal3d/viewer/meshPrimitives.d.ts +13 -0
  158. package/lib/crystal3d/viewer/meshPrimitives.d.ts.map +1 -0
  159. package/lib/crystal3d/viewer/meshPrimitives.js +76 -0
  160. package/lib/crystal3d/viewer/meshPrimitives.js.map +1 -0
  161. package/lib/crystal3d/viewer/plugin.d.ts +133 -0
  162. package/lib/crystal3d/viewer/plugin.d.ts.map +1 -0
  163. package/lib/crystal3d/viewer/plugin.js +181 -0
  164. package/lib/crystal3d/viewer/plugin.js.map +1 -0
  165. package/lib/crystal3d/viewer/renderCell.d.ts +43 -0
  166. package/lib/crystal3d/viewer/renderCell.d.ts.map +1 -0
  167. package/lib/crystal3d/viewer/renderCell.js +53 -0
  168. package/lib/crystal3d/viewer/renderCell.js.map +1 -0
  169. package/lib/crystal3d/viewer/renderElements.d.ts +54 -0
  170. package/lib/crystal3d/viewer/renderElements.d.ts.map +1 -0
  171. package/lib/crystal3d/viewer/renderElements.js +77 -0
  172. package/lib/crystal3d/viewer/renderElements.js.map +1 -0
  173. package/lib/crystal3d/viewer/renderStructure.d.ts +80 -0
  174. package/lib/crystal3d/viewer/renderStructure.d.ts.map +1 -0
  175. package/lib/crystal3d/viewer/renderStructure.js +143 -0
  176. package/lib/crystal3d/viewer/renderStructure.js.map +1 -0
  177. package/lib/crystal3d/viewer/sceneParts.d.ts +32 -0
  178. package/lib/crystal3d/viewer/sceneParts.d.ts.map +1 -0
  179. package/lib/crystal3d/viewer/sceneParts.js +77 -0
  180. package/lib/crystal3d/viewer/sceneParts.js.map +1 -0
  181. package/lib/crystal3d/viewer/shapeLayer.d.ts +41 -0
  182. package/lib/crystal3d/viewer/shapeLayer.d.ts.map +1 -0
  183. package/lib/crystal3d/viewer/shapeLayer.js +57 -0
  184. package/lib/crystal3d/viewer/shapeLayer.js.map +1 -0
  185. package/lib/crystal3d/viewer/textLayer.d.ts +21 -0
  186. package/lib/crystal3d/viewer/textLayer.d.ts.map +1 -0
  187. package/lib/crystal3d/viewer/textLayer.js +59 -0
  188. package/lib/crystal3d/viewer/textLayer.js.map +1 -0
  189. package/lib/crystal3d/viewer/viewer.d.ts +119 -0
  190. package/lib/crystal3d/viewer/viewer.d.ts.map +1 -0
  191. package/lib/crystal3d/viewer/viewer.js +172 -0
  192. package/lib/crystal3d/viewer/viewer.js.map +1 -0
  193. package/lib/crystal3d.d.ts +12 -0
  194. package/lib/crystal3d.d.ts.map +1 -0
  195. package/lib/crystal3d.js +12 -0
  196. package/lib/crystal3d.js.map +1 -0
  197. package/lib/download/core/croppedMarkup.d.ts.map +1 -1
  198. package/lib/download/core/croppedMarkup.js +16 -40
  199. package/lib/download/core/croppedMarkup.js.map +1 -1
  200. package/lib/download/core/dataUrl.d.ts +27 -0
  201. package/lib/download/core/dataUrl.d.ts.map +1 -0
  202. package/lib/download/core/dataUrl.js +54 -0
  203. package/lib/download/core/dataUrl.js.map +1 -0
  204. package/lib/download/core/index.d.ts +3 -0
  205. package/lib/download/core/index.d.ts.map +1 -1
  206. package/lib/download/core/index.js +2 -0
  207. package/lib/download/core/index.js.map +1 -1
  208. package/lib/download/core/svgMarkup.d.ts +39 -0
  209. package/lib/download/core/svgMarkup.d.ts.map +1 -0
  210. package/lib/download/core/svgMarkup.js +100 -0
  211. package/lib/download/core/svgMarkup.js.map +1 -0
  212. package/lib/drawing/ui/movingFigure.d.ts.map +1 -1
  213. package/lib/drawing/ui/movingFigure.js +4 -30
  214. package/lib/drawing/ui/movingFigure.js.map +1 -1
  215. package/lib/i18n/core/chromeCatalog.d.ts +1 -1
  216. package/lib/i18n/core/chromeCatalog.d.ts.map +1 -1
  217. package/lib/locales/de.json +26 -1
  218. package/lib/locales/en.json +26 -1
  219. package/lib/locales/es.json +26 -1
  220. package/lib/locales/fr.json +26 -1
  221. package/lib/locales/it.json +26 -1
  222. package/lib/molecule3d/ui/MoleculeCanvas3D.d.ts.map +1 -1
  223. package/lib/molecule3d/ui/MoleculeCanvas3D.js +16 -27
  224. package/lib/molecule3d/ui/MoleculeCanvas3D.js.map +1 -1
  225. package/lib/molstar/bonds/bondRule.d.ts +16 -0
  226. package/lib/molstar/bonds/bondRule.d.ts.map +1 -0
  227. package/lib/molstar/bonds/bondRule.js +23 -0
  228. package/lib/molstar/bonds/bondRule.js.map +1 -0
  229. package/lib/molstar/bonds/index.d.ts +9 -0
  230. package/lib/molstar/bonds/index.d.ts.map +1 -0
  231. package/lib/molstar/bonds/index.js +9 -0
  232. package/lib/molstar/bonds/index.js.map +1 -0
  233. package/lib/molstar/ui/MolstarToolbar.d.ts +47 -0
  234. package/lib/molstar/ui/MolstarToolbar.d.ts.map +1 -0
  235. package/lib/molstar/ui/MolstarToolbar.js +28 -0
  236. package/lib/molstar/ui/MolstarToolbar.js.map +1 -0
  237. package/lib/molstar/ui/index.d.ts +10 -0
  238. package/lib/molstar/ui/index.d.ts.map +1 -0
  239. package/lib/molstar/ui/index.js +8 -0
  240. package/lib/molstar/ui/index.js.map +1 -0
  241. package/lib/molstar/ui/useMolstarTools.d.ts +63 -0
  242. package/lib/molstar/ui/useMolstarTools.d.ts.map +1 -0
  243. package/lib/molstar/ui/useMolstarTools.js +36 -0
  244. package/lib/molstar/ui/useMolstarTools.js.map +1 -0
  245. package/package.json +2 -1
  246. package/src/crystal/core/cellAtoms.ts +106 -0
  247. package/src/crystal/core/index.ts +2 -0
  248. package/src/crystal/core/molecules.ts +7 -44
  249. package/src/crystal3d/core/cellClip.ts +229 -0
  250. package/src/crystal3d/core/cellGeometry.ts +193 -0
  251. package/src/crystal3d/core/cellStack.ts +87 -0
  252. package/src/crystal3d/core/crystalView.ts +131 -0
  253. package/src/crystal3d/core/drawingSet.ts +71 -0
  254. package/src/crystal3d/core/elementDrawing.ts +147 -0
  255. package/src/crystal3d/core/elementExtent.ts +81 -0
  256. package/src/crystal3d/core/elementLabels.ts +130 -0
  257. package/src/crystal3d/core/elementShapes.ts +141 -0
  258. package/src/crystal3d/core/frame.ts +56 -0
  259. package/src/crystal3d/core/framing.ts +101 -0
  260. package/src/crystal3d/core/index.ts +134 -0
  261. package/src/crystal3d/core/labelText.ts +44 -0
  262. package/src/crystal3d/core/latticeBasis.ts +110 -0
  263. package/src/crystal3d/core/mat3.ts +163 -0
  264. package/src/crystal3d/core/operationMatrix.ts +255 -0
  265. package/src/crystal3d/core/orientation.ts +229 -0
  266. package/src/crystal3d/core/palette.ts +43 -0
  267. package/src/crystal3d/core/primitives.ts +183 -0
  268. package/src/crystal3d/core/structureText.ts +43 -0
  269. package/src/crystal3d/core/supercell.ts +40 -0
  270. package/src/crystal3d/core/types.ts +186 -0
  271. package/src/crystal3d/core/vec3.ts +127 -0
  272. package/src/crystal3d/ui/CrystalCanvas3D.tsx +393 -0
  273. package/src/crystal3d/ui/CrystalStructureView.tsx +153 -0
  274. package/src/crystal3d/ui/CrystalStructureViewer.tsx +39 -0
  275. package/src/crystal3d/ui/CrystalViewControls.tsx +129 -0
  276. package/src/crystal3d/ui/CrystalViewer3D.tsx +183 -0
  277. package/src/crystal3d/ui/crystalScene.ts +106 -0
  278. package/src/crystal3d/ui/crystalStructureViewerProps.ts +54 -0
  279. package/src/crystal3d/ui/index.ts +20 -0
  280. package/src/crystal3d/ui/useCrystalCaption.ts +38 -0
  281. package/src/crystal3d/viewer/animate.ts +113 -0
  282. package/src/crystal3d/viewer/camera.ts +139 -0
  283. package/src/crystal3d/viewer/index.ts +13 -0
  284. package/src/crystal3d/viewer/layerRegistry.ts +47 -0
  285. package/src/crystal3d/viewer/meshPrimitives.ts +102 -0
  286. package/src/crystal3d/viewer/plugin.ts +258 -0
  287. package/src/crystal3d/viewer/renderCell.ts +98 -0
  288. package/src/crystal3d/viewer/renderElements.ts +121 -0
  289. package/src/crystal3d/viewer/renderStructure.ts +209 -0
  290. package/src/crystal3d/viewer/sceneParts.ts +119 -0
  291. package/src/crystal3d/viewer/shapeLayer.ts +108 -0
  292. package/src/crystal3d/viewer/textLayer.ts +85 -0
  293. package/src/crystal3d/viewer/viewer.ts +223 -0
  294. package/src/crystal3d.ts +12 -0
  295. package/src/download/core/croppedMarkup.ts +16 -42
  296. package/src/download/core/dataUrl.ts +59 -0
  297. package/src/download/core/index.ts +3 -0
  298. package/src/download/core/svgMarkup.ts +113 -0
  299. package/src/drawing/ui/movingFigure.ts +4 -28
  300. package/src/locales/de.json +26 -1
  301. package/src/locales/en.json +26 -1
  302. package/src/locales/es.json +26 -1
  303. package/src/locales/fr.json +26 -1
  304. package/src/locales/it.json +26 -1
  305. package/src/molecule3d/ui/MoleculeCanvas3D.tsx +45 -71
  306. package/src/molstar/bonds/bondRule.ts +34 -0
  307. package/src/molstar/bonds/index.ts +9 -0
  308. package/src/molstar/ui/MolstarToolbar.tsx +103 -0
  309. package/src/molstar/ui/index.ts +14 -0
  310. package/src/molstar/ui/useMolstarTools.ts +98 -0
  311. package/styles/chrome.css +90 -0
@@ -0,0 +1,57 @@
1
+ /**
2
+ * A layer of shapes: one mesh with one group per item, so every item picks up
3
+ * its own colour and its own hover label while the whole layer is added and
4
+ * removed in one call.
5
+ */
6
+ import { MeshBuilder } from 'molstar/lib/mol-geo/geometry/mesh/mesh-builder.js';
7
+ import { Mesh } from 'molstar/lib/mol-geo/geometry/mesh/mesh.js';
8
+ import { Shape } from 'molstar/lib/mol-model/shape.js';
9
+ // Lowercased on import: it is a factory, not a constructor.
10
+ import { ShapeRepresentation as createShapeRepresentation } from 'molstar/lib/mol-repr/shape/representation.js';
11
+ import { Color } from 'molstar/lib/mol-util/color/color.js';
12
+ import { clearShapeLayer, storeLayer } from "./layerRegistry.js";
13
+ import { addMeshPrimitive } from "./meshPrimitives.js";
14
+ /**
15
+ * Replace a layer of shapes.
16
+ * @param plugin - The molstar context.
17
+ * @param key - Which layer; a second call with the same key replaces it.
18
+ * @param name - What the layer is called in a picking label.
19
+ * @param groups - The items; an empty list clears the layer.
20
+ * @param style - See {@link ShapeLayerStyle}.
21
+ * @throws {Error} When the canvas is not initialised yet.
22
+ */
23
+ export async function renderShapeLayer(plugin, key, name, groups, style = {}) {
24
+ const canvas3d = plugin.canvas3d;
25
+ if (canvas3d === undefined) {
26
+ throw new Error(`renderShapeLayer: the molstar canvas is not ready (${key}).`);
27
+ }
28
+ clearShapeLayer(plugin, key);
29
+ if (groups.length === 0)
30
+ return;
31
+ const state = MeshBuilder.createState(4096, 2048);
32
+ const colours = [];
33
+ const labels = [];
34
+ for (const group of groups) {
35
+ state.currentGroup = colours.length;
36
+ colours.push(Color.fromHexStyle(group.colour));
37
+ labels.push(group.label);
38
+ for (const primitive of group.primitives) {
39
+ addMeshPrimitive(state, primitive);
40
+ }
41
+ }
42
+ const mesh = MeshBuilder.getMesh(state);
43
+ Mesh.computeNormals(mesh);
44
+ const shape = Shape.create(name, {}, mesh, (group) => colours[group] ?? BLACK, () => 1, (group) => labels[group] ?? name);
45
+ const representation = createShapeRepresentation(() => shape, Mesh.Utils);
46
+ await plugin.runTask(representation.createOrUpdate({
47
+ alpha: style.alpha ?? 1,
48
+ doubleSided: true,
49
+ ignoreLight: style.ignoreLight ?? false,
50
+ }, shape));
51
+ storeLayer(plugin, key, representation);
52
+ canvas3d.add(representation);
53
+ // add() only queues; nothing appears until the queue is committed.
54
+ canvas3d.commit();
55
+ }
56
+ const BLACK = Color.fromHexStyle('#000000'); // tokens-ok: the fallback ink of a picking label.
57
+ //# sourceMappingURL=shapeLayer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shapeLayer.js","sourceRoot":"","sources":["../../../src/crystal3d/viewer/shapeLayer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mDAAmD,CAAC;AAChF,OAAO,EAAE,IAAI,EAAE,MAAM,2CAA2C,CAAC;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAEvD,4DAA4D;AAC5D,OAAO,EAAE,mBAAmB,IAAI,yBAAyB,EAAE,MAAM,8CAA8C,CAAC;AAChH,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAI5D,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AA2BvD;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,MAA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AI,IAAI,CACzC,CAAC;IACF,MAAM,cAAc,GAAG,yBAAyB,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1E,MAAM,MAAM,CAAC,OAAO,CAClB,cAAc,CAAC,cAAc,CAC3B;QACE,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,CAAC;QACvB,WAAW,EAAE,IAAI;QACjB,WAAW,EAAE,KAAK,CAAC,WAAW,IAAI,KAAK;KACxC,EACD,KAAK,CACN,CACF,CAAC;IACF,UAAU,CAAC,MAAM,EAAE,GAAG,EAAE,cAAc,CAAC,CAAC;IACxC,QAAQ,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAC7B,mEAAmE;IACnE,QAAQ,CAAC,MAAM,EAAE,CAAC;AACpB,CAAC;AAED,MAAM,KAAK,GAAG,KAAK,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,kDAAkD"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * A layer of text floating in the scene: an element's name, a cell's a, b and c.
3
+ *
4
+ * The text is written on a pale card rather than straight onto the scene: a
5
+ * name over a dark atom, or over three translucent planes, is otherwise read
6
+ * as part of them.
7
+ */
8
+ import type { PluginContext } from 'molstar/lib/mol-plugin/context.js';
9
+ import type { TextItem } from '../core/primitives.ts';
10
+ /**
11
+ * Replace a layer of floating text.
12
+ * @param plugin - The molstar context.
13
+ * @param key - Which layer; a second call with the same key replaces it.
14
+ * @param name - What the layer is called in a picking label.
15
+ * @param items - The lines; an empty list clears the layer.
16
+ * @param colour - What a line with no colour of its own is written in,
17
+ * `#rrggbb`.
18
+ * @throws {Error} When the canvas is not initialised yet.
19
+ */
20
+ export declare function renderTextLayer(plugin: PluginContext, key: string, name: string, items: readonly TextItem[], colour: string): Promise<void>;
21
+ //# sourceMappingURL=textLayer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textLayer.d.ts","sourceRoot":"","sources":["../../../src/crystal3d/viewer/textLayer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAMvE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAItD;;;;;;;;;GASG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,aAAa,EACrB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,SAAS,QAAQ,EAAE,EAC1B,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,CA+Cf"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * A layer of text floating in the scene: an element's name, a cell's a, b and c.
3
+ *
4
+ * The text is written on a pale card rather than straight onto the scene: a
5
+ * name over a dark atom, or over three translucent planes, is otherwise read
6
+ * as part of them.
7
+ */
8
+ import { TextBuilder } from 'molstar/lib/mol-geo/geometry/text/text-builder.js';
9
+ import { Text } from 'molstar/lib/mol-geo/geometry/text/text.js';
10
+ import { Shape } from 'molstar/lib/mol-model/shape.js';
11
+ // Lowercased on import: it is a factory, not a constructor.
12
+ import { ShapeRepresentation as createShapeRepresentation } from 'molstar/lib/mol-repr/shape/representation.js';
13
+ import { Color } from 'molstar/lib/mol-util/color/color.js';
14
+ import { LABEL_CARD_COLOUR } from "../core/palette.js";
15
+ import { clearShapeLayer, storeLayer } from "./layerRegistry.js";
16
+ /**
17
+ * Replace a layer of floating text.
18
+ * @param plugin - The molstar context.
19
+ * @param key - Which layer; a second call with the same key replaces it.
20
+ * @param name - What the layer is called in a picking label.
21
+ * @param items - The lines; an empty list clears the layer.
22
+ * @param colour - What a line with no colour of its own is written in,
23
+ * `#rrggbb`.
24
+ * @throws {Error} When the canvas is not initialised yet.
25
+ */
26
+ export async function renderTextLayer(plugin, key, name, items, colour) {
27
+ const canvas3d = plugin.canvas3d;
28
+ if (canvas3d === undefined) {
29
+ throw new Error(`renderTextLayer: the molstar canvas is not ready (${key}).`);
30
+ }
31
+ clearShapeLayer(plugin, key);
32
+ if (items.length === 0)
33
+ return;
34
+ const builder = TextBuilder.create({}, items.length * 4, items.length * 4);
35
+ const fallback = Color.fromHexStyle(colour);
36
+ const inks = [];
37
+ for (let index = 0; index < items.length; index++) {
38
+ const item = items[index];
39
+ if (item === undefined)
40
+ continue;
41
+ const [x, y, z] = item.position;
42
+ builder.add(item.text, x, y, z, item.size, item.size, index);
43
+ inks.push(item.colour === undefined ? fallback : Color.fromHexStyle(item.colour));
44
+ }
45
+ const shape = Shape.create(name, {}, builder.getText(), (group) => inks[group] ?? fallback, () => 1, (group) => items[group]?.text ?? name);
46
+ const representation = createShapeRepresentation(() => shape, Text.Utils);
47
+ await plugin.runTask(representation.createOrUpdate({
48
+ attachment: 'middle-center',
49
+ background: true,
50
+ backgroundMargin: 0.25,
51
+ backgroundColor: Color.fromHexStyle(LABEL_CARD_COLOUR),
52
+ backgroundOpacity: 0.85,
53
+ fontWeight: 'bold',
54
+ }, shape));
55
+ storeLayer(plugin, key, representation);
56
+ canvas3d.add(representation);
57
+ canvas3d.commit();
58
+ }
59
+ //# sourceMappingURL=textLayer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textLayer.js","sourceRoot":"","sources":["../../../src/crystal3d/viewer/textLayer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mDAAmD,CAAC;AAChF,OAAO,EAAE,IAAI,EAAE,MAAM,2CAA2C,CAAC;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAEvD,4DAA4D;AAC5D,OAAO,EAAE,mBAAmB,IAAI,yBAAyB,EAAE,MAAM,8CAA8C,CAAC;AAChH,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAE5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGvD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AA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,CAAC;IACJ,CAAC;IACD,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CACxB,IAAI,EACJ,EAAE,EACF,OAAO,CAAC,OAAO,EAAE,EACjB,CAAC,KAAa,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,QAAQ,EAC1C,GAAG,EAAE,CAAC,CAAC,EACP,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,IAAI,IAAI,IAAI,CAC9C,CAAC;IACF,MAAM,cAAc,GAAG,yBAAyB,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1E,MAAM,MAAM,CAAC,OAAO,CAClB,cAAc,CAAC,cAAc,CAC3B;QACE,UAAU,EAAE,eAAe;QAC3B,UAAU,EAAE,IAAI;QAChB,gBAAgB,EAAE,IAAI;QACtB,eAAe,EAAE,KAAK,CAAC,YAAY,CAAC,iBAAiB,CAAC;QACtD,iBAAiB,EAAE,IAAI;QACvB,UAAU,EAAE,MAAM;KACnB,EACD,KAAK,CACN,CACF,CAAC;IACF,UAAU,CAAC,MAAM,EAAE,GAAG,EAAE,cAAc,CAAC,CAAC;IACxC,QAAQ,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,CAAC;AACpB,CAAC"}
@@ -0,0 +1,119 @@
1
+ /**
2
+ * The viewer a crystal page drives: a structure, a cell, a set of symmetry
3
+ * elements, and an operation applied to the first of them.
4
+ *
5
+ * Nothing here parses a space group or expands an orbit. The atoms arrive in
6
+ * their final places, because molstar's own expansion neither wraps into the
7
+ * cell nor deduplicates a special position, and falls back to `P 1` without a
8
+ * word on several common settings.
9
+ */
10
+ import type { CrystalBonds } from '../core/crystalView.ts';
11
+ import type { CellRepeat, SymmetryDrawing, UnitCell, ViewerAtom, ViewerOperation } from '../core/types.ts';
12
+ import type { PlayOptions } from './animate.ts';
13
+ import type { CrystalViewerOptions } from './plugin.ts';
14
+ import { CrystalViewerPlugin } from './plugin.ts';
15
+ import type { CellStyle } from './renderCell.ts';
16
+ import type { ElementLayerStyle } from './renderElements.ts';
17
+ import type { StructureStyle } from './renderStructure.ts';
18
+ /**
19
+ * Create a crystal viewer inside `container` and start initialising it.
20
+ * @param container - An element with `position: relative`; molstar inserts its
21
+ * own canvas into it.
22
+ * @param options - See {@link CrystalViewerOptions}.
23
+ * @returns A handle that is safe to dispose immediately.
24
+ */
25
+ export declare function createCrystalViewer(container: HTMLElement, options?: CrystalViewerOptions): CrystalViewer;
26
+ /**
27
+ * Everything a crystal page draws, on one canvas: the lifecycle, the camera,
28
+ * the measurements and the hover readout come from {@link CrystalViewerPlugin},
29
+ * the scene is here.
30
+ */
31
+ export declare class CrystalViewer extends CrystalViewerPlugin {
32
+ #private;
33
+ /**
34
+ * The symmetry elements drawn right now, in drawing order.
35
+ * @returns The drawings on screen.
36
+ */
37
+ get elements(): readonly SymmetryDrawing[];
38
+ /**
39
+ * Replace the atoms on screen.
40
+ * @param atoms - The whole scene, expanded and repeated already, in Cartesian
41
+ * ångström. An empty list clears them.
42
+ * @param style - See {@link StructureStyle}; its bonds are the ones last
43
+ * set by {@link CrystalViewer.setBonds}.
44
+ * @returns Resolves once the atoms are drawn.
45
+ */
46
+ showStructure(atoms: readonly ViewerAtom[], style?: Omit<StructureStyle, 'bonds'>): Promise<void>;
47
+ /**
48
+ * Draw other bonds, on the atoms on screen and on every later structure. The
49
+ * atoms are not drawn again, so the camera stays where it is.
50
+ * @param bonds - Which bonds are drawn.
51
+ * @returns Resolves once they are drawn.
52
+ */
53
+ setBonds(bonds: CrystalBonds): Promise<void>;
54
+ /**
55
+ * Remove the atoms, leaving the cell and the elements in place.
56
+ * @returns Resolves once the atoms are gone.
57
+ */
58
+ hideStructure(): Promise<void>;
59
+ /**
60
+ * Replace the unit cell box, and the stack of cells around it.
61
+ * @param cell - The six cell parameters, or `null` to draw none.
62
+ * @param repeat - Cells along a, b and c.
63
+ * @param style - See {@link CellStyle}.
64
+ * @returns Resolves once the cell is drawn.
65
+ */
66
+ showCell(cell: UnitCell | null, repeat?: CellRepeat, style?: CellStyle): Promise<void>;
67
+ /**
68
+ * Remove the cell.
69
+ * @returns Resolves once the cell is gone.
70
+ */
71
+ hideCell(): Promise<void>;
72
+ /**
73
+ * Replace every drawn symmetry element.
74
+ * @param drawings - The elements; an empty list clears them.
75
+ * @param style - See {@link ElementLayerStyle}; kept for later edits.
76
+ * @returns Resolves once the elements are drawn.
77
+ */
78
+ showElements(drawings: readonly SymmetryDrawing[], style?: ElementLayerStyle): Promise<void>;
79
+ /**
80
+ * Draw these elements as well, replacing any already drawn under the same id.
81
+ * @param drawings - What to add.
82
+ * @returns Resolves once the elements are drawn.
83
+ */
84
+ addElements(drawings: readonly SymmetryDrawing[]): Promise<void>;
85
+ /**
86
+ * Stop drawing these elements, leaving the rest alone.
87
+ * @param ids - The ids to remove; an id that is not drawn is ignored.
88
+ * @returns Resolves once the rest are redrawn.
89
+ */
90
+ removeElements(ids: readonly string[]): Promise<void>;
91
+ /**
92
+ * Remove every symmetry element.
93
+ * @returns Resolves once they are gone.
94
+ */
95
+ hideElements(): Promise<void>;
96
+ /**
97
+ * Apply an operation to the structure, once, and leave it where it lands.
98
+ *
99
+ * The elements stay where they are: an axis that turned with the molecule
100
+ * would prove nothing.
101
+ * @param operation - What to apply.
102
+ * @param options - See {@link PlayOptions}.
103
+ * @returns Resolves once the operation has been applied in full.
104
+ */
105
+ playOperation(operation: ViewerOperation, options?: PlayOptions): Promise<void>;
106
+ /**
107
+ * Hold the structure part-way through an operation, for a slider.
108
+ * @param operation - What is being applied.
109
+ * @param fraction - How far through, 0 to 1.
110
+ * @returns Resolves once the structure is held there.
111
+ */
112
+ setOperationFraction(operation: ViewerOperation, fraction: number): Promise<void>;
113
+ /**
114
+ * Put the structure back where it started.
115
+ * @returns Resolves once the structure is back.
116
+ */
117
+ resetOperation(): Promise<void>;
118
+ }
119
+ //# sourceMapp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,GAAE,UAAsB,EAC9B,KAAK,CAAC,EAAE,SAAS,GAChB,OAAO,CAAC,IAAI,CAAC;IAIhB;;;OAGG;IACH,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAIzB;;;;;OAKG;IACH,YAAY,CACV,QAAQ,EAAE,SAAS,eAAe,EAAE,EACpC,KAAK,CAAC,EAAE,iBAAiB,GACxB,OAAO,CAAC,IAAI,CAAC;IAMhB;;;;OAIG;IACH,WAAW,CAAC,QAAQ,EAAE,SAAS,eAAe,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAKhE;;;;OAIG;IACH,cAAc,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAKrD;;;OAGG;IACH,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAK7B;;;;;;;;OAQG;IACH,aAAa,CACX,SAAS,EAAE,eAAe,EAC1B,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,IAAI,CAAC;IAIhB;;;;;OAKG;IACH,oBAAoB,CAClB,SAAS,EAAE,eAAe,EAC1B,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC;IAMhB;;;OAGG;IACH,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;CAWhC"}
@@ -0,0 +1,172 @@
1
+ /**
2
+ * The viewer a crystal page drives: a structure, a cell, a set of symmetry
3
+ * elements, and an operation applied to the first of them.
4
+ *
5
+ * Nothing here parses a space group or expands an orbit. The atoms arrive in
6
+ * their final places, because molstar's own expansion neither wraps into the
7
+ * cell nor deduplicates a special position, and falls back to `P 1` without a
8
+ * word on several common settings.
9
+ */
10
+ import { clearMeasurements } from "../../molstar/core/index.js";
11
+ import { mergeDrawings, withoutDrawings } from "../core/drawingSet.js";
12
+ import { playOperation, resetOperation, setOperationFraction, } from "./animate.js";
13
+ import { CrystalViewerPlugin } from "./plugin.js";
14
+ import { setStructureBonds } from "./renderStructure.js";
15
+ import { drawCell, drawElements, drawStructure } from "./sceneParts.js";
16
+ /**
17
+ * Create a crystal viewer inside `container` and start initialising it.
18
+ * @param container - An element with `position: relative`; molstar inserts its
19
+ * own canvas into it.
20
+ * @param options - See {@link CrystalViewerOptions}.
21
+ * @returns A handle that is safe to dispose immediately.
22
+ */
23
+ export function createCrystalViewer(container, options = {}) {
24
+ return new CrystalViewer(container, options);
25
+ }
26
+ /**
27
+ * Everything a crystal page draws, on one canvas: the lifecycle, the camera,
28
+ * the measurements and the hover readout come from {@link CrystalViewerPlugin},
29
+ * the scene is here.
30
+ */
31
+ export class CrystalViewer extends CrystalViewerPlugin {
32
+ #drawings = [];
33
+ #elementStyle = {};
34
+ #bonds = 'all';
35
+ /**
36
+ * The symmetry elements drawn right now, in drawing order.
37
+ * @returns The drawings on screen.
38
+ */
39
+ get elements() {
40
+ return this.#drawings;
41
+ }
42
+ /**
43
+ * Replace the atoms on screen.
44
+ * @param atoms - The whole scene, expanded and repeated already, in Cartesian
45
+ * ångström. An empty list clears them.
46
+ * @param style - See {@link StructureStyle}; its bonds are the ones last
47
+ * set by {@link CrystalViewer.setBonds}.
48
+ * @returns Resolves once the atoms are drawn.
49
+ */
50
+ showStructure(atoms, style) {
51
+ // A measurement names atoms of the structure it was taken on.
52
+ return this.run(async (plugin) => {
53
+ await clearMeasurements(plugin);
54
+ await drawStructure(plugin, atoms, { ...style, bonds: this.#bonds });
55
+ });
56
+ }
57
+ /**
58
+ * Draw other bonds, on the atoms on screen and on every later structure. The
59
+ * atoms are not drawn again, so the camera stays where it is.
60
+ * @param bonds - Which bonds are drawn.
61
+ * @returns Resolves once they are drawn.
62
+ */
63
+ setBonds(bonds) {
64
+ if (bonds === this.#bonds)
65
+ return Promise.resolve();
66
+ this.#bonds = bonds;
67
+ return this.run((plugin) => setStructureBonds(plugin, bonds));
68
+ }
69
+ /**
70
+ * Remove the atoms, leaving the cell and the elements in place.
71
+ * @returns Resolves once the atoms are gone.
72
+ */
73
+ hideStructure() {
74
+ return this.run(async (plugin) => {
75
+ await clearMeasurements(plugin);
76
+ await drawStructure(plugin, []);
77
+ });
78
+ }
79
+ /**
80
+ * Replace the unit cell box, and the stack of cells around it.
81
+ * @param cell - The six cell parameters, or `null` to draw none.
82
+ * @param repeat - Cells along a, b and c.
83
+ * @param style - See {@link CellStyle}.
84
+ * @returns Resolves once the cell is drawn.
85
+ */
86
+ showCell(cell, repeat = [1, 1, 1], style) {
87
+ return this.run((plugin) => drawCell(plugin, cell, repeat, style));
88
+ }
89
+ /**
90
+ * Remove the cell.
91
+ * @returns Resolves once the cell is gone.
92
+ */
93
+ hideCell() {
94
+ return this.run((plugin) => drawCell(plugin, null));
95
+ }
96
+ /**
97
+ * Replace every drawn symmetry element.
98
+ * @param drawings - The elements; an empty list clears them.
99
+ * @param style - See {@link ElementLayerStyle}; kept for later edits.
100
+ * @returns Resolves once the elements are drawn.
101
+ */
102
+ showElements(drawings, style) {
103
+ if (style !== undefined)
104
+ this.#elementStyle = style;
105
+ this.#drawings = [...drawings];
106
+ return this.#redrawElements();
107
+ }
108
+ /**
109
+ * Draw these elements as well, replacing any already drawn under the same id.
110
+ * @param drawings - What to add.
111
+ * @returns Resolves once the elements are drawn.
112
+ */
113
+ addElements(drawings) {
114
+ this.#drawings = mergeDrawings(this.#drawings, drawings);
115
+ return this.#redrawElements();
116
+ }
117
+ /**
118
+ * Stop drawing these elements, leaving the rest alone.
119
+ * @param ids - The ids to remove; an id that is not drawn is ignored.
120
+ * @returns Resolves once the rest are redrawn.
121
+ */
122
+ removeElements(ids) {
123
+ this.#drawings = withoutDrawings(this.#drawings, ids);
124
+ return this.#redrawElements();
125
+ }
126
+ /**
127
+ * Remove every symmetry element.
128
+ * @returns Resolves once they are gone.
129
+ */
130
+ hideElements() {
131
+ this.#drawings = [];
132
+ return this.#redrawElements();
133
+ }
134
+ /**
135
+ * Apply an operation to the structure, once, and leave it where it lands.
136
+ *
137
+ * The elements stay where they are: an axis that turned with the molecule
138
+ * would prove nothing.
139
+ * @param operation - What to apply.
140
+ * @param options - See {@link PlayOptions}.
141
+ * @returns Resolves once the operation has been applied in full.
142
+ */
143
+ playOperation(operation, options) {
144
+ return this.run((plugin) => playOperation(plugin, operation, options));
145
+ }
146
+ /**
147
+ * Hold the structure part-way through an operation, for a slider.
148
+ * @param operation - What is being applied.
149
+ * @param fraction - How far through, 0 to 1.
150
+ * @returns Resolves once the structure is held there.
151
+ */
152
+ setOperationFraction(operation, fraction) {
153
+ return this.run((plugin) => {
154
+ setOperationFraction(plugin, operation, fraction);
155
+ });
156
+ }
157
+ /**
158
+ * Put the structure back where it started.
159
+ * @returns Resolves once the structure is back.
160
+ */
161
+ resetOperation() {
162
+ return this.run((plugin) => {
163
+ resetOperation(plugin);
164
+ });
165
+ }
166
+ #redrawElements() {
167
+ const drawings = this.#drawings;
168
+ const style = this.#elementStyle;
169
+ return this.run((plugin) => drawElements(plugin, drawings, style));
170
+ }
171
+ }
172
+ //# sourceMappingURL=viewer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"viewer.js","sourceRoot":"","sources":["../../../src/crystal3d/viewer/viewer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAUvE,OAAO,EACL,aAAa,EACb,cAAc,EACd,oBAAoB,GACrB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAIlD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAExE;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CACjC,SAAsB,EACtB,UAAgC,EAAE;IAElC,OAAO,IAAI,aAAa,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AAC/C,C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C1B,QAAgB;QAEhB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YACzB,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,cAAc;QACZ,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YACzB,cAAc,CAAC,MAAM,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,eAAe;QACb,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC;QACjC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;IACrE,CAAC;CACF"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Crystals in 3D: the atoms of a cell, the box around it, the symmetry
3
+ * elements over it and an operation applied to it, drawn by molstar.
4
+ *
5
+ * An entry point of its own because molstar is several megabytes: the canvas
6
+ * sits behind `React.lazy`, so importing this costs a page the drawing
7
+ * geometry and the components, never the viewer. The geometry needs neither
8
+ * React nor molstar and is exported beside the components.
9
+ */
10
+ export * from './crystal3d/core/index.ts';
11
+ export * from './crystal3d/ui/index.ts';
12
+ //# sourceMappingURL=crystal3d.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crystal3d.d.ts","sourceRoot":"","sources":["../src/crystal3d.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Crystals in 3D: the atoms of a cell, the box around it, the symmetry
3
+ * elements over it and an operation applied to it, drawn by molstar.
4
+ *
5
+ * An entry point of its own because molstar is several megabytes: the canvas
6
+ * sits behind `React.lazy`, so importing this costs a page the drawing
7
+ * geometry and the components, never the viewer. The geometry needs neither
8
+ * React nor molstar and is exported beside the components.
9
+ */
10
+ export * from "./crystal3d/core/index.js";
11
+ export * from "./crystal3d/ui/index.js";
12
+ //# sourceMappingURL=crystal3d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crystal3d.js","sourceRoot":"","sources":["../src/crystal3d.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"croppedMarkup.d.ts","sourceRoot":"","sources":["../../../src/download/core/croppedMarkup.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAS7C,iDAAiD;AACjD,MAAM,WAAW,kBAAkB;IACjC,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,kBAAkB,GAAG,IAAI,CA2B5E;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAO/D;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,SAAS,EACjB,GAAG,EAAE,MAAM,GACV,SAAS,GAAG,IAAI,CAgClB;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,YAAY,GACjB,SAAS,CAoBX;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAG7C"}
1
+ {"version":3,"file":"croppedMarkup.d.ts","sourceRoot":"","sources":["../../../src/download/core/croppedMarkup.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAU7C,iDAAiD;AACjD,MAAM,WAAW,kBAAkB;IACjC,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,kBAAkB,GAAG,IAAI,CA2B5E;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAO/D;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,SAAS,EACjB,GAAG,EAAE,MAAM,GACV,SAAS,GAAG,IAAI,CAgClB;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,YAAY,GACjB,SAAS,CAoBX;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAG7C"}
@@ -3,6 +3,7 @@
3
3
  * of an SVG and the image it holds, and narrowing a drawing's view box to a
4
4
  * part of it.
5
5
  */
6
+ import { svgAttribute, svgRootTag, svgViewBox } from "./svgMarkup.js";
6
7
  /** An SVG whose only element is one image. */
7
8
  const ONLY_IMAGE = /^\s*<svg\b[^>]*>\s*(?<image><image\b[^>]*?)\/?>\s*(?:<\/image>\s*)?<\/svg>\s*$/i;
8
9
  /** The attributes that size the root of an SVG, which a crop rewrites. */
@@ -18,21 +19,21 @@ export function rasterFigureSource(markup) {
18
19
  if (image === undefined || /\s(?:x|y|transform)\s*=/.test(image)) {
19
20
  return null;
20
21
  }
21
- const root = rootTag(markup);
22
- const width = Number(attribute(image, 'width'));
23
- const height = Number(attribute(image, 'height'));
22
+ const root = svgRootTag(markup);
23
+ const width = Number(svgAttribute(image, 'width'));
24
+ const height = Number(svgAttribute(image, 'height'));
24
25
  if (!(width > 0 && height > 0))
25
26
  return null;
26
- const sameSize = Number(attribute(root, 'width')) === width &&
27
- Number(attribute(root, 'height')) === height;
28
- const view = attribute(root, 'viewBox');
27
+ const sameSize = Number(svgAttribute(root, 'width')) === width &&
28
+ Number(svgAttribute(root, 'height')) === height;
29
+ const view = svgAttribute(root, 'viewBox');
29
30
  const sameView = view === undefined ||
30
31
  view
31
32
  .trim()
32
33
  .split(/[\s,]+/)
33
34
  .map(Number)
34
35
  .join(' ') === `0 0 ${width} ${height}`;
35
- const source = (attribute(image, 'href') ?? attribute(image, 'xlink:href'))?.replaceAll('&amp;', '&');
36
+ const source = (svgAttribute(image, 'href') ?? svgAttribute(image, 'xlink:href'))?.replaceAll('&amp;', '&');
36
37
  if (!sameSize || !sameView || !source?.startsWith('data:image/')) {
37
38
  return null;
38
39
  }
@@ -46,10 +47,10 @@ export function rasterFigureSource(markup) {
46
47
  * @returns The figure, or `undefined` when the SVG states no size in pixels.
47
48
  */
48
49
  export function svgFigure(markup) {
49
- const root = rootTag(markup);
50
- const view = viewBoxOf(attribute(root, 'viewBox'));
51
- const width = pixels(attribute(root, 'width')) ?? view?.width;
52
- const height = pixels(attribute(root, 'height')) ?? view?.height;
50
+ const root = svgRootTag(markup);
51
+ const view = svgViewBox(svgAttribute(root, 'viewBox'));
52
+ const width = pixels(svgAttribute(root, 'width')) ?? view?.width;
53
+ const height = pixels(svgAttribute(root, 'height')) ?? view?.height;
53
54
  if (width === undefined || height === undefined)
54
55
  return undefined;
55
56
  return { markup, width: Math.ceil(width), height: Math.ceil(height) };
@@ -64,8 +65,8 @@ export function svgFigure(markup) {
64
65
  * simple part of the view box.
65
66
  */
66
67
  export function croppedSvgMarkup(figure, box) {
67
- const root = rootTag(figure.markup);
68
- const view = viewBoxOf(attribute(root, 'viewBox')) ?? {
68
+ const root = svgRootTag(figure.markup);
69
+ const view = svgViewBox(svgAttribute(root, 'viewBox')) ?? {
69
70
  x: 0,
70
71
  y: 0,
71
72
  width: figure.width,
@@ -102,8 +103,8 @@ export function croppedSvgMarkup(figure, box) {
102
103
  * @returns The resized figure.
103
104
  */
104
105
  export function resizedSvgFigure(figure, size) {
105
- const root = rootTag(figure.markup);
106
- const view = viewBoxOf(attribute(root, 'viewBox')) ?? {
106
+ const root = svgRootTag(figure.markup);
107
+ const view = svgViewBox(svgAttribute(root, 'viewBox')) ?? {
107
108
  x: 0,
108
109
  y: 0,
109
110
  width: figure.width,
@@ -128,31 +129,6 @@ export function rounded(value) {
128
129
  const result = Math.round(value * 100) / 100;
129
130
  return Object.is(result, -0) ? 0 : result;
130
131
  }
131
- function rootTag(markup) {
132
- return /<svg\b[^>]*>/i.exec(markup)?.[0] ?? '';
133
- }
134
- function attribute(tag, name) {
135
- const pattern = new RegExp(String.raw `\s${name}\s*=\s*(?:"(?<double>[^"]*)"|'(?<single>[^']*)')`);
136
- const groups = pattern.exec(tag)?.groups;
137
- return groups?.double ?? groups?.single;
138
- }
139
- function viewBoxOf(value) {
140
- if (value === undefined)
141
- return undefined;
142
- const parts = value
143
- .trim()
144
- .split(/[\s,]+/)
145
- .map(Number);
146
- const [x, y, width, height] = parts;
147
- if (parts.length !== 4 || x === undefined || y === undefined) {
148
- return undefined;
149
- }
150
- if (!Number.isFinite(x) || !Number.isFinite(y))
151
- return undefined;
152
- if (!width || !height || !(width > 0) || !(height > 0))
153
- return undefined;
154
- return { x, y, width, height };
155
- }
156
132
  function pixels(value) {
157
133
  const match = /^\s*(?<number>[\d.]+)\s*(?:px)?\s*$/.exec(value ?? '');
158
134
  const number = Number(match?.groups?.number);
@@ -1 +1 @@
1
- {"version":3,"file":"croppedMarkup.js","sourceRoot":"","sources":["../../../src/download/core/croppedMarkup.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,8CAA8C;AAC9C,MAAM,UAAU,GACd,iFAAiF,CAAC;AAEpF,0EAA0E;AAC1E,MAAM,eAAe,GAAG,uDAAuD,CAAC;AAYhF;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAc;IAC/C,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC;IACrD,IAAI,KAAK,KAAK,SAAS,IAAI,yBAAyB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACjE,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;IAChD,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;IAClD,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IAC5C,MAAM,QAAQ,GACZ,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,KAAK,KAAK;QAC1C,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,KAAK,MAAM,CAAC;IAC/C,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACxC,MAAM,QAAQ,GACZ,IAAI,KAAK,SAAS;QAClB,IAAI;aACD,IAAI,EAAE;aACN,KAAK,CAAC,QAAQ,CAAC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