nmrium 0.42.0 → 0.43.1-pre.1692874523

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (306) hide show
  1. package/lib/component/1d/ApodizationLine.js +1 -1
  2. package/lib/component/1d/Chart1D.js +3 -2
  3. package/lib/component/1d/ExclusionZonesAnnotations.js +1 -2
  4. package/lib/component/1d/Line.js +1 -1
  5. package/lib/component/1d/Viewer1D.js +15 -3
  6. package/lib/component/1d/integral/IntegralResizable.js +4 -3
  7. package/lib/component/1d/multiAnalysis/AnalysisRange.js +3 -1
  8. package/lib/component/1d/peaks/PeakAnnotations.js +20 -25
  9. package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.d.ts +2 -0
  10. package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.js +59 -0
  11. package/lib/component/1d/peaks/PeakEditionManager.d.ts +18 -0
  12. package/lib/component/1d/peaks/PeakEditionManager.js +98 -0
  13. package/lib/component/1d/peaks/Peaks.d.ts +1 -0
  14. package/lib/component/1d/peaks/Peaks.js +22 -0
  15. package/lib/component/1d/ranges/Range.js +3 -1
  16. package/lib/component/1d/tool/BaseLineZones.d.ts +1 -1
  17. package/lib/component/1d/tool/BaseLineZones.js +11 -31
  18. package/lib/component/1d/utilities/intersectionResolver.d.ts +25 -0
  19. package/lib/component/1d/utilities/intersectionResolver.js +71 -0
  20. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.d.ts +2 -2
  21. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +17 -16
  22. package/lib/component/1d-2d/components/FloatMoleculeStructures/index.d.ts +2 -2
  23. package/lib/component/2d/SlicingView.js +1 -1
  24. package/lib/component/2d/Viewer2D.js +1 -3
  25. package/lib/component/2d/ft/Contours.js +1 -1
  26. package/lib/component/EventsTrackers/KeysListenerTracker.d.ts +5 -1
  27. package/lib/component/EventsTrackers/KeysListenerTracker.js +48 -8
  28. package/lib/component/assignment/index.d.ts +6 -1
  29. package/lib/component/assignment/index.js +5 -1
  30. package/lib/component/context/DispatchContext.d.ts +3 -2
  31. package/lib/component/context/KeyModifierContext.d.ts +13 -0
  32. package/lib/component/context/KeyModifierContext.js +39 -0
  33. package/lib/component/context/PreferencesContext.d.ts +39 -39
  34. package/lib/component/elements/Button.js +2 -0
  35. package/lib/component/elements/CounterLabel.d.ts +7 -0
  36. package/lib/component/elements/CounterLabel.js +12 -0
  37. package/lib/component/elements/EditableColumn.js +12 -6
  38. package/lib/component/elements/Input.d.ts +3 -12
  39. package/lib/component/elements/Input.js +24 -76
  40. package/lib/component/elements/Message.js +0 -1
  41. package/lib/component/elements/NumberInput.d.ts +1 -0
  42. package/lib/component/elements/NumberInput.js +10 -3
  43. package/lib/component/elements/PreferencesButton.d.ts +4 -0
  44. package/lib/component/elements/PreferencesButton.js +6 -0
  45. package/lib/component/elements/formik/FormikInput.d.ts +2 -2
  46. package/lib/component/elements/formik/FormikInput.js +3 -6
  47. package/lib/component/elements/formik/FormikOnChange.js +1 -1
  48. package/lib/component/elements/popup/Modal/ConfirmDialog.js +1 -1
  49. package/lib/component/header/ApodizationOptionsPanel.js +23 -14
  50. package/lib/component/header/BaseLineCorrectionPanel.js +31 -10
  51. package/lib/component/header/Header.d.ts +10 -3
  52. package/lib/component/header/Header.js +6 -6
  53. package/lib/component/header/ZeroFillingOptionsPanel.js +37 -31
  54. package/lib/component/highlight/index.d.ts +1 -0
  55. package/lib/component/highlight/index.js +1 -0
  56. package/lib/component/hooks/useActiveSpectrumPeaksViewState.js +1 -0
  57. package/lib/component/hooks/useCheckToolsVisibility.js +7 -3
  58. package/lib/component/hooks/useResizerStatus.d.ts +2 -0
  59. package/lib/component/hooks/useResizerStatus.js +7 -0
  60. package/lib/component/hooks/useSpectrum.js +1 -1
  61. package/lib/component/main/ErrorOverlay.js +20 -0
  62. package/lib/component/main/InnerNMRium.d.ts +7 -0
  63. package/lib/component/main/InnerNMRium.js +52 -0
  64. package/lib/component/main/InnerNMRiumContents.d.ts +14 -0
  65. package/lib/component/main/InnerNMRiumContents.js +88 -0
  66. package/lib/component/main/NMRium.d.ts +23 -0
  67. package/lib/component/main/NMRium.js +13 -0
  68. package/lib/component/main/NMRiumStateProvider.d.ts +9 -0
  69. package/lib/component/main/NMRiumStateProvider.js +74 -0
  70. package/lib/component/{SplitPaneWrapper.js → main/SplitPaneWrapper.js} +1 -1
  71. package/lib/component/main/StateError.d.ts +4 -0
  72. package/lib/component/main/StateError.js +16 -0
  73. package/lib/component/main/index.d.ts +3 -0
  74. package/lib/component/main/index.js +3 -0
  75. package/lib/component/main/types.d.ts +18 -0
  76. package/lib/component/main/types.js +2 -0
  77. package/lib/component/modal/AlignSpectraModal.js +78 -29
  78. package/lib/component/modal/MoleculeStructureEditorModal.d.ts +5 -1
  79. package/lib/component/modal/MoleculeStructureEditorModal.js +12 -15
  80. package/lib/component/modal/MultipletAnalysisModal.js +1 -1
  81. package/lib/component/modal/PredictSpectraModal.js +1 -1
  82. package/lib/component/modal/{AboutUsModal.js → aboutUs/AboutUsModal.js} +4 -3
  83. package/lib/component/modal/aboutUs/AboutUsZakodium.d.ts +1 -0
  84. package/lib/component/modal/aboutUs/AboutUsZakodium.js +33 -0
  85. package/lib/component/modal/changeSum/ChangeSumModal.d.ts +5 -16
  86. package/lib/component/modal/changeSum/ChangeSumModal.js +6 -115
  87. package/lib/component/modal/changeSum/ChangeSumModalContents.d.ts +18 -0
  88. package/lib/component/modal/changeSum/ChangeSumModalContents.js +94 -0
  89. package/lib/component/modal/metaImportation/MetaImportationModal.js +1 -1
  90. package/lib/component/modal/setting/GeneralSettings.js +2 -2
  91. package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.d.ts +1 -1
  92. package/lib/component/modal/setting/settings-tabs/GeneralTabContent.js +1 -1
  93. package/lib/component/modal/setting/settings-tabs/ImportationFiltersTabContent.js +1 -1
  94. package/lib/component/modal/setting/settingsValidation.js +5 -1
  95. package/lib/component/panels/InformationPanel.js +9 -100
  96. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +6 -11
  97. package/lib/component/panels/IntegralsPanel/IntegralTable.js +1 -1
  98. package/lib/component/panels/MoleculesPanel/MoleculePanel.js +2 -2
  99. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -4
  100. package/lib/component/panels/MoleculesPanel/Utilities.d.ts +3 -9
  101. package/lib/component/panels/MoleculesPanel/Utilities.js +14 -10
  102. package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts +13 -9
  103. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +8 -9
  104. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +5 -5
  105. package/lib/component/panels/Panels.js +6 -7
  106. package/lib/component/panels/PeaksPanel/PeaksPanel.js +11 -5
  107. package/lib/component/panels/PeaksPanel/PeaksTable.js +1 -1
  108. package/lib/component/panels/RangesPanel/RangesHeader.js +6 -10
  109. package/lib/component/panels/RangesPanel/TableColumns/RelativeColumn.js +1 -1
  110. package/lib/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +1 -1
  111. package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +1 -2
  112. package/lib/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +1 -1
  113. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +2 -2
  114. package/lib/component/panels/SummaryPanel/SummaryPanel.js +6 -6
  115. package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +2 -3
  116. package/lib/component/panels/SummaryPanel/utilities/Utilities.js +2 -3
  117. package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +8 -9
  118. package/lib/component/panels/ZonesPanel/ZonesPanel.js +3 -2
  119. package/lib/component/panels/ZonesPanel/ZonesPreferences.js +1 -1
  120. package/lib/component/panels/databasePanel/DatabasePanel.d.ts +18 -1
  121. package/lib/component/panels/databasePanel/DatabasePanel.js +3 -40
  122. package/lib/component/panels/databasePanel/DatabaseSearchOptions.d.ts +18 -0
  123. package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +53 -0
  124. package/lib/component/panels/header/DefaultPanelHeader.d.ts +3 -4
  125. package/lib/component/panels/header/DefaultPanelHeader.js +11 -13
  126. package/lib/component/panels/predictionPanel/PredictionPanel.js +3 -3
  127. package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +0 -1
  128. package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +1 -1
  129. package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -2
  130. package/lib/component/reducer/IgnoreActions.js +1 -1
  131. package/lib/component/reducer/Reducer.d.ts +3 -8
  132. package/lib/component/reducer/Reducer.js +34 -8
  133. package/lib/component/reducer/actions/DomainActions.js +2 -3
  134. package/lib/component/reducer/actions/FiltersActions.d.ts +32 -11
  135. package/lib/component/reducer/actions/FiltersActions.js +96 -28
  136. package/lib/component/reducer/actions/IntegralsActions.d.ts +6 -2
  137. package/lib/component/reducer/actions/IntegralsActions.js +44 -20
  138. package/lib/component/reducer/actions/MoleculeActions.js +4 -4
  139. package/lib/component/reducer/actions/PeaksActions.d.ts +6 -4
  140. package/lib/component/reducer/actions/PeaksActions.js +19 -1
  141. package/lib/component/reducer/actions/PreferencesActions.js +1 -2
  142. package/lib/component/reducer/actions/RangesActions.d.ts +6 -2
  143. package/lib/component/reducer/actions/RangesActions.js +31 -3
  144. package/lib/component/reducer/actions/ToolsActions.js +10 -10
  145. package/lib/component/reducer/core/Constants.d.ts +0 -4
  146. package/lib/component/reducer/core/Constants.js +0 -5
  147. package/lib/component/reducer/helper/ZoomHistoryManager.js +1 -2
  148. package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
  149. package/lib/component/reducer/preferences/utilities/getPreferencesByWorkspace.d.ts +1 -1
  150. package/lib/component/toolbar/FunctionToolBar.js +13 -3
  151. package/lib/component/toolbar/ToolTypes.d.ts +3 -2
  152. package/lib/component/toolbar/ToolTypes.js +57 -22
  153. package/lib/component/utility/export.js +7 -4
  154. package/lib/component/utility/filterType.d.ts +3 -0
  155. package/lib/component/utility/filterType.js +1 -0
  156. package/lib/component/workspaces/basic.js +2 -0
  157. package/lib/component/workspaces/embedded.js +2 -0
  158. package/lib/component/workspaces/exercise.js +2 -0
  159. package/lib/component/workspaces/prediction.js +9 -0
  160. package/lib/component/workspaces/process1D.js +2 -0
  161. package/lib/component/workspaces/workspaceDefaultProperties.js +2 -0
  162. package/lib/data/PredictionManager.d.ts +3 -3
  163. package/lib/data/PredictionManager.js +10 -10
  164. package/lib/data/constants/References.d.ts +5 -3
  165. package/lib/data/data1d/Spectrum1D/getReferenceShift.d.ts +10 -1
  166. package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +1 -2
  167. package/lib/data/data1d/Spectrum1D/ranges/addRange.js +2 -8
  168. package/lib/data/data1d/Spectrum1D/ranges/detectSignal.js +1 -1
  169. package/lib/data/molecules/Molecule.js +2 -2
  170. package/lib/data/utilities/checkModifierKeyActivated.d.ts +1 -1
  171. package/lib/data/utilities/checkModifierKeyActivated.js +8 -13
  172. package/lib/versionInfo.js +1 -1
  173. package/lib-cjs/component/1d/ApodizationLine.js +1 -1
  174. package/lib-cjs/component/1d/Chart1D.js +3 -2
  175. package/lib-cjs/component/1d/ExclusionZonesAnnotations.js +1 -2
  176. package/lib-cjs/component/1d/Line.js +1 -1
  177. package/lib-cjs/component/1d/Viewer1D.js +15 -3
  178. package/lib-cjs/component/1d/integral/IntegralResizable.js +4 -3
  179. package/lib-cjs/component/1d/multiAnalysis/AnalysisRange.js +3 -1
  180. package/lib-cjs/component/1d/peaks/PeakAnnotations.js +19 -24
  181. package/lib-cjs/component/1d/peaks/PeakAnnotationsSpreadMode.js +64 -0
  182. package/lib-cjs/component/1d/peaks/PeakEditionManager.js +129 -0
  183. package/lib-cjs/component/1d/peaks/Peaks.js +29 -0
  184. package/lib-cjs/component/1d/ranges/Range.js +3 -1
  185. package/lib-cjs/component/1d/tool/BaseLineZones.js +11 -34
  186. package/lib-cjs/component/1d/utilities/intersectionResolver.js +75 -0
  187. package/lib-cjs/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +17 -16
  188. package/lib-cjs/component/2d/SlicingView.js +1 -1
  189. package/lib-cjs/component/2d/Viewer2D.js +1 -3
  190. package/lib-cjs/component/2d/ft/Contours.js +1 -1
  191. package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +47 -7
  192. package/lib-cjs/component/assignment/index.js +5 -1
  193. package/lib-cjs/component/context/KeyModifierContext.js +44 -0
  194. package/lib-cjs/component/elements/Button.js +2 -0
  195. package/lib-cjs/component/elements/CounterLabel.js +16 -0
  196. package/lib-cjs/component/elements/EditableColumn.js +12 -6
  197. package/lib-cjs/component/elements/Input.js +23 -75
  198. package/lib-cjs/component/elements/Message.js +0 -1
  199. package/lib-cjs/component/elements/NumberInput.js +12 -2
  200. package/lib-cjs/component/elements/PreferencesButton.js +13 -0
  201. package/lib-cjs/component/elements/formik/FormikInput.js +3 -6
  202. package/lib-cjs/component/elements/formik/FormikOnChange.js +1 -1
  203. package/lib-cjs/component/elements/popup/Modal/ConfirmDialog.js +1 -1
  204. package/lib-cjs/component/header/ApodizationOptionsPanel.js +23 -14
  205. package/lib-cjs/component/header/BaseLineCorrectionPanel.js +30 -9
  206. package/lib-cjs/component/header/Header.js +6 -6
  207. package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +35 -29
  208. package/lib-cjs/component/highlight/index.js +1 -0
  209. package/lib-cjs/component/hooks/useActiveSpectrumPeaksViewState.js +1 -0
  210. package/lib-cjs/component/hooks/useCheckToolsVisibility.js +7 -3
  211. package/lib-cjs/component/hooks/useResizerStatus.js +11 -0
  212. package/lib-cjs/component/hooks/useSpectrum.js +1 -1
  213. package/lib-cjs/component/main/ErrorOverlay.js +26 -0
  214. package/lib-cjs/component/main/InnerNMRium.js +82 -0
  215. package/lib-cjs/component/main/InnerNMRiumContents.js +95 -0
  216. package/lib-cjs/component/main/NMRium.js +19 -0
  217. package/lib-cjs/component/main/NMRiumStateProvider.js +80 -0
  218. package/lib-cjs/component/{SplitPaneWrapper.js → main/SplitPaneWrapper.js} +1 -1
  219. package/lib-cjs/component/main/StateError.js +20 -0
  220. package/lib-cjs/component/main/index.js +21 -0
  221. package/lib-cjs/component/main/types.js +3 -0
  222. package/lib-cjs/component/modal/AlignSpectraModal.js +100 -28
  223. package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +11 -17
  224. package/lib-cjs/component/modal/MultipletAnalysisModal.js +1 -1
  225. package/lib-cjs/component/modal/PredictSpectraModal.js +1 -1
  226. package/lib-cjs/component/modal/{AboutUsModal.js → aboutUs/AboutUsModal.js} +4 -3
  227. package/lib-cjs/component/modal/aboutUs/AboutUsZakodium.js +39 -0
  228. package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +6 -141
  229. package/lib-cjs/component/modal/changeSum/ChangeSumModalContents.js +124 -0
  230. package/lib-cjs/component/modal/metaImportation/MetaImportationModal.js +1 -1
  231. package/lib-cjs/component/modal/setting/GeneralSettings.js +2 -2
  232. package/lib-cjs/component/modal/setting/settings-tabs/GeneralTabContent.js +1 -1
  233. package/lib-cjs/component/modal/setting/settings-tabs/ImportationFiltersTabContent.js +1 -1
  234. package/lib-cjs/component/modal/setting/settingsValidation.js +4 -0
  235. package/lib-cjs/component/panels/InformationPanel.js +7 -98
  236. package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +29 -11
  237. package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +1 -1
  238. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +2 -2
  239. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -4
  240. package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +14 -10
  241. package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +8 -9
  242. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +4 -4
  243. package/lib-cjs/component/panels/Panels.js +6 -7
  244. package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +32 -3
  245. package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +1 -1
  246. package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +29 -10
  247. package/lib-cjs/component/panels/RangesPanel/TableColumns/RelativeColumn.js +1 -1
  248. package/lib-cjs/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +1 -1
  249. package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +1 -2
  250. package/lib-cjs/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +1 -1
  251. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +2 -2
  252. package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +29 -6
  253. package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +4 -5
  254. package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +7 -8
  255. package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +26 -2
  256. package/lib-cjs/component/panels/ZonesPanel/ZonesPreferences.js +1 -1
  257. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +3 -40
  258. package/lib-cjs/component/panels/databasePanel/DatabaseSearchOptions.js +60 -0
  259. package/lib-cjs/component/panels/header/DefaultPanelHeader.js +12 -12
  260. package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +3 -3
  261. package/lib-cjs/component/panels/predictionPanel/PredictionSimpleOptions.js +0 -1
  262. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulation.js +1 -1
  263. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -2
  264. package/lib-cjs/component/reducer/IgnoreActions.js +1 -1
  265. package/lib-cjs/component/reducer/Reducer.js +33 -7
  266. package/lib-cjs/component/reducer/actions/DomainActions.js +2 -3
  267. package/lib-cjs/component/reducer/actions/FiltersActions.js +98 -28
  268. package/lib-cjs/component/reducer/actions/IntegralsActions.js +45 -20
  269. package/lib-cjs/component/reducer/actions/MoleculeActions.js +3 -3
  270. package/lib-cjs/component/reducer/actions/PeaksActions.js +20 -1
  271. package/lib-cjs/component/reducer/actions/PreferencesActions.js +1 -2
  272. package/lib-cjs/component/reducer/actions/RangesActions.js +31 -2
  273. package/lib-cjs/component/reducer/actions/ToolsActions.js +9 -9
  274. package/lib-cjs/component/reducer/core/Constants.js +1 -6
  275. package/lib-cjs/component/reducer/helper/ZoomHistoryManager.js +1 -2
  276. package/lib-cjs/component/toolbar/FunctionToolBar.js +13 -3
  277. package/lib-cjs/component/toolbar/ToolTypes.js +57 -22
  278. package/lib-cjs/component/utility/export.js +7 -4
  279. package/lib-cjs/component/utility/filterType.js +2 -0
  280. package/lib-cjs/component/workspaces/basic.js +2 -0
  281. package/lib-cjs/component/workspaces/embedded.js +2 -0
  282. package/lib-cjs/component/workspaces/exercise.js +2 -0
  283. package/lib-cjs/component/workspaces/prediction.js +9 -0
  284. package/lib-cjs/component/workspaces/process1D.js +2 -0
  285. package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +2 -0
  286. package/lib-cjs/data/PredictionManager.js +9 -9
  287. package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +1 -7
  288. package/lib-cjs/data/data1d/Spectrum1D/ranges/detectSignal.js +1 -1
  289. package/lib-cjs/data/molecules/Molecule.js +2 -2
  290. package/lib-cjs/data/utilities/checkModifierKeyActivated.js +8 -13
  291. package/lib-cjs/versionInfo.js +1 -1
  292. package/package.json +26 -25
  293. package/lib/component/1d/peaks/PeakAnnotation.d.ts +0 -12
  294. package/lib/component/1d/peaks/PeakAnnotation.js +0 -116
  295. package/lib/component/ErrorOverlay.js +0 -27
  296. package/lib/component/NMRium.d.ts +0 -42
  297. package/lib/component/NMRium.js +0 -237
  298. package/lib/component/reducer/actions/GlobalActions.d.ts +0 -9
  299. package/lib/component/reducer/actions/GlobalActions.js +0 -4
  300. package/lib-cjs/component/1d/peaks/PeakAnnotation.js +0 -118
  301. package/lib-cjs/component/ErrorOverlay.js +0 -30
  302. package/lib-cjs/component/NMRium.js +0 -267
  303. package/lib-cjs/component/reducer/actions/GlobalActions.js +0 -7
  304. /package/lib/component/{ErrorOverlay.d.ts → main/ErrorOverlay.d.ts} +0 -0
  305. /package/lib/component/{SplitPaneWrapper.d.ts → main/SplitPaneWrapper.d.ts} +0 -0
  306. /package/lib/component/modal/{AboutUsModal.d.ts → aboutUs/AboutUsModal.d.ts} +0 -0
