nmrium 1.12.0 → 2.0.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 (309) hide show
  1. package/lib/component/1d/database/DatabaseSpectrum.d.ts.map +1 -1
  2. package/lib/component/1d/database/DatabaseSpectrum.js +1 -1
  3. package/lib/component/1d/database/DatabaseSpectrum.js.map +1 -1
  4. package/lib/component/1d-2d/components/SpectrumInfoBlock.d.ts.map +1 -1
  5. package/lib/component/1d-2d/components/SpectrumInfoBlock.js +3 -17
  6. package/lib/component/1d-2d/components/SpectrumInfoBlock.js.map +1 -1
  7. package/lib/component/2d/ft/Contours.d.ts.map +1 -1
  8. package/lib/component/2d/ft/Contours.js +10 -12
  9. package/lib/component/2d/ft/Contours.js.map +1 -1
  10. package/lib/component/elements/ActionsButtonsPopover.js +1 -1
  11. package/lib/component/elements/ActionsButtonsPopover.js.map +1 -1
  12. package/lib/component/hooks/reduce2DSpectrum.d.ts +4 -0
  13. package/lib/component/hooks/reduce2DSpectrum.d.ts.map +1 -0
  14. package/lib/component/hooks/reduce2DSpectrum.js +60 -0
  15. package/lib/component/hooks/reduce2DSpectrum.js.map +1 -0
  16. package/lib/component/hooks/use2DReducer.d.ts +14 -0
  17. package/lib/component/hooks/use2DReducer.d.ts.map +1 -0
  18. package/lib/component/hooks/use2DReducer.js +30 -0
  19. package/lib/component/hooks/use2DReducer.js.map +1 -0
  20. package/lib/component/hooks/useCreateNmriumZip.d.ts +3 -0
  21. package/lib/component/hooks/useCreateNmriumZip.d.ts.map +1 -0
  22. package/lib/component/hooks/useCreateNmriumZip.js +28 -0
  23. package/lib/component/hooks/useCreateNmriumZip.js.map +1 -0
  24. package/lib/component/hooks/useExport.d.ts +8 -5
  25. package/lib/component/hooks/useExport.d.ts.map +1 -1
  26. package/lib/component/hooks/useExport.js +4 -21
  27. package/lib/component/hooks/useExport.js.map +1 -1
  28. package/lib/component/loader/useLoadFiles.d.ts.map +1 -1
  29. package/lib/component/loader/useLoadFiles.js +4 -5
  30. package/lib/component/loader/useLoadFiles.js.map +1 -1
  31. package/lib/component/main/InnerNMRium.d.ts.map +1 -1
  32. package/lib/component/main/InnerNMRium.js +2 -2
  33. package/lib/component/main/InnerNMRium.js.map +1 -1
  34. package/lib/component/main/NMRium.d.ts +48 -3
  35. package/lib/component/main/NMRium.d.ts.map +1 -1
  36. package/lib/component/main/NMRium.js.map +1 -1
  37. package/lib/component/main/NMRiumRefAPI.d.ts +2 -0
  38. package/lib/component/main/NMRiumRefAPI.d.ts.map +1 -1
  39. package/lib/component/main/NMRiumRefAPI.js +4 -1
  40. package/lib/component/main/NMRiumRefAPI.js.map +1 -1
  41. package/lib/component/main/NMRiumStateProvider.d.ts +5 -2
  42. package/lib/component/main/NMRiumStateProvider.d.ts.map +1 -1
  43. package/lib/component/main/NMRiumStateProvider.js +36 -30
  44. package/lib/component/main/NMRiumStateProvider.js.map +1 -1
  45. package/lib/component/modal/LoadJCAMPModal.js +4 -4
  46. package/lib/component/modal/LoadJCAMPModal.js.map +1 -1
  47. package/lib/component/modal/setting/general_settings.d.ts.map +1 -1
  48. package/lib/component/modal/setting/general_settings.js +3 -3
  49. package/lib/component/modal/setting/general_settings.js.map +1 -1
  50. package/lib/component/modal/setting/tanstack_general_settings/general_settings.d.ts +4 -2
  51. package/lib/component/modal/setting/tanstack_general_settings/general_settings.d.ts.map +1 -1
  52. package/lib/component/modal/setting/tanstack_general_settings/general_settings.js +46 -29
  53. package/lib/component/modal/setting/tanstack_general_settings/general_settings.js.map +1 -1
  54. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_body.d.ts +920 -188
  55. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_body.d.ts.map +1 -1
  56. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_body.js +10 -2
  57. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_body.js.map +1 -1
  58. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_footer.d.ts +920 -188
  59. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_footer.d.ts.map +1 -1
  60. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header.d.ts +1353 -6
  61. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header.d.ts.map +1 -1
  62. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header.js +43 -32
  63. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header.js.map +1 -1
  64. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header_actions_buttons.d.ts +1353 -6
  65. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header_actions_buttons.d.ts.map +1 -1
  66. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header_actions_buttons.js +88 -83
  67. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header_actions_buttons.js.map +1 -1
  68. package/lib/component/modal/setting/tanstack_general_settings/hooks/use_safe_workspace.d.ts +466 -0
  69. package/lib/component/modal/setting/tanstack_general_settings/hooks/use_safe_workspace.d.ts.map +1 -0
  70. package/lib/component/modal/setting/tanstack_general_settings/hooks/use_safe_workspace.js +59 -0
  71. package/lib/component/modal/setting/tanstack_general_settings/hooks/use_safe_workspace.js.map +1 -0
  72. package/lib/component/modal/setting/tanstack_general_settings/tabs/auto_processing_tab.d.ts +1354 -0
  73. package/lib/component/modal/setting/tanstack_general_settings/tabs/auto_processing_tab.d.ts.map +1 -0
  74. package/lib/component/modal/setting/tanstack_general_settings/tabs/auto_processing_tab.js +32 -0
  75. package/lib/component/modal/setting/tanstack_general_settings/tabs/auto_processing_tab.js.map +1 -0
  76. package/lib/component/modal/setting/tanstack_general_settings/tabs/database_tab.d.ts +1354 -0
  77. package/lib/component/modal/setting/tanstack_general_settings/tabs/database_tab.d.ts.map +1 -0
  78. package/lib/component/modal/setting/tanstack_general_settings/tabs/database_tab.js +80 -0
  79. package/lib/component/modal/setting/tanstack_general_settings/tabs/database_tab.js.map +1 -0
  80. package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.d.ts +920 -188
  81. package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.d.ts.map +1 -1
  82. package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.fields.d.ts.map +1 -1
  83. package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.fields.js +37 -9
  84. package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.fields.js.map +1 -1
  85. package/lib/component/modal/setting/tanstack_general_settings/tabs/external_api_tab.d.ts +1354 -0
  86. package/lib/component/modal/setting/tanstack_general_settings/tabs/external_api_tab.d.ts.map +1 -0
  87. package/lib/component/modal/setting/tanstack_general_settings/tabs/external_api_tab.js +58 -0
  88. package/lib/component/modal/setting/tanstack_general_settings/tabs/external_api_tab.js.map +1 -0
  89. package/lib/component/modal/setting/tanstack_general_settings/tabs/general_tab.d.ts +920 -188
  90. package/lib/component/modal/setting/tanstack_general_settings/tabs/general_tab.d.ts.map +1 -1
  91. package/lib/component/modal/setting/tanstack_general_settings/tabs/general_tab.js +1 -1
  92. package/lib/component/modal/setting/tanstack_general_settings/tabs/general_tab.js.map +1 -1
  93. package/lib/component/modal/setting/tanstack_general_settings/tabs/import_filters_tab.d.ts +920 -188
  94. package/lib/component/modal/setting/tanstack_general_settings/tabs/import_filters_tab.d.ts.map +1 -1
  95. package/lib/component/modal/setting/tanstack_general_settings/tabs/nuclei_tab.d.ts +920 -188
  96. package/lib/component/modal/setting/tanstack_general_settings/tabs/nuclei_tab.d.ts.map +1 -1
  97. package/lib/component/modal/setting/tanstack_general_settings/tabs/nuclei_tab.js +65 -112
  98. package/lib/component/modal/setting/tanstack_general_settings/tabs/nuclei_tab.js.map +1 -1
  99. package/lib/component/modal/setting/tanstack_general_settings/tabs/panels_tab.d.ts +920 -188
  100. package/lib/component/modal/setting/tanstack_general_settings/tabs/panels_tab.d.ts.map +1 -1
  101. package/lib/component/modal/setting/tanstack_general_settings/tabs/panels_tab.js +3 -3
  102. package/lib/component/modal/setting/tanstack_general_settings/tabs/panels_tab.js.map +1 -1
  103. package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_colors_tab.d.ts +1354 -0
  104. package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_colors_tab.d.ts.map +1 -0
  105. package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_colors_tab.js +142 -0
  106. package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_colors_tab.js.map +1 -0
  107. package/lib/component/modal/setting/tanstack_general_settings/tabs/title_block_tab.d.ts +1354 -0
  108. package/lib/component/modal/setting/tanstack_general_settings/tabs/title_block_tab.d.ts.map +1 -0
  109. package/lib/component/modal/setting/tanstack_general_settings/tabs/title_block_tab.js +112 -0
  110. package/lib/component/modal/setting/tanstack_general_settings/tabs/title_block_tab.js.map +1 -0
  111. package/lib/component/modal/setting/tanstack_general_settings/tabs/tools_tab.d.ts +1354 -0
  112. package/lib/component/modal/setting/tanstack_general_settings/tabs/tools_tab.d.ts.map +1 -0
  113. package/lib/component/modal/setting/tanstack_general_settings/tabs/tools_tab.js +38 -0
  114. package/lib/component/modal/setting/tanstack_general_settings/tabs/tools_tab.js.map +1 -0
  115. package/lib/component/modal/setting/tanstack_general_settings/ui/table.d.ts +68 -0
  116. package/lib/component/modal/setting/tanstack_general_settings/ui/table.d.ts.map +1 -0
  117. package/lib/component/modal/setting/tanstack_general_settings/ui/table.js +133 -0
  118. package/lib/component/modal/setting/tanstack_general_settings/ui/table.js.map +1 -0
  119. package/lib/component/modal/setting/tanstack_general_settings/ui/table_section.d.ts +10 -0
  120. package/lib/component/modal/setting/tanstack_general_settings/ui/table_section.d.ts.map +1 -0
  121. package/lib/component/modal/setting/tanstack_general_settings/ui/table_section.js +31 -0
  122. package/lib/component/modal/setting/tanstack_general_settings/ui/table_section.js.map +1 -0
  123. package/lib/component/modal/setting/tanstack_general_settings/validation/auto_processing_tab_validation.d.ts +71 -0
  124. package/lib/component/modal/setting/tanstack_general_settings/validation/auto_processing_tab_validation.d.ts.map +1 -0
  125. package/lib/component/modal/setting/tanstack_general_settings/validation/auto_processing_tab_validation.js +67 -0
  126. package/lib/component/modal/setting/tanstack_general_settings/validation/auto_processing_tab_validation.js.map +1 -0
  127. package/lib/component/modal/setting/tanstack_general_settings/{utils/checkUniqueByKey.d.ts → validation/check_unique_by_key.d.ts} +1 -1
  128. package/lib/component/modal/setting/tanstack_general_settings/validation/check_unique_by_key.d.ts.map +1 -0
  129. package/lib/component/modal/setting/tanstack_general_settings/{utils/checkUniqueByKey.js → validation/check_unique_by_key.js} +1 -1
  130. package/lib/component/modal/setting/tanstack_general_settings/validation/check_unique_by_key.js.map +1 -0
  131. package/lib/component/modal/setting/tanstack_general_settings/validation/database_tab_validation.d.ts +11 -0
  132. package/lib/component/modal/setting/tanstack_general_settings/validation/database_tab_validation.d.ts.map +1 -0
  133. package/lib/component/modal/setting/tanstack_general_settings/validation/database_tab_validation.js +20 -0
  134. package/lib/component/modal/setting/tanstack_general_settings/validation/database_tab_validation.js.map +1 -0
  135. package/lib/component/modal/setting/tanstack_general_settings/validation/external_apis_validation.d.ts +32 -0
  136. package/lib/component/modal/setting/tanstack_general_settings/validation/external_apis_validation.d.ts.map +1 -0
  137. package/lib/component/modal/setting/tanstack_general_settings/validation/external_apis_validation.js +11 -0
  138. package/lib/component/modal/setting/tanstack_general_settings/validation/external_apis_validation.js.map +1 -0
  139. package/lib/component/modal/setting/tanstack_general_settings/validation/general_tab_validation.d.ts +2 -0
  140. package/lib/component/modal/setting/tanstack_general_settings/validation/general_tab_validation.d.ts.map +1 -1
  141. package/lib/component/modal/setting/tanstack_general_settings/validation/general_tab_validation.js +3 -6
  142. package/lib/component/modal/setting/tanstack_general_settings/validation/general_tab_validation.js.map +1 -1
  143. package/lib/component/modal/setting/tanstack_general_settings/validation/nuclei_tab_validation.d.ts +12 -4
  144. package/lib/component/modal/setting/tanstack_general_settings/validation/nuclei_tab_validation.d.ts.map +1 -1
  145. package/lib/component/modal/setting/tanstack_general_settings/validation/nuclei_tab_validation.js +4 -3
  146. package/lib/component/modal/setting/tanstack_general_settings/validation/nuclei_tab_validation.js.map +1 -1
  147. package/lib/component/modal/setting/tanstack_general_settings/validation/panels_tab_validation.d.ts +20 -0
  148. package/lib/component/modal/setting/tanstack_general_settings/validation/panels_tab_validation.d.ts.map +1 -1
  149. package/lib/component/modal/setting/tanstack_general_settings/validation/panels_tab_validation.js +12 -4
  150. package/lib/component/modal/setting/tanstack_general_settings/validation/panels_tab_validation.js.map +1 -1
  151. package/lib/component/modal/setting/tanstack_general_settings/validation/spectra_colors_tab_validation.d.ts +54 -0
  152. package/lib/component/modal/setting/tanstack_general_settings/validation/spectra_colors_tab_validation.d.ts.map +1 -0
  153. package/lib/component/modal/setting/tanstack_general_settings/validation/spectra_colors_tab_validation.js +22 -0
  154. package/lib/component/modal/setting/tanstack_general_settings/validation/spectra_colors_tab_validation.js.map +1 -0
  155. package/lib/component/modal/setting/tanstack_general_settings/validation/title_block_tab_validation.d.ts +55 -0
  156. package/lib/component/modal/setting/tanstack_general_settings/validation/title_block_tab_validation.d.ts.map +1 -0
  157. package/lib/component/modal/setting/tanstack_general_settings/validation/title_block_tab_validation.js +18 -0
  158. package/lib/component/modal/setting/tanstack_general_settings/validation/title_block_tab_validation.js.map +1 -0
  159. package/lib/component/modal/setting/tanstack_general_settings/validation/tools_tab_validation.d.ts +32 -0
  160. package/lib/component/modal/setting/tanstack_general_settings/validation/tools_tab_validation.d.ts.map +1 -0
  161. package/lib/component/modal/setting/tanstack_general_settings/validation/tools_tab_validation.js +34 -0
  162. package/lib/component/modal/setting/tanstack_general_settings/validation/tools_tab_validation.js.map +1 -0
  163. package/lib/component/modal/setting/tanstack_general_settings/validation/utils.d.ts +13 -0
  164. package/lib/component/modal/setting/tanstack_general_settings/validation/utils.d.ts.map +1 -0
  165. package/lib/component/modal/setting/tanstack_general_settings/validation/utils.js +20 -0
  166. package/lib/component/modal/setting/tanstack_general_settings/validation/utils.js.map +1 -0
  167. package/lib/component/modal/setting/tanstack_general_settings/validation.d.ts +255 -39
  168. package/lib/component/modal/setting/tanstack_general_settings/validation.d.ts.map +1 -1
  169. package/lib/component/modal/setting/tanstack_general_settings/validation.js +16 -27
  170. package/lib/component/modal/setting/tanstack_general_settings/validation.js.map +1 -1
  171. package/lib/component/panels/MoleculesPanel/MoleculeStructure.d.ts.map +1 -1
  172. package/lib/component/panels/MoleculesPanel/MoleculeStructure.js +27 -0
  173. package/lib/component/panels/MoleculesPanel/MoleculeStructure.js.map +1 -1
  174. package/lib/component/panels/SpectraPanel/base/setting/Spectrum1DSetting.d.ts.map +1 -1
  175. package/lib/component/panels/SpectraPanel/base/setting/Spectrum1DSetting.js +3 -2
  176. package/lib/component/panels/SpectraPanel/base/setting/Spectrum1DSetting.js.map +1 -1
  177. package/lib/component/panels/SpectraPanel/base/setting/Spectrum2DSetting.d.ts +2 -1
  178. package/lib/component/panels/SpectraPanel/base/setting/Spectrum2DSetting.d.ts.map +1 -1
  179. package/lib/component/panels/SpectraPanel/base/setting/Spectrum2DSetting.js +8 -3
  180. package/lib/component/panels/SpectraPanel/base/setting/Spectrum2DSetting.js.map +1 -1
  181. package/lib/component/panels/SpectraPanel/base/setting/SpectrumSetting.js +1 -1
  182. package/lib/component/panels/SpectraPanel/base/setting/SpectrumSetting.js.map +1 -1
  183. package/lib/component/panels/databasePanel/DatabasePanel.d.ts.map +1 -1
  184. package/lib/component/panels/databasePanel/DatabasePanel.js +2 -2
  185. package/lib/component/panels/databasePanel/DatabasePanel.js.map +1 -1
  186. package/lib/component/panels/filtersPanel/Filters/FiltersSectionsPanel.d.ts.map +1 -1
  187. package/lib/component/panels/filtersPanel/Filters/FiltersSectionsPanel.js +26 -33
  188. package/lib/component/panels/filtersPanel/Filters/FiltersSectionsPanel.js.map +1 -1
  189. package/lib/component/panels/filtersPanel/Filters/base/BaseApodizationOptions.js +1 -1
  190. package/lib/component/panels/filtersPanel/Filters/base/BaseApodizationOptions.js.map +1 -1
  191. package/lib/component/reducer/Reducer.d.ts.map +1 -1
  192. package/lib/component/reducer/Reducer.js +1 -3
  193. package/lib/component/reducer/Reducer.js.map +1 -1
  194. package/lib/component/reducer/actions/FiltersActions.d.ts +2 -4
  195. package/lib/component/reducer/actions/FiltersActions.d.ts.map +1 -1
  196. package/lib/component/reducer/actions/FiltersActions.js +14 -5
  197. package/lib/component/reducer/actions/FiltersActions.js.map +1 -1
  198. package/lib/component/reducer/actions/LoadAction.d.ts +1 -4
  199. package/lib/component/reducer/actions/LoadAction.d.ts.map +1 -1
  200. package/lib/component/reducer/actions/LoadAction.js +8 -17
  201. package/lib/component/reducer/actions/LoadAction.js.map +1 -1
  202. package/lib/component/reducer/actions/MoleculeActions.d.ts.map +1 -1
  203. package/lib/component/reducer/actions/MoleculeActions.js +3 -0
  204. package/lib/component/reducer/actions/MoleculeActions.js.map +1 -1
  205. package/lib/component/reducer/actions/SpectraActions.d.ts +5 -1
  206. package/lib/component/reducer/actions/SpectraActions.d.ts.map +1 -1
  207. package/lib/component/reducer/actions/SpectraActions.js +4 -2
  208. package/lib/component/reducer/actions/SpectraActions.js.map +1 -1
  209. package/lib/component/reducer/actions/ToolsActions.d.ts.map +1 -1
  210. package/lib/component/reducer/actions/ToolsActions.js +1 -1
  211. package/lib/component/reducer/actions/ToolsActions.js.map +1 -1
  212. package/lib/component/reducer/preferences/actions/applyGeneralPreferences.d.ts.map +1 -1
  213. package/lib/component/reducer/preferences/actions/applyGeneralPreferences.js.map +1 -1
  214. package/lib/component/reducer/preferences/preferencesReducer.d.ts +3 -3
  215. package/lib/component/reducer/preferences/preferencesReducer.d.ts.map +1 -1
  216. package/lib/component/reducer/preferences/preferencesReducer.js +1 -1
  217. package/lib/component/workspaces/workspaceDefaultProperties.d.ts.map +1 -1
  218. package/lib/component/workspaces/workspaceDefaultProperties.js +9 -0
  219. package/lib/component/workspaces/workspaceDefaultProperties.js.map +1 -1
  220. package/lib/data/PredictionManager.d.ts.map +1 -1
  221. package/lib/data/PredictionManager.js +3 -0
  222. package/lib/data/PredictionManager.js.map +1 -1
  223. package/lib/data/data2d/Spectrum2D/contours.d.ts +7 -6
  224. package/lib/data/data2d/Spectrum2D/contours.d.ts.map +1 -1
  225. package/lib/data/data2d/Spectrum2D/contours.js +22 -6
  226. package/lib/data/data2d/Spectrum2D/contours.js.map +1 -1
  227. package/lib/data/data2d/Spectrum2D/initiateDatum2D.d.ts.map +1 -1
  228. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +1 -10
  229. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js.map +1 -1
  230. package/lib/data/molecules/Molecule.d.ts +5 -1
  231. package/lib/data/molecules/Molecule.d.ts.map +1 -1
  232. package/lib/data/molecules/Molecule.js +9 -7
  233. package/lib/data/molecules/Molecule.js.map +1 -1
  234. package/lib/data/molecules/MoleculeManager.d.ts +0 -6
  235. package/lib/data/molecules/MoleculeManager.d.ts.map +1 -1
  236. package/lib/data/molecules/MoleculeManager.js +25 -25
  237. package/lib/data/molecules/MoleculeManager.js.map +1 -1
  238. package/lib/versionInfo.d.ts.map +1 -1
  239. package/lib/versionInfo.js +1 -1
  240. package/lib/versionInfo.js.map +1 -1
  241. package/package.json +30 -29
  242. package/src/component/1d/database/DatabaseSpectrum.tsx +3 -1
  243. package/src/component/1d-2d/components/SpectrumInfoBlock.tsx +10 -22
  244. package/src/component/2d/ft/Contours.tsx +14 -27
  245. package/src/component/elements/ActionsButtonsPopover.tsx +1 -1
  246. package/src/component/hooks/reduce2DSpectrum.ts +98 -0
  247. package/src/component/hooks/use2DReducer.tsx +56 -0
  248. package/src/component/hooks/useCreateNmriumZip.ts +37 -0
  249. package/src/component/hooks/useExport.tsx +16 -31
  250. package/src/component/loader/useLoadFiles.ts +6 -10
  251. package/src/component/main/InnerNMRium.tsx +4 -2
  252. package/src/component/main/NMRium.tsx +50 -2
  253. package/src/component/main/NMRiumRefAPI.ts +7 -1
  254. package/src/component/main/NMRiumStateProvider.tsx +57 -35
  255. package/src/component/modal/LoadJCAMPModal.tsx +4 -4
  256. package/src/component/modal/setting/general_settings.tsx +4 -3
  257. package/src/component/modal/setting/tanstack_general_settings/general_settings.tsx +80 -54
  258. package/src/component/modal/setting/tanstack_general_settings/general_settings_dialog_body.tsx +48 -1
  259. package/src/component/modal/setting/tanstack_general_settings/general_settings_dialog_header.tsx +75 -68
  260. package/src/component/modal/setting/tanstack_general_settings/general_settings_dialog_header_actions_buttons.tsx +165 -184
  261. package/src/component/modal/setting/tanstack_general_settings/hooks/use_safe_workspace.ts +95 -0
  262. package/src/component/modal/setting/tanstack_general_settings/tabs/auto_processing_tab.tsx +81 -0
  263. package/src/component/modal/setting/tanstack_general_settings/tabs/database_tab.tsx +210 -0
  264. package/src/component/modal/setting/tanstack_general_settings/tabs/export_tab.fields.tsx +48 -8
  265. package/src/component/modal/setting/tanstack_general_settings/tabs/external_api_tab.tsx +150 -0
  266. package/src/component/modal/setting/tanstack_general_settings/tabs/general_tab.tsx +3 -3
  267. package/src/component/modal/setting/tanstack_general_settings/tabs/nuclei_tab.tsx +164 -233
  268. package/src/component/modal/setting/tanstack_general_settings/tabs/panels_tab.tsx +10 -10
  269. package/src/component/modal/setting/tanstack_general_settings/tabs/spectra_colors_tab.tsx +352 -0
  270. package/src/component/modal/setting/tanstack_general_settings/tabs/title_block_tab.tsx +248 -0
  271. package/src/component/modal/setting/tanstack_general_settings/tabs/tools_tab.tsx +155 -0
  272. package/src/component/modal/setting/tanstack_general_settings/ui/table.tsx +163 -0
  273. package/src/component/modal/setting/tanstack_general_settings/ui/table_section.tsx +52 -0
  274. package/src/component/modal/setting/tanstack_general_settings/validation/auto_processing_tab_validation.ts +73 -0
  275. package/src/component/modal/setting/tanstack_general_settings/validation/database_tab_validation.ts +23 -0
  276. package/src/component/modal/setting/tanstack_general_settings/validation/external_apis_validation.ts +12 -0
  277. package/src/component/modal/setting/tanstack_general_settings/validation/general_tab_validation.ts +4 -6
  278. package/src/component/modal/setting/tanstack_general_settings/validation/nuclei_tab_validation.ts +11 -8
  279. package/src/component/modal/setting/tanstack_general_settings/validation/panels_tab_validation.ts +17 -9
  280. package/src/component/modal/setting/tanstack_general_settings/validation/spectra_colors_tab_validation.ts +29 -0
  281. package/src/component/modal/setting/tanstack_general_settings/validation/title_block_tab_validation.ts +26 -0
  282. package/src/component/modal/setting/tanstack_general_settings/validation/tools_tab_validation.ts +34 -0
  283. package/src/component/modal/setting/tanstack_general_settings/validation/utils.ts +30 -0
  284. package/src/component/modal/setting/tanstack_general_settings/validation.ts +16 -31
  285. package/src/component/panels/MoleculesPanel/MoleculeStructure.tsx +35 -0
  286. package/src/component/panels/SpectraPanel/base/setting/Spectrum1DSetting.tsx +3 -2
  287. package/src/component/panels/SpectraPanel/base/setting/Spectrum2DSetting.tsx +12 -4
  288. package/src/component/panels/SpectraPanel/base/setting/SpectrumSetting.tsx +1 -1
  289. package/src/component/panels/databasePanel/DatabasePanel.tsx +6 -4
  290. package/src/component/panels/filtersPanel/Filters/FiltersSectionsPanel.tsx +34 -49
  291. package/src/component/panels/filtersPanel/Filters/base/BaseApodizationOptions.tsx +1 -1
  292. package/src/component/reducer/Reducer.ts +1 -3
  293. package/src/component/reducer/actions/FiltersActions.ts +16 -10
  294. package/src/component/reducer/actions/LoadAction.ts +12 -27
  295. package/src/component/reducer/actions/MoleculeActions.ts +3 -0
  296. package/src/component/reducer/actions/SpectraActions.ts +14 -6
  297. package/src/component/reducer/actions/ToolsActions.ts +3 -1
  298. package/src/component/reducer/preferences/actions/applyGeneralPreferences.ts +1 -2
  299. package/src/component/reducer/preferences/preferencesReducer.ts +4 -4
  300. package/src/component/workspaces/workspaceDefaultProperties.ts +9 -0
  301. package/src/data/PredictionManager.ts +3 -0
  302. package/src/data/data2d/Spectrum2D/contours.ts +28 -12
  303. package/src/data/data2d/Spectrum2D/initiateDatum2D.ts +1 -17
  304. package/src/data/molecules/Molecule.ts +17 -7
  305. package/src/data/molecules/MoleculeManager.ts +31 -29
  306. package/src/versionInfo.ts +1 -1
  307. package/lib/component/modal/setting/tanstack_general_settings/utils/checkUniqueByKey.d.ts.map +0 -1
  308. package/lib/component/modal/setting/tanstack_general_settings/utils/checkUniqueByKey.js.map +0 -1
  309. /package/src/component/modal/setting/tanstack_general_settings/{utils/checkUniqueByKey.ts → validation/check_unique_by_key.ts} +0 -0
