nmrium 0.31.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 (492) hide show
  1. package/lib/component/1d/Chart1D.js +1 -1
  2. package/lib/component/1d/FooterBanner.js +17 -10
  3. package/lib/component/1d/LinesSeries.js +1 -1
  4. package/lib/component/1d/SpectraTracker.js +1 -1
  5. package/lib/component/1d/Viewer1D.js +1 -1
  6. package/lib/component/1d/XAxis.js +1 -1
  7. package/lib/component/1d/database/DatabaseSpectrum.js +2 -1
  8. package/lib/component/1d/database/ResurrectedDatabaseRanges.js +2 -2
  9. package/lib/component/1d/{Integral.d.ts → integral/Integral.d.ts} +0 -0
  10. package/lib/component/1d/{Integral.js → integral/Integral.js} +2 -2
  11. package/lib/component/1d/integral/IntegralIndicator.d.ts +9 -0
  12. package/lib/component/1d/integral/IntegralIndicator.js +27 -0
  13. package/lib/component/1d/{IntegralResizable.d.ts → integral/IntegralResizable.d.ts} +0 -0
  14. package/lib/component/1d/integral/IntegralResizable.js +69 -0
  15. package/lib/component/1d/{IntegralsSeries.d.ts → integral/IntegralsSeries.d.ts} +0 -0
  16. package/lib/component/1d/{IntegralsSeries.js → integral/IntegralsSeries.js} +4 -4
  17. package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
  18. package/lib/component/1d/multiplicityTree/MultiplicityTree.js +4 -4
  19. package/lib/component/1d/multiplicityTree/buildTreeNode.js +3 -3
  20. package/lib/component/1d/peaks/PeakAnnotation.js +1 -1
  21. package/lib/component/1d/peaks/usePeakShapesPath.js +10 -6
  22. package/lib/component/1d/ranges/Range.js +27 -50
  23. package/lib/component/1d/tool/PeakPointer.js +1 -1
  24. package/lib/component/1d/utilities/scale.js +2 -2
  25. package/lib/component/2d/Contours.js +61 -42
  26. package/lib/component/2d/FooterBanner.js +2 -2
  27. package/lib/component/2d/Left1DChart.js +1 -1
  28. package/lib/component/2d/Top1DChart.js +1 -1
  29. package/lib/component/2d/Viewer2D.js +11 -14
  30. package/lib/component/2d/tools/XYLabelPointer.js +2 -2
  31. package/lib/component/2d/tools/slicing/VerticalSliceChart.js +1 -1
  32. package/lib/component/2d/zones/IndicationLines.js +5 -8
  33. package/lib/component/EventsTrackers/BrushTracker.js +30 -21
  34. package/lib/component/EventsTrackers/KeysListenerTracker.js +14 -15
  35. package/lib/component/NMRium.d.ts +1 -1
  36. package/lib/component/NMRium.js +6 -6
  37. package/lib/component/SplitPaneWrapper.js +1 -1
  38. package/lib/component/assignment/actions/initAssignment.js +17 -17
  39. package/lib/component/assignment/index.js +2 -2
  40. package/lib/component/context/PreferencesContext.js +3 -6
  41. package/lib/component/elements/Button.js +1 -1
  42. package/lib/component/elements/CheckBoxCell.js +1 -1
  43. package/lib/component/elements/ContextMenu.js +2 -2
  44. package/lib/component/elements/EditableColumn.d.ts +3 -1
  45. package/lib/component/elements/EditableColumn.js +21 -8
  46. package/lib/component/elements/GroupPane.d.ts +12 -0
  47. package/lib/component/elements/GroupPane.js +14 -0
  48. package/lib/component/elements/Input.js +7 -4
  49. package/lib/component/elements/IsotopesViewer.js +1 -1
  50. package/lib/component/elements/Label.js +1 -2
  51. package/lib/component/elements/MolecularFormulaInput.js +2 -0
  52. package/lib/component/elements/NumberInput.js +2 -2
  53. package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +1 -1
  54. package/lib/component/elements/ReactTable/ReactTable.d.ts +2 -1
  55. package/lib/component/elements/ReactTable/ReactTable.js +72 -38
  56. package/lib/component/elements/ReactTable/ReactTableFlexLayout.d.ts +3 -2
  57. package/lib/component/elements/ReactTable/ReactTableFlexLayout.js +2 -2
  58. package/lib/component/elements/ReactTable/utility/addCustomColumn.js +3 -3
  59. package/lib/component/elements/ReactTable/utility/useRowSpan.js +3 -7
  60. package/lib/component/elements/accordion/Accordion.js +2 -2
  61. package/lib/component/elements/draggble/useDraggable.js +1 -3
  62. package/lib/component/elements/dropDownButton/DropDownList.js +1 -2
  63. package/lib/component/elements/formik/FormikCheckBox.js +1 -1
  64. package/lib/component/elements/formik/FormikColorPicker.d.ts +0 -1
  65. package/lib/component/elements/formik/FormikColorPicker.js +5 -8
  66. package/lib/component/elements/formik/FormikErrorsSummary.js +2 -2
  67. package/lib/component/elements/formik/FormikForm.js +2 -2
  68. package/lib/component/elements/formik/FormikInput.d.ts +0 -1
  69. package/lib/component/elements/formik/FormikInput.js +12 -20
  70. package/lib/component/elements/formik/FormikOnChange.d.ts +1 -1
  71. package/lib/component/elements/formik/FormikOnChange.js +13 -10
  72. package/lib/component/elements/formik/FormikSelect.js +1 -1
  73. package/lib/component/elements/formik/FormikSlider.d.ts +2 -4
  74. package/lib/component/elements/formik/FormikSlider.js +8 -11
  75. package/lib/component/elements/formik/FormikTextarea.js +1 -1
  76. package/lib/component/elements/linearAxis/LinearVerticalAxis.js +2 -2
  77. package/lib/component/elements/popup/Alert/Provider.js +7 -7
  78. package/lib/component/elements/popup/Alert/index.d.ts +3 -4
  79. package/lib/component/elements/popup/Alert/index.js +3 -4
  80. package/lib/component/elements/popup/Modal/ModalContent.js +3 -1
  81. package/lib/component/elements/popup/Modal/Provider.js +16 -31
  82. package/lib/component/elements/popup/Modal/index.d.ts +4 -5
  83. package/lib/component/elements/popup/Modal/index.js +4 -5
  84. package/lib/component/header/Header.js +1 -1
  85. package/lib/component/hooks/useActiveSpectrumStyleOptions.js +1 -1
  86. package/lib/component/hooks/useCombinedRefs.js +2 -2
  87. package/lib/component/hooks/useExport.d.ts +1 -1
  88. package/lib/component/hooks/useExport.js +9 -6
  89. package/lib/component/hooks/useFormatNumberByNucleus.js +1 -1
  90. package/lib/component/hooks/usePanelPreferences.js +9 -7
  91. package/lib/component/loader/DropZone.js +10 -2
  92. package/lib/component/modal/AlignSpectraModal.js +1 -1
  93. package/lib/component/modal/ExportAsMatrixModal.js +1 -1
  94. package/lib/component/modal/LoadJCAMPModal.js +2 -2
  95. package/lib/component/modal/MultipleSpectraFiltersModal/index.js +1 -1
  96. package/lib/component/modal/MultipletAnalysisModal.js +3 -3
  97. package/lib/component/modal/PredictSpectraModal.js +5 -5
  98. package/lib/component/modal/editRange/EditRangeModal.js +4 -4
  99. package/lib/component/modal/editRange/forms/components/SignalFormInfo.js +1 -1
  100. package/lib/component/modal/editRange/forms/validation/EditRangeValidation.js +2 -2
  101. package/lib/component/modal/setting/DatabasesTabContent.js +25 -20
  102. package/lib/component/modal/setting/DisplayTabContent.js +21 -27
  103. package/lib/component/modal/setting/FormattingTabContent.js +10 -10
  104. package/lib/component/modal/setting/GeneralSettings.js +11 -14
  105. package/lib/component/modal/setting/GeneralTabContent.js +3 -1
  106. package/lib/component/modal/setting/ToolsTabContent.js +18 -19
  107. package/lib/component/modal/setting/WorkspaceItem.d.ts +2 -1
  108. package/lib/component/modal/setting/WorkspaceItem.js +36 -48
  109. package/lib/component/modal/setting/settingsValidation.d.ts +58 -57
  110. package/lib/component/modal/setting/settingsValidation.js +14 -12
  111. package/lib/component/panels/AutomaticAssignment/useAutoAssignments.js +8 -7
  112. package/lib/component/panels/InformationPanel.js +52 -56
  113. package/lib/component/panels/IntegralsPanel/IntegralTable.js +1 -1
  114. package/lib/component/panels/MoleculesPanel/MoleculeHeader.js +1 -1
  115. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +1 -1
  116. package/lib/component/panels/MoleculesPanel/Utilities.js +6 -6
  117. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +16 -17
  118. package/lib/component/panels/MultipleSpectraAnalysisPanel/ColumnHeader.js +1 -1
  119. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleAnalysisCodeEditor.js +1 -1
  120. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
  121. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPreferences.js +18 -17
  122. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisTable.js +2 -2
  123. package/lib/component/panels/PeaksPanel/PeaksPanel.js +1 -1
  124. package/lib/component/panels/PeaksPanel/PeaksTable.js +2 -2
  125. package/lib/component/panels/RangesPanel/RangesHeader.js +1 -1
  126. package/lib/component/panels/RangesPanel/RangesPanel.js +1 -1
  127. package/lib/component/panels/RangesPanel/RangesTable.js +1 -1
  128. package/lib/component/panels/RangesPanel/RangesTableRow.js +1 -3
  129. package/lib/component/panels/RangesPanel/TableColumns/CouplingColumn.js +1 -1
  130. package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.js +2 -2
  131. package/lib/component/panels/RangesPanel/hooks/useMapRanges.js +8 -8
  132. package/lib/component/panels/SpectrumsPanel/SpectrumListItem.js +6 -6
  133. package/lib/component/panels/SpectrumsPanel/SpectrumListPanel.js +3 -3
  134. package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +5 -5
  135. package/lib/component/panels/SpectrumsPanel/base/ColorIndicator.js +2 -2
  136. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.d.ts +1 -1
  137. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.js +2 -1
  138. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.d.ts +1 -1
  139. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.js +2 -1
  140. package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +3 -26
  141. package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +13 -17
  142. package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +16 -17
  143. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +20 -21
  144. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +12 -12
  145. package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.js +1 -5
  146. package/lib/component/panels/SummaryPanel/utilities/Utilities.js +105 -94
  147. package/lib/component/panels/ZonesPanel/ZonesTable.js +8 -8
  148. package/lib/component/panels/databasePanel/DatabasePanel.js +5 -4
  149. package/lib/component/panels/databasePanel/DatabaseTable.d.ts +2 -1
  150. package/lib/component/panels/databasePanel/DatabaseTable.js +20 -5
  151. package/lib/component/panels/extra/preferences/ColumnsHelper.js +5 -2
  152. package/lib/component/panels/extra/utilities/MultiplicityUtilities.d.ts +2 -2
  153. package/lib/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
  154. package/lib/component/panels/filtersPanel/FiltersTable.js +1 -1
  155. package/lib/component/reducer/IgnoreActions.js +3 -3
  156. package/lib/component/reducer/Reducer.d.ts +26 -45
  157. package/lib/component/reducer/Reducer.js +13 -12
  158. package/lib/component/reducer/actions/CorrelationsActions.js +4 -4
  159. package/lib/component/reducer/actions/DomainActions.d.ts +2 -2
  160. package/lib/component/reducer/actions/DomainActions.js +52 -69
  161. package/lib/component/reducer/actions/FiltersActions.js +15 -6
  162. package/lib/component/reducer/actions/HistoryActions.js +5 -5
  163. package/lib/component/reducer/actions/IntegralsActions.js +6 -5
  164. package/lib/component/reducer/actions/LoadActions.js +12 -0
  165. package/lib/component/reducer/actions/PeaksActions.js +7 -6
  166. package/lib/component/reducer/actions/PreferencesActions.js +20 -38
  167. package/lib/component/reducer/actions/RangesActions.d.ts +1 -1
  168. package/lib/component/reducer/actions/RangesActions.js +28 -24
  169. package/lib/component/reducer/actions/SpectrumsActions.js +13 -6
  170. package/lib/component/reducer/actions/ToolsActions.d.ts +1 -1
  171. package/lib/component/reducer/actions/ToolsActions.js +28 -41
  172. package/lib/component/reducer/actions/ZonesActions.js +11 -10
  173. package/lib/component/reducer/core/Constants.js +1 -1
  174. package/lib/component/reducer/helper/GetClosestNumber.js +2 -1
  175. package/lib/component/reducer/helper/Zoom1DManager.js +11 -10
  176. package/lib/component/reducer/helper/getActiveSpectrum.d.ts +3 -0
  177. package/lib/component/reducer/helper/getActiveSpectrum.js +4 -0
  178. package/lib/component/reducer/helper/getSpectrum.js +3 -5
  179. package/lib/component/reducer/helper/getStrongestPeak.d.ts +1 -1
  180. package/lib/component/reducer/helper/getStrongestPeak.js +2 -3
  181. package/lib/component/reducer/preferences/actions/removeWorkspace.js +3 -10
  182. package/lib/component/reducer/preferences/actions/setPreferences.js +5 -6
  183. package/lib/component/reducer/preferences/preferencesReducer.d.ts +2 -2
  184. package/lib/component/reducer/preferences/utilities/mapNucleiFormatting.d.ts +1 -4
  185. package/lib/component/reducer/preferences/utilities/mapNucleiFormatting.js +7 -5
  186. package/lib/component/tool/BrushX.js +3 -3
  187. package/lib/component/tool/BrushXY.js +5 -5
  188. package/lib/component/tool/CrossLinePointer.js +3 -3
  189. package/lib/component/toolbar/BasicToolBar.js +9 -8
  190. package/lib/component/utility/Evaluate.js +2 -2
  191. package/lib/component/utility/FileUtility.d.ts +2 -9
  192. package/lib/component/utility/FileUtility.js +11 -28
  193. package/lib/component/utility/GroupByInfoKey.d.ts +1 -1
  194. package/lib/component/utility/GroupByInfoKey.js +11 -13
  195. package/lib/component/utility/PathBuilder.js +1 -1
  196. package/lib/component/utility/PreferencesHelper.js +2 -3
  197. package/lib/component/utility/{Export.d.ts → export.d.ts} +0 -0
  198. package/lib/component/utility/{Export.js → export.js} +54 -73
  199. package/lib/component/utility/formatNumber.d.ts +6 -1
  200. package/lib/component/utility/formatNumber.js +5 -4
  201. package/lib/component/workspaces/Workspace.d.ts +1 -1
  202. package/lib/component/workspaces/exercise.js +4 -4
  203. package/lib/component/workspaces/workspaceDefaultProperties.js +1 -1
  204. package/lib/data/Filters.d.ts +16 -18
  205. package/lib/data/Filters.js +16 -18
  206. package/lib/data/FiltersManager.js +4 -3
  207. package/lib/data/PredictionManager.js +8 -10
  208. package/lib/data/SpectraManager.d.ts +1 -2
  209. package/lib/data/SpectraManager.js +25 -60
  210. package/lib/data/data1d/MultipleAnalysis.js +74 -70
  211. package/lib/data/data1d/Spectrum1D/SumManager.js +1 -1
  212. package/lib/data/data1d/Spectrum1D/generateJGraphData.js +1 -1
  213. package/lib/data/data1d/Spectrum1D/index.d.ts +24 -25
  214. package/lib/data/data1d/Spectrum1D/index.js +24 -25
  215. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +1 -1
  216. package/lib/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +6 -5
  217. package/lib/data/data1d/Spectrum1D/integrals/updateRelatives.js +8 -10
  218. package/lib/data/data1d/Spectrum1D/peaks/lookupPeak.js +1 -1
  219. package/lib/data/data1d/Spectrum1D/peaks/optimizePeaks.js +2 -2
  220. package/lib/data/data1d/Spectrum1D/ranges/addRange.js +3 -2
  221. package/lib/data/data1d/Spectrum1D/ranges/changeRange.js +2 -2
  222. package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +35 -1
  223. package/lib/data/data1d/Spectrum1D/ranges/mapRanges.d.ts +35 -1
  224. package/lib/data/data1d/Spectrum1D/ranges/mapRanges.js +6 -7
  225. package/lib/data/data1d/database.js +45 -28
  226. package/lib/data/data1d/filter1d/apodization.js +2 -1
  227. package/lib/data/data1d/filter1d/fft.js +24 -7
  228. package/lib/data/data1d/filter1d/phaseCorrection.js +11 -5
  229. package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +1 -1
  230. package/lib/data/data1d/filter1d/zeroFilling.js +1 -1
  231. package/lib/data/data2d/Processing2D.d.ts +3 -3
  232. package/lib/data/data2d/Processing2D.js +10 -20
  233. package/lib/data/data2d/Spectrum2D/contours.d.ts +40 -0
  234. package/lib/data/data2d/Spectrum2D/contours.js +132 -0
  235. package/lib/data/data2d/Spectrum2D/index.d.ts +10 -11
  236. package/lib/data/data2d/Spectrum2D/index.js +10 -11
  237. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +3 -4
  238. package/lib/data/data2d/Spectrum2D/shift/getShift.js +4 -5
  239. package/lib/data/data2d/Spectrum2D/zones/detectZones.js +11 -8
  240. package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.js +1 -1
  241. package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.js +1 -2
  242. package/lib/data/molecules/MoleculeManager.js +1 -1
  243. package/lib/data/types/common/Source.d.ts +1 -0
  244. package/lib/data/types/data1d/index.d.ts +12 -13
  245. package/lib/data/types/data2d/Data2D.d.ts +2 -0
  246. package/lib/data/types/data2d/Datum2D.d.ts +0 -1
  247. package/lib/data/types/data2d/index.d.ts +8 -9
  248. package/lib/data/utilities/RangeUtilities.js +13 -9
  249. package/lib/data/utilities/ZoneUtilities.js +17 -13
  250. package/lib/data/utilities/calculateSanPlot.d.ts +8 -0
  251. package/lib/data/utilities/calculateSanPlot.js +31 -0
  252. package/lib/data/utilities/checkModifierKeyActivated.js +1 -2
  253. package/lib/data/utilities/generateChar.js +8 -6
  254. package/lib/data/utilities/getAtom.js +1 -1
  255. package/lib/data/utilities/getAtomsFromMF.js +2 -2
  256. package/lib/data/utilities/getColor.js +3 -3
  257. package/lib/data/utilities/getSum.js +6 -3
  258. package/lib/types/NMRiumGeneralPreferences.d.ts +2 -2
  259. package/lib/versionInfo.js +1 -1
  260. package/lib-cjs/component/1d/Chart1D.js +1 -1
  261. package/lib-cjs/component/1d/FooterBanner.js +16 -9
  262. package/lib-cjs/component/1d/LinesSeries.js +1 -1
  263. package/lib-cjs/component/1d/SpectraTracker.js +1 -1
  264. package/lib-cjs/component/1d/Viewer1D.js +1 -1
  265. package/lib-cjs/component/1d/XAxis.js +1 -1
  266. package/lib-cjs/component/1d/database/DatabaseSpectrum.js +2 -1
  267. package/lib-cjs/component/1d/database/ResurrectedDatabaseRanges.js +2 -2
  268. package/lib-cjs/component/1d/{Integral.js → integral/Integral.js} +2 -2
  269. package/lib-cjs/component/1d/integral/IntegralIndicator.js +31 -0
  270. package/lib-cjs/component/1d/integral/IntegralResizable.js +74 -0
  271. package/lib-cjs/component/1d/{IntegralsSeries.js → integral/IntegralsSeries.js} +4 -4
  272. package/lib-cjs/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
  273. package/lib-cjs/component/1d/multiplicityTree/MultiplicityTree.js +4 -4
  274. package/lib-cjs/component/1d/multiplicityTree/buildTreeNode.js +3 -3
  275. package/lib-cjs/component/1d/peaks/PeakAnnotation.js +1 -1
  276. package/lib-cjs/component/1d/peaks/usePeakShapesPath.js +10 -6
  277. package/lib-cjs/component/1d/ranges/Range.js +27 -50
  278. package/lib-cjs/component/1d/tool/PeakPointer.js +1 -1
  279. package/lib-cjs/component/1d/utilities/scale.js +2 -2
  280. package/lib-cjs/component/2d/Contours.js +60 -41
  281. package/lib-cjs/component/2d/FooterBanner.js +2 -2
  282. package/lib-cjs/component/2d/Left1DChart.js +1 -1
  283. package/lib-cjs/component/2d/Top1DChart.js +1 -1
  284. package/lib-cjs/component/2d/Viewer2D.js +11 -14
  285. package/lib-cjs/component/2d/tools/XYLabelPointer.js +2 -2
  286. package/lib-cjs/component/2d/tools/slicing/VerticalSliceChart.js +1 -1
  287. package/lib-cjs/component/2d/zones/IndicationLines.js +5 -8
  288. package/lib-cjs/component/EventsTrackers/BrushTracker.js +30 -21
  289. package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +14 -15
  290. package/lib-cjs/component/NMRium.js +7 -7
  291. package/lib-cjs/component/SplitPaneWrapper.js +1 -1
  292. package/lib-cjs/component/assignment/actions/initAssignment.js +17 -17
  293. package/lib-cjs/component/assignment/index.js +2 -2
  294. package/lib-cjs/component/context/PreferencesContext.js +3 -6
  295. package/lib-cjs/component/elements/Button.js +1 -1
  296. package/lib-cjs/component/elements/CheckBoxCell.js +1 -1
  297. package/lib-cjs/component/elements/ContextMenu.js +2 -2
  298. package/lib-cjs/component/elements/EditableColumn.js +21 -8
  299. package/lib-cjs/component/elements/GroupPane.js +18 -0
  300. package/lib-cjs/component/elements/Input.js +7 -4
  301. package/lib-cjs/component/elements/IsotopesViewer.js +1 -1
  302. package/lib-cjs/component/elements/Label.js +1 -2
  303. package/lib-cjs/component/elements/MolecularFormulaInput.js +2 -0
  304. package/lib-cjs/component/elements/NumberInput.js +2 -2
  305. package/lib-cjs/component/elements/ReactTable/Elements/ReactTableRow.js +1 -1
  306. package/lib-cjs/component/elements/ReactTable/ReactTable.js +71 -37
  307. package/lib-cjs/component/elements/ReactTable/ReactTableFlexLayout.js +2 -2
  308. package/lib-cjs/component/elements/ReactTable/utility/addCustomColumn.js +3 -3
  309. package/lib-cjs/component/elements/ReactTable/utility/useRowSpan.js +3 -7
  310. package/lib-cjs/component/elements/accordion/Accordion.js +2 -2
  311. package/lib-cjs/component/elements/draggble/useDraggable.js +1 -3
  312. package/lib-cjs/component/elements/dropDownButton/DropDownList.js +1 -2
  313. package/lib-cjs/component/elements/formik/FormikCheckBox.js +1 -1
  314. package/lib-cjs/component/elements/formik/FormikColorPicker.js +4 -7
  315. package/lib-cjs/component/elements/formik/FormikErrorsSummary.js +2 -2
  316. package/lib-cjs/component/elements/formik/FormikForm.js +2 -2
  317. package/lib-cjs/component/elements/formik/FormikInput.js +12 -20
  318. package/lib-cjs/component/elements/formik/FormikOnChange.js +13 -10
  319. package/lib-cjs/component/elements/formik/FormikSelect.js +1 -1
  320. package/lib-cjs/component/elements/formik/FormikSlider.js +7 -10
  321. package/lib-cjs/component/elements/formik/FormikTextarea.js +1 -1
  322. package/lib-cjs/component/elements/linearAxis/LinearVerticalAxis.js +2 -2
  323. package/lib-cjs/component/elements/popup/Alert/Provider.js +8 -8
  324. package/lib-cjs/component/elements/popup/Alert/index.js +5 -5
  325. package/lib-cjs/component/elements/popup/Modal/ModalContent.js +3 -1
  326. package/lib-cjs/component/elements/popup/Modal/Provider.js +16 -31
  327. package/lib-cjs/component/elements/popup/Modal/index.js +7 -7
  328. package/lib-cjs/component/header/Header.js +1 -1
  329. package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +1 -1
  330. package/lib-cjs/component/hooks/useCombinedRefs.js +2 -2
  331. package/lib-cjs/component/hooks/useExport.js +14 -11
  332. package/lib-cjs/component/hooks/useFormatNumberByNucleus.js +1 -1
  333. package/lib-cjs/component/hooks/usePanelPreferences.js +9 -7
  334. package/lib-cjs/component/loader/DropZone.js +10 -2
  335. package/lib-cjs/component/modal/AlignSpectraModal.js +1 -1
  336. package/lib-cjs/component/modal/ExportAsMatrixModal.js +2 -2
  337. package/lib-cjs/component/modal/LoadJCAMPModal.js +2 -2
  338. package/lib-cjs/component/modal/MultipleSpectraFiltersModal/index.js +1 -1
  339. package/lib-cjs/component/modal/MultipletAnalysisModal.js +3 -3
  340. package/lib-cjs/component/modal/PredictSpectraModal.js +5 -5
  341. package/lib-cjs/component/modal/editRange/EditRangeModal.js +4 -4
  342. package/lib-cjs/component/modal/editRange/forms/components/SignalFormInfo.js +1 -1
  343. package/lib-cjs/component/modal/editRange/forms/validation/EditRangeValidation.js +2 -2
  344. package/lib-cjs/component/modal/setting/DatabasesTabContent.js +25 -20
  345. package/lib-cjs/component/modal/setting/DisplayTabContent.js +21 -27
  346. package/lib-cjs/component/modal/setting/FormattingTabContent.js +10 -10
  347. package/lib-cjs/component/modal/setting/GeneralSettings.js +11 -14
  348. package/lib-cjs/component/modal/setting/GeneralTabContent.js +3 -1
  349. package/lib-cjs/component/modal/setting/ToolsTabContent.js +18 -19
  350. package/lib-cjs/component/modal/setting/WorkspaceItem.js +37 -49
  351. package/lib-cjs/component/modal/setting/settingsValidation.js +14 -12
  352. package/lib-cjs/component/panels/AutomaticAssignment/useAutoAssignments.js +8 -7
  353. package/lib-cjs/component/panels/InformationPanel.js +51 -55
  354. package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +1 -1
  355. package/lib-cjs/component/panels/MoleculesPanel/MoleculeHeader.js +1 -1
  356. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +4 -4
  357. package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +6 -6
  358. package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +16 -17
  359. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/ColumnHeader.js +1 -1
  360. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleAnalysisCodeEditor.js +1 -1
  361. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +2 -2
  362. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPreferences.js +18 -17
  363. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisTable.js +2 -2
  364. package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +1 -1
  365. package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +2 -2
  366. package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +2 -2
  367. package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +2 -2
  368. package/lib-cjs/component/panels/RangesPanel/RangesTable.js +1 -1
  369. package/lib-cjs/component/panels/RangesPanel/RangesTableRow.js +1 -3
  370. package/lib-cjs/component/panels/RangesPanel/TableColumns/CouplingColumn.js +1 -1
  371. package/lib-cjs/component/panels/RangesPanel/hooks/useEditRangeModal.js +2 -2
  372. package/lib-cjs/component/panels/RangesPanel/hooks/useMapRanges.js +8 -8
  373. package/lib-cjs/component/panels/SpectrumsPanel/SpectrumListItem.js +6 -6
  374. package/lib-cjs/component/panels/SpectrumsPanel/SpectrumListPanel.js +3 -3
  375. package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +6 -6
  376. package/lib-cjs/component/panels/SpectrumsPanel/base/ColorIndicator.js +2 -2
  377. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.js +2 -1
  378. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.js +2 -1
  379. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -25
  380. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +13 -17
  381. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +16 -17
  382. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +20 -21
  383. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +12 -12
  384. package/lib-cjs/component/panels/SummaryPanel/SetShiftTolerancesModal.js +1 -5
  385. package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +105 -94
  386. package/lib-cjs/component/panels/ZonesPanel/ZonesTable.js +8 -8
  387. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +5 -4
  388. package/lib-cjs/component/panels/databasePanel/DatabaseTable.js +20 -5
  389. package/lib-cjs/component/panels/extra/preferences/ColumnsHelper.js +5 -2
  390. package/lib-cjs/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
  391. package/lib-cjs/component/panels/filtersPanel/FiltersTable.js +1 -1
  392. package/lib-cjs/component/reducer/IgnoreActions.js +3 -3
  393. package/lib-cjs/component/reducer/Reducer.js +12 -11
  394. package/lib-cjs/component/reducer/actions/CorrelationsActions.js +4 -4
  395. package/lib-cjs/component/reducer/actions/DomainActions.js +52 -69
  396. package/lib-cjs/component/reducer/actions/FiltersActions.js +15 -6
  397. package/lib-cjs/component/reducer/actions/HistoryActions.js +5 -5
  398. package/lib-cjs/component/reducer/actions/IntegralsActions.js +6 -5
  399. package/lib-cjs/component/reducer/actions/LoadActions.js +12 -0
  400. package/lib-cjs/component/reducer/actions/PeaksActions.js +7 -6
  401. package/lib-cjs/component/reducer/actions/PreferencesActions.js +20 -38
  402. package/lib-cjs/component/reducer/actions/RangesActions.js +28 -24
  403. package/lib-cjs/component/reducer/actions/SpectrumsActions.js +12 -5
  404. package/lib-cjs/component/reducer/actions/ToolsActions.js +28 -41
  405. package/lib-cjs/component/reducer/actions/ZonesActions.js +11 -10
  406. package/lib-cjs/component/reducer/core/Constants.js +1 -1
  407. package/lib-cjs/component/reducer/helper/GetClosestNumber.js +2 -1
  408. package/lib-cjs/component/reducer/helper/Zoom1DManager.js +11 -10
  409. package/lib-cjs/component/reducer/helper/getActiveSpectrum.js +8 -0
  410. package/lib-cjs/component/reducer/helper/getSpectrum.js +3 -5
  411. package/lib-cjs/component/reducer/helper/getStrongestPeak.js +2 -3
  412. package/lib-cjs/component/reducer/preferences/actions/removeWorkspace.js +3 -10
  413. package/lib-cjs/component/reducer/preferences/actions/setPreferences.js +5 -9
  414. package/lib-cjs/component/reducer/preferences/utilities/mapNucleiFormatting.js +7 -5
  415. package/lib-cjs/component/tool/BrushX.js +3 -3
  416. package/lib-cjs/component/tool/BrushXY.js +5 -5
  417. package/lib-cjs/component/tool/CrossLinePointer.js +3 -3
  418. package/lib-cjs/component/toolbar/BasicToolBar.js +8 -7
  419. package/lib-cjs/component/utility/Evaluate.js +2 -2
  420. package/lib-cjs/component/utility/FileUtility.js +11 -29
  421. package/lib-cjs/component/utility/GroupByInfoKey.js +11 -13
  422. package/lib-cjs/component/utility/PathBuilder.js +1 -1
  423. package/lib-cjs/component/utility/PreferencesHelper.js +2 -3
  424. package/lib-cjs/component/utility/{Export.js → export.js} +78 -74
  425. package/lib-cjs/component/utility/formatNumber.js +5 -4
  426. package/lib-cjs/component/workspaces/exercise.js +4 -4
  427. package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +1 -1
  428. package/lib-cjs/data/Filters.js +17 -35
  429. package/lib-cjs/data/FiltersManager.js +4 -3
  430. package/lib-cjs/data/PredictionManager.js +8 -10
  431. package/lib-cjs/data/SpectraManager.js +26 -62
  432. package/lib-cjs/data/data1d/MultipleAnalysis.js +74 -70
  433. package/lib-cjs/data/data1d/Spectrum1D/SumManager.js +1 -1
  434. package/lib-cjs/data/data1d/Spectrum1D/generateJGraphData.js +1 -1
  435. package/lib-cjs/data/data1d/Spectrum1D/index.js +25 -25
  436. package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +1 -1
  437. package/lib-cjs/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +6 -5
  438. package/lib-cjs/data/data1d/Spectrum1D/integrals/updateRelatives.js +8 -10
  439. package/lib-cjs/data/data1d/Spectrum1D/peaks/lookupPeak.js +1 -1
  440. package/lib-cjs/data/data1d/Spectrum1D/peaks/optimizePeaks.js +2 -2
  441. package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +3 -2
  442. package/lib-cjs/data/data1d/Spectrum1D/ranges/changeRange.js +2 -2
  443. package/lib-cjs/data/data1d/Spectrum1D/ranges/mapRanges.js +6 -7
  444. package/lib-cjs/data/data1d/database.js +45 -28
  445. package/lib-cjs/data/data1d/filter1d/apodization.js +2 -1
  446. package/lib-cjs/data/data1d/filter1d/fft.js +23 -6
  447. package/lib-cjs/data/data1d/filter1d/phaseCorrection.js +10 -4
  448. package/lib-cjs/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +1 -1
  449. package/lib-cjs/data/data1d/filter1d/zeroFilling.js +1 -1
  450. package/lib-cjs/data/data2d/Processing2D.js +10 -20
  451. package/lib-cjs/data/data2d/Spectrum2D/contours.js +138 -0
  452. package/lib-cjs/data/data2d/Spectrum2D/index.js +11 -11
  453. package/lib-cjs/data/data2d/Spectrum2D/initiateDatum2D.js +3 -4
  454. package/lib-cjs/data/data2d/Spectrum2D/shift/getShift.js +4 -5
  455. package/lib-cjs/data/data2d/Spectrum2D/zones/detectZones.js +11 -8
  456. package/lib-cjs/data/data2d/Spectrum2D/zones/detectZonesManual.js +1 -1
  457. package/lib-cjs/data/data2d/Spectrum2D/zones/getDetectionZones.js +1 -2
  458. package/lib-cjs/data/molecules/MoleculeManager.js +1 -1
  459. package/lib-cjs/data/utilities/RangeUtilities.js +13 -9
  460. package/lib-cjs/data/utilities/ZoneUtilities.js +17 -13
  461. package/lib-cjs/data/utilities/calculateSanPlot.js +35 -0
  462. package/lib-cjs/data/utilities/checkModifierKeyActivated.js +1 -2
  463. package/lib-cjs/data/utilities/generateChar.js +8 -6
  464. package/lib-cjs/data/utilities/getAtom.js +1 -1
  465. package/lib-cjs/data/utilities/getAtomsFromMF.js +2 -2
  466. package/lib-cjs/data/utilities/getColor.js +3 -3
  467. package/lib-cjs/data/utilities/getSum.js +6 -3
  468. package/lib-cjs/versionInfo.js +1 -1
  469. package/package.json +36 -31
  470. package/lib/component/1d/IntegralResizable.js +0 -72
  471. package/lib/component/elements/popup/helpers.d.ts +0 -1
  472. package/lib/component/elements/popup/helpers.js +0 -9
  473. package/lib/component/panels/RangesPanel/TableColumns/format.d.ts +0 -1
  474. package/lib/component/panels/RangesPanel/TableColumns/format.js +0 -8
  475. package/lib/data/data1d/Data1DManager.d.ts +0 -3
  476. package/lib/data/data1d/Data1DManager.js +0 -98
  477. package/lib/data/data1d/filter1d/absolute.d.ts +0 -13
  478. package/lib/data/data1d/filter1d/absolute.js +0 -26
  479. package/lib/data/data2d/Data2DManager.d.ts +0 -3
  480. package/lib/data/data2d/Data2DManager.js +0 -34
  481. package/lib/data/types/data2d/Contour.d.ts +0 -4
  482. package/lib/data/types/data2d/Contour.js +0 -1
  483. package/lib/data/types/data2d/Contours.d.ts +0 -2
  484. package/lib/data/types/data2d/Contours.js +0 -1
  485. package/lib-cjs/component/1d/IntegralResizable.js +0 -77
  486. package/lib-cjs/component/elements/popup/helpers.js +0 -13
  487. package/lib-cjs/component/panels/RangesPanel/TableColumns/format.js +0 -14
  488. package/lib-cjs/data/data1d/Data1DManager.js +0 -104
  489. package/lib-cjs/data/data1d/filter1d/absolute.js +0 -32
  490. package/lib-cjs/data/data2d/Data2DManager.js +0 -40
  491. package/lib-cjs/data/types/data2d/Contour.js +0 -2
  492. package/lib-cjs/data/types/data2d/Contours.js +0 -2
