react-cheminfo 0.75.0 → 0.77.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 (342) hide show
  1. package/README.md +141 -31
  2. package/lib/card/core/cardAddress.d.ts +19 -2
  3. package/lib/card/core/cardAddress.d.ts.map +1 -1
  4. package/lib/card/core/cardAddress.js +35 -2
  5. package/lib/card/core/cardAddress.js.map +1 -1
  6. package/lib/card/core/cardPageUrl.d.ts +7 -1
  7. package/lib/card/core/cardPageUrl.d.ts.map +1 -1
  8. package/lib/card/core/cardPageUrl.js +4 -2
  9. package/lib/card/core/cardPageUrl.js.map +1 -1
  10. package/lib/card/core/index.d.ts +1 -1
  11. package/lib/card/core/index.d.ts.map +1 -1
  12. package/lib/card/core/index.js +1 -1
  13. package/lib/card/core/index.js.map +1 -1
  14. package/lib/credits/core/credits.d.ts +30 -0
  15. package/lib/credits/core/credits.d.ts.map +1 -1
  16. package/lib/credits/core/credits.js +35 -0
  17. package/lib/credits/core/credits.js.map +1 -1
  18. package/lib/download/core/copySvg.d.ts +12 -0
  19. package/lib/download/core/copySvg.d.ts.map +1 -0
  20. package/lib/download/core/copySvg.js +38 -0
  21. package/lib/download/core/copySvg.js.map +1 -0
  22. package/lib/download/core/downloadFigure.d.ts +12 -1
  23. package/lib/download/core/downloadFigure.d.ts.map +1 -1
  24. package/lib/download/core/downloadFigure.js +21 -0
  25. package/lib/download/core/downloadFigure.js.map +1 -1
  26. package/lib/download/core/figureDpi.d.ts +59 -0
  27. package/lib/download/core/figureDpi.d.ts.map +1 -0
  28. package/lib/download/core/figureDpi.js +75 -0
  29. package/lib/download/core/figureDpi.js.map +1 -0
  30. package/lib/download/core/figurePng.d.ts +4 -1
  31. package/lib/download/core/figurePng.d.ts.map +1 -1
  32. package/lib/download/core/figurePng.js +11 -2
  33. package/lib/download/core/figurePng.js.map +1 -1
  34. package/lib/download/core/index.d.ts +5 -1
  35. package/lib/download/core/index.d.ts.map +1 -1
  36. package/lib/download/core/index.js +4 -1
  37. package/lib/download/core/index.js.map +1 -1
  38. package/lib/download/core/pngDpi.d.ts +22 -0
  39. package/lib/download/core/pngDpi.d.ts.map +1 -0
  40. package/lib/download/core/pngDpi.js +79 -0
  41. package/lib/download/core/pngDpi.js.map +1 -0
  42. package/lib/download/ui/FigureDownloadPanel.d.ts +13 -0
  43. package/lib/download/ui/FigureDownloadPanel.d.ts.map +1 -1
  44. package/lib/download/ui/FigureDownloadPanel.js +18 -34
  45. package/lib/download/ui/FigureDownloadPanel.js.map +1 -1
  46. package/lib/download/ui/figureDownloadHint.d.ts +5 -0
  47. package/lib/download/ui/figureDownloadHint.d.ts.map +1 -1
  48. package/lib/download/ui/figureDownloadHint.js +8 -0
  49. package/lib/download/ui/figureDownloadHint.js.map +1 -1
  50. package/lib/download/ui/figureDownloadOptions.d.ts +84 -0
  51. package/lib/download/ui/figureDownloadOptions.d.ts.map +1 -0
  52. package/lib/download/ui/figureDownloadOptions.js +2 -0
  53. package/lib/download/ui/figureDownloadOptions.js.map +1 -0
  54. package/lib/download/ui/resolutionChoices.d.ts +27 -0
  55. package/lib/download/ui/resolutionChoices.d.ts.map +1 -0
  56. package/lib/download/ui/resolutionChoices.js +48 -0
  57. package/lib/download/ui/resolutionChoices.js.map +1 -0
  58. package/lib/download/ui/useFigureActions.d.ts +4 -1
  59. package/lib/download/ui/useFigureActions.d.ts.map +1 -1
  60. package/lib/download/ui/useFigureActions.js +17 -8
  61. package/lib/download/ui/useFigureActions.js.map +1 -1
  62. package/lib/download/ui/useFigureDownload.d.ts +2 -55
  63. package/lib/download/ui/useFigureDownload.d.ts.map +1 -1
  64. package/lib/download/ui/useFigureDownload.js +45 -13
  65. package/lib/download/ui/useFigureDownload.js.map +1 -1
  66. package/lib/ecosystem/core/sites.d.ts.map +1 -1
  67. package/lib/ecosystem/core/sites.js +14 -0
  68. package/lib/ecosystem/core/sites.js.map +1 -1
  69. package/lib/ecosystem/core/types.d.ts +1 -1
  70. package/lib/ecosystem/core/types.d.ts.map +1 -1
  71. package/lib/ecosystem/ui/glyphs.d.ts.map +1 -1
  72. package/lib/ecosystem/ui/glyphs.js +3 -0
  73. package/lib/ecosystem/ui/glyphs.js.map +1 -1
  74. package/lib/i18n/core/chromeCatalog.d.ts +1 -1
  75. package/lib/i18n/core/chromeCatalog.d.ts.map +1 -1
  76. package/lib/ir/core/bandAssignments.d.ts.map +1 -1
  77. package/lib/ir/core/bandAssignments.js +27 -0
  78. package/lib/ir/core/bandAssignments.js.map +1 -1
  79. package/lib/ir/ui/BandRow.d.ts +4 -4
  80. package/lib/ir/ui/BandRow.d.ts.map +1 -1
  81. package/lib/ir/ui/BandRow.js +41 -14
  82. package/lib/ir/ui/BandRow.js.map +1 -1
  83. package/lib/locales/de.json +32 -1
  84. package/lib/locales/en.json +32 -1
  85. package/lib/locales/es.json +32 -1
  86. package/lib/locales/fr.json +32 -1
  87. package/lib/locales/it.json +32 -1
  88. package/lib/molecule3d/ui/Molecule3DStage.d.ts +4 -33
  89. package/lib/molecule3d/ui/Molecule3DStage.d.ts.map +1 -1
  90. package/lib/molecule3d/ui/Molecule3DStage.js +3 -37
  91. package/lib/molecule3d/ui/Molecule3DStage.js.map +1 -1
  92. package/lib/osiris/core/barGeometry.d.ts +42 -0
  93. package/lib/osiris/core/barGeometry.d.ts.map +1 -0
  94. package/lib/osiris/core/barGeometry.js +46 -0
  95. package/lib/osiris/core/barGeometry.js.map +1 -0
  96. package/lib/osiris/core/computeProperties.d.ts +42 -0
  97. package/lib/osiris/core/computeProperties.d.ts.map +1 -0
  98. package/lib/osiris/core/computeProperties.js +115 -0
  99. package/lib/osiris/core/computeProperties.js.map +1 -0
  100. package/lib/osiris/core/constants.d.ts +70 -0
  101. package/lib/osiris/core/constants.d.ts.map +1 -0
  102. package/lib/osiris/core/constants.js +99 -0
  103. package/lib/osiris/core/constants.js.map +1 -0
  104. package/lib/osiris/core/fitness.d.ts +32 -0
  105. package/lib/osiris/core/fitness.d.ts.map +1 -0
  106. package/lib/osiris/core/fitness.js +48 -0
  107. package/lib/osiris/core/fitness.js.map +1 -0
  108. package/lib/osiris/core/index.d.ts +29 -0
  109. package/lib/osiris/core/index.d.ts.map +1 -0
  110. package/lib/osiris/core/index.js +19 -0
  111. package/lib/osiris/core/index.js.map +1 -0
  112. package/lib/osiris/core/poolSize.d.ts +17 -0
  113. package/lib/osiris/core/poolSize.d.ts.map +1 -0
  114. package/lib/osiris/core/poolSize.js +22 -0
  115. package/lib/osiris/core/poolSize.js.map +1 -0
  116. package/lib/osiris/core/poolTypes.d.ts +140 -0
  117. package/lib/osiris/core/poolTypes.d.ts.map +1 -0
  118. package/lib/osiris/core/poolTypes.js +12 -0
  119. package/lib/osiris/core/poolTypes.js.map +1 -0
  120. package/lib/osiris/core/predictIdCode.d.ts +39 -0
  121. package/lib/osiris/core/predictIdCode.d.ts.map +1 -0
  122. package/lib/osiris/core/predictIdCode.js +54 -0
  123. package/lib/osiris/core/predictIdCode.js.map +1 -0
  124. package/lib/osiris/core/predictProtocol.d.ts +67 -0
  125. package/lib/osiris/core/predictProtocol.d.ts.map +1 -0
  126. package/lib/osiris/core/predictProtocol.js +29 -0
  127. package/lib/osiris/core/predictProtocol.js.map +1 -0
  128. package/lib/osiris/core/predictionPool.d.ts +23 -0
  129. package/lib/osiris/core/predictionPool.d.ts.map +1 -0
  130. package/lib/osiris/core/predictionPool.js +186 -0
  131. package/lib/osiris/core/predictionPool.js.map +1 -0
  132. package/lib/osiris/core/predictionQueue.d.ts +46 -0
  133. package/lib/osiris/core/predictionQueue.d.ts.map +1 -0
  134. package/lib/osiris/core/predictionQueue.js +57 -0
  135. package/lib/osiris/core/predictionQueue.js.map +1 -0
  136. package/lib/osiris/core/predictors.d.ts +62 -0
  137. package/lib/osiris/core/predictors.d.ts.map +1 -0
  138. package/lib/osiris/core/predictors.js +100 -0
  139. package/lib/osiris/core/predictors.js.map +1 -0
  140. package/lib/osiris/core/propertyKeys.d.ts +32 -0
  141. package/lib/osiris/core/propertyKeys.d.ts.map +1 -0
  142. package/lib/osiris/core/propertyKeys.js +44 -0
  143. package/lib/osiris/core/propertyKeys.js.map +1 -0
  144. package/lib/osiris/core/riskAppearance.d.ts +60 -0
  145. package/lib/osiris/core/riskAppearance.d.ts.map +1 -0
  146. package/lib/osiris/core/riskAppearance.js +59 -0
  147. package/lib/osiris/core/riskAppearance.js.map +1 -0
  148. package/lib/osiris/core/riskDetail.d.ts +22 -0
  149. package/lib/osiris/core/riskDetail.d.ts.map +1 -0
  150. package/lib/osiris/core/riskDetail.js +86 -0
  151. package/lib/osiris/core/riskDetail.js.map +1 -0
  152. package/lib/osiris/core/riskDetailRequest.d.ts +31 -0
  153. package/lib/osiris/core/riskDetailRequest.d.ts.map +1 -0
  154. package/lib/osiris/core/riskDetailRequest.js +49 -0
  155. package/lib/osiris/core/riskDetailRequest.js.map +1 -0
  156. package/lib/osiris/core/riskFindings.d.ts +26 -0
  157. package/lib/osiris/core/riskFindings.d.ts.map +1 -0
  158. package/lib/osiris/core/riskFindings.js +79 -0
  159. package/lib/osiris/core/riskFindings.js.map +1 -0
  160. package/lib/osiris/core/runPredictionJob.d.ts +20 -0
  161. package/lib/osiris/core/runPredictionJob.d.ts.map +1 -0
  162. package/lib/osiris/core/runPredictionJob.js +43 -0
  163. package/lib/osiris/core/runPredictionJob.js.map +1 -0
  164. package/lib/osiris/core/scales.d.ts +70 -0
  165. package/lib/osiris/core/scales.d.ts.map +1 -0
  166. package/lib/osiris/core/scales.js +185 -0
  167. package/lib/osiris/core/scales.js.map +1 -0
  168. package/lib/osiris/core/types.d.ts +91 -0
  169. package/lib/osiris/core/types.d.ts.map +1 -0
  170. package/lib/osiris/core/types.js +19 -0
  171. package/lib/osiris/core/types.js.map +1 -0
  172. package/lib/osiris/core/valuation.d.ts +28 -0
  173. package/lib/osiris/core/valuation.d.ts.map +1 -0
  174. package/lib/osiris/core/valuation.js +39 -0
  175. package/lib/osiris/core/valuation.js.map +1 -0
  176. package/lib/osiris/ui/PropertyBar.d.ts +27 -0
  177. package/lib/osiris/ui/PropertyBar.d.ts.map +1 -0
  178. package/lib/osiris/ui/PropertyBar.js +27 -0
  179. package/lib/osiris/ui/PropertyBar.js.map +1 -0
  180. package/lib/osiris/ui/PropertyPanel.d.ts +91 -0
  181. package/lib/osiris/ui/PropertyPanel.d.ts.map +1 -0
  182. package/lib/osiris/ui/PropertyPanel.js +77 -0
  183. package/lib/osiris/ui/PropertyPanel.js.map +1 -0
  184. package/lib/osiris/ui/PropertyRows.d.ts +40 -0
  185. package/lib/osiris/ui/PropertyRows.d.ts.map +1 -0
  186. package/lib/osiris/ui/PropertyRows.js +23 -0
  187. package/lib/osiris/ui/PropertyRows.js.map +1 -0
  188. package/lib/osiris/ui/RiskFindings.d.ts +43 -0
  189. package/lib/osiris/ui/RiskFindings.d.ts.map +1 -0
  190. package/lib/osiris/ui/RiskFindings.js +51 -0
  191. package/lib/osiris/ui/RiskFindings.js.map +1 -0
  192. package/lib/osiris/ui/RiskPanel.d.ts +46 -0
  193. package/lib/osiris/ui/RiskPanel.d.ts.map +1 -0
  194. package/lib/osiris/ui/RiskPanel.js +32 -0
  195. package/lib/osiris/ui/RiskPanel.js.map +1 -0
  196. package/lib/osiris/ui/RiskSquare.d.ts +51 -0
  197. package/lib/osiris/ui/RiskSquare.d.ts.map +1 -0
  198. package/lib/osiris/ui/RiskSquare.js +23 -0
  199. package/lib/osiris/ui/RiskSquare.js.map +1 -0
  200. package/lib/osiris/ui/index.d.ts +15 -0
  201. package/lib/osiris/ui/index.d.ts.map +1 -0
  202. package/lib/osiris/ui/index.js +8 -0
  203. package/lib/osiris/ui/index.js.map +1 -0
  204. package/lib/osiris/ui/usePredictions.d.ts +81 -0
  205. package/lib/osiris/ui/usePredictions.d.ts.map +1 -0
  206. package/lib/osiris/ui/usePredictions.js +102 -0
  207. package/lib/osiris/ui/usePredictions.js.map +1 -0
  208. package/lib/osiris-ui.d.ts +11 -0
  209. package/lib/osiris-ui.d.ts.map +1 -0
  210. package/lib/osiris-ui.js +11 -0
  211. package/lib/osiris-ui.js.map +1 -0
  212. package/lib/osiris.d.ts +17 -0
  213. package/lib/osiris.d.ts.map +1 -0
  214. package/lib/osiris.js +17 -0
  215. package/lib/osiris.js.map +1 -0
  216. package/lib/panel/ui/FilterInput.d.ts.map +1 -1
  217. package/lib/panel/ui/FilterInput.js +3 -1
  218. package/lib/panel/ui/FilterInput.js.map +1 -1
  219. package/lib/panel/ui/SidePanelItem.d.ts +39 -0
  220. package/lib/panel/ui/SidePanelItem.d.ts.map +1 -0
  221. package/lib/panel/ui/SidePanelItem.js +63 -0
  222. package/lib/panel/ui/SidePanelItem.js.map +1 -0
  223. package/lib/panel/ui/SidePanelStack.d.ts +11 -10
  224. package/lib/panel/ui/SidePanelStack.d.ts.map +1 -1
  225. package/lib/panel/ui/SidePanelStack.js +22 -15
  226. package/lib/panel/ui/SidePanelStack.js.map +1 -1
  227. package/lib/panel/ui/SpectrumColorSwatch.d.ts.map +1 -1
  228. package/lib/panel/ui/SpectrumColorSwatch.js +4 -2
  229. package/lib/panel/ui/SpectrumColorSwatch.js.map +1 -1
  230. package/lib/panel/ui/usePanelFolds.d.ts +35 -0
  231. package/lib/panel/ui/usePanelFolds.d.ts.map +1 -0
  232. package/lib/panel/ui/usePanelFolds.js +73 -0
  233. package/lib/panel/ui/usePanelFolds.js.map +1 -0
  234. package/lib/shared/ui/FullscreenStage.d.ts +43 -0
  235. package/lib/shared/ui/FullscreenStage.d.ts.map +1 -0
  236. package/lib/shared/ui/FullscreenStage.js +38 -0
  237. package/lib/shared/ui/FullscreenStage.js.map +1 -0
  238. package/lib/shared/ui/canFillScreen.d.ts +7 -0
  239. package/lib/shared/ui/canFillScreen.d.ts.map +1 -0
  240. package/lib/shared/ui/canFillScreen.js +9 -0
  241. package/lib/shared/ui/canFillScreen.js.map +1 -0
  242. package/lib/shared/ui/index.d.ts +3 -0
  243. package/lib/shared/ui/index.d.ts.map +1 -1
  244. package/lib/shared/ui/index.js +2 -0
  245. package/lib/shared/ui/index.js.map +1 -1
  246. package/lib/split/ui/splitPanes.d.ts +3 -3
  247. package/lib/split/ui/splitPanes.js +1 -1
  248. package/lib/structure/core/structureNotations.d.ts +8 -1
  249. package/lib/structure/core/structureNotations.d.ts.map +1 -1
  250. package/lib/structure/core/structureNotations.js +14 -8
  251. package/lib/structure/core/structureNotations.js.map +1 -1
  252. package/lib/structure/ui/CardStructure.d.ts +43 -0
  253. package/lib/structure/ui/CardStructure.d.ts.map +1 -0
  254. package/lib/structure/ui/CardStructure.js +28 -0
  255. package/lib/structure/ui/CardStructure.js.map +1 -0
  256. package/lib/structure/ui/StructureExportPanel.d.ts +8 -0
  257. package/lib/structure/ui/StructureExportPanel.d.ts.map +1 -1
  258. package/lib/structure/ui/StructureExportPanel.js +9 -4
  259. package/lib/structure/ui/StructureExportPanel.js.map +1 -1
  260. package/lib/structure/ui/StructurePicturePane.d.ts +1 -1
  261. package/lib/structure/ui/StructurePicturePane.d.ts.map +1 -1
  262. package/lib/structure/ui/StructurePicturePane.js +5 -2
  263. package/lib/structure/ui/StructurePicturePane.js.map +1 -1
  264. package/lib/structure/ui/index.d.ts +3 -0
  265. package/lib/structure/ui/index.d.ts.map +1 -1
  266. package/lib/structure/ui/index.js +1 -0
  267. package/lib/structure/ui/index.js.map +1 -1
  268. package/package.json +4 -1
  269. package/src/card/core/cardAddress.ts +39 -3
  270. package/src/card/core/cardPageUrl.ts +10 -3
  271. package/src/card/core/index.ts +7 -1
  272. package/src/credits/core/credits.ts +40 -0
  273. package/src/download/core/copySvg.ts +40 -0
  274. package/src/download/core/downloadFigure.ts +26 -1
  275. package/src/download/core/figureDpi.ts +94 -0
  276. package/src/download/core/figurePng.ts +11 -2
  277. package/src/download/core/index.ts +14 -1
  278. package/src/download/core/pngDpi.ts +84 -0
  279. package/src/download/ui/FigureDownloadPanel.tsx +41 -51
  280. package/src/download/ui/figureDownloadHint.ts +13 -0
  281. package/src/download/ui/figureDownloadOptions.ts +85 -0
  282. package/src/download/ui/resolutionChoices.ts +67 -0
  283. package/src/download/ui/useFigureActions.ts +24 -9
  284. package/src/download/ui/useFigureDownload.tsx +57 -71
  285. package/src/ecosystem/core/sites.ts +14 -0
  286. package/src/ecosystem/core/types.ts +2 -1
  287. package/src/ecosystem/ui/glyphs.tsx +20 -0
  288. package/src/ir/core/bandAssignments.ts +27 -0
  289. package/src/ir/ui/BandRow.tsx +84 -26
  290. package/src/locales/de.json +32 -1
  291. package/src/locales/en.json +32 -1
  292. package/src/locales/es.json +32 -1
  293. package/src/locales/fr.json +32 -1
  294. package/src/locales/it.json +32 -1
  295. package/src/molecule3d/ui/Molecule3DStage.tsx +4 -88
  296. package/src/osiris/core/barGeometry.ts +74 -0
  297. package/src/osiris/core/computeProperties.ts +175 -0
  298. package/src/osiris/core/constants.ts +110 -0
  299. package/src/osiris/core/fitness.ts +59 -0
  300. package/src/osiris/core/index.ts +78 -0
  301. package/src/osiris/core/poolSize.ts +24 -0
  302. package/src/osiris/core/poolTypes.ts +140 -0
  303. package/src/osiris/core/predictIdCode.ts +69 -0
  304. package/src/osiris/core/predictProtocol.ts +78 -0
  305. package/src/osiris/core/predictionPool.ts +237 -0
  306. package/src/osiris/core/predictionQueue.ts +89 -0
  307. package/src/osiris/core/predictors.ts +142 -0
  308. package/src/osiris/core/propertyKeys.ts +54 -0
  309. package/src/osiris/core/riskAppearance.ts +86 -0
  310. package/src/osiris/core/riskDetail.ts +120 -0
  311. package/src/osiris/core/riskDetailRequest.ts +64 -0
  312. package/src/osiris/core/riskFindings.ts +92 -0
  313. package/src/osiris/core/runPredictionJob.ts +49 -0
  314. package/src/osiris/core/scales.ts +236 -0
  315. package/src/osiris/core/types.ts +103 -0
  316. package/src/osiris/core/valuation.ts +44 -0
  317. package/src/osiris/ui/PropertyBar.tsx +77 -0
  318. package/src/osiris/ui/PropertyPanel.tsx +227 -0
  319. package/src/osiris/ui/PropertyRows.tsx +92 -0
  320. package/src/osiris/ui/RiskFindings.tsx +137 -0
  321. package/src/osiris/ui/RiskPanel.tsx +81 -0
  322. package/src/osiris/ui/RiskSquare.tsx +108 -0
  323. package/src/osiris/ui/index.ts +17 -0
  324. package/src/osiris/ui/usePredictions.ts +194 -0
  325. package/src/osiris-ui.ts +11 -0
  326. package/src/osiris.ts +17 -0
  327. package/src/panel/ui/FilterInput.tsx +4 -1
  328. package/src/panel/ui/SidePanelItem.tsx +162 -0
  329. package/src/panel/ui/SidePanelStack.tsx +29 -36
  330. package/src/panel/ui/SpectrumColorSwatch.tsx +5 -3
  331. package/src/panel/ui/usePanelFolds.ts +103 -0
  332. package/src/shared/ui/FullscreenStage.tsx +96 -0
  333. package/src/shared/ui/canFillScreen.ts +8 -0
  334. package/src/shared/ui/index.ts +6 -0
  335. package/src/split/ui/splitPanes.tsx +4 -4
  336. package/src/structure/core/structureNotations.ts +25 -8
  337. package/src/structure/ui/CardStructure.tsx +76 -0
  338. package/src/structure/ui/StructureExportPanel.tsx +23 -4
  339. package/src/structure/ui/StructurePicturePane.tsx +14 -1
  340. package/src/structure/ui/index.ts +6 -0
  341. package/styles/chrome.css +3 -3
  342. package/styles/osiris.css +339 -0
