nmrium 0.31.0 → 0.33.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 (178) hide show
  1. package/lib/component/1d/Chart1D.js +1 -1
  2. package/lib/component/1d/FooterBanner.js +17 -10
  3. package/lib/component/1d/{Integral.d.ts → integral/Integral.d.ts} +0 -0
  4. package/lib/component/1d/{Integral.js → integral/Integral.js} +2 -2
  5. package/lib/component/1d/integral/IntegralIndicator.d.ts +9 -0
  6. package/lib/component/1d/integral/IntegralIndicator.js +27 -0
  7. package/lib/component/1d/{IntegralResizable.d.ts → integral/IntegralResizable.d.ts} +0 -0
  8. package/lib/component/1d/integral/IntegralResizable.js +69 -0
  9. package/lib/component/1d/{IntegralsSeries.d.ts → integral/IntegralsSeries.d.ts} +0 -0
  10. package/lib/component/1d/{IntegralsSeries.js → integral/IntegralsSeries.js} +3 -3
  11. package/lib/component/1d/ranges/Range.js +27 -50
  12. package/lib/component/1d/utilities/scale.js +2 -2
  13. package/lib/component/2d/Contours.js +61 -42
  14. package/lib/component/2d/Left1DChart.js +1 -1
  15. package/lib/component/2d/Top1DChart.js +1 -1
  16. package/lib/component/EventsTrackers/BrushTracker.js +30 -21
  17. package/lib/component/NMRium.d.ts +1 -1
  18. package/lib/component/NMRium.js +1 -1
  19. package/lib/component/SplitPaneWrapper.js +1 -1
  20. package/lib/component/elements/EditableColumn.d.ts +3 -1
  21. package/lib/component/elements/EditableColumn.js +18 -3
  22. package/lib/component/elements/formik/FormikColorPicker.d.ts +0 -1
  23. package/lib/component/elements/formik/FormikColorPicker.js +5 -8
  24. package/lib/component/elements/formik/FormikInput.d.ts +0 -1
  25. package/lib/component/elements/formik/FormikInput.js +8 -19
  26. package/lib/component/elements/formik/FormikOnChange.d.ts +1 -1
  27. package/lib/component/elements/formik/FormikOnChange.js +13 -10
  28. package/lib/component/elements/formik/FormikSlider.d.ts +2 -4
  29. package/lib/component/elements/formik/FormikSlider.js +8 -11
  30. package/lib/component/hooks/useActiveSpectrumStyleOptions.js +1 -1
  31. package/lib/component/hooks/useExport.js +1 -1
  32. package/lib/component/loader/DropZone.js +9 -1
  33. package/lib/component/modal/ExportAsMatrixModal.js +1 -1
  34. package/lib/component/modal/editRange/forms/components/SignalFormInfo.js +1 -1
  35. package/lib/component/modal/setting/GeneralTabContent.js +1 -1
  36. package/lib/component/panels/MoleculesPanel/MoleculeHeader.js +1 -1
  37. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +1 -1
  38. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
  39. package/lib/component/panels/PeaksPanel/PeaksTable.js +1 -1
  40. package/lib/component/panels/RangesPanel/RangesHeader.js +1 -1
  41. package/lib/component/panels/RangesPanel/RangesPanel.js +1 -1
  42. package/lib/component/panels/RangesPanel/RangesTableRow.js +1 -3
  43. package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +1 -1
  44. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.d.ts +1 -1
  45. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.js +2 -1
  46. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.d.ts +1 -1
  47. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.js +2 -1
  48. package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +3 -26
  49. package/lib/component/panels/extra/preferences/ColumnsHelper.js +5 -2
  50. package/lib/component/reducer/Reducer.d.ts +20 -59
  51. package/lib/component/reducer/Reducer.js +24 -10
  52. package/lib/component/reducer/actions/DomainActions.js +3 -2
  53. package/lib/component/reducer/actions/FiltersActions.js +12 -3
  54. package/lib/component/reducer/actions/IntegralsActions.js +6 -5
  55. package/lib/component/reducer/actions/PeaksActions.js +7 -6
  56. package/lib/component/reducer/actions/PreferencesActions.js +18 -36
  57. package/lib/component/reducer/actions/RangesActions.d.ts +1 -1
  58. package/lib/component/reducer/actions/RangesActions.js +20 -16
  59. package/lib/component/reducer/actions/SpectrumsActions.js +13 -6
  60. package/lib/component/reducer/actions/ToolsActions.d.ts +1 -1
  61. package/lib/component/reducer/actions/ToolsActions.js +15 -28
  62. package/lib/component/reducer/actions/ZonesActions.js +9 -8
  63. package/lib/component/reducer/core/Constants.js +1 -1
  64. package/lib/component/reducer/helper/getActiveSpectrum.d.ts +3 -0
  65. package/lib/component/reducer/helper/getActiveSpectrum.js +4 -0
  66. package/lib/component/reducer/preferences/preferencesReducer.d.ts +2 -2
  67. package/lib/component/toolbar/BasicToolBar.js +8 -7
  68. package/lib/component/utility/FileUtility.d.ts +1 -8
  69. package/lib/component/utility/FileUtility.js +2 -17
  70. package/lib/component/utility/{Export.d.ts → export.d.ts} +0 -0
  71. package/lib/component/utility/{Export.js → export.js} +27 -44
  72. package/lib/component/utility/formatNumber.d.ts +6 -1
  73. package/lib/component/utility/formatNumber.js +4 -3
  74. package/lib/component/workspaces/Workspace.d.ts +1 -1
  75. package/lib/component/workspaces/exercise.js +4 -4
  76. package/lib/component/workspaces/workspaceDefaultProperties.js +1 -1
  77. package/lib/data/Filters.d.ts +1 -2
  78. package/lib/data/Filters.js +1 -2
  79. package/lib/data/SpectraManager.d.ts +1 -2
  80. package/lib/data/SpectraManager.js +22 -55
  81. package/lib/data/data1d/filter1d/fft.js +21 -4
  82. package/lib/data/data1d/filter1d/phaseCorrection.js +11 -5
  83. package/lib/data/data2d/Processing2D.js +3 -2
  84. package/lib/data/data2d/Spectrum2D/contours.d.ts +40 -0
  85. package/lib/data/data2d/Spectrum2D/contours.js +132 -0
  86. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +2 -3
  87. package/lib/data/types/common/Source.d.ts +1 -0
  88. package/lib/data/types/data2d/Data2D.d.ts +2 -0
  89. package/lib/data/types/data2d/Datum2D.d.ts +0 -1
  90. package/lib/data/utilities/calculateSanPlot.d.ts +8 -0
  91. package/lib/data/utilities/calculateSanPlot.js +31 -0
  92. package/lib/types/NMRiumGeneralPreferences.d.ts +2 -2
  93. package/lib/versionInfo.js +1 -1
  94. package/lib-cjs/component/1d/Chart1D.js +1 -1
  95. package/lib-cjs/component/1d/FooterBanner.js +16 -9
  96. package/lib-cjs/component/1d/{Integral.js → integral/Integral.js} +2 -2
  97. package/lib-cjs/component/1d/integral/IntegralIndicator.js +31 -0
  98. package/lib-cjs/component/1d/integral/IntegralResizable.js +74 -0
  99. package/lib-cjs/component/1d/{IntegralsSeries.js → integral/IntegralsSeries.js} +3 -3
  100. package/lib-cjs/component/1d/ranges/Range.js +27 -50
  101. package/lib-cjs/component/1d/utilities/scale.js +2 -2
  102. package/lib-cjs/component/2d/Contours.js +60 -41
  103. package/lib-cjs/component/2d/Left1DChart.js +1 -1
  104. package/lib-cjs/component/2d/Top1DChart.js +1 -1
  105. package/lib-cjs/component/EventsTrackers/BrushTracker.js +30 -21
  106. package/lib-cjs/component/NMRium.js +2 -2
  107. package/lib-cjs/component/SplitPaneWrapper.js +1 -1
  108. package/lib-cjs/component/elements/EditableColumn.js +18 -3
  109. package/lib-cjs/component/elements/formik/FormikColorPicker.js +4 -7
  110. package/lib-cjs/component/elements/formik/FormikInput.js +8 -19
  111. package/lib-cjs/component/elements/formik/FormikOnChange.js +13 -10
  112. package/lib-cjs/component/elements/formik/FormikSlider.js +7 -10
  113. package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +1 -1
  114. package/lib-cjs/component/hooks/useExport.js +6 -6
  115. package/lib-cjs/component/loader/DropZone.js +9 -1
  116. package/lib-cjs/component/modal/ExportAsMatrixModal.js +2 -2
  117. package/lib-cjs/component/modal/editRange/forms/components/SignalFormInfo.js +1 -1
  118. package/lib-cjs/component/modal/setting/GeneralTabContent.js +1 -1
  119. package/lib-cjs/component/panels/MoleculesPanel/MoleculeHeader.js +1 -1
  120. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +4 -4
  121. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +2 -2
  122. package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +1 -1
  123. package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +2 -2
  124. package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +2 -2
  125. package/lib-cjs/component/panels/RangesPanel/RangesTableRow.js +1 -3
  126. package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +2 -2
  127. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.js +2 -1
  128. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.js +2 -1
  129. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -25
  130. package/lib-cjs/component/panels/extra/preferences/ColumnsHelper.js +5 -2
  131. package/lib-cjs/component/reducer/Reducer.js +23 -9
  132. package/lib-cjs/component/reducer/actions/DomainActions.js +3 -2
  133. package/lib-cjs/component/reducer/actions/FiltersActions.js +12 -3
  134. package/lib-cjs/component/reducer/actions/IntegralsActions.js +6 -5
  135. package/lib-cjs/component/reducer/actions/PeaksActions.js +7 -6
  136. package/lib-cjs/component/reducer/actions/PreferencesActions.js +18 -36
  137. package/lib-cjs/component/reducer/actions/RangesActions.js +20 -16
  138. package/lib-cjs/component/reducer/actions/SpectrumsActions.js +12 -5
  139. package/lib-cjs/component/reducer/actions/ToolsActions.js +15 -28
  140. package/lib-cjs/component/reducer/actions/ZonesActions.js +9 -8
  141. package/lib-cjs/component/reducer/core/Constants.js +1 -1
  142. package/lib-cjs/component/reducer/helper/getActiveSpectrum.js +8 -0
  143. package/lib-cjs/component/toolbar/BasicToolBar.js +7 -6
  144. package/lib-cjs/component/utility/FileUtility.js +2 -18
  145. package/lib-cjs/component/utility/{Export.js → export.js} +51 -45
  146. package/lib-cjs/component/utility/formatNumber.js +4 -3
  147. package/lib-cjs/component/workspaces/exercise.js +4 -4
  148. package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +1 -1
  149. package/lib-cjs/data/Filters.js +1 -3
  150. package/lib-cjs/data/SpectraManager.js +23 -57
  151. package/lib-cjs/data/data1d/filter1d/fft.js +20 -3
  152. package/lib-cjs/data/data1d/filter1d/phaseCorrection.js +10 -4
  153. package/lib-cjs/data/data2d/Processing2D.js +3 -2
  154. package/lib-cjs/data/data2d/Spectrum2D/contours.js +138 -0
  155. package/lib-cjs/data/data2d/Spectrum2D/initiateDatum2D.js +2 -3
  156. package/lib-cjs/data/utilities/calculateSanPlot.js +35 -0
  157. package/lib-cjs/versionInfo.js +1 -1
  158. package/package.json +21 -20
  159. package/lib/component/1d/IntegralResizable.js +0 -72
  160. package/lib/component/panels/RangesPanel/TableColumns/format.d.ts +0 -1
  161. package/lib/component/panels/RangesPanel/TableColumns/format.js +0 -8
  162. package/lib/data/data1d/Data1DManager.d.ts +0 -3
  163. package/lib/data/data1d/Data1DManager.js +0 -98
  164. package/lib/data/data1d/filter1d/absolute.d.ts +0 -13
  165. package/lib/data/data1d/filter1d/absolute.js +0 -26
  166. package/lib/data/data2d/Data2DManager.d.ts +0 -3
  167. package/lib/data/data2d/Data2DManager.js +0 -34
  168. package/lib/data/types/data2d/Contour.d.ts +0 -4
  169. package/lib/data/types/data2d/Contour.js +0 -1
  170. package/lib/data/types/data2d/Contours.d.ts +0 -2
  171. package/lib/data/types/data2d/Contours.js +0 -1
  172. package/lib-cjs/component/1d/IntegralResizable.js +0 -77
  173. package/lib-cjs/component/panels/RangesPanel/TableColumns/format.js +0 -14
  174. package/lib-cjs/data/data1d/Data1DManager.js +0 -104
  175. package/lib-cjs/data/data1d/filter1d/absolute.js +0 -32
  176. package/lib-cjs/data/data2d/Data2DManager.js +0 -40
  177. package/lib-cjs/data/types/data2d/Contour.js +0 -2
  178. package/lib-cjs/data/types/data2d/Contours.js +0 -2