@@ -0,0 +1,30 @@
1
+ import type { ZodCodec, ZodObject, ZodUUID } from 'zod';
2
+ import { z } from 'zod';
3
+ import type { $ZodObjectConfig, $ZodShape } from 'zod/v4/core';
4
+
5
+ export const jpathCodec = z.codec(
6
+ z.string().min(1),
7
+ z.array(z.string().min(1)).min(1),
8
+ {
9
+ encode: (path) => path.join('.'),
10
+ decode: (path) => (path ? path.split('.') : []),
11
+ },
12
+ );
13
+
14
+ /**
15
+ * Add an uuid field to `z.input<validator>` and keep as-is the `z.output<validator>`.
16
+ * It is mandatory for fields in table rows.
17
+ * @param validator
18
+ */
19
+ export function withUUID<ZT extends ZodObject<$ZodShape, $ZodObjectConfig>>(
20
+ validator: ZT,
21
+ ): ZodCodec<ZodObject<ZT['shape'] & { uuid: ZodUUID }>, ZT> {
22
+ return z.codec(validator.extend({ uuid: z.uuid() }), validator, {
23
+ encode: (value) => ({
24
+ ...validator.decode(value),
25
+ uuid: crypto.randomUUID(),
26
+ }),
27
+ decode: ({ uuid, ...value }) =>
28
+ validator.encode(value as z.output<typeof validator>),
29
+ });
30
+ }
@@ -2,7 +2,10 @@ import { z } from 'zod';
2
2
 