@@ -1 +1 @@
1
- {"version":3,"file":"StructurePicturePane.js","sourceRoot":"","sources":["../../../src/structure/ui/StructurePicturePane.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG7D,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EACL,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,kBAAkB,GACnB,MAAM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CACxB,YAAG,SAAS,EAAC,0BAA0B,EAAC,KAAK,EAAE,YAAY,YACxD,MAAM,GACL,CACL,IACG,CACP,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,YAAY,CAAC,IAAsB;IAK1C,MAAM,OAAO,GAAG,EAAE,CAAC;IACnB,KAAK,MAAM,KAAK,IAAI,aAAa,EAAE,CAAC;QAClC,OAAO,CAAC,IAAI,CAAC;YACX,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC;YAC9B,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC;YACpB,QAAQ,EAAE,CAAC,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC;SACxC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,GAAG;IACjB,GAAG,uBAAuB;IAC1B,KAAK,EAAE,KAAK,CAAC,SAAS;IACtB,QAAQ,EAAE,EAAE;IACZ,UAAU,EAAE,GAAG;CACiB,CAAC;AAEnC,MAAM,YAAY,GAAG;IACnB,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,KAAK,CAAC,SAAS;IACtB,QAAQ,EAAE,EAAE;IACZ,kBAAkB,EAAE,cAAc;CACF,CAAC;AAEnC,MAAM,YAAY,GAAG;IACnB,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,KAAK,CAAC,SAAS;IACtB,QAAQ,EAAE,EAAE;CACoB,CAAC"}
1
+ {"version":3,"file":"StructurePicturePane.js","sourceRoot":"","sources":["../../../src/structure/ui/StructurePicturePane.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG7D,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,EAAE,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AAK,EAAE,KAAK,CAAC,SAAS;IACtB,QAAQ,EAAE,EAAE;IACZ,kBAAkB,EAAE,cAAc;CACF,CAAC;AAEnC,MAAM,YAAY,GAAG;IACnB,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,KAAK,CAAC,SAAS;IACtB,QAAQ,EAAE,EAAE;CACoB,CAAC"}
@@ -27,7 +27,10 @@ export type { StructureExportDialogProps } from './StructureExportDialog.tsx';
27
27
  export { StructureExportDialog } from './StructureExportDialog.tsx';
28
28
  export type { StructureExportButtonProps } from './StructureExportButton.tsx';
29
29
  export { StructureExportButton } from './StructureExportButton.tsx';
30
+ export type { CardStructureProps } from './CardStructure.tsx';
31
+ export { CardStructure } from './CardStructure.tsx';
30
32
  export type { StructureExportPanelProps } from './StructureExportPanel.tsx';
33
+ export type { StructureNotationKind, SuppliedNotations, } from '../core/structureNotations.ts';
31
34
  export type { ToolbarFloorOptions } from './useToolbarFloor.ts';
32
35
  export { useToolbarFloor } from './useToolbarFloor.ts';
33
36
  export type { StructureDraft } from './useStructureDraft.ts';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/structure/ui/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,YAAY,EACV,qBAAqB,EACrB,mBAAmB,EACnB,6BAA6B,EAC7B,6BAA6B,GAC9B,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,YAAY,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,wBAAwB,EAAE,MAAM,2BAA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OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,YAAY,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,YAAY,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,YAAY,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,YAAY,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAC5E,YAAY,EACV,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,+BAA+B,CAAC;AACvC,YAAY,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
@@ -18,6 +18,7 @@ export { StructureSearchDialog } from "./StructureSearchDialog.js";
18
18
  export { useStructureSearchModes } from "./useStructureSearchModes.js";
19
19
  export { StructureExportDialog } from "./StructureExportDialog.js";
20
20
  export { StructureExportButton } from "./StructureExportButton.js";
21
+ export { CardStructure } from "./CardStructure.js";
21
22
  export { useToolbarFloor } from "./useToolbarFloor.js";
22
23
  export { useStructureDraft } from "./useStructureDraft.js";
23
24
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/structure/ui/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AASH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAiB,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAuB,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAqB,CAAC;AAEpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA2B,CAAC;AAEhE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA6B,CAAC;AAEpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA6B,CAAC;AAEpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA6B,CAAC;AAGpE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/structure/ui/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AASH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAiB,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAuB,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAqB,CAAC;AAEpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA2B,CAAC;AAEhE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA6B,CAAC;AAEpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA6B,CAAC;AAEpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA6B,CAAC;AAEpE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAqB,CAAC;AAOpD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-cheminfo",
3
- "version": "0.75.0",
3
+ "version": "0.77.0",
4
4
  "license": "MIT",
5
5
  "description": "React components, hooks and framework-free helpers shared by the cheminfo sites: site chrome, citations, sharing, routing, pedagogy, charts, and the structure, orbital and 3D molecule viewers",
6
6
  "author": "Luc Patiny",
@@ -27,6 +27,8 @@
27
27
  "./molecule3d": "./lib/molecule3d.js",
28
28
  "./molstar/*": "./lib/molstar/*/index.js",
29
29
  "./orbital": "./lib/orbital.js",
30
+ "./osiris": "./lib/osiris.js",
31
+ "./osiris-ui": "./lib/osiris-ui.js",
30
32
  "./pages": "./lib/pages.js",
31
33
  "./raman": "./lib/raman.js",
32
34
  "./server": "./lib/server.js",
@@ -78,6 +80,7 @@
78
80
  "cheminfo-font": "^1.28.0",
79
81
  "cheminfo-types": "^1.16.0",
80
82
  "convert-to-jcamp": "^7.0.1",
83
+ "crc-32": "^1.2.2",
81
84
  "intl-messageformat": "^11.2.15",
82
85
  "ir-spectrum": "^4.2.0",
83
86
  "jcampconverter": "^12.5.11",
@@ -18,6 +18,13 @@ import { EMBED_PARAM, HIDE_PARAM } from '../../share/core/config.ts';
18
18
  /** The parameter asking for the answer's card instead of the page. */
19
19
  export const CARD_PARAM = 'card';
20
20
 
21
+ /**
22
+ * The parameter naming what a precise question asked, e.g. `only=formula`:
23
+ * the card then draws what the answer is about and only those facts. Without
24
+ * it the card draws everything it would.
25
+ */
26
+ export const ONLY_PARAM = 'only';
27
+
21
28
  /**
22
29
  * Whether an address asks for a card.
23
30
  * @param search - The query string, with or without its leading `?`.
@@ -30,6 +37,29 @@ export function isCardAddress(search: string): boolean {
30
37
  return false;
31
38
  }
32
39
 
40
+ /**
41
+ * The facts a card's `only` names, among those the site's card can single
42
+ * out. A name the card does not know is ignored, so a link written before a
43
+ * fact was renamed still opens, on the facts it still names.
44
+ * @param value - The value of `only` as the query holds it, comma-separated;
45
+ * null or undefined when the address has none.
46
+ * @param known - Every fact the card can single out.
47
+ * @returns The facts named, each once, in the order written; empty when none
48
+ * is known, and the card then draws everything.
49
+ */
50
+ export function parseOnlyParam<Fact extends string>(
51
+ value: string | null | undefined,
52
+ known: readonly Fact[],
53
+ ): Fact[] {
54
+ const facts: Fact[] = [];
55
+ if (value == null) return facts;
56
+ for (const part of value.split(',')) {
57
+ const fact = known.find((candidate) => candidate === part.trim());
58
+ if (fact !== undefined && !facts.includes(fact)) facts.push(fact);
59
+ }
60
+ return facts;
61
+ }
62
+
33
63
  /**
34
64
  * The address a card is at: `globalThis.location`, a `URL`, or any record of
35
65
  * the three parts.
@@ -62,7 +92,7 @@ export interface SitePageOptions {
62
92
  /**
63
93
  * A parameter the page at a given path does not read, though another page
64
94
  * of the site does: a tutorial step reads no InChI, the converter does.
65
- * @default undefined - nothing beyond `card`, `embed`, `hide` and
95
+ * @default undefined - nothing beyond `card`, `only`, `embed`, `hide` and
66
96
  * `cardParams` is left out
67
97
  */
68
98
  isCardOnly?: (key: string, pathname: string) => boolean;
@@ -70,7 +100,7 @@ export interface SitePageOptions {
70
100
 
71
101
  /**
72
102
  * The site's own page a card stands for, with its chrome: the card's address
73
- * without `card`, `embed`, `hide` and what only the card reads. Every other
103
+ * without `card`, `only`, `embed`, `hide` and what only the card reads. Every other
74
104
  * parameter is kept exactly as it was written, so the `+` of a charged atom
75
105
  * stays a plus and the commas of a list stay commas. This is the address an
76
106
  * answer's `link` names, and the one the card's Details button opens.
@@ -84,7 +114,13 @@ export function sitePageUrl(
84
114
  options: SitePageOptions = {},
85
115
  ): string {
86
116
  const { cardParams = [], literalPlus = true, isCardOnly } = options;
87
- const dropped = new Set([CARD_PARAM, EMBED_PARAM, HIDE_PARAM, ...cardParams]);
117
+ const dropped = new Set([
118
+ CARD_PARAM,
119
+ ONLY_PARAM,
120
+ EMBED_PARAM,
121
+ HIDE_PARAM,
122
+ ...cardParams,
123
+ ]);
88
124
  const kept: string[] = [];
89
125
  const search = location.search.startsWith('?')
90
126
  ? location.search.slice(1)
@@ -9,7 +9,7 @@ import type { QueryEntry } from '../../router/core/query.ts';
9
9
  import { formatQueryEntries } from '../../router/core/query.ts';
10
10
  import { EMBED_PARAM, HIDE_PARAM } from '../../share/core/config.ts';
11
11
 
12
- import { CARD_PARAM } from './cardAddress.ts';
12
+ import { CARD_PARAM, ONLY_PARAM } from './cardAddress.ts';
13
13
 
14
14
  /** How {@link framedPageUrl} frames a page. */
15
15
  export interface FramedPageOptions {
@@ -30,7 +30,13 @@ export interface CardPageOptions extends FramedPageOptions {
30
30
  */
31
31
  card?: string;
32
32
  /**
33
- * What only the card reads, written after `card` in the order given, e.g.
33
+ * The facts a precise question asked, written `only=formula,mass` after
34
+ * `card`: the card draws what the answer is about and only those.
35
+ * @default [] - the card draws everything
36
+ */
37
+ only?: readonly string[];
38
+ /**
39
+ * What only the card reads, written after `card` and `only` in the order given, e.g.
34
40
  * `{ rows: '10' }`. A value left `undefined` or empty is not written.
35
41
  * @default {}
36
42
  */
@@ -67,8 +73,9 @@ export function cardPageUrl(
67
73
  page: string,
68
74
  options: CardPageOptions = {},
69
75
  ): string {
70
- const { card = '1', extra = {} } = options;
76
+ const { card = '1', only = [], extra = {} } = options;
71
77
  const entries: QueryEntry[] = [[CARD_PARAM, card]];
78
+ if (only.length > 0) entries.push([ONLY_PARAM, only.join(',')]);
72
79
  for (const [key, value] of Object.entries(extra)) {
73
80
  if (value !== undefined && value !== '') entries.push([key, value]);
74
81
  }
@@ -1,5 +1,11 @@
1
1
  export type { CardLocation, SitePageOptions } from './cardAddress.ts';
2
- export { CARD_PARAM, isCardAddress, sitePageUrl } from './cardAddress.ts';
2
+ export {
3
+ CARD_PARAM,
4
+ ONLY_PARAM,
5
+ isCardAddress,
6
+ parseOnlyParam,
7
+ sitePageUrl,
8
+ } from './cardAddress.ts';
3
9
  export type { CardPageOptions, FramedPageOptions } from './cardPageUrl.ts';
4
10
  export { cardPageUrl, framedPageUrl } from './cardPageUrl.ts';
5
11
  export type { OpenPanel } from './panelRoom.ts';
@@ -84,6 +84,46 @@ export const CREDITS = [
84
84
  description: 'the substructure and similarity search, inside SQLite.',
85
85
  license: 'MIT',
86
86
  },
87
+ {
88
+ id: 'openchemlib-search-wasm',
89
+ name: 'openchemlib-search-wasm',
90
+ href: 'https://github.com/cheminfo/openchemlib-search-wasm',
91
+ description:
92
+ 'the functional-group keys of every structure, and the dictionary that names them.',
93
+ license: 'BSD-3-Clause',
94
+ },
95
+ {
96
+ id: 'chemcaption',
97
+ name: 'ChemCaption',
98
+ href: 'https://github.com/lamalab-org/chem-caption',
99
+ description:
100
+ 'definitions of functional groups, adapted in the function-key dictionary.',
101
+ license: 'MIT',
102
+ },
103
+ {
104
+ id: 'accfg',
105
+ name: 'AccFG',
106
+ href: 'https://github.com/xuanliugit/AccFG',
107
+ description:
108
+ 'definitions of functional groups, adapted in the function-key dictionary.',
109
+ license: 'MIT',
110
+ },
111
+ {
112
+ id: 'medchem',
113
+ name: 'medchem',
114
+ href: 'https://github.com/datamol-io/medchem',
115
+ description:
116
+ 'definitions of functional groups, adapted in the function-key dictionary.',
117
+ license: 'Apache-2.0',
118
+ },
119
+ {
120
+ id: 'rdkit',
121
+ name: 'RDKit',
122
+ href: 'https://github.com/rdkit/rdkit',
123
+ description:
124
+ 'definitions of functional groups, and the reference every key was checked against.',
125
+ license: 'BSD-3-Clause',
126
+ },
87
127
  {
88
128
  id: 'osiris-property-explorer',
89
129
  name: 'OSIRIS Property Explorer',
@@ -0,0 +1,40 @@
1
+ import { writeClipboardItem } from '../../clipboard/core/clipboardItem.ts';
2
+ import { writeToClipboard } from '../../clipboard/core/writeToClipboard.ts';
3
+
4
+ /** The type a picture is put on the clipboard as: no `charset`, which it refuses. */
5
+ const SVG_CLIPBOARD_TYPE = 'image/svg+xml';
6
+
7
+ /**
8
+ * Put an SVG document on the clipboard, without ever throwing at the caller.
9
+ *
10
+ * Where the browser takes an SVG picture, the document goes on as one and as
11
+ * its text, in one item: a slide or a vector editor pastes the drawing, a text
12
+ * editor the markup. Elsewhere — Firefox and Safari take no SVG picture — the
13
+ * text alone, which a vector editor still pastes as a drawing.
14
+ * @param markup - The SVG document.
15
+ * @returns Whether the clipboard now holds it, at least as text.
16
+ */
17
+ export async function copySvg(markup: string): Promise<boolean> {
18
+ if (takesSvgPicture()) {
19
+ const written = await writeClipboardItem({
20
+ [SVG_CLIPBOARD_TYPE]: new Blob([markup], { type: SVG_CLIPBOARD_TYPE }),
21
+ 'text/plain': new Blob([markup], { type: 'text/plain' }),
22
+ });
23
+ if (written) return true;
24
+ }
25
+ return writeToClipboard(markup);
26
+ }
27
+
28
+ /**
29
+ * Whether the clipboard says it takes an SVG picture. Asked before writing:
30
+ * a write it refuses would spend the click, and the text after it would be
31
+ * refused too in Safari.
32
+ * @returns Whether `ClipboardItem.supports` names the SVG type.
33
+ */
34
+ function takesSvgPicture(): boolean {
35
+ if (typeof ClipboardItem === 'undefined') return false;
36
+ const item = ClipboardItem as { supports?: (type: string) => boolean };
37
+ return (
38
+ typeof item.supports === 'function' && item.supports(SVG_CLIPBOARD_TYPE)
39
+ );
40
+ }
@@ -11,7 +11,7 @@
11
11
  import { downloadBlob } from './downloadBlob.ts';
12
12
  import { figurePng } from './figurePng.ts';
13
13
  import { defaultFigureScale } from './figureScale.ts';
14
- import type { FigureSvgOptions } from './figureSvg.ts';
14
+ import type { FigureSvg, FigureSvgOptions } from './figureSvg.ts';
15
15
  import { FIGURE_SVG_TYPE, figureSvg } from './figureSvg.ts';
16
16
  import { sanitizeFileName } from './sanitizeFileName.ts';
17
17
 
@@ -67,3 +67,28 @@ export async function downloadFigure(
67
67
  const figure = figureSvg(target, { background });
68
68
  downloadBlob(await figurePng(figure, scale), `${name}.png`);
69
69
  }
70
+
71
+ /**
72
+ * Save a figure its page wrote as an SVG document itself, rather than one
73
+ * copied off the page: a drawing whose file carries more than its picture.
74
+ * The SVG is saved as written, at the size it states; the PNG is painted from
75
+ * it at the multiple asked for.
76
+ * @param figure - The document, and its size in pixels of the page.
77
+ * @param options - Which file, at what multiple, and its name; a background
78
+ * is the document's own business.
79
+ * @throws {Error} When the browser cannot paint it.
80
+ */
81
+ export async function downloadFigureSvg(
82
+ figure: FigureSvg,
83
+ options: Omit<DownloadFigureOptions, 'background'> = {},
84
+ ): Promise<void> {
85
+ const { format = 'png', fileName = DEFAULT_FILE_NAME } = options;
86
+ const name = sanitizeFileName(fileName, DEFAULT_FILE_NAME);
87
+ if (format === 'svg') {
88
+ const blob = new Blob([figure.markup], { type: FIGURE_SVG_TYPE });
89
+ downloadBlob(blob, `${name}.svg`);
90
+ return;
91
+ }
92
+ const scale = options.scale ?? defaultFigureScale(format);
93
+ downloadBlob(await figurePng(figure, scale), `${name}.png`);
94
+ }
@@ -0,0 +1,94 @@
1
+ /**
2
+ * A figure's resolution stated in dots per inch.
3
+ *
4
+ * A pixel of the page is a ninety-sixth of an inch, by the definition of CSS,
5
+ * so every figure on screen already has a printed size, and the multiple it is
6
+ * painted at is a resolution in another unit: 1× is 96 dpi. A figure whose size
7
+ * on the page is the size it prints at — a structure drawn to a journal's bond
8
+ * length — is offered its resolution in dots per inch, which is what a journal
9
+ * asks for; any other figure is offered multiples of what the reader sees.
10
+ */
11
+
12
+ import type { FigurePixels } from './figureScale.ts';
13
+ import { figureScaleLabel } from './figureScale.ts';
14
+
15
+ /** How the resolution of a figure is offered. */
16
+ export type FigureResolutionUnit = 'multiple' | 'dpi';
17
+
18
+ /** How many pixels of the page make an inch. */
19
+ export const CSS_PIXELS_PER_INCH = 96;
20
+
21
+ /**
22
+ * The dots per inch offered: a slide, a journal's halftone, its combination
23
+ * art, and its line art.
24
+ */
25
+ export const FIGURE_DPIS: readonly number[] = [150, 300, 600, 1200];
26
+
27
+ /** The dots per inch a figure with a printed size is saved at by default. */
28
+ export const DEFAULT_FIGURE_DPI = 300;
29
+
30
+ /** Centimetres in an inch. */
31
+ const CENTIMETRES_PER_INCH = 2.54;
32
+
33
+ /**
34
+ * The multiple a figure is painted at to reach this many dots per inch.
35
+ * @param dpi - Dots per inch.
36
+ * @returns The multiple of its size on the page.
37
+ */
38
+ export function dpiScale(dpi: number): number {
39
+ return dpi / CSS_PIXELS_PER_INCH;
40
+ }
41
+
42
+ /**
43
+ * The dots per inch a figure painted at this multiple has, when it is printed
44
+ * at its size on the page.
45
+ * @param scale - The multiple of its size on the page.
46
+ * @returns Whole dots per inch.
47
+ */
48
+ export function figureDpi(scale: number): number {
49
+ return Math.round(scale * CSS_PIXELS_PER_INCH);
50
+ }
51
+
52
+ /**
53
+ * The size a figure prints at.
54
+ * @param size - Its size on the page, in pixels.
55
+ * @returns Its width and height in centimetres.
56
+ */
57
+ export function figureCentimetres(size: FigurePixels): FigurePixels {
58
+ const factor = CENTIMETRES_PER_INCH / CSS_PIXELS_PER_INCH;
59
+ return { width: size.width * factor, height: size.height * factor };
60
+ }
61
+
62
+ /**
63
+ * The size a figure prints at, written out to a tenth of a centimetre.
64
+ * @param size - Its size on the page, in pixels.
65
+ * @param language - The language the numbers are written in.
66
+ * @returns Its width and height in centimetres, as text: `8.5` or `8,5`.
67
+ */
68
+ export function formatFigureCentimetres(
69
+ size: FigurePixels,
70
+ language: string,
71
+ ): { width: string; height: string } {
72
+ const printed = figureCentimetres(size);
73
+ const format = new Intl.NumberFormat(language, {
74
+ minimumFractionDigits: 1,
75
+ maximumFractionDigits: 1,
76
+ });
77
+ return {
78
+ width: format.format(printed.width),
79
+ height: format.format(printed.height),
80
+ };
81
+ }
82
+
83
+ /**
84
+ * What a resolution reads on a button: `2×`, or `300 dpi`.
85
+ * @param scale - The multiple of the figure's size on the page.
86
+ * @param unit - How the resolution is offered.
87
+ * @returns Its label.
88
+ */
89
+ export function figureResolutionLabel(
90
+ scale: number,
91
+ unit: FigureResolutionUnit,
92
+ ): string {
93
+ return unit === 'dpi' ? `${figureDpi(scale)} dpi` : figureScaleLabel(scale);
94
+ }
@@ -6,11 +6,16 @@
6
6
  * the figure that was read, and two drawing paths are two things to keep in
7
7
  * step. Scaling is the browser's own, so a figure saved at three times is
8
8
  * genuinely three times the detail rather than a stretched screenshot.
9
+ *
10
+ * The file states its resolution, so a document places it at the size the
11
+ * figure has on the page rather than at one pixel per point.
9
12
  */
10
13
 
14
+ import { figureDpi } from './figureDpi.ts';
11
15
  import { DEFAULT_FIGURE_SCALE, figurePixels } from './figureScale.ts';
12
16
  import type { FigureSvg } from './figureSvg.ts';
13
17
  import { FIGURE_SVG_TYPE } from './figureSvg.ts';
18
+ import { withPngDpi } from './pngDpi.ts';
14
19
 
15
20
  /** What a saved raster figure is. */
16
21
  export const FIGURE_PNG_TYPE = 'image/png';
@@ -19,7 +24,7 @@ export const FIGURE_PNG_TYPE = 'image/png';
19
24
  * The figure as a PNG.
20
25
  * @param figure - The figure, already copied off the page.
21
26
  * @param scale - How many pixels are painted per pixel on screen.
22
- * @returns The image.
27
+ * @returns The image, stating `96 × scale` dots per inch.
23
28
  * @throws {Error} When the browser cannot paint or encode it.
24
29
  */
25
30
  export async function figurePng(
@@ -38,7 +43,11 @@ export async function figurePng(
38
43
  }
39
44
  context.drawImage(drawing, 0, 0, pixels.width, pixels.height);
40
45
 
41
- return encode(canvas);
46
+ const encoded = await encode(canvas);
47
+ const png = new Uint8Array(await encoded.arrayBuffer());
48
+ return new Blob([withPngDpi(png, figureDpi(scale))], {
49
+ type: FIGURE_PNG_TYPE,
50
+ });
42
51
  }
43
52
 
44
53
  /**
@@ -1,10 +1,22 @@
1
1
  export type { FigureNotice } from './copyFigure.ts';
2
2
  export { copyFigure } from './copyFigure.ts';
3
+ export { copySvg } from './copySvg.ts';
3
4
  export { cssTokenNames, resolveCssTokens } from './cssTokens.ts';
4
5
  export { downloadBlob } from './downloadBlob.ts';
5
6
  export type { DownloadFigureOptions, FigureFormat } from './downloadFigure.ts';
6
- export { downloadFigure } from './downloadFigure.ts';
7
+ export { downloadFigure, downloadFigureSvg } from './downloadFigure.ts';
7
8
  export { downloadText } from './downloadText.ts';
9
+ export type { FigureResolutionUnit } from './figureDpi.ts';
10
+ export {
11
+ CSS_PIXELS_PER_INCH,
12
+ DEFAULT_FIGURE_DPI,
13
+ FIGURE_DPIS,
14
+ dpiScale,
15
+ figureCentimetres,
16
+ figureDpi,
17
+ figureResolutionLabel,
18
+ formatFigureCentimetres,
19
+ } from './figureDpi.ts';
8
20
  export type { FigureLayout } from './figureLayout.ts';
9
21
  export {
10
22
  FIGURE_COLUMN_WIDTH,
@@ -52,6 +64,7 @@ export {
52
64
  figurePaintings,
53
65
  figureSize,
54
66
  } from './figureTarget.ts';
67
+ export { pngDpi, withPngDpi } from './pngDpi.ts';
55
68
  export { sanitizeFileName } from './sanitizeFileName.ts';
56
69
 
57
70
  export { drawingIn, stackDrawings } from './stackedDrawing.ts';
@@ -0,0 +1,84 @@
1
+ /**
2
+ * The resolution a PNG states, in its `pHYs` chunk.
3
+ *
4
+ * A browser writes none, and a word processor or a slide then places the
5
+ * picture as if it were 72 or 96 dpi — a figure painted for print arrives
6
+ * several times too large. Stated, it arrives at the size it was drawn.
7
+ */
8
+
9
+ import CRC32 from 'crc-32';
10
+
11
+ const SIGNATURE = [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a];
12
+
13
+ /** Metres in an inch: `pHYs` counts pixels per metre. */
14
+ const METRES_PER_INCH = 0.0254;
15
+
16
+ /**
17
+ * A PNG stating a resolution, any resolution it stated before dropped.
18
+ * @param png - The PNG file's bytes.
19
+ * @param dpi - Dots per inch.
20
+ * @returns A new PNG file.
21
+ * @throws {Error} When the bytes are not a PNG.
22
+ */
23
+ export function withPngDpi(
24
+ png: Uint8Array,
25
+ dpi: number,
26
+ ): Uint8Array<ArrayBuffer> {
27
+ for (let index = 0; index < SIGNATURE.length; index++) {
28
+ if (png[index] !== SIGNATURE[index]) throw new Error('Not a PNG file.');
29
+ }
30
+ const view = new DataView(png.buffer, png.byteOffset, png.byteLength);
31
+ const chunks: Uint8Array[] = [png.subarray(0, SIGNATURE.length)];
32
+ let offset = SIGNATURE.length;
33
+ while (offset + 8 <= png.length) {
34
+ const end = offset + 12 + view.getUint32(offset);
35
+ const type = chunkType(png, offset);
36
+ if (type !== 'pHYs') chunks.push(png.subarray(offset, end));
37
+ if (type === 'IHDR') chunks.push(physChunk(dpi));
38
+ offset = end;
39
+ }
40
+ let total = 0;
41
+ for (const chunk of chunks) total += chunk.length;
42
+ const result = new Uint8Array(total);
43
+ let position = 0;
44
+ for (const chunk of chunks) {
45
+ result.set(chunk, position);
46
+ position += chunk.length;
47
+ }
48
+ return result;
49
+ }
50
+
51
+ /**
52
+ * The resolution a PNG states.
53
+ * @param png - The PNG file's bytes.
54
+ * @returns Whole dots per inch, or `undefined` when it states none.
55
+ */
56
+ export function pngDpi(png: Uint8Array): number | undefined {
57
+ const view = new DataView(png.buffer, png.byteOffset, png.byteLength);
58
+ let offset = SIGNATURE.length;
59
+ while (offset + 8 <= png.length) {
60
+ if (chunkType(png, offset) === 'pHYs' && png[offset + 16] === 1) {
61
+ return Math.round(view.getUint32(offset + 8) * METRES_PER_INCH);
62
+ }
63
+ offset += 12 + view.getUint32(offset);
64
+ }
65
+ return undefined;
66
+ }
67
+
68
+ function chunkType(png: Uint8Array, offset: number): string {
69
+ return String.fromCodePoint(...png.subarray(offset + 4, offset + 8));
70
+ }
71
+
72
+ function physChunk(dpi: number): Uint8Array {
73
+ const chunk = new Uint8Array(21);
74
+ const view = new DataView(chunk.buffer);
75
+ view.setUint32(0, 9);
76
+ chunk.set([0x70, 0x48, 0x59, 0x73], 4);
77
+ const perMetre = Math.round(dpi / METRES_PER_INCH);
78
+ view.setUint32(8, perMetre);
79
+ view.setUint32(12, perMetre);
80
+ // The unit: 1 is the metre, 0 an aspect ratio with no size.
81
+ chunk[16] = 1;
82
+ view.setInt32(17, CRC32.buf(chunk.subarray(4, 17)));
83
+ return chunk;
84
+ }