nmrium 0.47.0 → 0.49.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 (88) hide show
  1. package/lib/component/1d/Chart1D.js +1 -1
  2. package/lib/component/1d/Line.js +1 -1
  3. package/lib/component/1d/LinesSeries.d.ts +1 -1
  4. package/lib/component/1d/LinesSeries.js +24 -3
  5. package/lib/component/1d/SpectraLegends.js +1 -1
  6. package/lib/component/1d/Viewer1D.js +144 -124
  7. package/lib/component/1d/jCouplingGraph/JsCoupling.js +1 -1
  8. package/lib/component/1d/peaks/Peaks.js +5 -4
  9. package/lib/component/1d/ranges/Atoms.d.ts +7 -0
  10. package/lib/component/1d/ranges/Atoms.js +43 -0
  11. package/lib/component/1d/ranges/Range.js +4 -2
  12. package/lib/component/1d/tool/BaseLine.d.ts +2 -0
  13. package/lib/component/1d/tool/BaseLine.js +26 -0
  14. package/lib/component/1d/tool/BaseLineZones.js +18 -3
  15. package/lib/component/1d/utilities/scale.d.ts +1 -0
  16. package/lib/component/1d/utilities/scale.js +2 -1
  17. package/lib/component/2d/Chart2D.js +6 -4
  18. package/lib/component/2d/Viewer2D.js +35 -26
  19. package/lib/component/context/KeyModifierContext.d.ts +14 -3
  20. package/lib/component/context/KeyModifierContext.js +35 -4
  21. package/lib/component/context/LoggerContext.d.ts +9 -0
  22. package/lib/component/context/LoggerContext.js +21 -7
  23. package/lib/component/context/PreferencesContext.d.ts +1 -108
  24. package/lib/component/context/TopicMoleculeContext.d.ts +8 -0
  25. package/lib/component/context/TopicMoleculeContext.js +30 -0
  26. package/lib/component/elements/Input.js +4 -1
  27. package/lib/component/elements/ResizerWithScale.js +19 -2
  28. package/lib/component/elements/SVGGroup.js +2 -2
  29. package/lib/component/elements/formik/FormikTextarea.js +8 -9
  30. package/lib/component/elements/linearAxis/LinearVerticalAxis.js +1 -1
  31. package/lib/component/elements/resizer/SVGResizer.js +1 -1
  32. package/lib/component/header/BaseLineCorrectionPanel.js +3 -2
  33. package/lib/component/header/Header.js +2 -2
  34. package/lib/component/hooks/useCheckToolsVisibility.js +1 -1
  35. package/lib/component/hooks/useExport.js +2 -2
  36. package/lib/component/hooks/useSetActiveSpectrumAction.d.ts +3 -0
  37. package/lib/component/hooks/useSetActiveSpectrumAction.js +16 -0
  38. package/lib/component/hooks/useToolsFunctions.js +4 -2
  39. package/lib/component/hooks/useVerticalAlign.d.ts +1 -1
  40. package/lib/component/main/InnerNMRium.js +3 -2
  41. package/lib/component/modal/ExportAsJcampModal.js +1 -1
  42. package/lib/component/modal/ImportPublicationStringModal.d.ts +2 -1
  43. package/lib/component/modal/ImportPublicationStringModal.js +76 -32
  44. package/lib/component/modal/editRange/forms/validation/EditRangeValidation.js +2 -4
  45. package/lib/component/modal/setting/settings-tabs/GeneralTabContent.js +9 -11
  46. package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +2 -1
  47. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts +2 -1
  48. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -5
  49. package/lib/component/panels/RangesPanel/RangesTable.js +1 -1
  50. package/lib/component/panels/SpectrumsPanel/SpectraPreferences.js +39 -5
  51. package/lib/component/panels/SpectrumsPanel/SpectraTable.js +28 -40
  52. package/lib/component/panels/SpectrumsPanel/SpectrumListPanel.js +4 -2
  53. package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -9
  54. package/lib/component/panels/SpectrumsPanel/base/RenderAsHTML.d.ts +7 -0
  55. package/lib/component/panels/SpectrumsPanel/base/RenderAsHTML.js +21 -0
  56. package/lib/component/panels/SpectrumsPanel/base/SpectraColumnsManager.js +19 -16
  57. package/lib/component/panels/SpectrumsPanel/base/SpectrumName.js +0 -1
  58. package/lib/component/panels/databasePanel/DatabasePanel.js +6 -1
  59. package/lib/component/panels/multipleAnalysisPanel/AnalysisChart.js +1 -1
  60. package/lib/component/panels/predictionPanel/PredictionPanel.js +3 -1
  61. package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +15 -4
  62. package/lib/component/reducer/Reducer.js +2 -0
  63. package/lib/component/reducer/actions/DomainActions.d.ts +2 -2
  64. package/lib/component/reducer/actions/DomainActions.js +2 -2
  65. package/lib/component/reducer/actions/FiltersActions.d.ts +3 -4
  66. package/lib/component/reducer/actions/FiltersActions.js +93 -57
  67. package/lib/component/reducer/actions/LoadActions.js +10 -8
  68. package/lib/component/reducer/actions/SpectrumsActions.d.ts +8 -1
  69. package/lib/component/reducer/actions/SpectrumsActions.js +8 -4
  70. package/lib/component/reducer/actions/ToolsActions.d.ts +8 -5
  71. package/lib/component/reducer/actions/ToolsActions.js +51 -44
  72. package/lib/component/reducer/helper/getVerticalAlign.d.ts +1 -1
  73. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +0 -4
  74. package/lib/component/toolbar/BasicToolBar.js +11 -29
  75. package/lib/component/utility/export.d.ts +3 -2
  76. package/lib/component/utility/export.js +45 -26
  77. package/lib/component/workspaces/exercise.js +1 -0
  78. package/lib/component/workspaces/prediction.js +1 -16
  79. package/lib/component/workspaces/simulation.js +1 -2
  80. package/lib/component/workspaces/workspaceDefaultProperties.js +4 -3
  81. package/lib/data/data1d/Spectrum1D/index.d.ts +0 -1
  82. package/lib/data/data1d/Spectrum1D/index.js +0 -1
  83. package/lib/data/data1d/multipleSpectraAnalysis.js +27 -40
  84. package/lib/data/data2d/Spectrum2D/getMissingProjection.js +10 -1
  85. package/lib/versionInfo.js +1 -1
  86. package/package.json +31 -30
  87. package/lib/data/data1d/Spectrum1D/generateSpectrumFromPublicationString.d.ts +0 -2
  88. package/lib/data/data1d/Spectrum1D/generateSpectrumFromPublicationString.js +0 -6
