nmrium 0.32.0 → 0.33.0-pre.1667632695

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 (453) hide show
  1. package/lib/component/1d/Chart1D.js +1 -1
  2. package/lib/component/1d/LinesSeries.js +1 -1
  3. package/lib/component/1d/SpectraTracker.js +1 -1
  4. package/lib/component/1d/Viewer1D.js +1 -1
  5. package/lib/component/1d/XAxis.js +1 -1
  6. package/lib/component/1d/database/DatabaseSpectrum.js +2 -1
  7. package/lib/component/1d/database/ResurrectedDatabaseRanges.js +2 -2
  8. package/lib/component/1d/{Integral.d.ts → integral/Integral.d.ts} +0 -0
  9. package/lib/component/1d/{Integral.js → integral/Integral.js} +2 -2
  10. package/lib/component/1d/integral/IntegralIndicator.d.ts +9 -0
  11. package/lib/component/1d/integral/IntegralIndicator.js +27 -0
  12. package/lib/component/1d/{IntegralResizable.d.ts → integral/IntegralResizable.d.ts} +0 -0
  13. package/lib/component/1d/integral/IntegralResizable.js +69 -0
  14. package/lib/component/1d/{IntegralsSeries.d.ts → integral/IntegralsSeries.d.ts} +0 -0
  15. package/lib/component/1d/{IntegralsSeries.js → integral/IntegralsSeries.js} +4 -4
  16. package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
  17. package/lib/component/1d/multiplicityTree/MultiplicityTree.js +4 -4
  18. package/lib/component/1d/multiplicityTree/buildTreeNode.js +3 -3
  19. package/lib/component/1d/peaks/PeakAnnotation.js +1 -1
  20. package/lib/component/1d/peaks/usePeakShapesPath.js +10 -6
  21. package/lib/component/1d/ranges/Range.js +27 -50
  22. package/lib/component/1d/tool/PeakPointer.js +1 -1
  23. package/lib/component/1d/utilities/scale.js +2 -2
  24. package/lib/component/2d/Contours.js +61 -42
  25. package/lib/component/2d/FooterBanner.js +2 -2
  26. package/lib/component/2d/Viewer2D.js +11 -14
  27. package/lib/component/2d/tools/XYLabelPointer.js +2 -2
  28. package/lib/component/2d/tools/slicing/VerticalSliceChart.js +1 -1
  29. package/lib/component/2d/zones/IndicationLines.js +5 -8
  30. package/lib/component/EventsTrackers/KeysListenerTracker.js +14 -15
  31. package/lib/component/NMRium.d.ts +1 -1
  32. package/lib/component/NMRium.js +6 -6
  33. package/lib/component/assignment/actions/initAssignment.js +17 -17
  34. package/lib/component/assignment/index.js +2 -2
  35. package/lib/component/context/PreferencesContext.js +3 -6
  36. package/lib/component/elements/Button.js +1 -1
  37. package/lib/component/elements/CheckBoxCell.js +1 -1
  38. package/lib/component/elements/ContextMenu.js +2 -2
  39. package/lib/component/elements/EditableColumn.js +3 -5
  40. package/lib/component/elements/GroupPane.d.ts +12 -0
  41. package/lib/component/elements/GroupPane.js +14 -0
  42. package/lib/component/elements/Input.js +7 -4
  43. package/lib/component/elements/IsotopesViewer.js +1 -1
  44. package/lib/component/elements/Label.js +1 -2
  45. package/lib/component/elements/MolecularFormulaInput.js +2 -0
  46. package/lib/component/elements/NumberInput.js +2 -2
  47. package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +1 -1
  48. package/lib/component/elements/ReactTable/ReactTable.d.ts +2 -1
  49. package/lib/component/elements/ReactTable/ReactTable.js +72 -38
  50. package/lib/component/elements/ReactTable/ReactTableFlexLayout.d.ts +3 -2
  51. package/lib/component/elements/ReactTable/ReactTableFlexLayout.js +2 -2
  52. package/lib/component/elements/ReactTable/utility/addCustomColumn.js +3 -3
  53. package/lib/component/elements/ReactTable/utility/useRowSpan.js +3 -7
  54. package/lib/component/elements/accordion/Accordion.js +2 -2
  55. package/lib/component/elements/draggble/useDraggable.js +1 -3
  56. package/lib/component/elements/dropDownButton/DropDownList.js +1 -2
  57. package/lib/component/elements/formik/FormikCheckBox.js +1 -1
  58. package/lib/component/elements/formik/FormikColorPicker.d.ts +0 -1
  59. package/lib/component/elements/formik/FormikColorPicker.js +5 -8
  60. package/lib/component/elements/formik/FormikErrorsSummary.js +2 -2
  61. package/lib/component/elements/formik/FormikForm.js +2 -2
  62. package/lib/component/elements/formik/FormikInput.d.ts +0 -1
  63. package/lib/component/elements/formik/FormikInput.js +12 -20
  64. package/lib/component/elements/formik/FormikOnChange.d.ts +1 -1
  65. package/lib/component/elements/formik/FormikOnChange.js +13 -10
  66. package/lib/component/elements/formik/FormikSelect.js +1 -1
  67. package/lib/component/elements/formik/FormikSlider.d.ts +2 -4
  68. package/lib/component/elements/formik/FormikSlider.js +8 -11
  69. package/lib/component/elements/formik/FormikTextarea.js +1 -1
  70. package/lib/component/elements/linearAxis/LinearVerticalAxis.js +2 -2
  71. package/lib/component/elements/popup/Alert/Provider.js +7 -7
  72. package/lib/component/elements/popup/Alert/index.d.ts +3 -4
  73. package/lib/component/elements/popup/Alert/index.js +3 -4
  74. package/lib/component/elements/popup/Modal/ModalContent.js +3 -1
  75. package/lib/component/elements/popup/Modal/Provider.js +16 -31
  76. package/lib/component/elements/popup/Modal/index.d.ts +4 -5
  77. package/lib/component/elements/popup/Modal/index.js +4 -5
  78. package/lib/component/header/Header.js +1 -1
  79. package/lib/component/hooks/useCombinedRefs.js +2 -2
  80. package/lib/component/hooks/useExport.d.ts +1 -1
  81. package/lib/component/hooks/useExport.js +9 -6
  82. package/lib/component/hooks/useFormatNumberByNucleus.js +1 -1
  83. package/lib/component/hooks/usePanelPreferences.js +9 -7
  84. package/lib/component/loader/DropZone.js +4 -4
  85. package/lib/component/modal/AlignSpectraModal.js +1 -1
  86. package/lib/component/modal/ExportAsMatrixModal.js +1 -1
  87. package/lib/component/modal/LoadJCAMPModal.js +2 -2
  88. package/lib/component/modal/MultipleSpectraFiltersModal/index.js +1 -1
  89. package/lib/component/modal/MultipletAnalysisModal.js +3 -3
  90. package/lib/component/modal/PredictSpectraModal.js +5 -5
  91. package/lib/component/modal/editRange/EditRangeModal.js +4 -4
  92. package/lib/component/modal/editRange/forms/components/SignalFormInfo.js +1 -1
  93. package/lib/component/modal/editRange/forms/validation/EditRangeValidation.js +2 -2
  94. package/lib/component/modal/setting/DatabasesTabContent.js +25 -20
  95. package/lib/component/modal/setting/DisplayTabContent.js +21 -27
  96. package/lib/component/modal/setting/FormattingTabContent.js +10 -10
  97. package/lib/component/modal/setting/GeneralSettings.js +11 -14
  98. package/lib/component/modal/setting/GeneralTabContent.js +3 -1
  99. package/lib/component/modal/setting/ToolsTabContent.js +18 -19
  100. package/lib/component/modal/setting/WorkspaceItem.d.ts +2 -1
  101. package/lib/component/modal/setting/WorkspaceItem.js +36 -48
  102. package/lib/component/modal/setting/settingsValidation.d.ts +58 -57
  103. package/lib/component/modal/setting/settingsValidation.js +14 -12
  104. package/lib/component/panels/AutomaticAssignment/useAutoAssignments.js +8 -7
  105. package/lib/component/panels/InformationPanel.js +52 -56
  106. package/lib/component/panels/IntegralsPanel/IntegralTable.js +1 -1
  107. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +1 -1
  108. package/lib/component/panels/MoleculesPanel/Utilities.js +6 -6
  109. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +16 -17
  110. package/lib/component/panels/MultipleSpectraAnalysisPanel/ColumnHeader.js +1 -1
  111. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleAnalysisCodeEditor.js +1 -1
  112. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
  113. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPreferences.js +18 -17
  114. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisTable.js +2 -2
  115. package/lib/component/panels/PeaksPanel/PeaksPanel.js +1 -1
  116. package/lib/component/panels/PeaksPanel/PeaksTable.js +2 -2
  117. package/lib/component/panels/RangesPanel/RangesHeader.js +1 -1
  118. package/lib/component/panels/RangesPanel/RangesPanel.js +1 -1
  119. package/lib/component/panels/RangesPanel/RangesTable.js +1 -1
  120. package/lib/component/panels/RangesPanel/RangesTableRow.js +1 -3
  121. package/lib/component/panels/RangesPanel/TableColumns/CouplingColumn.js +1 -1
  122. package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.js +2 -2
  123. package/lib/component/panels/RangesPanel/hooks/useMapRanges.js +8 -8
  124. package/lib/component/panels/SpectrumsPanel/SpectrumListItem.js +6 -6
  125. package/lib/component/panels/SpectrumsPanel/SpectrumListPanel.js +3 -3
  126. package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +5 -5
  127. package/lib/component/panels/SpectrumsPanel/base/ColorIndicator.js +2 -2
  128. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.d.ts +1 -1
  129. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.js +2 -1
  130. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.d.ts +1 -1
  131. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.js +2 -1
  132. package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +13 -17
  133. package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +16 -17
  134. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +20 -21
  135. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +12 -12
  136. package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.js +1 -5
  137. package/lib/component/panels/SummaryPanel/utilities/Utilities.js +105 -94
  138. package/lib/component/panels/ZonesPanel/ZonesTable.js +8 -8
  139. package/lib/component/panels/databasePanel/DatabasePanel.js +5 -4
  140. package/lib/component/panels/databasePanel/DatabaseTable.d.ts +2 -1
  141. package/lib/component/panels/databasePanel/DatabaseTable.js +20 -5
  142. package/lib/component/panels/extra/preferences/ColumnsHelper.js +5 -2
  143. package/lib/component/panels/extra/utilities/MultiplicityUtilities.d.ts +2 -2
  144. package/lib/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
  145. package/lib/component/panels/filtersPanel/FiltersTable.js +1 -1
  146. package/lib/component/reducer/IgnoreActions.js +3 -3
  147. package/lib/component/reducer/Reducer.d.ts +40 -14
  148. package/lib/component/reducer/Reducer.js +12 -11
  149. package/lib/component/reducer/actions/CorrelationsActions.js +4 -4
  150. package/lib/component/reducer/actions/DomainActions.d.ts +2 -2
  151. package/lib/component/reducer/actions/DomainActions.js +49 -67
  152. package/lib/component/reducer/actions/FiltersActions.js +3 -3
  153. package/lib/component/reducer/actions/HistoryActions.js +5 -5
  154. package/lib/component/reducer/actions/LoadActions.js +12 -0
  155. package/lib/component/reducer/actions/PreferencesActions.js +18 -37
  156. package/lib/component/reducer/actions/RangesActions.js +14 -12
  157. package/lib/component/reducer/actions/SpectrumsActions.js +10 -4
  158. package/lib/component/reducer/actions/ToolsActions.js +20 -35
  159. package/lib/component/reducer/actions/ZonesActions.js +2 -2
  160. package/lib/component/reducer/core/Constants.js +1 -1
  161. package/lib/component/reducer/helper/GetClosestNumber.js +2 -1
  162. package/lib/component/reducer/helper/Zoom1DManager.js +11 -10
  163. package/lib/component/reducer/helper/getSpectrum.js +3 -5
  164. package/lib/component/reducer/helper/getStrongestPeak.d.ts +1 -1
  165. package/lib/component/reducer/helper/getStrongestPeak.js +2 -3
  166. package/lib/component/reducer/preferences/actions/removeWorkspace.js +3 -10
  167. package/lib/component/reducer/preferences/actions/setPreferences.js +5 -6
  168. package/lib/component/reducer/preferences/utilities/mapNucleiFormatting.d.ts +1 -4
  169. package/lib/component/reducer/preferences/utilities/mapNucleiFormatting.js +7 -5
  170. package/lib/component/tool/BrushX.js +3 -3
  171. package/lib/component/tool/BrushXY.js +5 -5
  172. package/lib/component/tool/CrossLinePointer.js +3 -3
  173. package/lib/component/toolbar/BasicToolBar.js +1 -1
  174. package/lib/component/utility/Evaluate.js +2 -2
  175. package/lib/component/utility/FileUtility.d.ts +2 -9
  176. package/lib/component/utility/FileUtility.js +11 -28
  177. package/lib/component/utility/GroupByInfoKey.d.ts +1 -1
  178. package/lib/component/utility/GroupByInfoKey.js +11 -13
  179. package/lib/component/utility/PathBuilder.js +1 -1
  180. package/lib/component/utility/PreferencesHelper.js +2 -3
  181. package/lib/component/utility/{Export.d.ts → export.d.ts} +0 -0
  182. package/lib/component/utility/{Export.js → export.js} +53 -78
  183. package/lib/component/utility/formatNumber.d.ts +6 -1
  184. package/lib/component/utility/formatNumber.js +5 -4
  185. package/lib/data/Filters.d.ts +16 -17
  186. package/lib/data/Filters.js +16 -17
  187. package/lib/data/FiltersManager.js +4 -3
  188. package/lib/data/PredictionManager.js +8 -10
  189. package/lib/data/SpectraManager.d.ts +1 -2
  190. package/lib/data/SpectraManager.js +25 -60
  191. package/lib/data/data1d/MultipleAnalysis.js +74 -70
  192. package/lib/data/data1d/Spectrum1D/SumManager.js +1 -1
  193. package/lib/data/data1d/Spectrum1D/generateJGraphData.js +1 -1
  194. package/lib/data/data1d/Spectrum1D/index.d.ts +24 -25
  195. package/lib/data/data1d/Spectrum1D/index.js +24 -25
  196. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +1 -1
  197. package/lib/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +6 -5
  198. package/lib/data/data1d/Spectrum1D/integrals/updateRelatives.js +8 -10
  199. package/lib/data/data1d/Spectrum1D/peaks/lookupPeak.js +1 -1
  200. package/lib/data/data1d/Spectrum1D/peaks/optimizePeaks.js +2 -2
  201. package/lib/data/data1d/Spectrum1D/ranges/addRange.js +3 -2
  202. package/lib/data/data1d/Spectrum1D/ranges/changeRange.js +2 -2
  203. package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +35 -1
  204. package/lib/data/data1d/Spectrum1D/ranges/mapRanges.d.ts +35 -1
  205. package/lib/data/data1d/Spectrum1D/ranges/mapRanges.js +6 -7
  206. package/lib/data/data1d/database.js +45 -28
  207. package/lib/data/data1d/filter1d/apodization.js +2 -1
  208. package/lib/data/data1d/filter1d/fft.js +24 -7
  209. package/lib/data/data1d/filter1d/phaseCorrection.js +2 -2
  210. package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +1 -1
  211. package/lib/data/data1d/filter1d/zeroFilling.js +1 -1
  212. package/lib/data/data2d/Processing2D.d.ts +3 -3
  213. package/lib/data/data2d/Processing2D.js +7 -18
  214. package/lib/data/data2d/Spectrum2D/contours.d.ts +40 -0
  215. package/lib/data/data2d/Spectrum2D/contours.js +132 -0
  216. package/lib/data/data2d/Spectrum2D/index.d.ts +10 -11
  217. package/lib/data/data2d/Spectrum2D/index.js +10 -11
  218. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +3 -4
  219. package/lib/data/data2d/Spectrum2D/shift/getShift.js +4 -5
  220. package/lib/data/data2d/Spectrum2D/zones/detectZones.js +11 -8
  221. package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.js +1 -1
  222. package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.js +1 -2
  223. package/lib/data/molecules/MoleculeManager.js +1 -1
  224. package/lib/data/types/common/Source.d.ts +1 -0
  225. package/lib/data/types/data1d/index.d.ts +12 -13
  226. package/lib/data/types/data2d/Data2D.d.ts +2 -0
  227. package/lib/data/types/data2d/Datum2D.d.ts +0 -1
  228. package/lib/data/types/data2d/index.d.ts +8 -9
  229. package/lib/data/utilities/RangeUtilities.js +13 -9
  230. package/lib/data/utilities/ZoneUtilities.js +17 -13
  231. package/lib/data/utilities/checkModifierKeyActivated.js +1 -2
  232. package/lib/data/utilities/generateChar.js +8 -6
  233. package/lib/data/utilities/getAtom.js +1 -1
  234. package/lib/data/utilities/getAtomsFromMF.js +2 -2
  235. package/lib/data/utilities/getColor.js +3 -3
  236. package/lib/data/utilities/getSum.js +6 -3
  237. package/lib/versionInfo.js +1 -1
  238. package/lib-cjs/component/1d/Chart1D.js +1 -1
  239. package/lib-cjs/component/1d/LinesSeries.js +1 -1
  240. package/lib-cjs/component/1d/SpectraTracker.js +1 -1
  241. package/lib-cjs/component/1d/Viewer1D.js +1 -1
  242. package/lib-cjs/component/1d/XAxis.js +1 -1
  243. package/lib-cjs/component/1d/database/DatabaseSpectrum.js +2 -1
  244. package/lib-cjs/component/1d/database/ResurrectedDatabaseRanges.js +2 -2
  245. package/lib-cjs/component/1d/{Integral.js → integral/Integral.js} +2 -2
  246. package/lib-cjs/component/1d/integral/IntegralIndicator.js +31 -0
  247. package/lib-cjs/component/1d/integral/IntegralResizable.js +74 -0
  248. package/lib-cjs/component/1d/{IntegralsSeries.js → integral/IntegralsSeries.js} +4 -4
  249. package/lib-cjs/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
  250. package/lib-cjs/component/1d/multiplicityTree/MultiplicityTree.js +4 -4
  251. package/lib-cjs/component/1d/multiplicityTree/buildTreeNode.js +3 -3
  252. package/lib-cjs/component/1d/peaks/PeakAnnotation.js +1 -1
  253. package/lib-cjs/component/1d/peaks/usePeakShapesPath.js +10 -6
  254. package/lib-cjs/component/1d/ranges/Range.js +27 -50
  255. package/lib-cjs/component/1d/tool/PeakPointer.js +1 -1
  256. package/lib-cjs/component/1d/utilities/scale.js +2 -2
  257. package/lib-cjs/component/2d/Contours.js +60 -41
  258. package/lib-cjs/component/2d/FooterBanner.js +2 -2
  259. package/lib-cjs/component/2d/Viewer2D.js +11 -14
  260. package/lib-cjs/component/2d/tools/XYLabelPointer.js +2 -2
  261. package/lib-cjs/component/2d/tools/slicing/VerticalSliceChart.js +1 -1
  262. package/lib-cjs/component/2d/zones/IndicationLines.js +5 -8
  263. package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +14 -15
  264. package/lib-cjs/component/NMRium.js +7 -7
  265. package/lib-cjs/component/assignment/actions/initAssignment.js +17 -17
  266. package/lib-cjs/component/assignment/index.js +2 -2
  267. package/lib-cjs/component/context/PreferencesContext.js +3 -6
  268. package/lib-cjs/component/elements/Button.js +1 -1
  269. package/lib-cjs/component/elements/CheckBoxCell.js +1 -1
  270. package/lib-cjs/component/elements/ContextMenu.js +2 -2
  271. package/lib-cjs/component/elements/EditableColumn.js +3 -5
  272. package/lib-cjs/component/elements/GroupPane.js +18 -0
  273. package/lib-cjs/component/elements/Input.js +7 -4
  274. package/lib-cjs/component/elements/IsotopesViewer.js +1 -1
  275. package/lib-cjs/component/elements/Label.js +1 -2
  276. package/lib-cjs/component/elements/MolecularFormulaInput.js +2 -0
  277. package/lib-cjs/component/elements/NumberInput.js +2 -2
  278. package/lib-cjs/component/elements/ReactTable/Elements/ReactTableRow.js +1 -1
  279. package/lib-cjs/component/elements/ReactTable/ReactTable.js +71 -37
  280. package/lib-cjs/component/elements/ReactTable/ReactTableFlexLayout.js +2 -2
  281. package/lib-cjs/component/elements/ReactTable/utility/addCustomColumn.js +3 -3
  282. package/lib-cjs/component/elements/ReactTable/utility/useRowSpan.js +3 -7
  283. package/lib-cjs/component/elements/accordion/Accordion.js +2 -2
  284. package/lib-cjs/component/elements/draggble/useDraggable.js +1 -3
  285. package/lib-cjs/component/elements/dropDownButton/DropDownList.js +1 -2
  286. package/lib-cjs/component/elements/formik/FormikCheckBox.js +1 -1
  287. package/lib-cjs/component/elements/formik/FormikColorPicker.js +4 -7
  288. package/lib-cjs/component/elements/formik/FormikErrorsSummary.js +2 -2
  289. package/lib-cjs/component/elements/formik/FormikForm.js +2 -2
  290. package/lib-cjs/component/elements/formik/FormikInput.js +12 -20
  291. package/lib-cjs/component/elements/formik/FormikOnChange.js +13 -10
  292. package/lib-cjs/component/elements/formik/FormikSelect.js +1 -1
  293. package/lib-cjs/component/elements/formik/FormikSlider.js +7 -10
  294. package/lib-cjs/component/elements/formik/FormikTextarea.js +1 -1
  295. package/lib-cjs/component/elements/linearAxis/LinearVerticalAxis.js +2 -2
  296. package/lib-cjs/component/elements/popup/Alert/Provider.js +8 -8
  297. package/lib-cjs/component/elements/popup/Alert/index.js +5 -5
  298. package/lib-cjs/component/elements/popup/Modal/ModalContent.js +3 -1
  299. package/lib-cjs/component/elements/popup/Modal/Provider.js +16 -31
  300. package/lib-cjs/component/elements/popup/Modal/index.js +7 -7
  301. package/lib-cjs/component/header/Header.js +1 -1
  302. package/lib-cjs/component/hooks/useCombinedRefs.js +2 -2
  303. package/lib-cjs/component/hooks/useExport.js +14 -11
  304. package/lib-cjs/component/hooks/useFormatNumberByNucleus.js +1 -1
  305. package/lib-cjs/component/hooks/usePanelPreferences.js +9 -7
  306. package/lib-cjs/component/loader/DropZone.js +4 -4
  307. package/lib-cjs/component/modal/AlignSpectraModal.js +1 -1
  308. package/lib-cjs/component/modal/ExportAsMatrixModal.js +2 -2
  309. package/lib-cjs/component/modal/LoadJCAMPModal.js +2 -2
  310. package/lib-cjs/component/modal/MultipleSpectraFiltersModal/index.js +1 -1
  311. package/lib-cjs/component/modal/MultipletAnalysisModal.js +3 -3
  312. package/lib-cjs/component/modal/PredictSpectraModal.js +5 -5
  313. package/lib-cjs/component/modal/editRange/EditRangeModal.js +4 -4
  314. package/lib-cjs/component/modal/editRange/forms/components/SignalFormInfo.js +1 -1
  315. package/lib-cjs/component/modal/editRange/forms/validation/EditRangeValidation.js +2 -2
  316. package/lib-cjs/component/modal/setting/DatabasesTabContent.js +25 -20
  317. package/lib-cjs/component/modal/setting/DisplayTabContent.js +21 -27
  318. package/lib-cjs/component/modal/setting/FormattingTabContent.js +10 -10
  319. package/lib-cjs/component/modal/setting/GeneralSettings.js +11 -14
  320. package/lib-cjs/component/modal/setting/GeneralTabContent.js +3 -1
  321. package/lib-cjs/component/modal/setting/ToolsTabContent.js +18 -19
  322. package/lib-cjs/component/modal/setting/WorkspaceItem.js +37 -49
  323. package/lib-cjs/component/modal/setting/settingsValidation.js +14 -12
  324. package/lib-cjs/component/panels/AutomaticAssignment/useAutoAssignments.js +8 -7
  325. package/lib-cjs/component/panels/InformationPanel.js +51 -55
  326. package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +1 -1
  327. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +4 -4
  328. package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +6 -6
  329. package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +16 -17
  330. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/ColumnHeader.js +1 -1
  331. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleAnalysisCodeEditor.js +1 -1
  332. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +2 -2
  333. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPreferences.js +18 -17
  334. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisTable.js +2 -2
  335. package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +1 -1
  336. package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +2 -2
  337. package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +2 -2
  338. package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +2 -2
  339. package/lib-cjs/component/panels/RangesPanel/RangesTable.js +1 -1
  340. package/lib-cjs/component/panels/RangesPanel/RangesTableRow.js +1 -3
  341. package/lib-cjs/component/panels/RangesPanel/TableColumns/CouplingColumn.js +1 -1
  342. package/lib-cjs/component/panels/RangesPanel/hooks/useEditRangeModal.js +2 -2
  343. package/lib-cjs/component/panels/RangesPanel/hooks/useMapRanges.js +8 -8
  344. package/lib-cjs/component/panels/SpectrumsPanel/SpectrumListItem.js +6 -6
  345. package/lib-cjs/component/panels/SpectrumsPanel/SpectrumListPanel.js +3 -3
  346. package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +6 -6
  347. package/lib-cjs/component/panels/SpectrumsPanel/base/ColorIndicator.js +2 -2
  348. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.js +2 -1
  349. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.js +2 -1
  350. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +13 -17
  351. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +16 -17
  352. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +20 -21
  353. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +12 -12
  354. package/lib-cjs/component/panels/SummaryPanel/SetShiftTolerancesModal.js +1 -5
  355. package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +105 -94
  356. package/lib-cjs/component/panels/ZonesPanel/ZonesTable.js +8 -8
  357. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +5 -4
  358. package/lib-cjs/component/panels/databasePanel/DatabaseTable.js +20 -5
  359. package/lib-cjs/component/panels/extra/preferences/ColumnsHelper.js +5 -2
  360. package/lib-cjs/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
  361. package/lib-cjs/component/panels/filtersPanel/FiltersTable.js +1 -1
  362. package/lib-cjs/component/reducer/IgnoreActions.js +3 -3
  363. package/lib-cjs/component/reducer/Reducer.js +11 -10
  364. package/lib-cjs/component/reducer/actions/CorrelationsActions.js +4 -4
  365. package/lib-cjs/component/reducer/actions/DomainActions.js +49 -67
  366. package/lib-cjs/component/reducer/actions/FiltersActions.js +3 -3
  367. package/lib-cjs/component/reducer/actions/HistoryActions.js +5 -5
  368. package/lib-cjs/component/reducer/actions/LoadActions.js +12 -0
  369. package/lib-cjs/component/reducer/actions/PreferencesActions.js +18 -37
  370. package/lib-cjs/component/reducer/actions/RangesActions.js +14 -12
  371. package/lib-cjs/component/reducer/actions/SpectrumsActions.js +9 -3
  372. package/lib-cjs/component/reducer/actions/ToolsActions.js +20 -35
  373. package/lib-cjs/component/reducer/actions/ZonesActions.js +2 -2
  374. package/lib-cjs/component/reducer/core/Constants.js +1 -1
  375. package/lib-cjs/component/reducer/helper/GetClosestNumber.js +2 -1
  376. package/lib-cjs/component/reducer/helper/Zoom1DManager.js +11 -10
  377. package/lib-cjs/component/reducer/helper/getSpectrum.js +3 -5
  378. package/lib-cjs/component/reducer/helper/getStrongestPeak.js +2 -3
  379. package/lib-cjs/component/reducer/preferences/actions/removeWorkspace.js +3 -10
  380. package/lib-cjs/component/reducer/preferences/actions/setPreferences.js +5 -9
  381. package/lib-cjs/component/reducer/preferences/utilities/mapNucleiFormatting.js +7 -5
  382. package/lib-cjs/component/tool/BrushX.js +3 -3
  383. package/lib-cjs/component/tool/BrushXY.js +5 -5
  384. package/lib-cjs/component/tool/CrossLinePointer.js +3 -3
  385. package/lib-cjs/component/toolbar/BasicToolBar.js +1 -1
  386. package/lib-cjs/component/utility/Evaluate.js +2 -2
  387. package/lib-cjs/component/utility/FileUtility.js +11 -29
  388. package/lib-cjs/component/utility/GroupByInfoKey.js +11 -13
  389. package/lib-cjs/component/utility/PathBuilder.js +1 -1
  390. package/lib-cjs/component/utility/PreferencesHelper.js +2 -3
  391. package/lib-cjs/component/utility/{Export.js → export.js} +77 -79
  392. package/lib-cjs/component/utility/formatNumber.js +5 -4
  393. package/lib-cjs/data/Filters.js +17 -33
  394. package/lib-cjs/data/FiltersManager.js +4 -3
  395. package/lib-cjs/data/PredictionManager.js +8 -10
  396. package/lib-cjs/data/SpectraManager.js +26 -62
  397. package/lib-cjs/data/data1d/MultipleAnalysis.js +74 -70
  398. package/lib-cjs/data/data1d/Spectrum1D/SumManager.js +1 -1
  399. package/lib-cjs/data/data1d/Spectrum1D/generateJGraphData.js +1 -1
  400. package/lib-cjs/data/data1d/Spectrum1D/index.js +25 -25
  401. package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +1 -1
  402. package/lib-cjs/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +6 -5
  403. package/lib-cjs/data/data1d/Spectrum1D/integrals/updateRelatives.js +8 -10
  404. package/lib-cjs/data/data1d/Spectrum1D/peaks/lookupPeak.js +1 -1
  405. package/lib-cjs/data/data1d/Spectrum1D/peaks/optimizePeaks.js +2 -2
  406. package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +3 -2
  407. package/lib-cjs/data/data1d/Spectrum1D/ranges/changeRange.js +2 -2
  408. package/lib-cjs/data/data1d/Spectrum1D/ranges/mapRanges.js +6 -7
  409. package/lib-cjs/data/data1d/database.js +45 -28
  410. package/lib-cjs/data/data1d/filter1d/apodization.js +2 -1
  411. package/lib-cjs/data/data1d/filter1d/fft.js +23 -6
  412. package/lib-cjs/data/data1d/filter1d/phaseCorrection.js +2 -2
  413. package/lib-cjs/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +1 -1
  414. package/lib-cjs/data/data1d/filter1d/zeroFilling.js +1 -1
  415. package/lib-cjs/data/data2d/Processing2D.js +7 -18
  416. package/lib-cjs/data/data2d/Spectrum2D/contours.js +138 -0
  417. package/lib-cjs/data/data2d/Spectrum2D/index.js +11 -11
  418. package/lib-cjs/data/data2d/Spectrum2D/initiateDatum2D.js +3 -4
  419. package/lib-cjs/data/data2d/Spectrum2D/shift/getShift.js +4 -5
  420. package/lib-cjs/data/data2d/Spectrum2D/zones/detectZones.js +11 -8
  421. package/lib-cjs/data/data2d/Spectrum2D/zones/detectZonesManual.js +1 -1
  422. package/lib-cjs/data/data2d/Spectrum2D/zones/getDetectionZones.js +1 -2
  423. package/lib-cjs/data/molecules/MoleculeManager.js +1 -1
  424. package/lib-cjs/data/utilities/RangeUtilities.js +13 -9
  425. package/lib-cjs/data/utilities/ZoneUtilities.js +17 -13
  426. package/lib-cjs/data/utilities/checkModifierKeyActivated.js +1 -2
  427. package/lib-cjs/data/utilities/generateChar.js +8 -6
  428. package/lib-cjs/data/utilities/getAtom.js +1 -1
  429. package/lib-cjs/data/utilities/getAtomsFromMF.js +2 -2
  430. package/lib-cjs/data/utilities/getColor.js +3 -3
  431. package/lib-cjs/data/utilities/getSum.js +6 -3
  432. package/lib-cjs/versionInfo.js +1 -1
  433. package/package.json +30 -26
  434. package/lib/component/1d/IntegralResizable.js +0 -72
  435. package/lib/component/elements/popup/helpers.d.ts +0 -1
  436. package/lib/component/elements/popup/helpers.js +0 -9
  437. package/lib/component/panels/RangesPanel/TableColumns/format.d.ts +0 -1
  438. package/lib/component/panels/RangesPanel/TableColumns/format.js +0 -8
  439. package/lib/data/data1d/Data1DManager.d.ts +0 -3
  440. package/lib/data/data1d/Data1DManager.js +0 -98
  441. package/lib/data/data2d/Data2DManager.d.ts +0 -3
  442. package/lib/data/data2d/Data2DManager.js +0 -34
  443. package/lib/data/types/data2d/Contour.d.ts +0 -4
  444. package/lib/data/types/data2d/Contour.js +0 -1
  445. package/lib/data/types/data2d/Contours.d.ts +0 -2
  446. package/lib/data/types/data2d/Contours.js +0 -1
  447. package/lib-cjs/component/1d/IntegralResizable.js +0 -77
  448. package/lib-cjs/component/elements/popup/helpers.js +0 -13
  449. package/lib-cjs/component/panels/RangesPanel/TableColumns/format.js +0 -14
  450. package/lib-cjs/data/data1d/Data1DManager.js +0 -104
  451. package/lib-cjs/data/data2d/Data2DManager.js +0 -40
  452. package/lib-cjs/data/types/data2d/Contour.js +0 -2
  453. package/lib-cjs/data/types/data2d/Contours.js +0 -2
