nmrium 0.42.0 → 0.43.1-pre.1692874523

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/ApodizationLine.js +1 -1
  2. package/lib/component/1d/Chart1D.js +3 -2
  3. package/lib/component/1d/ExclusionZonesAnnotations.js +1 -2
  4. package/lib/component/1d/Line.js +1 -1
  5. package/lib/component/1d/Viewer1D.js +15 -3
  6. package/lib/component/1d/integral/IntegralResizable.js +4 -3
  7. package/lib/component/1d/multiAnalysis/AnalysisRange.js +3 -1
  8. package/lib/component/1d/peaks/PeakAnnotations.js +20 -25
  9. package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.d.ts +2 -0
  10. package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.js +59 -0
  11. package/lib/component/1d/peaks/PeakEditionManager.d.ts +18 -0
  12. package/lib/component/1d/peaks/PeakEditionManager.js +98 -0
  13. package/lib/component/1d/peaks/Peaks.d.ts +1 -0
  14. package/lib/component/1d/peaks/Peaks.js +22 -0
  15. package/lib/component/1d/ranges/Range.js +3 -1
  16. package/lib/component/1d/tool/BaseLineZones.d.ts +1 -1
  17. package/lib/component/1d/tool/BaseLineZones.js +11 -31
  18. package/lib/component/1d/utilities/intersectionResolver.d.ts +25 -0
  19. package/lib/component/1d/utilities/intersectionResolver.js +71 -0
  20. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.d.ts +2 -2
  21. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +17 -16
  22. package/lib/component/1d-2d/components/FloatMoleculeStructures/index.d.ts +2 -2
  23. package/lib/component/2d/SlicingView.js +1 -1
  24. package/lib/component/2d/Viewer2D.js +1 -3
  25. package/lib/component/2d/ft/Contours.js +1 -1
  26. package/lib/component/EventsTrackers/KeysListenerTracker.d.ts +5 -1
  27. package/lib/component/EventsTrackers/KeysListenerTracker.js +48 -8
  28. package/lib/component/assignment/index.d.ts +6 -1
  29. package/lib/component/assignment/index.js +5 -1
  30. package/lib/component/context/DispatchContext.d.ts +3 -2
  31. package/lib/component/context/KeyModifierContext.d.ts +13 -0
  32. package/lib/component/context/KeyModifierContext.js +39 -0
  33. package/lib/component/context/PreferencesContext.d.ts +39 -39
  34. package/lib/component/elements/Button.js +2 -0
  35. package/lib/component/elements/CounterLabel.d.ts +7 -0
  36. package/lib/component/elements/CounterLabel.js +12 -0
  37. package/lib/component/elements/EditableColumn.js +12 -6
  38. package/lib/component/elements/Input.d.ts +3 -12
  39. package/lib/component/elements/Input.js +24 -76
  40. package/lib/component/elements/Message.js +0 -1
  41. package/lib/component/elements/NumberInput.d.ts +1 -0
  42. package/lib/component/elements/NumberInput.js +10 -3
  43. package/lib/component/elements/PreferencesButton.d.ts +4 -0
  44. package/lib/component/elements/PreferencesButton.js +6 -0
  45. package/lib/component/elements/formik/FormikInput.d.ts +2 -2
  46. package/lib/component/elements/formik/FormikInput.js +3 -6
  47. package/lib/component/elements/formik/FormikOnChange.js +1 -1
  48. package/lib/component/elements/popup/Modal/ConfirmDialog.js +1 -1
  49. package/lib/component/header/ApodizationOptionsPanel.js +23 -14
  50. package/lib/component/header/BaseLineCorrectionPanel.js +31 -10
  51. package/lib/component/header/Header.d.ts +10 -3
  52. package/lib/component/header/Header.js +6 -6
  53. package/lib/component/header/ZeroFillingOptionsPanel.js +37 -31
  54. package/lib/component/highlight/index.d.ts +1 -0
  55. package/lib/component/highlight/index.js +1 -0
  56. package/lib/component/hooks/useActiveSpectrumPeaksViewState.js +1 -0
  57. package/lib/component/hooks/useCheckToolsVisibility.js +7 -3
  58. package/lib/component/hooks/useResizerStatus.d.ts +2 -0
  59. package/lib/component/hooks/useResizerStatus.js +7 -0
  60. package/lib/component/hooks/useSpectrum.js +1 -1
  61. package/lib/component/main/ErrorOverlay.js +20 -0
  62. package/lib/component/main/InnerNMRium.d.ts +7 -0
  63. package/lib/component/main/InnerNMRium.js +52 -0
  64. package/lib/component/main/InnerNMRiumContents.d.ts +14 -0
  65. package/lib/component/main/InnerNMRiumContents.js +88 -0
  66. package/lib/component/main/NMRium.d.ts +23 -0
  67. package/lib/component/main/NMRium.js +13 -0
  68. package/lib/component/main/NMRiumStateProvider.d.ts +9 -0
  69. package/lib/component/main/NMRiumStateProvider.js +74 -0
  70. package/lib/component/{SplitPaneWrapper.js → main/SplitPaneWrapper.js} +1 -1
  71. package/lib/component/main/StateError.d.ts +4 -0
  72. package/lib/component/main/StateError.js +16 -0
  73. package/lib/component/main/index.d.ts +3 -0
  74. package/lib/component/main/index.js +3 -0
  75. package/lib/component/main/types.d.ts +18 -0
  76. package/lib/component/main/types.js +2 -0
  77. package/lib/component/modal/AlignSpectraModal.js +78 -29
  78. package/lib/component/modal/MoleculeStructureEditorModal.d.ts +5 -1
  79. package/lib/component/modal/MoleculeStructureEditorModal.js +12 -15
  80. package/lib/component/modal/MultipletAnalysisModal.js +1 -1
  81. package/lib/component/modal/PredictSpectraModal.js +1 -1
  82. package/lib/component/modal/{AboutUsModal.js → aboutUs/AboutUsModal.js} +4 -3
  83. package/lib/component/modal/aboutUs/AboutUsZakodium.d.ts +1 -0
  84. package/lib/component/modal/aboutUs/AboutUsZakodium.js +33 -0
  85. package/lib/component/modal/changeSum/ChangeSumModal.d.ts +5 -16
  86. package/lib/component/modal/changeSum/ChangeSumModal.js +6 -115
  87. package/lib/component/modal/changeSum/ChangeSumModalContents.d.ts +18 -0
  88. package/lib/component/modal/changeSum/ChangeSumModalContents.js +94 -0
  89. package/lib/component/modal/metaImportation/MetaImportationModal.js +1 -1
  90. package/lib/component/modal/setting/GeneralSettings.js +2 -2
  91. package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.d.ts +1 -1
  92. package/lib/component/modal/setting/settings-tabs/GeneralTabContent.js +1 -1
  93. package/lib/component/modal/setting/settings-tabs/ImportationFiltersTabContent.js +1 -1
  94. package/lib/component/modal/setting/settingsValidation.js +5 -1
  95. package/lib/component/panels/InformationPanel.js +9 -100
  96. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +6 -11
  97. package/lib/component/panels/IntegralsPanel/IntegralTable.js +1 -1
  98. package/lib/component/panels/MoleculesPanel/MoleculePanel.js +2 -2
  99. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -4
  100. package/lib/component/panels/MoleculesPanel/Utilities.d.ts +3 -9
  101. package/lib/component/panels/MoleculesPanel/Utilities.js +14 -10
  102. package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts +13 -9
  103. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +8 -9
  104. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +5 -5
  105. package/lib/component/panels/Panels.js +6 -7
  106. package/lib/component/panels/PeaksPanel/PeaksPanel.js +11 -5
  107. package/lib/component/panels/PeaksPanel/PeaksTable.js +1 -1
  108. package/lib/component/panels/RangesPanel/RangesHeader.js +6 -10
  109. package/lib/component/panels/RangesPanel/TableColumns/RelativeColumn.js +1 -1
  110. package/lib/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +1 -1
  111. package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +1 -2
  112. package/lib/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +1 -1
  113. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +2 -2
  114. package/lib/component/panels/SummaryPanel/SummaryPanel.js +6 -6
  115. package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +2 -3
  116. package/lib/component/panels/SummaryPanel/utilities/Utilities.js +2 -3
  117. package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +8 -9
  118. package/lib/component/panels/ZonesPanel/ZonesPanel.js +3 -2
  119. package/lib/component/panels/ZonesPanel/ZonesPreferences.js +1 -1
  120. package/lib/component/panels/databasePanel/DatabasePanel.d.ts +18 -1
  121. package/lib/component/panels/databasePanel/DatabasePanel.js +3 -40
  122. package/lib/component/panels/databasePanel/DatabaseSearchOptions.d.ts +18 -0
  123. package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +53 -0
  124. package/lib/component/panels/header/DefaultPanelHeader.d.ts +3 -4
  125. package/lib/component/panels/header/DefaultPanelHeader.js +11 -13
  126. package/lib/component/panels/predictionPanel/PredictionPanel.js +3 -3
  127. package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +0 -1
  128. package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +1 -1
  129. package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -2
  130. package/lib/component/reducer/IgnoreActions.js +1 -1
  131. package/lib/component/reducer/Reducer.d.ts +3 -8
  132. package/lib/component/reducer/Reducer.js +34 -8
  133. package/lib/component/reducer/actions/DomainActions.js +2 -3
  134. package/lib/component/reducer/actions/FiltersActions.d.ts +32 -11
  135. package/lib/component/reducer/actions/FiltersActions.js +96 -28
  136. package/lib/component/reducer/actions/IntegralsActions.d.ts +6 -2
  137. package/lib/component/reducer/actions/IntegralsActions.js +44 -20
  138. package/lib/component/reducer/actions/MoleculeActions.js +4 -4
  139. package/lib/component/reducer/actions/PeaksActions.d.ts +6 -4
  140. package/lib/component/reducer/actions/PeaksActions.js +19 -1
  141. package/lib/component/reducer/actions/PreferencesActions.js +1 -2
  142. package/lib/component/reducer/actions/RangesActions.d.ts +6 -2
  143. package/lib/component/reducer/actions/RangesActions.js +31 -3
  144. package/lib/component/reducer/actions/ToolsActions.js +10 -10
  145. package/lib/component/reducer/core/Constants.d.ts +0 -4
  146. package/lib/component/reducer/core/Constants.js +0 -5
  147. package/lib/component/reducer/helper/ZoomHistoryManager.js +1 -2
  148. package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
  149. package/lib/component/reducer/preferences/utilities/getPreferencesByWorkspace.d.ts +1 -1
  150. package/lib/component/toolbar/FunctionToolBar.js +13 -3
  151. package/lib/component/toolbar/ToolTypes.d.ts +3 -2
  152. package/lib/component/toolbar/ToolTypes.js +57 -22
  153. package/lib/component/utility/export.js +7 -4
  154. package/lib/component/utility/filterType.d.ts +3 -0
  155. package/lib/component/utility/filterType.js +1 -0
  156. package/lib/component/workspaces/basic.js +2 -0
  157. package/lib/component/workspaces/embedded.js +2 -0
  158. package/lib/component/workspaces/exercise.js +2 -0
  159. package/lib/component/workspaces/prediction.js +9 -0
  160. package/lib/component/workspaces/process1D.js +2 -0
  161. package/lib/component/workspaces/workspaceDefaultProperties.js +2 -0
  162. package/lib/data/PredictionManager.d.ts +3 -3
  163. package/lib/data/PredictionManager.js +10 -10
  164. package/lib/data/constants/References.d.ts +5 -3
  165. package/lib/data/data1d/Spectrum1D/getReferenceShift.d.ts +10 -1
  166. package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +1 -2
  167. package/lib/data/data1d/Spectrum1D/ranges/addRange.js +2 -8
  168. package/lib/data/data1d/Spectrum1D/ranges/detectSignal.js +1 -1
  169. package/lib/data/molecules/Molecule.js +2 -2
  170. package/lib/data/utilities/checkModifierKeyActivated.d.ts +1 -1
  171. package/lib/data/utilities/checkModifierKeyActivated.js +8 -13
  172. package/lib/versionInfo.js +1 -1
  173. package/lib-cjs/component/1d/ApodizationLine.js +1 -1
  174. package/lib-cjs/component/1d/Chart1D.js +3 -2
  175. package/lib-cjs/component/1d/ExclusionZonesAnnotations.js +1 -2
  176. package/lib-cjs/component/1d/Line.js +1 -1
  177. package/lib-cjs/component/1d/Viewer1D.js +15 -3
  178. package/lib-cjs/component/1d/integral/IntegralResizable.js +4 -3
  179. package/lib-cjs/component/1d/multiAnalysis/AnalysisRange.js +3 -1
  180. package/lib-cjs/component/1d/peaks/PeakAnnotations.js +19 -24
  181. package/lib-cjs/component/1d/peaks/PeakAnnotationsSpreadMode.js +64 -0
  182. package/lib-cjs/component/1d/peaks/PeakEditionManager.js +129 -0
  183. package/lib-cjs/component/1d/peaks/Peaks.js +29 -0
  184. package/lib-cjs/component/1d/ranges/Range.js +3 -1
  185. package/lib-cjs/component/1d/tool/BaseLineZones.js +11 -34
  186. package/lib-cjs/component/1d/utilities/intersectionResolver.js +75 -0
  187. package/lib-cjs/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +17 -16
  188. package/lib-cjs/component/2d/SlicingView.js +1 -1
  189. package/lib-cjs/component/2d/Viewer2D.js +1 -3
  190. package/lib-cjs/component/2d/ft/Contours.js +1 -1
  191. package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +47 -7
  192. package/lib-cjs/component/assignment/index.js +5 -1
  193. package/lib-cjs/component/context/KeyModifierContext.js +44 -0
  194. package/lib-cjs/component/elements/Button.js +2 -0
  195. package/lib-cjs/component/elements/CounterLabel.js +16 -0
  196. package/lib-cjs/component/elements/EditableColumn.js +12 -6
  197. package/lib-cjs/component/elements/Input.js +23 -75
  198. package/lib-cjs/component/elements/Message.js +0 -1
  199. package/lib-cjs/component/elements/NumberInput.js +12 -2
  200. package/lib-cjs/component/elements/PreferencesButton.js +13 -0
  201. package/lib-cjs/component/elements/formik/FormikInput.js +3 -6
  202. package/lib-cjs/component/elements/formik/FormikOnChange.js +1 -1
  203. package/lib-cjs/component/elements/popup/Modal/ConfirmDialog.js +1 -1
  204. package/lib-cjs/component/header/ApodizationOptionsPanel.js +23 -14
  205. package/lib-cjs/component/header/BaseLineCorrectionPanel.js +30 -9
  206. package/lib-cjs/component/header/Header.js +6 -6
  207. package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +35 -29
  208. package/lib-cjs/component/highlight/index.js +1 -0
  209. package/lib-cjs/component/hooks/useActiveSpectrumPeaksViewState.js +1 -0
  210. package/lib-cjs/component/hooks/useCheckToolsVisibility.js +7 -3
  211. package/lib-cjs/component/hooks/useResizerStatus.js +11 -0
  212. package/lib-cjs/component/hooks/useSpectrum.js +1 -1
  213. package/lib-cjs/component/main/ErrorOverlay.js +26 -0
  214. package/lib-cjs/component/main/InnerNMRium.js +82 -0
  215. package/lib-cjs/component/main/InnerNMRiumContents.js +95 -0
  216. package/lib-cjs/component/main/NMRium.js +19 -0
  217. package/lib-cjs/component/main/NMRiumStateProvider.js +80 -0
  218. package/lib-cjs/component/{SplitPaneWrapper.js → main/SplitPaneWrapper.js} +1 -1
  219. package/lib-cjs/component/main/StateError.js +20 -0
  220. package/lib-cjs/component/main/index.js +21 -0
  221. package/lib-cjs/component/main/types.js +3 -0
  222. package/lib-cjs/component/modal/AlignSpectraModal.js +100 -28
  223. package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +11 -17
  224. package/lib-cjs/component/modal/MultipletAnalysisModal.js +1 -1
  225. package/lib-cjs/component/modal/PredictSpectraModal.js +1 -1
  226. package/lib-cjs/component/modal/{AboutUsModal.js → aboutUs/AboutUsModal.js} +4 -3
  227. package/lib-cjs/component/modal/aboutUs/AboutUsZakodium.js +39 -0
  228. package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +6 -141
  229. package/lib-cjs/component/modal/changeSum/ChangeSumModalContents.js +124 -0
  230. package/lib-cjs/component/modal/metaImportation/MetaImportationModal.js +1 -1
  231. package/lib-cjs/component/modal/setting/GeneralSettings.js +2 -2
  232. package/lib-cjs/component/modal/setting/settings-tabs/GeneralTabContent.js +1 -1
  233. package/lib-cjs/component/modal/setting/settings-tabs/ImportationFiltersTabContent.js +1 -1
  234. package/lib-cjs/component/modal/setting/settingsValidation.js +4 -0
  235. package/lib-cjs/component/panels/InformationPanel.js +7 -98
  236. package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +29 -11
  237. package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +1 -1
  238. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +2 -2
  239. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -4
  240. package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +14 -10
  241. package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +8 -9
  242. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +4 -4
  243. package/lib-cjs/component/panels/Panels.js +6 -7
  244. package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +32 -3
  245. package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +1 -1
  246. package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +29 -10
  247. package/lib-cjs/component/panels/RangesPanel/TableColumns/RelativeColumn.js +1 -1
  248. package/lib-cjs/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +1 -1
  249. package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +1 -2
  250. package/lib-cjs/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +1 -1
  251. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +2 -2
  252. package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +29 -6
  253. package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +4 -5
  254. package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +7 -8
  255. package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +26 -2
  256. package/lib-cjs/component/panels/ZonesPanel/ZonesPreferences.js +1 -1
  257. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +3 -40
  258. package/lib-cjs/component/panels/databasePanel/DatabaseSearchOptions.js +60 -0
  259. package/lib-cjs/component/panels/header/DefaultPanelHeader.js +12 -12
  260. package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +3 -3
  261. package/lib-cjs/component/panels/predictionPanel/PredictionSimpleOptions.js +0 -1
  262. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulation.js +1 -1
  263. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -2
  264. package/lib-cjs/component/reducer/IgnoreActions.js +1 -1
  265. package/lib-cjs/component/reducer/Reducer.js +33 -7
  266. package/lib-cjs/component/reducer/actions/DomainActions.js +2 -3
  267. package/lib-cjs/component/reducer/actions/FiltersActions.js +98 -28
  268. package/lib-cjs/component/reducer/actions/IntegralsActions.js +45 -20
  269. package/lib-cjs/component/reducer/actions/MoleculeActions.js +3 -3
  270. package/lib-cjs/component/reducer/actions/PeaksActions.js +20 -1
  271. package/lib-cjs/component/reducer/actions/PreferencesActions.js +1 -2
  272. package/lib-cjs/component/reducer/actions/RangesActions.js +31 -2
  273. package/lib-cjs/component/reducer/actions/ToolsActions.js +9 -9
  274. package/lib-cjs/component/reducer/core/Constants.js +1 -6
  275. package/lib-cjs/component/reducer/helper/ZoomHistoryManager.js +1 -2
  276. package/lib-cjs/component/toolbar/FunctionToolBar.js +13 -3
  277. package/lib-cjs/component/toolbar/ToolTypes.js +57 -22
  278. package/lib-cjs/component/utility/export.js +7 -4
  279. package/lib-cjs/component/utility/filterType.js +2 -0
  280. package/lib-cjs/component/workspaces/basic.js +2 -0
  281. package/lib-cjs/component/workspaces/embedded.js +2 -0
  282. package/lib-cjs/component/workspaces/exercise.js +2 -0
  283. package/lib-cjs/component/workspaces/prediction.js +9 -0
  284. package/lib-cjs/component/workspaces/process1D.js +2 -0
  285. package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +2 -0
  286. package/lib-cjs/data/PredictionManager.js +9 -9
  287. package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +1 -7
  288. package/lib-cjs/data/data1d/Spectrum1D/ranges/detectSignal.js +1 -1
  289. package/lib-cjs/data/molecules/Molecule.js +2 -2
  290. package/lib-cjs/data/utilities/checkModifierKeyActivated.js +8 -13
  291. package/lib-cjs/versionInfo.js +1 -1
  292. package/package.json +26 -25
  293. package/lib/component/1d/peaks/PeakAnnotation.d.ts +0 -12
  294. package/lib/component/1d/peaks/PeakAnnotation.js +0 -116
  295. package/lib/component/ErrorOverlay.js +0 -27
  296. package/lib/component/NMRium.d.ts +0 -42
  297. package/lib/component/NMRium.js +0 -237
  298. package/lib/component/reducer/actions/GlobalActions.d.ts +0 -9
  299. package/lib/component/reducer/actions/GlobalActions.js +0 -4
  300. package/lib-cjs/component/1d/peaks/PeakAnnotation.js +0 -118
  301. package/lib-cjs/component/ErrorOverlay.js +0 -30
  302. package/lib-cjs/component/NMRium.js +0 -267
  303. package/lib-cjs/component/reducer/actions/GlobalActions.js +0 -7
  304. /package/lib/component/{ErrorOverlay.d.ts → main/ErrorOverlay.d.ts} +0 -0
  305. /package/lib/component/{SplitPaneWrapper.d.ts → main/SplitPaneWrapper.d.ts} +0 -0
  306. /package/lib/component/modal/{AboutUsModal.d.ts → aboutUs/AboutUsModal.d.ts} +0 -0
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
27
  };
