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
@@ -20,9 +20,9 @@ function prepare1DData(data) {
20
20
  return array;
21
21
  }
22
22
  function prepare2DData(data) {
23
- let cols = data.z[0].length;
24
- let rows = data.z.length;
25
- let jump = Math.floor((cols * rows) / 204800) || 1;
23
+ const cols = data.z[0].length;
24
+ const rows = data.z.length;
25
+ const jump = Math.floor((cols * rows) / 204800) || 1;
26
26
  const array = new Float64Array(((cols * rows) / jump) >> 0);
27
27
  let index = 0;
28
28
  for (let r = 0; r < rows; r += 1) {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  function generateNumbersPowerOfX(start, end, options) {
4
4
  const { power = 2, format = formatNumber } = options || {};
5
- let values = [];
5
+ const values = [];
6
6
  for (let i = start; i <= end; i++) {
7
7
  const result = power ** i;
8
8
  values.push({
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.newClipboardItem = exports.write = exports.writeText = exports.read = exports.readText = void 0;
4
+ function readText() {
5
+ return import('clipboard-polyfill').then((c) => c.readText());
6
+ }
7
+ exports.readText = readText;
8
+ function read() {
9
+ return import('clipboard-polyfill').then((c) => c.read());
10
+ }
11
+ exports.read = read;
12
+ function writeText(data) {
13
+ return import('clipboard-polyfill').then((c) => c.writeText(data));
14
+ }
15
+ exports.writeText = writeText;
16
+ function write(data) {
17
+ return import('clipboard-polyfill').then((c) => c.write(data));
18
+ }
19
+ exports.write = write;
20
+ function newClipboardItem(items, options) {
21
+ return import('clipboard-polyfill').then((c) => new c.ClipboardItem(items, options));
22
+ }
23
+ exports.newClipboardItem = newClipboardItem;
@@ -0,0 +1,158 @@
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
+ exports.ClipboardFallbackModal = exports.ClipboardFallback = void 0;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const styled_1 = __importDefault(require("@emotion/styled"));
9
+ const react_1 = require("react");
10
+ const ui_1 = require("react-science/ui");
11
+ const Button_1 = __importDefault(require("../../component/elements/Button"));
12
+ const ClipboardForm = styled_1.default.form `
13
+ padding: 0.5rem;
14
+
15
+ & > label {
16
+ display: flex;
17
+ flex-direction: column;
18
+ gap: 0.5rem;
19
+ }
20
+
21
+ textarea {
22
+ padding: 0.5rem;
23
+ }
24
+ `;
25
+ const Actions = styled_1.default.div `
26
+ display: flex;
27
+ gap: 0.5rem;
28
+ justify-content: flex-end;
29
+ `;
30
+ function throwError(props, prop) {
31
+ throw new Error(`props.${prop} is mandatory with ${String(props.mode)} mode`);
32
+ }
33
+ function assertReadProps(props) {
34
+ if (typeof props.onRead !== 'function')
35
+ throwError(props, 'onRead');
36
+ }
37
+ function assertReadTextProps(props) {
38
+ if (typeof props.onReadText !== 'function')
39
+ throwError(props, 'onReadText');
40
+ }
41
+ function assertWriteProps(props) {
42
+ if (!props.file)
43
+ throwError(props, 'file');
44
+ if (typeof props.onDismiss !== 'function')
45
+ throwError(props, 'onDismiss');
46
+ }
47
+ function assertWriteTextProps(props) {
48
+ if (typeof props.text !== 'string')
49
+ throwError(props, 'text');
50
+ if (typeof props.onDismiss !== 'function')
51
+ throwError(props, 'onDismiss');
52
+ }
53
+ /**
54
+ * switch between ClipboardFallback variant over mode props
55
+ * mode === read => ClipboardFallbackReadProps
56
+ * mode === readText => ClipboardFallbackReadTextProps
57
+ * mode === write => ClipboardFallbackWriteProps
58
+ * mode === writeText => ClipboardFallbackWriteTextProps
59
+ *
60
+ * implement what you need in function what part of the clipboard api from useClipboard you use
61
+ * props will be checked at runtime
62
+ *
63
+ * @param props
64
+ */
65
+ function ClipboardFallback(props) {
66
+ switch (props.mode) {
67
+ case 'read':
68
+ assertReadProps(props);
69
+ return (0, jsx_runtime_1.jsx)(ClipboardFallbackRead, { ...props });
70
+ case 'readText':
71
+ assertReadTextProps(props);
72
+ return (0, jsx_runtime_1.jsx)(ClipboardFallbackReadText, { ...props });
73
+ case 'write': {
74
+ assertWriteProps(props);
75
+ return (0, jsx_runtime_1.jsx)(ClipboardFallbackWrite, { ...props });
76
+ }
77
+ case 'writeText':
78
+ assertWriteTextProps(props);
79
+ return (0, jsx_runtime_1.jsx)(ClipboardFallbackWriteText, { ...props });
80
+ default:
81
+ return null;
82
+ }
83
+ }
84
+ exports.ClipboardFallback = ClipboardFallback;
85
+ /**
86
+ * return null if !props.mode
87
+ *
88
+ * @param props
89
+ * @see ClipboardFallback
90
+ */
91
+ function ClipboardFallbackModal(props) {
92
+ if (!props.mode)
93
+ return null;
94
+ const titles = {
95
+ read: `Import data from file`,
96
+ readText: `Paste text from clipboard`,
97
+ write: `Export data to file`,
98
+ writeText: `Copy text from text area`,
99
+ };
100
+ return ((0, jsx_runtime_1.jsxs)(ui_1.Modal, { hasCloseButton: true, isOpen: true, onRequestClose: props.onDismiss, children: [(0, jsx_runtime_1.jsx)(ui_1.Modal.Header, { children: (0, jsx_runtime_1.jsx)("h2", { children: titles[props.mode] }) }), (0, jsx_runtime_1.jsx)(ui_1.Modal.Body, { children: (0, jsx_runtime_1.jsx)(ClipboardFallback, { ...props }) })] }));
101
+ }
102
+ exports.ClipboardFallbackModal = ClipboardFallbackModal;
103
+ function ClipboardFallbackRead(props) {
104
+ const onFileRef = (0, react_1.useRef)(props.onRead);
105
+ onFileRef.current = props.onRead;
106
+ const onSubmit = (0, react_1.useCallback)((event) => {
107
+ event.preventDefault();
108
+ const data = new FormData(event.currentTarget);
109
+ const file = data.get('file');
110
+ if (!(file instanceof File))
111
+ return;
112
+ onFileRef.current(file);
113
+ }, []);
114
+ if (props.mode !== 'read')
115
+ return null;
116
+ return ((0, jsx_runtime_1.jsxs)(ClipboardForm, { onSubmit: onSubmit, children: [(0, jsx_runtime_1.jsxs)("label", { children: [(0, jsx_runtime_1.jsx)("span", { children: props.label ?? 'File' }), (0, jsx_runtime_1.jsx)("input", { name: "file", type: "file" })] }), (0, jsx_runtime_1.jsx)("p", { children: "We were not able to read from your clipboard. Please input your data in the file field" }), (0, jsx_runtime_1.jsxs)(Actions, { children: [(0, jsx_runtime_1.jsx)(Button_1.default.Done, { type: "submit", children: "Submit" }), (0, jsx_runtime_1.jsx)(Button_1.default.Secondary, { type: "reset", onClick: props.onDismiss, children: "Cancel" })] })] }));
117
+ }
118
+ function ClipboardFallbackReadText(props) {
119
+ const onTextRef = (0, react_1.useRef)(props.onReadText);
120
+ onTextRef.current = props.onReadText;
121
+ const onSubmit = (0, react_1.useCallback)((event) => {
122
+ event.preventDefault();
123
+ const data = new FormData(event.currentTarget);
124
+ const text = data.get('text');
125
+ if (typeof text !== 'string')
126
+ return;
127
+ onTextRef.current(text);
128
+ }, []);
129
+ if (props.mode !== 'readText')
130
+ return null;
131
+ return ((0, jsx_runtime_1.jsxs)(ClipboardForm, { onSubmit: onSubmit, children: [(0, jsx_runtime_1.jsxs)("label", { children: [(0, jsx_runtime_1.jsx)("span", { children: props.label ?? 'Text' }), (0, jsx_runtime_1.jsx)("textarea", { name: "text", cols: 50, rows: 10 })] }), (0, jsx_runtime_1.jsx)("p", { children: "We were not able to read text from your clipboard. Please paste your data in the text area." }), (0, jsx_runtime_1.jsxs)(Actions, { children: [(0, jsx_runtime_1.jsx)(Button_1.default.Done, { type: "submit", children: "Submit" }), (0, jsx_runtime_1.jsx)(Button_1.default.Secondary, { type: "reset", onClick: props.onDismiss, children: "Cancel" })] })] }));
132
+ }
133
+ function ClipboardFallbackWrite(props) {
134
+ const onDismissRef = (0, react_1.useRef)(props.onDismiss);
135
+ onDismissRef.current = props.onDismiss;
136
+ const onSubmit = (0, react_1.useCallback)((event) => {
137
+ event.preventDefault();
138
+ onDismissRef.current();
139
+ }, []);
140
+ const downloadLink = (0, react_1.useMemo)(() => URL.createObjectURL(props.file), [props.file]);
141
+ (0, react_1.useEffect)(() => {
142
+ return () => URL.revokeObjectURL(downloadLink);
143
+ }, [downloadLink]);
144
+ if (props.mode !== 'write')
145
+ return null;
146
+ return ((0, jsx_runtime_1.jsxs)(ClipboardForm, { onSubmit: onSubmit, children: [(0, jsx_runtime_1.jsx)("p", { children: props.label ?? 'Download' }), (0, jsx_runtime_1.jsx)("a", { href: downloadLink, download: props.file.name, children: "We were not able to write data to your clipboard. Please download your data with this link." }), (0, jsx_runtime_1.jsx)(Actions, { children: (0, jsx_runtime_1.jsx)(Button_1.default.Secondary, { type: "submit", children: "Dismiss" }) })] }));
147
+ }
148
+ function ClipboardFallbackWriteText(props) {
149
+ const onDismissRef = (0, react_1.useRef)(props.onDismiss);
150
+ onDismissRef.current = props.onDismiss;
151
+ const onSubmit = (0, react_1.useCallback)((event) => {
152
+ event.preventDefault();
153
+ onDismissRef.current();
154
+ }, []);
155
+ if (props.mode !== 'writeText')
156
+ return null;
157
+ return ((0, jsx_runtime_1.jsxs)(ClipboardForm, { onSubmit: onSubmit, children: [(0, jsx_runtime_1.jsx)("span", { children: props.label ?? 'Text' }), (0, jsx_runtime_1.jsx)("textarea", { name: "text", cols: 30, rows: 10, ref: (node) => node?.select(), children: props.text }), (0, jsx_runtime_1.jsx)("p", { children: "We were not able to write text to your clipboard. Please copy your data in the text area." }), (0, jsx_runtime_1.jsx)(Actions, { children: (0, jsx_runtime_1.jsx)(Button_1.default.Secondary, { type: "submit", children: "Dismiss" }) })] }));
158
+ }
@@ -0,0 +1,147 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useClipboard = exports.useNavigatorPermission = void 0;
4
+ const react_1 = require("react");
5
+ const clipboard_1 = require("./clipboard");
6
+ function useNavigatorPermission(now, permissionName, onGranted, onError = reportError) {
7
+ const [state, setState] = (0, react_1.useState)();
8
+ (0, react_1.useEffect)(() => {
9
+ if (!now)
10
+ return;
11
+ let canceled = false;
12
+ let status;
13
+ function onPermissionChange() {
14
+ if (canceled)
15
+ return;
16
+ setState(status.state);
17
+ if (status.state === 'granted') {
18
+ onGranted?.();
19
+ }
20
+ }
21
+ void navigator.permissions
22
+ .query({ name: permissionName })
23
+ .then((pStatus) => {
24
+ if (canceled)
25
+ return;
26
+ status = pStatus;
27
+ setState(status.state);
28
+ status.addEventListener('change', onPermissionChange);
29
+ })
30
+ .catch((error) => {
31
+ if (canceled)
32
+ return;
33
+ onError(error);
34
+ });
35
+ return () => {
36
+ canceled = true;
37
+ if (status) {
38
+ status.removeEventListener('change', onPermissionChange);
39
+ }
40
+ };
41
+ }, [now, permissionName, onGranted, onError]);
42
+ return { state, isGranted: state === 'granted' };
43
+ }
44
+ exports.useNavigatorPermission = useNavigatorPermission;
45
+ /**
46
+ * Give you a wrapped clipboard api and a shouldFallback state.
47
+ * ignore if read and readText return promise filled with undefined, and rely on shouldFallback to display an alternative interaction.
48
+ * You should use ClipboardFallback component
49
+ *
50
+ * @example
51
+ * ```tsx
52
+ * const { readText, shouldFallback, setShouldFallback } = useClipboard();
53
+ *
54
+ * function handlePasteAction() {
55
+ * // yes you can safely ignore error here,
56
+ * // readText() will never throw, error is caught and set shouldFallback to corresponding mode
57
+ * void readText().then(handlePaste);
58
+ * }
59
+ *
60
+ * function handlePaste(text: string | undefined) {
61
+ * if (!text) return;
62
+ *
63
+ * setState(text);
64
+ * setShouldFallback(null);
65
+ * }
66
+ *
67
+ * return (
68
+ * <>
69
+ * <button onClick={handlePasteAction}>Paste</button>
70
+ * <ClipboardFallbackModal
71
+ * mode={shouldFallback}
72
+ * onDismiss={() => setShouldFallback(null)}
73
+ * onReadText={handlePaste}
74
+ * />
75
+ * </>
76
+ * )
77
+ * ```
78
+ */
79
+ function useClipboard() {
80
+ const [shouldFallback, setShouldFallback] = (0, react_1.useState)();
81
+ const [text, setText] = (0, react_1.useState)();
82
+ const [blobs, setBlobs] = (0, react_1.useState)();
83
+ const cleanShouldFallback = (0, react_1.useCallback)(() => {
84
+ setShouldFallback(undefined);
85
+ setText(undefined);
86
+ setBlobs(undefined);
87
+ }, []);
88
+ const clipboardAPI = (0, react_1.useMemo)(() => ({
89
+ async read() {
90
+ try {
91
+ return await (0, clipboard_1.read)();
92
+ }
93
+ catch {
94
+ setShouldFallback('read');
95
+ }
96
+ },
97
+ async readText() {
98
+ try {
99
+ return await (0, clipboard_1.readText)();
100
+ }
101
+ catch {
102
+ setShouldFallback('readText');
103
+ }
104
+ },
105
+ async write(data) {
106
+ try {
107
+ return await (0, clipboard_1.write)(data);
108
+ }
109
+ catch {
110
+ const blobs = await Promise.all(data.map((ci) => ci.getType(ci.types[0])));
111
+ setBlobs(blobs);
112
+ setShouldFallback('write');
113
+ }
114
+ },
115
+ async rawWriteWithType(data, type = 'text/plain') {
116
+ try {
117
+ const item = await (0, clipboard_1.newClipboardItem)({
118
+ [type]: new Promise((resolve) => {
119
+ resolve(new Blob([data], { type }));
120
+ }),
121
+ });
122
+ return await (0, clipboard_1.write)([item]);
123
+ }
124
+ catch {
125
+ setText(data);
126
+ setShouldFallback('writeText');
127
+ }
128
+ },
129
+ async writeText(data) {
130
+ try {
131
+ return await (0, clipboard_1.writeText)(data);
132
+ }
133
+ catch {
134
+ setText(data);
135
+ setShouldFallback('writeText');
136
+ }
137
+ },
138
+ }), []);
139
+ return {
140
+ ...clipboardAPI,
141
+ shouldFallback,
142
+ text,
143
+ blobs,
144
+ cleanShouldFallback,
145
+ };
146
+ }
147
+ exports.useClipboard = useClipboard;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = { version: 'v0.39.0' };
3
+ exports.default = { version: 'v0.41.0' };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nmrium",
3
3
  "description": "React component to display and process nuclear magnetic resonance (NMR) spectra.",
4
- "version": "0.39.0",
4
+ "version": "0.41.0",
5
5
  "license": "MIT",
6
6
  "main": "lib-cjs/component/NMRium.js",
7
7
  "module": "lib/component/NMRium.js",
@@ -27,14 +27,14 @@
27
27
  "install:clean": "rm -rf node_modules/ && rm -rf package-lock.json && npm install && npm start",
28
28
  "prepack": "npm run clean-lib && npm run compile",
29
29
  "prepublishOnly": "npm run set-version-npm",
30
- "prettier": "prettier --check src",
31
- "prettier-write": "prettier --write src",
30
+ "prettier": "prettier --check src test-e2e",
31
+ "prettier-write": "prettier --write src test-e2e",
32
32
  "set-version-npm": "VERSION=$(jq .version package.json | tr -d '\"') && echo \"export default { version: 'v$VERSION' };\" > src/versionInfo.ts",
33
33
  "set-version-sha": "SHA=$(git rev-parse HEAD) && echo \"export default { version: 'git-$SHA' };\" > src/versionInfo.ts",
34
34
  "start": "npm run dev",
35
35
  "stylelint": "stylelint \"**/*.{css,tsx}\"",
36
36
  "stylelint-fix": "npm run stylelint -- --fix",
37
- "test": "npm run test-only && npm run build-no-minify && npm run test-e2e && npm run eslint && npm run prettier && npm run check-types",
37
+ "test": "npm run test-only && npm run eslint && npm run prettier && npm run check-types && npm run stylelint && npm run build-no-minify && npm run test-e2e",
38
38
  "test-only": "vitest run --coverage",
39
39
  "test-e2e": "playwright test --project chromium",
40
40
  "test-e2e-server": "serve -l tcp://localhost:3000 build"
@@ -81,16 +81,17 @@
81
81
  "ml-baseline-correction-regression": "^1.0.2",
82
82
  "ml-conrec": "^5.0.2",
83
83
  "ml-gsd": "^12.1.3",
84
+ "ml-matrix": "^6.10.4",
84
85
  "ml-spectra-processing": "^12.5.0",
85
86
  "ml-stat": "^1.3.3",
86
- "multiplet-analysis": "^2.1.1",
87
+ "multiplet-analysis": "^2.1.2",
87
88
  "nmr-correlation": "^2.3.3",
88
- "nmr-load-save": "^0.13.2",
89
- "nmr-processing": "^9.7.3",
89
+ "nmr-load-save": "^0.14.1",
90
+ "nmr-processing": "^9.7.8",
90
91
  "nmredata": "^0.9.2",
91
92
  "numeral": "^2.0.6",
92
93
  "openchemlib": "^8.3.0",
93
- "openchemlib-utils": "^2.4.0",
94
+ "openchemlib-utils": "^2.7.1",
94
95
  "papaparse": "^5.4.1",
95
96
  "re-resizable": "^6.9.9",
96
97
  "react-d3-utils": "^1.0.0",
@@ -103,7 +104,7 @@
103
104
  "react-ocl-nmr": "^2.0.0",
104
105
  "react-plot": "^1.4.2",
105
106
  "react-rnd": "^10.4.1",
106
- "react-science": "^0.24.2",
107
+ "react-science": "^0.24.3",
107
108
  "react-slider": "^2.0.6",
108
109
  "react-table": "^7.8.0",
109
110
  "react-transition-group": "^4.4.5",
@@ -115,35 +116,35 @@
115
116
  "@babel/plugin-transform-modules-commonjs": "^7.22.5",
116
117
  "@babel/preset-react": "^7.22.5",
117
118
  "@babel/preset-typescript": "^7.22.5",
118
- "@playwright/test": "^1.35.1",
119
+ "@playwright/test": "^1.36.1",
119
120
  "@simbathesailor/use-what-changed": "^2.0.0",
120
121
  "@types/d3": "^7.4.0",
121
- "@types/node": "^20.3.2",
122
+ "@types/node": "^20.4.2",
122
123
  "@types/papaparse": "^5.3.7",
123
- "@types/react": "^18.2.14",
124
- "@types/react-dom": "^18.2.6",
124
+ "@types/react": "^18.2.15",
125
+ "@types/react-dom": "^18.2.7",
125
126
  "@types/react-table": "^7.7.14",
126
127
  "@vitejs/plugin-react-swc": "^3.3.2",
127
- "@vitest/coverage-v8": "^0.32.2",
128
+ "@vitest/coverage-v8": "^0.33.0",
128
129
  "cross-env": "^7.0.3",
129
- "cspell": "^6.31.1",
130
- "eslint": "^8.43.0",
131
- "eslint-config-cheminfo-react": "^9.1.1",
132
- "eslint-config-cheminfo-typescript": "^11.3.1",
130
+ "cspell": "^6.31.2",
131
+ "eslint": "^8.45.0",
132
+ "eslint-config-cheminfo-react": "^10.0.0",
133
+ "eslint-config-cheminfo-typescript": "^12.0.3",
133
134
  "modern-normalize": "^2.0.0",
134
135
  "postcss-styled-syntax": "^0.4.0",
135
- "prettier": "^2.8.8",
136
- "rc-menu": "^9.10.0",
136
+ "prettier": "^3.0.0",
137
+ "rc-menu": "^9.11.0",
137
138
  "react": "^18.2.0",
138
139
  "react-dom": "^18.2.0",
139
- "react-router-dom": "^6.14.0",
140
+ "react-router-dom": "^6.14.2",
140
141
  "rimraf": "^5.0.1",
141
142
  "rollup-plugin-analyzer": "^4.0.0",
142
143
  "serve": "^14.2.0",
143
- "stylelint": "^15.9.0",
144
- "stylelint-config-standard": "^33.0.0",
144
+ "stylelint": "^15.10.2",
145
+ "stylelint-config-standard": "^34.0.0",
145
146
  "typescript": "~5.1.6",
146
- "vite": "^4.3.9",
147
- "vitest": "^0.32.2"
147
+ "vite": "^4.4.4",
148
+ "vitest": "^0.33.0"
148
149
  }
149
150
  }
@@ -1 +0,0 @@
1
- export declare function LogsHistory(): import("react/jsx-runtime").JSX.Element;