nmrium 0.39.0 → 0.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (306) hide show
  1. package/lib/component/1d/FooterBanner.js +5 -4
  2. package/lib/component/1d/Viewer1D.js +121 -104
  3. package/lib/component/1d/database/ResurrectedDatabaseRanges.js +1 -1
  4. package/lib/component/1d/jCouplingGraph/JGraphContext.d.ts +1 -1
  5. package/lib/component/1d/jCouplingGraph/JsCouplingLinks.js +1 -1
  6. package/lib/component/1d/multiplicityTree/TreeColors.d.ts +1 -1
  7. package/lib/component/1d/multiplicityTree/TreeColors.js +1 -6
  8. package/lib/component/1d/multiplicityTree/TreeNodes.d.ts +1 -1
  9. package/lib/component/1d/tool/BaseLineZones.d.ts +1 -1
  10. package/lib/component/1d/tool/BaseLineZones.js +7 -4
  11. package/lib/component/1d/tool/PeakPointer.js +1 -1
  12. package/lib/component/1d/utilities/scale.js +1 -3
  13. package/lib/component/1d-2d/components/FloatMoleculeStructures/index.d.ts +1 -1
  14. package/lib/component/1d-2d/tools/BrushXY.js +10 -7
  15. package/lib/component/1d-2d/tools/CrossLinePointer.js +1 -1
  16. package/lib/component/2d/FooterBanner.js +3 -2
  17. package/lib/component/2d/Viewer2D.js +51 -29
  18. package/lib/component/2d/XAxis.js +1 -1
  19. package/lib/component/2d/YAxis.js +1 -1
  20. package/lib/component/2d/utilities/SliceScale.d.ts +2 -2
  21. package/lib/component/2d/utilities/scale.d.ts +5 -5
  22. package/lib/component/2d/zones/Signal.js +1 -2
  23. package/lib/component/EventsTrackers/BrushTracker.d.ts +4 -1
  24. package/lib/component/EventsTrackers/BrushTracker.js +21 -6
  25. package/lib/component/NMRium.d.ts +2 -2
  26. package/lib/component/NMRium.js +39 -26
  27. package/lib/component/assignment/AssignmentsReducer.d.ts +1 -1
  28. package/lib/component/assignment/actions/setActiveAssignment.js +1 -1
  29. package/lib/component/context/LoggerContext.js +11 -6
  30. package/lib/component/elements/InputRange.js +1 -1
  31. package/lib/component/elements/MenuButton.d.ts +1 -1
  32. package/lib/component/elements/MoleculeSelection.d.ts +1 -1
  33. package/lib/component/elements/ReactTable/ReactTable.d.ts +1 -1
  34. package/lib/component/elements/Tab/DeleteButton.d.ts +1 -1
  35. package/lib/component/elements/ToolbarMenu.d.ts +1 -1
  36. package/lib/component/elements/accordion/Accordion.d.ts +1 -1
  37. package/lib/component/elements/draggable/SVGDraggable.d.ts +1 -1
  38. package/lib/component/elements/draggable/useDraggable.d.ts +1 -1
  39. package/lib/component/elements/dropDownButton/DropDownButton.d.ts +1 -1
  40. package/lib/component/elements/dropDownButton/DropDownList.js +3 -1
  41. package/lib/component/elements/formik/SelectBox.d.ts +1 -1
  42. package/lib/component/elements/popup/Alert/AlertBlock.d.ts +8 -0
  43. package/lib/component/elements/popup/Alert/AlertBlock.js +30 -0
  44. package/lib/component/elements/popup/Alert/Context.d.ts +26 -2
  45. package/lib/component/elements/popup/Alert/Context.js +6 -2
  46. package/lib/component/elements/popup/Alert/Provider.d.ts +4 -3
  47. package/lib/component/elements/popup/Alert/Provider.js +5 -23
  48. package/lib/component/elements/popup/Modal/ConfirmDialog.d.ts +1 -1
  49. package/lib/component/elements/popup/Modal/ConfirmDialog.js +2 -1
  50. package/lib/component/elements/popup/Modal/Provider.js +3 -1
  51. package/lib/component/elements/popup/options.d.ts +22 -19
  52. package/lib/component/elements/resizer/Resizer.d.ts +2 -2
  53. package/lib/component/elements/toggle/ToggleButton.d.ts +2 -2
  54. package/lib/component/elements/toggle/ToggleButton.js +1 -1
  55. package/lib/component/header/Header.js +2 -2
  56. package/lib/component/header/ZeroFillingOptionsPanel.js +3 -8
  57. package/lib/component/highlight/index.d.ts +1 -1
  58. package/lib/component/hooks/useCheckToolsVisibility.js +2 -2
  59. package/lib/component/hooks/useExport.js +2 -1
  60. package/lib/component/hooks/useFormatNumberByNucleus.d.ts +1 -1
  61. package/lib/component/hooks/usePanelPreferences.js +2 -2
  62. package/lib/component/hooks/useXScale.d.ts +1 -1
  63. package/lib/component/hooks/useXYReduce.d.ts +2 -2
  64. package/lib/component/modal/AboutSpectrumSimulationModal.d.ts +2 -0
  65. package/lib/component/modal/AboutSpectrumSimulationModal.js +49 -0
  66. package/lib/component/modal/AboutUsModal.js +4 -2
  67. package/lib/component/modal/AlignSpectraModal.js +11 -1
  68. package/lib/component/modal/LogsHistoryModal.d.ts +6 -0
  69. package/lib/component/{header/LogsHistory.js → modal/LogsHistoryModal.js} +6 -4
  70. package/lib/component/modal/MultipletAnalysisModal.js +2 -1
  71. package/lib/component/modal/PredictSpectraModal.d.ts +1 -2
  72. package/lib/component/modal/PredictSpectraModal.js +25 -28
  73. package/lib/component/modal/changeSum/ChangeSumModal.js +1 -1
  74. package/lib/component/modal/editRange/forms/components/SignalsForm.js +1 -1
  75. package/lib/component/modal/editZone/SignalsForm.js +1 -1
  76. package/lib/component/modal/metaImportation/MetaImportationModal.js +1 -1
  77. package/lib/component/modal/setting/GeneralSettings.js +28 -27
  78. package/lib/component/modal/setting/settings-tabs/DisplayTabContent.js +4 -0
  79. package/lib/component/modal/setting/settings-tabs/FormattingTabContent.js +1 -1
  80. package/lib/component/modal/setting/settingsValidation.js +2 -2
  81. package/lib/component/panels/IntegralsPanel/IntegralPanel.d.ts +1 -1
  82. package/lib/component/panels/IntegralsPanel/IntegralTable.d.ts +1 -1
  83. package/lib/component/panels/IntegralsPanel/IntegralTable.js +4 -7
  84. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts +1 -1
  85. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +19 -19
  86. package/lib/component/panels/MoleculesPanel/Utilities.d.ts +1 -1
  87. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +3 -5
  88. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +9 -13
  89. package/lib/component/panels/Panels.js +13 -0
  90. package/lib/component/panels/PeaksPanel/PeaksTable.js +1 -1
  91. package/lib/component/panels/RangesPanel/RangesHeader.js +9 -15
  92. package/lib/component/panels/RangesPanel/RangesPanel.js +7 -10
  93. package/lib/component/panels/SpectrumsPanel/SpectraTable.js +8 -11
  94. package/lib/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +3 -1
  95. package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -2
  96. package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +2 -1
  97. package/lib/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
  98. package/lib/component/panels/ZonesPanel/ZonesTable.d.ts +1 -1
  99. package/lib/component/panels/databasePanel/DatabasePanel.d.ts +1 -1
  100. package/lib/component/panels/databasePanel/DatabasePanel.js +1 -1
  101. package/lib/component/panels/databasePanel/DatabaseTable.js +1 -1
  102. package/lib/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
  103. package/lib/component/panels/extra/utilities/UseToggleStatus.js +1 -1
  104. package/lib/component/panels/filtersPanel/FiltersTable.js +2 -2
  105. package/lib/component/panels/predictionPanel/PredictionOptionsPanel.js +2 -1
  106. package/lib/component/panels/predictionPanel/PredictionPanel.js +3 -2
  107. package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +2 -2
  108. package/lib/component/panels/spectrumSimulation/SpectrumSimulation.d.ts +1 -0
  109. package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +88 -0
  110. package/lib/component/panels/spectrumSimulation/SpectrumSimulationPreferences.d.ts +11 -0
  111. package/lib/component/panels/spectrumSimulation/SpectrumSimulationPreferences.js +37 -0
  112. package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.d.ts +4 -0
  113. package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +25 -0
  114. package/lib/component/panels/spectrumSimulation/SpinSystemTable.d.ts +5 -0
  115. package/lib/component/panels/spectrumSimulation/SpinSystemTable.js +60 -0
  116. package/lib/component/reducer/Reducer.d.ts +13 -12
  117. package/lib/component/reducer/Reducer.js +251 -239
  118. package/lib/component/reducer/actions/AssignmentsActions.d.ts +1 -1
  119. package/lib/component/reducer/actions/AssignmentsActions.js +1 -1
  120. package/lib/component/reducer/actions/DatabaseActions.js +2 -1
  121. package/lib/component/reducer/actions/DomainActions.d.ts +7 -2
  122. package/lib/component/reducer/actions/DomainActions.js +30 -1
  123. package/lib/component/reducer/actions/FiltersActions.js +4 -4
  124. package/lib/component/reducer/actions/LoadActions.js +1 -1
  125. package/lib/component/reducer/actions/MoleculeActions.d.ts +2 -0
  126. package/lib/component/reducer/actions/MoleculeActions.js +51 -2
  127. package/lib/component/reducer/actions/SpectrumsActions.d.ts +8 -2
  128. package/lib/component/reducer/actions/SpectrumsActions.js +43 -4
  129. package/lib/component/reducer/actions/ToolsActions.js +2 -2
  130. package/lib/component/reducer/actions/ZonesActions.js +1 -1
  131. package/lib/component/reducer/helper/ZoomHistoryManager.d.ts +4 -6
  132. package/lib/component/reducer/preferences/actions/setActiveWorkspace.js +1 -1
  133. package/lib/component/reducer/preferences/actions/setPreferences.js +3 -4
  134. package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
  135. package/lib/component/reducer/preferences/preferencesReducer.js +5 -1
  136. package/lib/component/reducer/preferences/utilities/flatObject.js +1 -1
  137. package/lib/component/toolbar/ToolTypes.d.ts +4 -4
  138. package/lib/component/utility/export.d.ts +5 -4
  139. package/lib/component/utility/export.js +33 -61
  140. package/lib/component/utility/getSpectraObjectPaths.js +1 -1
  141. package/lib/component/utility/getUniqueNuclei.js +1 -1
  142. package/lib/component/utility/jpathToArray.js +1 -1
  143. package/lib/component/workspaces/index.d.ts +1 -0
  144. package/lib/component/workspaces/index.js +2 -0
  145. package/lib/component/workspaces/simulation.d.ts +2 -0
  146. package/lib/component/workspaces/simulation.js +68 -0
  147. package/lib/component/workspaces/workspaceDefaultProperties.js +1 -0
  148. package/lib/data/PredictionManager.d.ts +8 -7
  149. package/lib/data/PredictionManager.js +95 -22
  150. package/lib/data/SpectraManager.js +1 -1
  151. package/lib/data/constants/DefaultPathLengths.d.ts +1 -3
  152. package/lib/data/constants/SignalsKinds.d.ts +2 -2
  153. package/lib/data/data1d/Spectrum1D/generateJGraphData.js +3 -3
  154. package/lib/data/data1d/Spectrum1D/getReferenceShift.js +5 -4
  155. package/lib/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.d.ts +1 -1
  156. package/lib/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +12 -13
  157. package/lib/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +10 -9
  158. package/lib/data/data1d/database.d.ts +5 -5
  159. package/lib/data/data1d/database.js +3 -3
  160. package/lib/data/data1d/multipleSpectraAnalysis.d.ts +1 -1
  161. package/lib/data/data1d/multipleSpectraAnalysis.js +1 -1
  162. package/lib/data/data1d/spectrumSimulation.d.ts +14 -0
  163. package/lib/data/data1d/spectrumSimulation.js +53 -0
  164. package/lib/data/data2d/Spectrum2D/contours.d.ts +8 -4
  165. package/lib/data/data2d/Spectrum2D/contours.js +7 -1
  166. package/lib/data/data2d/Spectrum2D/getMissingProjection.js +6 -6
  167. package/lib/data/data2d/Spectrum2D/getShift.js +1 -1
  168. package/lib/data/data2d/Spectrum2D/getSlice.js +4 -4
  169. package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.js +5 -5
  170. package/lib/data/getDefaultMatrixFilters.d.ts +2 -2
  171. package/lib/data/matrixGeneration.js +1 -1
  172. package/lib/data/molecules/MoleculeManager.d.ts +1 -1
  173. package/lib/data/molecules/MoleculeManager.js +7 -7
  174. package/lib/data/parseMeta/linkMetaWithSpectra.js +2 -1
  175. package/lib/data/types/data1d/MatrixOptions.d.ts +2 -2
  176. package/lib/data/utilities/FindUtilities.js +4 -4
  177. package/lib/data/utilities/RangeUtilities.d.ts +1 -1
  178. package/lib/data/utilities/ZoneUtilities.d.ts +1 -1
  179. package/lib/data/utilities/calculateSanPlot.js +3 -3
  180. package/lib/data/utilities/generateNumbersPowerOfX.js +1 -1
  181. package/lib/utils/clipboard/clipboard.d.ts +12 -0
  182. package/lib/utils/clipboard/clipboard.js +15 -0
  183. package/lib/utils/clipboard/clipboardComponents.d.ts +45 -0
  184. package/lib/utils/clipboard/clipboardComponents.js +150 -0
  185. package/lib/utils/clipboard/clipboardHooks.d.ts +94 -0
  186. package/lib/utils/clipboard/clipboardHooks.js +142 -0
  187. package/lib/utils/clipboard/types.d.ts +1 -0
  188. package/lib/utils/clipboard/types.js +1 -0
  189. package/lib/versionInfo.js +1 -1
  190. package/lib-cjs/component/1d/FooterBanner.js +5 -4
  191. package/lib-cjs/component/1d/Viewer1D.js +120 -103
  192. package/lib-cjs/component/1d/database/ResurrectedDatabaseRanges.js +1 -1
  193. package/lib-cjs/component/1d/jCouplingGraph/JsCouplingLinks.js +1 -1
  194. package/lib-cjs/component/1d/multiplicityTree/TreeColors.js +1 -6
  195. package/lib-cjs/component/1d/tool/BaseLineZones.js +6 -3
  196. package/lib-cjs/component/1d/tool/PeakPointer.js +1 -1
  197. package/lib-cjs/component/1d/utilities/scale.js +1 -3
  198. package/lib-cjs/component/1d-2d/tools/BrushXY.js +10 -7
  199. package/lib-cjs/component/1d-2d/tools/CrossLinePointer.js +1 -1
  200. package/lib-cjs/component/2d/FooterBanner.js +3 -2
  201. package/lib-cjs/component/2d/Viewer2D.js +50 -28
  202. package/lib-cjs/component/2d/XAxis.js +1 -1
  203. package/lib-cjs/component/2d/YAxis.js +1 -1
  204. package/lib-cjs/component/2d/zones/Signal.js +1 -2
  205. package/lib-cjs/component/EventsTrackers/BrushTracker.js +21 -6
  206. package/lib-cjs/component/NMRium.js +37 -24
  207. package/lib-cjs/component/assignment/actions/setActiveAssignment.js +1 -1
  208. package/lib-cjs/component/context/LoggerContext.js +10 -5
  209. package/lib-cjs/component/elements/InputRange.js +1 -1
  210. package/lib-cjs/component/elements/dropDownButton/DropDownList.js +3 -1
  211. package/lib-cjs/component/elements/popup/Alert/AlertBlock.js +36 -0
  212. package/lib-cjs/component/elements/popup/Alert/Context.js +6 -2
  213. package/lib-cjs/component/elements/popup/Alert/Provider.js +4 -22
  214. package/lib-cjs/component/elements/popup/Modal/ConfirmDialog.js +2 -1
  215. package/lib-cjs/component/elements/popup/Modal/Provider.js +3 -1
  216. package/lib-cjs/component/header/Header.js +2 -2
  217. package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +3 -8
  218. package/lib-cjs/component/hooks/useCheckToolsVisibility.js +2 -2
  219. package/lib-cjs/component/hooks/useExport.js +2 -1
  220. package/lib-cjs/component/hooks/usePanelPreferences.js +1 -1
  221. package/lib-cjs/component/modal/AboutSpectrumSimulationModal.js +54 -0
  222. package/lib-cjs/component/modal/AboutUsModal.js +4 -2
  223. package/lib-cjs/component/modal/AlignSpectraModal.js +11 -1
  224. package/lib-cjs/component/{header/LogsHistory.js → modal/LogsHistoryModal.js} +8 -6
  225. package/lib-cjs/component/modal/MultipletAnalysisModal.js +2 -1
  226. package/lib-cjs/component/modal/PredictSpectraModal.js +24 -27
  227. package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +1 -1
  228. package/lib-cjs/component/modal/editRange/forms/components/SignalsForm.js +1 -1
  229. package/lib-cjs/component/modal/editZone/SignalsForm.js +1 -1
  230. package/lib-cjs/component/modal/metaImportation/MetaImportationModal.js +1 -1
  231. package/lib-cjs/component/modal/setting/GeneralSettings.js +28 -27
  232. package/lib-cjs/component/modal/setting/settings-tabs/DisplayTabContent.js +4 -0
  233. package/lib-cjs/component/modal/setting/settings-tabs/FormattingTabContent.js +1 -1
  234. package/lib-cjs/component/modal/setting/settingsValidation.js +2 -2
  235. package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +4 -7
  236. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +18 -18
  237. package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +3 -5
  238. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +9 -13
  239. package/lib-cjs/component/panels/Panels.js +13 -0
  240. package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +1 -1
  241. package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +9 -15
  242. package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +7 -10
  243. package/lib-cjs/component/panels/SpectrumsPanel/SpectraTable.js +8 -11
  244. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +3 -1
  245. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -2
  246. package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
  247. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +1 -1
  248. package/lib-cjs/component/panels/databasePanel/DatabaseTable.js +1 -1
  249. package/lib-cjs/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
  250. package/lib-cjs/component/panels/extra/utilities/UseToggleStatus.js +1 -1
  251. package/lib-cjs/component/panels/filtersPanel/FiltersTable.js +2 -2
  252. package/lib-cjs/component/panels/predictionPanel/PredictionOptionsPanel.js +2 -1
  253. package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +3 -2
  254. package/lib-cjs/component/panels/predictionPanel/PredictionSimpleOptions.js +1 -1
  255. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulation.js +94 -0
  256. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationPreferences.js +42 -0
  257. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +31 -0
  258. package/lib-cjs/component/panels/spectrumSimulation/SpinSystemTable.js +67 -0
  259. package/lib-cjs/component/reducer/Reducer.js +251 -239
  260. package/lib-cjs/component/reducer/actions/AssignmentsActions.js +1 -1
  261. package/lib-cjs/component/reducer/actions/DatabaseActions.js +2 -1
  262. package/lib-cjs/component/reducer/actions/DomainActions.js +31 -1
  263. package/lib-cjs/component/reducer/actions/FiltersActions.js +4 -4
  264. package/lib-cjs/component/reducer/actions/LoadActions.js +1 -1
  265. package/lib-cjs/component/reducer/actions/MoleculeActions.js +54 -2
  266. package/lib-cjs/component/reducer/actions/SpectrumsActions.js +43 -3
  267. package/lib-cjs/component/reducer/actions/ToolsActions.js +2 -2
  268. package/lib-cjs/component/reducer/actions/ZonesActions.js +1 -1
  269. package/lib-cjs/component/reducer/preferences/actions/setActiveWorkspace.js +1 -1
  270. package/lib-cjs/component/reducer/preferences/actions/setPreferences.js +3 -4
  271. package/lib-cjs/component/reducer/preferences/preferencesReducer.js +5 -1
  272. package/lib-cjs/component/reducer/preferences/utilities/flatObject.js +1 -1
  273. package/lib-cjs/component/utility/export.js +33 -63
  274. package/lib-cjs/component/utility/getSpectraObjectPaths.js +1 -1
  275. package/lib-cjs/component/utility/getUniqueNuclei.js +1 -1
  276. package/lib-cjs/component/utility/jpathToArray.js +1 -1
  277. package/lib-cjs/component/workspaces/index.js +2 -0
  278. package/lib-cjs/component/workspaces/simulation.js +71 -0
  279. package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +1 -0
  280. package/lib-cjs/data/PredictionManager.js +96 -22
  281. package/lib-cjs/data/SpectraManager.js +1 -1
  282. package/lib-cjs/data/data1d/Spectrum1D/generateJGraphData.js +3 -3
  283. package/lib-cjs/data/data1d/Spectrum1D/getReferenceShift.js +5 -4
  284. package/lib-cjs/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +12 -13
  285. package/lib-cjs/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +10 -9
  286. package/lib-cjs/data/data1d/database.js +3 -3
  287. package/lib-cjs/data/data1d/multipleSpectraAnalysis.js +1 -1
  288. package/lib-cjs/data/data1d/spectrumSimulation.js +58 -0
  289. package/lib-cjs/data/data2d/Spectrum2D/contours.js +7 -1
  290. package/lib-cjs/data/data2d/Spectrum2D/getMissingProjection.js +6 -6
  291. package/lib-cjs/data/data2d/Spectrum2D/getShift.js +1 -1
  292. package/lib-cjs/data/data2d/Spectrum2D/getSlice.js +4 -4
  293. package/lib-cjs/data/data2d/Spectrum2D/zones/getDetectionZones.js +5 -5
  294. package/lib-cjs/data/matrixGeneration.js +1 -1
  295. package/lib-cjs/data/molecules/MoleculeManager.js +7 -7
  296. package/lib-cjs/data/parseMeta/linkMetaWithSpectra.js +2 -1
  297. package/lib-cjs/data/utilities/FindUtilities.js +4 -4
  298. package/lib-cjs/data/utilities/calculateSanPlot.js +3 -3
  299. package/lib-cjs/data/utilities/generateNumbersPowerOfX.js +1 -1
  300. package/lib-cjs/utils/clipboard/clipboard.js +23 -0
  301. package/lib-cjs/utils/clipboard/clipboardComponents.js +158 -0
  302. package/lib-cjs/utils/clipboard/clipboardHooks.js +147 -0
  303. package/lib-cjs/utils/clipboard/types.js +2 -0
  304. package/lib-cjs/versionInfo.js +1 -1
  305. package/package.json +26 -25
  306. package/lib/component/header/LogsHistory.d.ts +0 -1