@@ -2,10 +2,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import FloatMoleculeStructures from '../tool/FloatMoleculeStructures';
3
3
  import ApdoizationLine from './ApodizationLine';
4
4
  import ExclusionZonesAnnotations from './ExclusionZonesAnnotations';
5
- import IntegralsSeries from './IntegralsSeries';
6
5
  import LinesSeries from './LinesSeries';
7
6
  import XAxis from './XAxis';
8
7
  import DatabaseElements from './database/DatabaseElements';
8
+ import IntegralsSeries from './integral/IntegralsSeries';
9
9
  import JGraph from './jCouplingGraph/JGraph';
10
10
  import MultiAnalysisRanges from './multiAnalysis/MultiAnalysisRanges';
11
11
  import PeakAnnotations from './peaks/PeakAnnotations';
@@ -6,7 +6,7 @@ import Line from './Line';
6
6
  function LinesSeries() {
7
7
  const { data, tempData, displayerKey, xDomains } = useChartData();
8
8
  const activeSpectrum = useActiveSpectrum();
9
- let _data = tempData ? tempData : data;
9
+ let _data = tempData || data;
10
10
  return (_jsxs("g", { clipPath: `url(#${displayerKey}clip-chart-1d)`, className: "spectrums", children: [_data
11
11
  ?.filter((d) => d.display.isVisible === true && xDomains[d.id])
12
12
  .map((d, i) => (_jsx("g", { id: d.id, children: _jsx(Line, { display: d.display, id: d.id, data: get1DDataXY(d), index: i }) }, d.id))), activeSpectrum?.id && _jsx("use", { href: `#${activeSpectrum?.id}` })] }));
@@ -57,7 +57,7 @@ function SpectraTracker() {
57
57
  spectrum.info.nucleus === activeTab && (_jsxs("div", { style: { display: 'block' }, children: [_jsx("span", { style: {
58
58
  ...styles.colorIndicator,
59
59
  borderColor: spectrum.display.color,
60
- } }), _jsx(YTracker, { datum: get1DDataXY(spectrum) }), _jsx("span", { style: styles.value, children: spectrum.display.name })] }, spectrum.id)), []));
60
+ } }), _jsx(YTracker, { datum: get1DDataXY(spectrum) }), _jsx("span", { style: styles.value, children: spectrum.display.name })] }, spectrum.id))));
61
61
  }, [activeTab, data, isVisible, xDomains]);
62
62
  if (!isVisible)
63
63
  return null;
@@ -105,7 +105,7 @@ function Viewer1D({ emptyText = undefined }) {
105
105
  });
106
106
  if (!activeSpectrum)
107
107
  break;
108
- const { data: { x }, } = state.data[activeSpectrum.index];
108
+ const { data: { x }, } = data[activeSpectrum.index];
109
109
  const { fromIndex, toIndex } = xGetFromToIndex(x, { from, to });
110
110
  if (toIndex - fromIndex <= MAX_LENGTH) {
111
111
  dispatch({
@@ -39,7 +39,7 @@ function XAxis(props) {
39
39
  const { scaleX } = useScale();
40
40
  const refAxis = useRef(null);
41
41
  const refGrid = useRef(null);
42
- const label = labelProp ? labelProp : mode === 'RTL' ? 'δ [ppm]' : 'time [s]';
42
+ const label = labelProp || (mode === 'RTL' ? 'δ [ppm]' : 'time [s]');
43
43
  useEffect(() => {
44
44
  if (!show || !scaleX)
45
45
  return;
@@ -48,7 +48,8 @@ function DatabaseSpectrum() {
48
48
  setPath(pathBuilder.toString());
49
49
  }
50
50
  }
51
- catch (e) {
51
+ catch (error) {
52
+ reportError(error);
52
53
  alert.error('Failed to Load spectrum');
53
54
  }
54
55
  }, 250));
@@ -39,7 +39,7 @@ function ResurrectedDatabaseRanges() {
39
39
  yDomain[0] = domain[0] < yDomain[0] ? domain[0] : yDomain[0];
40
40
  yDomain[1] = domain[1] > yDomain[1] ? domain[1] : yDomain[1];
41
41
  return { data, from: newForm, to: newTo };
42
- }, []);
42
+ });
43
43
  const scaleY = getYScale({
44
44
  height: blockHight,
45
45
  margin: { top: 0, bottom: 0 },
@@ -54,7 +54,7 @@ function ResurrectedDatabaseRanges() {
54
54
  pathBuilder.lineTo(finalScaleX(x[i]), scaleY(y[i]));
55
55
  }
56
56
  return { path: pathBuilder.toString(), from, to };
57
- }, []);
57
+ });
58
58
  return (_jsx("g", { clipPath: `url(#${displayerKey}clip-chart-1d)`, className: "resurrected-database-ranges", width: "100%", height: "100%", children: paths.map(({ path, from, to }, index) => (
59
59
  // eslint-disable-next-line react/no-array-index-key
60
60
  _jsxs("g", { children: [_jsx("g", { transform: `translate(${scaleX()(to)},0)`, children: _jsx("rect", { x: "0", width: Math.abs(scaleX()(to) - scaleX()(from)), height: "100%", fill: "#ff6f0057" }) }), _jsx("path", { transform: `translate(0,${translateY})`, stroke: color, fill: "none", d: path })] }, `${index}`))) }));
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import useIntegralPath from '../hooks/useIntegralPath';
3
- import { usePanelPreferences } from '../hooks/usePanelPreferences';
2
+ import useIntegralPath from '../../hooks/useIntegralPath';
3
+ import { usePanelPreferences } from '../../hooks/usePanelPreferences';
4
4
  import IntegralResizable from './IntegralResizable';
5
5
  function Integral({ integral, isActive, nucleus }) {
6
6
  const path = useIntegralPath(integral);
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ interface IntegralIndicatorProps {
3
+ value: number | undefined;
4
+ format: string;
5
+ width: number;
6
+ opacity?: number;
7
+ }
8
+ export declare function IntegralIndicator(props: IntegralIndicatorProps): JSX.Element;
9
+ export {};
@@ -0,0 +1,27 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useChartData } from '../../context/ChartContext';
3
+ import { formatNumber } from '../../utility/formatNumber';
4
+ const styles = {
5
+ text: {
6
+ fontSize: '11px',
7
+ textAnchor: 'middle',
8
+ dominantBaseline: 'middle',
9
+ writingMode: 'vertical-rl',
10
+ fill: 'black',
11
+ },
12
+ path: {
13
+ fill: 'none',
14
+ strokeWidth: '1px',
15
+ shapeRendering: 'crispEdges',
16
+ stroke: 'black',
17
+ },
18
+ };
19
+ export function IntegralIndicator(props) {
20
+ const { value, width, format, opacity = 1 } = props;
21
+ const { height, margin } = useChartData();
22
+ const bottom = height - margin.bottom;
23
+ return (_jsxs("g", { style: { transform: `translate(0,${bottom - 10}px) `, opacity }, children: [_jsx("text", { style: {
24
+ ...styles.text,
25
+ transform: `translate(${width / 2}px,-12px) scale(-1)`,
26
+ }, children: value ? formatNumber(value, format) : '' }), _jsx("path", { style: styles.path, d: `M0 0 L0 5 L${width} 5 L${width} 0 ` })] }));
27
+ }
@@ -0,0 +1,69 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
+ /** @jsxImportSource @emotion/react */
3
+ import { css } from '@emotion/react';
4
+ import { useChartData } from '../../context/ChartContext';
5
+ import { useDispatch } from '../../context/DispatchContext';
6
+ import { useGlobal } from '../../context/GlobalContext';
7
+ import { useScaleChecked } from '../../context/ScaleContext';
8
+ import Resizer from '../../elements/resizer/Resizer';
9
+ import { HighlightEventSource, useHighlight } from '../../highlight/index';
10
+ import { RESIZE_INTEGRAL } from '../../reducer/types/Types';
11
+ import { options } from '../../toolbar/ToolTypes';
12
+ import { IntegralIndicator } from './IntegralIndicator';
13
+ const stylesOnHover = css `
14
+ pointer-events: bounding-box;
15
+ @-moz-document url-prefix() {
16
+ pointer-events: fill;
17
+ }
18
+ .highlight {
19
+ fill: transparent;
20
+ }
21
+ .target {
22
+ visibility: hidden;
23
+ }
24
+ `;
25
+ const stylesHighlighted = css `
26
+ pointer-events: bounding-box;
27
+
28
+ @-moz-document url-prefix() {
29
+ pointer-events: fill;
30
+ }
31
+ fill: #ff6f0057;
32
+
33
+ .target {
34
+ visibility: visible;
35
+ }
36
+ `;
37
+ function IntegralResizable({ integralData, integralFormat, }) {
38
+ const { height, margin, toolOptions: { selectedTool }, } = useChartData();
39
+ const { viewerRef } = useGlobal();
40
+ const { scaleX } = useScaleChecked();
41
+ const dispatch = useDispatch();
42
+ const { id, integral } = integralData;
43
+ const highlight = useHighlight([id], {
44
+ type: HighlightEventSource.INTEGRAL,
45
+ extra: { id },
46
+ });
47
+ function handleOnStopResizing(position) {
48
+ dispatch({
49
+ type: RESIZE_INTEGRAL,
50
+ payload: {
51
+ data: {
52
+ ...integralData,
53
+ from: scaleX().invert(position.x2),
54
+ to: scaleX().invert(position.x1),
55
+ },
56
+ },
57
+ });
58
+ }
59
+ const from = integralData.from ? scaleX()(integralData.from) : 0;
60
+ const to = integralData.to ? scaleX()(integralData.to) : 0;
61
+ const bottom = height - margin.bottom;
62
+ return (_jsx("g", { onMouseEnter: () => highlight.show(), onMouseLeave: () => highlight.hide(), children: _jsx(Resizer, { tag: "svg", initialPosition: { x1: to, x2: from }, onEnd: handleOnStopResizing, parentElement: viewerRef, disabled: selectedTool !== options.integral.id, children: ({ x1, x2 }, isActive) => {
63
+ const width = x2 - x1;
64
+ return (_jsxs("g", { css: highlight.isActive || isActive
65
+ ? stylesHighlighted
66
+ : stylesOnHover, children: [_jsx("rect", { width: width, height: bottom, className: "highlight", "data-no-export": "true" }), _jsx(IntegralIndicator, { value: integral, format: integralFormat, width: width })] }));
67
+ } }, `${id}_${to}_${from}`) }));
68
+ }
69
+ export default IntegralResizable;
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useMemo } from 'react';
3
- import { isSpectrum1D } from '../../data/data1d/Spectrum1D';
4
- import { useChartData } from '../context/ChartContext';
5
- import { useActiveSpectrum } from '../reducer/Reducer';
3
+ import { isSpectrum1D } from '../../../data/data1d/Spectrum1D';
4
+ import { useChartData } from '../../context/ChartContext';
5
+ import { useActiveSpectrum } from '../../reducer/Reducer';
6
6
  import Integral from './Integral';
