nmrium 2.4.0 → 2.5.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 (277) hide show
  1. package/lib/component/1d/HorizontalAxis1D.d.ts.map +1 -1
  2. package/lib/component/1d/HorizontalAxis1D.js +4 -1
  3. package/lib/component/1d/HorizontalAxis1D.js.map +1 -1
  4. package/lib/component/1d/SVGContent1D.d.ts.map +1 -1
  5. package/lib/component/1d/SVGContent1D.js +2 -1
  6. package/lib/component/1d/SVGContent1D.js.map +1 -1
  7. package/lib/component/1d/Viewer1D.d.ts.map +1 -1
  8. package/lib/component/1d/Viewer1D.js +2 -1
  9. package/lib/component/1d/Viewer1D.js.map +1 -1
  10. package/lib/component/1d/integral/IntegralResizable.d.ts.map +1 -1
  11. package/lib/component/1d/integral/IntegralResizable.js +4 -4
  12. package/lib/component/1d/integral/IntegralResizable.js.map +1 -1
  13. package/lib/component/1d/ranges/Range.d.ts.map +1 -1
  14. package/lib/component/1d/ranges/Range.js +3 -3
  15. package/lib/component/1d/ranges/Range.js.map +1 -1
  16. package/lib/component/1d/ranges/Signals.d.ts +2 -0
  17. package/lib/component/1d/ranges/Signals.d.ts.map +1 -0
  18. package/lib/component/1d/ranges/Signals.js +16 -0
  19. package/lib/component/1d/ranges/Signals.js.map +1 -0
  20. package/lib/component/1d-2d/components/RangeIndicator.d.ts +13 -0
  21. package/lib/component/1d-2d/components/RangeIndicator.d.ts.map +1 -0
  22. package/lib/component/1d-2d/components/RangeIndicator.js +52 -0
  23. package/lib/component/1d-2d/components/RangeIndicator.js.map +1 -0
  24. package/lib/component/1d-2d/components/Signals1D.d.ts +19 -0
  25. package/lib/component/1d-2d/components/Signals1D.d.ts.map +1 -0
  26. package/lib/component/1d-2d/components/Signals1D.js +155 -0
  27. package/lib/component/1d-2d/components/Signals1D.js.map +1 -0
  28. package/lib/component/1d-2d/tools/CrossLinePointer.d.ts +16 -1
  29. package/lib/component/1d-2d/tools/CrossLinePointer.d.ts.map +1 -1
  30. package/lib/component/1d-2d/tools/CrossLinePointer.js +25 -15
  31. package/lib/component/1d-2d/tools/CrossLinePointer.js.map +1 -1
  32. package/lib/component/1d-2d/tools/CursorToolIcon.d.ts +9 -0
  33. package/lib/component/1d-2d/tools/CursorToolIcon.d.ts.map +1 -0
  34. package/lib/component/1d-2d/tools/CursorToolIcon.js +58 -0
  35. package/lib/component/1d-2d/tools/CursorToolIcon.js.map +1 -0
  36. package/lib/component/2d/1d-tracer/Left1DChart.d.ts.map +1 -1
  37. package/lib/component/2d/1d-tracer/Left1DChart.js +3 -2
  38. package/lib/component/2d/1d-tracer/Left1DChart.js.map +1 -1
  39. package/lib/component/2d/1d-tracer/Ranges1D.d.ts.map +1 -1
  40. package/lib/component/2d/1d-tracer/Ranges1D.js +4 -60
  41. package/lib/component/2d/1d-tracer/Ranges1D.js.map +1 -1
  42. package/lib/component/2d/1d-tracer/Top1DChart.d.ts.map +1 -1
  43. package/lib/component/2d/1d-tracer/Top1DChart.js +3 -2
  44. package/lib/component/2d/1d-tracer/Top1DChart.js.map +1 -1
  45. package/lib/component/2d/DirectAxis2D.d.ts.map +1 -1
  46. package/lib/component/2d/DirectAxis2D.js +4 -1
  47. package/lib/component/2d/DirectAxis2D.js.map +1 -1
  48. package/lib/component/2d/IndirectAxis2D.d.ts.map +1 -1
  49. package/lib/component/2d/IndirectAxis2D.js +5 -2
  50. package/lib/component/2d/IndirectAxis2D.js.map +1 -1
  51. package/lib/component/2d/Viewer2D.d.ts.map +1 -1
  52. package/lib/component/2d/Viewer2D.js +2 -1
  53. package/lib/component/2d/Viewer2D.js.map +1 -1
  54. package/lib/component/AnchorSVG.d.ts +5 -6
  55. package/lib/component/AnchorSVG.d.ts.map +1 -1
  56. package/lib/component/AnchorSVG.js +9 -6
  57. package/lib/component/AnchorSVG.js.map +1 -1
  58. package/lib/component/EventsTrackers/BrushTracker.d.ts.map +1 -1
  59. package/lib/component/EventsTrackers/BrushTracker.js +14 -4
  60. package/lib/component/EventsTrackers/BrushTracker.js.map +1 -1
  61. package/lib/component/EventsTrackers/MouseTracker.d.ts +3 -0
  62. package/lib/component/EventsTrackers/MouseTracker.d.ts.map +1 -1
  63. package/lib/component/EventsTrackers/MouseTracker.js +15 -0
  64. package/lib/component/EventsTrackers/MouseTracker.js.map +1 -1
  65. package/lib/component/context/KeyModifierContext.d.ts +1 -0
  66. package/lib/component/context/KeyModifierContext.d.ts.map +1 -1
  67. package/lib/component/context/KeyModifierContext.js +22 -6
  68. package/lib/component/context/KeyModifierContext.js.map +1 -1
  69. package/lib/component/elements/D3Axis.d.ts.map +1 -1
  70. package/lib/component/elements/D3Axis.js +4 -3
  71. package/lib/component/elements/D3Axis.js.map +1 -1
  72. package/lib/component/header/AutoPeakPickingOptionPanel.d.ts.map +1 -1
  73. package/lib/component/header/AutoPeakPickingOptionPanel.js +59 -31
  74. package/lib/component/header/AutoPeakPickingOptionPanel.js.map +1 -1
  75. package/lib/component/header/RangesPickingOptionPanel.d.ts.map +1 -1
  76. package/lib/component/header/RangesPickingOptionPanel.js +34 -19
  77. package/lib/component/header/RangesPickingOptionPanel.js.map +1 -1
  78. package/lib/component/hooks/useAddMultipletSignal.d.ts +7 -0
  79. package/lib/component/hooks/useAddMultipletSignal.d.ts.map +1 -0
  80. package/lib/component/hooks/useAddMultipletSignal.js +28 -0
  81. package/lib/component/hooks/useAddMultipletSignal.js.map +1 -0
  82. package/lib/component/hooks/useFilter.d.ts.map +1 -1
  83. package/lib/component/hooks/useFilter.js.map +1 -1
  84. package/lib/component/hooks/useSpectrum.d.ts +3 -1
  85. package/lib/component/hooks/useSpectrum.d.ts.map +1 -1
  86. package/lib/component/hooks/useSpectrum.js +1 -1
  87. package/lib/component/hooks/useSpectrum.js.map +1 -1
  88. package/lib/component/hooks/useSpectrumWithDataSource.d.ts +1 -1
  89. package/lib/component/hooks/useSpectrumWithDataSource.d.ts.map +1 -1
  90. package/lib/component/hooks/useSpectrumWithDataSource.js.map +1 -1
  91. package/lib/component/hooks/useTempSpectrum.d.ts +1 -1
  92. package/lib/component/hooks/useTempSpectrum.d.ts.map +1 -1
  93. package/lib/component/hooks/use_ticks_config.d.ts +1 -4
  94. package/lib/component/hooks/use_ticks_config.d.ts.map +1 -1
  95. package/lib/component/hooks/use_ticks_config.js +1 -6
  96. package/lib/component/hooks/use_ticks_config.js.map +1 -1
  97. package/lib/component/modal/PublicationStringModal.d.ts +1 -1
  98. package/lib/component/modal/PublicationStringModal.d.ts.map +1 -1
  99. package/lib/component/modal/PublicationStringModal.js +2 -2
  100. package/lib/component/modal/PublicationStringModal.js.map +1 -1
  101. package/lib/component/modal/setting/tanstack_general_settings/errors/context.d.ts +118 -0
  102. package/lib/component/modal/setting/tanstack_general_settings/errors/context.d.ts.map +1 -1
  103. package/lib/component/modal/setting/tanstack_general_settings/errors/renderer.d.ts +118 -0
  104. package/lib/component/modal/setting/tanstack_general_settings/errors/renderer.d.ts.map +1 -1
  105. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_body.d.ts +118 -0
  106. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_body.d.ts.map +1 -1
  107. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_footer.d.ts +96 -0
  108. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_footer.d.ts.map +1 -1
  109. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header.d.ts +96 -0
  110. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header.d.ts.map +1 -1
  111. package/lib/component/modal/setting/tanstack_general_settings/hooks/use_safe_workspace.d.ts +16 -0
  112. package/lib/component/modal/setting/tanstack_general_settings/hooks/use_safe_workspace.d.ts.map +1 -1
  113. package/lib/component/modal/setting/tanstack_general_settings/tabs/auto_processing_tab.d.ts +96 -0
  114. package/lib/component/modal/setting/tanstack_general_settings/tabs/auto_processing_tab.d.ts.map +1 -1
  115. package/lib/component/modal/setting/tanstack_general_settings/tabs/axis_tab.d.ts +96 -0
  116. package/lib/component/modal/setting/tanstack_general_settings/tabs/axis_tab.d.ts.map +1 -1
  117. package/lib/component/modal/setting/tanstack_general_settings/tabs/axis_tab.js +12 -1
  118. package/lib/component/modal/setting/tanstack_general_settings/tabs/axis_tab.js.map +1 -1
  119. package/lib/component/modal/setting/tanstack_general_settings/tabs/database_tab.d.ts +96 -0
  120. package/lib/component/modal/setting/tanstack_general_settings/tabs/database_tab.d.ts.map +1 -1
  121. package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.d.ts +96 -0
  122. package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.d.ts.map +1 -1
  123. package/lib/component/modal/setting/tanstack_general_settings/tabs/external_api_tab.d.ts +96 -0
  124. package/lib/component/modal/setting/tanstack_general_settings/tabs/external_api_tab.d.ts.map +1 -1
  125. package/lib/component/modal/setting/tanstack_general_settings/tabs/general_tab.d.ts +96 -0
  126. package/lib/component/modal/setting/tanstack_general_settings/tabs/general_tab.d.ts.map +1 -1
  127. package/lib/component/modal/setting/tanstack_general_settings/tabs/import_filters_tab.d.ts +96 -0
  128. package/lib/component/modal/setting/tanstack_general_settings/tabs/import_filters_tab.d.ts.map +1 -1
  129. package/lib/component/modal/setting/tanstack_general_settings/tabs/nuclei_tab.d.ts +96 -0
  130. package/lib/component/modal/setting/tanstack_general_settings/tabs/nuclei_tab.d.ts.map +1 -1
  131. package/lib/component/modal/setting/tanstack_general_settings/tabs/panels_tab.d.ts +96 -0
  132. package/lib/component/modal/setting/tanstack_general_settings/tabs/panels_tab.d.ts.map +1 -1
  133. package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_colors_tab.d.ts +96 -0
  134. package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_colors_tab.d.ts.map +1 -1
  135. package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_label_tab.d.ts +96 -0
  136. package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_label_tab.d.ts.map +1 -1
  137. package/lib/component/modal/setting/tanstack_general_settings/tabs/title_block_tab.d.ts +96 -0
  138. package/lib/component/modal/setting/tanstack_general_settings/tabs/title_block_tab.d.ts.map +1 -1
  139. package/lib/component/modal/setting/tanstack_general_settings/tabs/tools_tab.d.ts +96 -0
  140. package/lib/component/modal/setting/tanstack_general_settings/tabs/tools_tab.d.ts.map +1 -1
  141. package/lib/component/modal/setting/tanstack_general_settings/validation/axis_tab_validation.d.ts +22 -0
  142. package/lib/component/modal/setting/tanstack_general_settings/validation/axis_tab_validation.d.ts.map +1 -1
  143. package/lib/component/modal/setting/tanstack_general_settings/validation/axis_tab_validation.js +15 -2
  144. package/lib/component/modal/setting/tanstack_general_settings/validation/axis_tab_validation.js.map +1 -1
  145. package/lib/component/modal/setting/tanstack_general_settings/validation.d.ts +22 -0
  146. package/lib/component/modal/setting/tanstack_general_settings/validation.d.ts.map +1 -1
  147. package/lib/component/panels/MoleculesPanel/hooks/useAtomAssignment.js +1 -1
  148. package/lib/component/panels/MoleculesPanel/hooks/useAtomAssignment.js.map +1 -1
  149. package/lib/component/panels/RangesPanel/RangesPanel.d.ts.map +1 -1
  150. package/lib/component/panels/RangesPanel/RangesPanel.js +1 -3
  151. package/lib/component/panels/RangesPanel/RangesPanel.js.map +1 -1
  152. package/lib/component/panels/RangesPanel/RangesTableRow.d.ts.map +1 -1
  153. package/lib/component/panels/RangesPanel/RangesTableRow.js +10 -12
  154. package/lib/component/panels/RangesPanel/RangesTableRow.js.map +1 -1
  155. package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.d.ts +1 -1
  156. package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.d.ts.map +1 -1
  157. package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.js +1 -1
  158. package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.js.map +1 -1
  159. package/lib/component/panels/filtersPanel/processings_sections_panel.d.ts.map +1 -1
  160. package/lib/component/panels/filtersPanel/processings_sections_panel.js +13 -23
  161. package/lib/component/panels/filtersPanel/processings_sections_panel.js.map +1 -1
  162. package/lib/component/panels/hooks/use_processings_mutation.d.ts +10 -0
  163. package/lib/component/panels/hooks/use_processings_mutation.d.ts.map +1 -0
  164. package/lib/component/panels/hooks/use_processings_mutation.js +130 -0
  165. package/lib/component/panels/hooks/use_processings_mutation.js.map +1 -0
  166. package/lib/component/panels/informationPanel/InformationPanel.js +1 -1
  167. package/lib/component/panels/informationPanel/InformationPanel.js.map +1 -1
  168. package/lib/component/reducer/Reducer.d.ts.map +1 -1
  169. package/lib/component/reducer/Reducer.js +2 -0
  170. package/lib/component/reducer/Reducer.js.map +1 -1
  171. package/lib/component/reducer/actions/CorrelationsActions.js +1 -1
  172. package/lib/component/reducer/actions/CorrelationsActions.js.map +1 -1
  173. package/lib/component/reducer/actions/FiltersActions.d.ts +2 -0
  174. package/lib/component/reducer/actions/FiltersActions.d.ts.map +1 -1
  175. package/lib/component/reducer/actions/FiltersActions.js +1 -1
  176. package/lib/component/reducer/actions/FiltersActions.js.map +1 -1
  177. package/lib/component/reducer/actions/RangesActions.d.ts.map +1 -1
  178. package/lib/component/reducer/actions/RangesActions.js +13 -24
  179. package/lib/component/reducer/actions/RangesActions.js.map +1 -1
  180. package/lib/component/reducer/actions/SpectraActions.d.ts +8 -2
  181. package/lib/component/reducer/actions/SpectraActions.d.ts.map +1 -1
  182. package/lib/component/reducer/actions/SpectraActions.js +6 -1
  183. package/lib/component/reducer/actions/SpectraActions.js.map +1 -1
  184. package/lib/component/reducer/preferences/actions/setPreferences.d.ts +2 -2
  185. package/lib/component/reducer/preferences/actions/setPreferences.d.ts.map +1 -1
  186. package/lib/component/reducer/preferences/actions/setPreferences.js +8 -5
  187. package/lib/component/reducer/preferences/actions/setPreferences.js.map +1 -1
  188. package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
  189. package/lib/component/reducer/preferences/preferencesReducer.d.ts.map +1 -1
  190. package/lib/component/toolbar/ToolTypes.d.ts +21 -1
  191. package/lib/component/toolbar/ToolTypes.d.ts.map +1 -1
  192. package/lib/component/toolbar/ToolTypes.js +40 -0
  193. package/lib/component/toolbar/ToolTypes.js.map +1 -1
  194. package/lib/component/toolbar/nmr_toolbar.d.ts.map +1 -1
  195. package/lib/component/toolbar/nmr_toolbar.js +9 -35
  196. package/lib/component/toolbar/nmr_toolbar.js.map +1 -1
  197. package/lib/component/workspaces/workspaceDefaultProperties.d.ts.map +1 -1
  198. package/lib/component/workspaces/workspaceDefaultProperties.js +19 -2
  199. package/lib/component/workspaces/workspaceDefaultProperties.js.map +1 -1
  200. package/lib/data/data1d/Spectrum1D/initiateDatum1D.d.ts.map +1 -1
  201. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +13 -5
  202. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js.map +1 -1
  203. package/lib/data/data2d/Spectrum2D/initiateDatum2D.d.ts.map +1 -1
  204. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +12 -4
  205. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js.map +1 -1
  206. package/lib/data/data2d/Spectrum2D/isSpectrum2D.d.ts +1 -1
  207. package/lib/data/data2d/Spectrum2D/isSpectrum2D.d.ts.map +1 -1
  208. package/lib/data/data2d/Spectrum2D/isSpectrum2D.js.map +1 -1
  209. package/lib/data/utilities/RangeUtilities.d.ts +1 -6
  210. package/lib/data/utilities/RangeUtilities.d.ts.map +1 -1
  211. package/lib/data/utilities/RangeUtilities.js +10 -27
  212. package/lib/data/utilities/RangeUtilities.js.map +1 -1
  213. package/lib/versionInfo.js +1 -1
  214. package/package.json +15 -14
  215. package/src/component/1d/HorizontalAxis1D.tsx +12 -2
  216. package/src/component/1d/SVGContent1D.tsx +2 -0
  217. package/src/component/1d/Viewer1D.tsx +2 -0
  218. package/src/component/1d/integral/IntegralResizable.tsx +6 -6
  219. package/src/component/1d/ranges/Range.tsx +6 -6
  220. package/src/component/1d/ranges/Signals.tsx +28 -0
  221. package/src/component/1d-2d/components/RangeIndicator.tsx +106 -0
  222. package/src/component/1d-2d/components/Signals1D.tsx +306 -0
  223. package/src/component/1d-2d/tools/CrossLinePointer.tsx +75 -32
  224. package/src/component/1d-2d/tools/CursorToolIcon.tsx +110 -0
  225. package/src/component/2d/1d-tracer/Left1DChart.tsx +4 -2
  226. package/src/component/2d/1d-tracer/Ranges1D.tsx +4 -100
  227. package/src/component/2d/1d-tracer/Top1DChart.tsx +4 -2
  228. package/src/component/2d/DirectAxis2D.tsx +12 -3
  229. package/src/component/2d/IndirectAxis2D.tsx +9 -5
  230. package/src/component/2d/Viewer2D.tsx +5 -2
  231. package/src/component/AnchorSVG.tsx +27 -28
  232. package/src/component/EventsTrackers/BrushTracker.tsx +21 -7
  233. package/src/component/EventsTrackers/MouseTracker.tsx +21 -0
  234. package/src/component/context/KeyModifierContext.tsx +27 -8
  235. package/src/component/elements/D3Axis.tsx +31 -9
  236. package/src/component/header/AutoPeakPickingOptionPanel.tsx +173 -102
  237. package/src/component/header/RangesPickingOptionPanel.tsx +72 -59
  238. package/src/component/hooks/useAddMultipletSignal.tsx +32 -0
  239. package/src/component/hooks/useFilter.ts +2 -1
  240. package/src/component/hooks/useSpectrum.ts +7 -1
  241. package/src/component/hooks/useSpectrumWithDataSource.ts +16 -8
  242. package/src/component/hooks/use_ticks_config.ts +1 -7
  243. package/src/component/modal/PublicationStringModal.tsx +3 -3
  244. package/src/component/modal/setting/tanstack_general_settings/tabs/axis_tab.tsx +76 -12
  245. package/src/component/modal/setting/tanstack_general_settings/validation/axis_tab_validation.ts +16 -2
  246. package/src/component/panels/MoleculesPanel/hooks/useAtomAssignment.tsx +1 -1
  247. package/src/component/panels/RangesPanel/RangesPanel.tsx +1 -3
  248. package/src/component/panels/RangesPanel/RangesTableRow.tsx +10 -12
  249. package/src/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.tsx +2 -2
  250. package/src/component/panels/filtersPanel/processings_sections_panel.tsx +27 -44
  251. package/src/component/panels/hooks/use_processings_mutation.ts +171 -0
  252. package/src/component/panels/informationPanel/InformationPanel.tsx +1 -1
  253. package/src/component/reducer/Reducer.ts +2 -0
  254. package/src/component/reducer/actions/CorrelationsActions.ts +1 -1
  255. package/src/component/reducer/actions/FiltersActions.ts +1 -1
  256. package/src/component/reducer/actions/RangesActions.ts +14 -25
  257. package/src/component/reducer/actions/SpectraActions.ts +20 -1
  258. package/src/component/reducer/preferences/actions/setPreferences.ts +18 -10
  259. package/src/component/reducer/preferences/preferencesReducer.ts +1 -1
  260. package/src/component/toolbar/ToolTypes.ts +92 -1
  261. package/src/component/toolbar/nmr_toolbar.tsx +12 -69
  262. package/src/component/workspaces/workspaceDefaultProperties.ts +19 -2
  263. package/src/data/data1d/Spectrum1D/initiateDatum1D.ts +14 -8
  264. package/src/data/data2d/Spectrum2D/initiateDatum2D.ts +12 -4
  265. package/src/data/data2d/Spectrum2D/isSpectrum2D.ts +1 -1
  266. package/src/data/utilities/RangeUtilities.ts +12 -36
  267. package/src/versionInfo.ts +1 -1
  268. package/lib/component/1d/integral/IntegralIndicator.d.ts +0 -9
  269. package/lib/component/1d/integral/IntegralIndicator.d.ts.map +0 -1
  270. package/lib/component/1d/integral/IntegralIndicator.js +0 -22
  271. package/lib/component/1d/integral/IntegralIndicator.js.map +0 -1
  272. package/lib/component/2d/1d-tracer/Signals1D.d.ts +0 -11
  273. package/lib/component/2d/1d-tracer/Signals1D.d.ts.map +0 -1
  274. package/lib/component/2d/1d-tracer/Signals1D.js +0 -90
  275. package/lib/component/2d/1d-tracer/Signals1D.js.map +0 -1
  276. package/src/component/1d/integral/IntegralIndicator.tsx +0 -43
  277. package/src/component/2d/1d-tracer/Signals1D.tsx +0 -145