@@ -4,10 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.applyKeyPreferencesHandler = exports.setKeyPreferencesHandler = exports.changeSpectrumVerticalAlignment = void 0;
7
- const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
8
7
  const GroupByInfoKey_1 = __importDefault(require("../../utility/GroupByInfoKey"));
9
8
  const nucleusToString_1 = __importDefault(require("../../utility/nucleusToString"));
10
9
  const Constants_1 = require("../core/Constants");
10
+ const getActiveSpectrum_1 = require("../helper/getActiveSpectrum");
11
11
  const DomainActions_1 = require("./DomainActions");
12
12
  function changeSpectrumVerticalAlignment(draft, options) {
13
13
  function stack(spectra = []) {
@@ -61,16 +61,12 @@ function changeSpectrumVerticalAlignment(draft, options) {
61
61
  exports.changeSpectrumVerticalAlignment = changeSpectrumVerticalAlignment;
62
62
  function setKeyPreferencesHandler(draft, keyCode) {
63
63
  const { data, zoom, xDomain, xDomains, yDomain, yDomains, originDomain, margin, displayerMode, view, } = draft;
64
- const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
65
- if (view.spectra.activeTab) {
64
+ const { spectra: { activeTab }, } = view;
65
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
66
+ if (activeTab) {
66
67
  const groupByNucleus = (0, GroupByInfoKey_1.default)('nucleus');
67
68
  const spectrumsGroupsList = groupByNucleus(data);
68
- const level = displayerMode === Constants_1.DISPLAYER_MODE.DM_2D
69
- ? spectrumsGroupsList[view.spectra.activeTab].reduce((acc, datum) => {
70
- acc[datum.id] = datum.processingController.getLevel();
71
- return acc;
72
- }, {})
73
- : null;
69
+ const spectra = spectrumsGroupsList[activeTab];
74
70
  draft.keysPreferences[keyCode] = {
75
71
  activeSpectrum,
76
72
  displayerMode,
@@ -81,30 +77,26 @@ function setKeyPreferencesHandler(draft, keyCode) {
81
77
  yDomain,
82
78
  yDomains,
83
79
  originDomain,
84
- level,
85
80
  margin,
86
- data: spectrumsGroupsList[view.spectra.activeTab].reduce((acc, datum) => {
87
- acc[datum.id] = {
88
- display: {
89
- color: datum.display.color,
90
- isVisible: datum.display.isVisible,
91
- isPeaksMarkersVisible: datum.display.isPeaksMarkersVisible,
92
- },
93
- };
94
- return acc;
95
- }, {}),
81
+ data: spectra,
96
82
  };
97
83
  }
98
84
  }
99
85
  exports.setKeyPreferencesHandler = setKeyPreferencesHandler;
86
+ function setSpectraDisplayPreferences(draft, preferences) {
87
+ draft.data.forEach((datum, index) => {
88
+ if ((0, nucleusToString_1.default)(datum.info.nucleus) === preferences.activeTab) {
89
+ draft.data[index].display = {
90
+ ...datum.display,
91
+ ...preferences.data[datum.id].display,
92
+ };
93
+ }
94
+ });
95
+ }
100
96
  function applyKeyPreferencesHandler(draft, keyCode) {
101
97
  const preferences = draft.keysPreferences[keyCode];
102
98
  if (preferences) {
103
- draft.data.forEach((datum, index) => {
104
- if ((0, nucleusToString_1.default)(datum.info.nucleus) === preferences.activeTab) {
105
- draft.data[index].display = Object.assign((0, cloneDeep_1.default)(datum.display), preferences.data[datum.id].display);
106
- }
107
- });
99
+ setSpectraDisplayPreferences(draft, preferences);
108
100
  draft.view = preferences.view;
109
101
  draft.displayerMode = preferences.displayerMode;
110
102
  draft.margin = preferences.margin;
@@ -114,17 +106,7 @@ function applyKeyPreferencesHandler(draft, keyCode) {
114
106
  draft.yDomain = preferences.yDomain;
115
107
  draft.originDomain = preferences.originDomain;
116
108
  draft.yDomains = preferences.yDomains;
117
- if (draft.displayerMode === Constants_1.DISPLAYER_MODE.DM_2D) {
118
- for (const datumID of Object.keys(preferences.level)) {
119
- const { levelPositive, levelNegative } = preferences.level[datumID];
120
- const index = draft.data.findIndex((datum) => datum.id === datumID);
121
- const processController = draft.data[index]
122
- .processingController;
123
- processController.setLevel(levelPositive, levelNegative);
124
- draft.contours[datumID] = processController.drawContours();
125
- }
126
- }
127
- else {
109
+ if (draft.displayerMode !== Constants_1.DISPLAYER_MODE.DM_2D) {
128
110
  draft.zoom = preferences.zoom;
129
111
  }
130
112
  }
@@ -38,13 +38,14 @@ const Spectrum1D_1 = require("../../../data/data1d/Spectrum1D");
38
38
  const SumManager_1 = require("../../../data/data1d/Spectrum1D/SumManager");
39
39
  const RangeUtilities_1 = require("../../../data/utilities/RangeUtilities");
40
40
  const Reducer_1 = require("../Reducer");
41
+ const getActiveSpectrum_1 = require("../helper/getActiveSpectrum");
41
42
  const getRange_1 = __importDefault(require("../helper/getRange"));
42
43
  const CorrelationsActions_1 = require("./CorrelationsActions");
43
44
  const DomainActions_1 = require("./DomainActions");
44
45
  const ToolsActions_1 = require("./ToolsActions");
45
46
  function handleAutoRangesDetection(draft, options) {
46
47
  const { data, xDomain, molecules, view: { spectra: { activeTab: nucleus }, }, } = draft;
47
- const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
48
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
48
49
  if (activeSpectrum?.id) {
49
50
  const { index, id } = activeSpectrum;
50
51
  const datum = data[index];
@@ -103,7 +104,7 @@ function getRangeIndex(draft, spectrumIndex, rangeID) {
103
104
  return draft.data[spectrumIndex].ranges.values.findIndex((range) => range.id === rangeID);
104
105
  }
105
106
  function handleDeleteRange(draft, action) {
106
- const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
107
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
107
108
  if (activeSpectrum?.id) {
108
109
  const { index } = activeSpectrum;
109
110
  const { data, resetSelectTool = false } = action.payload;
@@ -128,7 +129,7 @@ function handleDeleteRange(draft, action) {
128
129
  exports.handleDeleteRange = handleDeleteRange;
129
130
  function handleChangeRangeSignalKind(draft, action) {
130
131
  const state = (0, immer_1.original)(draft);
131
- const activeSpectrum = state.view.spectra.activeSpectra[state.view.spectra.activeTab];
132
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(state);
132
133
  if (activeSpectrum?.id) {
133
134
  const { index } = activeSpectrum;
134
135
  const { rowData, value } = action.payload.data;
@@ -147,7 +148,7 @@ function handleChangeRangeSignalKind(draft, action) {
147
148
  exports.handleChangeRangeSignalKind = handleChangeRangeSignalKind;
148
149
  function handleSaveEditedRange(draft, action) {
149
150
  const state = (0, immer_1.original)(draft);
150
- const activeSpectrum = state.view.spectra.activeSpectra[state.view.spectra.activeTab];
151
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(state);
151
152
  if (activeSpectrum?.id) {
152
153
  const { index } = activeSpectrum;
153
154
  const { editedRowData, assignmentData } = action.payload;
@@ -192,7 +193,7 @@ function handleDeleteSignal(draft, action) {
192
193
  }
193
194
  exports.handleDeleteSignal = handleDeleteSignal;
194
195
  function handleUnlinkRange(draft, action) {
195
- const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
196
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
196
197
  if (activeSpectrum?.id) {
197
198
  const { index } = activeSpectrum;
198
199
  const { assignmentData, rangeData = null, signalIndex = -1, } = action.payload;
@@ -228,7 +229,7 @@ function handleUnlinkRange(draft, action) {
228
229
  }
229
230
  exports.handleUnlinkRange = handleUnlinkRange;
230
231
  function handleSetDiaIDRange(draft, action) {
231
- const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
232
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
232
233
  if (activeSpectrum?.id) {
233
234
  const { index } = activeSpectrum;
234
235
  const { rangeData, diaIDs, signalIndex, nbAtoms } = action.payload;
@@ -248,7 +249,7 @@ function handleSetDiaIDRange(draft, action) {
248
249
  }
249
250
  exports.handleSetDiaIDRange = handleSetDiaIDRange;
250
251
  function handleResizeRange(draft, action) {
251
- const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
252
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
252
253
  if (activeSpectrum?.id) {
253
254
  const { index } = activeSpectrum;
254
255
  (0, Spectrum1D_1.changeRange)(draft.data[index], action.data);
@@ -257,7 +258,7 @@ function handleResizeRange(draft, action) {
257
258
  exports.handleResizeRange = handleResizeRange;
258
259
  function handleChangeRangeSum(draft, options) {
259
260
  const { data, view: { spectra: { activeTab: nucleus }, }, } = draft;
260
- const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
261
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
261
262
  if (activeSpectrum?.id) {
262
263
  const { index } = activeSpectrum;
263
264
  const datum = data[index];
@@ -270,7 +271,7 @@ function addNewRange(draft, props) {
270
271
  const { startX, endX, id } = props;
271
272
  const range = (0, getRange_1.default)(draft, { startX, endX });
272
273
  const { view: { spectra: { activeTab: nucleus }, }, molecules, } = draft;
273
- const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
274
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
274
275
  if (activeSpectrum?.id) {
275
276
  const { index } = activeSpectrum;
276
277
  const [from, to] = range;
@@ -308,16 +309,18 @@ function handleAddRange(draft, action) {
308
309
  exports.handleAddRange = handleAddRange;
309
310
  function handleChangeRangeRelativeValue(draft, action) {
310
311
  const data = action.payload.data;
311
- if (draft.activeSpectrum?.id) {
312
- const { index } = draft.activeSpectrum;
312
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
313
+ if (activeSpectrum?.id) {
314
+ const { index } = activeSpectrum;
313
315
  (0, Spectrum1D_1.changeRangeRelativeValue)(draft.data[index], data);
314
316
  }
315
317
  }
316
318
  exports.handleChangeRangeRelativeValue = handleChangeRangeRelativeValue;
317
319
  function handleChangeRangeSignalValue(draft, action) {
318
320
  const { rangeID, signalID, value } = action.payload;
319
- if (draft.activeSpectrum?.id) {
320
- const { index } = draft.activeSpectrum;
321
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
322
+ if (activeSpectrum?.id) {
323
+ const { index } = activeSpectrum;
321
324
  const shift = (0, Spectrum1D_1.changeRangeSignal)(draft.data[index], {
322
325
  rangeID,
323
326
  signalID,
@@ -337,15 +340,16 @@ function handleOnChangeRangesData(draft) {
337
340
  }
338
341
  function handleChangeRangesSumFlag(draft, action) {
339
342
  const flag = action.payload;
340
- if (draft.activeSpectrum?.id) {
341
- const { index } = draft.activeSpectrum;
343
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
344
+ if (activeSpectrum?.id) {
345
+ const { index } = activeSpectrum;
342
346
  draft.data[index].ranges.options.isSumConstant = !flag;
343
347
  }
344
348
  }
345
349
  exports.handleChangeRangesSumFlag = handleChangeRangesSumFlag;
346
350
  function handleUpdateRange(draft, action) {
347
351
  const { range, resetSelectTool = false } = action.payload;
348
- const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
352
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
349
353
  if (activeSpectrum?.id && range.id) {
350
354
  const datum = draft.data[activeSpectrum?.index];
351
355
  const index = datum.ranges.values.findIndex((_range) => _range.id === range.id);
@@ -32,9 +32,11 @@ const Filters = __importStar(require("../../../data/Filters"));
32
32
  const FiltersManager_1 = require("../../../data/FiltersManager");
33
33
  const Spectrum1D_1 = require("../../../data/data1d/Spectrum1D");
34
34
  const Spectrum2D_1 = require("../../../data/data2d/Spectrum2D");
35
+ const contours_1 = require("../../../data/data2d/Spectrum2D/contours");
35
36
  const ToolTypes_1 = require("../../toolbar/ToolTypes");
36
37
  const GroupByInfoKey_1 = __importDefault(require("../../utility/GroupByInfoKey"));
37
38
  const Zoom1DManager_1 = require("../helper/Zoom1DManager");
39
+ const getActiveSpectrum_1 = require("../helper/getActiveSpectrum");
38
40
  const DomainActions_1 = require("./DomainActions");
39
41
  const FiltersActions_1 = require("./FiltersActions");
40
42
  const ToolsActions_1 = require("./ToolsActions");
@@ -96,7 +98,7 @@ function handleChangePeaksMarkersVisibility(draft, data) {
96
98
  exports.handleChangePeaksMarkersVisibility = handleChangePeaksMarkersVisibility;
97
99
  function handleChangeActiveSpectrum(draft, activeSpectrum) {
98
100
  let refreshDomain = false;
99
- const currentActiveSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
101
+ const currentActiveSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
100
102
  if (activeSpectrum) {
101
103
  const newIndex = draft.data.findIndex((d) => d.id === activeSpectrum.id);
102
104
  const oldIndex = draft.data.findIndex((d) => d.id === currentActiveSpectrum?.id);
@@ -146,10 +148,15 @@ function handleChangeActiveSpectrum(draft, activeSpectrum) {
146
148
  }
147
149
  exports.handleChangeActiveSpectrum = handleChangeActiveSpectrum;
148
150
  function changeSpectrumSetting(draft, { id, display }) {
149
- const state = (0, immer_1.original)(draft);
150
- const index = state.data.findIndex((d) => d.id === id);
151
+ const index = draft.data.findIndex((d) => d.id === id);
151
152
  if (index !== -1) {
152
- draft.data[index].display = display;
153
+ const spectrum = draft.data[index];
154
+ spectrum.display = display;
155
+ if ((0, Spectrum2D_1.isSpectrum2D)(spectrum)) {
156
+ const contoursLevels = draft.view.zoom.levels;
157
+ const { checkLevel } = (0, contours_1.contoursManager)(spectrum.id, contoursLevels, spectrum.display.contourOptions);
158
+ contoursLevels[spectrum.id] = checkLevel();
159
+ }
153
160
  }
154
161
  }
155
162
  exports.changeSpectrumSetting = changeSpectrumSetting;
@@ -179,7 +186,7 @@ exports.handleDeleteSpectra = handleDeleteSpectra;
179
186
  function addMissingProjectionHandler(draft, action) {
180
187
  const state = (0, immer_1.original)(draft);
181
188
  const { nucleus } = action;
182
- const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
189
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
183
190
  if (activeSpectrum?.id) {
184
191
  const { index } = activeSpectrum;
185
192
  for (let n of nucleus) {
@@ -7,6 +7,7 @@ exports.resetSpectraScale = exports.setSpectraSameTopHandler = exports.setTab =
7
7
  const uuid_1 = require("@lukeed/uuid");
8
8
  const immer_1 = require("immer");
9
9
  const ml_spectra_processing_1 = require("ml-spectra-processing");
10
+ const contours_1 = require("../../../data/data2d/Spectrum2D/contours");
10
11
  const scale_1 = require("../../1d/utilities/scale");
11
12
  const DimensionLayout_1 = require("../../2d/utilities/DimensionLayout");
12
13
  const scale_2 = require("../../2d/utilities/scale");
@@ -16,7 +17,9 @@ const Reducer_1 = require("../Reducer");
16
17
  const Constants_1 = require("../core/Constants");
17
18
  const Zoom1DManager_1 = require("../helper/Zoom1DManager");
18
19
  const ZoomHistoryManager_1 = __importDefault(require("../helper/ZoomHistoryManager"));
20
+ const getActiveSpectrum_1 = require("../helper/getActiveSpectrum");
19
21
  const getActiveSpectrumOrFail_1 = require("../helper/getActiveSpectrumOrFail");
22
+ const getSpectrum_1 = require("../helper/getSpectrum");
20
23
  const DomainActions_1 = require("./DomainActions");
21
24
  const FiltersActions_1 = require("./FiltersActions");
22
25
  const PreferencesActions_1 = require("./PreferencesActions");
@@ -125,10 +128,11 @@ function handleDeleteBaseLineZone(draft, id) {
125
128
  }
126
129
  exports.handleDeleteBaseLineZone = handleDeleteBaseLineZone;
127
130
  function handleToggleRealImaginaryVisibility(draft) {
128
- if (draft.activeSpectrum != null) {
129
- const { index } = draft.activeSpectrum;
130
- draft.data[index].display.isRealSpectrumVisible =
131
- !draft.data[index].display.isRealSpectrumVisible;
131
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
132
+ if (activeSpectrum != null) {
133
+ const { index } = activeSpectrum;
134
+ const datum = draft.data[index];
135
+ datum.display.isRealSpectrumVisible = !datum.display.isRealSpectrumVisible;
132
136
  (0, DomainActions_1.setDomain)(draft);
133
137
  }
134
138
  }
@@ -172,7 +176,7 @@ function handleBrushEnd(draft, action) {
172
176
  }
173
177
  exports.handleBrushEnd = handleBrushEnd;
174
178
  function setVerticalIndicatorXPosition(draft, position) {
175
- const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
179
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
176
180
  if (activeSpectrum?.id) {
177
181
  const scaleX = (0, scale_1.getXScale)(draft);
178
182
  const value = scaleX.invert(position);
@@ -189,7 +193,7 @@ function getSpectrumID(draft, index) {
189
193
  function handleZoom(draft, action) {
190
194
  const { event, trackID, selectedTool } = action;
191
195
  const { view: { ranges: rangeState }, displayerMode, } = draft;
192
- const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
196
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
193
197
  const { showRangesIntegrals } = rangeState.find((r) => r.spectrumID === activeSpectrum?.id) ||
194
198
  Reducer_1.rangeStateInit;
195
199
  if (displayerMode === Constants_1.DISPLAYER_MODE.DM_2D) {
@@ -291,15 +295,6 @@ function setMargin(draft) {
291
295
  draft.margin = Constants_1.MARGIN['1D'];
292
296
  }
293
297
  }
294
- function processing2DData(draft, data) {
295
- if (draft.displayerMode === Constants_1.DISPLAYER_MODE.DM_2D) {
296
- let _data = {};
297
- for (const datum of data[draft.view.spectra.activeTab]) {
298
- _data[datum.id] = datum.processingController.drawContours();
299
- }
300
- draft.contours = _data;
301
- }
302
- }
303
298
  function setDisplayerMode(draft, data) {
304
299
  draft.displayerMode =
305
300
  data && data.some((d) => d.info.dimension === 2)
@@ -371,7 +366,6 @@ function setActiveTab(draft, options) {
371
366
  const currentTab = !tab || !tabs.includes(tab || '') ? tabs[0] : tab;
372
367
  setTab(draft, dataGroupByNucleus, currentTab, refreshActiveTab);
373
368
  resetTool(draft);
374
- processing2DData(draft, dataGroupByNucleus);
375
369
  (0, DomainActions_1.setDomain)(draft, domainOptions);
376
370
  (0, DomainActions_1.setIntegralsYDomain)(draft, dataGroupByNucleus[currentTab]);
377
371
  const zoomHistory = (0, ZoomHistoryManager_1.default)(draft.zoom.history, draft.view.spectra.activeTab);
@@ -390,20 +384,13 @@ function handelSetActiveTab(draft, tab) {
390
384
  }
391
385
  exports.handelSetActiveTab = handelSetActiveTab;
392
386
  function levelChangeHandler(draft, { deltaY, shiftKey }) {
393
- const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
387
+ const activeSpectrum = (0, getSpectrum_1.getSpectrum)(draft);
394
388
  try {
395
389
  if (activeSpectrum?.id) {
396
- const { index, id } = activeSpectrum;
397
- const processingController = draft.data[index]
398
- .processingController;
399
- if (shiftKey) {
400
- processingController.shiftWheel(deltaY);
401
- }
402
- else {
403
- processingController.wheel(deltaY);
404
- }
405
- const contours = Object.freeze(processingController.drawContours());
406
- draft.contours[id] = contours;
390
+ const { levels } = draft.view.zoom;
391
+ const contourOptions = activeSpectrum.display.contourOptions;
392
+ const zoom = (0, contours_1.contoursManager)(activeSpectrum.id, levels, contourOptions);
393
+ draft.view.zoom.levels[activeSpectrum.id] = zoom.wheel(deltaY, shiftKey);
407
394
  }
408
395
  }
409
396
  catch (e) {
@@ -37,6 +37,7 @@ const Spectrum2D_1 = require("../../../data/data2d/Spectrum2D");
37
37
  const ZoneUtilities_1 = require("../../../data/utilities/ZoneUtilities");
38
38
  const Reducer_1 = require("../Reducer");
39
39
  const get2DRange_1 = __importDefault(require("../helper/get2DRange"));
40
+ const getActiveSpectrum_1 = require("../helper/getActiveSpectrum");
40
41
  const CorrelationsActions_1 = require("./CorrelationsActions");
41
42
  const DomainActions_1 = require("./DomainActions");
42
43
  function changeZonesFactorHandler(draft, action) {
@@ -44,7 +45,7 @@ function changeZonesFactorHandler(draft, action) {
44
45
  }
45
46
  exports.changeZonesFactorHandler = changeZonesFactorHandler;
46
47
  function add2dZoneHandler(draft, action) {
47
- const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
48
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
48
49
  if (activeSpectrum?.id) {
49
50
  const { index } = activeSpectrum;
50
51
  const drawnZone = (0, get2DRange_1.default)(draft, action);
@@ -60,7 +61,7 @@ function add2dZoneHandler(draft, action) {
60
61
  }
61
62
  exports.add2dZoneHandler = add2dZoneHandler;
62
63
  function handleAutoZonesDetection(draft, detectionOptions) {
63
- const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
64
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
64
65
  if (activeSpectrum?.id) {
65
66
  const { index } = activeSpectrum;
66
67
  const [fromX, toX] = draft.xDomain;
@@ -90,7 +91,7 @@ function handleAutoSpectraZonesDetection(draft) {
90
91
  exports.handleAutoSpectraZonesDetection = handleAutoSpectraZonesDetection;
91
92
  function changeZoneSignalDelta(draft, action) {
92
93
  const { zoneID, signal } = action.payload;
93
- const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
94
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
94
95
  if (activeSpectrum?.id) {
95
96
  const { index } = activeSpectrum;
96
97
  const { xShift, yShift } = (0, Spectrum2D_1.changeZoneSignal)(draft.data[index], zoneID, signal);
@@ -113,7 +114,7 @@ function getZoneIndex(state, spectrumIndex, zoneID) {
113
114
  }
114
115
  function handleChangeZoneSignalKind(draft, action) {
115
116
  const state = (0, immer_1.original)(draft);
116
- const activeSpectrum = state.view.spectra.activeSpectra[state.view.spectra.activeTab];
117
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(state);
117
118
  if (activeSpectrum?.id) {
118
119
  const { index } = activeSpectrum;
119
120
  const { rowData, value } = action.payload;
@@ -129,7 +130,7 @@ function handleChangeZoneSignalKind(draft, action) {
129
130
  exports.handleChangeZoneSignalKind = handleChangeZoneSignalKind;
130
131
  function handleDeleteZone(draft, action) {
131
132
  const state = (0, immer_1.original)(draft);
132
- const activeSpectrum = state.view.spectra.activeSpectra[state.view.spectra.activeTab];
133
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(state);
133
134
  if (activeSpectrum?.id) {
134
135
  const { index } = activeSpectrum;
135
136
  const { id, assignmentData } = action.payload;
@@ -187,7 +188,7 @@ function handleSetSignalPathLength(draft, action) {
187
188
  exports.handleSetSignalPathLength = handleSetSignalPathLength;
188
189
  function handleUnlinkZone(draft, action) {
189
190
  const state = (0, immer_1.original)(draft);
190
- const activeSpectrum = state.view.spectra.activeSpectra[state.view.spectra.activeTab];
191
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(state);
191
192
  if (activeSpectrum?.id) {
192
193
  const { index } = activeSpectrum;
193
194
  const { zoneData = null, assignmentData, isOnZoneLevel = undefined, signalIndex = -1, axis = undefined, } = action.payload;
@@ -211,7 +212,7 @@ function handleUnlinkZone(draft, action) {
211
212
  exports.handleUnlinkZone = handleUnlinkZone;
212
213
  function handleSetDiaIDZone(draft, action) {
213
214
  const state = (0, immer_1.original)(draft);
214
- const activeSpectrum = state.view.spectra.activeSpectra[state.view.spectra.activeTab];
215
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(state);
215
216
  if (activeSpectrum?.id) {
216
217
  const { index } = activeSpectrum;
217
218
  const { zoneData, diaIDs, axis, signalIndex, nbAtoms } = action.payload;
@@ -231,7 +232,7 @@ function handleSetDiaIDZone(draft, action) {
231
232
  exports.handleSetDiaIDZone = handleSetDiaIDZone;
232
233
  function handleSaveEditedZone(draft, action) {
233
234
  const state = (0, immer_1.original)(draft);
234
- const activeSpectrum = state.view.spectra.activeSpectra[state.view.spectra.activeTab];
235
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(state);
235
236
  if (activeSpectrum?.id) {
236
237
  const { index } = activeSpectrum;
237
238
  const { editedRowData } = action.payload;
@@ -12,7 +12,7 @@ exports.MARGIN = {
12
12
  '1D': {
13
13
  top: 10,
14
14
  right: 10,
15
- bottom: 70,
15
+ bottom: 50,
16
16
  left: 10,
17
17
  },
18
18
  };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getActiveSpectrum = void 0;
4
+ function getActiveSpectrum(state) {
5
+ const { activeSpectra, activeTab } = state.view.spectra;
6
+ return activeSpectra[activeTab] || null;
7
+ }
8
+ exports.getActiveSpectrum = getActiveSpectrum;
@@ -79,11 +79,12 @@ function BasicToolBarInner({ info, verticalAlign, ftCounter, fidCounter, activeS
79
79
  const openLoader = (0, LoaderContext_1.useLoader)();
80
80
  const isExperimentalFeature = (0, useCheckExperimentalFeature_1.default)();
81
81
  const isButtonVisible = (0, useCheckToolsVisibility_1.useCheckToolsVisibility)();
82
- const importMenu = (0, react_1.useMemo)(() => {
83
- return isExperimentalFeature
84
- ? IMPORT_MENU
85
- : IMPORT_MENU.filter((item) => item.id !== 'importPublicationString');
86
- }, [isExperimentalFeature]);
82
+ const importMenu = isExperimentalFeature
83
+ ? IMPORT_MENU
84
+ : IMPORT_MENU.filter((item) => item.id !== 'importPublicationString');
85
+ const exportMenu = isExperimentalFeature
86
+ ? EXPORT_MENU
87
+ : EXPORT_MENU.filter((item) => item.id !== 'nmre');
87
88
  const { isRealSpectrumShown, changeSpectrumViewHandler, changeDisplayViewModeHandler, alignSpectrumsVerticallyHandler, } = (0, useToolsFunctions_1.default)();
88
89
  const { saveAsSVGHandler, saveAsPNGHandler, saveAsJSONHandler, saveToClipboardHandler, saveAsHandler, } = (0, useExport_1.default)();
89
90
  const LoadJacmpHandler = (0, react_1.useCallback)((file) => {
@@ -152,7 +153,7 @@ function BasicToolBarInner({ info, verticalAlign, ftCounter, fidCounter, activeS
152
153
  }, items: importMenu })), isButtonVisible('exportAs') && ((0, jsx_runtime_1.jsx)(ToolbarMenu_1.default, { component: (0, jsx_runtime_1.jsx)(fa_1.FaFileExport, {}), toolTip: "Export As", onClick: (element) => {
153
154
  exportHandler(element);
154
155
  return null;
155
- }, items: EXPORT_MENU })), isButtonVisible('spectraStackAlignments') &&
156
+ }, items: exportMenu })), isButtonVisible('spectraStackAlignments') &&
156
157
  ftCounter > 1 &&
157
158
  (info?.isFt || !activeSpectrum) && ((0, jsx_runtime_1.jsx)(analysis_ui_components_1.Toolbar.Item, { id: "spectra-alignment", className: "cheminfo", title: "Spectra alignment ( Press s )", onClick: changeDisplayViewModeHandler, children: verticalAlign.align === 'stack' ? ((0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrOverlay3Aligned, {})) : ((0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrOverlay3, {})) })), isButtonVisible('realImaginary') && info.isComplex && ((0, jsx_runtime_1.jsx)(analysis_ui_components_1.Toolbar.Item, { id: "display", title: isRealSpectrumShown ? 'Display Real ' : 'Display Imaginary', onClick: changeSpectrumViewHandler, className: "cheminfo", children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrRealImag, {}) })), isButtonVisible('spectraCenterAlignments') &&
158
159
  (ftCounter > 0 || fidCounter > 0) && ((0, jsx_runtime_1.jsx)(analysis_ui_components_1.Toolbar.Item, { id: "baseline-position", title: verticalAlign.align === 'bottom'
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getFileSignature = exports.extractFileMetaFromPath = exports.getFileName = exports.getFileExtension = exports.loadFile = exports.loadFilesFromZip = exports.loadFiles = exports.FILES_SIGNATURES = exports.FILES_TYPES = void 0;
3
+ exports.getFileSignature = exports.extractFileMetaFromPath = exports.getFileName = exports.getFileExtension = exports.loadFile = exports.loadFiles = exports.FILES_SIGNATURES = exports.FILES_TYPES = void 0;
4
4
  exports.FILES_TYPES = {
5
5
  MOL: 'mol',
6
6
  NMRIUM: 'nmrium',
@@ -15,6 +15,7 @@ exports.FILES_SIGNATURES = {
15
15
  ZIP: '504b0304',
16
16
  };
17
17
  function getFileSignature(fileArrayBuffer) {
18
+ // eslint-disable-next-line no-restricted-properties
18
19
  return new Uint8Array(fileArrayBuffer)
19
20
  .slice(0, 4)
20
21
  .reduce((acc, byte) => (acc += byte.toString(16).padStart(2, '0')), '');
@@ -77,20 +78,3 @@ function loadFiles(acceptedFiles, options = {}) {
77
78
  }));
78
79
  }
79
80
  exports.loadFiles = loadFiles;
80
- async function loadFilesFromZip(files, options = {}) {
81
- const result = [];
82
- for (const file of files) {
83
- try {
84
- const binary = await file.async(options.asBuffer ? 'uint8array' : 'text');
85
- const name = getFileName(file.name);
86
- const extension = getFileExtension(file.name);
87
- result.push({ binary, name, extension });
88
- }
89
- catch (e) {
90
- // eslint-disable-next-line no-console
91
- console.error(e);
92
- }
93
- }
94
- return result;
95
- }
96
- exports.loadFilesFromZip = loadFilesFromZip;