@@ -69,6 +69,6 @@ function ApodizationLine() {
69
69
  return '';
70
70
  }
71
71
  };
72
- return (_jsx("path", { "data-test-id": "apodization-line", stroke: "green", fill: "none", strokeWidth: "2", d: paths() }));
72
+ return (_jsx("path", { "data-testid": "apodization-line", stroke: "green", fill: "none", strokeWidth: "2", d: paths() }));
73
73
  }
74
74
  export default ApodizationLine;
@@ -10,12 +10,13 @@ import DatabaseElements from './database/DatabaseElements';
10
10
  import IntegralsSeries from './integral/IntegralsSeries';
11
11
  import JGraph from './jCouplingGraph/JGraph';
12
12
  import MultiAnalysisRanges from './multiAnalysis/MultiAnalysisRanges';
13
- import PeakAnnotations from './peaks/PeakAnnotations';
13
+ import { PeakEditionProvider } from './peaks/PeakEditionManager';
14
+ import { Peaks } from './peaks/Peaks';
14
15
  import PeaksShapes from './peaks/PeaksShapes';
15
16
  import Ranges from './ranges/Ranges';
16
17
  import BaseLineZones from './tool/BaseLineZones';
17
18
  function Chart1D({ mode, width, height, margin, displayerKey }) {
18
19
  const { current: { general: { spectraRendering }, }, } = usePreferences();
19
- return (_jsxs("svg", { viewBox: `0 0 ${width} ${height}`, width: width, height: height, id: "nmrSVG", shapeRendering: spectraRendering, children: [_jsx("defs", { children: _jsx("clipPath", { id: `${displayerKey}clip-chart-1d`, children: _jsx("rect", { width: `${width - margin.left - margin.right}`, height: `${height}`, x: `${margin.left}`, y: `${0}` }) }) }), _jsx(LinesSeries, {}), _jsx(ApodizationLine, {}), _jsx(IntegralsSeries, {}), _jsx(PeakAnnotations, {}), _jsx(Ranges, {}), _jsx(JGraph, {}), _jsx(MultiAnalysisRanges, {}), _jsx(BaseLineZones, {}), _jsx(ExclusionZonesAnnotations, {}), _jsx(DatabaseElements, {}), _jsx(PeaksShapes, {}), _jsx(SpectraTracker, {}), _jsx(SpectrumInfoBlock, {}), _jsx("g", { className: "container", style: { pointerEvents: 'none' }, children: _jsx(XAxis, { showGrid: true, mode: mode }) })] }));
20
+ return (_jsx(PeakEditionProvider, { children: _jsxs("svg", { viewBox: `0 0 ${width} ${height}`, width: width, height: height, id: "nmrSVG", shapeRendering: spectraRendering, children: [_jsx("defs", { children: _jsx("clipPath", { id: `${displayerKey}clip-chart-1d`, children: _jsx("rect", { width: `${width - margin.left - margin.right}`, height: `${height}`, x: `${margin.left}`, y: `${0}` }) }) }), _jsx(LinesSeries, {}), _jsx(ApodizationLine, {}), _jsx(IntegralsSeries, {}), _jsx(Peaks, {}), _jsx(Ranges, {}), _jsx(JGraph, {}), _jsx(MultiAnalysisRanges, {}), _jsx(BaseLineZones, {}), _jsx(ExclusionZonesAnnotations, {}), _jsx(DatabaseElements, {}), _jsx(PeaksShapes, {}), _jsx(SpectraTracker, {}), _jsx(SpectrumInfoBlock, {}), _jsx("g", { className: "container", style: { pointerEvents: 'none' }, children: _jsx(XAxis, { showGrid: true, mode: mode }) })] }) }));
20
21
  }