@@ -77,8 +77,25 @@ export const workspaceDefaultProperties: RequiredWorkspacePreferences = {
77
77
  } satisfies Required<WorkspacePreferences['display']>,
78
78
 
79
79
  axis: {
80
- secondaryTicks: { enabled: true },
81
- primaryTicks: { textStyle: { fontSize: 10 } },
80
+ labelStyle: {
81
+ fontSize: 10,
82
+ },
83
+ secondaryTicks: {
84
+ enabled: true,
85
+ tickStyle: {
86
+ strokeWidth: 1,
87
+ strokeOpacity: 1,
88
+ stroke: '#000000',
89
+ },
90
+ },
91
+ primaryTicks: {
92
+ textStyle: { fontSize: 10 },
93
+ tickStyle: {
94
+ strokeWidth: 1,
95
+ strokeOpacity: 1,
96
+ stroke: '#000000',
97
+ },
98
+ },
82
99
  gridlines1D: {
83
100
  primary: {
84
101
  enabled: true,
@@ -2,6 +2,7 @@ import type {
2
2
  Spectrum1D,
3
3
  SpectrumOneDimensionColor,
4
4
  } from '@zakodium/nmrium-core';
5
+ import { sliceData1D } from '@zakodium/nmrium-core';
5
6
  import { Filters1DManager } from 'nmr-processing';
6
7
 
7
8
  import type { UsedColors } from '../../../types/UsedColors.js';
@@ -46,15 +47,18 @@ export function initiateDatum1D(
46
47
  },
47
48
  };
48
49
 
49
- spectrumObj.originalInfo = spectrumObj.info;
50
-
51
- spectrumObj.meta = { ...spectrum.meta };
52
-
53
- spectrumObj.customInfo = { ...spectrum.customInfo };
50
+ // Now, processings can happen before loading in component
51
+ if (!spectrumObj.originalInfo) {
52
+ spectrumObj.originalInfo = structuredClone(spectrumObj.info);
53
+ }
54
54
 
55
55
  spectrumObj.data = convertDataToFloat64Array(spectrum.data);
56
+ if (!spectrumObj.originalData) {
57
+ spectrumObj.originalData = sliceData1D(spectrumObj.data);
58
+ }
56
59
 
57
- spectrumObj.originalData = spectrumObj.data;
60
+ spectrumObj.meta = { ...spectrum.meta };
61
+ spectrumObj.customInfo = { ...spectrum.customInfo };
58
62
 
59
63
  spectrumObj.filters = initiateFilters(spectrum?.filters); //array of object {name: "FilterName", options: FilterOptions = {value | object} }
60
64
 
@@ -81,8 +85,10 @@ export function initiateDatum1D(
81
85
  });
82
86
  spectrumObj.ranges = initiateRanges(spectrum, spectrumObj, rangesOptions);
83
87
 
84
- //reapply filters after load the original data
85
- Filters1DManager.reapplyFilters(spectrumObj);
88
+ if (!spectrumObj.processings) {
89
+ //reapply filters after load the original data
90
+ Filters1DManager.reapplyFilters(spectrumObj);
91
+ }
86
92
 
87
93
  return spectrumObj;
88
94
  }