@@ -99,15 +99,19 @@ export function generateAnalyzeSpectra(multipleSpectraAnalysis, spectra, nucleus
99
99
  const newData = Object.fromEntries(Object.entries(data).map((spectra) => {
100
100
  const result = Object.fromEntries(Object.keys(columns).map((key) => {
101
101
  const isFormula = columns[key].type === AnalysisColumnsTypes.FORMULA;
102
- return [
103
- key,
104
- isFormula
105
- ? {
102
+ if (isFormula) {
103
+ const { SID, id } = spectra[1][key];
104
+ return [
105
+ key,
106
+ {
107
+ SID,
108
+ id,
106
109
  colKey: key,
107
110
  value: calculate(columns, data[spectra[0]], columns[key].formula),
108
- }
109
- : { ...spectra[1][key], colKey: key },
110
- ];
111
+ },
112
+ ];
113
+ }
114
+ return [key, { ...spectra[1][key], colKey: key }];
111
115
  }));
112
116
  return [spectra[0], result];
113
117
  }));
@@ -147,52 +151,35 @@ export function getDataAsString(spectraAnalysis, spectra, spectraPanelPreference
147
151
  const spectraData = convertSpectraArrayToObject(spectra);
148
152
  if (spectraAnalysis) {
149
153
  const { values, options: { columns }, } = spectraAnalysis;
150
- let result = '';
154
+ //columns labels
155
+ const letters = Object.keys(columns);
156
+ const columnsLabels = letters.slice();
157
+ let index = 0;
151
158
  // listed the spectra panel columns
152
159
  for (const col of spectraPanelPreferences.columns) {
153
- if (col.visible) {
154
- const { name } = col;
155
- if ((name && ['name', 'solvent'].includes(name)) || !name) {
156
- result += `${col.label}\t`;
157
- }
160
+ if (col.visible && 'jpath' in col) {
161
+ columnsLabels.splice(index, 0, col.label);
162
+ index++;
158
163
  }
159
164
  }
160
- const letters = Object.keys(columns);
161
- // listed the spectra analysis panel columns
162
- for (const letter of letters) {
163
- result += `${letter}\t`;
164
- }
165
- result += '\n';
165
+ let result = `${columnsLabels.join('\t')}\n`;
166
166
  for (const spectrumAnalysis of Object.values(values)) {
167
167
  const spectrum = spectraData[spectrumAnalysis[letters[0]].SID];
168
+ const cellsValues = [];
168
169
  // listed the spectra cell values
169
170
  for (const col of spectraPanelPreferences.columns) {
170
- if (col.visible) {
171
- const name = col
172
- ?.name;
173
- if (name) {
174
- switch (name) {
175
- case 'name':
176
- result += `${spectrum.info.name}\t`;
177
- break;
178
- case 'solvent':
179
- result += `${spectrum.info.solvent || `null`}\t`;
180
- break;
181
- default:
182
- break;
183
- }
184
- }
185
- else {
186
- const path = col?.jpath;
187
- result += `${lodashGet(spectrum, path, `null`)}\t`;
188
- }
171
+ if (col.visible && 'jpath' in col) {
172
+ const jpath = col?.jpath;
173
+ const value = lodashGet(spectrum, jpath, `null`);
174
+ cellsValues.push(value);
189
175
  }
190
176
  }
191
177
  // listed the spectra analysis cell values
192
178
  for (const letter of letters) {
193
- result += `${spectrumAnalysis[letter][columns[letter].valueKey]}\t`;
179
+ const value = spectrumAnalysis[letter][columns[letter].valueKey];
180
+ cellsValues.push(value);
194
181
  }
195
- result += '\n';
182
+ result += `${cellsValues.join('\t')}\n`;
196
183
  }
197
184
  return result;
198
185
  }
@@ -33,7 +33,9 @@ export function getMissingProjection(datum, nucleus, datumInfo, usedColors) {
33
33
  if (index === -1)
34
34
  index = 0;
35
35
  const info = {
36
- nucleus: datumInfo.nucleus[index], // 1H, 13C, 19F, ...
36
+ ...getInfo(datumInfo, index),
37
+ experiment: '1d',
38
+ pulseSequence: 'projection',
37
39
  isFid: false,
38
40
  isComplex: false, // if isComplex is true that mean it contains real/ imaginary x set, if not hid re/im button .
39
41
  dimension: 1,
@@ -41,3 +43,10 @@ export function getMissingProjection(datum, nucleus, datumInfo, usedColors) {
41
43
  const data = getProjection(datum, index);
42
44
  return initiateDatum1D({ info, data }, { usedColors });
43
45
  }
46
+ function getInfo(info, index) {
47
+ const newInfo = {};
48
+ for (const key in info) {
49
+ newInfo[key] = Array.isArray(info[key]) ? info[key][index] : info[key];
50
+ }
51
+ return newInfo;
52
+ }
@@ -1 +1 @@
1
- export default { version: 'v0.47.0' };
1
+ export default { version: 'v0.49.0' };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nmrium",
3
3
  "description": "React component to display and process nuclear magnetic resonance (NMR) spectra.",
4
- "version": "0.47.0",
4
+ "version": "0.49.0",
5
5
  "license": "MIT",
6
6
  "module": "lib/component/main/index.js",
7
7
  "types": "lib/component/main/index.d.ts",
@@ -23,6 +23,7 @@
23
23
  "eslint": "eslint . --cache",
24
24
  "eslint-fix": "npm run eslint -- --fix",
25
25
  "install:clean": "rm -rf node_modules/ && rm -rf package-lock.json && npm install && npm start",
26
+ "playwright": "playwright test --ui",
26
27
  "prepack": "npm run clean-lib && npm run compile",
27
28
  "prepublishOnly": "npm run set-version-npm",
28
29
  "prettier": "prettier --check src test-e2e",
@@ -45,7 +46,7 @@
45
46
  "url": "git+https://github.com/cheminfo/nmrium.git"
46
47
  },
47
48
  "volta": {
48
- "node": "20.10.0"
49
+ "node": "20.11.0"
49
50
  },
50
51
  "overrides": {
51
52
  "react": "$react",
@@ -56,20 +57,20 @@
56
57
  "react-dom": ">=18.0.0"
57
58
  },
58
59
  "dependencies": {
59
- "@blueprintjs/core": "^5.7.2",
60
- "@blueprintjs/icons": "^5.5.0",
61
- "@emotion/react": "^11.11.1",
60
+ "@blueprintjs/core": "^5.9.1",
61
+ "@blueprintjs/icons": "^5.7.1",
62
+ "@emotion/react": "^11.11.3",
62
63
  "@emotion/styled": "^11.11.0",
63
64
  "@lukeed/uuid": "^2.0.1",
64
- "cheminfo-font": "^1.12.0",
65
+ "cheminfo-font": "^1.13.0",
65
66
  "cheminfo-types": "^1.7.2",
66
- "clipboard-polyfill": "^4.0.1",
67
+ "clipboard-polyfill": "^4.0.2",
67
68
  "convert-to-jcamp": "^5.4.9",
68
69
  "d3": "^7.8.5",
69
70
  "eventemitter3": "^5.0.1",
70
71
  "fifo-logger": "^0.6.1",
71
72
  "file-saver": "^2.0.5",
72
- "filelist-utils": "^1.10.2",
73
+ "filelist-utils": "^1.11.0",
73
74
  "formik": "^2.4.5",
74
75
  "immer": "^10.0.3",
75
76
  "jszip": "^3.10.1",
@@ -82,22 +83,22 @@
82
83
  "ml-conrec": "^5.0.2",
83
84
  "ml-gsd": "^12.1.3",
84
85
  "ml-matrix": "^6.11.0",
85
- "ml-spectra-processing": "^12.8.0",
86
+ "ml-spectra-processing": "^12.10.1",
86
87
  "ml-stat": "^1.3.3",
87
88
  "multiplet-analysis": "^2.1.2",
88
89
  "nmr-correlation": "^2.3.3",
89
- "nmr-load-save": "^0.24.0",
90
- "nmr-processing": "^11.7.0",
90
+ "nmr-load-save": "^0.26.0",
91
+ "nmr-processing": "^11.10.0",
91
92
  "nmredata": "^0.9.9",
92
93
  "numeral": "^2.0.6",
93
- "openchemlib": "^8.7.2",
94
- "openchemlib-utils": "^5.6.1",
94
+ "openchemlib": "^8.8.1",
95
+ "openchemlib-utils": "^5.8.0",
95
96
  "papaparse": "^5.4.1",
96
97
  "re-resizable": "6.9.11",
97
98
  "react-d3-utils": "^1.0.0",
98
99
  "react-dropzone": "^14.2.3",
99
100
  "react-error-boundary": "^4.0.12",
100
- "react-icons": "^4.12.0",
101
+ "react-icons": "^5.0.1",
101
102
  "react-inspector": "^6.0.2",
102
103
  "react-mf": "^2.0.2",
103
104
  "react-ocl": "^6.1.0",
@@ -108,7 +109,7 @@
108
109
  "react-slider": "^2.0.6",
109
110
  "react-table": "^7.8.0",
110
111
  "react-transition-group": "^4.4.5",
111
- "react-use": "^17.4.2",
112
+ "react-use": "^17.5.0",
112
113
  "smart-array-filter": "^4.0.2",
113
114
  "yup": "^1.3.3"
114
115
  },
@@ -116,36 +117,36 @@
116
117
  "@babel/plugin-transform-modules-commonjs": "^7.23.3",
117
118
  "@babel/preset-react": "^7.23.3",
118
119
  "@babel/preset-typescript": "^7.23.3",
119
- "@playwright/test": "^1.40.1",
120
+ "@playwright/test": "^1.41.2",
120
121
  "@simbathesailor/use-what-changed": "^2.0.0",
121
122
  "@types/d3": "^7.4.3",
122
123
  "@types/lodash": "^4.14.202",
123
- "@types/node": "^20.10.5",
124
+ "@types/node": "^20.11.16",
124
125
  "@types/papaparse": "^5.3.14",
125
- "@types/react": "^18.2.45",
126
+ "@types/react": "^18.2.51",
126
127
  "@types/react-dom": "^18.2.18",
127
- "@types/react-table": "^7.7.18",
128
- "@vitejs/plugin-react-swc": "^3.5.0",
129
- "@vitest/coverage-v8": "^1.0.4",
128
+ "@types/react-table": "^7.7.19",
129
+ "@vitejs/plugin-react-swc": "^3.6.0",
130
+ "@vitest/coverage-v8": "^1.2.2",
130
131
  "cross-env": "^7.0.3",
131
- "cspell": "^8.1.3",
132
+ "cspell": "^8.3.2",
132
133
  "eslint": "^8.56.0",
133
134
  "eslint-config-cheminfo-react": "^10.1.0",
134
135
  "eslint-config-cheminfo-typescript": "^12.1.0",
135
136
  "modern-normalize": "^2.0.0",
136
- "postcss-styled-syntax": "^0.5.0",
137
- "prettier": "^3.1.1",
137
+ "postcss-styled-syntax": "^0.6.4",
138
+ "prettier": "^3.2.4",
138
139
  "rc-menu": "^9.12.4",
139
140
  "react": "^18.2.0",
140
141
  "react-dom": "^18.2.0",
141
- "react-router-dom": "^6.21.0",
142
+ "react-router-dom": "^6.22.0",
142
143
  "rimraf": "^5.0.5",
143
144
  "rollup-plugin-analyzer": "^4.0.0",
144
145
  "serve": "^14.2.1",
145
- "stylelint": "^16.0.2",
146
- "stylelint-config-standard": "^35.0.0",
146
+ "stylelint": "^16.2.1",
147
+ "stylelint-config-standard": "^36.0.0",
147
148
  "typescript": "^5.3.3",
148
- "vite": "^5.0.10",
149
- "vitest": "^1.0.4"
149
+ "vite": "^5.0.12",
150
+ "vitest": "^1.2.2"
150
151
  }
151
- }
152
+ }
@@ -1,2 +0,0 @@
1
- import { UsedColors } from '../../../types/UsedColors';
2
- export declare function generateSpectrumFromPublicationString(publicationString: string, usedColors: UsedColors): import("nmr-load-save").Spectrum1D | undefined;
@@ -1,6 +0,0 @@
1
- import { resurrect } from 'nmr-processing';
2
- import { generateSpectrumFromRanges } from './ranges/generateSpectrumFromRanges';
3
- export function generateSpectrumFromPublicationString(publicationString, usedColors) {
4
- const { ranges, experiment: { nucleus, solvent }, parts, } = resurrect(publicationString);
5
- return generateSpectrumFromRanges(ranges, { nucleus, solvent, name: parts[0] }, usedColors);
6
- }