3
3
  import { workspaceDefaultProperties } from '../../../workspaces/workspaceDefaultProperties.js';
4
4
 
5
+ import { autoProcessingTabValidation } from './validation/auto_processing_tab_validation.ts';
6
+ import { databasesValidation } from './validation/database_tab_validation.ts';
5
7
  import { exportPreferencesValidation } from './validation/export_tab_validation.js';
8
+ import { externalAPIsValidation } from './validation/external_apis_validation.js';
6
9
  import {
7
10
  displayGeneralValidation,
8
11
  generalValidation,
@@ -11,6 +14,9 @@ import {
11
14
  import { nmrLoadersValidation } from './validation/import_filters_tab_validation.js';
12
15
  import { nucleiValidation } from './validation/nuclei_tab_validation.js';
13
16
  import { displayPanelsValidation } from './validation/panels_tab_validation.js';
17
+ import { spectraColorsTabValidation } from './validation/spectra_colors_tab_validation.ts';
18
+ import { infoBlockTabValidation } from './validation/title_block_tab_validation.js';
19
+ import { toolBarButtonsValidation } from './validation/tools_tab_validation.ts';
14
20
 
15
21
  /**
16
22
  * The type for the workspace preferences is `WorkspaceWithSource`
@@ -22,45 +28,24 @@ import { displayPanelsValidation } from './validation/panels_tab_validation.js';
22
28
  const displayValidation = z.object({
23
29
  general: displayGeneralValidation,
24
30
  panels: displayPanelsValidation,
31
+ toolBarButtons: toolBarButtonsValidation,
25
32
  });
26
33
 
27
34
  export const workspaceValidation = z.object({
28
- nuclei: nucleiValidation,
29
- peaksLabel: peaksLabelValidation,
30
- general: generalValidation,
31
35
  display: displayValidation,
36
+ general: generalValidation,
37
+ nuclei: nucleiValidation,
38
+ databases: databasesValidation,
32
39
  nmrLoaders: nmrLoadersValidation,
40
+ infoBlock: infoBlockTabValidation,
41
+ onLoadProcessing: autoProcessingTabValidation,
42
+ spectraColors: spectraColorsTabValidation,
43
+ externalAPIs: externalAPIsValidation,
33
44
  export: exportPreferencesValidation,
45
+ peaksLabel: peaksLabelValidation,
34
46
  });
35
47
 
36
48
  // This object is used to define type not real values. Do not use it as values
37
49
  export const defaultGeneralSettingsFormValues: z.input<
38
50
  typeof workspaceValidation
39
- > = {
40
- nuclei: nucleiValidation.encode(workspaceDefaultProperties.nuclei),
41
- peaksLabel: {
42
- marginTop: 0,
43
- },
44
- general: {
45
- dimmedSpectraOpacity: 0,
46
- invert: false,
47
- invertScroll: false,
48
- spectraRendering: 'auto',
49
- loggingLevel: 'info',
50
- popupLoggingLevel: 'info',
51
- },
52
- display: {
53
- general: {
54
- experimentalFeatures: {
55
- display: false,
56
- },
57
- },
58
- panels: displayPanelsValidation.encode(
59
- workspaceDefaultProperties.display.panels,
60
- ),
61
- },
62
- nmrLoaders: nmrLoadersValidation.encode(
63
- workspaceDefaultProperties.nmrLoaders,
64
- ),
65
- export: exportPreferencesValidation.encode(workspaceDefaultProperties.export),
66
- };
51
+ > = workspaceValidation.encode(workspaceDefaultProperties);
@@ -1,4 +1,6 @@
1
1
  import type { MoleculeView } from '@zakodium/nmrium-core';
2
+ import { Molecule } from 'openchemlib';
3
+ import type { GroupedDiaID } from 'openchemlib-utils';
2
4
  import { useRef } from 'react';
3
5
  import type { MolfileSvgRendererProps } from 'react-ocl';
4
6
  import { MolfileSvgRenderer } from 'react-ocl';
@@ -7,6 +9,7 @@ import OCLnmr from 'react-ocl-nmr';
7
9
 
8
10
  import type { StateMoleculeExtended } from '../../../data/molecules/Molecule.js';
9
11
  import { useDispatch } from '../../context/DispatchContext.js';
12
+ import { useTopicMolecule } from '../../context/TopicMoleculeContext.tsx';
10
13
  import { useHighlightColor } from '../../hooks/useHighlightColor.js';
11
14
 
12
15
  import useAtomAssignment from './hooks/useAtomAssignment.js';
@@ -20,6 +23,30 @@ interface MoleculeStructureProps extends Pick<OCLnmrProps, 'width' | 'height'> {
20
23
  index?: number;
21
24
  }
22
25
 
26
+ function getCustomLabels(groups: GroupedDiaID[]) {
27
+ return groups.flatMap((g) => g.customLabels).join(',');
28
+ }
29
+ function useCustomLabelChange() {
30
+ const topicMolecule = useTopicMolecule();
31
+
32
+ return (newMolfile: string, moleculeId: string) => {
33
+ const molecule = topicMolecule?.[moleculeId];
34
+
35
+ if (!molecule) return false;
36
+
37
+ const currentGroupedAtomIDs = molecule.getGroupedDiastereotopicAtomIDs();
38
+ const newMolecule = molecule.fromMolecule(Molecule.fromMolfile(newMolfile));
39
+ const updatedGroupedAtomIDs = newMolecule.getGroupedDiastereotopicAtomIDs();
40
+
41
+ if (!currentGroupedAtomIDs || !updatedGroupedAtomIDs) return;
42
+
43
+ return (
44
+ getCustomLabels(currentGroupedAtomIDs) !==
45
+ getCustomLabels(updatedGroupedAtomIDs)
46
+ );
47
+ };
48
+ }
49
+
23
50
  export function MoleculeStructure(props: MoleculeStructureProps) {
24
51
  const {
25
52
  molecule,
@@ -42,6 +69,7 @@ export function MoleculeStructure(props: MoleculeStructureProps) {
42
69
  useExtractAtomAssignmentLabel();
43
70
  //TODO Temporary workaround to prevent other focused elements from being triggered by the space key
44
71
  const containerRef = useRef<HTMLDivElement>(null);
72
+ const hasCustomLabelChanged = useCustomLabelChange();
45
73
 
46
74
  const atomHighlightColor =
47
75
  currentDiaIDsToHighlight?.length > 0 ? '#ff000080' : highlightColor;
@@ -89,6 +117,13 @@ export function MoleculeStructure(props: MoleculeStructureProps) {
89
117
  const diaObject = getLastHoverAtom();
90
118
  const assignmentObj = getAssignmentLabelByHover(molecule.id, molfile);
91
119
 
120
+ if (hasCustomLabelChanged(molfile, molecule.id)) {
121
+ dispatch({
122
+ type: 'CHANGE_MOLECULE_ANNOTATION',
123
+ payload: { id: molecule.id, atomAnnotation: 'custom-labels' },
124
+ });
125
+ }
126
+
92
127
  if (assignmentObj && diaObject) {
93
128
  dispatch({
94
129
  type: 'CHANGE_ASSIGNMENT_LABEL_BY_DIAIDS',
@@ -15,15 +15,16 @@ export function Spectrum1DSetting({
15
15
  data: SpectrumData,
16
16
  onSubmit,
17
17
  }: Spectrum1DSettingProps) {
18
+ const { display } = SpectrumData;
18
19
  const { control, handleSubmit } = useForm({
19
- defaultValues: SpectrumData.display,
20
+ defaultValues: { display },
20
21
  });
21
22
 
22
23
  return (
23
24
  <div style={{ display: 'flex', flexDirection: 'column', gap: '1.25rem' }}>
24
25
  <div style={{ display: 'block', position: 'relative' }}>
25
26
  <Controller
26
- name="color"
27
+ name="display.color"
27
28
  control={control}
28
29
  render={({ field }) => {
29
30
  const { value, onChange } = field;
@@ -1,6 +1,7 @@
1
1
  import type { RangeSliderProps } from '@blueprintjs/core';
2
2
  import { RangeSlider } from '@blueprintjs/core';
3
3
  import styled from '@emotion/styled';
4
+ import type { Spectrum2D } from '@zakodium/nmrium-core';
4
5
  import debounce from 'lodash/debounce.js';
5
6
  import type { CSSProperties } from 'react';
6
7
  import { useMemo } from 'react';
@@ -14,6 +15,7 @@ import {
14
15
  import { ColorPicker } from 'react-science/ui';
15
16
 
16
17
  import { COLORS } from '../../../../../data/utilities/generateColor.js';
18
+ import { useChartData } from '../../../../context/ChartContext.tsx';
17
19
  import { NumberInput2 } from '../../../../elements/NumberInput2.js';
18
20
  import { useFormValidateField } from '../../../../elements/useFormValidateField.js';
19
21
  import { colorToHexWithAlpha } from '../../../../utility/colorToHexWithAlpha.js';
@@ -38,7 +40,7 @@ function ContoursRangeSlider(props: ContoursRangeSliderProps) {
38
40
  }
39
41
 
40
42
  interface Spectrum2DSettingProps {
41
- data: any;
43
+ data: Spectrum2D;
42
44
  onSubmit: (values: any) => void;
43
45
  }
44
46
 
@@ -53,8 +55,14 @@ export function Spectrum2DSetting({
53
55
  data: SpectrumData,
54
56
  onSubmit,
55
57
  }: Spectrum2DSettingProps) {
56
- const { positiveColor, negativeColor } = SpectrumData.display;
57
- const methods = useForm({ defaultValues: SpectrumData.display });
58
+ const { id, display } = SpectrumData;
59
+ const {
60
+ view: { spectraContourLevels },
61
+ } = useChartData();
62
+ const methods = useForm({
63
+ defaultValues: { contourOptions: spectraContourLevels[id], display },
64
+ });
65
+ const { positiveColor, negativeColor } = display;
58
66
 
59
67
  return (
60
68
  <FormProvider {...methods}>
@@ -95,7 +103,7 @@ function Settings(props: SettingsProps) {
95
103
  return (
96
104
  <>
97
105
  <Controller
98
- name={`${sign}Color`}
106
+ name={`display.${sign}Color`}
99
107
  control={control}
100
108
  render={({ field }) => {
101
109
  const { value, onChange } = field;
@@ -29,7 +29,7 @@ export function SpectrumSetting({
29
29
  function submitHandler(values: any) {
30
30
  dispatch({
31
31
  type: 'CHANGE_SPECTRUM_SETTING',
32
- payload: { id, display: values },
32
+ payload: { id, ...values },
33
33
  });
34
34
  }
35
35
 
@@ -304,7 +304,9 @@ function DatabasePanelInner({
304
304
  });
305
305
 
306
306
  try {
307
- const [{ data }] = await core.readFromWebSource({
307
+ const {
308
+ state: { data },
309
+ } = await core.readFromWebSource({
308
310
  entries: [{ baseURL: url.origin, relativePath: url.pathname }],
309
311
  });
310
312
  const spectrum = data?.spectra?.[0] || null;
@@ -520,9 +522,9 @@ async function saveJcampAsJson(
520
522
  const { index, baseURL, jcampURL, names, ocl = {}, smiles } = rowData;
521
523
  const { ranges } = filteredData.data[index];
522
524
  const url = new URL(jcampURL, baseURL);
523
- const [
524
- { data: { spectra, sources } = { sources: [], spectra: [] }, version },
525
- ] = await core.readFromWebSource({
525
+ const {
526
+ state: { data: { spectra = [], sources = [] } = {}, version },
527
+ } = await core.readFromWebSource({
526
528
  entries: [{ baseURL: url.origin, relativePath: url.pathname }],
527
529
  });
528
530
 
@@ -1,13 +1,13 @@
1
1
  import { Switch } from '@blueprintjs/core';
2
2
  import styled from '@emotion/styled';
3
3
  import { Filters1D, Filters2D } from 'nmr-processing';
4
- import { memo, useEffect, useRef, useState } from 'react';
4
+ import { memo, useMemo, useRef, useState } from 'react';
5
5
  import { FaRegTrashAlt } from 'react-icons/fa';
6
6
  import { ObjectInspector } from 'react-inspector';
7
7
  import { Button } from 'react-science/ui';
8
8
 
9
9
  import { getFilterLabel } from '../../../../data/getFilterLabel.js';
10
- import type { FilterEntry as BaseFilterEntry } from '../../../../data/types/common/FilterEntry.js';
10
+ import type { FilterEntry } from '../../../../data/types/common/FilterEntry.js';
11
11
  import { useChartData } from '../../../context/ChartContext.js';
12
12
  import { useDispatch } from '../../../context/DispatchContext.js';
13
13
  import { useFilterSyncOptions } from '../../../context/FilterSyncOptionsContext.js';
@@ -23,11 +23,11 @@ import { getDefaultFilterOptions } from '../../../utility/getDefaultFilterOption
23
23
 
24
24
  import { filterOptionPanels } from './index.js';
25
25
 
26
- export const nonRemovableFilters = new Set<BaseFilterEntry['name']>([
26
+ export const nonRemovableFilters = new Set<FilterEntry['name']>([
27
27
  'digitalFilter',
28
28
  'digitalFilter2D',
29
29
  ]);
30
- const readOnlyFilters = new Set<BaseFilterEntry['name']>([
30
+ const readOnlyFilters = new Set<FilterEntry['name']>([
31
31
  'digitalFilter',
32
32
  'shiftX',
33
33
  'exclusionZones',
@@ -46,10 +46,6 @@ const Filters = {
46
46
  ...Filters1D,
47
47
  ...Filters2D,
48
48
  };
49
-
50
- type FilterEntry = Omit<BaseFilterEntry, 'value'> & {
51
- value: null | BaseFilterEntry['value'];
52
- };
53
49
  interface FilterElementsProps {
54
50
  filter: FilterEntry;
55
51
  spectraCounter: number;
@@ -75,7 +71,7 @@ function FilterElements(props: FilterElementsProps) {
75
71
  const label = getFilterLabel(name);
76
72
 
77
73
  function handleFilterCheck(
78
- id: any,
74
+ id: string,
79
75
  event: React.ChangeEvent<HTMLInputElement>,
80
76
  ) {
81
77
  const enabled = event.target.checked;
@@ -169,6 +165,7 @@ function FilterElements(props: FilterElementsProps) {
169
165
  innerLabel="Off"
170
166
  checked={enabled || false}
171
167
  onChange={(event) => {
168
+ if (!id) return;
172
169
  handleFilterCheck(id, event);
173
170
  }}
174
171
  />
@@ -187,20 +184,16 @@ function FiltersInner(props: FiltersInnerProps) {
187
184
  const {
188
185
  toolOptions: { selectedTool },
189
186
  } = useChartData();
190
- const [newFilter, setNewFilter] = useState<FilterEntry | null>();
187
+ const [manualSection, setManualSection] = useState<string | null>(null);
188
+
191
189
  const { updateFilterOptions } = useFilterSyncOptions();
192
190
 
193
- const [selectedSection, openSection] = useState<string | null>();
194
191
  const dispatch = useDispatch();
195
192
  const toaster = useToaster();
196
- const selectedFilterIndex = useRef<number>();
193
+ const selectedFilterIndex = useRef<number | null>();
197
194
  const activeSpectrum = useActiveSpectrum();
198
195
 
199
- function toggleSection(sectionKey: any) {
200
- openSection(selectedSection === sectionKey ? '' : sectionKey);
201
- }
202
-
203
- function filterSnapShotHandler(filter: any, index: any) {
196
+ function filterSnapShotHandler(filter: FilterEntry, index: number) {
204
197
  selectedFilterIndex.current =
205
198
  selectedFilterIndex.current && index === selectedFilterIndex.current
206
199
  ? null
@@ -210,7 +203,7 @@ function FiltersInner(props: FiltersInnerProps) {
210
203
  //Clear the filter sync object
211
204
  updateFilterOptions(null);
212
205
  //Close the opened section
213
- openSection(null);
206
+ setManualSection(null);
214
207
  }
215
208
  const hideLoading = toaster.showLoading({
216
209
  message: 'Filter snapshot process in progress',
@@ -224,7 +217,7 @@ function FiltersInner(props: FiltersInnerProps) {
224
217
  }, 0);
225
218
  }
226
219
 
227
- function getStyle(filter: any, index: any) {
220
+ function getStyle(filter: FilterEntry, index: number) {
228
221
  const { id, error } = filter;
229
222
 
230
223
  if (error) {
@@ -245,38 +238,34 @@ function FiltersInner(props: FiltersInnerProps) {
245
238
  return {};
246
239
  }
247
240
 
248
- useEffect(() => {
249
- const isFilterExists = filters.some(
250
- (filter) => filter.name === selectedTool,
251
- );
252
-
253
- // TODO: The types of selectedTool and Filters are completely incompatible
254
- // I think we need a propper mapping between the two
241
+ const newFilter = useMemo<FilterEntry | null>(() => {
242
+ const isFilterExists = filters.some((f) => f.name === selectedTool);
255
243
  if (!isFilterExists && (Filters as any)?.[selectedTool]) {
256
244
  const { name } = (Filters as any)[selectedTool];
257
- setNewFilter(getDefaultFilterOptions(name));
258
- } else {
259
- setNewFilter((previousNewFilter) => {
260
- if (previousNewFilter) {
261
- openSection('');
262
- }
263
- return null;
264
- });
245
+ return getDefaultFilterOptions(name);
265
246
  }
247
+ return null;
266
248
  }, [filters, selectedTool]);
267
249
 
268
- useEffect(() => {
269
- if ((Filters as any)?.[selectedTool]) {
270
- openSection(selectedTool);
271
- return;
272
- }
250
+ const selectedSection = useMemo(() => {
251
+ // New filter tool is selected
252
+ if ((Filters as any)?.[selectedTool]) return selectedTool;
273
253
 
274
- const filter = filters.find((filter) => filter.id === activeFilterID);
254
+ //An existing filter is being edited
255
+ const filter = filters.find((f) => f.id === activeFilterID);
256
+ if (filter) return filter.name;
275
257
 
276
- if (filter) {
277
- openSection(filter.name);
278
- }
279
- }, [activeFilterID, filters, selectedTool]);
258
+ // otherwise, fallback to the manual selected section
259
+ return manualSection;
260
+ }, [selectedTool, activeFilterID, filters, manualSection]);
261
+
262
+ function toggleSection(sectionKey: string) {
263
+ setManualSection((prev) => (prev === sectionKey ? null : sectionKey));
264
+ }
265
+
266
+ function handleClose() {
267
+ setManualSection(null);
268
+ }
280
269
 
281
270
  const filtersList = [...filters];
282
271
 
@@ -295,11 +284,7 @@ function FiltersInner(props: FiltersInnerProps) {
295
284
  return <EmptyText text="No Filters" />;
296
285
  }
297
286
 
298
- function handleClose() {
299
- openSection(null);
300
- }
301
-
302
- function handleReorderFilters(sourceIndex: any, targetIndex: any) {
287
+ function handleReorderFilters(sourceIndex: number, targetIndex: number) {
303
288
  dispatch({
304
289
  type: 'REORDER_FILTERS',
305
290
  payload: { sourceIndex, targetIndex },
@@ -98,7 +98,7 @@ export function BaseApodizationOptions(
98
98
  dispatch({
99
99
  type: 'SET_FILTER_SNAPSHOT',
100
100
  payload: {
101
- filter: { id: filter.id, name: filter.name },
101
+ filter,
102
102
  tempRollback: event.target.checked,
103
103
  triggerSource: 'processedToggle',
104
104
  },
@@ -104,9 +104,7 @@ export function getDefaultViewState(): ViewState {
104
104
  showSimilarityTree: false,
105
105
  selectReferences: {},
106
106
  },
107
- zoom: {
108
- levels: {},
109
- },
107
+ spectraContourLevels: {},
110
108
  verticalAlign: {},
111
109
  predictions: {},
112
110
  currentSimulatedSpectrumKey: null,
@@ -25,13 +25,11 @@ import {
25
25
 
26
26
  import { isSpectrum1D } from '../../../data/data1d/Spectrum1D/index.js';
27
27
  import { isFid1DSpectrum } from '../../../data/data1d/Spectrum1D/isSpectrum1D.js';
28
- import { getDefaultContoursLevel } from '../../../data/data2d/Spectrum2D/contours.js';
28
+ import { initializeContoursLevels } from '../../../data/data2d/Spectrum2D/contours.js';
29
29
  import { getProjection } from '../../../data/data2d/Spectrum2D/getMissingProjection.js';
30
30
  import { isSpectrum2D } from '../../../data/data2d/Spectrum2D/index.js';
31
- import {
32
- isFid2DSpectrum,
33
- isFt2DSpectrum,
34
- } from '../../../data/data2d/Spectrum2D/isSpectrum2D.js';
31
+ import { isFid2DSpectrum } from '../../../data/data2d/Spectrum2D/isSpectrum2D.js';
32
+ import type { FilterEntry } from '../../../data/types/common/FilterEntry.ts';
35
33
  import type { ExclusionZone } from '../../../data/types/data1d/ExclusionZone.js';
36
34
  import { getXScale } from '../../1d/utilities/scale.js';
37
35
  import { get2DXScale, get2DYScale } from '../../2d/utilities/scale.js';
@@ -185,7 +183,7 @@ type DeleteSpectraFilterAction = ActionType<
185
183
  type SetFilterSnapshotAction = ActionType<
186
184
  'SET_FILTER_SNAPSHOT',
187
185
  {
188
- filter: { name: string; id: string };
186
+ filter: FilterEntry;
189
187
  tempRollback: boolean;
190
188
  triggerSource?: 'none' | 'processedToggle';
191
189
  }
@@ -736,8 +734,18 @@ function beforeRollback(draft: Draft<State>, filterKey: any) {
736
734
  }
737
735
  }
738
736
  function afterRollback(draft: Draft<State>, filterKey: any) {
737
+ const activeSpectrum = getActiveSpectrum(draft);
738
+
739
739
  switch (filterKey) {
740
740
  //specify the filters here
741
+ case fftDimension1:
742
+ case fftDimension2: {
743
+ if (!activeSpectrum) return;
744
+ const spectrum = current(draft).data[activeSpectrum.index];
745
+ draft.view.spectraContourLevels[spectrum.id] =
746
+ initializeContoursLevels(spectrum);
747
+ break;
748
+ }
741
749
  default:
742
750
  break;
743
751
  }
@@ -1345,10 +1353,6 @@ function applyFFTTwoDimensionFilter(
1345
1353
 
1346
1354
  const spectrum = draft.data[index];
1347
1355
 
1348
- if (isFt2DSpectrum(spectrum)) {
1349
- spectrum.display.contourOptions = getDefaultContoursLevel(spectrum);
1350
- }
1351
-
1352
1356
  updateView(draft, domainUpdateRules);
1353
1357
 
1354
1358
  //clear zoom history
@@ -1356,6 +1360,8 @@ function applyFFTTwoDimensionFilter(
1356
1360
 
1357
1361
  draft.toolOptions.selectedOptionPanel = null;
1358
1362
  draft.toolOptions.selectedTool = 'zoom';
1363
+ draft.view.spectraContourLevels[spectrum.id] =
1364
+ initializeContoursLevels(spectrum);
1359
1365
  }
1360
1366
 
1361
1367
  function handleApplyFFtDimension1Filter(draft: Draft<State>) {
@@ -15,6 +15,7 @@ import { buildCorrelationData } from 'nmr-correlation';
15
15
  import type { ParseResult } from 'papaparse';
16
16
 
17
17
  import { initiateDatum1D } from '../../../data/data1d/Spectrum1D/index.js';
18
+ import { initializeContours } from '../../../data/data2d/Spectrum2D/contours.ts';
18
19
  import { initiateDatum2D } from '../../../data/data2d/Spectrum2D/index.js';
19
20
  import type { StateMoleculeExtended } from '../../../data/molecules/Molecule.js';
20
21
  import * as MoleculeManager from '../../../data/molecules/MoleculeManager.js';
@@ -35,15 +36,12 @@ interface InitiateProps {
35
36
  nmriumState: Partial<NmriumState>;
36
37
  aggregator: FileCollection;
37
38
  }
38
- interface InputProps extends Omit<InitiateProps, 'aggregator'> {
39
+ interface InputProps extends InitiateProps {
39
40
  containsNmrium?: boolean;
40
41
  usedColors?: UsedColors;
41
42
  parseMetaFileResult?: ParseResult<any> | null;
42
43
  resetSourceObject?: boolean;
43
44
  spectraColors?: SpectraColors;
44
- fileCollection?: FileCollection;
45
- selectorRoot?: string;
46
- aggregator?: FileCollection;
47
45
  defaultMoleculeSettings?: MoleculeView;
48
46
  }
49
47
 
@@ -155,26 +153,11 @@ function setData(draft: Draft<State>, input: InputProps | InitiateProps) {
155
153
  }
156
154
  }
157
155
 
158
- if (input.aggregator) {
159
- if ('forceInitialize' in input && input.forceInitialize) {
160
- draft.aggregator = input.aggregator;
161
- } else {
162
- draft.aggregator = FileCollection.fromCollection(draft.aggregator);
163
- draft.aggregator.appendFileCollection(input.aggregator, '');
164
- }
165
- }
166
-
167
- if (
168
- 'fileCollection' in input &&
169
- input.fileCollection &&
170
- 'selectorRoot' in input &&
171
- input.selectorRoot
172
- ) {
156
+ if ('forceInitialize' in input && input.forceInitialize) {
157
+ draft.aggregator = input.aggregator;
158
+ } else {
173
159
  draft.aggregator = FileCollection.fromCollection(draft.aggregator);
174
- draft.aggregator.appendFileCollection(
175
- input.fileCollection,
176
- input.selectorRoot,
177
- );
160
+ draft.aggregator.appendFileCollection(input.aggregator, '');
178
161
  }
179
162
 
180
163
  const newMolecules = MoleculeManager.fromJSON(molecules, draft.molecules);
@@ -195,6 +178,9 @@ function setData(draft: Draft<State>, input: InputProps | InitiateProps) {
195
178
  spectraColors,
196
179
  }),
197
180
  );
181
+
182
+ draft.view.spectraContourLevels = initializeContours(draft.data);
183
+
198
184
  setCorrelation(draft, correlations);
199
185
 
200
186
  if (parseMetaFileResult) {
@@ -285,10 +271,9 @@ function initData(
285
271
  initialDraft.actionType = action.type;
286
272
  });
287
273
  } else {
288
- if (action.payload.aggregator) {
289
- draft.aggregator = FileCollection.fromCollection(draft.aggregator);
290
- draft.aggregator.appendFileCollection(action.payload.aggregator, '');
291
- }
274
+ draft.aggregator = FileCollection.fromCollection(draft.aggregator);
275
+ draft.aggregator.appendFileCollection(action.payload.aggregator, '');
276
+
292
277
  if (view) {
293
278
  const defaultViewState = getDefaultViewState();
294
279
  draft.view = lodashMerge(defaultViewState, view);
@@ -14,6 +14,7 @@ import type {
14
14
  import { generateSpectra } from '../../../data/PredictionManager.js';
15
15
  import { changeSpectraRelativeSum } from '../../../data/data1d/Spectrum1D/SumManager.js';
16
16
  import { isSpectrum1D } from '../../../data/data1d/Spectrum1D/isSpectrum1D.js';
17
+ import { initializeContoursLevels } from '../../../data/data2d/Spectrum2D/contours.ts';
17
18
  import type { MoleculeBoundingRect } from '../../../data/molecules/Molecule.js';
18
19
  import { DRAGGABLE_STRUCTURE_INITIAL_BOUNDING_REACT } from '../../../data/molecules/Molecule.js';
19
20
  import * as MoleculeManager from '../../../data/molecules/MoleculeManager.js';
@@ -304,6 +305,8 @@ function handlePredictSpectraFromMolecule(
304
305
  )) {
305
306
  draft.data.push(spectrum);
306
307
  spectraIds.push(spectrum.id);
308
+ draft.view.spectraContourLevels[spectrum.id] =
309
+ initializeContoursLevels(spectrum);
307
310
  }
308
311
  let id = molecule?.id;
309
312
  //if the id object is not exits add a new molecule