nmrium 0.39.0 → 0.41.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 (306) hide show
  1. package/lib/component/1d/FooterBanner.js +5 -4
  2. package/lib/component/1d/Viewer1D.js +121 -104
  3. package/lib/component/1d/database/ResurrectedDatabaseRanges.js +1 -1
  4. package/lib/component/1d/jCouplingGraph/JGraphContext.d.ts +1 -1
  5. package/lib/component/1d/jCouplingGraph/JsCouplingLinks.js +1 -1
  6. package/lib/component/1d/multiplicityTree/TreeColors.d.ts +1 -1
  7. package/lib/component/1d/multiplicityTree/TreeColors.js +1 -6
  8. package/lib/component/1d/multiplicityTree/TreeNodes.d.ts +1 -1
  9. package/lib/component/1d/tool/BaseLineZones.d.ts +1 -1
  10. package/lib/component/1d/tool/BaseLineZones.js +7 -4
  11. package/lib/component/1d/tool/PeakPointer.js +1 -1
  12. package/lib/component/1d/utilities/scale.js +1 -3
  13. package/lib/component/1d-2d/components/FloatMoleculeStructures/index.d.ts +1 -1
  14. package/lib/component/1d-2d/tools/BrushXY.js +10 -7
  15. package/lib/component/1d-2d/tools/CrossLinePointer.js +1 -1
  16. package/lib/component/2d/FooterBanner.js +3 -2
  17. package/lib/component/2d/Viewer2D.js +51 -29
  18. package/lib/component/2d/XAxis.js +1 -1
  19. package/lib/component/2d/YAxis.js +1 -1
  20. package/lib/component/2d/utilities/SliceScale.d.ts +2 -2
  21. package/lib/component/2d/utilities/scale.d.ts +5 -5
  22. package/lib/component/2d/zones/Signal.js +1 -2
  23. package/lib/component/EventsTrackers/BrushTracker.d.ts +4 -1
  24. package/lib/component/EventsTrackers/BrushTracker.js +21 -6
  25. package/lib/component/NMRium.d.ts +2 -2
  26. package/lib/component/NMRium.js +39 -26
  27. package/lib/component/assignment/AssignmentsReducer.d.ts +1 -1
  28. package/lib/component/assignment/actions/setActiveAssignment.js +1 -1
  29. package/lib/component/context/LoggerContext.js +11 -6
  30. package/lib/component/elements/InputRange.js +1 -1
  31. package/lib/component/elements/MenuButton.d.ts +1 -1
  32. package/lib/component/elements/MoleculeSelection.d.ts +1 -1
  33. package/lib/component/elements/ReactTable/ReactTable.d.ts +1 -1
  34. package/lib/component/elements/Tab/DeleteButton.d.ts +1 -1
  35. package/lib/component/elements/ToolbarMenu.d.ts +1 -1
  36. package/lib/component/elements/accordion/Accordion.d.ts +1 -1
  37. package/lib/component/elements/draggable/SVGDraggable.d.ts +1 -1
  38. package/lib/component/elements/draggable/useDraggable.d.ts +1 -1
  39. package/lib/component/elements/dropDownButton/DropDownButton.d.ts +1 -1
  40. package/lib/component/elements/dropDownButton/DropDownList.js +3 -1
  41. package/lib/component/elements/formik/SelectBox.d.ts +1 -1
  42. package/lib/component/elements/popup/Alert/AlertBlock.d.ts +8 -0
  43. package/lib/component/elements/popup/Alert/AlertBlock.js +30 -0
  44. package/lib/component/elements/popup/Alert/Context.d.ts +26 -2
  45. package/lib/component/elements/popup/Alert/Context.js +6 -2
  46. package/lib/component/elements/popup/Alert/Provider.d.ts +4 -3
  47. package/lib/component/elements/popup/Alert/Provider.js +5 -23
  48. package/lib/component/elements/popup/Modal/ConfirmDialog.d.ts +1 -1
  49. package/lib/component/elements/popup/Modal/ConfirmDialog.js +2 -1
  50. package/lib/component/elements/popup/Modal/Provider.js +3 -1
  51. package/lib/component/elements/popup/options.d.ts +22 -19
  52. package/lib/component/elements/resizer/Resizer.d.ts +2 -2
  53. package/lib/component/elements/toggle/ToggleButton.d.ts +2 -2
  54. package/lib/component/elements/toggle/ToggleButton.js +1 -1
  55. package/lib/component/header/Header.js +2 -2
  56. package/lib/component/header/ZeroFillingOptionsPanel.js +3 -8
  57. package/lib/component/highlight/index.d.ts +1 -1
  58. package/lib/component/hooks/useCheckToolsVisibility.js +2 -2
  59. package/lib/component/hooks/useExport.js +2 -1
  60. package/lib/component/hooks/useFormatNumberByNucleus.d.ts +1 -1
  61. package/lib/component/hooks/usePanelPreferences.js +2 -2
  62. package/lib/component/hooks/useXScale.d.ts +1 -1
  63. package/lib/component/hooks/useXYReduce.d.ts +2 -2
  64. package/lib/component/modal/AboutSpectrumSimulationModal.d.ts +2 -0
  65. package/lib/component/modal/AboutSpectrumSimulationModal.js +49 -0
  66. package/lib/component/modal/AboutUsModal.js +4 -2
  67. package/lib/component/modal/AlignSpectraModal.js +11 -1
  68. package/lib/component/modal/LogsHistoryModal.d.ts +6 -0
  69. package/lib/component/{header/LogsHistory.js → modal/LogsHistoryModal.js} +6 -4
  70. package/lib/component/modal/MultipletAnalysisModal.js +2 -1
  71. package/lib/component/modal/PredictSpectraModal.d.ts +1 -2
  72. package/lib/component/modal/PredictSpectraModal.js +25 -28
  73. package/lib/component/modal/changeSum/ChangeSumModal.js +1 -1
  74. package/lib/component/modal/editRange/forms/components/SignalsForm.js +1 -1
  75. package/lib/component/modal/editZone/SignalsForm.js +1 -1
  76. package/lib/component/modal/metaImportation/MetaImportationModal.js +1 -1
  77. package/lib/component/modal/setting/GeneralSettings.js +28 -27
  78. package/lib/component/modal/setting/settings-tabs/DisplayTabContent.js +4 -0
  79. package/lib/component/modal/setting/settings-tabs/FormattingTabContent.js +1 -1
  80. package/lib/component/modal/setting/settingsValidation.js +2 -2
  81. package/lib/component/panels/IntegralsPanel/IntegralPanel.d.ts +1 -1
  82. package/lib/component/panels/IntegralsPanel/IntegralTable.d.ts +1 -1
  83. package/lib/component/panels/IntegralsPanel/IntegralTable.js +4 -7
  84. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts +1 -1
  85. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +19 -19
  86. package/lib/component/panels/MoleculesPanel/Utilities.d.ts +1 -1
  87. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +3 -5
  88. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +9 -13
  89. package/lib/component/panels/Panels.js +13 -0
  90. package/lib/component/panels/PeaksPanel/PeaksTable.js +1 -1
  91. package/lib/component/panels/RangesPanel/RangesHeader.js +9 -15
  92. package/lib/component/panels/RangesPanel/RangesPanel.js +7 -10
  93. package/lib/component/panels/SpectrumsPanel/SpectraTable.js +8 -11
  94. package/lib/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +3 -1
  95. package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -2
  96. package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +2 -1
  97. package/lib/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
  98. package/lib/component/panels/ZonesPanel/ZonesTable.d.ts +1 -1
  99. package/lib/component/panels/databasePanel/DatabasePanel.d.ts +1 -1
  100. package/lib/component/panels/databasePanel/DatabasePanel.js +1 -1
  101. package/lib/component/panels/databasePanel/DatabaseTable.js +1 -1
  102. package/lib/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
  103. package/lib/component/panels/extra/utilities/UseToggleStatus.js +1 -1
  104. package/lib/component/panels/filtersPanel/FiltersTable.js +2 -2
  105. package/lib/component/panels/predictionPanel/PredictionOptionsPanel.js +2 -1
  106. package/lib/component/panels/predictionPanel/PredictionPanel.js +3 -2
  107. package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +2 -2
  108. package/lib/component/panels/spectrumSimulation/SpectrumSimulation.d.ts +1 -0
  109. package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +88 -0
  110. package/lib/component/panels/spectrumSimulation/SpectrumSimulationPreferences.d.ts +11 -0
  111. package/lib/component/panels/spectrumSimulation/SpectrumSimulationPreferences.js +37 -0
  112. package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.d.ts +4 -0
  113. package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +25 -0
  114. package/lib/component/panels/spectrumSimulation/SpinSystemTable.d.ts +5 -0
  115. package/lib/component/panels/spectrumSimulation/SpinSystemTable.js +60 -0
  116. package/lib/component/reducer/Reducer.d.ts +13 -12
  117. package/lib/component/reducer/Reducer.js +251 -239
  118. package/lib/component/reducer/actions/AssignmentsActions.d.ts +1 -1
  119. package/lib/component/reducer/actions/AssignmentsActions.js +1 -1
  120. package/lib/component/reducer/actions/DatabaseActions.js +2 -1
  121. package/lib/component/reducer/actions/DomainActions.d.ts +7 -2
  122. package/lib/component/reducer/actions/DomainActions.js +30 -1
  123. package/lib/component/reducer/actions/FiltersActions.js +4 -4
  124. package/lib/component/reducer/actions/LoadActions.js +1 -1
  125. package/lib/component/reducer/actions/MoleculeActions.d.ts +2 -0
  126. package/lib/component/reducer/actions/MoleculeActions.js +51 -2
  127. package/lib/component/reducer/actions/SpectrumsActions.d.ts +8 -2
  128. package/lib/component/reducer/actions/SpectrumsActions.js +43 -4
  129. package/lib/component/reducer/actions/ToolsActions.js +2 -2
  130. package/lib/component/reducer/actions/ZonesActions.js +1 -1
  131. package/lib/component/reducer/helper/ZoomHistoryManager.d.ts +4 -6
  132. package/lib/component/reducer/preferences/actions/setActiveWorkspace.js +1 -1
  133. package/lib/component/reducer/preferences/actions/setPreferences.js +3 -4
  134. package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
  135. package/lib/component/reducer/preferences/preferencesReducer.js +5 -1
  136. package/lib/component/reducer/preferences/utilities/flatObject.js +1 -1
  137. package/lib/component/toolbar/ToolTypes.d.ts +4 -4
  138. package/lib/component/utility/export.d.ts +5 -4
  139. package/lib/component/utility/export.js +33 -61
  140. package/lib/component/utility/getSpectraObjectPaths.js +1 -1
  141. package/lib/component/utility/getUniqueNuclei.js +1 -1
  142. package/lib/component/utility/jpathToArray.js +1 -1
  143. package/lib/component/workspaces/index.d.ts +1 -0
  144. package/lib/component/workspaces/index.js +2 -0
  145. package/lib/component/workspaces/simulation.d.ts +2 -0
  146. package/lib/component/workspaces/simulation.js +68 -0
  147. package/lib/component/workspaces/workspaceDefaultProperties.js +1 -0
  148. package/lib/data/PredictionManager.d.ts +8 -7
  149. package/lib/data/PredictionManager.js +95 -22
  150. package/lib/data/SpectraManager.js +1 -1
  151. package/lib/data/constants/DefaultPathLengths.d.ts +1 -3
  152. package/lib/data/constants/SignalsKinds.d.ts +2 -2
  153. package/lib/data/data1d/Spectrum1D/generateJGraphData.js +3 -3
  154. package/lib/data/data1d/Spectrum1D/getReferenceShift.js +5 -4
  155. package/lib/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.d.ts +1 -1
  156. package/lib/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +12 -13
  157. package/lib/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +10 -9
  158. package/lib/data/data1d/database.d.ts +5 -5
  159. package/lib/data/data1d/database.js +3 -3
  160. package/lib/data/data1d/multipleSpectraAnalysis.d.ts +1 -1
  161. package/lib/data/data1d/multipleSpectraAnalysis.js +1 -1
  162. package/lib/data/data1d/spectrumSimulation.d.ts +14 -0
  163. package/lib/data/data1d/spectrumSimulation.js +53 -0
  164. package/lib/data/data2d/Spectrum2D/contours.d.ts +8 -4
  165. package/lib/data/data2d/Spectrum2D/contours.js +7 -1
  166. package/lib/data/data2d/Spectrum2D/getMissingProjection.js +6 -6
  167. package/lib/data/data2d/Spectrum2D/getShift.js +1 -1
  168. package/lib/data/data2d/Spectrum2D/getSlice.js +4 -4
  169. package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.js +5 -5
  170. package/lib/data/getDefaultMatrixFilters.d.ts +2 -2
  171. package/lib/data/matrixGeneration.js +1 -1
  172. package/lib/data/molecules/MoleculeManager.d.ts +1 -1
  173. package/lib/data/molecules/MoleculeManager.js +7 -7
  174. package/lib/data/parseMeta/linkMetaWithSpectra.js +2 -1
  175. package/lib/data/types/data1d/MatrixOptions.d.ts +2 -2
  176. package/lib/data/utilities/FindUtilities.js +4 -4
  177. package/lib/data/utilities/RangeUtilities.d.ts +1 -1
  178. package/lib/data/utilities/ZoneUtilities.d.ts +1 -1
  179. package/lib/data/utilities/calculateSanPlot.js +3 -3
  180. package/lib/data/utilities/generateNumbersPowerOfX.js +1 -1
  181. package/lib/utils/clipboard/clipboard.d.ts +12 -0
  182. package/lib/utils/clipboard/clipboard.js +15 -0
  183. package/lib/utils/clipboard/clipboardComponents.d.ts +45 -0
  184. package/lib/utils/clipboard/clipboardComponents.js +150 -0
  185. package/lib/utils/clipboard/clipboardHooks.d.ts +94 -0
  186. package/lib/utils/clipboard/clipboardHooks.js +142 -0
  187. package/lib/utils/clipboard/types.d.ts +1 -0
  188. package/lib/utils/clipboard/types.js +1 -0
  189. package/lib/versionInfo.js +1 -1
  190. package/lib-cjs/component/1d/FooterBanner.js +5 -4
  191. package/lib-cjs/component/1d/Viewer1D.js +120 -103
  192. package/lib-cjs/component/1d/database/ResurrectedDatabaseRanges.js +1 -1
  193. package/lib-cjs/component/1d/jCouplingGraph/JsCouplingLinks.js +1 -1
  194. package/lib-cjs/component/1d/multiplicityTree/TreeColors.js +1 -6
  195. package/lib-cjs/component/1d/tool/BaseLineZones.js +6 -3
  196. package/lib-cjs/component/1d/tool/PeakPointer.js +1 -1
  197. package/lib-cjs/component/1d/utilities/scale.js +1 -3
  198. package/lib-cjs/component/1d-2d/tools/BrushXY.js +10 -7
  199. package/lib-cjs/component/1d-2d/tools/CrossLinePointer.js +1 -1
  200. package/lib-cjs/component/2d/FooterBanner.js +3 -2
  201. package/lib-cjs/component/2d/Viewer2D.js +50 -28
  202. package/lib-cjs/component/2d/XAxis.js +1 -1
  203. package/lib-cjs/component/2d/YAxis.js +1 -1
  204. package/lib-cjs/component/2d/zones/Signal.js +1 -2
  205. package/lib-cjs/component/EventsTrackers/BrushTracker.js +21 -6
  206. package/lib-cjs/component/NMRium.js +37 -24
  207. package/lib-cjs/component/assignment/actions/setActiveAssignment.js +1 -1
  208. package/lib-cjs/component/context/LoggerContext.js +10 -5
  209. package/lib-cjs/component/elements/InputRange.js +1 -1
  210. package/lib-cjs/component/elements/dropDownButton/DropDownList.js +3 -1
  211. package/lib-cjs/component/elements/popup/Alert/AlertBlock.js +36 -0
  212. package/lib-cjs/component/elements/popup/Alert/Context.js +6 -2
  213. package/lib-cjs/component/elements/popup/Alert/Provider.js +4 -22
  214. package/lib-cjs/component/elements/popup/Modal/ConfirmDialog.js +2 -1
  215. package/lib-cjs/component/elements/popup/Modal/Provider.js +3 -1
  216. package/lib-cjs/component/header/Header.js +2 -2
  217. package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +3 -8
  218. package/lib-cjs/component/hooks/useCheckToolsVisibility.js +2 -2
  219. package/lib-cjs/component/hooks/useExport.js +2 -1
  220. package/lib-cjs/component/hooks/usePanelPreferences.js +1 -1
  221. package/lib-cjs/component/modal/AboutSpectrumSimulationModal.js +54 -0
  222. package/lib-cjs/component/modal/AboutUsModal.js +4 -2
  223. package/lib-cjs/component/modal/AlignSpectraModal.js +11 -1
  224. package/lib-cjs/component/{header/LogsHistory.js → modal/LogsHistoryModal.js} +8 -6
  225. package/lib-cjs/component/modal/MultipletAnalysisModal.js +2 -1
  226. package/lib-cjs/component/modal/PredictSpectraModal.js +24 -27
  227. package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +1 -1
  228. package/lib-cjs/component/modal/editRange/forms/components/SignalsForm.js +1 -1
  229. package/lib-cjs/component/modal/editZone/SignalsForm.js +1 -1
  230. package/lib-cjs/component/modal/metaImportation/MetaImportationModal.js +1 -1
  231. package/lib-cjs/component/modal/setting/GeneralSettings.js +28 -27
  232. package/lib-cjs/component/modal/setting/settings-tabs/DisplayTabContent.js +4 -0
  233. package/lib-cjs/component/modal/setting/settings-tabs/FormattingTabContent.js +1 -1
  234. package/lib-cjs/component/modal/setting/settingsValidation.js +2 -2
  235. package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +4 -7
  236. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +18 -18
  237. package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +3 -5
  238. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +9 -13
  239. package/lib-cjs/component/panels/Panels.js +13 -0
  240. package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +1 -1
  241. package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +9 -15
  242. package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +7 -10
  243. package/lib-cjs/component/panels/SpectrumsPanel/SpectraTable.js +8 -11
  244. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +3 -1
  245. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -2
  246. package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
  247. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +1 -1
  248. package/lib-cjs/component/panels/databasePanel/DatabaseTable.js +1 -1
  249. package/lib-cjs/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
  250. package/lib-cjs/component/panels/extra/utilities/UseToggleStatus.js +1 -1
  251. package/lib-cjs/component/panels/filtersPanel/FiltersTable.js +2 -2
  252. package/lib-cjs/component/panels/predictionPanel/PredictionOptionsPanel.js +2 -1
  253. package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +3 -2
  254. package/lib-cjs/component/panels/predictionPanel/PredictionSimpleOptions.js +1 -1
  255. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulation.js +94 -0
  256. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationPreferences.js +42 -0
  257. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +31 -0
  258. package/lib-cjs/component/panels/spectrumSimulation/SpinSystemTable.js +67 -0
  259. package/lib-cjs/component/reducer/Reducer.js +251 -239
  260. package/lib-cjs/component/reducer/actions/AssignmentsActions.js +1 -1
  261. package/lib-cjs/component/reducer/actions/DatabaseActions.js +2 -1
  262. package/lib-cjs/component/reducer/actions/DomainActions.js +31 -1
  263. package/lib-cjs/component/reducer/actions/FiltersActions.js +4 -4
  264. package/lib-cjs/component/reducer/actions/LoadActions.js +1 -1
  265. package/lib-cjs/component/reducer/actions/MoleculeActions.js +54 -2
  266. package/lib-cjs/component/reducer/actions/SpectrumsActions.js +43 -3
  267. package/lib-cjs/component/reducer/actions/ToolsActions.js +2 -2
  268. package/lib-cjs/component/reducer/actions/ZonesActions.js +1 -1
  269. package/lib-cjs/component/reducer/preferences/actions/setActiveWorkspace.js +1 -1
  270. package/lib-cjs/component/reducer/preferences/actions/setPreferences.js +3 -4
  271. package/lib-cjs/component/reducer/preferences/preferencesReducer.js +5 -1
  272. package/lib-cjs/component/reducer/preferences/utilities/flatObject.js +1 -1
  273. package/lib-cjs/component/utility/export.js +33 -63
  274. package/lib-cjs/component/utility/getSpectraObjectPaths.js +1 -1
  275. package/lib-cjs/component/utility/getUniqueNuclei.js +1 -1
  276. package/lib-cjs/component/utility/jpathToArray.js +1 -1
  277. package/lib-cjs/component/workspaces/index.js +2 -0
  278. package/lib-cjs/component/workspaces/simulation.js +71 -0
  279. package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +1 -0
  280. package/lib-cjs/data/PredictionManager.js +96 -22
  281. package/lib-cjs/data/SpectraManager.js +1 -1
  282. package/lib-cjs/data/data1d/Spectrum1D/generateJGraphData.js +3 -3
  283. package/lib-cjs/data/data1d/Spectrum1D/getReferenceShift.js +5 -4
  284. package/lib-cjs/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +12 -13
  285. package/lib-cjs/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +10 -9
  286. package/lib-cjs/data/data1d/database.js +3 -3
  287. package/lib-cjs/data/data1d/multipleSpectraAnalysis.js +1 -1
  288. package/lib-cjs/data/data1d/spectrumSimulation.js +58 -0
  289. package/lib-cjs/data/data2d/Spectrum2D/contours.js +7 -1
  290. package/lib-cjs/data/data2d/Spectrum2D/getMissingProjection.js +6 -6
  291. package/lib-cjs/data/data2d/Spectrum2D/getShift.js +1 -1
  292. package/lib-cjs/data/data2d/Spectrum2D/getSlice.js +4 -4
  293. package/lib-cjs/data/data2d/Spectrum2D/zones/getDetectionZones.js +5 -5
  294. package/lib-cjs/data/matrixGeneration.js +1 -1
  295. package/lib-cjs/data/molecules/MoleculeManager.js +7 -7
  296. package/lib-cjs/data/parseMeta/linkMetaWithSpectra.js +2 -1
  297. package/lib-cjs/data/utilities/FindUtilities.js +4 -4
  298. package/lib-cjs/data/utilities/calculateSanPlot.js +3 -3
  299. package/lib-cjs/data/utilities/generateNumbersPowerOfX.js +1 -1
  300. package/lib-cjs/utils/clipboard/clipboard.js +23 -0
  301. package/lib-cjs/utils/clipboard/clipboardComponents.js +158 -0
  302. package/lib-cjs/utils/clipboard/clipboardHooks.js +147 -0
  303. package/lib-cjs/utils/clipboard/types.js +2 -0
  304. package/lib-cjs/versionInfo.js +1 -1
  305. package/package.json +26 -25
  306. package/lib/component/header/LogsHistory.d.ts +0 -1