@@ -44,10 +44,12 @@ const FooterBanner_1 = __importDefault(require("./FooterBanner"));
44
44
  const SlicingView_1 = __importDefault(require("./SlicingView"));
45
45
  const XYLabelPointer_1 = __importDefault(require("./tools/XYLabelPointer"));
46
46
  const DimensionLayout_1 = require("./utilities/DimensionLayout");
47
+ const scale_1 = require("./utilities/scale");
47
48
  function Viewer2D({ emptyText = undefined }) {
48
49
  const state = (0, ChartContext_1.useChartData)();
49
50
  const { toolOptions: { selectedTool }, isLoading, data, margin, view: { spectra: { activeSpectra, activeTab }, }, } = state;
50
51
  const dispatch = (0, DispatchContext_1.useDispatch)();
52
+ const brushStartRef = (0, react_1.useRef)(null);
51
53
  const spectrumData = (0, react_1.useMemo)(() => {
52
54
  const nuclei = activeTab.split(',');
53
55
  return nuclei.map((nucleus) => {
@@ -62,36 +64,56 @@ function Viewer2D({ emptyText = undefined }) {
62
64
  });
63
65
  }, [activeTab, data, activeSpectra]);
64
66
  const DIMENSION = (0, DimensionLayout_1.get2DDimensionLayout)(state);
67
+ function handelBrush(brushData) {
68
+ const { startX: startXInPixel, endX: endXInPixel, startY: startYInPixel, endY: endYInPixel, mouseButton, } = brushData;
69
+ if (mouseButton === 'secondary') {
70
+ const scaleX = (0, scale_1.get2DXScale)(state);
71
+ const scaleY = (0, scale_1.get2DYScale)(state);
72
+ if (!brushStartRef.current) {
73
+ const x = scaleX.invert(startXInPixel);
74
+ const y = scaleY.invert(startYInPixel);
75
+ brushStartRef.current = { x, y };
76
+ }
77
+ const { x, y } = brushStartRef.current;
78
+ const shiftX = scaleX.invert(endXInPixel) - x;
79
+ const shiftY = scaleY.invert(endYInPixel) - y;
80
+ dispatch({ type: 'MOVE', payload: { shiftX, shiftY } });
81
+ }
82
+ }
65
83
  const handelBrushEnd = (0, react_1.useCallback)((brushData) => {
66
- const trackID = (0, DimensionLayout_1.getLayoutID)(DIMENSION, brushData);
67
- if (trackID) {
68
- if (brushData.altKey) {
69
- switch (selectedTool) {
70
- default:
71
- break;
84
+ //reset the brush start
85
+ brushStartRef.current = null;
86
+ if (brushData.mouseButton === 'main') {
87
+ const trackID = (0, DimensionLayout_1.getLayoutID)(DIMENSION, brushData);
88
+ if (trackID) {
89
+ if (brushData.altKey) {
90
+ switch (selectedTool) {
91
+ default:
92
+ break;
93
+ }
72
94
  }
73
- }
74
- else if (brushData.shiftKey) {
75
- switch (selectedTool) {
76
- case ToolTypes_1.options.zonePicking.id:
77
- dispatch({ type: 'ADD_2D_ZONE', payload: brushData });
78
- break;
79
- default:
80
- break;
95
+ else if (brushData.shiftKey) {
96
+ switch (selectedTool) {
97
+ case ToolTypes_1.options.zonePicking.id:
98
+ dispatch({ type: 'ADD_2D_ZONE', payload: brushData });
99
+ break;
100
+ default:
101
+ break;
102
+ }
81
103
  }
82
- }
83
- else {
84
- switch (selectedTool) {
85
- default:
86
- if (selectedTool != null) {
87
- return dispatch({
88
- type: 'BRUSH_END',
89
- payload: {
90
- ...brushData,
91
- trackID: (0, DimensionLayout_1.getLayoutID)(DIMENSION, brushData),
92
- },
93
- });
94
- }
104
+ else {
105
+ switch (selectedTool) {
106
+ default:
107
+ if (selectedTool != null) {
108
+ return dispatch({
109
+ type: 'BRUSH_END',
110
+ payload: {
111
+ ...brushData,
112
+ trackID: (0, DimensionLayout_1.getLayoutID)(DIMENSION, brushData),
113
+ },
114
+ });
115
+ }
116
+ }
95
117
  }
96
118
  }
97
119
  }
@@ -123,7 +145,7 @@ function Viewer2D({ emptyText = undefined }) {
123
145
  break;
124
146
  }
125
147
  }, [selectedTool]);
126
- return ((0, jsx_runtime_1.jsx)(react_d3_utils_1.ResponsiveChart, { children: ({ width, height }) => ((0, jsx_runtime_1.jsxs)(ViewerResponsiveWrapper, { width: width, height: height, children: [(0, jsx_runtime_1.jsx)(Spinner_1.default, { isLoading: isLoading, emptyText: emptyText }), data && data.length > 0 && ((0, jsx_runtime_1.jsx)(BrushTracker_1.BrushTracker, { onBrush: handelBrushEnd, onDoubleClick: handelOnDoubleClick, onClick: mouseClick, onZoom: handleZoom, style: {
148
+ return ((0, jsx_runtime_1.jsx)(react_d3_utils_1.ResponsiveChart, { children: ({ width, height }) => ((0, jsx_runtime_1.jsxs)(ViewerResponsiveWrapper, { width: width, height: height, children: [(0, jsx_runtime_1.jsx)(Spinner_1.default, { isLoading: isLoading, emptyText: emptyText }), data && data.length > 0 && ((0, jsx_runtime_1.jsx)(BrushTracker_1.BrushTracker, { onBrush: handelBrush, onBrushEnd: handelBrushEnd, onDoubleClick: handelOnDoubleClick, onClick: mouseClick, onZoom: handleZoom, style: {
127
149
  width: '100%',
128
150
  height: '100%',
129
151
  margin: 'auto',
@@ -55,7 +55,7 @@ function XAxis(props) {
55
55
  (0, react_2.useEffect)(() => {
56
56
  if (!show)
57
57
  return;
58
- let scaleX = (0, scale_1.get2DXScale)({
58
+ const scaleX = (0, scale_1.get2DXScale)({
59
59
  width,
60
60
  margin,
61
61
  xDomain,
@@ -55,7 +55,7 @@ function YAxis(props) {
55
55
  (0, react_2.useEffect)(() => {
56
56
  if (!show || !yDomain)
57
57
  return;
58
- let scaleY = (0, scale_1.get2DYScale)({ height, yDomain, margin }, !!spectrum?.info?.isFid);
58
+ const scaleY = (0, scale_1.get2DYScale)({ height, yDomain, margin }, !!spectrum?.info?.isFid);
59
59
  const axis = d3.axisRight(scaleY).ticks(8).tickFormat(d3.format('0'));
60
60
  // @ts-expect-error well typed
61
61
  d3.select(refAxis.current).call(axis);
@@ -45,7 +45,6 @@ function Signal({ signal, isVisible }) {
45
45
  assignment.hide();
46
46
  highlight.hide();
47
47
  }, cx: scaleX(signal.x.delta || 0), cy: scaleY(signal.y.delta || 0), r: isHighlighted ? 6 : 4, fill: isHighlighted ? 'green' : 'darkgreen' }, signal.id)] })), (0, jsx_runtime_1.jsx)("g", { className: "zone-signal-peak", style: { pointerEvents: 'none' }, children: isVisible.peaks &&
48
- signal?.peaks &&
49
- signal.peaks.map((peak, i) => ((0, jsx_runtime_1.jsx)("circle", { cx: scaleX(peak.x), cy: scaleY(peak.y), r: 2, fill: "black" }, `${signal.id + i}`))) })] }));
48
+ signal?.peaks?.map((peak, i) => ((0, jsx_runtime_1.jsx)("circle", { cx: scaleX(peak.x), cy: scaleY(peak.y), r: 2, fill: "black" }, `${signal.id + i}`))) })] }));
50
49
  }
51
50
  exports.default = (0, react_1.memo)(Signal);
@@ -8,8 +8,13 @@ const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const debounce_1 = __importDefault(require("lodash/debounce"));
9
9
  const map_1 = __importDefault(require("lodash/map"));
10
10
  const react_1 = require("react");
11
+ const MouseButtons = {
12
+ 0: 'main',
13
+ 2: 'secondary',
14
+ };
11
15
  const initialState = {
12
16
  step: 'initial',
17
+ mouseButton: 'unknown',
13
18
  shiftKey: false,
14
19
  altKey: false,
15
20
  startX: 0,
@@ -33,18 +38,21 @@ function useBrushTracker() {
33
38
  return (0, react_1.useContext)(exports.BrushContext);
34
39
  }
35
40
  exports.useBrushTracker = useBrushTracker;
36
- function BrushTracker({ children, className, style, onBrush = () => null, onZoom = () => null, onDoubleClick = () => null, onClick = () => null, noPropagation, }) {
41
+ function BrushTracker({ children, className, style, onBrushEnd, onBrush, onZoom = () => null, onDoubleClick = () => null, onClick = () => null, noPropagation, }) {
37
42
  const [state, dispatch] = (0, react_1.useReducer)(reducer, initialState);
38
43
  const [mouseDownTime, setMouseDownTime] = (0, react_1.useState)(0);
39
44
  const debounceClickEventsRef = (0, react_1.useRef)([]);
45
+ const lastPointRef = (0, react_1.useRef)(0);
40
46
  const mouseDownHandler = (0, react_1.useCallback)((event) => {
41
- if (event.button === 0) {
47
+ //check that the right or left mouse button pressed
48
+ if ([0, 2].includes(event.button)) {
42
49
  if (noPropagation) {
43
50
  event.stopPropagation();
44
51
  }
45
52
  dispatch({
46
53
  type: 'DOWN',
47
54
  payload: {
55
+ mouseButton: MouseButtons[event.button],
48
56
  shiftKey: event.shiftKey,
49
57
  altKey: event.altKey,
50
58
  screenX: event.screenX,
@@ -107,13 +115,19 @@ function BrushTracker({ children, className, style, onBrush = () => null, onZoom
107
115
  }, [onZoom]);
108
116
  (0, react_1.useEffect)(() => {
109
117
  const { step, startX, endX, startY, endY } = state;
110
- if (step === 'end' && Math.hypot(endX - startX, endY - startY) > 5) {
111
- onBrush(state);
118
+ const point = Math.hypot(endX - startX, endY - startY);
119
+ if ((step === 'end' || step === 'brushing') &&
120
+ lastPointRef.current !== point) {
121
+ onBrush?.(state);
122
+ lastPointRef.current = point;
123
+ }
124
+ if (step === 'end' && point > 5) {
125
+ onBrushEnd?.(state);
112
126
  dispatch({
113
127
  type: 'DONE',
114
128
  });
115
129
  }
116
- }, [onBrush, state]);
130
+ }, [onBrush, onBrushEnd, state]);
117
131
  return ((0, jsx_runtime_1.jsx)(exports.BrushContext.Provider, { value: state, children: (0, jsx_runtime_1.jsx)("div", { className: className, style: style, onMouseDown: mouseDownHandler, onClick: clickHandler, onWheel: handleMouseWheel, onMouseEnter: () => {
118
132
  // disable page scrolling once the mouse over the Displayer
119
133
  window.addEventListener('wheel', stopPageScrolling, {
@@ -137,13 +151,14 @@ function reducer(state, action) {
137
151
  return state;
138
152
  case 'DOWN':
139
153
  if (state.step === 'initial' || state.step === 'end') {
140
- const { shiftKey, altKey, screenX, screenY, clientX, clientY, boundingRect, } = action.payload;
154
+ const { shiftKey, altKey, mouseButton, screenX, screenY, clientX, clientY, boundingRect, } = action.payload;
141
155
  const x = clientX - boundingRect.x;
142
156
  const y = clientY - boundingRect.y;
143
157
  return {
144
158
  ...state,
145
159
  shiftKey,
146
160
  altKey,
161
+ mouseButton,
147
162
  startX: x,
148
163
  startY: y,
149
164
  startScreenX: screenX,
@@ -66,7 +66,7 @@ const viewerContainerStyle = (0, react_1.css) `
66
66
  border: 0.55px #e6e6e6 solid;
67
67
  display: flex;
68
68
  flex: 1;
69
- flex-direction: 'column';
69
+ flex-direction: column;
70
70
  height: 100%;
71
71
  margin-left: -1px;
72
72
  `;
@@ -227,28 +227,41 @@ function InnerNMRium({ data: dataProp = defaultData, workspace, customWorkspaces
227
227
  rootRef: rootRef.current,
228
228
  elementsWrapperRef: elementsWrapperRef.current,
229
229
  viewerRef: viewerRef.current,
230
- }, children: (0, jsx_runtime_1.jsx)(PreferencesContext_1.PreferencesProvider, { value: preferencesState, children: (0, jsx_runtime_1.jsx)("div", { ref: mainDivRef, style: { height: '100%', position: 'relative' }, children: (0, jsx_runtime_1.jsx)(LoggerContext_1.LoggerProvider, { children: (0, jsx_runtime_1.jsx)(Alert_1.AlertProvider, { wrapperRef: elementsWrapperRef.current, children: (0, jsx_runtime_1.jsx)(DispatchContext_1.DispatchProvider, { value: dispatch, children: (0, jsx_runtime_1.jsx)(ChartContext_1.ChartDataProvider, { value: state, children: (0, jsx_runtime_1.jsx)(Modal_1.ModalProvider, { wrapperRef: elementsWrapperRef.current, children: (0, jsx_runtime_1.jsx)(highlight_1.HighlightProvider, { children: (0, jsx_runtime_1.jsx)(assignment_1.AssignmentProvider, { spectraData: spectraData, children: (0, jsx_runtime_1.jsx)(SpinnerContext_1.SpinnerProvider, { value: getSpinner, children: (0, jsx_runtime_1.jsx)("div", { className: "nmrium-container", ref: rootRef, css: containerStyles, onContextMenu: preventContextMenuHandler, style: { height: '100%', width: '100%' }, children: (0, jsx_runtime_1.jsx)(DropZone_1.default, { children: (0, jsx_runtime_1.jsxs)("div", { style: {
231
- display: 'flex',
232
- flexDirection: 'column',
233
- backgroundColor: 'white',
234
- width: '100%',
235
- }, children: [(0, jsx_runtime_1.jsx)(Header_1.default, { isFullscreen: isFullscreen, onMaximize: toggle }), (0, jsx_runtime_1.jsxs)("div", { style: {
236
- display: 'flex',
237
- flexDirection: 'row',
238
- height: '100%',
239
- }, children: [(0, jsx_runtime_1.jsx)(ToolBar_1.default, {}), (0, jsx_runtime_1.jsxs)(SplitPaneWrapper_1.SplitPaneWrapper, { children: [(0, jsx_runtime_1.jsxs)("div", { css: viewerContainerStyle, children: [(0, jsx_runtime_1.jsx)(KeysListenerTracker_1.default, {}), (0, jsx_runtime_1.jsxs)("div", { id: "nmrium-viewer", "data-test-id": "viewer", ref: viewerRef, style: {
240
- width: '100%',
241
- height: '100%',
242
- position: 'relative',
243
- }, children: [(0, jsx_runtime_1.jsx)(FloatMoleculeStructures_1.default, {}), displayerMode ===
244
- Constants_1.DISPLAYER_MODE.DM_1D ? ((0, jsx_runtime_1.jsx)(Viewer1D_1.default, { emptyText: emptyText })) : ((0, jsx_runtime_1.jsx)(Viewer2D_1.default, { emptyText: emptyText }))] })] }), (0, jsx_runtime_1.jsx)(Panels_1.default, {})] }), (0, jsx_runtime_1.jsx)("div", { ref: elementsWrapperRef, id: "main-wrapper", style: {
245
- position: 'absolute',
246
- pointerEvents: 'none',
247
- zIndex: 2,
248
- left: 0,
249
- right: 0,
250
- top: 0,
251
- bottom: 0,
252
- } }, String(isFullscreen))] })] }) }) }) }) }) }) }) }) }) }) }) }) }) }));
230
+ }, children: (0, jsx_runtime_1.jsx)(PreferencesContext_1.PreferencesProvider, { value: preferencesState, children: (0, jsx_runtime_1.jsx)("div", { ref: mainDivRef, style: { height: '100%', position: 'relative' }, children: (0, jsx_runtime_1.jsx)(LoggerContext_1.LoggerProvider, { children: (0, jsx_runtime_1.jsx)(Alert_1.AlertProvider, { wrapperRef: elementsWrapperRef.current, children: (0, jsx_runtime_1.jsx)(DispatchContext_1.DispatchProvider, { value: dispatch, children: (0, jsx_runtime_1.jsx)(ChartContext_1.ChartDataProvider, { value: state, children: (0, jsx_runtime_1.jsx)(Modal_1.ModalProvider, { wrapperRef: elementsWrapperRef.current, children: (0, jsx_runtime_1.jsx)(highlight_1.HighlightProvider, { children: (0, jsx_runtime_1.jsx)(assignment_1.AssignmentProvider, { spectraData: spectraData, children: (0, jsx_runtime_1.jsxs)(SpinnerContext_1.SpinnerProvider, { value: getSpinner, children: [(0, jsx_runtime_1.jsx)(StateError, {}), (0, jsx_runtime_1.jsx)("div", { className: "nmrium-container", ref: rootRef, css: containerStyles, onContextMenu: preventContextMenuHandler, style: { height: '100%', width: '100%' }, children: (0, jsx_runtime_1.jsx)(DropZone_1.default, { children: (0, jsx_runtime_1.jsxs)("div", { style: {
231
+ display: 'flex',
232
+ flexDirection: 'column',
233
+ backgroundColor: 'white',
234
+ width: '100%',
235
+ }, children: [(0, jsx_runtime_1.jsx)(Header_1.default, { isFullscreen: isFullscreen, onMaximize: toggle }), (0, jsx_runtime_1.jsxs)("div", { style: {
236
+ display: 'flex',
237
+ flexDirection: 'row',
238
+ height: '100%',
239
+ }, children: [(0, jsx_runtime_1.jsx)(ToolBar_1.default, {}), (0, jsx_runtime_1.jsxs)(SplitPaneWrapper_1.SplitPaneWrapper, { children: [(0, jsx_runtime_1.jsxs)("div", { css: viewerContainerStyle, children: [(0, jsx_runtime_1.jsx)(KeysListenerTracker_1.default, {}), (0, jsx_runtime_1.jsxs)("div", { id: "nmrium-viewer", "data-test-id": "viewer", ref: viewerRef, style: {
240
+ width: '100%',
241
+ height: '100%',
242
+ position: 'relative',
243
+ }, children: [(0, jsx_runtime_1.jsx)(FloatMoleculeStructures_1.default, {}), displayerMode ===
244
+ Constants_1.DISPLAYER_MODE.DM_1D ? ((0, jsx_runtime_1.jsx)(Viewer1D_1.default, { emptyText: emptyText })) : ((0, jsx_runtime_1.jsx)(Viewer2D_1.default, { emptyText: emptyText }))] })] }), (0, jsx_runtime_1.jsx)(Panels_1.default, {})] }), (0, jsx_runtime_1.jsx)("div", { ref: elementsWrapperRef, id: "main-wrapper", style: {
245
+ position: 'absolute',
246
+ pointerEvents: 'none',
247
+ zIndex: 2,
248
+ left: 0,
249
+ right: 0,
250
+ top: 0,
251
+ bottom: 0,
252
+ } }, String(isFullscreen))] })] }) }) })] }) }) }) }) }) }) }) }) }) }) }));
253
253
  }
254
254
  exports.default = (0, react_2.memo)(NMRium);
255
+ /**
256
+ * Alert user in UI when state have errorAction (error from reducer)
257
+ */
258
+ function StateError() {
259
+ const { errorAction } = (0, ChartContext_1.useChartData)();
260
+ const { error: alertError } = (0, Alert_1.useAlert)();
261
+ (0, react_2.useEffect)(() => {
262
+ if (!errorAction)
263
+ return;
264
+ alertError(errorAction?.message ?? String(errorAction));
265
+ }, [errorAction, alertError]);
266
+ return null;
267
+ }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  function setActiveAssignment(state, action) {
4
- let { id, axis } = action.payload;
4
+ const { id, axis } = action.payload;
5
5
  const isActive = state.activated?.id === id;
6
6
  return {
7
7
  ...state,
@@ -4,6 +4,7 @@ exports.LoggerProvider = exports.useLogger = exports.LoggerContext = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const fifo_logger_1 = require("fifo-logger");
6
6
  const react_1 = require("react");
7
+ const LogsHistoryModal_1 = require("../modal/LogsHistoryModal");
7
8
  const PreferencesContext_1 = require("./PreferencesContext");
8
9
  exports.LoggerContext = (0, react_1.createContext)(null);
9
10
  function useLogger() {
@@ -18,12 +19,16 @@ function LoggerProvider({ children }) {
18
19
  const { current: { general: { loggingLevel }, }, } = (0, PreferencesContext_1.usePreferences)();
19
20
  const [lastReadLogId, setLastLogId] = (0, react_1.useState)(0);
20
21
  const [logsHistory, setLogsHistory] = (0, react_1.useState)([]);
22
+ const [isLogHistoryOpened, openLogHistory] = (0, react_1.useState)(false);
21
23
  const loggerRef = (0, react_1.useRef)(new fifo_logger_1.FifoLogger({
22
24
  onChange: (log, logs) => {
23
- if (log?.error &&
24
- (log?.levelLabel === 'error' || log?.levelLabel === 'fatal')) {
25
- // eslint-disable-next-line no-console
26
- console.error(log.error);
25
+ if (log && ['warn', 'error', 'fatal'].includes(log.levelLabel)) {
26
+ //open the log history automatically if we have warn,error, or fatal
27
+ openLogHistory(true);
28
+ if (log?.error) {
29
+ // eslint-disable-next-line no-console
30
+ console.error(log.error);
31
+ }
27
32
  }
28
33
  setLogsHistory(logs.slice());
29
34
  },
@@ -47,6 +52,6 @@ function LoggerProvider({ children }) {
47
52
  lastReadLogId,
48
53
  };
49
54
  }, [lastReadLogId, logsHistory, markAsRead]);
50
- return ((0, jsx_runtime_1.jsx)(exports.LoggerContext.Provider, { value: loggerState, children: children }));
55
+ return ((0, jsx_runtime_1.jsxs)(exports.LoggerContext.Provider, { value: loggerState, children: [isLogHistoryOpened && ((0, jsx_runtime_1.jsx)(LogsHistoryModal_1.LogsHistoryModal, { autoOpen: true, onClose: () => openLogHistory(false) })), children] }));
51
56
  }
52
57
  exports.LoggerProvider = LoggerProvider;
@@ -38,7 +38,7 @@ function InputRange(props, ref) {
38
38
  }));
39
39
  const mouseDownCallback = (0, react_1.useCallback)((event) => {
40
40
  function mouseMoveCallback(event) {
41
- let diff = event.clientX - previousPosition.current;
41
+ const diff = event.clientX - previousPosition.current;
42
42
  previousPosition.current = event.clientX;
43
43
  if (event.buttons === 1) {
44
44
  const step = diff / (event.shiftKey ? 10 : 1);
@@ -10,7 +10,9 @@ const styles = {
10
10
  position: absolute;
11
11
  height: auto;
12
12
  z-index: 99999999999999;
13
- box-shadow: 0 19px 38px rgb(0 0 0 / 30%), 0 15px 12px rgb(0 0 0 / 22%);
13
+ box-shadow:
14
+ 0 19px 38px rgb(0 0 0 / 30%),
15
+ 0 15px 12px rgb(0 0 0 / 22%);
14
16
  border-radius: 10px;
15
17
  margin-bottom: 20px;
16
18
  overflow: hidden;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
7
+ /** @jsxImportSource @emotion/react */
8
+ const react_1 = require("@emotion/react");
9
+ const fa_1 = require("react-icons/fa");
10
+ const options_1 = require("../options");
11
+ const ProgressIndicator_1 = __importDefault(require("./ProgressIndicator"));
12
+ const style = (0, react_1.css) `
13
+ padding: 25px;
14
+ border-radius: 10px;
15
+ pointer-events: all;
16
+ min-height: 60px;
17
+ position: relative;
18
+
19
+ > button {
20
+ position: absolute;
21
+ right: 5px;
22
+ top: 5px;
23
+ border: none;
24
+ background-color: transparent;
25
+ color: white;
26
+ }
27
+ `;
28
+ function AlertBlock(props) {
29
+ const { offset, alert, onClose } = props;
30
+ return ((0, jsx_runtime_1.jsxs)("div", { css: style, style: {
31
+ margin: offset,
32
+ backgroundColor: alert.options.backgroundColor,
33
+ color: alert.options.color,
34
+ }, children: [(0, jsx_runtime_1.jsx)("button", { type: "button", onClick: onClose, children: (0, jsx_runtime_1.jsx)(fa_1.FaTimes, {}) }), (0, jsx_runtime_1.jsx)("span", { children: alert.message }), alert.options.type === options_1.types.PROGRESS_INDICATOR && (0, jsx_runtime_1.jsx)(ProgressIndicator_1.default, {})] }, alert.id));
35
+ }
36
+ exports.default = AlertBlock;
@@ -2,9 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useAlert = exports.AlertProvider = void 0;
4
4
  const react_1 = require("react");
5
- const AlertContext = (0, react_1.createContext)({});
5
+ const AlertContext = (0, react_1.createContext)(null);
6
6
  exports.AlertProvider = AlertContext.Provider;
7
7
  function useAlert() {
8
- return (0, react_1.useContext)(AlertContext);
8
+ const context = (0, react_1.useContext)(AlertContext);
9
+ if (!context) {
10
+ throw new Error('useAlert should be mount into an AlertProvider');
11
+ }
12
+ return context;
9
13
  }
10
14
  exports.useAlert = useAlert;
@@ -7,13 +7,12 @@ const jsx_runtime_1 = require("react/jsx-runtime");
7
7
  const groupBy_1 = __importDefault(require("lodash/groupBy"));
8
8
  const react_1 = require("react");
9
9
  const react_dom_1 = require("react-dom");
10
- const fa_1 = require("react-icons/fa");
11
10
  const react_transition_group_1 = require("react-transition-group");
12
11
  const Transition_1 = __importDefault(require("../Transition"));
13
12
  const Wrapper_1 = __importDefault(require("../Wrapper"));
14
13
  const options_1 = require("../options");
14
+ const AlertBlock_1 = __importDefault(require("./AlertBlock"));
15
15
  const Context_1 = require("./Context");
16
- const ProgressIndicator_1 = __importDefault(require("./ProgressIndicator"));
17
16
  function Provider({ children, wrapperRef = null, offset = '5px', position = options_1.positions.BOTTOM_CENTER, timeout = 3000, type, transition = options_1.transitions.FADE, ...props }) {
18
17
  const root = (0, react_1.useRef)(null);
19
18
  const timersId = (0, react_1.useRef)([]);
@@ -58,10 +57,10 @@ function Provider({ children, wrapperRef = null, offset = '5px', position = opti
58
57
  id,
59
58
  message,
60
59
  options: alertOptions,
60
+ close: () => remove(alert),
61
61
  };
62
- alert.close = () => remove(alert);
63
62
  if (alert.options.timeout) {
64
- const timerId = setTimeout(() => {
63
+ const timerId = window.setTimeout(() => {
65
64
  remove(alert);
66
65
  timersId.current.splice(timersId.current.indexOf(timerId), 1);
67
66
  }, alert.options.timeout);
@@ -126,24 +125,7 @@ function Provider({ children, wrapperRef = null, offset = '5px', position = opti
126
125
  (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: Object.keys(options_1.positions).map((key) => {
127
126
  const position = options_1.positions[key];
128
127
  return ((0, jsx_runtime_1.jsx)(react_transition_group_1.TransitionGroup, { appear: true, options: { position, zIndex: 999999 }, component: Wrapper_1.default, containerStyle: parentStyle, ...props, children: alertsByPosition[position]
129
- ? alertsByPosition[position].map((alert) => ((0, jsx_runtime_1.jsx)(Transition_1.default, { type: transition, children: (0, jsx_runtime_1.jsxs)("div", { style: {
130
- margin: offset,
131
- padding: '25px',
132
- borderRadius: '10px',
133
- pointerEvents: 'all',
134
- backgroundColor: alert.options.backgroundColor,
135
- color: alert.options.color,
136
- minHeight: '60px',
137
- position: 'relative',
138
- }, children: [(0, jsx_runtime_1.jsx)("button", { style: {
139
- position: 'absolute',
140
- right: '5px',
141
- top: '5px',
142
- border: 'none',
143
- backgroundColor: 'transparent',
144
- color: 'white',
145
- }, type: "button", onClick: () => closeHandler(alert), children: (0, jsx_runtime_1.jsx)(fa_1.FaTimes, {}) }), (0, jsx_runtime_1.jsx)("span", { children: alert.message }), alert.options.type ===
146
- options_1.types.PROGRESS_INDICATOR && (0, jsx_runtime_1.jsx)(ProgressIndicator_1.default, {})] }, alert.id) }, alert.id)))
128
+ ? alertsByPosition[position].map((alert) => ((0, jsx_runtime_1.jsx)(Transition_1.default, { type: transition, children: (0, jsx_runtime_1.jsx)(AlertBlock_1.default, { offset: offset, alert: alert, onClose: () => closeHandler(alert) }) }, alert.id)))
147
129
  : null }, position));
148
130
  }) }), root.current)] }));
149
131
  }
@@ -8,7 +8,8 @@ const styles = (0, react_1.css) `
8
8
  display: block;
9
9
  border-radius: 5px;
10
10
  overflow: hidden;
11
- width: 350px;
11
+ width: 30vw;
12
+ min-width: 350px;
12
13
  border-top: 10px solid #ed0000;
13
14
 
14
15
  .message {
@@ -124,7 +124,9 @@ function Provider({ children, style, offset = '0px', position = options_1.positi
124
124
  .rnd-container {
125
125
  box-sizing: initial;
126
126
  background-color: #fff;
127
- box-shadow: 0 0 0 0, 0 8px 16px rgb(0 0 0 / 30%);
127
+ box-shadow:
128
+ 0 0 0 0,
129
+ 0 8px 16px rgb(0 0 0 / 30%);
128
130
  border-radius: 5px;
129
131
  }
130
132
  `;
@@ -18,6 +18,7 @@ const Header_1 = require("../elements/Header");
18
18
  const DropDownButton_1 = __importDefault(require("../elements/dropDownButton/DropDownButton"));
19
19
  const useSaveSettings_1 = require("../hooks/useSaveSettings");
20
20
  const AboutUsModal_1 = __importDefault(require("../modal/AboutUsModal"));
21
+ const LogsHistoryModal_1 = require("../modal/LogsHistoryModal");
21
22
  const GeneralSettings_1 = __importDefault(require("../modal/setting/GeneralSettings"));
22
23
  const WorkspaceItem_1 = __importDefault(require("../modal/setting/WorkspaceItem"));
23
24
  const ToolTypes_1 = require("../toolbar/ToolTypes");
@@ -25,7 +26,6 @@ const ApodizationOptionsPanel_1 = __importDefault(require("./ApodizationOptionsP
25
26
  const AutoPeakPickingOptionPanel_1 = __importDefault(require("./AutoPeakPickingOptionPanel"));
26
27
  const BaseLineCorrectionPanel_1 = __importDefault(require("./BaseLineCorrectionPanel"));
27
28
  const HeaderContainer_1 = require("./HeaderContainer");
28
- const LogsHistory_1 = require("./LogsHistory");
29
29
  const PhaseCorrectionPanel_1 = __importDefault(require("./PhaseCorrectionPanel"));
30
30
  const RangesPickingOptionPanel_1 = __importDefault(require("./RangesPickingOptionPanel"));
31
31
  const ZeroFillingOptionsPanel_1 = __importDefault(require("./ZeroFillingOptionsPanel"));
@@ -106,7 +106,7 @@ function HeaderInner(props) {
106
106
  alignItems: 'center',
107
107
  }, children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(ui_1.Toolbar, { orientation: "horizontal", children: (0, jsx_runtime_1.jsx)(AboutUsModal_1.default, {}) }) }), (0, jsx_runtime_1.jsx)("div", { className: "toolOptionsPanel", style: { flex: 1 }, children: selectedPanel })] }), (0, jsx_runtime_1.jsxs)(HeaderContainer_1.HeaderContainer, { style: {
108
108
  alignItems: 'center',
109
- }, children: [!hideGeneralSettings && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(DropDownButton_1.default, { data: workspacesList, selectedKey: workspace.current, onSelect: changeWorkspaceHandler, renderItem: renderItem }), (0, jsx_runtime_1.jsx)(SaveButton, {})] })), !general?.hideLogs && (0, jsx_runtime_1.jsx)(LogsHistory_1.LogsHistory, {}), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)(ui_1.Toolbar, { orientation: "horizontal", children: [(0, jsx_runtime_1.jsx)(ui_1.Toolbar.Item, { id: "user-manual", title: "User manual", onClick: () => window.open(constants_1.docsBaseUrl, '_blank'), children: (0, jsx_runtime_1.jsx)(fa_1.FaQuestionCircle, {}) }), !hideGeneralSettings && ((0, jsx_runtime_1.jsx)(GeneralSettings_1.default, { height: height / 2 })), !isFullscreen && ((0, jsx_runtime_1.jsx)(ui_1.Toolbar.Item, { id: "full-screen", onClick: onMaximize, title: "Full Screen", className: "windowButton", children: (0, jsx_runtime_1.jsx)(fa_1.FaRegWindowMaximize, {}) }))] }) })] })] }) }));
109
+ }, children: [!hideGeneralSettings && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(DropDownButton_1.default, { data: workspacesList, selectedKey: workspace.current, onSelect: changeWorkspaceHandler, renderItem: renderItem }), (0, jsx_runtime_1.jsx)(SaveButton, {})] })), !general?.hideLogs && (0, jsx_runtime_1.jsx)(LogsHistoryModal_1.LogsHistoryModal, {}), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)(ui_1.Toolbar, { orientation: "horizontal", children: [(0, jsx_runtime_1.jsx)(ui_1.Toolbar.Item, { id: "user-manual", title: "User manual", onClick: () => window.open(constants_1.docsBaseUrl, '_blank'), children: (0, jsx_runtime_1.jsx)(fa_1.FaQuestionCircle, {}) }), !hideGeneralSettings && ((0, jsx_runtime_1.jsx)(GeneralSettings_1.default, { height: height / 2 })), !isFullscreen && ((0, jsx_runtime_1.jsx)(ui_1.Toolbar.Item, { id: "full-screen", onClick: onMaximize, title: "Full Screen", className: "windowButton", children: (0, jsx_runtime_1.jsx)(fa_1.FaRegWindowMaximize, {}) }))] }) })] })] }) }));
110
110
  }
111
111
  function SaveButton() {
112
112
  const { workspace, workspaces, originalWorkspaces } = (0, PreferencesContext_1.usePreferences)();
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const jsx_runtime_1 = require("react/jsx-runtime");
7
7
  const nmr_processing_1 = require("nmr-processing");
8
8
  const react_1 = require("react");
9
+ const ui_1 = require("react-science/ui");
9
10
  const generateNumbersPowerOfX_1 = __importDefault(require("../../data/utilities/generateNumbersPowerOfX"));
10
11
  const DispatchContext_1 = require("../context/DispatchContext");
11
12
  const ActionButtons_1 = __importDefault(require("../elements/ActionButtons"));
12
- const CheckBox_1 = __importDefault(require("../elements/CheckBox"));
13
13
  const Label_1 = __importDefault(require("../elements/Label"));
14
14
  const Select_1 = __importDefault(require("../elements/Select"));
15
15
  const useFilter_1 = require("../hooks/useFilter");
@@ -55,19 +55,14 @@ function ZeroFillingOptionsInnerPanel(props) {
55
55
  }
56
56
  function handleChangeSizeHandler(value) {
57
57
  setSize(value);
58
- dispatchLiveChanges(value);
59
58
  }
60
59
  (0, react_1.useEffect)(() => {
61
60
  if (livePreview && size) {
62
61
  dispatchLiveChanges(size);
63
62
  }
64
63
  // eslint-disable-next-line react-hooks/exhaustive-deps
65
- }, []);
66
- function checkChangeHandler(event) {
67
- const checked = event.target.checked;
68
- setLivePreview(checked);
69
- }
70
- return ((0, jsx_runtime_1.jsxs)(HeaderContainer_1.HeaderContainer, { children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "Size: ", style: Header_1.headerLabelStyle, children: (0, jsx_runtime_1.jsx)(Select_1.default, { items: Sizes, style: { marginLeft: 10, marginRight: 10 }, value: size, onChange: handleChangeSizeHandler }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Live preview ", htmlFor: "livePreview", style: Header_1.headerLabelStyle, children: (0, jsx_runtime_1.jsx)(CheckBox_1.default, { name: "livePreview", defaultChecked: true, onChange: checkChangeHandler }) }), (0, jsx_runtime_1.jsx)(ActionButtons_1.default, { onDone: handleApplyFilter, onCancel: handleCancelFilter })] }));
64
+ }, [size, livePreview]);
65
+ return ((0, jsx_runtime_1.jsxs)(HeaderContainer_1.HeaderContainer, { children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "Size: ", style: Header_1.headerLabelStyle, children: (0, jsx_runtime_1.jsx)(Select_1.default, { items: Sizes, style: { marginLeft: 10, marginRight: 10 }, value: size, onChange: handleChangeSizeHandler }) }), (0, jsx_runtime_1.jsx)(ui_1.Checkbox, { label: "Live preview", checked: livePreview, onChange: setLivePreview }), (0, jsx_runtime_1.jsx)(ActionButtons_1.default, { onDone: handleApplyFilter, onCancel: handleCancelFilter })] }));
71
66
  }
72
67
  const MemoizedZeroFillingOptionsPanel = (0, react_1.memo)(ZeroFillingOptionsInnerPanel);
73
68
  function ZeroFillingOptionsPanel() {
@@ -16,7 +16,7 @@ function useCheckToolsVisibility() {
16
16
  const spectrum = (0, useSpectrum_1.default)(null);
17
17
  return (0, react_1.useCallback)((toolKey, checkOptions = {}) => {
18
18
  const { checkMode = true, checkSpectrumType = true, extraInfoCheckParameters, } = checkOptions;
19
- let flag = (0, get_1.default)(preferences.current, `display.toolBarButtons.${toolKey}`, false);
19
+ const flag = (0, get_1.default)(preferences.current, `display.toolBarButtons.${toolKey}`, false);
20
20
  const { spectraOptions, mode } = ToolTypes_1.options[toolKey];
21
21
  const modeFlag = !checkMode || (checkMode && (!mode || displayerMode === mode));
22
22
  const spectrumCheckFlag = !checkSpectrumType ||
@@ -38,7 +38,7 @@ function checkSpectrum(spectrum, options) {
38
38
  let innerConditionFlag = true;
39
39
  if (option.active) {
40
40
  if (spectrum) {
41
- for (let { key, value } of option.info || []) {
41
+ for (const { key, value } of option.info || []) {
42
42
  if (spectrum.info[key] !== value) {
43
43
  innerConditionFlag = false;
44
44
  }
@@ -46,7 +46,8 @@ function useExport() {
46
46
  setTimeout(() => {
47
47
  void handle();
48
48
  }, 0);
49
- });
49
+ })
50
+ .catch(reportError);
50
51
  }, [alert, preferencesState, state]);
51
52
  const saveAsSVGHandler = (0, react_1.useCallback)(async () => {
52
53
  if (state.data.length > 0 && rootRef) {
@@ -28,7 +28,7 @@ function getDefaultPreferences(panelKey, nucleus) {
28
28
  case 'multipleSpectraAnalysis':
29
29
  return (0, panelsPreferencesDefaultValues_1.getMultipleSpectraAnalysisDefaultValues)(nucleus);
30
30
  case 'prediction':
31
- return PredictionManager_1.defaultPredictionOptions;
31
+ return (0, PredictionManager_1.getDefaultPredictionOptions)();
32
32
  default:
33
33
  return {};
34
34
  }