@@ -1,10 +1,8 @@
1
1
  export function getSpectrum(state, value) {
2
2
  const activeSpectrum = state.view.spectra.activeSpectra[state.view.spectra.activeTab];
3
- if (value === undefined) {
4
- if (activeSpectrum?.id) {
5
- const index = activeSpectrum.index;
6
- return state.data[index];
7
- }
3
+ if (value === undefined && activeSpectrum?.id) {
4
+ const index = activeSpectrum.index;
5
+ return state.data[index];
8
6
  }
9
7
  if (typeof value === 'number') {
10
8
  return state.data[value] || undefined;
@@ -2,6 +2,6 @@ import { Draft } from 'immer';
2
2
  import { State } from '../Reducer';
3
3
  export declare function getStrongestPeak(draft: Draft<State>): {
4
4
  xValue: number;
5
- yValue: number | undefined;
5
+ yValue: number;
6
6
  index: number;
7
7
  } | undefined;
@@ -1,11 +1,10 @@
1
1
  import { max } from 'd3';
2
2
  export function getStrongestPeak(draft) {
3
- const { data } = draft;
4
3
  const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
5
4
  if (activeSpectrum) {
6
- const activeData = data[activeSpectrum?.index].data;
5
+ const activeData = draft.data[activeSpectrum?.index].data;
7
6
  const strongestPeakValue = max(activeData.re);
8
- const index = activeData.re.findIndex((val) => val === strongestPeakValue);
7
+ const index = activeData.re.indexOf(strongestPeakValue);
9
8
  return {
10
9
  xValue: activeData.x[index],
11
10
  yValue: strongestPeakValue,
@@ -1,4 +1,3 @@
1
- import { original } from 'immer';
2
1
  import { getLocalStorage, storeData } from '../../../utility/LocalStorage';
3
2
  import { filterObject } from '../utilities/filterObject';
4
3
  export function removeWorkspace(draft, action) {
@@ -7,14 +6,8 @@ export function removeWorkspace(draft, action) {
7
6
  draft.workspace.current = 'default';
8
7
  }
9
8
  let localData = getLocalStorage('nmr-general-settings');
10
- const storedWorkspaces = original(draft)?.workspaces || {};
11
- const workspaces = Object.keys(storedWorkspaces).reduce((acc, key) => {
12
- if (key !== workspace) {
13
- acc[key] = storedWorkspaces[key];
14
- }
15
- return acc;
16
- }, {});
17
- draft.workspaces = workspaces;
18
- localData.workspaces = filterObject(workspaces);
9
+ // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
10
+ delete draft.workspaces[workspace];
11
+ localData.workspaces = filterObject(draft.workspaces);
19
12
  storeData('nmr-general-settings', JSON.stringify(localData));
20
13
  }
@@ -1,11 +1,9 @@
1
- import lodashMerge from 'lodash/merge';
2
1
  import { getLocalStorage, storeData } from '../../../utility/LocalStorage';
3
2
  import { getActiveWorkspace } from '../utilities/getActiveWorkspace';
4
3
  import { mapNucleiFormatting } from '../utilities/mapNucleiFormatting';
5
4
  export function setPreferences(draft, action) {
6
5
  if (action.payload) {
7
- let currentWorkspacePreferences = getActiveWorkspace(draft);
8
- let { general, formatting, display, databases } = action.payload;
6
+ let { general = {}, formatting, display, databases } = action.payload;
9
7
  formatting = mapNucleiFormatting(formatting);
10
8
  let localData = getLocalStorage('nmr-general-settings');
11
9
  localData.currentWorkspace = draft.workspace.current;
@@ -20,12 +18,13 @@ export function setPreferences(draft, action) {
20
18
  },
21
19
  };
22
20
  storeData('nmr-general-settings', JSON.stringify(localData));
23
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
24
- currentWorkspacePreferences = lodashMerge(currentWorkspacePreferences, {
21
+ const currentWorkspacePreferences = getActiveWorkspace(draft);
22
+ draft.workspaces[draft.workspace.current] = {
23
+ ...currentWorkspacePreferences,
25
24
  general,
26
25
  formatting,
27
26
  databases,
28
27
  display,
29
- });
28
+ };
30
29
  }
31
30
  }
@@ -48,7 +48,7 @@ declare const preferencesReducer: (base: {
48
48
  readonly open?: boolean | undefined;
49
49
  } | undefined;
50
50
  readonly hidePanelOnLoad?: boolean | undefined;
51
- readonly initialPanelWidth?: import("analysis-ui-components/lib-esm/components/SplitPane").InitialSeparation | undefined;
51
+ readonly initialPanelWidth?: import("analysis-ui-components").SplitPaneSize | undefined;
52
52
  } | undefined;
53
53
  readonly panels?: {
54
54
  readonly spectraPanel?: {
@@ -127,7 +127,7 @@ declare const preferencesReducer: (base: {
127
127
  } | undefined;
128
128
  };
129
129
  readonly general: {
130
- readonly dimmedSpectraTransparency: number;
130
+ readonly dimmedSpectraOpacity: number;
131
131
  };
132
132
  readonly formatting: {
133
133
  readonly nuclei: {
@@ -1,5 +1,2 @@
1
1
  import { Formatting } from '../../../workspaces/Workspace';
2
- export declare function mapNucleiFormatting(formatting: Formatting): {
3
- panels: Partial<import("../../../workspaces/Workspace").PanelsPreferences>;
4
- nuclei: {};
5
- };
2
+ export declare function mapNucleiFormatting(formatting: Formatting): Formatting;
@@ -1,8 +1,10 @@
1
1
  export function mapNucleiFormatting(formatting) {
2
2
  const { nuclei, ...res } = formatting;
3
- const _nuclei = Object.keys(nuclei).reduce((nucleusFormatting, key) => {
4
- nucleusFormatting[nuclei[key].name.trim().toLowerCase()] = nuclei[key];
5
- return nucleusFormatting;
6
- }, {});
7
- return { nuclei: _nuclei, ...res };
3
+ return {
4
+ nuclei: Object.fromEntries(Object.keys(nuclei).map((key) => [
5
+ nuclei[key].name.trim().toLowerCase(),
6
+ nuclei[key],
7
+ ])),
8
+ ...res,
9
+ };
8
10
  }
@@ -11,7 +11,7 @@ const styles = {
11
11
  left: '0px',
12
12
  },
13
13
  };
14
- const allowTools = [
14
+ const allowTools = new Set([
15
15
  options.zoom.id,
16
16
  options.zeroFilling.id,
17
17
  options.peakPicking.id,
@@ -20,11 +20,11 @@ const allowTools = [
20
20
  options.baselineCorrection.id,
21
21
  options.rangePicking.id,
22
22
  options.exclusionZones.id,
23
- ];
23
+ ]);
24
24
  export default function BrushX() {
25
25
  const { width, height, toolOptions: { selectedTool }, } = useChartData();
26
26
  const { startX, endX, step } = useContext(BrushContext);
27
- if (!allowTools.includes(selectedTool) || step !== 'brushing')
27
+ if (!allowTools.has(selectedTool) || step !== 'brushing')
28
28
  return null;
29
29
  const scale = (endX - startX) / width;
30
30
  return (_jsx("div", { style: {
@@ -12,7 +12,7 @@ const styles = {
12
12
  zoom: '100%',
13
13
  },
14
14
  };
15
- const allowTools = [
15
+ const allowTools = new Set([
16
16
  options.zoom.id,
17
17
  options.apodization.id,
18
18
  options.zeroFilling.id,
@@ -27,7 +27,7 @@ const allowTools = [
27
27
  options.multipleSpectraAnalysis.id,
28
28
  options.exclusionZones.id,
29
29
  options.databaseRangesSelection.id,
30
- ];
30
+ ]);
31
31
  export const BRUSH_TYPE = {
32
32
  X: 1,
33
33
  Y: 2,
@@ -40,7 +40,7 @@ const defaultDimensionBorder = {
40
40
  export default function BrushXY({ brushType = BRUSH_TYPE.XY, dimensionBorder = defaultDimensionBorder, width: widthProps, height: heightProps, }) {
41
41
  let { width, height, toolOptions: { selectedTool }, } = useChartData();
42
42
  let { startX, endX, startY, endY, step } = useContext(BrushContext);
43
- if (!allowTools.includes(selectedTool) ||
43
+ if (!allowTools.has(selectedTool) ||
44
44
  step !== 'brushing' ||
45
45
  !dimensionBorder ||
46
46
  (dimensionBorder.startX && startX < dimensionBorder.startX) ||
@@ -55,8 +55,8 @@ export default function BrushXY({ brushType = BRUSH_TYPE.XY, dimensionBorder = d
55
55
  : endY < dimensionBorder.startY))) {
56
56
  return null;
57
57
  }
58
- width = widthProps ? widthProps : width;
59
- height = heightProps ? heightProps : height;
58
+ width = widthProps || width;
59
+ height = heightProps || height;
60
60
  endX =
61
61
  dimensionBorder.endX && endX > dimensionBorder.endX
62
62
  ? dimensionBorder.endX
@@ -13,7 +13,7 @@ const styles = {
13
13
  willChange: 'transform',
14
14
  },
15
15
  };
16
- const allowTools = [
16
+ const allowTools = new Set([
17
17
  options.zoom.id,
18
18
  options.apodization.id,
19
19
  options.equalizer.id,
@@ -26,12 +26,12 @@ const allowTools = [
26
26
  options.multipleSpectraAnalysis.id,
27
27
  options.exclusionZones.id,
28
28
  options.databaseRangesSelection.id,
29
- ];
29
+ ]);
30
30
  function CrossLinePointer() {
31
31
  const { height, width, margin, toolOptions: { selectedTool }, } = useChartData();
32
32
  let position = useContext(MouseContext);
33
33
  const brushState = useContext(BrushContext);
34
- if (!allowTools.includes(selectedTool) ||
34
+ if (!allowTools.has(selectedTool) ||
35
35
  brushState.step === 'brushing' ||
36
36
  !position ||
37
37
  position.x > width - margin.right ||
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Toolbar } from 'analysis-ui-components';
3
3
  import { SvgNmrRealImag, SvgNmrOverlay3, SvgNmrOverlay3Aligned, SvgNmrAlignBottom, SvgNmrAlignCenter, } from 'cheminfo-font';
4
- import { Fragment, useCallback, memo, useMemo } from 'react';
4
+ import { Fragment, useCallback, memo } from 'react';
5
5
  import { FaDownload, FaFileDownload, FaFileImage, FaCopy, FaFileExport, FaFile, FaFileImport, } from 'react-icons/fa';
6
6
  import { useChartData } from '../context/ChartContext';
7
7
  import { useDispatch } from '../context/DispatchContext';
@@ -74,11 +74,12 @@ function BasicToolBarInner({ info, verticalAlign, ftCounter, fidCounter, activeS
74
74
  const openLoader = useLoader();
75
75
  const isExperimentalFeature = useCheckExperimentalFeature();
76
76
  const isButtonVisible = useCheckToolsVisibility();
77
- const importMenu = useMemo(() => {
78
- return isExperimentalFeature
79
- ? IMPORT_MENU
80
- : IMPORT_MENU.filter((item) => item.id !== 'importPublicationString');
81
- }, [isExperimentalFeature]);
77
+ const importMenu = isExperimentalFeature
78
+ ? IMPORT_MENU
79
+ : IMPORT_MENU.filter((item) => item.id !== 'importPublicationString');
80
+ const exportMenu = isExperimentalFeature
81
+ ? EXPORT_MENU
82
+ : EXPORT_MENU.filter((item) => item.id !== 'nmre');
82
83
  const { isRealSpectrumShown, changeSpectrumViewHandler, changeDisplayViewModeHandler, alignSpectrumsVerticallyHandler, } = useToolsFunctions();
83
84
  const { saveAsSVGHandler, saveAsPNGHandler, saveAsJSONHandler, saveToClipboardHandler, saveAsHandler, } = useExport();
84
85
  const LoadJacmpHandler = useCallback((file) => {
@@ -123,7 +124,7 @@ function BasicToolBarInner({ info, verticalAlign, ftCounter, fidCounter, activeS
123
124
  void saveAsPNGHandler();
124
125
  break;
125
126
  case 'json':
126
- void saveAsJSONHandler();
127
+ saveAsJSONHandler();
127
128
  break;
128
129
  case 'advance_save':
129
130
  void saveAsHandler();
@@ -147,7 +148,7 @@ function BasicToolBarInner({ info, verticalAlign, ftCounter, fidCounter, activeS
147
148
  }, items: importMenu })), isButtonVisible('exportAs') && (_jsx(ToolbarMenu, { component: _jsx(FaFileExport, {}), toolTip: "Export As", onClick: (element) => {
148
149
  exportHandler(element);
149
150
  return null;
150
- }, items: EXPORT_MENU })), isButtonVisible('spectraStackAlignments') &&
151
+ }, items: exportMenu })), isButtonVisible('spectraStackAlignments') &&
151
152
  ftCounter > 1 &&
152
153
  (info?.isFt || !activeSpectrum) && (_jsx(Toolbar.Item, { id: "spectra-alignment", className: "cheminfo", title: "Spectra alignment ( Press s )", onClick: changeDisplayViewModeHandler, children: verticalAlign.align === 'stack' ? (_jsx(SvgNmrOverlay3Aligned, {})) : (_jsx(SvgNmrOverlay3, {})) })), isButtonVisible('realImaginary') && info.isComplex && (_jsx(Toolbar.Item, { id: "display", title: isRealSpectrumShown ? 'Display Real ' : 'Display Imaginary', onClick: changeSpectrumViewHandler, className: "cheminfo", children: _jsx(SvgNmrRealImag, {}) })), isButtonVisible('spectraCenterAlignments') &&
153
154
  (ftCounter > 0 || fidCounter > 0) && (_jsx(Toolbar.Item, { id: "baseline-position", title: verticalAlign.align === 'bottom'
@@ -3,7 +3,7 @@ export default function calculate(code, args = null) {
3
3
  // eslint-disable-next-line no-new-func
4
4
  return new Function('args', `return ${code}`)(args);
5
5
  }
6
- catch (e) {
7
- return e;
6
+ catch (error) {
7
+ return error;
8
8
  }
9
9
  }
@@ -13,7 +13,7 @@ export declare const FILES_SIGNATURES: {
13
13
  };
14
14
  declare function getFileSignature(fileArrayBuffer: any): string;
15
15
  declare function loadFile(file: any, options?: {
16
- asBuffer: boolean;
16
+ asBuffer?: boolean;
17
17
  }): Promise<string | ArrayBuffer>;
18
18
  declare function getFileExtension(name: any): any;
19
19
  declare function getFileName(name: any): any;
@@ -31,11 +31,4 @@ declare function extractFileMetaFromPath(path: any): {
31
31
  declare function loadFiles<T = unknown>(acceptedFiles: any, options?: {
32
32
  asBuffer?: boolean;
33
33
  }): Promise<T[]>;
34
- declare function loadFilesFromZip(files: any, options?: {
35
- asBuffer?: boolean;
36
- }): Promise<{
37
- binary: any;
38
- name: string;
39
- extension: string;
40
- }[]>;
41
- export { loadFiles, loadFilesFromZip, loadFile, getFileExtension, getFileName, extractFileMetaFromPath, getFileSignature, };
34
+ export { loadFiles, loadFile, getFileExtension, getFileName, extractFileMetaFromPath, getFileSignature, };
@@ -12,14 +12,13 @@ export const FILES_SIGNATURES = {
12
12
  ZIP: '504b0304',
13
13
  };
14
14
  function getFileSignature(fileArrayBuffer) {
15
- return new Uint8Array(fileArrayBuffer)
16
- .slice(0, 4)
17
- .reduce((acc, byte) => (acc += byte.toString(16).padStart(2, '0')), '');
15
+ return Array.from(new Uint8Array(fileArrayBuffer).slice(0, 4), (byte) => byte.toString(16).padStart(2, '0')).join('');
18
16
  }
19
- async function loadFile(file, options = { asBuffer: false }) {
17
+ async function loadFile(file, options = {}) {
18
+ const { asBuffer = false } = options;
20
19
  const response = await fetch(file);
21
20
  checkStatus(response);
22
- const data = options.asBuffer ? response.arrayBuffer() : response.text();
21
+ const data = asBuffer ? response.arrayBuffer() : response.text();
23
22
  return data;
24
23
  }
25
24
  function checkStatus(response) {
@@ -32,10 +31,10 @@ function getFileExtension(name) {
32
31
  return name.replace(/^.*\./, '').toLowerCase();
33
32
  }
34
33
  function getFileName(name) {
35
- return name.substr(0, name.lastIndexOf('.'));
34
+ return name.slice(0, Math.max(0, name.lastIndexOf('.')));
36
35
  }
37
36
  function extractFileMetaFromPath(path) {
38
- const meta = path.replace(/^.*[\\/]/, '').split('.');
37
+ const meta = path.replace(/^.*[/\\]/, '').split('.');
39
38
  return { name: meta[0].toLowerCase(), extension: meta[1].toLowerCase() };
40
39
  }
41
40
  /**
@@ -49,16 +48,16 @@ function loadFiles(acceptedFiles, options = {}) {
49
48
  return Promise.all([].map.call(acceptedFiles, (file) => {
50
49
  return new Promise((resolve, reject) => {
51
50
  const reader = new FileReader();
52
- reader.onabort = (e) => reject(e);
53
- reader.onerror = (e) => reject(e);
54
- reader.onload = () => {
51
+ reader.addEventListener('abort', (e) => reject(e));
52
+ reader.addEventListener('error', (e) => reject(e));
53
+ reader.addEventListener('load', () => {
55
54
  if (reader.result) {
56
55
  const binary = reader.result;
57
56
  const name = getFileName(file.name);
58
57
  const extension = getFileExtension(file.name);
59
58
  resolve({ binary, name, extension });
60
59
  }
61
- };
60
+ });
62
61
  if (options.asBuffer) {
63
62
  reader.readAsArrayBuffer(file);
64
63
  }
@@ -68,20 +67,4 @@ function loadFiles(acceptedFiles, options = {}) {
68
67
  });
69
68
  }));
70
69
  }
71
- async function loadFilesFromZip(files, options = {}) {
72
- const result = [];
73
- for (const file of files) {
74
- try {
75
- const binary = await file.async(options.asBuffer ? 'uint8array' : 'text');
76
- const name = getFileName(file.name);
77
- const extension = getFileExtension(file.name);
78
- result.push({ binary, name, extension });
79
- }
80
- catch (e) {
81
- // eslint-disable-next-line no-console
82
- console.error(e);
83
- }
84
- }
85
- return result;
86
- }
87
- export { loadFiles, loadFilesFromZip, loadFile, getFileExtension, getFileName, extractFileMetaFromPath, getFileSignature, };
70
+ export { loadFiles, loadFile, getFileExtension, getFileName, extractFileMetaFromPath, getFileSignature, };
@@ -1 +1 @@
1
- export default function GroupByInfoKey(key: any): (array: any, orderByNucleus?: boolean) => any;
1
+ export default function GroupByInfoKey(key: string): (array: any, orderByNucleus?: boolean) => {};
@@ -1,28 +1,26 @@
1
1
  function getNucleusSum(input) {
2
2
  const nucleus = input.split(',');
3
- return nucleus.reduce((acc, i) => {
3
+ let output = 0;
4
+ for (const i of nucleus) {
4
5
  const additions = nucleus.length === 2 ? 100 : 0;
5
- acc += Number(i.replace(/\D/g, '')) + additions;
6
- return acc;
7
- }, 0);
6
+ output += Number(i.replace(/\D/g, '')) + additions;
7
+ }
8
+ return output;
8
9
  }
9
10
  export default function GroupByInfoKey(key) {
10
11
  return (array, orderByNucleus = false) => {
11
- const unorderedGroup = array.reduce((objectsByKeyValue, obj) => {
12
+ const unorderedGroup = {};
13
+ for (const obj of array) {
12
14
  const value = obj.info[key];
13
- objectsByKeyValue[value] = (objectsByKeyValue[value] || []).concat(obj);
14
- return objectsByKeyValue;
15
- }, {});
15
+ unorderedGroup[value] = (unorderedGroup[value] || []).concat(obj);
16
+ }
16
17
  if (!orderByNucleus) {
17
18
  return unorderedGroup;
18
19
  }
19
20
  else {
20
- return Object.keys(unorderedGroup)
21
+ return Object.fromEntries(Object.keys(unorderedGroup)
21
22
  .sort((a, b) => getNucleusSum(a) - getNucleusSum(b))
22
- .reduce((acc, key) => {
23
- acc[key] = unorderedGroup[key];
24
- return acc;
25
- }, {});
23
+ .map((key) => [key, unorderedGroup[key]]));
26
24
  }
27
25
  };
28
26
  }
@@ -9,7 +9,7 @@ export class PathBuilder {
9
9
  this.array.push(`L ${x} ${y}`);
10
10
  }
11
11
  closePath() {
12
- if (this.array.length !== 0)
12
+ if (this.array.length > 0)
13
13
  this.array.push('Z');
14
14
  }
15
15
  toString() {
@@ -1,9 +1,8 @@
1
1
  import { getLocalStorage, getValue } from './LocalStorage';
2
2
  function GetPreference(preferences, key) {
3
3
  const localData = getLocalStorage('nmr-general-settings');
4
- const val = getValue(preferences, `formatting.panels.[${key}]`)
5
- ? getValue(preferences, `formatting.panels.[${key}]`)
6
- : getValue(localData, `formatting.panels.[${key}]`);
4
+ const val = getValue(preferences, `formatting.panels.[${key}]`) ||
5
+ getValue(localData, `formatting.panels.[${key}]`);
7
6
  return val;
8
7
  }
9
8
  export { GetPreference };
@@ -1,52 +1,34 @@
1
+ import * as clipboard from 'clipboard-polyfill';
1
2
  import { saveAs } from 'file-saver';
2
3
  import JSZip from 'jszip';
3
- function copyFormattedHtml(html) {
4
- // Create an iframe (isolated container) for the HTML
5
- let container = document.createElement('div');
6
- container.innerHTML = html;
7
- // Hide element
8
- container.style.position = 'fixed';
9
- container.style.pointerEvents = 'none';
10
- container.style.opacity = '0';
11
- // Detect all style sheets of the page
12
- let activeSheets = Array.prototype.slice
13
- .call(document.styleSheets)
14
- .filter((sheet) => {
15
- return !sheet.disabled;
16
- });
17
- // Mount the iframe to the DOM to make `contentWindow` available
18
- document.body.appendChild(container);
19
- // Copy to clipboard
20
- window.getSelection()?.removeAllRanges();
21
- let range = document.createRange();
22
- range.selectNode(container);
23
- window.getSelection()?.addRange(range);
24
- document.execCommand('copy');
25
- for (const active of activeSheets) {
26
- active.disabled = true;
27
- }
28
- document.execCommand('copy');
29
- for (const active of activeSheets) {
30
- active.disabled = false;
31
- }
32
- // Remove the iframe
33
- document.body.removeChild(container);
34
- }
35
4
  async function copyHTMLToClipboard(data) {
36
- try {
37
- copyFormattedHtml(data);
38
- return true;
39
- }
40
- catch (err) {
41
- return false;
42
- }
5
+ return copyToClipboard(data, 'text/html');
43
6
  }
44
7
  async function copyTextToClipboard(data) {
8
+ return copyToClipboard(data, 'text/plain');
9
+ }
10
+ async function copyToClipboard(data, type) {
45
11
  try {
46
- await navigator.clipboard.writeText(data);
12
+ if (typeof ClipboardItem !== 'undefined') {
13
+ void navigator.clipboard.write([
14
+ new ClipboardItem({
15
+ [type]: new Promise((resolve) => {
16
+ resolve(new Blob([data], { type }));
17
+ }),
18
+ }),
19
+ ]);
20
+ }
21
+ else {
22
+ //TODO when Firefox team implement ClipboardItem this code should be removed
23
+ // this library is used mainly to solve the problem of copy HTML to a clipboard in Firefox but we use it for both HTML and plain text
24
+ const item = new clipboard.ClipboardItem({
25
+ [type]: new Blob([data], { type }),
26
+ });
27
+ await clipboard.write([item]);
28
+ }
47
29
  return true;
48
30
  }
49
- catch (err) {
31
+ catch {
50
32
  return false;
51
33
  }
52
34
  }
@@ -73,9 +55,9 @@ async function exportAsJSON(data, fileName = 'experiment', spaceIndent = 0, isCo
73
55
  });
74
56
  saveAs(blob, `${fileName}.nmrium`);
75
57
  }
76
- catch (e) {
77
- // eslint-disable-next-line no-console
78
- console.log(e);
58
+ catch (error) {
59
+ // TODO: handle error.
60
+ reportError(error);
79
61
  }
80
62
  }
81
63
  }
@@ -126,33 +108,34 @@ function exportAsPng(rootRef, elementID, fileName = 'experiment') {
126
108
  }
127
109
  let img = new Image();
128
110
  let url = URL.createObjectURL(blob);
129
- img.onload = async () => {
111
+ img.addEventListener('load', () => {
130
112
  context?.drawImage(img, 0, 0);
131
113
  let png = canvas.toDataURL('image/png', 1);
132
114
  saveAs(png, `${fileName}.png`);
133
115
  URL.revokeObjectURL(png);
134
- };
116
+ });
135
117
  img.src = url;
136
118
  }
137
- catch (e) {
138
- // eslint-disable-next-line no-console
139
- console.log(e);
119
+ catch (error) {
120
+ // TODO: handle error.
121
+ reportError(error);
140
122
  }
141
123
  }
142
- function copyDataURLCliboard(image) {
124
+ // hack way to copy the image to the clipboard
125
+ function copyDataURLClipboardFireFox(image) {
143
126
  const img = document.createElement('img');
144
127
  img.src = image;
145
128
  img.style.position = 'fixed';
146
129
  img.style.pointerEvents = 'none';
147
130
  img.style.opacity = '0';
148
- document.body.appendChild(img);
131
+ document.body.append(img);
149
132
  const range = document.createRange();
150
133
  range.selectNode(img);
151
134
  window.getSelection()?.addRange(range);
152
135
  document.execCommand('Copy');
153
- document.body.removeChild(img);
136
+ img.remove();
154
137
  }
155
- function copyBlobToCliboard(canvas) {
138
+ function copyBlobToClipboard(canvas) {
156
139
  canvas.toBlob((b) => {
157
140
  const clip = new ClipboardItem({
158
141
  [b.type]: b,
@@ -160,9 +143,9 @@ function copyBlobToCliboard(canvas) {
160
143
  navigator.clipboard.write([clip]).then(() => {
161
144
  // eslint-disable-next-line no-console
162
145
  console.log('experiment copied.');
163
- }, (err) => {
164
- // eslint-disable-next-line no-console
165
- console.log(err);
146
+ }, (error) => {
147
+ // TODO: handle error;
148
+ reportError(error);
166
149
  });
167
150
  });
168
151
  }
@@ -179,44 +162,42 @@ function copyPNGToClipboard(rootRef, elementID) {
179
162
  }
180
163
  let img = new Image();
181
164
  const url = URL.createObjectURL(blob);
182
- img.onload = async () => {
165
+ img.addEventListener('load', async () => {
183
166
  context?.drawImage(img, 0, 0);
184
167
  const png = canvas.toDataURL('image/png', 1);
185
168
  // @ts-expect-error write exists in some browsers
186
169
  if (navigator.clipboard.write) {
187
- copyBlobToCliboard(canvas);
170
+ copyBlobToClipboard(canvas);
188
171
  }
189
172
  else {
190
- copyDataURLCliboard(png);
173
+ copyDataURLClipboardFireFox(png);
191
174
  }
192
175
  URL.revokeObjectURL(png);
193
- };
176
+ });
194
177
  img.src = url;
195
178
  }
196
- catch (e) {
197
- if (e instanceof ReferenceError) {
179
+ catch (error) {
180
+ if (error instanceof ReferenceError) {
198
181
  // eslint-disable-next-line no-alert
199
182
  alert('Your browser does not support this feature, please use Google Chrome');
200
183
  }
201
- // eslint-disable-next-line no-console
202
- console.log(e);
184
+ // TODO: handle error.
185
+ reportError(error);
203
186
  }
204
187
  }
205
188
  function getBlob(rootRef, elementID) {
206
189
  let _svg = rootRef.getRootNode()
207
- .getElementById(elementID)
190
+ .querySelector(`#${elementID}`)
208
191
  ?.cloneNode(true);
209
192
  const width = Number(_svg?.getAttribute('width').replace('px', ''));
210
193
  const height = Number(_svg?.getAttribute('height').replace('px', ''));
211
- _svg
212
- .querySelectorAll('[data-no-export="true"]')
213
- .forEach((element) => element.remove());
214
- _svg
215
- .querySelectorAll('[data-replace-float-structure="true"]')
216
- .forEach((element) => {
194
+ for (const element of _svg.querySelectorAll('[data-no-export="true"]')) {
195
+ element.remove();
196
+ }
197
+ const elements = _svg.querySelectorAll('[data-replace-float-structure="true"]');
198
+ for (const element of elements) {
217
199
  element.replaceWith(element.childNodes[0].childNodes[0]);
218
- return element;
219
- });
200
+ }
220
201
  const head = `<svg class="nmr-svg" viewBox='0 0 ${width} ${height}' width="${width}" height="${height}" version="1.1" xmlns="http://www.w3.org/2000/svg">`;
221
202
  const style = `<style>.grid line,.grid path{stroke:none;} .peaks-text{fill:#730000} .x path{stroke-width:1px} .x text{
222
203
  font-size: 12px;