21
22
  export default Chart1D;
@@ -4,7 +4,6 @@ import { memo } from 'react';
4
4
  import { useChartData } from '../context/ChartContext';
5
5
  import { useScale } from '../context/ScaleContext';
6
6
  import useSpectraByActiveNucleus from '../hooks/useSpectraPerNucleus';
7
- import { DISPLAYER_MODE } from '../reducer/core/Constants';
8
7
  import ExclusionZoneAnnotation from './ExclusionZoneAnnotation';
9
8
  function ExclusionZonesAnnotationsInner({ displayerKey, xDomains, spectra, shiftY, }) {
10
9
  return (_jsx("g", { className: "spectrum-exclusion-zones-group", clipPath: `url(#${displayerKey}clip-chart-1d)`, children: spectra
@@ -20,7 +19,7 @@ function ExclusionZonesAnnotations() {
20
19
  const { displayerKey, xDomains, displayerMode } = useChartData();
21
20
  const { shiftY } = useScale();
22
21
  const spectra = useSpectraByActiveNucleus();
23
- if (displayerMode !== DISPLAYER_MODE.DM_1D)
22
+ if (displayerMode !== '1D')
24
23
  return null;
25
24
  return (_jsx(MemoizedPeakAnnotations, { spectra: spectra, displayerKey: displayerKey, xDomains: xDomains, shiftY: shiftY }));
26
25
  }
@@ -26,6 +26,6 @@ function Line({ data, id, display, index }) {
26
26
  }
27
27
  }, [scaleX, scaleY, id, data, xyReduce]);
28
28
  const { color: stroke, opacity: strokeOpacity } = parseColor(display?.color || 'black');
29
- return (_jsx("path", { className: "line", "data-test-id": "spectrum-line", stroke: stroke, fill: "none", strokeOpacity: opacity === 1 ? strokeOpacity : opacity, d: paths, transform: `translate(0,-${shiftY * index})` }, id));
29
+ return (_jsx("path", { className: "line", "data-testid": "spectrum-line", stroke: stroke, fill: "none", strokeOpacity: opacity === 1 ? strokeOpacity : opacity, d: paths, transform: `translate(0,-${shiftY * index})` }, id));
30
30
  }
31
31
  export default Line;
@@ -225,10 +225,10 @@ function Viewer1D({ emptyText = undefined }) {
225
225
  dispatch({ type: 'SET_ZOOM', payload: { event, selectedTool } });
226
226
  }, [dispatch, selectedTool]);
227
227
  const mouseClick = useCallback((position) => {
228
+ if (!scaleState.scaleX)
229
+ return;
230
+ const xPPM = scaleState.scaleX().invert(position.x);
228
231
  const propagateEvent = () => {
229
- if (!scaleState.scaleX)
230
- return;
231
- const xPPM = scaleState.scaleX().invert(position.x);
232
232
  Events.emit('mouseClick', {
233
233
  ...position,
234
234
  xPPM,
@@ -245,6 +245,18 @@ function Viewer1D({ emptyText = undefined }) {
245
245
  case options.editRange.id:
246
246
  propagateEvent();
247
247
  break;
248
+ case options.integral.id:
249
+ dispatch({
250
+ type: 'CUT_INTEGRAL',
251
+ payload: { cutValue: xPPM },
252
+ });
253
+ break;
254
+ case options.rangePicking.id:
255
+ dispatch({
256
+ type: 'CUT_RANGE',
257
+ payload: { cutValue: xPPM },
258
+ });
259
+ break;
248
260
  default:
249
261
  break;
250
262
  }
@@ -7,7 +7,7 @@ import { useGlobal } from '../../context/GlobalContext';
7
7
  import { useScaleChecked } from '../../context/ScaleContext';
8
8
  import Resizer from '../../elements/resizer/Resizer';
9
9
  import { HighlightEventSource, useHighlight } from '../../highlight/index';
10
- import { options } from '../../toolbar/ToolTypes';
10
+ import { useResizerStatus } from '../../hooks/useResizerStatus';
11
11
  import { IntegralIndicator } from './IntegralIndicator';
12
12
  const stylesOnHover = css `
13
13
  pointer-events: bounding-box;
@@ -38,7 +38,7 @@ const stylesHighlighted = css `
38
38
  }
39
39
  `;
40
40
  function IntegralResizable({ integralData, integralFormat, }) {
41
- const { height, margin, toolOptions: { selectedTool }, } = useChartData();
41
+ const { height, margin } = useChartData();
42
42
  const { viewerRef } = useGlobal();
43
43
  const { scaleX } = useScaleChecked();
44
44
  const dispatch = useDispatch();
@@ -62,7 +62,8 @@ function IntegralResizable({ integralData, integralFormat, }) {
62
62
  const from = integralData.from ? scaleX()(integralData.from) : 0;
63
63
  const to = integralData.to ? scaleX()(integralData.to) : 0;
64
64
  const bottom = height - margin.bottom;
65
- 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) => {
65
+ const isResizeingActive = useResizerStatus('integral');
66
+ return (_jsx("g", { onMouseEnter: () => highlight.show(), onMouseLeave: () => highlight.hide(), children: _jsx(Resizer, { tag: "svg", initialPosition: { x1: to, x2: from }, onEnd: handleOnStopResizing, parentElement: viewerRef, disabled: !isResizeingActive, children: ({ x1, x2 }, isActive) => {
66
67
  const width = x2 - x1;
67
68
  return (_jsxs("g", { css: highlight.isActive || isActive
68
69
  ? stylesHighlighted
@@ -7,6 +7,7 @@ import { usePreferences } from '../../context/PreferencesContext';
7
7
  import { useScaleChecked } from '../../context/ScaleContext';
8
8
  import Resizer from '../../elements/resizer/Resizer';
9
9
  import { useHighlight } from '../../highlight';
10
+ import { useResizerStatus } from '../../hooks/useResizerStatus';
10
11
  const styles = {
11
12
  common: css `
12
13
  pointer-events: bounding-box;
@@ -51,7 +52,8 @@ function AnalysisRange({ rangeData, columnKey, activeTab, }) {
51
52
  }, [activeTab, columnKey, dispatch, scaleX]);
52
53
  const from = scaleX()(rangeData.from);
53
54
  const to = scaleX()(rangeData.to);
54
- return (_jsx("g", { ...highlight.onHover, ...highlight.onHover, children: _jsx(Resizer, { tag: "svg", onEnd: resizeEndHandler, initialPosition: { x2: from, x1: to }, parentElement: viewerRef, children: ({ x1, x2 }, isActive) => (_jsxs("g", { transform: `translate(0,25)`, css: [
55
+ const isResizeingActive = useResizerStatus('multipleSpectraAnalysis');
56
+ return (_jsx("g", { ...highlight.onHover, ...highlight.onHover, children: _jsx(Resizer, { tag: "svg", onEnd: resizeEndHandler, initialPosition: { x2: from, x1: to }, parentElement: viewerRef, disabled: !isResizeingActive, children: ({ x1, x2 }, isActive) => (_jsxs("g", { transform: `translate(0,25)`, css: [
55
57
  styles.common,
56
58
  highlight.isActive || isActive
57
59
  ? styles.Highlighted
@@ -1,36 +1,31 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useMemo } from 'react';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
2
  import { useChartData } from '../../context/ChartContext';
4
3
  import { useScaleChecked } from '../../context/ScaleContext';
4
+ import { HighlightEventSource, useHighlight } from '../../highlight';
5
5
  import { useActiveSpectrum } from '../../hooks/useActiveSpectrum';
6
- import { useActiveSpectrumPeaksViewState } from '../../hooks/useActiveSpectrumPeaksViewState';
6
+ import { usePanelPreferences } from '../../hooks/usePanelPreferences';
7
7
  import useSpectrum from '../../hooks/useSpectrum';
8
- import PeakAnnotation from './PeakAnnotation';
8
+ import { formatNumber } from '../../utility/formatNumber';
9
+ import { PeakEditionListener } from './PeakEditionManager';
9
10
  const emptyData = { peaks: {}, info: {}, display: {} };
10
11
  function PeakAnnotations() {
11
12
  const { displayerKey } = useChartData();
12
13
  const activeSpectrum = useActiveSpectrum();
13
- const { scaleX, scaleY, shiftY } = useScaleChecked();
14
+ const { shiftY } = useScaleChecked();
14
15
  const spectrum = useSpectrum(emptyData);
15
- const peaksViewState = useActiveSpectrumPeaksViewState();
16
- const Peaks = useMemo(() => {
17
- if (!spectrum?.peaks?.values ||
18
- !spectrum.display.isVisible ||
19
- !peaksViewState.isPeaksVisible) {
20
- return null;
21
- }
22
- return (_jsx("g", { transform: `translate(0,-${(activeSpectrum?.index || 0) * shiftY})`, children: spectrum.peaks.values.map(({ x, y, id }) => (_jsx(PeakAnnotation, { x: scaleX()(x), y: scaleY(spectrum.id)(y) - 5, sign: Math.sign(y), id: id, value: x, color: "#730000", nucleus: spectrum.info.nucleus }, id))) }));
23
- }, [
24
- spectrum.peaks.values,
25
- spectrum.display.isVisible,
26
- spectrum.id,
27
- spectrum.info.nucleus,
28
- peaksViewState.isPeaksVisible,
29
- activeSpectrum?.index,
30
- shiftY,
31
- scaleX,
32
- scaleY,
33
- ]);
34
- return (_jsx("g", { className: "peaks", clipPath: `url(#${displayerKey}clip-chart-1d)`, children: Peaks }));
16
+ return (_jsx("g", { className: "peaks", clipPath: `url(#${displayerKey}clip-chart-1d)`, children: _jsx("g", { transform: `translate(0,-${(activeSpectrum?.index || 0) * shiftY})`, children: spectrum.peaks.values.map((peak) => (_jsx(PeakAnnotation, { spectrumId: spectrum.id, peak: peak, color: "#730000", nucleus: spectrum.info.nucleus }, peak.id))) }) }));
17
+ }
18
+ function PeakAnnotation({ peak, spectrumId, color, nucleus, }) {
19
+ const { id, x, y } = peak;
20
+ const sign = Math.sign(y);
21
+ const { deltaPPM } = usePanelPreferences('peaks', nucleus);
22
+ const highlight = useHighlight([id], {
23
+ type: HighlightEventSource.PEAK,
24
+ extra: { id },
25
+ });
26
+ const { scaleX, scaleY } = useScaleChecked();
27
+ const sx = scaleX()(x);
28
+ const sy = scaleY(spectrumId)(y) - 5;
29
+ return (_jsxs("g", { style: { outline: 'none' }, transform: `translate(${sx}, ${sy})`, onMouseEnter: () => highlight.show(), onMouseLeave: () => highlight.hide(), children: [_jsx("line", { x1: "0", x2: "0", y1: sign === -1 ? 10 : 0, y2: sign === -1 ? 28 : -18, stroke: color, strokeWidth: highlight.isActive ? '3px' : '1px' }), _jsx(PeakEditionListener, { value: x, x: x, y: y, useScaleX: true, useScaleY: true, id: id, dy: sign === -1 ? 0 : -26, children: _jsx("text", { x: "0", y: sign === -1 ? 26 : -10, dy: "0", dx: "0.35em", fontSize: "11px", fill: color, children: formatNumber(x, deltaPPM.format) }) })] }));
35
30
  }
36
31
  export default PeakAnnotations;
@@ -0,0 +1,2 @@
1
+ declare function PeakAnnotationsTreeStyle(): import("react/jsx-runtime").JSX.Element | null;
2
+ export default PeakAnnotationsTreeStyle;
@@ -0,0 +1,59 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useChartData } from '../../context/ChartContext';
3
+ import { useScaleChecked } from '../../context/ScaleContext';
4
+ import { HighlightEventSource, useHighlight } from '../../highlight';
5
+ import { usePanelPreferences } from '../../hooks/usePanelPreferences';
6
+ import useSpectrum from '../../hooks/useSpectrum';
7
+ import { formatNumber } from '../../utility/formatNumber';
8
+ import { resolve } from '../utilities/intersectionResolver';
9
+ import { PeakEditionListener } from './PeakEditionManager';
10
+ const emptyData = { peaks: {}, info: {}, display: {} };
11
+ const notationWidth = 10;
12
+ const notationMargin = 2;
13
+ function getDecimalsCount(max, format) {
14
+ const numberOfDigits = format.replace(/\./, '').length;
15
+ const fractionDigits = format.split('.')[1].length;
16
+ return (Math.max(String(max.toFixed(0)).length, numberOfDigits - fractionDigits) +
17
+ fractionDigits);
18
+ }
19
+ function PeakAnnotationsTreeStyle() {
20
+ const { displayerKey, xDomain } = useChartData();
21
+ const { scaleX } = useScaleChecked();
22
+ const spectrum = useSpectrum(emptyData);
23
+ const { deltaPPM } = usePanelPreferences('peaks', spectrum.info.nucleus);
24
+ const decimalsCount = getDecimalsCount(xDomain[1], deltaPPM.format);
25
+ const mapPeaks = spectrum.peaks.values
26
+ .map((peak) => ({
27
+ ...peak,
28
+ scaleX: scaleX()(peak.x),
29
+ }))
30
+ .sort((p1, p2) => p2.x - p1.x);
31
+ if (!mapPeaks?.length)
32
+ return null;
33
+ const peaks = resolve(mapPeaks, {
34
+ key: 'scaleX',
35
+ width: notationWidth,
36
+ margin: notationMargin,
37
+ groupMargin: 10,
38
+ });
39
+ return (_jsx("g", { className: "peaks", clipPath: `url(#${displayerKey}clip-chart-1d)`, children: _jsx("g", { transform: `translate(0,${decimalsCount * 10})`, children: peaks.map((group) => {
40
+ return (_jsx("g", { transform: `translate(${group.meta.groupStartX},0)`, children: group.group.map((item, index) => {
41
+ const { id, x: value, scaleX } = item;
42
+ const startX = index * (notationWidth + notationMargin);
43
+ const x = scaleX - group.meta.groupStartX;
44
+ return (_jsx(PeakAnnotation, { startX: startX, x: x, id: id, value: value, format: deltaPPM.format, color: spectrum.display.color, peakEditionFieldPositon: {
45
+ x: group.meta.groupStartX + startX,
46
+ y: decimalsCount * 10,
47
+ } }, id));
48
+ }) }, group.meta.id));
49
+ }) }) }));
50
+ }
51
+ function PeakAnnotation(props) {
52
+ const { startX, format, color, id, value, x, peakEditionFieldPositon } = props;
53
+ const highlight = useHighlight([id], {
54
+ type: HighlightEventSource.PEAK,
55
+ extra: { id },
56
+ });
57
+ return (_jsxs("g", { onMouseEnter: () => highlight.show(), onMouseLeave: () => highlight.hide(), children: [_jsx(PeakEditionListener, { ...peakEditionFieldPositon, id, value, children: _jsx("text", { transform: `rotate(-90) translate(0 ${startX})`, dominantBaseline: "middle", textAnchor: "start", fontSize: "11px", fill: "black", children: formatNumber(value, format) }) }), _jsx("path", { d: `M ${startX} 5 v 5 L ${x} 20 v 5`, stroke: color, fill: "transparent", strokeWidth: highlight.isActive ? '3px' : '1px' })] }));
58
+ }
59
+ export default PeakAnnotationsTreeStyle;
@@ -0,0 +1,18 @@
1
+ import { ReactNode } from 'react';
2
+ interface PeakEditionListenerProps {
3
+ x: number;
4
+ y: number;
5
+ useScaleX?: boolean;
6
+ useScaleY?: boolean;
7
+ dx?: number;
8
+ dy?: number;
9
+ value: number;
10
+ id: string;
11
+ }
12
+ export declare function PeakEditionProvider({ children }: {
13
+ children: any;
14
+ }): import("react/jsx-runtime").JSX.Element;
15
+ export declare function PeakEditionListener(props: PeakEditionListenerProps & {
16
+ children: ReactNode;
17
+ }): import("react/jsx-runtime").JSX.Element;
18
+ export {};
@@ -0,0 +1,98 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Formik } from 'formik';
3
+ import { createContext, useCallback, useContext, useMemo, useState, } from 'react';
4
+ import * as Yup from 'yup';
5
+ import { useChartData } from '../../context/ChartContext';
6
+ import { useDispatch } from '../../context/DispatchContext';
7
+ import { useScaleChecked } from '../../context/ScaleContext';
8
+ import FormikNumberInput from '../../elements/formik/FormikNumberInput';
9
+ import { useActiveSpectrum } from '../../hooks/useActiveSpectrum';
10
+ const validationSchema = Yup.object({
11
+ value: Yup.number().required(),
12
+ });
13
+ const InputDimension = { height: 28, width: 100 };
14
+ const peaksEditionContext = {
15
+ onEdit: () => { },
16
+ };
17
+ const PeaksEditionContext = createContext(peaksEditionContext);
18
+ function usePeaksEditionManager() {
19
+ const context = useContext(PeaksEditionContext);
20
+ if (!context) {
21
+ throw new Error('Peak edition manager context was not found');
22
+ }
23
+ return context;
24
+ }
25
+ function stopPropagation(e) {
26
+ e.stopPropagation();
27
+ }
28
+ export function PeakEditionProvider({ children }) {
29
+ const { scaleX, scaleY } = useScaleChecked();
30
+ const { width } = useChartData();
31
+ const spectrum = useActiveSpectrum();
32
+ const [peak, setPeak] = useState(null);
33
+ function getPosition() {
34
+ let x = 0;
35
+ let y = 0;
36
+ if (!peak) {
37
+ return { x, y };
38
+ }
39
+ const { x: px, y: py, dx, dy, useScaleX, useScaleY } = peak;
40
+ x = px + dx;
41
+ if (useScaleX) {
42
+ x = scaleX()(px) + dx;
43
+ }
44
+ y = py + dy;
45
+ if (useScaleY) {
46
+ y = scaleY(spectrum?.id)(py) + dy;
47
+ }
48
+ if (x + InputDimension.width > width) {
49
+ x = x - InputDimension.width;
50
+ }
51
+ return { x, y };
52
+ }
53
+ const handleOnEdit = useCallback((e, peak) => {
54
+ e.stopPropagation();
55
+ if (peak) {
56
+ setPeak({ ...peak });
57
+ }
58
+ else {
59
+ setPeak(null);
60
+ }
61
+ }, []);
62
+ const editiionManagerState = useMemo(() => ({ onEdit: handleOnEdit, id: peak?.id }), [peak?.id, handleOnEdit]);
63
+ const { x, y } = getPosition();
64
+ return (_jsx(PeaksEditionContext.Provider, { value: editiionManagerState, children: _jsxs("div", { onClick: () => setPeak(null), onContextMenu: () => setPeak(null), style: { position: 'relative' }, children: [peak && (_jsx("div", { style: {
65
+ position: 'absolute',
66
+ display: 'block',
67
+ transform: `translate(${x}px,${y}px)`,
68
+ }, children: _jsx(PeakEditionField, { value: peak.value, onClose: () => setPeak(null) }, peak.id) })), children] }) }));
69
+ }
70
+ function PeakEditionField({ value, onClose }) {
71
+ const dispatch = useDispatch();
72
+ function keyDownCheck(event) {
73
+ if (event.key === 'Enter') {
74
+ return true;
75
+ }
76
+ else if (event.key === 'Escape') {
77
+ onClose();
78
+ return false;
79
+ }
80
+ }
81
+ function hanldeOnSubmit({ value: newValue }) {
82
+ if (value) {
83
+ const shift = newValue - value;
84
+ dispatch({ type: 'SHIFT_SPECTRUM', payload: { shift } });
85
+ onClose();
86
+ }
87
+ }
88
+ return (_jsx(Formik, { initialValues: { value }, onSubmit: hanldeOnSubmit, validationSchema: validationSchema, children: ({ submitForm }) => (_jsx(FormikNumberInput, { style: {
89
+ height: `${InputDimension.height}px`,
90
+ padding: '5px',
91
+ outline: 'none',
92
+ }, name: "value", autoSelect: true, onKeyDown: (e) => keyDownCheck(e) && submitForm(), onClick: stopPropagation, onMouseDown: stopPropagation })) }));
93
+ }
94
+ export function PeakEditionListener(props) {
95
+ const { children, x, y, value, useScaleX = false, useScaleY = false, dx = 0, dy = -InputDimension.height, id, } = props;
96
+ const { onEdit, id: editingPeakId } = usePeaksEditionManager();
97
+ return (_jsx("g", { onClick: (e) => onEdit(e, { x, y, value, useScaleX, useScaleY, dx, dy, id }), children: editingPeakId !== id && children }));
98
+ }
@@ -0,0 +1 @@
1
+ export declare function Peaks(): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useChartData } from '../../context/ChartContext';
3
+ import { useActiveSpectrumPeaksViewState } from '../../hooks/useActiveSpectrumPeaksViewState';
4
+ import useSpectrum from '../../hooks/useSpectrum';
5
+ import PeakAnnotations from './PeakAnnotations';
6
+ import PeakAnnotationsSpreadMode from './PeakAnnotationsSpreadMode';
7
+ const emptyData = { peaks: {}, info: {}, display: {} };
8
+ export function Peaks() {
9
+ const { view: { peaks }, } = useChartData();
10
+ const spectrum = useSpectrum(emptyData);
11
+ const peaksViewState = useActiveSpectrumPeaksViewState();
12
+ if (!spectrum?.peaks?.values ||
13
+ !spectrum.display.isVisible ||
14
+ !peaksViewState.isPeaksVisible) {
15
+ return null;
16
+ }
17
+ const mode = peaks?.[spectrum.id]?.displayingMode || 'spread';
18
+ if (mode === 'spread') {
19
+ return _jsx(PeakAnnotationsSpreadMode, {});
20
+ }
21
+ return _jsx(PeakAnnotations, {});
22
+ }
@@ -10,6 +10,7 @@ import { useGlobal } from '../../context/GlobalContext';
10
10
  import { useScaleChecked } from '../../context/ScaleContext';
11
11
  import Resizer from '../../elements/resizer/Resizer';
12
12
  import { HighlightEventSource, useHighlight } from '../../highlight';
13
+ import { useResizerStatus } from '../../hooks/useResizerStatus';
13
14
  import { options } from '../../toolbar/ToolTypes';
14
15
  import { IntegralIndicator } from '../integral/IntegralIndicator';
15
16
  import { MultiplicityTree } from '../multiplicityTree/MultiplicityTree';
@@ -74,7 +75,8 @@ function Range({ range, showMultiplicityTrees, selectedTool, relativeFormat, })
74
75
  const isNotSignal = !checkRangeKind(range);
75
76
  const isHighlighted = isBlockedByEditing || highlightRange.isActive || assignmentRange.isActive;
76
77
  const isAssigned = isRangeAssigned(range);
77
- return (_jsxs("g", { "data-test-id": "range", style: { outline: 'none' }, onMouseEnter: mouseEnterHandler, onMouseLeave: mouseLeaveHandler, ...(!assignmentRange.isActive && { css: style }), 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 isResizeingActive = useResizerStatus('rangePicking');
79
+ return (_jsxs("g", { "data-testid": "range", style: { outline: 'none' }, onMouseEnter: mouseEnterHandler, onMouseLeave: mouseLeaveHandler, ...(!assignmentRange.isActive && { css: style }), children: [_jsx(Resizer, { tag: "svg", initialPosition: { x1: to, x2: from }, onEnd: handleOnStopResizing, parentElement: viewerRef, disabled: !isResizeingActive, children: ({ x1, x2 }, isActive) => {
78
80
  const width = x2 - x1;
79
81
  return (_jsxs("g", { children: [isAssigned && !isHighlighted && !isActive && (_jsx("rect", { width: width, height: "10px", fill: "#ffd700", opacity: "0.35", "data-no-export": "true" })), _jsx("rect", { width: width, height: "100%", fill: isHighlighted || isActive ? '#ff6f0057' : 'transparent', "data-no-export": "true" }), _jsx(IntegralIndicator, { value: integration, format: relativeFormat, width: width, opacity: isNotSignal ? 0.5 : 1 })] }));
80
82
  } }, `${id}_${to}_${from}`), showMultiplicityTrees && (_jsx(MultiplicityTree, { range: range, onUnlink: unAssignHandler })), _jsx(AssignmentActionsButtons, { isActive: !!(assignmentRange.isActive || diaIDs), x: from - 16, onAssign: assignHandler, onUnAssign: () => unAssignHandler() })] }, id));
@@ -1,2 +1,2 @@
1
- declare function BaseLineZones(): import("@emotion/react/jsx-runtime").JSX.Element | null;
1
+ declare function BaseLineZones(): import("react/jsx-runtime").JSX.Element | null;
2
2
  export default BaseLineZones;
@@ -1,41 +1,21 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
- /** @jsxImportSource @emotion/react */
3
- import { css } from '@emotion/react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
4
2
  import { useChartData } from '../../context/ChartContext';
5
- import { useDispatch } from '../../context/DispatchContext';
6
3
  import { useScaleChecked } from '../../context/ScaleContext';
7
- import DeleteButton from '../../elements/DeleteButton';
8
- const styles = css `
9
- pointer-events: bounding-box;
10
- user-select: 'none';
11
- user-select: none;
12
-
13
- .zone-area {
14
- height: 100%;
15
- fill: #b8b8b857;
16
- cursor: pointer;
17
- }
18
-
19
- .delete-button {
20
- display: none;
21
- cursor: pointer;
22
- }
23
-
24
- :hover .delete-button {
25
- display: block;
26
- }
27
- `;
4
+ import { useHighlight } from '../../highlight';
28
5
  function BaseLineZones() {
29
6
  const { toolOptions: { selectedTool, data: { baselineCorrection }, }, } = useChartData();
30
- const { scaleX } = useScaleChecked();
31
- const dispatch = useDispatch();
32
- const deleteRangeHandler = (id) => {
33
- dispatch({ type: 'DELETE_BASE_LINE_ZONE', payload: { id } });
34
- };
35
7
  const baseLineZones = baselineCorrection.zones;
36
8
  if (selectedTool !== 'baselineCorrection' || baseLineZones.length === 0) {
37
9
  return null;
38
10
  }
39
- return (_jsx("g", { children: baselineCorrection.zones.map((zone) => (_jsxs("g", { transform: `translate(${scaleX()(zone.to)},0)`, css: styles, children: [_jsx(DeleteButton, { x: -20, y: 10, onDelete: () => deleteRangeHandler(zone.id) }), _jsx("rect", { x: "0", width: `${scaleX()(zone.from) - scaleX()(zone.to)}`, className: "zone-area" })] }, zone.id))) }));
11
+ return (_jsx("g", { children: baselineCorrection.zones.map((zone) => (_jsx(BaseLineZone, { ...zone }, zone.id))) }));
12
+ }
13
+ function BaseLineZone(props) {
14
+ const { from, to, id } = props;
15
+ const { onHover, isActive, defaultActiveStyle: { backgroundColor: activeFill }, } = useHighlight([id], { type: 'BASELINE_ZONE', extra: { id } });
16
+ const { scaleX } = useScaleChecked();
17
+ const x = scaleX()(to);
18
+ const width = scaleX()(from) - scaleX()(to);
19
+ return (_jsx("g", { transform: `translate(${x},0)`, ...onHover, children: _jsx("rect", { x: "0", width: width, height: "100%", style: { backgroundColor: 'red' }, fill: isActive ? activeFill : '#b8b8b857' }) }));
40
20
  }
41
21
  export default BaseLineZones;
@@ -0,0 +1,25 @@
1
+ interface ResolveGroupIntersectionProps {
2
+ maxIteration?: number;
3
+ groupMargin?: number;
4
+ }
5
+ interface GroupDataProps {
6
+ threshold?: number;
7
+ key: string;
8
+ }
9
+ interface ResolveIntersectionProps extends GroupDataProps, ResolveGroupIntersectionProps {
10
+ width?: number;
11
+ margin?: number;
12
+ }
13
+ interface GroupMeta {
14
+ groupWidth: number;
15
+ groupMidX: number;
16
+ groupStartX: number;
17
+ groupEndX: number;
18
+ id: string;
19
+ }
20
+ interface ResolveData<T> {
21
+ group: T[];
22
+ meta: GroupMeta;
23
+ }
24
+ export declare function resolve<T>(data: T[], options: ResolveIntersectionProps): Array<ResolveData<T>>;
25
+ export {};
@@ -0,0 +1,71 @@
1
+ import { v4 } from '@lukeed/uuid';
2
+ function groupData(data, options) {
3
+ const { threshold, key } = options;
4
+ const groups = [];
5
+ let lastRefValue = data[0][key];
6
+ let groupIndex = 0;
7
+ for (const datum of data) {
8
+ if (datum[key] - lastRefValue <= threshold) {
9
+ if (!groups[groupIndex]) {
10
+ groups.push([datum]);
11
+ }
12
+ else {
13
+ groups[groupIndex].push(datum);
14
+ }
15
+ }
16
+ else {
17
+ lastRefValue = datum[key];
18
+ groupIndex++;
19
+ groups.push([datum]);
20
+ }
21
+ }
22
+ return groups;
23
+ }
24
+ function resolveGroupsIntersection(groups, options) {
25
+ const { maxIteration = 3, groupMargin = 0 } = options;
26
+ let iteration = 1;
27
+ let hasIntersection = true;
28
+ const newGroups = JSON.parse(JSON.stringify(groups));
29
+ while (iteration < maxIteration && hasIntersection) {
30
+ iteration++;
31
+ hasIntersection = false;
32
+ let previousGroup = newGroups[0];
33
+ for (let i = 1; i < newGroups.length; i++) {
34
+ const currentGroupMeta = newGroups[i].meta;
35
+ if (previousGroup.meta.groupEndX > currentGroupMeta.groupStartX) {
36
+ const diff = Math.abs(currentGroupMeta.groupStartX - previousGroup.meta.groupEndX);
37
+ hasIntersection = true;
38
+ const shift = diff + groupMargin;
39
+ newGroups[i].meta = {
40
+ ...newGroups[i].meta,
41
+ groupStartX: currentGroupMeta.groupStartX + shift,
42
+ groupEndX: currentGroupMeta.groupEndX + shift,
43
+ groupMidX: currentGroupMeta.groupMidX + shift,
44
+ };
45
+ }
46
+ previousGroup = newGroups[i];
47
+ }
48
+ }
49
+ return newGroups;
50
+ }
51
+ export function resolve(data, options) {
52
+ const { width = 10, margin = 5, groupMargin = 0, key, threshold: inputThreshold, } = options;
53
+ const threshold = inputThreshold || width + margin * 2;
54
+ const groupedData = groupData(data, { threshold, key });
55
+ const resolvedGroups = [];
56
+ for (const group of groupedData) {
57
+ const groupWidth = group.length * width + (group.length - 1) * margin;
58
+ let sum = 0;
59
+ for (const groupDatum of group) {
60
+ sum += groupDatum[key];
61
+ }
62
+ const groupMidX = sum / group.length;
63
+ const groupStartX = groupMidX - groupWidth / 2 + width / 2;
64
+ const groupEndX = groupWidth / 2 + groupMidX;
65
+ resolvedGroups.push({
66
+ group,
67
+ meta: { groupMidX, groupStartX, groupEndX, groupWidth, id: v4() },
68
+ });
69
+ }
70
+ return resolveGroupsIntersection(resolvedGroups, { groupMargin });
71
+ }
@@ -1,13 +1,13 @@
1
1
  import { Ranges, Zones } from 'nmr-processing';
2
2
  import { MoleculeView, StateMoleculeExtended } from '../../../../data/molecules/Molecule';
3
- import { DISPLAYER_MODE } from '../../../reducer/core/Constants';
3
+ import { DisplayerMode } from '../../../reducer/Reducer';
4
4
  interface DraggableStructureProps {
5
5
  zones: Zones;
6
6
  ranges: Ranges;
7
7
  molecule: StateMoleculeExtended;
8
8
  moleculeView: MoleculeView;
9
9
  activeTab: string;
10
- displayerMode: DISPLAYER_MODE;
10
+ displayerMode: DisplayerMode;
11
11
  index?: number;
12
12
  }
13
13
  export declare function DraggableStructure(props: DraggableStructureProps): import("@emotion/react/jsx-runtime").JSX.Element | null;