@@ -6,7 +6,8 @@ const generateSpectrumFromRanges_1 = require("../../../data/data1d/Spectrum1D/ra
6
6
  const Zoom1DManager_1 = require("../helper/Zoom1DManager");
7
7
  const DomainActions_1 = require("./DomainActions");
8
8
  function handleResurrectSpectrumFromJcamp(draft, action) {
9
- let { ranges, spectrum } = action.payload;
9
+ const { ranges } = action.payload;
10
+ let { spectrum } = action.payload;
10
11
  spectrum = {
11
12
  ...spectrum,
12
13
  ranges: {
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.handleSetYDomain = exports.handleSetXDomain = exports.setIntegralsYDomain = exports.setMode = exports.setDomain = exports.getDomain = void 0;
6
+ exports.handleMoveOverXAxis = exports.handleSetYDomain = exports.handleSetXDomain = exports.setIntegralsYDomain = exports.setMode = exports.setDomain = exports.getDomain = void 0;
7
7
  const d3_1 = require("d3");
8
8
  const get1DDataXY_1 = require("../../../data/data1d/Spectrum1D/get1DDataXY");
9
9
  const Spectrum2D_1 = require("../../../data/data2d/Spectrum2D");
@@ -206,3 +206,33 @@ function handleSetYDomain(draft, action) {
206
206
  (0, ZoomHistoryManager_1.addToBrushHistory)(draft, { xDomain: draft.xDomain, yDomain });
207
207
  }
208
208
  exports.handleSetYDomain = handleSetYDomain;
209
+ function handleMoveOverXAxis(draft, action) {
210
+ const { shiftX, shiftY } = action.payload;
211
+ const [x1, x2] = draft.xDomain;
212
+ const [y1, y2] = draft.yDomain;
213
+ const [x1Origin, x2Origin] = draft.originDomain.xDomain;
214
+ const [y1Origin, y2Origin] = draft.originDomain.yDomain;
215
+ let x1Domain = x1 - shiftX;
216
+ let x2Domain = x2 - shiftX;
217
+ let y1Domain = y1 - shiftY;
218
+ let y2Domain = y2 - shiftY;
219
+ if (x1Domain < x1Origin) {
220
+ x1Domain = x1Origin;
221
+ x2Domain = x2;
222
+ }
223
+ if (x2Domain > x2Origin) {
224
+ x2Domain = x2Origin;
225
+ x1Domain = x1;
226
+ }
227
+ if (y1Domain < y1Origin) {
228
+ y1Domain = y1Origin;
229
+ y2Domain = y2;
230
+ }
231
+ if (y2Domain > y2Origin) {
232
+ y2Domain = y2Origin;
233
+ y1Domain = y1;
234
+ }
235
+ draft.xDomain = [x1Domain, x2Domain];
236
+ draft.yDomain = [y1Domain, y2Domain];
237
+ }
238
+ exports.handleMoveOverXAxis = handleMoveOverXAxis;
@@ -224,7 +224,7 @@ function handleCalculateZeroFillingFilter(draft, action) {
224
224
  if (activeSpectrum) {
225
225
  const index = activeSpectrum.index;
226
226
  const { data: { x, re, im }, filters, info, } = draft.tempData[index];
227
- let _data = { data: { x, re, im }, filters, info };
227
+ const _data = { data: { x, re, im }, filters, info };
228
228
  zeroFilling.apply(_data, action.payload);
229
229
  const { im: newIm, re: newRe, x: newX } = _data.data;
230
230
  const datum = draft.data[index];
@@ -242,7 +242,7 @@ function handleCalculateApodizationFilter(draft, action) {
242
242
  const index = activeSpectrum.index;
243
243
  const options = action.payload;
244
244
  const { data: { x, re, im }, info, } = draft.tempData[index];
245
- let _data = { data: { x, re, im }, info };
245
+ const _data = { data: { x, re, im }, info };
246
246
  draft.toolOptions.data.apodizationOptions = options;
247
247
  apodization.apply(_data, options);
248
248
  const { im: newIm, re: newRe } = _data.data;
@@ -331,7 +331,7 @@ function handleCalculateManualPhaseCorrection(draft, action) {
331
331
  const { index } = activeSpectrum;
332
332
  const { data: { x, re, im }, info, } = draft.tempData[index];
333
333
  const { ph0, ph1 } = action.payload;
334
- let _data = { data: { x, re, im }, info };
334
+ const _data = { data: { x, re, im }, info };
335
335
  phaseCorrection.apply(_data, { ph0, ph1 });
336
336
  const { im: newIm, re: newRe } = _data.data;
337
337
  const datum = draft.data[index];
@@ -432,7 +432,7 @@ function calculateBaseLineCorrection(draft, baseLineOptions) {
432
432
  const { zones, options } = draft.toolOptions.data.baselineCorrection;
433
433
  const { livePreview, ...filterOptions } = options;
434
434
  if (livePreview) {
435
- let _data = { data: { x, re, im }, info };
435
+ const _data = { data: { x, re, im }, info };
436
436
  baselineCorrection.apply(_data, {
437
437
  zones,
438
438
  ...filterOptions,
@@ -45,7 +45,7 @@ function convertHybridizationStringValuesInCorrelations(correlations) {
45
45
  ...correlations,
46
46
  values: correlations.values.map((correlation) => {
47
47
  if (typeof correlation.hybridization === 'string') {
48
- let values = [];
48
+ const values = [];
49
49
  if (correlation.hybridization.length > 0) {
50
50
  const hybridizationString = correlation.hybridization.replaceAll('SP', '');
51
51
  const value = Number(hybridizationString);
@@ -22,8 +22,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
25
28
  Object.defineProperty(exports, "__esModule", { value: true });
26
29
  exports.handleChangeMoleculeLabel = exports.handleChangeFloatMoleculePosition = exports.handleToggleMoleculeAtomsNumbers = exports.handleFloatMoleculeOverSpectrum = exports.handlePredictSpectraFromMolecule = exports.handleDeleteMolecule = exports.handleSetMolecule = exports.handleAddMolecule = void 0;
30
+ const full_1 = __importDefault(require("openchemlib/full"));
31
+ const openchemlib_utils_1 = require("openchemlib-utils");
27
32
  const PredictionManager_1 = require("../../../data/PredictionManager");
28
33
  const SumManager_1 = require("../../../data/data1d/Spectrum1D/SumManager");
29
34
  const Molecule_1 = require("../../../data/molecules/Molecule");
@@ -101,10 +106,11 @@ function handleDeleteMolecule(draft, action) {
101
106
  exports.handleDeleteMolecule = handleDeleteMolecule;
102
107
  //action
103
108
  function handlePredictSpectraFromMolecule(draft, action) {
104
- const { predictedSpectra, options, molecule, action: predictionAction = 'save', } = action.payload;
109
+ const { logger, predictedSpectra, options, molecule, action: predictionAction = 'save', } = action.payload;
110
+ checkPredictions(predictedSpectra, options, molecule.molfile, logger);
105
111
  const color = (0, generateColor_1.generateColor)(false, draft.usedColors['1d']);
106
112
  const spectraIds = [];
107
- for (const spectrum of (0, PredictionManager_1.generateSpectra)(predictedSpectra, options, color)) {
113
+ for (const spectrum of (0, PredictionManager_1.generateSpectra)(predictedSpectra, options, color, logger)) {
108
114
  draft.data.push(spectrum);
109
115
  spectraIds.push(spectrum.id);
110
116
  }
@@ -130,6 +136,52 @@ function handlePredictSpectraFromMolecule(draft, action) {
130
136
  (0, ToolsActions_1.setActiveTab)(draft, { refreshActiveTab: true, tab: '1H' });
131
137
  }
132
138
  exports.handlePredictSpectraFromMolecule = handlePredictSpectraFromMolecule;
139
+ function checkPredictions(predictedSpectra, inputOptions, molfile, logger) {
140
+ const { spectra } = inputOptions;
141
+ const missing2DPrediction = [];
142
+ const molecule = full_1.default.Molecule.fromMolfile(molfile);
143
+ molecule.addImplicitHydrogens();
144
+ const { atoms } = (0, openchemlib_utils_1.getAtoms)(molecule);
145
+ for (const [experiment, required] of Object.entries(spectra)) {
146
+ if (!required || predictedSpectra[experiment])
147
+ continue;
148
+ let message = '';
149
+ switch (experiment) {
150
+ case 'proton': {
151
+ message =
152
+ atoms.H - (0, openchemlib_utils_1.nbLabileH)(molecule) === 0
153
+ ? 'No non-labile hydrogen found in the molecule, the proton spectrum could not be predicted'
154
+ : `Proton was not predicted`;
155
+ break;
156
+ }
157
+ case 'carbon': {
158
+ message = `${experiment} was not predicted. ${!('C' in atoms) ? 'No carbons found in the molecule' : ''}`;
159
+ break;
160
+ }
161
+ case 'cosy':
162
+ message = !predictedSpectra.proton
163
+ ? `Proton prediction is missing, so COSY experiment can not be simulated`
164
+ : `There was a error in ${experiment.toUpperCase()} prediction`;
165
+ break;
166
+ case 'hsqc':
167
+ case 'hmbc':
168
+ if (!predictedSpectra[experiment]) {
169
+ missing2DPrediction.push(experiment);
170
+ }
171
+ break;
172
+ default:
173
+ break;
174
+ }
175
+ if (message.length > 0) {
176
+ logger.warn(message);
177
+ }
178
+ }
179
+ if (missing2DPrediction.length > 0) {
180
+ logger.warn(`Carbon or proton prediction are missing, so ${missing2DPrediction.length > 1
181
+ ? missing2DPrediction.join(' and ')
182
+ : missing2DPrediction[0]} can not be simulated`);
183
+ }
184
+ }
133
185
  function setPredictedSpectraReference(draft, moleculeId, spectraIds) {
134
186
  const predictedSpectraIds = draft.view.predictions?.[moleculeId];
135
187
  // check if the molecule predicted and return and the spectra Ids
@@ -3,13 +3,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.setSpectraMetaInfo = exports.handleOrderSpectra = exports.handleRecolorSpectraBasedOnDistinctValue = exports.handleToggleSpectraLegend = exports.handleImportSpectraMetaInfo = exports.handleGenerateSpectrumFromPublicationStringHandler = exports.handleAlignSpectraHandler = exports.handleAddMissingProjectionHandler = exports.handleDeleteSpectra = exports.handleChangeSpectrumSetting = exports.handleChangeActiveSpectrum = exports.handleChangeSpectraVisibilityByNucleus = exports.handleChangeSpectrumVisibilityById = void 0;
6
+ exports.setSpectraMetaInfo = exports.handleSimulateSpectrum = exports.handleOrderSpectra = exports.handleRecolorSpectraBasedOnDistinctValue = exports.handleToggleSpectraLegend = exports.handleImportSpectraMetaInfo = exports.handleGenerateSpectrumFromPublicationStringHandler = exports.handleAlignSpectraHandler = exports.handleAddMissingProjectionHandler = exports.handleDeleteSpectra = exports.handleChangeSpectrumSetting = exports.handleChangeActiveSpectrum = exports.handleChangeSpectraVisibilityByNucleus = exports.handleChangeSpectrumVisibilityById = void 0;
7
7
  const immer_1 = require("immer");
8
8
  const get_1 = __importDefault(require("lodash/get"));
9
9
  const omitBy_1 = __importDefault(require("lodash/omitBy"));
10
10
  const set_1 = __importDefault(require("lodash/set"));
11
11
  const nmr_processing_1 = require("nmr-processing");
12
12
  const Spectrum1D_1 = require("../../../data/data1d/Spectrum1D");
13
+ const spectrumSimulation_1 = require("../../../data/data1d/spectrumSimulation");
13
14
  const Spectrum2D_1 = require("../../../data/data2d/Spectrum2D");
14
15
  const contours_1 = require("../../../data/data2d/Spectrum2D/contours");
15
16
  const GroupByInfoKey_1 = __importDefault(require("../../utility/GroupByInfoKey"));
@@ -267,7 +268,7 @@ function handleAddMissingProjectionHandler(draft, action) {
267
268
  const { index } = activeSpectrum;
268
269
  const Spectrum2D = state.data[index];
269
270
  const { info, data } = Spectrum2D;
270
- for (let n of nucleus) {
271
+ for (const n of nucleus) {
271
272
  const datum1D = (0, Spectrum2D_1.getMissingProjection)(info.isFid ? data.re : data.rr, n, info, draft.usedColors);
272
273
  draft.data.push(datum1D);
273
274
  }
@@ -282,7 +283,7 @@ exports.handleAddMissingProjectionHandler = handleAddMissingProjectionHandler;
282
283
  //action
283
284
  function handleAlignSpectraHandler(draft, action) {
284
285
  if (draft.data && draft.data.length > 0) {
285
- for (let datum of draft.data) {
286
+ for (const datum of draft.data) {
286
287
  if (datum.info?.dimension === 1 &&
287
288
  datum.info.nucleus === draft.view.spectra.activeTab &&
288
289
  !datum.info?.isFid) {
@@ -386,3 +387,42 @@ function handleOrderSpectra(draft, action) {
386
387
  .concat(sortedSpectra);
387
388
  }
388
389
  exports.handleOrderSpectra = handleOrderSpectra;
390
+ function handleSimulateSpectrum(draft, simulateSpectrumOptions) {
391
+ const { payload: { spinSystem, data, options, keepSpectrum = false }, } = simulateSpectrumOptions;
392
+ const { x, y } = (0, spectrumSimulation_1.simulateSpectrum)(spinSystem, {
393
+ data,
394
+ options,
395
+ });
396
+ let spectrumIndex = -1;
397
+ if (!keepSpectrum && draft.view.currentSimulatedSpectrumKey) {
398
+ spectrumIndex = draft.data.findIndex((s) => s.id === draft.view.currentSimulatedSpectrumKey);
399
+ }
400
+ const { frequency, to, from } = options;
401
+ const info = {
402
+ originFrequency: frequency,
403
+ baseFrequency: frequency,
404
+ name: spinSystem,
405
+ };
406
+ if (spectrumIndex !== -1) {
407
+ const spectrum = draft.data[spectrumIndex];
408
+ spectrum.data = { x, re: y };
409
+ spectrum.info = { ...spectrum.info, ...info };
410
+ const [x1, x2] = draft.originDomain.xDomain;
411
+ const isInXDomain = to - from <= x2 - x1;
412
+ (0, DomainActions_1.setDomain)(draft, { updateYDomain: false, updateXDomain: !isInXDomain });
413
+ }
414
+ else {
415
+ const spectrum = (0, Spectrum1D_1.initiateDatum1D)({
416
+ data: { x, re: y },
417
+ info: {
418
+ isFt: true,
419
+ nucleus: '1H',
420
+ ...info,
421
+ },
422
+ }, { usedColors: draft.usedColors });
423
+ draft.data.push(spectrum);
424
+ draft.view.currentSimulatedSpectrumKey = spectrum.id;
425
+ (0, ToolsActions_1.setActiveTab)(draft);
426
+ }
427
+ }
428
+ exports.handleSimulateSpectrum = handleSimulateSpectrum;
@@ -350,10 +350,10 @@ function setDisplayerMode(draft, data) {
350
350
  }
351
351
  //utility
352
352
  function setTabActiveSpectrum(draft, dataGroupByTab) {
353
- let tabs2D = [];
353
+ const tabs2D = [];
354
354
  const tabActiveSpectrum = {};
355
355
  const tabkeys = Object.keys(dataGroupByTab).sort((a, b) => a.split(',').length > b.split(',').length ? -1 : 1);
356
- for (let tabKey of tabkeys) {
356
+ for (const tabKey of tabkeys) {
357
357
  const data = dataGroupByTab[tabKey];
358
358
  const nucleusLength = tabKey.split(',').length;
359
359
  if (nucleusLength === 2) {
@@ -82,7 +82,7 @@ function handleChangeZoneSignalDelta(draft, action) {
82
82
  if (activeSpectrum?.id) {
83
83
  const { index } = activeSpectrum;
84
84
  const { xShift, yShift } = (0, Spectrum2D_1.changeZoneSignal)(draft.data[index], zoneId, signal);
85
- let filters = [];
85
+ const filters = [];
86
86
  if (xShift !== 0) {
87
87
  filters.push({ name: nmr_processing_1.Filters.shift2DX.id, value: { shift: xShift } });
88
88
  }
@@ -5,7 +5,7 @@ const LocalStorage_1 = require("../../../utility/LocalStorage");
5
5
  function setActiveWorkspace(draft, action) {
6
6
  if (action.payload) {
7
7
  const { workspace } = action.payload;
8
- let localData = (0, LocalStorage_1.getLocalStorage)('nmr-general-settings');
8
+ const localData = (0, LocalStorage_1.getLocalStorage)('nmr-general-settings');
9
9
  draft.workspace.current = workspace;
10
10
  localData.currentWorkspace = workspace;
11
11
  (0, LocalStorage_1.storeData)('nmr-general-settings', JSON.stringify(localData));
@@ -9,15 +9,14 @@ const LocalStorage_1 = require("../../../utility/LocalStorage");
9
9
  const getActiveWorkspace_1 = require("../utilities/getActiveWorkspace");
10
10
  const mapNucleiFormatting_1 = require("../utilities/mapNucleiFormatting");
11
11
  function setPreferences(draft, action) {
12
- let localData = (0, LocalStorage_1.getLocalStorage)('nmr-general-settings');
12
+ const localData = (0, LocalStorage_1.getLocalStorage)('nmr-general-settings');
13
13
  const currentWorkspacePreferences = (0, getActiveWorkspace_1.getActiveWorkspace)(draft);
14
14
  if (action.payload) {
15
- let { formatting, ...restPreferences } = action.payload;
16
- formatting = (0, mapNucleiFormatting_1.mapNucleiFormatting)(formatting);
15
+ const { formatting, ...restPreferences } = action.payload;
17
16
  draft.workspaces[draft.workspace.current] = {
18
17
  ...currentWorkspacePreferences,
19
18
  ...restPreferences,
20
- formatting,
19
+ formatting: (0, mapNucleiFormatting_1.mapNucleiFormatting)(formatting),
21
20
  };
22
21
  }
23
22
  if (draft.workspaces[draft.workspace.current].source === 'user') {
@@ -49,6 +49,10 @@ exports.WORKSPACES = [
49
49
  key: 'embedded',
50
50
  label: workspaces_1.default.embedded.label,
51
51
  },
52
+ {
53
+ key: 'simulation',
54
+ label: workspaces_1.default.simulation.label,
55
+ },
52
56
  ];
53
57
  exports.preferencesInitialState = {
54
58
  version: LOCAL_STORAGE_VERSION,
@@ -62,7 +66,7 @@ exports.preferencesInitialState = {
62
66
  };
63
67
  function initPreferencesState(state) {
64
68
  const nmrLocalStorageVersion = (0, LocalStorage_1.getLocalStorage)('nmr-local-storage-version', false);
65
- let localData = (0, LocalStorage_1.getLocalStorage)('nmr-general-settings');
69
+ const localData = (0, LocalStorage_1.getLocalStorage)('nmr-general-settings');
66
70
  // remove old nmr-local-storage-version key
67
71
  if (nmrLocalStorageVersion && localData?.version) {
68
72
  (0, LocalStorage_1.removeData)('nmr-local-storage-version');
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.flatObject = void 0;
4
4
  function flatObject(data) {
5
- let result = {};
5
+ const result = {};
6
6
  JSON.parse(JSON.stringify(data), (key, value) => {
7
7
  if (value?.hidden !== true && key) {
8
8
  result[key] = result[key]++ || 1;
@@ -3,46 +3,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getBlob = exports.exportAsMatrix = exports.exportAsMol = exports.copyHTMLToClipboard = exports.copyTextToClipboard = exports.copyPNGToClipboard = exports.exportAsPng = exports.exportAsNMRE = exports.exportAsJSON = exports.exportAsSVG = void 0;
6
+ exports.getBlob = exports.exportAsMatrix = exports.exportAsMol = exports.copyPNGToClipboard = exports.exportAsPng = exports.exportAsNMRE = exports.exportAsJSON = exports.exportAsSVG = void 0;
7
7
  const file_saver_1 = require("file-saver");
8
8
  const jszip_1 = __importDefault(require("jszip"));
9
- async function copyHTMLToClipboard(data) {
10
- return copyToClipboard(data, 'text/html');
11
- }
12
- exports.copyHTMLToClipboard = copyHTMLToClipboard;
13
- async function copyTextToClipboard(data) {
14
- return copyToClipboard(data, 'text/plain');
15
- }
16
- exports.copyTextToClipboard = copyTextToClipboard;
17
- async function copyToClipboard(data, type) {
18
- try {
19
- if (typeof ClipboardItem !== 'undefined') {
20
- void navigator.clipboard.write([
21
- new ClipboardItem({
22
- [type]: new Promise((resolve) => {
23
- resolve(new Blob([data], { type }));
24
- }),
25
- }),
26
- ]);
27
- }
28
- else {
29
- const clipboard = await import('clipboard-polyfill');
30
- //TODO when Firefox team implement ClipboardItem this code should be removed
31
- // this library is used mainly to solve the problem of copy HTML to a clipboard in Firefox but we use it for both HTML and plain text
32
- const item = new clipboard.ClipboardItem({
33
- [type]: new Blob([data], { type }),
34
- });
35
- await clipboard.write([item]);
36
- }
37
- return true;
38
- }
39
- catch {
40
- return false;
41
- }
42
- }
9
+ const clipboard_1 = require("../../utils/clipboard/clipboard");
43
10
  /**
44
11
  * export the experiments result in JSON format
45
- * @param {*} data
12
+ * @param data
13
+ * @param fileName
14
+ * @param spaceIndent
15
+ * @param isCompressed
46
16
  */
47
17
  async function exportAsJSON(data, fileName = 'experiment', spaceIndent = 0, isCompressed = false) {
48
18
  const fileData = JSON.stringify(data, (key, value) => ArrayBuffer.isView(value) ? Array.from(value) : value, spaceIndent);
@@ -111,19 +81,19 @@ exports.exportAsSVG = exportAsSVG;
111
81
  function exportAsPng(rootRef, elementID, fileName = 'experiment') {
112
82
  const { blob, width, height } = getBlob(rootRef, elementID);
113
83
  try {
114
- let canvas = document.createElement('canvas');
84
+ const canvas = document.createElement('canvas');
115
85
  canvas.width = width;
116
86
  canvas.height = height;
117
- let context = canvas.getContext('2d');
87
+ const context = canvas.getContext('2d');
118
88
  if (context) {
119
89
  context.fillStyle = 'white';
120
90
  context.fillRect(0, 0, canvas.width, canvas.height);
121
91
  }
122
- let img = new Image();
123
- let url = URL.createObjectURL(blob);
92
+ const img = new Image();
93
+ const url = URL.createObjectURL(blob);
124
94
  img.addEventListener('load', () => {
125
95
  context?.drawImage(img, 0, 0);
126
- let png = canvas.toDataURL('image/png', 1);
96
+ const png = canvas.toDataURL('image/png', 1);
127
97
  (0, file_saver_1.saveAs)(png, `${fileName}.png`);
128
98
  URL.revokeObjectURL(png);
129
99
  });
@@ -151,42 +121,42 @@ function copyDataURLClipboardFireFox(image) {
151
121
  }
152
122
  function copyBlobToClipboard(canvas) {
153
123
  canvas.toBlob((b) => {
154
- const clip = new ClipboardItem({
155
- [b.type]: b,
156
- });
157
- navigator.clipboard.write([clip]).then(() => {
124
+ if (!b)
125
+ return;
126
+ (async () => {
127
+ const clip = await (0, clipboard_1.newClipboardItem)({
128
+ [b.type]: b,
129
+ });
130
+ await (0, clipboard_1.write)([clip]);
131
+ })()
132
+ .catch(() => {
133
+ const png = canvas.toDataURL('image/png', 1);
134
+ copyDataURLClipboardFireFox(png);
135
+ URL.revokeObjectURL(png);
136
+ })
137
+ .then(() => {
158
138
  // eslint-disable-next-line no-console
159
139
  console.log('experiment copied.');
160
- }, (error) => {
161
- // TODO: handle error;
162
- reportError(error);
163
- });
140
+ })
141
+ .catch(reportError);
164
142
  });
165
143
  }
166
144
  function copyPNGToClipboard(rootRef, elementID) {
167
145
  const { blob, width, height } = getBlob(rootRef, elementID);
168
146
  try {
169
- let canvas = document.createElement('canvas');
147
+ const canvas = document.createElement('canvas');
170
148
  canvas.width = width;
171
149
  canvas.height = height;
172
- let context = canvas.getContext('2d');
150
+ const context = canvas.getContext('2d');
173
151
  if (context) {
174
152
  context.fillStyle = 'white';
175
153
  context.fillRect(0, 0, canvas.width, canvas.height);
176
154
  }
177
- let img = new Image();
155
+ const img = new Image();
178
156
  const url = URL.createObjectURL(blob);
179
- img.addEventListener('load', async () => {
157
+ img.addEventListener('load', () => {
180
158
  context?.drawImage(img, 0, 0);
181
- const png = canvas.toDataURL('image/png', 1);
182
- // @ts-expect-error write exists in some browsers
183
- if (navigator.clipboard.write) {
184
- copyBlobToClipboard(canvas);
185
- }
186
- else {
187
- copyDataURLClipboardFireFox(png);
188
- }
189
- URL.revokeObjectURL(png);
159
+ copyBlobToClipboard(canvas);
190
160
  });
191
161
  img.src = url;
192
162
  }
@@ -201,7 +171,7 @@ function copyPNGToClipboard(rootRef, elementID) {
201
171
  }
202
172
  exports.copyPNGToClipboard = copyPNGToClipboard;
203
173
  function getBlob(rootRef, elementID) {
204
- let _svg = rootRef.getRootNode()
174
+ const _svg = rootRef.getRootNode()
205
175
  .querySelector(`#${elementID}`)
206
176
  ?.cloneNode(true);
207
177
  const width = Number(_svg?.getAttribute('width').replace('px', ''));
@@ -19,7 +19,7 @@ function lookForObjectsPaths(obj, path, output) {
19
19
  path = [];
20
20
  }
21
21
  else {
22
- for (let key in obj) {
22
+ for (const key in obj) {
23
23
  lookForObjectsPaths(obj[key], [...path.slice(), key], output);
24
24
  }
25
25
  }
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getUniqueNuclei = void 0;
4
4
  function getUniqueNuclei(nuclei) {
5
- let uniqueNuclei = {};
5
+ const uniqueNuclei = {};
6
6
  for (const nucleus of nuclei) {
7
7
  const _nuclei = nucleus.split(',');
8
8
  for (const _nucleus of _nuclei) {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.jpathToArray = void 0;
4
4
  function jpathToArray(jpath, separator = '.') {
5
- let keys = [];
5
+ const keys = [];
6
6
  let key = '';
7
7
  let findSeparator = false;
8
8
  const length = jpath.length;
@@ -6,6 +6,7 @@ const embedded_1 = require("./embedded");
6
6
  const exercise_1 = require("./exercise");
7
7
  const prediction_1 = require("./prediction");
8
8
  const process1D_1 = require("./process1D");
9
+ const simulation_1 = require("./simulation");
9
10
  exports.default = {
10
11
  exercise: exercise_1.exercise,
11
12
  default: basic_1.basic,
@@ -13,4 +14,5 @@ exports.default = {
13
14
  prediction: prediction_1.prediction,
14
15
  assignment: assignment_1.assignment,
15
16
  embedded: embedded_1.embedded,
17
+ simulation: simulation_1.simulation,
16
18
  };
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.simulation = void 0;
4
+ exports.simulation = {
5
+ version: 1,
6
+ label: 'Simulation',
7
+ general: {
8
+ dimmedSpectraOpacity: 0.5,
9
+ verticalSplitterPosition: '440px',
10
+ verticalSplitterCloseThreshold: 600,
11
+ spectraRendering: 'auto',
12
+ loggingLevel: 'info',
13
+ },
14
+ display: {
15
+ panels: {
16
+ spectraPanel: { display: true },
17
+ simulationPanel: { display: true, open: true },
18
+ },
19
+ toolBarButtons: {
20
+ exportAs: true,
21
+ import: true,
22
+ spectraCenterAlignments: true,
23
+ spectraStackAlignments: true,
24
+ zoomOut: true,
25
+ zoom: true,
26
+ },
27
+ },
28
+ formatting: {
29
+ nuclei: {},
30
+ panels: {
31
+ spectra: {
32
+ nuclei: {
33
+ '1H': {
34
+ columns: [
35
+ {
36
+ name: 'visible',
37
+ label: '',
38
+ description: 'Show/Hide Spectrum',
39
+ visible: true,
40
+ },
41
+ {
42
+ name: 'name',
43
+ label: 'Spectrum Name',
44
+ description: 'Spectrum Name',
45
+ jpath: ['info', 'name'],
46
+ visible: true,
47
+ },
48
+ {
49
+ label: 'Frequency',
50
+ description: 'frequency',
51
+ jpath: ['info', 'originFrequency'],
52
+ visible: true,
53
+ },
54
+ {
55
+ jpath: ['info', 'nucleus'],
56
+ label: 'Experiment',
57
+ visible: true,
58
+ },
59
+ {
60
+ name: 'color',
61
+ label: '',
62
+ description: 'Spectrum Color',
63
+ visible: true,
64
+ },
65
+ ],
66
+ },
67
+ },
68
+ },
69
+ },
70
+ },
71
+ };
@@ -24,6 +24,7 @@ exports.workspaceDefaultProperties = {
24
24
  peaksPanel: { display: false, open: false },
25
25
  predictionPanel: { display: false, open: false },
26
26
  summaryPanel: { display: false, open: false },
27
+ simulationPanel: { display: false, open: false },
27
28
  },
28
29
  toolBarButtons: {
29
30
  baselineCorrection: false,