@@ -2,6 +2,7 @@ import type {
2
2
  Spectrum2D,
3
3
  SpectrumTwoDimensionsColor,
4
4
  } from '@zakodium/nmrium-core';
5
+ import { sliceData2D } from '@zakodium/nmrium-core';
5
6
  import { Filters2DManager } from 'nmr-processing';
6
7
 
7
8
  import type { UsedColors } from '../../../types/UsedColors.js';
@@ -51,20 +52,27 @@ export function initiateDatum2D(
51
52
  info: initiateInfo(spectrum),
52
53
  };
53
54
 
54
- datum.originalInfo = datum.info;
55
+ // Now, processings can happen before loading in component
56
+ if (!datum.originalInfo) {
57
+ datum.originalInfo = structuredClone(datum.info);
58
+ }
55
59
 
56
60
  datum.meta = { ...spectrum.meta };
57
61
 
58
62
  datum.customInfo = { ...spectrum.customInfo };
59
63
 
60
64
  datum.data = getData(datum, spectrum);
61
- datum.originalData = datum.data;
65
+ if (!datum.originalData) {
66
+ datum.originalData = sliceData2D(datum.data);
67
+ }
62
68
  datum.filters = initiateFilters(spectrum?.filters);
63
69
 
64
70
  datum.zones = initiateZones(spectrum, datum);