7
7
  function IntegralsSeries() {
8
8
  const { xDomains, data, displayerKey, view: { spectra: { activeTab: nucleus }, }, } = useChartData();
@@ -14,7 +14,7 @@ function IntegralsSeries() {
14
14
  return (_jsx("g", { className: "integrals", children: data?.[0] &&
15
15
  data
16
16
  .filter((d) => d.display.isVisible && xDomains[d.id])
17
- .filter(isSpectrum1D)
17
+ .filter((element) => isSpectrum1D(element))
18
18
  .map((spectrum) => spectrum.integrals.values.map((integral) => (_jsx(Integral, { nucleus: nucleus, integral: integral, isActive: isActive(spectrum.id) }, integral.id)))) }));
19
19
  }, [activeSpectrum, data, nucleus, xDomains]);
20
20
  return _jsx("g", { clipPath: `url(#${displayerKey}clip-chart-1d)`, children: Integrals });
@@ -10,7 +10,7 @@ function MultiAnalysisRangesInner({ activeTab, spectraAnalysis, displayerKey, })
10
10
  return columns;
11
11
  }, [activeTab, spectraAnalysis]);
12
12
  const ranges = useMemo(() => {
13
- return Object.keys(columns).map((key) => key, []);
13
+ return Object.keys(columns).map((key) => key);
14
14
  }, [columns]);