@@ -16,6 +39,10 @@ const Select_1 = __importDefault(require("../elements/Select"));
16
39
  const FormikInput_1 = __importDefault(require("../elements/formik/FormikInput"));
17
40
  const Events_1 = __importDefault(require("../utility/Events"));
18
41
  const ModalStyle_1 = require("./ModalStyle");
42
+ const ml_spectra_processing_1 = require("ml-spectra-processing");
43
+ const useSpectraPerNucleus_1 = __importDefault(require("../hooks/useSpectraPerNucleus"));
44
+ const Yup = __importStar(require("yup"));
45
+ const Message_1 = __importDefault(require("../elements/Message"));
19
46
  const labelStyle = {
20
47
  label: { flex: 4, fontWeight: '500' },
21
48
  wrapper: { flex: 8, display: 'flex', alignItems: 'center' },
@@ -27,44 +54,89 @@ const inputStyle = {
27
54
  },
28
55
  };
29
56
  const baseList = [{ key: 1, value: 'manual', label: 'Manual' }];
57
+ const DEFAULT_OPTIONS = {
58
+ from: -1,
59
+ to: 1,
60
+ nbPeaks: 1,
61
+ targetX: 0,
62
+ };
63
+ const schemaValidation = Yup.object({
64
+ from: Yup.number().required(),
65
+ to: Yup.number().required(),
66
+ nbPeaks: Yup.number().required(),
67
+ targetX: Yup.number().required(),
68
+ });
69
+ function checkSpectra(options, spectra) {
70
+ const { from, to } = options;
71
+ for (const spectrum of spectra) {
72
+ const { data: { x }, } = spectrum;
73
+ const min = x[0];
74
+ const max = x.at(-1);
75
+ if (from < min || to > max) {
76
+ throw new Error('Some spectra do not have data in the selected range');
77
+ }
78
+ if (Math.abs((0, ml_spectra_processing_1.xFindClosestIndex)(x, from) - (0, ml_spectra_processing_1.xFindClosestIndex)(x, to)) < 10) {
79
+ throw new Error('The selected range is too small to provide accurate results');
80
+ }
81
+ }
82
+ }
83
+ function checkOptions(options) {
84
+ const returnedOptions = { ...options };
85
+ if (options.from > options.to) {
86
+ returnedOptions.to = options.from;
87
+ returnedOptions.from = options.to;
88
+ }
89
+ return returnedOptions;
90
+ }
91
+ function getList(nucleus) {
92
+ if (!References_1.REFERENCES?.[nucleus]) {
93
+ return [];
94
+ }
95
+ const list = Object.entries(References_1.REFERENCES[nucleus]).map((item) => ({
96
+ value: item[0],
97
+ label: item[0],
98
+ }));
99
+ return baseList.concat(list);
100
+ }
30
101
  function AlignSpectraModal({ onClose = () => null, nucleus, }) {
31
- const refForm = (0, react_1.useRef)();
102
+ const spectra = (0, useSpectraPerNucleus_1.default)();
32
103
  const dispatch = (0, DispatchContext_1.useDispatch)();
33
- const List = (0, react_1.useMemo)(() => {
34
- const list = References_1.REFERENCES[nucleus]
35
- ? Object.entries(References_1.REFERENCES[nucleus]).map((item) => ({
36
- value: item[0],
37
- label: item[0],
38
- }))
39
- : [];
40
- return baseList.concat(list);
41
- }, [nucleus]);
42
- const handleSave = (0, react_1.useCallback)(() => {
43
- refForm.current.submitForm();
44
- }, []);
45
- const submitHandler = (0, react_1.useCallback)((values) => {
46
- dispatch({ type: 'ALIGN_SPECTRA', payload: values });
47
- onClose();
48
- }, [dispatch, onClose]);
104
+ const [options, setOptions] = (0, react_1.useState)(DEFAULT_OPTIONS);
105
+ const [error, setError] = (0, react_1.useState)('');
106
+ function submitHandler(inputOptions) {
107
+ const options = checkOptions(inputOptions);
108
+ setOptions(options);
109
+ try {
110
+ checkSpectra(options, spectra);
111
+ dispatch({ type: 'ALIGN_SPECTRA', payload: options });
112
+ onClose();
113
+ }
114
+ catch (error) {
115
+ const message = error.message;
116
+ setError(message);
117
+ }
118
+ }
49
119
  (0, react_1.useEffect)(() => {
50
120
  function handler(event) {
51
121
  const [from, to] = event.range;
52
- refForm.current.setValues({ ...refForm.current.values, from, to });
122
+ setOptions((prevOptions) => ({ ...prevOptions, from, to }));
53
123
  }
54
124
  Events_1.default.on('brushEnd', handler);
55
125
  return () => {
56
126
  Events_1.default.off('brushEnd', handler);
57
127
  };
58
128
  }, []);
59
- const optionChangeHandler = (0, react_1.useCallback)((id) => {
60
- const value = References_1.REFERENCES[nucleus][id];
61
- const { delta = 0, ...resValues } = value || { delta: 0 };
62
- refForm.current.setValues({
63
- ...refForm.current.values,
64
- targetX: delta,
65
- ...resValues,
66
- });
67
- }, [nucleus]);
68
- return ((0, jsx_runtime_1.jsxs)("div", { css: ModalStyle_1.ModalStyles, children: [(0, jsx_runtime_1.jsxs)("div", { className: "header handle", children: [(0, jsx_runtime_1.jsx)("span", { children: "Spectra calibration" }), (0, jsx_runtime_1.jsx)(CloseButton_1.default, { onClick: onClose, className: "close-bt" })] }), (0, jsx_runtime_1.jsx)("div", { className: "inner-content", style: { flex: 1 }, children: (0, jsx_runtime_1.jsx)(formik_1.Formik, { innerRef: refForm, initialValues: { from: -1, to: 1, nbPeaks: 1, targetX: 0 }, onSubmit: submitHandler, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "Options", style: labelStyle, children: (0, jsx_runtime_1.jsx)(Select_1.default, { items: List, style: { width: '100%', height: 30 }, onChange: optionChangeHandler }) }), (0, jsx_runtime_1.jsxs)(Label_1.default, { title: "Range", style: labelStyle, children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "From", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "from", type: "number", style: inputStyle }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "To", style: { label: { padding: '0 10px' } }, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "to", type: "number", style: inputStyle }) })] }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Number of Peaks", style: labelStyle, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "nbPeaks", type: "number", style: inputStyle }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Target PPM", style: labelStyle, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "targetX", type: "number", style: inputStyle }) })] }) }) }), (0, jsx_runtime_1.jsx)("div", { className: "footer-container", children: (0, jsx_runtime_1.jsx)(Button_1.default.Done, { onClick: handleSave, children: "Done" }) })] }));
129
+ function optionChangeHandler(key) {
130
+ const { delta: targetX = 0, ...otherOptions } = References_1.REFERENCES?.[nucleus]?.[key] || {};
131
+ const value = {
132
+ ...DEFAULT_OPTIONS,
133
+ targetX,
134
+ ...otherOptions,
135
+ };
136
+ setOptions(value);
137
+ setError('');
138
+ }
139
+ const List = getList(nucleus);
140
+ return ((0, jsx_runtime_1.jsx)("div", { css: ModalStyle_1.ModalStyles, children: (0, jsx_runtime_1.jsx)(formik_1.Formik, { initialValues: options, enableReinitialize: true, onSubmit: submitHandler, validationSchema: schemaValidation, validate: () => setError(''), children: ({ submitForm }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "header handle", children: [(0, jsx_runtime_1.jsx)("span", { children: "Spectra calibration" }), (0, jsx_runtime_1.jsx)(CloseButton_1.default, { onClick: onClose, className: "close-bt" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "inner-content", style: { flex: 1, minHeight: '220px' }, children: [error && (0, jsx_runtime_1.jsx)(Message_1.default, { type: "error", children: error }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Options", style: labelStyle, children: (0, jsx_runtime_1.jsx)(Select_1.default, { items: List, style: { width: '100%', height: 30 }, onChange: optionChangeHandler }) }), (0, jsx_runtime_1.jsxs)(Label_1.default, { title: "Range", style: labelStyle, children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "From", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "from", type: "number", style: inputStyle }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "To", style: { label: { padding: '0 10px' } }, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "to", type: "number", style: inputStyle }) })] }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Number of Peaks", style: labelStyle, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "nbPeaks", type: "number", style: inputStyle }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Target PPM", style: labelStyle, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "targetX", type: "number", style: inputStyle }) })] }), (0, jsx_runtime_1.jsx)("div", { className: "footer-container", children: (0, jsx_runtime_1.jsx)(Button_1.default.Done, { onClick: submitForm, children: "Done" }) })] })) }) }));
69
141
  }
70
142
  exports.default = AlignSpectraModal;
@@ -1,20 +1,14 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.useMoleculeEditor = void 0;
7
4
  const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
8
5
  /** @jsxImportSource @emotion/react */
9
6
  const react_1 = require("react");
10
7
  const full_1 = require("react-ocl/full");
8
+ const ui_1 = require("react-science/ui");
11
9
  const DispatchContext_1 = require("../context/DispatchContext");
12
- const ActionButtons_1 = __importDefault(require("../elements/ActionButtons"));
13
- const Modal_1 = require("../elements/popup/Modal");
14
- const options_1 = require("../elements/popup/options");
15
- const ModalStyle_1 = require("./ModalStyle");
16
10
  function MoleculeStructureEditorModal(props) {
17
- const { onClose = () => null, selectedMolecule, floatMoleculeOnSave = false, } = props;
11
+ const { onClose = () => null, selectedMolecule, floatMoleculeOnSave = false, isOpen = false, } = props;
18
12
  const [molfile, setMolfile] = (0, react_1.useState)(null);
19
13
  const dispatch = (0, DispatchContext_1.useDispatch)();
20
14
  (0, react_1.useEffect)(() => {
@@ -62,17 +56,17 @@ function MoleculeStructureEditorModal(props) {
62
56
  }
63
57
  }
64
58
  }, [molfile, selectedMolecule, dispatch, floatMoleculeOnSave, onClose]);
65
- return ((0, jsx_runtime_1.jsxs)("div", { css: ModalStyle_1.ModalStyles, children: [(0, jsx_runtime_1.jsx)(full_1.StructureEditor, { initialMolfile: selectedMolecule?.molfile, svgMenu: true, fragment: false, onChange: cb }), (0, jsx_runtime_1.jsx)("div", { className: "footer-container", children: (0, jsx_runtime_1.jsx)(ActionButtons_1.default, { style: { flexDirection: 'row-reverse', margin: 0 }, onDone: handleSave, doneLabel: "Save", onCancel: handleClose }) })] }));
59
+ return ((0, jsx_runtime_1.jsx)(ui_1.ConfirmModal, { headerColor: "transparent", isOpen: isOpen, onRequestClose: handleClose, onCancel: handleClose, onConfirm: handleSave, maxWidth: 700, children: (0, jsx_runtime_1.jsx)(ui_1.Modal.Body, { children: (0, jsx_runtime_1.jsx)(full_1.StructureEditor, { initialMolfile: selectedMolecule?.molfile, svgMenu: true, fragment: false, onChange: cb }) }) }));
66
60
  }
67
61
  function useMoleculeEditor(floatMoleculeOnSave = false) {
68
- const modal = (0, Modal_1.useModal)();
69
- return (0, react_1.useCallback)((molecule) => {
70
- modal.show((0, jsx_runtime_1.jsx)(MoleculeStructureEditorModal, { selectedMolecule: molecule, floatMoleculeOnSave: floatMoleculeOnSave }), {
71
- position: options_1.positions.TOP_CENTER,
72
- width: 700,
73
- height: 500,
74
- });
75
- }, [floatMoleculeOnSave, modal]);
62
+ const [isOpen, openModal, closeModal] = (0, ui_1.useOnOff)(false);
63
+ const [molecule, setMolecule] = (0, react_1.useState)();
64
+ const modal = ((0, jsx_runtime_1.jsx)(MoleculeStructureEditorModal, { selectedMolecule: molecule, floatMoleculeOnSave: floatMoleculeOnSave, onClose: closeModal, isOpen: isOpen }));
65
+ const openMoleculeEditor = (0, react_1.useCallback)((molecule) => {
66
+ setMolecule(molecule);
67
+ openModal();
68
+ }, [openModal]);
69
+ return { modal, openMoleculeEditor };
76
70
  }
77
71
  exports.useMoleculeEditor = useMoleculeEditor;
78
72
  exports.default = MoleculeStructureEditorModal;
@@ -131,7 +131,7 @@ function MultipletAnalysisModal({ data, activeSpectrum, scaleX, startX, endX, on
131
131
  try {
132
132
  const result = (0, multiplet_analysis_1.analyseMultiplet)(analysesProps, {
133
133
  frequency: info.originFrequency,
134
- minimalResolution: 0.3,
134
+ minimalResolution: 0.1,
135
135
  maxTestedJ: 17,
136
136
  takeBestPartMultiplet: true,
137
137
  correctVerticalOffset: true,
@@ -80,7 +80,7 @@ function PredictSpectraModal({ onClose = () => null, molecule, }) {
80
80
  closeDialog();
81
81
  const hideLoading = await alert.showLoading(`Predict ${predictedSpectra.join(',')} in progress`);
82
82
  try {
83
- const data = await (0, PredictionManager_1.predictSpectra)(molfile);
83
+ const data = await (0, PredictionManager_1.predictSpectra)(molfile, values.spectra);
84
84
  dispatch({
85
85
  type: 'PREDICT_SPECTRA',
86
86
  payload: {
@@ -8,8 +8,9 @@ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
8
8
  const react_1 = require("@emotion/react");
9
9
  const cheminfo_font_1 = require("cheminfo-font");
10
10
  const ui_1 = require("react-science/ui");
11
- const versionInfo_1 = __importDefault(require("../../versionInfo"));
12
- const Logo_1 = __importDefault(require("../elements/Logo"));
11
+ const versionInfo_1 = __importDefault(require("../../../versionInfo"));
12
+ const Logo_1 = __importDefault(require("../../elements/Logo"));
13
+ const AboutUsZakodium_1 = __importDefault(require("./AboutUsZakodium"));
13
14
  const styles = (0, react_1.css) `
14
15
  width: 40vw;
15
16
  min-width: 500px;
@@ -97,7 +98,7 @@ function AboutUsModal() {
97
98
  display: 'flex',
98
99
  alignItems: 'center',
99
100
  justifyContent: 'center',
100
- }, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgLogoNmrium, {}) }) }), (0, jsx_runtime_1.jsx)(ui_1.Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: closeDialog, maxWidth: 1000, children: (0, jsx_runtime_1.jsxs)("div", { css: styles, children: [(0, jsx_runtime_1.jsx)(ui_1.Modal.Header, { children: (0, jsx_runtime_1.jsx)("div", { className: "header", children: (0, jsx_runtime_1.jsx)("span", { children: "About NMRium" }) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "container", children: [(0, jsx_runtime_1.jsxs)("div", { className: "center-container", children: [(0, jsx_runtime_1.jsx)(Logo_1.default, { width: 160, height: 50 }), "Version ", (0, jsx_runtime_1.jsx)(VersionInfo, {}), (0, jsx_runtime_1.jsx)("span", { className: "separator" }), (0, jsx_runtime_1.jsx)("a", { href: "https://git.nmrium.org", target: "_blank", rel: "noreferrer", children: "GitHub ( https://git.nmrium.org )" })] }), (0, jsx_runtime_1.jsx)("div", { className: "center-container", children: (0, jsx_runtime_1.jsx)("span", { className: "separator" }) }), (0, jsx_runtime_1.jsx)("span", { className: "content", children: "This project is developed by Zakodium S\u00E0rl (Switzerland), the University of Cologne (Germany), Johannes Gutenberg University Mainz (Germany) and Universidad del Valle (Colombia)." }), (0, jsx_runtime_1.jsxs)("div", { className: "center-container", children: [(0, jsx_runtime_1.jsx)("span", { className: "separator" }), (0, jsx_runtime_1.jsx)("span", { className: "title", children: "Funding is provided by" }), (0, jsx_runtime_1.jsx)("span", { className: "separator" })] }), (0, jsx_runtime_1.jsx)("div", { className: "content", children: (0, jsx_runtime_1.jsxs)("ul", { children: [(0, jsx_runtime_1.jsx)("li", { children: "IDNMR grant, which part of the Scientific Library Services and Information Systems (LIS) initiative of the DFG." }), (0, jsx_runtime_1.jsx)("li", { children: "Zakodium S\u00E0rl (Switzerland)." }), (0, jsx_runtime_1.jsx)("li", { children: "Universidad del Valle (Cali, Colombia)." })] }) })] })] }) })] }));
101
+ }, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgLogoNmrium, {}) }) }), (0, jsx_runtime_1.jsx)(ui_1.Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: closeDialog, maxWidth: 1000, children: (0, jsx_runtime_1.jsxs)("div", { css: styles, children: [(0, jsx_runtime_1.jsx)(ui_1.Modal.Header, { children: (0, jsx_runtime_1.jsx)("div", { className: "header", children: (0, jsx_runtime_1.jsx)("span", { children: "About NMRium" }) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "container", children: [(0, jsx_runtime_1.jsxs)("div", { className: "center-container", children: [(0, jsx_runtime_1.jsx)(Logo_1.default, { width: 160, height: 50 }), "Version ", (0, jsx_runtime_1.jsx)(VersionInfo, {}), (0, jsx_runtime_1.jsx)("span", { className: "separator" }), (0, jsx_runtime_1.jsx)("a", { href: "https://git.nmrium.org", target: "_blank", rel: "noreferrer", children: "GitHub ( https://git.nmrium.org )" })] }), (0, jsx_runtime_1.jsx)("div", { className: "center-container", children: (0, jsx_runtime_1.jsx)("span", { className: "separator" }) }), (0, jsx_runtime_1.jsx)("span", { className: "content", children: "This project is developed by Zakodium S\u00E0rl (Switzerland), the University of Cologne (Germany), Johannes Gutenberg University Mainz (Germany) and Universidad del Valle (Colombia)." }), (0, jsx_runtime_1.jsxs)("div", { className: "center-container", children: [(0, jsx_runtime_1.jsx)("span", { className: "separator" }), (0, jsx_runtime_1.jsx)("span", { className: "title", children: "Funding is provided by" }), (0, jsx_runtime_1.jsx)("span", { className: "separator" })] }), (0, jsx_runtime_1.jsx)("div", { className: "content", children: (0, jsx_runtime_1.jsxs)("ul", { children: [(0, jsx_runtime_1.jsx)("li", { children: "IDNMR grant, which part of the Scientific Library Services and Information Systems (LIS) initiative of the DFG." }), (0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)(AboutUsZakodium_1.default, {}) }), (0, jsx_runtime_1.jsx)("li", { children: "Universidad del Valle (Cali, Colombia)." })] }) })] })] }) })] }));
101
102
  }
102
103
  exports.default = AboutUsModal;
103
104
  function VersionInfo() {
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const styled_1 = __importDefault(require("@emotion/styled"));
8
+ const ui_1 = require("react-science/ui");
9
+ const DispatchContext_1 = require("../../context/DispatchContext");
10
+ function AboutUsZakodium() {
11
+ const [isSecretOpen, openSecret] = (0, ui_1.useOnOff)();
12
+ function handleClick(event) {
13
+ if (event.shiftKey && event.altKey) {
14
+ openSecret();
15
+ }
16
+ }
17
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { onClick: handleClick, children: "Zakodium" }), ` Sàrl (Switzerland).`, isSecretOpen && (0, jsx_runtime_1.jsx)(SecretThrower, {})] }));
18
+ }
19
+ exports.default = AboutUsZakodium;
20
+ const ThrowerDiv = styled_1.default.div `
21
+ display: flex;
22
+ flex-direction: column;
23
+ gap: 1rem;
24
+ `;
25
+ /**
26
+ * This component is here for us so we can test the impact of thrown exceptions
27
+ * in the deployed application.
28
+ */
29
+ function SecretThrower() {
30
+ const [shouldThrow, setShouldThrow] = (0, ui_1.useOnOff)();
31
+ const dispatch = (0, DispatchContext_1.useDispatch)();
32
+ if (shouldThrow) {
33
+ throw new Error('Error thrown in React render');
34
+ }
35
+ return ((0, jsx_runtime_1.jsxs)(ThrowerDiv, { children: [(0, jsx_runtime_1.jsx)(ui_1.Button, { onClick: setShouldThrow, children: "Throw in React render" }), (0, jsx_runtime_1.jsx)(ui_1.Button, { onClick: () => dispatch({
36
+ type: 'SECRET_THROW_ERROR',
37
+ payload: { randomNumber: Math.random() },
38
+ }), children: "Throw in main reducer" })] }));
39
+ }
@@ -1,145 +1,10 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
2
  Object.defineProperty(exports, "__esModule", { value: true });
29
- const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
30
- /** @jsxImportSource @emotion/react */
31
- const react_1 = require("@emotion/react");
32
- const formik_1 = require("formik");
33
- const react_2 = require("react");
34
- const Yup = __importStar(require("yup"));
35
- const PreferencesContext_1 = require("../../context/PreferencesContext");
36
- const Button_1 = __importDefault(require("../../elements/Button"));
37
- const CloseButton_1 = __importDefault(require("../../elements/CloseButton"));
38
- const Tab_1 = __importDefault(require("../../elements/Tab/Tab"));
39
- const Tabs_1 = __importDefault(require("../../elements/Tab/Tabs"));
40
- const FormikInput_1 = __importDefault(require("../../elements/formik/FormikInput"));
41
- const ModalStyle_1 = require("../ModalStyle");
42
- const SelectMolecule_1 = __importDefault(require("./SelectMolecule"));
43
- const styles = (0, react_1.css) `
44
- width: 450px;
45
- height: 400px;
46
-
47
- .header {
48
- display: flex;
49
- padding: 10px;
50
-
51
- span {
52
- font-size: 14px;
53
- flex: 1;
54
- }
55
- }
56
-
57
- .tab-content {
58
- flex: 1;
59
- }
60
-
61
- .manual-container {
62
- padding: 30px 5px;
63
-
64
- .input {
65
- width: 80% !important;
66
- height: 36px;
67
- margin: 0 auto;
68
- }
69
-
70
- .input input {
71
- padding: 5px;
72
- text-align: center;
73
- }
74
- }
75
- `;
76
- var SumSetOptions;
77
- (function (SumSetOptions) {
78
- SumSetOptions["Auto"] = "auto";
79
- SumSetOptions["Manual"] = "manual";
80
- })(SumSetOptions || (SumSetOptions = {}));
81
- function getValidationSchema(option) {
82
- switch (option) {
83
- case SumSetOptions.Auto: {
84
- return Yup.object({
85
- molecule: Yup.object().required(),
86
- });
87
- }
88
- case SumSetOptions.Manual: {
89
- return Yup.object({
90
- sum: Yup.number().required(),
91
- });
92
- }
93
- default:
94
- return null;
95
- }
96
- }
97
- function ChangeSumModal({ onSave, onClose, header, sumOptions, }) {
98
- const { current: { display: { panels }, }, } = (0, PreferencesContext_1.usePreferences)();
99
- const [setOption, setActiveOption] = (0, react_2.useState)(SumSetOptions.Auto);
100
- const formRef = (0, react_2.useRef)(null);
101
- function handleKeyDown(event) {
102
- if (event.key === 'Enter') {
103
- formRef.current.submitForm();
104
- }
105
- }
106
- function onTabChangeHandler(tab) {
107
- setActiveOption(tab.tabid);
108
- }
109
- (0, react_2.useEffect)(() => {
110
- if (sumOptions?.sumAuto && panels?.structuresPanel?.display) {
111
- setActiveOption(SumSetOptions.Auto);
112
- const { mf, moleculeId: id } = sumOptions;
113
- formRef.current.setValues({
114
- sum: null,
115
- molecule: id && mf ? { mf, id } : null,
116
- });
117
- }
118
- else {
119
- setActiveOption(SumSetOptions.Manual);
120
- formRef.current.setValues({ sum: sumOptions?.sum ?? '', molecule: null });
121
- }
122
- }, [panels?.structuresPanel, sumOptions]);
123
- function saveHandler(values) {
124
- switch (setOption) {
125
- case SumSetOptions.Auto: {
126
- const { molecule: { mf, id: moleculeId }, } = values;
127
- onSave({ sumAuto: true, mf, moleculeId });
128
- break;
129
- }
130
- case SumSetOptions.Manual: {
131
- const { sum } = values;
132
- onSave({ sum, sumAuto: false });
133
- break;
134
- }
135
- default:
136
- return;
137
- }
138
- onClose();
139
- }
140
- const isStructurePanelVisible = panels?.structuresPanel?.display || false;
141
- return (
142
- // <div css={modalContainer}>
143
- (0, jsx_runtime_1.jsxs)("div", { css: [ModalStyle_1.ModalStyles, styles], children: [(0, jsx_runtime_1.jsxs)("div", { className: "header handle", children: [(0, jsx_runtime_1.jsx)("span", { children: header }), (0, jsx_runtime_1.jsx)(CloseButton_1.default, { onClick: onClose })] }), (0, jsx_runtime_1.jsx)("div", { className: "tab-content", children: (0, jsx_runtime_1.jsx)(formik_1.Formik, { innerRef: formRef, onSubmit: saveHandler, initialValues: { sum: '', molecule: null }, validationSchema: getValidationSchema(setOption), children: (0, jsx_runtime_1.jsxs)(Tabs_1.default, { activeTab: setOption, onClick: onTabChangeHandler, children: [isStructurePanelVisible && ((0, jsx_runtime_1.jsx)(Tab_1.default, { title: "Auto", tabid: SumSetOptions.Auto, children: (0, jsx_runtime_1.jsx)(SelectMolecule_1.default, { name: "molecule" }) })), (0, jsx_runtime_1.jsx)(Tab_1.default, { title: "Manual", tabid: SumSetOptions.Manual, children: (0, jsx_runtime_1.jsx)("div", { className: "manual-container", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "sum", type: "number", nullable: true, placeholder: "Enter the new value", onKeyDown: handleKeyDown }) }) })] }) }) }), (0, jsx_runtime_1.jsx)("div", { className: "footer-container", children: (0, jsx_runtime_1.jsx)(Button_1.default.Done, { onClick: () => formRef.current.submitForm(), style: { width: '80px' }, children: "Set" }) })] }));
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ const ui_1 = require("react-science/ui");
5
+ const ChangeSumModalContents_1 = require("./ChangeSumModalContents");
6
+ function ChangeSumModal({ renderButton, ...otherProps }) {
7
+ const [isOpenDialog, openDialog, closeDialog] = (0, ui_1.useOnOff)(false);
8
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [renderButton(openDialog), (0, jsx_runtime_1.jsx)(ui_1.Modal, { isOpen: isOpenDialog, onRequestClose: closeDialog, width: 500, height: 400, children: (0, jsx_runtime_1.jsx)(ChangeSumModalContents_1.ChangeSumModalContents, { ...otherProps, onClose: closeDialog }) })] }));
144
9
  }
145
10
  exports.default = ChangeSumModal;
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.ChangeSumModalContents = void 0;
30
+ const jsx_runtime_1 = require("react/jsx-runtime");
31
+ const styled_1 = __importDefault(require("@emotion/styled"));
32
+ const formik_1 = require("formik");
33
+ const react_1 = require("react");
34
+ const ui_1 = require("react-science/ui");
35
+ const Yup = __importStar(require("yup"));
36
+ const PreferencesContext_1 = require("../../context/PreferencesContext");
37
+ const Button_1 = __importDefault(require("../../elements/Button"));
38
+ const Tab_1 = __importDefault(require("../../elements/Tab/Tab"));
39
+ const Tabs_1 = __importDefault(require("../../elements/Tab/Tabs"));
40
+ const FormikInput_1 = __importDefault(require("../../elements/formik/FormikInput"));
41
+ const SelectMolecule_1 = __importDefault(require("./SelectMolecule"));
42
+ function getValidationSchema(option) {
43
+ switch (option) {
44
+ case 'auto': {
45
+ return Yup.object({
46
+ molecule: Yup.object().required(),
47
+ });
48
+ }
49
+ case 'manual': {
50
+ return Yup.object({
51
+ sum: Yup.number().required(),
52
+ });
53
+ }
54
+ default:
55
+ return null;
56
+ }
57
+ }
58
+ const ManualContainer = styled_1.default.div `
59
+ padding: 30px 5px;
60
+
61
+ .input {
62
+ width: 80% !important;
63
+ height: 36px;
64
+ margin: 0 auto;
65
+ }
66
+
67
+ .input input {
68
+ padding: 5px;
69
+ text-align: center;
70
+ }
71
+ `;
72
+ function ChangeSumModalContents(props) {
73
+ const { currentSum, sumType, sumOptions, onSave, onClose } = props;
74
+ const { current: { display: { panels }, }, } = (0, PreferencesContext_1.usePreferences)();
75
+ const [setOption, setActiveOption] = (0, react_1.useState)('auto');
76
+ const formRef = (0, react_1.useRef)(null);
77
+ (0, react_1.useEffect)(() => {
78
+ if (sumOptions?.sumAuto && panels?.structuresPanel?.display) {
79
+ setActiveOption('auto');
80
+ const { mf, moleculeId: id } = sumOptions;
81
+ formRef.current.setValues({
82
+ sum: null,
83
+ molecule: id && mf ? { mf, id } : null,
84
+ });
85
+ }
86
+ else {
87
+ setActiveOption('manual');
88
+ formRef.current.setValues({
89
+ sum: sumOptions?.sum ?? '',
90
+ molecule: null,
91
+ });
92
+ }
93
+ }, [panels?.structuresPanel, sumOptions]);
94
+ function handleKeyDown(event) {
95
+ if (event.key === 'Enter') {
96
+ formRef.current.submitForm();
97
+ }
98
+ }
99
+ function onTabChangeHandler(tab) {
100
+ setActiveOption(tab.tabid);
101
+ }
102
+ function saveHandler(values) {
103
+ switch (setOption) {
104
+ case 'auto': {
105
+ const { molecule: { mf, id: moleculeId }, } = values;
106
+ onSave({ sumAuto: true, mf, moleculeId });
107
+ break;
108
+ }
109
+ case 'manual': {
110
+ const { sum } = values;
111
+ onSave({ sum, sumAuto: false });
112
+ break;
113
+ }
114
+ default:
115
+ return;
116
+ }
117
+ onClose();
118
+ }
119
+ const isStructurePanelVisible = panels?.structuresPanel?.display || false;
120
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ui_1.Modal.Header, { children: currentSum
121
+ ? `Set new ${sumType} sum (Current: ${currentSum.toFixed(2)})`
122
+ : `Set new ${sumType} Sum` }), (0, jsx_runtime_1.jsx)(ui_1.Modal.Body, { children: (0, jsx_runtime_1.jsx)(formik_1.Formik, { innerRef: formRef, onSubmit: saveHandler, initialValues: { sum: '', molecule: null }, validationSchema: getValidationSchema(setOption), children: (0, jsx_runtime_1.jsxs)(Tabs_1.default, { activeTab: setOption, onClick: onTabChangeHandler, children: [isStructurePanelVisible && ((0, jsx_runtime_1.jsx)(Tab_1.default, { title: "Auto", tabid: "auto", children: (0, jsx_runtime_1.jsx)(SelectMolecule_1.default, { name: "molecule" }) })), (0, jsx_runtime_1.jsx)(Tab_1.default, { title: "Manual", tabid: "manual", children: (0, jsx_runtime_1.jsx)(ManualContainer, { children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "sum", type: "number", placeholder: "Enter the new value", onKeyDown: handleKeyDown }) }) })] }) }) }), (0, jsx_runtime_1.jsx)(ui_1.Modal.Footer, { children: (0, jsx_runtime_1.jsx)(Button_1.default.Done, { onClick: () => formRef.current.submitForm(), style: { width: 80 }, children: "Set" }) })] }));
123
+ }
124
+ exports.ChangeSumModalContents = ChangeSumModalContents;
@@ -212,7 +212,7 @@ function MetaImportationModal({ onClose, file }) {
212
212
  padding: '5px',
213
213
  fontSize: '14px',
214
214
  },
215
- }, placeholder: "Example: info.plus", datalist: datalist, nullable: true, mapOnChangeValue: (key) => paths?.[key] || null, mapValue: (paths) => (0, convertPathArrayToString_1.convertPathArrayToString)(paths) }) })] }) }), (0, jsx_runtime_1.jsx)(Button_1.default.Done, { onClick: () => formRef.current?.submitForm(), children: "Link Spectra" })] }), (0, jsx_runtime_1.jsx)("div", { style: { height: 'calc(100% - 160px)' }, children: (0, jsx_runtime_1.jsx)(ReactTable_1.default, { columns: columns, data: metaData, approxItemHeight: 25, approxColumnWidth: 100, enableVirtualScroll: true, enableColumnsVirtualScroll: true, activeRow: handleActiveRow, rowStyle: handleRowStyle }) })] })) }) }), (0, jsx_runtime_1.jsx)("div", { className: "footer-container", children: (0, jsx_runtime_1.jsx)(Button_1.default.Done, { onClick: handleImport, disabled: Object.keys(matches).length === 0, children: "Import" }) })] }));
215
+ }, placeholder: "Example: info.plus", datalist: datalist, mapOnChangeValue: (key) => paths?.[key] || null, mapValue: (paths) => (0, convertPathArrayToString_1.convertPathArrayToString)(paths) }) })] }) }), (0, jsx_runtime_1.jsx)(Button_1.default.Done, { onClick: () => formRef.current?.submitForm(), children: "Link Spectra" })] }), (0, jsx_runtime_1.jsx)("div", { style: { height: 'calc(100% - 160px)' }, children: (0, jsx_runtime_1.jsx)(ReactTable_1.default, { columns: columns, data: metaData, approxItemHeight: 25, approxColumnWidth: 100, enableVirtualScroll: true, enableColumnsVirtualScroll: true, activeRow: handleActiveRow, rowStyle: handleRowStyle }) })] })) }) }), (0, jsx_runtime_1.jsx)("div", { className: "footer-container", children: (0, jsx_runtime_1.jsx)(Button_1.default.Done, { onClick: handleImport, disabled: Object.keys(matches).length === 0, children: "Import" }) })] }));
216
216
  }
217
217
  function fileValidator(file) {
218
218
  if (!(0, parseMeta_1.isMetaFile)(file)) {
@@ -150,7 +150,7 @@ function GeneralSettingsModal({ height }) {
150
150
  }, [workspaces]);
151
151
  const handleReset = () => {
152
152
  const workSpaceDisplayPreferences = (0, getPreferencesByWorkspace_1.getPreferencesByWorkspace)(workspaceName, originalWorkspaces);
153
- refForm.current?.setValues(workSpaceDisplayPreferences);
153
+ void refForm.current?.setValues(workSpaceDisplayPreferences);
154
154
  };
155
155
  function submitHandler(values) {
156
156
  saveSettings(values);
@@ -215,7 +215,7 @@ function GeneralSettingsModal({ height }) {
215
215
  const setWorkspaceSetting = (0, react_2.useCallback)((inputWorkspace) => {
216
216
  const parseWorkspaceName = Object.keys(inputWorkspace)[0];
217
217
  if (preferences.workspace.current === parseWorkspaceName) {
218
- refForm.current?.setValues(inputWorkspace[parseWorkspaceName]);
218
+ void refForm.current?.setValues(inputWorkspace[parseWorkspaceName]);
219
219
  }
220
220
  else if (preferences.workspaces[parseWorkspaceName]) {
221
221
  pastRef.current = inputWorkspace;
@@ -40,6 +40,6 @@ const LOGS_LEVELS = [
40
40
  value: level,
41
41
  }));
42
42
  function GeneralTabContent() {
43
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(GroupPane_1.GroupPane, { text: "Spectra", children: (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Opacity of dimmed spectra [ 0 - 1 ]", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "general.dimmedSpectraOpacity", checkValue: (value) => Number(value) >= 0 && Number(value) <= 1, type: "number" }) }) }), (0, jsx_runtime_1.jsx)(GroupPane_1.GroupPane, { text: "Experimental features", children: (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Enable experimental features", htmlFor: "display.general.experimentalFeatures.display", children: (0, jsx_runtime_1.jsx)(FormikCheckBox_1.default, { name: "display.general.experimentalFeatures.display" }) }) }), (0, jsx_runtime_1.jsx)(GroupPane_1.GroupPane, { text: "Rendering", children: (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Spectra rendering ", children: (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { items: SHAPE_RENDERING, name: "general.spectraRendering", style: { width: '150px' } }) }) }), (0, jsx_runtime_1.jsx)(GroupPane_1.GroupPane, { text: "Logging settings", children: (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Level ", children: (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { items: LOGS_LEVELS, name: "general.loggingLevel", style: { width: '100px' } }) }) })] }));
43
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(GroupPane_1.GroupPane, { text: "Spectra", children: (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Opacity of dimmed spectra [ 0 - 1 ]", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "general.dimmedSpectraOpacity", checkValue: (value) => Number(value) >= 0 && Number(value) <= 1, type: "number", step: 0.1, min: 0, max: 1 }) }) }), (0, jsx_runtime_1.jsx)(GroupPane_1.GroupPane, { text: "Experimental features", children: (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Enable experimental features", htmlFor: "display.general.experimentalFeatures.display", children: (0, jsx_runtime_1.jsx)(FormikCheckBox_1.default, { name: "display.general.experimentalFeatures.display" }) }) }), (0, jsx_runtime_1.jsx)(GroupPane_1.GroupPane, { text: "Rendering", children: (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Spectra rendering ", children: (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { items: SHAPE_RENDERING, name: "general.spectraRendering", style: { width: '150px' } }) }) }), (0, jsx_runtime_1.jsx)(GroupPane_1.GroupPane, { text: "Logging settings", children: (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Level ", children: (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { items: LOGS_LEVELS, name: "general.loggingLevel", style: { width: '100px' } }) }) })] }));
44
44
  }
45
45
  exports.default = GeneralTabContent;
@@ -75,7 +75,7 @@ const COLUMNS = [
75
75
  case 'checkbox':
76
76
  return ((0, jsx_runtime_1.jsx)(CheckBoxCell_1.CheckBoxCell, { name: `nmrLoaders.${row.original.name}`, defaultValue: false }));
77
77
  case 'input':
78
- return ((0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: `nmrLoaders.${row.original.name}`, type: "string", style: { input: { width: '100%', padding: 0 } }, nullable: true }));
78
+ return ((0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: `nmrLoaders.${row.original.name}`, type: "string", style: { input: { width: '100%', padding: 0 } } }));
79
79
  case 'select':
80
80
  return ((0, jsx_runtime_1.jsx)(FormikSelect_1.default, { name: `nmrLoaders.${row.original.name}`, style: { width: '100%' }, items: row.original.options }));
81
81
  default: