nmrium 1.2.1 → 1.3.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 (48) hide show
  1. package/lib/component/1d/FloatPublicationString.js +1 -1
  2. package/lib/component/1d/FloatPublicationString.js.map +1 -1
  3. package/lib/component/1d/FloatingRanges.js +1 -1
  4. package/lib/component/1d/FloatingRanges.js.map +1 -1
  5. package/lib/component/1d/inset/DraggableInset.js +1 -1
  6. package/lib/component/1d/inset/DraggableInset.js.map +1 -1
  7. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.d.ts.map +1 -1
  8. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +23 -6
  9. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js.map +1 -1
  10. package/lib/component/modal/aboutUs/AboutUsModal.d.ts.map +1 -1
  11. package/lib/component/modal/aboutUs/AboutUsModal.js +5 -1
  12. package/lib/component/modal/aboutUs/AboutUsModal.js.map +1 -1
  13. package/lib/component/panels/MoleculesPanel/MoleculePanel.d.ts.map +1 -1
  14. package/lib/component/panels/MoleculesPanel/MoleculePanel.js +1 -1
  15. package/lib/component/panels/MoleculesPanel/MoleculePanel.js.map +1 -1
  16. package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts.map +1 -1
  17. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +1 -0
  18. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js.map +1 -1
  19. package/lib/component/reducer/actions/SpectraActions.d.ts.map +1 -1
  20. package/lib/component/reducer/actions/SpectraActions.js +7 -6
  21. package/lib/component/reducer/actions/SpectraActions.js.map +1 -1
  22. package/lib/component/toolbar/ToolBar.js +7 -7
  23. package/lib/component/toolbar/ToolBar.js.map +1 -1
  24. package/lib/component/toolbar/ToolTypes.d.ts.map +1 -1
  25. package/lib/component/toolbar/ToolTypes.js +2 -1
  26. package/lib/component/toolbar/ToolTypes.js.map +1 -1
  27. package/lib/component/utility/renderCoreSlot.d.ts +8 -1
  28. package/lib/component/utility/renderCoreSlot.d.ts.map +1 -1
  29. package/lib/component/utility/renderCoreSlot.js +10 -2
  30. package/lib/component/utility/renderCoreSlot.js.map +1 -1
  31. package/lib/data/molecules/MoleculeManager.d.ts.map +1 -1
  32. package/lib/data/molecules/MoleculeManager.js +5 -0
  33. package/lib/data/molecules/MoleculeManager.js.map +1 -1
  34. package/lib/versionInfo.js +1 -1
  35. package/package.json +6 -6
  36. package/src/component/1d/FloatPublicationString.tsx +1 -1
  37. package/src/component/1d/FloatingRanges.tsx +1 -1
  38. package/src/component/1d/inset/DraggableInset.tsx +1 -1
  39. package/src/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.tsx +36 -15
  40. package/src/component/modal/aboutUs/AboutUsModal.tsx +59 -41
  41. package/src/component/panels/MoleculesPanel/MoleculePanel.tsx +1 -0
  42. package/src/component/panels/MoleculesPanel/useAtomAssignment.tsx +1 -0
  43. package/src/component/reducer/actions/SpectraActions.ts +7 -6
  44. package/src/component/toolbar/ToolBar.tsx +7 -7
  45. package/src/component/toolbar/ToolTypes.ts +2 -1
  46. package/src/component/utility/renderCoreSlot.tsx +12 -2
  47. package/src/data/molecules/MoleculeManager.ts +8 -0
  48. package/src/versionInfo.ts +1 -1