15
15
  if (!ranges || ranges.length === 0) {
16
16
  return null;
@@ -79,13 +79,13 @@ function MultiplicityTree({ rangeFrom, rangeTo, signal, labelOptions = {
79
79
  }, [treeProps.width, width]);
80
80
  const startY = useMemo(() => {
81
81
  let yMax;
82
- spectrumData.data.x.forEach((_x, i) => {
82
+ for (const [i, _x] of spectrumData.data.x.entries()) {
83
83
  if (_x >= rangeFrom &&
84
84
  _x <= rangeTo &&
85
85
  (!yMax || spectrumData.data.re[i] > yMax)) {
86
86
  yMax = spectrumData.data.re[i];
87
87
  }
88
- });
88
+ }
89
89
  return scaleY(spectrumData.id)(yMax) - treeProps.height - 30;
90
90
  }, [
91
91
  spectrumData.data.x,
@@ -113,7 +113,7 @@ function MultiplicityTree({ rangeFrom, rangeTo, signal, labelOptions = {
113
113
  }
114
114
  else {
115
115
  const _xRange = { x1: signal.delta, x2: signal.delta };
116
- treeNodesData.forEach((_treeNodeData) => {
116
+ for (const _treeNodeData of treeNodesData) {
117
117
  if (_treeNodeData.startX < _xRange.x1) {
118
118
  _xRange.x1 = _treeNodeData.startX;
119
119
  }
@@ -126,7 +126,7 @@ function MultiplicityTree({ rangeFrom, rangeTo, signal, labelOptions = {
126
126
  if (_treeNodeData._startX > _xRange.x2) {
127
127
  _xRange.x2 = _treeNodeData._startX;
128
128
  }
129
- });
129
+ }
130
130
  setXRange(_xRange);
131
131
  }
132
132
  }, [
@@ -11,7 +11,7 @@ function createTreeNodes(signal, spectrumData) {
11
11
  }
12
12
  // re-use colors if needed
13
13
  const color = TREE_LEVEL_COLORS[multiplicityIndex % TREE_LEVEL_COLORS.length];
14
- const jIndex = jIndices.findIndex((_jIndex) => _jIndex === multiplicityIndex);
14
+ const jIndex = jIndices.indexOf(multiplicityIndex);
15
15
  const frequency = lodashGet(spectrumData, 'info.originFrequency', 0);
16
16
  const coupling = jIndex >= 0 && frequency > 0 && signal?.js?.[jIndex]
17
17
  ? signal.js[jIndex].coupling / frequency // convert to ppm
@@ -35,7 +35,7 @@ function createTreeNodes(signal, spectrumData) {
35
35
  let _startX = pascal.length % 2 === 0
36
36
  ? startX - (pascal.length / 2) * coupling + coupling / 2 // in case of even number of nodes
37
37
  : startX - (pascal.length / 2 - 0.5) * coupling; // in case of odd number of nodes
38
- pascal.forEach((ratio, k) => {
38
+ for (const [k, ratio] of pascal.entries()) {
39
39
  if (k > 0) {
40
40
  _startX += coupling;
41
41
  }
@@ -48,7 +48,7 @@ function createTreeNodes(signal, spectrumData) {
48
48
  });
49
49
  // go to next multiplet in multiplicity string
50
50
  buildTreeNodesData(multiplicityIndex + 1, jIndices, treeNodesData, _startX);
51
- });
51
+ }
52
52
  }
53
53
  return treeNodesData;
54
54
  }
@@ -70,7 +70,7 @@ value, color, nucleus, }) {
70
70
  const handleKeyDown = useCallback((event) => {
71
71
  if (event.key === 'Enter') {
72
72
  const newValue = event.currentTarget.valueAsNumber;
73
- if (!isNaN(newValue)) {
73
+ if (!Number.isNaN(newValue)) {
74
74
  const shiftValue = newValue - value;
75
75
  handleOnPeakChange({
76
76
  id,
@@ -10,22 +10,26 @@ export function usePeakShapesPath(spectrum) {
10
10
  const frequency = spectrum.info.originFrequency;
11
11
  let pathSeries = null;
12
12
  switch (target) {
13
- case 'peakShape':
14
- pathSeries = peakToXY(options.peak, {
13
+ case 'peakShape': {
14
+ const { peak } = options;
15
+ pathSeries = peakToXY(peak, {
15
16
  frequency,
16
17
  nbPoints: 1024,
17
- from: options.peak.x - (options.peak.width / frequency) * 9,
18
- to: options.peak.x + (options.peak.width / frequency) * 9,
18
+ from: peak.x - (peak.width / frequency) * 9,
19
+ to: peak.x + (peak.width / frequency) * 9,
19
20
  });
20
21
  break;
21
- case 'peaksSum':
22
- pathSeries = peaksToXY(options.peaks, {
22
+ }
23
+ case 'peaksSum': {
24
+ const { peaks } = options;
25
+ pathSeries = peaksToXY(peaks, {
23
26
  frequency,
24
27
  nbPoints: width,
25
28
  from: xDomain[0],
26
29
  to: xDomain[1],
27
30
  });
28
31
  break;
32
+ }
29
33
  default:
30
34
  break;
31
35
  }
@@ -1,7 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
2
  /** @jsxImportSource @emotion/react */
3
3
  import { css } from '@emotion/react';
4
- import { useCallback, useState, useEffect } from 'react';
5
4
  import { checkRangeKind } from '../../../data/utilities/RangeUtilities';
6
5
  import { useAssignment, useAssignmentData, } from '../../assignment/AssignmentsContext';
7
6
  import { filterForIDsWithAssignment } from '../../assignment/utilities/filterForIDsWithAssignment';
@@ -12,18 +11,17 @@ import Resizer from '../../elements/resizer/Resizer';
12
11
  import { HighlightEventSource, useHighlight } from '../../highlight';
13
12
  import { RESIZE_RANGE } from '../../reducer/types/Types';
14
13
  import { options } from '../../toolbar/ToolTypes';
15
- import { formatNumber } from '../../utility/formatNumber';
14
+ import { IntegralIndicator } from '../integral/IntegralIndicator';
16
15
  import MultiplicityTree from '../multiplicityTree/MultiplicityTree';
17
16
  const stylesOnHover = css `
18
17
  pointer-events: bounding-box;
19
18
  @-moz-document url-prefix() {
20
19
  pointer-events: fill;
21
20
  }
22
- user-select: 'none';
23
- -webkit-user-select: none; /* Chrome all / Safari all */
24
- -moz-user-select: none; /* Firefox all */
25
-
26
- .delete-button {
21
+ .highlight {
22
+ fill: transparent;
23
+ }
24
+ .target {
27
25
  visibility: hidden;
28
26
  }
29
27
  `;
@@ -33,13 +31,10 @@ const stylesHighlighted = css `
33
31
  @-moz-document url-prefix() {
34
32
  pointer-events: fill;
35
33
  }
36
- .range-area {
37
- height: 100%;
38
- fill: #ff6f0057;
39
- }
40
- .delete-button {
34
+ fill: #ff6f0057;
35
+
36
+ .target {
41
37
  visibility: visible;
42
- cursor: pointer;
43
38
  }
44
39
  `;
45
40
  function Range({ rangeData, showMultiplicityTrees, selectedTool, relativeFormat, }) {
@@ -50,20 +45,8 @@ function Range({ rangeData, showMultiplicityTrees, selectedTool, relativeFormat,
50
45
  const highlightRange = useHighlight([assignmentRange.id].concat(assignmentRange.assigned?.x || []).concat(filterForIDsWithAssignment(assignmentData, signals.map((_signal) => _signal.id))), { type: HighlightEventSource.RANGE, extra: { id } });
51
46
  const { scaleX } = useScaleChecked();
52
47
  const dispatch = useDispatch();
53
- const [reduceOpacity, setReduceOpacity] = useState(false);
54
- const [isBlockedByEditing, setIsBlockedByEditing] = useState(false);
55
- useEffect(() => {
56
- if (selectedTool && selectedTool === options.editRange.id) {
57
- setIsBlockedByEditing(true);
58
- }
59
- else {
60
- setIsBlockedByEditing(false);
61
- }
62
- }, [selectedTool]);
63
- useEffect(() => {
64
- setReduceOpacity(!checkRangeKind(rangeData));
65
- }, [rangeData]);
66
- const handleOnStopResizing = useCallback((position) => {
48
+ const isBlockedByEditing = selectedTool && selectedTool === options.editRange.id;
49
+ function handleOnStopResizing(position) {
67
50
  dispatch({
68
51
  type: RESIZE_RANGE,
69
52
  data: {
@@ -72,40 +55,34 @@ function Range({ rangeData, showMultiplicityTrees, selectedTool, relativeFormat,
72
55
  to: scaleX().invert(position.x1),
73
56
  },
74
57
  });
75
- }, [dispatch, rangeData, scaleX]);
76
- const mouseEnterHandler = useCallback(() => {
58
+ }
59
+ function mouseEnterHandler() {
77
60
  assignmentRange.show('x');
78
61
  highlightRange.show();
79
- }, [assignmentRange, highlightRange]);
80
- const mouseLeaveHandler = useCallback(() => {
62
+ }
63
+ function mouseLeaveHandler() {
81
64
  assignmentRange.hide();
82
65
  highlightRange.hide();
83
- }, [assignmentRange, highlightRange]);
84
- const assignHandler = useCallback((e) => {
66
+ }
67
+ function assignHandler(e) {
85
68
  if (selectedTool === options.rangePicking.id &&
86
69
  e.shiftKey &&
87
70
  !isBlockedByEditing) {
88
71
  assignmentRange.setActive('x');
89
72
  }
90
- }, [assignmentRange, isBlockedByEditing, selectedTool]);
73
+ }
91
74
  const from = scaleX()(rangeData.from);
92
75
  const to = scaleX()(rangeData.to);
93
- return (_jsxs("g", { "data-test-id": "range", style: { outline: 'none' }, onMouseEnter: mouseEnterHandler, onMouseLeave: mouseLeaveHandler, onClick: assignHandler, children: [_jsx(Resizer, { tag: "svg", initialPosition: { x1: to, x2: from }, onEnd: handleOnStopResizing, parentElement: viewerRef, disabled: selectedTool !== options.rangePicking.id, children: ({ x1, x2 }, isActive) => (_jsxs("g", { transform: `translate(0,10)`, css: isBlockedByEditing ||
94
- highlightRange.isActive ||
95
- assignmentRange.isActive ||
96
- isActive
97
- ? stylesHighlighted
98
- : stylesOnHover, children: [_jsx("rect", { x: "0", width: x2 - x1, height: "6", className: "range-area", fill: "green", fillOpacity: !reduceOpacity ||
99
- highlightRange.isActive ||
100
- assignmentRange.isActive
101
- ? 1
102
- : 0.4 }), _jsx("text", { textAnchor: "middle", x: (x2 - x1) / 2, y: "20", fontSize: "10", fill: "red", fillOpacity: !reduceOpacity ||
103
- highlightRange.isActive ||
104
- assignmentRange.isActive
105
- ? 1
106
- : 0.6, children: integration !== undefined
107
- ? formatNumber(integration, relativeFormat)
108
- : '' })] })) }, `${id}_${to}_${from}`), showMultiplicityTrees &&
76
+ const isNotSignal = !checkRangeKind(rangeData);
77
+ return (_jsxs("g", { "data-test-id": "range", style: { outline: 'none' }, onMouseEnter: mouseEnterHandler, onMouseLeave: mouseLeaveHandler, onClick: assignHandler, children: [_jsx(Resizer, { tag: "svg", initialPosition: { x1: to, x2: from }, onEnd: handleOnStopResizing, parentElement: viewerRef, disabled: selectedTool !== options.rangePicking.id, children: ({ x1, x2 }, isActive) => {
78
+ const width = x2 - x1;
79
+ return (_jsxs("g", { css: isBlockedByEditing ||
80
+ highlightRange.isActive ||
81
+ assignmentRange.isActive ||
82
+ isActive
83
+ ? stylesHighlighted
84
+ : stylesOnHover, children: [_jsx("rect", { width: width, height: "100%", className: "highlight", "data-no-export": "true" }), _jsx(IntegralIndicator, { value: integration, format: relativeFormat, width: width, opacity: isNotSignal ? 0.5 : 1 })] }));
85
+ } }, `${id}_${to}_${from}`), showMultiplicityTrees &&
109
86
  signals &&
110
87
  signals.length > 0 &&
111
88
  signals.map((_signal) => (_jsx(MultiplicityTree, { rangeFrom: rangeData.from, rangeTo: rangeData.to, signal: _signal }, _signal.id)))] }, id));
@@ -50,7 +50,7 @@ function PeakPointer() {
50
50
  const yDataRange = datum.y.slice(minIndex, maxIndex);
51
51
  if (yDataRange && yDataRange.length > 0) {
52
52
  const yValue = max(yDataRange);
53
- const xIndex = yDataRange.findIndex((value) => value === yValue);
53
+ const xIndex = yDataRange.indexOf(yValue);
54
54
  const xValue = datum.x[minIndex + xIndex];
55
55
  return {
56
56
  x: scaleX()(xValue),
@@ -9,8 +9,8 @@ function getXScale(state, spectrumId = null) {
9
9
  function getYScale(state, spectrumId = null) {
10
10
  const { height, margin, verticalAlign, yDomain, yDomains } = state;
11
11
  const _height = verticalAlign.align === 'center'
12
- ? (height - 30) / 2
13
- : height - margin.bottom - 30;
12
+ ? (height - 40) / 2
13
+ : height - margin.bottom - 40;
14
14
  let domainY = [];
15
15
  if (spectrumId === null || yDomains[spectrumId] === undefined) {
16
16
  domainY = [0, yDomain[1]];
@@ -1,64 +1,83 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import debounce from 'lodash/debounce';
2
3
  import get from 'lodash/get';
3
- import { memo, useMemo } from 'react';
4
+ import { memo, useMemo, useRef } from 'react';
4
5
  import { getShift } from '../../data/data2d/Spectrum2D';
6
+ import { drawContours, getDefaultContoursLevel, } from '../../data/data2d/Spectrum2D/contours';
5
7
  import { useChartData } from '../context/ChartContext';
6
8
  import { usePreferences } from '../context/PreferencesContext';
9
+ import { useAlert } from '../elements/popup/Alert';
7
10
  import { useActiveSpectrum } from '../reducer/Reducer';
8
11
  import { PathBuilder } from '../utility/PathBuilder';
12
+ import nucleusToString from '../utility/nucleusToString';
9
13
  import { get2DXScale, get2DYScale } from './utilities/scale';
10
- function ContoursPaths({ id: spectrumID, sign, color, datum, }) {
11
- const { margin, width, height, xDomain, yDomain, contours } = useChartData();
12
- const activeSpectrum = useActiveSpectrum();
13
- const preferences = usePreferences();
14
+ function usePath(datum, contours) {
15
+ const { margin, width, height, xDomain, yDomain } = useChartData();
14
16
  const { xShift, yShift } = getShift(datum);
15
- const isActive = useMemo(() => {
16
- return activeSpectrum === null ? true : spectrumID === activeSpectrum.id;
17
- }, [activeSpectrum, spectrumID]);
18
- function buildContourPath(data) {
19
- const _scaleX = get2DXScale({ margin, width, xDomain });
20
- const _scaleY = get2DYScale({ margin, height, yDomain });
21
- const pathBuilder = new PathBuilder();
22
- for (const element of data) {
23
- if (element.lines) {
24
- const lines = element.lines;
25
- if (lines.length < 1e6) {
26
- for (let i = 0; i < lines.length; i += 4) {
27
- pathBuilder.moveTo(_scaleX(lines[i] + xShift), _scaleY(lines[i + 1] + yShift));
28
- pathBuilder.lineTo(_scaleX(lines[i + 2] + xShift), _scaleY(lines[i + 3] + yShift));
29
- }
17
+ const _scaleX = get2DXScale({ margin, width, xDomain });
18
+ const _scaleY = get2DYScale({ margin, height, yDomain });
19
+ const pathBuilder = new PathBuilder();
20
+ for (const element of contours) {
21
+ if (element.lines) {
22
+ const lines = element.lines;
23
+ if (lines.length < 1e6) {
24
+ for (let i = 0; i < lines.length; i += 4) {
25
+ pathBuilder.moveTo(_scaleX(lines[i] + xShift), _scaleY(lines[i + 1] + yShift));
26
+ pathBuilder.lineTo(_scaleX(lines[i + 2] + xShift), _scaleY(lines[i + 3] + yShift));
30
27
  }
31
28
  }
32
- else {
33
- pathBuilder.moveTo(_scaleX(element[0].x + xShift), _scaleY(element[0].y + yShift));
34
- for (let j = 1; j < element.length; j++) {
35
- pathBuilder.lineTo(_scaleX(element[j].x + xShift), _scaleY(element[j].y + yShift));
36
- }
29
+ }
30
+ else {
31
+ pathBuilder.moveTo(_scaleX(element[0].x + xShift), _scaleY(element[0].y + yShift));
32
+ for (let j = 1; j < element.length; j++) {
33
+ pathBuilder.lineTo(_scaleX(element[j].x + xShift), _scaleY(element[j].y + yShift));
37
34
  }
38
35
  }
39
- pathBuilder.closePath();
40
- return pathBuilder.toString();
41
36
  }
42
- const data = useMemo(() => {
43
- return get(contours, `${spectrumID}.${sign}`, []);
44
- }, [contours, sign, spectrumID]);
45
- const path = buildContourPath(data);
46
- if (!path)
47
- return null;
48
- return (_jsx("path", { fill: "none", "data-test-id": "spectrum-line", stroke: color, strokeWidth: "1", style: {
49
- opacity: isActive
50
- ? 1
51
- : get(preferences.current, 'general.dimmedSpectraOpacity', 0.1),
52
- }, d: path }));
37
+ pathBuilder.closePath();
38
+ return pathBuilder.toString();
39
+ }
40
+ const useContoursLevel = (datum, sign) => {
41
+ const { view: { zoom: { levels }, }, } = useChartData();
42
+ const { id, display: { contourOptions }, } = datum;
43
+ const defaultLevel = getDefaultContoursLevel(contourOptions);
44
+ const level = levels?.[id]?.[sign];
45
+ return typeof level !== 'number' ? defaultLevel[sign] : level;
46
+ };
47
+ function ContoursPaths({ id: spectrumID, sign, color, datum, onTimeout, }) {
48
+ const activeSpectrum = useActiveSpectrum();
49
+ const preferences = usePreferences();
50
+ const level = useContoursLevel(datum, sign);
51
+ const contours = useMemo(() => {
52
+ const { contours, timeout } = drawContours(level, datum, sign === 'negative');
53
+ if (timeout) {
54
+ onTimeout();
55
+ }
56
+ return contours;
57
+ }, [datum, level, onTimeout, sign]);
58
+ const path = usePath(datum, contours);
59
+ const opacity = activeSpectrum === null || spectrumID === activeSpectrum.id
60
+ ? '1'
61
+ : get(preferences.current, 'general.dimmedSpectraOpacity', 0.1);
62
+ return (_jsx("path", { fill: "none", "data-test-id": "spectrum-line", stroke: color, strokeWidth: "1", opacity: opacity, d: path }));
53
63
  }
54
64
  function ContoursInner({ data, displayerKey }) {
55
- return (_jsx("g", { clipPath: `url(#${displayerKey}clip-chart-2d)`, className: "contours", children: data?.map((datum, index) => (_jsxs("g", { children: [datum.display.isPositiveVisible && (_jsx(ContoursPaths, { id: datum.id, sign: "positive", datum: datum, color: datum.display.positiveColor })), datum.display.isNegativeVisible && (_jsx(ContoursPaths, { id: datum.id, sign: "negative", datum: datum, color: datum.display.negativeColor }))] }, `${datum.id + index}`))) }));
65
+ const alert = useAlert();
66
+ const debounceAlert = useRef(debounce(() => {
67
+ alert.error('Too many contour lines, only showing the first ones');
68
+ }, 2000));
69
+ function timeoutHandler() {
70
+ debounceAlert.current();
71
+ }
72
+ return (_jsx("g", { clipPath: `url(#${displayerKey}clip-chart-2d)`, className: "contours", children: data?.map((datum) => (_jsxs("g", { children: [datum.display.isPositiveVisible && (_jsx(ContoursPaths, { id: datum.id, sign: "positive", datum: datum, color: datum.display.positiveColor, onTimeout: timeoutHandler })), datum.display.isNegativeVisible && (_jsx(ContoursPaths, { id: datum.id, sign: "negative", datum: datum, color: datum.display.negativeColor, onTimeout: timeoutHandler }))] }, datum.id))) }));
56
73
  }
57
74
  const MemoizedContours = memo(ContoursInner);
58
75
  export default function Contours() {
59
- const { data: spectra, displayerKey } = useChartData();
76
+ const { data: spectra, displayerKey, view: { spectra: { activeTab }, }, } = useChartData();
60
77
  const data = useMemo(() => {
61
- return spectra.filter((datum) => datum.info.dimension === 2 && datum.info.isFt);
62
- }, [spectra]);
78
+ return spectra.filter((datum) => datum.info.dimension === 2 &&
79
+ datum.info.isFt &&
80
+ activeTab === nucleusToString(datum.info.nucleus));
81
+ }, [activeTab, spectra]);
63
82
  return _jsx(MemoizedContours, { ...{ data, displayerKey } });
64
83
  }