65
71
 
66
- //reapply filters after load the original data
67
- Filters2DManager.reapplyFilters(datum);
72
+ if (!datum.processings) {
73
+ //reapply filters after load the original data
74
+ Filters2DManager.reapplyFilters(datum);
75
+ }
68
76
 
69
77
  // datum.display.contourOptions = initializeSpectrumContoursOptions(datum);
70
78
 
@@ -30,7 +30,7 @@ export function isFt2DSpectrum(
30
30
  return isSpectrum2D(spectrum) && isFt2DData(spectrum.data);
31
31
  }
32
32
  export function isQuadrants2DSpectrum(
33
- spectrum: Spectrum,
33
+ spectrum: Spectrum | undefined,
34
34
  ): spectrum is Spectrum2D & { data: NmrData2DFt } {
35
35
  return isSpectrum2D(spectrum) && isQuadrantsData(spectrum.data);
36
36
  }
@@ -1,43 +1,19 @@
1
1
  import type { Range, Signal1D } from '@zakodium/nmr-types';
2
- import omit from 'lodash/omit.js';
3
2
 
4
- function resetDiaIDs(range: Range) {
5
- const deletedKeys = ['diaIDs', 'nbAtoms'];
6
- range = omit(range, deletedKeys) as Range;
7
- range.signals = range.signals.map((signal) => {
8
- return omit(signal, deletedKeys) as Signal1D;
9
- });
10
- return range;
3
+ function omitSignalKeys(signal: Signal1D): Signal1D {
4
+ const { diaIDs, nbAtoms, ...rest } = signal;
5
+ return rest;
11
6
  }
12
7
 
13
- interface UnlinkOptions {
14
- unlinkType?: 'both' | 'range' | 'signal';
15
- signalIndex?: number;
16
- }
17
-
18
- export function unlink(range: Range, options: UnlinkOptions = {}): Range {
19
- const { unlinkType = 'both', signalIndex = -1 } = options;
20
- const keys = ['diaIDs', 'nbAtoms'];
21
-
22
- switch (unlinkType) {
23
- case 'both':
24
- range = resetDiaIDs(range);
25
- break;
26
- case 'range':
27
- range = omit(range, keys) as Range;
28
- break;
29
- case 'signal':
30
- if (signalIndex !== -1) {
31
- range.signals[signalIndex] = omit(
32
- range.signals[signalIndex],
33
- keys,
34
- ) as Signal1D;
35
- }
36
- break;
37
- default:
38
- break;
39
- }
40
- return range;
8
+ export function unlink(range: Range, signalIndex?: number): Range {
9
+ return {
10
+ ...range,
11
+ signals: range.signals.map((signal, index) =>
12
+ signalIndex === undefined || index === signalIndex
13
+ ? omitSignalKeys(signal)
14
+ : signal,
15
+ ),
16
+ };
41
17
  }
42
18
 
43
19
  export function getOpacityBasedOnSignalKind(input: Range | Signal1D) {
@@ -1 +1 @@
1
- export default { version: 'v2.4.0' };
1
+ export default { version: 'v2.5.0' };
@@ -1,9 +0,0 @@
1
- interface IntegralIndicatorProps {
2
- value: number | undefined;
3
- format: string;
4
- width: number;
5
- opacity?: number;
6
- }
7
- export declare function IntegralIndicator(props: IntegralIndicatorProps): import("react").JSX.Element;
8
- export {};
9
- //# sourceMappingURL=IntegralIndicator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IntegralIndicator.d.ts","sourceRoot":"","sources":["../../../../src/component/1d/integral/IntegralIndicator.tsx"],"names":[],"mappings":"AAKA,UAAU,sBAAsB;IAC9B,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAeD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,+BAiB9D"}
@@ -1,22 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useChartData } from '../../context/ChartContext.js';
3
- import { formatNumber } from '../../utility/formatNumber.js';
4
- const styles = {
5
- text: {
6
- fontSize: '11px',
7
- fill: 'black',
8
- },
9
- path: {
10
- fill: 'none',
11
- strokeWidth: '1px',
12
- shapeRendering: 'crispEdges',
13
- stroke: 'black',
14
- },
15
- };
16
- export function IntegralIndicator(props) {
17
- const { value, width, format, opacity = 1 } = props;
18
- const { height, margin } = useChartData();
19
- const bottom = height - margin.bottom;
20
- return (_jsxs("g", { transform: `translate(0 ${bottom - 10})`, style: { opacity }, children: [_jsx("text", { transform: `rotate(-90) translate(5 ${Math.round(width / 2) + 4})`, style: styles.text, children: value ? formatNumber(value, format) : '' }), _jsx("path", { style: styles.path, d: `M0 0 L0 5 L${width} 5 L${width} 0 ` })] }));
21
- }
22
- //# sourceMappingURL=IntegralIndicator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IntegralIndicator.js","sourceRoot":"","sources":["../../../../src/component/1d/integral/IntegralIndicator.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAS7D,MAAM,MAAM,GAA2C;IACrD,IAAI,EAAE;QACJ,QAAQ,EAAE,MAAM;QAChB,IAAI,EAAE,OAAO;KACd;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,KAAK;QAClB,cAAc,EAAE,YAAY;QAC5B,MAAM,EAAE,OAAO;KAChB;CACF,CAAC;AAEF,MAAM,UAAU,iBAAiB,CAAC,KAA6B;IAC7D,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,GAAG,CAAC,EAAE,GAAG,KAAK,CAAC;IACpD,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,YAAY,EAAE,CAAC;IAE1C,MAAM,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAEtC,OAAO,CACL,aAAG,SAAS,EAAE,eAAe,MAAM,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,aAC7D,eACE,SAAS,EAAE,2BAA2B,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,EAClE,KAAK,EAAE,MAAM,CAAC,IAAI,YAEjB,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,GACpC,EACP,eAAM,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,EAAE,cAAc,KAAK,OAAO,KAAK,KAAK,GAAI,IACnE,CACL,CAAC;AACJ,CAAC"}
@@ -1,11 +0,0 @@
1
- import type { Range } from '@zakodium/nmr-types';
2
- import type { RefObject } from 'react';
3
- interface Signals1DProps {
4
- spectrumId: string;
5
- ranges: Range[];
6
- svgRef: RefObject<SVGSVGElement>;
7
- orientation: 'horizontal' | 'vertical';
8
- }
9
- export declare function Signals1D(props: Signals1DProps): import("react").JSX.Element;
10
- export {};
11
- //# sourceMappingURL=Signals1D.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Signals1D.d.ts","sourceRoot":"","sources":["../../../../src/component/2d/1d-tracer/Signals1D.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAY,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAQvC,UAAU,cAAc;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,MAAM,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC;IACjC,WAAW,EAAE,YAAY,GAAG,UAAU,CAAC;CACxC;AAQD,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,+BA0H9C"}
@@ -1,90 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useMemo, useRef, useState } from 'react';
3
- import { Anchor } from "../../AnchorSVG.js";
4
- import { useChartData } from "../../context/ChartContext.js";
5
- import { useDispatch } from "../../context/DispatchContext.js";
6
- import { useScale2DX, useScale2DY } from '../utilities/scale.js';
7
- export function Signals1D(props) {
8
- const { ranges, svgRef, orientation, spectrumId } = props;
9
- const { margin: { top, left }, } = useChartData();
10
- const scaleX = useScale2DX();
11
- const scaleY = useScale2DY();
12
- const size = orientation === 'horizontal' ? top : left;
13
- const scale = orientation === 'horizontal' ? scaleX : scaleY;
14
- const draggingAnchorRef = useRef(null);
15
- // Only used during active drag for local updates
16
- const [draggingAnchor, setDraggingAnchor] = useState(null);
17
- const dispatch = useDispatch();
18
- function handleDragMove(index, newPosition, range) {
19
- // console.log(newX)
20
- const delta = orientation === 'horizontal' ? newPosition.x : newPosition.y;
21
- const from = orientation === 'horizontal' ? range.from : range.to;
22
- const to = orientation === 'horizontal' ? range.to : range.from;
23
- const clampedX = Math.max(scale(to), Math.min(scale(from), delta));
24
- const updated = { index, delta: scale.invert(clampedX) };
25
- draggingAnchorRef.current = updated;
26
- setDraggingAnchor(updated);
27
- }
28
- function handleDragEnd(signal) {
29
- const finalDelta = draggingAnchorRef.current?.delta;
30
- if (!finalDelta)
31
- return;
32
- draggingAnchorRef.current = null;
33
- setDraggingAnchor(null);
34
- dispatch({
35
- type: 'CHANGE_SIGNAL_DELTA',
36
- payload: {
37
- value: finalDelta,
38
- rangeId: signal.rangeID,
39
- signalId: signal.id,
40
- spectrumId,
41
- },
42
- });
43
- }
44
- function handleDelete(signal) {
45
- dispatch({
46
- type: 'DELETE_1D_SIGNAL',
47
- payload: {
48
- rangeId: signal.rangeID,
49
- signalId: signal.id,
50
- spectrumId,
51
- },
52
- });
53
- }
54
- const signals = useMemo(() => {
55
- const result = [];
56
- let flatIndex = 0;
57
- for (const range of ranges ?? []) {
58
- for (const signal of range.signals ?? []) {
59
- const isDragging = draggingAnchor?.index === flatIndex;
60
- result.push({
61
- ...signal,
62
- delta: isDragging ? draggingAnchor.delta : signal.delta,
63
- from: range.from,
64
- to: range.to,
65
- rangeID: range.id,
66
- });
67
- flatIndex++;
68
- }
69
- }
70
- return result;
71
- }, [ranges, draggingAnchor?.index, draggingAnchor?.delta]);
72
- return (_jsx("g", { children: signals.map((signal, index) => {
73
- const { rangeID, id, delta, from, to } = signal;
74
- const x = orientation === 'horizontal' ? scale(delta) : size - 5;
75
- const y = orientation === 'horizontal' ? size - 5 : scale(delta);
76
- return (_jsx(Anchor, { position: { x, y }, svgRef: svgRef, shape: "circle", onDragMove: (newPosition) => handleDragMove(index, newPosition, { from, to }), onDragEnd: () => handleDragEnd(signal), onDelete: () => handleDelete(signal), cursorOrientation: orientation, anchorStyle: {
77
- guideStyle: 'dashed',
78
- size: 8,
79
- hoverSize: 15,
80
- dragSize: 15,
81
- hoverStroke: 'red',
82
- dragStroke: 'darkgreen',
83
- guideColor: 'red',
84
- guideDragColor: 'darkgreen',
85
- fill: 'red',
86
- stroke: 'transparent',
87
- }, svgHeight: 100 }, `${id}-${rangeID}`));
88
- }) }));
89
- }
90
- //# sourceMappingURL=Signals1D.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Signals1D.js","sourceRoot":"","sources":["../../../../src/component/2d/1d-tracer/Signals1D.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAElD,OAAO,EAA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,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,EAElD,SAAS,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,EACtC,QAAQ,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,EACpC,iBAAiB,EAAE,WAAW,EAC9B,WAAW,EAAE;oBACX,UAAU,EAAE,QAAQ;oBACpB,IAAI,EAAE,CAAC;oBACP,SAAS,EAAE,EAAE;oBACb,QAAQ,EAAE,EAAE;oBACZ,WAAW,EAAE,KAAK;oBAClB,UAAU,EAAE,WAAW;oBACvB,UAAU,EAAE,KAAK;oBACjB,cAAc,EAAE,WAAW;oBAC3B,IAAI,EAAE,KAAK;oBACX,MAAM,EAAE,aAAa;iBACtB,EACD,SAAS,EAAE,GAAG,IAtBT,GAAG,EAAE,IAAI,OAAO,EAAE,CAuBvB,CACH,CAAC;QACJ,CAAC,CAAC,GACA,CACL,CAAC;AACJ,CAAC"}
@@ -1,43 +0,0 @@
1
- import type { CSSProperties } from 'react';
2
-
3
- import { useChartData } from '../../context/ChartContext.js';
4
- import { formatNumber } from '../../utility/formatNumber.js';
5
-
6
- interface IntegralIndicatorProps {
7
- value: number | undefined;
8
- format: string;
9
- width: number;
10
- opacity?: number;
11
- }
12
-
13
- const styles: Record<'text' | 'path', CSSProperties> = {
14
- text: {
15
- fontSize: '11px',
16
- fill: 'black',
17
- },
18
- path: {
19
- fill: 'none',
20
- strokeWidth: '1px',
21
- shapeRendering: 'crispEdges',
22
- stroke: 'black',
23
- },
24
- };
25
-
26
- export function IntegralIndicator(props: IntegralIndicatorProps) {
27
- const { value, width, format, opacity = 1 } = props;
28
- const { height, margin } = useChartData();
29
-
30
- const bottom = height - margin.bottom;
31
-
32
- return (
33
- <g transform={`translate(0 ${bottom - 10})`} style={{ opacity }}>
34
- <text
35
- transform={`rotate(-90) translate(5 ${Math.round(width / 2) + 4})`}
36
- style={styles.text}
37
- >
38
- {value ? formatNumber(value, format) : ''}
39
- </text>
40
- <path style={styles.path} d={`M0 0 L0 5 L${width} 5 L${width} 0 `} />
41
- </g>
42
- );
43
- }
@@ -1,145 +0,0 @@
1
- import type { Range, Signal1D } from '@zakodium/nmr-types';
2
- import type { RefObject } from 'react';
3
- import { useMemo, useRef, useState } from 'react';
4
-
5
- import { Anchor } from '../../AnchorSVG.tsx';
6
- import { useChartData } from '../../context/ChartContext.tsx';
7
- import { useDispatch } from '../../context/DispatchContext.tsx';
8
- import { useScale2DX, useScale2DY } from '../utilities/scale.js';
9
-
10
- interface Signals1DProps {
11
- spectrumId: string;
12
- ranges: Range[];
13
- svgRef: RefObject<SVGSVGElement>;
14
- orientation: 'horizontal' | 'vertical';
15
- }
16
-
17
- interface SignalWithRange extends Signal1D {
18
- from: number;
19
- to: number;
20
- rangeID: string;
21
- }
22
-
23
- export function Signals1D(props: Signals1DProps) {
24
- const { ranges, svgRef, orientation, spectrumId } = props;
25
- const {
26
- margin: { top, left },
27
- } = useChartData();
28
- const scaleX = useScale2DX();
29
- const scaleY = useScale2DY();
30
- const size = orientation === 'horizontal' ? top : left;
31
- const scale = orientation === 'horizontal' ? scaleX : scaleY;
32
- const draggingAnchorRef = useRef<{ index: number; delta: number } | null>(
33
- null,
34
- );
35
- // Only used during active drag for local updates
36
- const [draggingAnchor, setDraggingAnchor] = useState<{
37
- index: number;
38
- delta: number;
39
- } | null>(null);
40
- const dispatch = useDispatch();
41
-
42
- function handleDragMove(
43
- index: number,
44
- newPosition: { x: number; y: number },
45
- range: { from: number; to: number },
46
- ) {
47
- // console.log(newX)
48
-
49
- const delta = orientation === 'horizontal' ? newPosition.x : newPosition.y;
50
- const from = orientation === 'horizontal' ? range.from : range.to;
51
- const to = orientation === 'horizontal' ? range.to : range.from;
52
- const clampedX = Math.max(scale(to), Math.min(scale(from), delta));
53
- const updated = { index, delta: scale.invert(clampedX) };
54
- draggingAnchorRef.current = updated;
55
- setDraggingAnchor(updated);
56
- }
57
- function handleDragEnd(signal: SignalWithRange) {
58
- const finalDelta = draggingAnchorRef.current?.delta;
59
-
60
- if (!finalDelta) return;
61
-
62
- draggingAnchorRef.current = null;
63
- setDraggingAnchor(null);
64
- dispatch({
65
- type: 'CHANGE_SIGNAL_DELTA',
66
- payload: {
67
- value: finalDelta,
68
- rangeId: signal.rangeID,
69
- signalId: signal.id,
70
- spectrumId,
71
- },
72
- });
73
- }
74
-
75
- function handleDelete(signal: SignalWithRange) {
76
- dispatch({
77
- type: 'DELETE_1D_SIGNAL',
78
- payload: {
79
- rangeId: signal.rangeID,
80
- signalId: signal.id,
81
- spectrumId,
82
- },
83
- });
84
- }
85
-
86
- const signals = useMemo(() => {
87
- const result: SignalWithRange[] = [];
88
- let flatIndex = 0;
89
-
90
- for (const range of ranges ?? []) {
91
- for (const signal of range.signals ?? []) {
92
- const isDragging = draggingAnchor?.index === flatIndex;
93
-
94
- result.push({
95
- ...signal,
96
- delta: isDragging ? draggingAnchor.delta : signal.delta,
97
- from: range.from,
98
- to: range.to,
99
- rangeID: range.id,
100
- });
101
-
102
- flatIndex++;
103
- }
104
- }
105
-
106
- return result;
107
- }, [ranges, draggingAnchor?.index, draggingAnchor?.delta]);
108
- return (
109
- <g>
110
- {signals.map((signal, index) => {
111
- const { rangeID, id, delta, from, to } = signal;
112
- const x = orientation === 'horizontal' ? scale(delta) : size - 5;
113
- const y = orientation === 'horizontal' ? size - 5 : scale(delta);
114
-
115
- return (
116
- <Anchor
117
- key={`${id}-${rangeID}`}
118
- position={{ x, y }}
119
- svgRef={svgRef}
120
- shape="circle"
121
- onDragMove={(newPosition) =>
122
- handleDragMove(index, newPosition, { from, to })
123
- }
124
- onDragEnd={() => handleDragEnd(signal)}
125
- onDelete={() => handleDelete(signal)}
126
- cursorOrientation={orientation}
127
- anchorStyle={{
128
- guideStyle: 'dashed',
129
- size: 8,
130
- hoverSize: 15,
131
- dragSize: 15,
132
- hoverStroke: 'red',
133
- dragStroke: 'darkgreen',
134
- guideColor: 'red',
135
- guideDragColor: 'darkgreen',
136
- fill: 'red',
137
- stroke: 'transparent',
138
- }}
139
- svgHeight={100}
140
- />
141
- );
142
- })}
143
- </g>
144
- );
145
- }