@@ -399,11 +399,11 @@ function handleChangeActiveSpectrum(
399
399
  * not refresh the y domain if the next and previous selected spectra have Ft or we do not have previous or next active spectra
400
400
  */
401
401
  const refreshDomain =
402
- previousActiveSpectraHasFT === undefined ||
403
- (previousActiveSpectraHasFT !== newActiveSpectraHasFT &&
404
- spectra &&
405
- spectra?.length > 0 &&
406
- spectraIds?.length > 0);
402
+ (previousActiveSpectraHasFT === undefined ||
403
+ previousActiveSpectraHasFT !== newActiveSpectraHasFT) &&
404
+ spectra &&
405
+ spectra?.length > 0 &&
406
+ spectraIds?.length > 0;
407
407
 
408
408
  /**
409
409
  * if the active spectrum not is FID then do not refresh the domain and the mode when the first time you activate spectrum
@@ -709,7 +709,7 @@ function handleSimulateSpectrum(
709
709
  (s) => s.id === draft.view.currentSimulatedSpectrumKey,
710
710
  );
711
711
  }
712
- const { frequency, to, from } = options;
712
+ const { frequency, to, from, nbPoints } = options;
713
713
 
714
714
  const info = {
715
715
  originFrequency: frequency,
@@ -731,6 +731,7 @@ function handleSimulateSpectrum(
731
731
  info: {
732
732
  isFt: true,
733
733
  nucleus: '1H',
734
+ nbPoints,
734
735
  ...info,
735
736
  },
736
737
  },
@@ -249,7 +249,7 @@ export default function ToolBar() {
249
249
  title: options.peakPicking.label,
250
250
  shortcuts: ['p'],
251
251
  description: 'Detect peaks manually or automatically in the spectrum.',
252
- link: 'https://docs.nmrium.org/20_1d-spectra/peaks',
252
+ link: 'https://docs.nmrium.org/help/peaks',
253
253
  },
254
254
 
255
255
  icon: <SvgNmrPeakPicking />,
@@ -290,7 +290,7 @@ export default function ToolBar() {
290
290
  title: options.rangePicking.label,
291
291
  shortcuts: ['r'],
292
292
  description: `Define ranges and analyse multiplet automatically or manually. Click, drag, and release ${!invert ? 'while holding SHIFT' : ''} to draw the range. Ranges can be resized by moving the edges.`,
293
- link: 'https://docs.nmrium.org/20_1d-spectra/ranges',
293
+ link: 'https://docs.nmrium.org/help/ranges',
294
294
  },
295
295
  icon: <SvgNmrRangePicking />,
296
296
  },
@@ -308,6 +308,7 @@ export default function ToolBar() {
308
308
  shortcuts: ['a'],
309
309
  description:
310
310
  'Apply mathematical function that the FID is multiplied by before Fourier Transform.',
311
+ link: 'https://docs.nmrium.org/help/apodization',
311
312
  },
312
313
  icon: <SvgNmrApodization />,
313
314
  },
@@ -332,7 +333,7 @@ export default function ToolBar() {
332
333
  shortcuts: ['z'],
333
334
  description:
334
335
  'Improve spectrum quality by increasing the number of points. By default, the number of points is twice as many as in the original FID.',
335
- link: 'https://docs.nmrium.org/20_1d-spectra/preprocessing#zero-filling',
336
+ link: 'https://docs.nmrium.org/help/zero-filling',
336
337
  },
337
338
  icon: <SvgNmrZeroFilling />,
338
339
  },
@@ -360,7 +361,7 @@ export default function ToolBar() {
360
361
  title: options.phaseCorrection.label,
361
362
  shortcuts: ['a'],
362
363
  description: `Correct the spectrum phase manually or automatically. For manual phase correction, define the pivot${!invert ? ' using SHIFT +' : ''} click, then press the PH0 and PH1 button, and move the mouse horizontally.`,
363
- link: 'https://docs.nmrium.org/20_1d-spectra/phase',
364
+ link: 'https://docs.nmrium.org/help/phase',
364
365
  },
365
366
  icon: <SvgNmrPhaseCorrection />,
366
367
  },
@@ -380,7 +381,7 @@ export default function ToolBar() {
380
381
  title: options.baselineCorrection.label,
381
382
  shortcuts: ['b'],
382
383
  description: `Correct the baseline of the spectrum. You should draw zones corresponding to the noise using click, drag, release${!invert ? 'while holding SHIFT' : ''}.`,
383
- link: 'https://docs.nmrium.org/20_1d-spectra/baseline',
384
+ link: 'https://docs.nmrium.org/help/baseline',
384
385
  },
385
386
  icon: <SvgNmrBaselineCorrection />,
386
387
  },
@@ -401,7 +402,7 @@ export default function ToolBar() {
401
402
  title: options.fft.label,
402
403
  shortcuts: ['t'],
403
404
  description: 'Perform a Fourier transform on the FID.',
404
- link: 'https://docs.nmrium.org/20_1d-spectra/ft',
405
+ link: 'https://docs.nmrium.org/help/ft',
405
406
  },
406
407
  onClick: handleOnFFTFilter,
407
408
  icon: <SvgNmrFourierTransform />,
@@ -455,7 +456,6 @@ export default function ToolBar() {
455
456
  title: `Display ${isRealSpectrumShown ? 'real' : 'imaginary'}`,
456
457
  description:
457
458
  'Toggle between the imaginary and real parts of the spectrum.',
458
- link: 'https://docs.nmrium.org/20_1d-spectra/views',
459
459
  },
460
460
  icon: <SvgNmrRealImag />,
461
461
  onClick: changeSpectrumViewHandler,
@@ -382,7 +382,8 @@ export const options: RecordOptions = {
382
382
  spectraOptions: [
383
383
  {
384
384
  info: [
385
- { key: 'isFid', value: true },
385
+ { key: 'isFtDimensionOne', value: true },
386
+ { key: 'isFt', value: false },
386
387
  { key: 'isComplex', value: true },
387
388
  ],
388
389
  active: true,
@@ -1,11 +1,21 @@
1
1
  import type { NMRiumCore, SupportedUISlot } from '@zakodium/nmrium-core';
2
2
  import type { ReactNode } from 'react';
3
3
 
4
+ /**
5
+ * Render all components registered in the given slot.
6
+ *
7
+ * @param core
8
+ * @param slot
9
+ * @param fallback - return fallback if no component is registered in the slot
10
+ */
4
11
  export function renderCoreSlot(
5
12
  core: NMRiumCore,
6
13
  slot: SupportedUISlot,
7
- ): ReactNode[] {
8
- return Array.from(core.slot(slot), ([key, Component]) => (
14
+ fallback?: ReactNode,
15
+ ): ReactNode {
16
+ const jsx = Array.from(core.slot(slot), ([key, Component]) => (
9
17
  <Component key={key} slot={slot} />
10
18
  ));
19
+
20
+ return jsx.length > 0 ? jsx : fallback;
11
21
  }
@@ -4,6 +4,7 @@ import { Molecule } from 'openchemlib';
4
4
  import type { StateMolecule, StateMoleculeExtended } from './Molecule.js';
5
5
  import { initMolecule } from './Molecule.js';
6
6
 
7
+ //TODO: Move molecule initialization to nmrium-core and log an error if the molecule cannot be parsed.
7
8
  export function fromJSON(
8
9
  mols: StateMolecule[],
9
10
  reservedMolecules: StateMolecule[] = [],
@@ -13,6 +14,13 @@ export function fromJSON(
13
14
  const molecules: StateMoleculeExtended[] = [];
14
15
  for (const mol of mols) {
15
16
  const molecule = Molecule.fromMolfile(mol.molfile);
17
+
18
+ const atomCount = molecule.getAllAtoms();
19
+
20
+ if (atomCount === 0) {
21
+ continue;
22
+ }
23
+
16
24
  molecules.push(
17
25
  initMolecule({
18
26
  molfile: molecule.toMolfileV3(),
@@ -1 +1 @@
1
- export default { version: 'v1.2.1' };
1
+ export default { version: 'v1.3.0' };