nmrium 1.7.0 → 1.8.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 (210) hide show
  1. package/lib/component/1d/ranges/Atoms.d.ts.map +1 -1
  2. package/lib/component/1d/ranges/Atoms.js +24 -9
  3. package/lib/component/1d/ranges/Atoms.js.map +1 -1
  4. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.d.ts +2 -1
  5. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.d.ts.map +1 -1
  6. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +32 -42
  7. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js.map +1 -1
  8. package/lib/component/1d-2d/components/FloatMoleculeStructures/FloatMolecules.d.ts.map +1 -1
  9. package/lib/component/1d-2d/components/FloatMoleculeStructures/FloatMolecules.js.map +1 -1
  10. package/lib/component/2d/zones/SignalsGuideLines.js +1 -1
  11. package/lib/component/2d/zones/SignalsGuideLines.js.map +1 -1
  12. package/lib/component/hooks/useExport.js +1 -1
  13. package/lib/component/hooks/useExport.js.map +1 -1
  14. package/lib/component/loader/useLoadFiles.d.ts.map +1 -1
  15. package/lib/component/loader/useLoadFiles.js +17 -7
  16. package/lib/component/loader/useLoadFiles.js.map +1 -1
  17. package/lib/component/main/NMRiumStateProvider.d.ts.map +1 -1
  18. package/lib/component/main/NMRiumStateProvider.js +2 -3
  19. package/lib/component/main/NMRiumStateProvider.js.map +1 -1
  20. package/lib/component/modal/LoadJCAMPModal.js +7 -2
  21. package/lib/component/modal/LoadJCAMPModal.js.map +1 -1
  22. package/lib/component/modal/MoleculeStructureEditorModal.d.ts.map +1 -1
  23. package/lib/component/modal/MoleculeStructureEditorModal.js +7 -3
  24. package/lib/component/modal/MoleculeStructureEditorModal.js.map +1 -1
  25. package/lib/component/modal/SaveAsModal.d.ts.map +1 -1
  26. package/lib/component/modal/SaveAsModal.js +6 -2
  27. package/lib/component/modal/SaveAsModal.js.map +1 -1
  28. package/lib/component/modal/setting/settings-tabs/ToolsTabContent.d.ts.map +1 -1
  29. package/lib/component/modal/setting/settings-tabs/ToolsTabContent.js +16 -0
  30. package/lib/component/modal/setting/settings-tabs/ToolsTabContent.js.map +1 -1
  31. package/lib/component/panels/MoleculesPanel/MoleculeOptionsPanel.d.ts +6 -0
  32. package/lib/component/panels/MoleculesPanel/MoleculeOptionsPanel.d.ts.map +1 -0
  33. package/lib/component/panels/MoleculesPanel/MoleculeOptionsPanel.js +87 -0
  34. package/lib/component/panels/MoleculesPanel/MoleculeOptionsPanel.js.map +1 -0
  35. package/lib/component/panels/MoleculesPanel/MoleculePanel.d.ts.map +1 -1
  36. package/lib/component/panels/MoleculesPanel/MoleculePanel.js +18 -26
  37. package/lib/component/panels/MoleculesPanel/MoleculePanel.js.map +1 -1
  38. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts.map +1 -1
  39. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +32 -25
  40. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js.map +1 -1
  41. package/lib/component/panels/MoleculesPanel/MoleculeStructure.d.ts +13 -0
  42. package/lib/component/panels/MoleculesPanel/MoleculeStructure.d.ts.map +1 -0
  43. package/lib/component/panels/MoleculesPanel/MoleculeStructure.js +66 -0
  44. package/lib/component/panels/MoleculesPanel/MoleculeStructure.js.map +1 -0
  45. package/lib/component/panels/MoleculesPanel/{useAtomAssignment.d.ts → hooks/useAtomAssignment.d.ts} +1 -1
  46. package/lib/component/panels/MoleculesPanel/hooks/useAtomAssignment.d.ts.map +1 -0
  47. package/lib/component/panels/MoleculesPanel/{useAtomAssignment.js → hooks/useAtomAssignment.js} +32 -16
  48. package/lib/component/panels/MoleculesPanel/hooks/useAtomAssignment.js.map +1 -0
  49. package/lib/component/panels/MoleculesPanel/hooks/useExtractAtomAssignmentLabel.d.ts +12 -0
  50. package/lib/component/panels/MoleculesPanel/hooks/useExtractAtomAssignmentLabel.d.ts.map +1 -0
  51. package/lib/component/panels/MoleculesPanel/hooks/useExtractAtomAssignmentLabel.js +58 -0
  52. package/lib/component/panels/MoleculesPanel/hooks/useExtractAtomAssignmentLabel.js.map +1 -0
  53. package/lib/component/panels/MoleculesPanel/utilities/AtomData.d.ts +5 -0
  54. package/lib/component/panels/MoleculesPanel/utilities/AtomData.d.ts.map +1 -0
  55. package/lib/component/panels/MoleculesPanel/utilities/AtomData.js +2 -0
  56. package/lib/component/panels/MoleculesPanel/utilities/AtomData.js.map +1 -0
  57. package/lib/component/panels/MoleculesPanel/utilities/extractFromAtom.d.ts +16 -0
  58. package/lib/component/panels/MoleculesPanel/utilities/extractFromAtom.d.ts.map +1 -0
  59. package/lib/component/panels/MoleculesPanel/utilities/extractFromAtom.js +47 -0
  60. package/lib/component/panels/MoleculesPanel/utilities/extractFromAtom.js.map +1 -0
  61. package/lib/component/panels/MoleculesPanel/utilities/getAssignIds.d.ts +18 -0
  62. package/lib/component/panels/MoleculesPanel/utilities/getAssignIds.d.ts.map +1 -0
  63. package/lib/component/panels/MoleculesPanel/utilities/getAssignIds.js +31 -0
  64. package/lib/component/panels/MoleculesPanel/utilities/getAssignIds.js.map +1 -0
  65. package/lib/component/panels/MoleculesPanel/utilities/getCurrentDiaIDsToHighlight.d.ts +3 -0
  66. package/lib/component/panels/MoleculesPanel/utilities/getCurrentDiaIDsToHighlight.d.ts.map +1 -0
  67. package/lib/component/panels/MoleculesPanel/utilities/getCurrentDiaIDsToHighlight.js +12 -0
  68. package/lib/component/panels/MoleculesPanel/utilities/getCurrentDiaIDsToHighlight.js.map +1 -0
  69. package/lib/component/panels/MoleculesPanel/utilities/getHighlightsOnHover.d.ts +4 -0
  70. package/lib/component/panels/MoleculesPanel/utilities/getHighlightsOnHover.d.ts.map +1 -0
  71. package/lib/component/panels/MoleculesPanel/utilities/getHighlightsOnHover.js +25 -0
  72. package/lib/component/panels/MoleculesPanel/utilities/getHighlightsOnHover.js.map +1 -0
  73. package/lib/component/panels/MoleculesPanel/utilities/getUniqueDiaIDs.d.ts +6 -0
  74. package/lib/component/panels/MoleculesPanel/utilities/getUniqueDiaIDs.d.ts.map +1 -0
  75. package/lib/component/panels/MoleculesPanel/utilities/getUniqueDiaIDs.js +18 -0
  76. package/lib/component/panels/MoleculesPanel/utilities/getUniqueDiaIDs.js.map +1 -0
  77. package/lib/component/panels/hooks/useMoleculeAnnotationCore.d.ts +9 -0
  78. package/lib/component/panels/hooks/useMoleculeAnnotationCore.d.ts.map +1 -0
  79. package/lib/component/panels/hooks/useMoleculeAnnotationCore.js +27 -0
  80. package/lib/component/panels/hooks/useMoleculeAnnotationCore.js.map +1 -0
  81. package/lib/component/reducer/IgnoreActions.d.ts.map +1 -1
  82. package/lib/component/reducer/IgnoreActions.js +2 -1
  83. package/lib/component/reducer/IgnoreActions.js.map +1 -1
  84. package/lib/component/reducer/Reducer.d.ts +11 -5
  85. package/lib/component/reducer/Reducer.d.ts.map +1 -1
  86. package/lib/component/reducer/Reducer.js +8 -3
  87. package/lib/component/reducer/Reducer.js.map +1 -1
  88. package/lib/component/reducer/actions/LoadAction.d.ts +7 -4
  89. package/lib/component/reducer/actions/LoadAction.d.ts.map +1 -1
  90. package/lib/component/reducer/actions/LoadAction.js +35 -26
  91. package/lib/component/reducer/actions/LoadAction.js.map +1 -1
  92. package/lib/component/reducer/actions/MoleculeActions.d.ts +20 -5
  93. package/lib/component/reducer/actions/MoleculeActions.d.ts.map +1 -1
  94. package/lib/component/reducer/actions/MoleculeActions.js +42 -28
  95. package/lib/component/reducer/actions/MoleculeActions.js.map +1 -1
  96. package/lib/component/reducer/actions/RangesActions.d.ts +10 -4
  97. package/lib/component/reducer/actions/RangesActions.d.ts.map +1 -1
  98. package/lib/component/reducer/actions/RangesActions.js +24 -3
  99. package/lib/component/reducer/actions/RangesActions.js.map +1 -1
  100. package/lib/component/reducer/actions/ZonesActions.d.ts +1 -1
  101. package/lib/component/reducer/actions/ZonesActions.d.ts.map +1 -1
  102. package/lib/component/reducer/preferences/actions/changeDefaultMoleculeSettings.d.ts +4 -0
  103. package/lib/component/reducer/preferences/actions/changeDefaultMoleculeSettings.d.ts.map +1 -0
  104. package/lib/component/reducer/preferences/actions/changeDefaultMoleculeSettings.js +7 -0
  105. package/lib/component/reducer/preferences/actions/changeDefaultMoleculeSettings.js.map +1 -0
  106. package/lib/component/reducer/preferences/preferencesReducer.d.ts +3 -2
  107. package/lib/component/reducer/preferences/preferencesReducer.d.ts.map +1 -1
  108. package/lib/component/reducer/preferences/preferencesReducer.js +3 -0
  109. package/lib/component/reducer/preferences/preferencesReducer.js.map +1 -1
  110. package/lib/component/toolbar/ToolTypes.d.ts.map +1 -1
  111. package/lib/component/toolbar/ToolTypes.js +1 -0
  112. package/lib/component/toolbar/ToolTypes.js.map +1 -1
  113. package/lib/component/workspaces/assignment.d.ts.map +1 -1
  114. package/lib/component/workspaces/assignment.js +7 -0
  115. package/lib/component/workspaces/assignment.js.map +1 -1
  116. package/lib/component/workspaces/basic.d.ts.map +1 -1
  117. package/lib/component/workspaces/basic.js +5 -0
  118. package/lib/component/workspaces/basic.js.map +1 -1
  119. package/lib/component/workspaces/embedded.d.ts.map +1 -1
  120. package/lib/component/workspaces/embedded.js +5 -0
  121. package/lib/component/workspaces/embedded.js.map +1 -1
  122. package/lib/component/workspaces/exercise.d.ts.map +1 -1
  123. package/lib/component/workspaces/exercise.js +5 -0
  124. package/lib/component/workspaces/exercise.js.map +1 -1
  125. package/lib/component/workspaces/prediction.d.ts.map +1 -1
  126. package/lib/component/workspaces/prediction.js +5 -0
  127. package/lib/component/workspaces/prediction.js.map +1 -1
  128. package/lib/component/workspaces/process1D.d.ts.map +1 -1
  129. package/lib/component/workspaces/process1D.js +6 -0
  130. package/lib/component/workspaces/process1D.js.map +1 -1
  131. package/lib/component/workspaces/workspaceDefaultProperties.d.ts.map +1 -1
  132. package/lib/component/workspaces/workspaceDefaultProperties.js +18 -0
  133. package/lib/component/workspaces/workspaceDefaultProperties.js.map +1 -1
  134. package/lib/data/SpectraManager.d.ts +1 -1
  135. package/lib/data/SpectraManager.d.ts.map +1 -1
  136. package/lib/data/SpectraManager.js.map +1 -1
  137. package/lib/data/data1d/Spectrum1D/initiateDatum1D.d.ts +0 -1
  138. package/lib/data/data1d/Spectrum1D/initiateDatum1D.d.ts.map +1 -1
  139. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +17 -16
  140. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js.map +1 -1
  141. package/lib/data/data2d/Spectrum2D/initiateDatum2D.d.ts +0 -1
  142. package/lib/data/data2d/Spectrum2D/initiateDatum2D.d.ts.map +1 -1
  143. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +7 -6
  144. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js.map +1 -1
  145. package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.d.ts.map +1 -1
  146. package/lib/data/data2d/Spectrum2D/zones/initiateZones.d.ts.map +1 -1
  147. package/lib/data/molecules/Molecule.d.ts +1 -17
  148. package/lib/data/molecules/Molecule.d.ts.map +1 -1
  149. package/lib/data/molecules/Molecule.js +3 -7
  150. package/lib/data/molecules/Molecule.js.map +1 -1
  151. package/lib/data/molecules/MoleculeManager.d.ts +1 -1
  152. package/lib/data/molecules/MoleculeManager.d.ts.map +1 -1
  153. package/lib/data/molecules/MoleculeManager.js +1 -4
  154. package/lib/data/molecules/MoleculeManager.js.map +1 -1
  155. package/lib/versionInfo.js +1 -1
  156. package/package.json +27 -27
  157. package/src/component/1d/ranges/Atoms.tsx +36 -13
  158. package/src/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.tsx +38 -79
  159. package/src/component/1d-2d/components/FloatMoleculeStructures/FloatMolecules.tsx +5 -2
  160. package/src/component/2d/zones/SignalsGuideLines.tsx +1 -1
  161. package/src/component/hooks/useExport.tsx +1 -1
  162. package/src/component/loader/useLoadFiles.ts +19 -7
  163. package/src/component/main/NMRiumStateProvider.tsx +2 -3
  164. package/src/component/modal/LoadJCAMPModal.tsx +10 -4
  165. package/src/component/modal/MoleculeStructureEditorModal.tsx +10 -3
  166. package/src/component/modal/SaveAsModal.tsx +8 -2
  167. package/src/component/modal/setting/settings-tabs/ToolsTabContent.tsx +16 -0
  168. package/src/component/panels/MoleculesPanel/MoleculeOptionsPanel.tsx +160 -0
  169. package/src/component/panels/MoleculesPanel/MoleculePanel.tsx +77 -101
  170. package/src/component/panels/MoleculesPanel/MoleculePanelHeader.tsx +54 -35
  171. package/src/component/panels/MoleculesPanel/MoleculeStructure.tsx +117 -0
  172. package/src/component/panels/MoleculesPanel/{useAtomAssignment.tsx → hooks/useAtomAssignment.tsx} +47 -25
  173. package/src/component/panels/MoleculesPanel/hooks/useExtractAtomAssignmentLabel.ts +74 -0
  174. package/src/component/panels/MoleculesPanel/utilities/AtomData.ts +4 -0
  175. package/src/component/panels/MoleculesPanel/utilities/extractFromAtom.ts +63 -0
  176. package/src/component/panels/MoleculesPanel/utilities/getAssignIds.ts +59 -0
  177. package/src/component/panels/MoleculesPanel/utilities/getCurrentDiaIDsToHighlight.ts +12 -0
  178. package/src/component/panels/MoleculesPanel/utilities/getHighlightsOnHover.ts +36 -0
  179. package/src/component/panels/MoleculesPanel/utilities/getUniqueDiaIDs.ts +20 -0
  180. package/src/component/panels/hooks/useMoleculeAnnotationCore.ts +36 -0
  181. package/src/component/reducer/IgnoreActions.ts +2 -1
  182. package/src/component/reducer/Reducer.ts +21 -8
  183. package/src/component/reducer/actions/LoadAction.ts +51 -38
  184. package/src/component/reducer/actions/MoleculeActions.ts +85 -37
  185. package/src/component/reducer/actions/RangesActions.ts +50 -5
  186. package/src/component/reducer/actions/ZonesActions.ts +1 -1
  187. package/src/component/reducer/preferences/actions/changeDefaultMoleculeSettings.ts +16 -0
  188. package/src/component/reducer/preferences/preferencesReducer.ts +11 -1
  189. package/src/component/toolbar/ToolTypes.ts +1 -0
  190. package/src/component/workspaces/assignment.ts +7 -0
  191. package/src/component/workspaces/basic.ts +5 -0
  192. package/src/component/workspaces/embedded.ts +5 -0
  193. package/src/component/workspaces/exercise.ts +5 -0
  194. package/src/component/workspaces/prediction.ts +5 -0
  195. package/src/component/workspaces/process1D.ts +6 -0
  196. package/src/component/workspaces/workspaceDefaultProperties.ts +18 -0
  197. package/src/data/SpectraManager.ts +1 -7
  198. package/src/data/data1d/Spectrum1D/initiateDatum1D.ts +17 -19
  199. package/src/data/data2d/Spectrum2D/initiateDatum2D.ts +7 -10
  200. package/src/data/molecules/Molecule.ts +5 -25
  201. package/src/data/molecules/MoleculeManager.ts +0 -4
  202. package/src/index.tsx +0 -3
  203. package/src/versionInfo.ts +1 -1
  204. package/lib/component/panels/MoleculesPanel/Utilities.d.ts +0 -43
  205. package/lib/component/panels/MoleculesPanel/Utilities.d.ts.map +0 -1
  206. package/lib/component/panels/MoleculesPanel/Utilities.js +0 -129
  207. package/lib/component/panels/MoleculesPanel/Utilities.js.map +0 -1
  208. package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts.map +0 -1
  209. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js.map +0 -1
  210. package/src/component/panels/MoleculesPanel/Utilities.ts +0 -188
@@ -1,4 +1,4 @@
1
- import type { StateMolecule } from '@zakodium/nmrium-core';
1
+ import type { MoleculeView, StateMolecule } from '@zakodium/nmrium-core';
2
2
  import { Molecule } from 'openchemlib';
3
3
 
4
4
  import getAtomsFromMF from '../utilities/getAtomsFromMF.js';
@@ -29,22 +29,7 @@ export const DRAGGABLE_STRUCTURE_INITIAL_BOUNDING_REACT: MoleculeBoundingRect =
29
29
  };
30
30
 
31
31
  export type MoleculesView = Record<string, MoleculeView>;
32
- export interface MoleculeView {
33
- floating: {
34
- /**
35
- * If the floating molecule is shown.
36
- */
37
- visible: boolean;
38
- /**
39
- * Floating molecule position.
40
- */
41
- bounding: MoleculeBoundingRect;
42
- };
43
- /**
44
- * Show/Hide atoms numbers on the molecule.
45
- */
46
- showAtomNumber: boolean;
47
- }
32
+
48
33
  export function initMolecule(
49
34
  options: Partial<StateMolecule> = {},
50
35
  ): StateMoleculeExtended {
@@ -59,9 +44,7 @@ export function initMolecule(
59
44
  id,
60
45
  molfile,
61
46
  label,
62
- sourceSelector: options.sourceSelector,
63
- sourceId: options.sourceId,
64
- fileCollectionId: options.fileCollectionId,
47
+ selector: options.selector,
65
48
  mf: mfInfo.formula,
66
49
  em: mfInfo.absoluteWeight,
67
50
  mw: mfInfo.relativeWeight,
@@ -71,15 +54,12 @@ export function initMolecule(
71
54
  }
72
55
 
73
56
  export function toJSON(molecule: StateMoleculeExtended): StateMolecule {
74
- const { molfile, label, id, fileCollectionId, sourceSelector, sourceId } =
75
- molecule;
57
+ const { molfile, label, id, selector } = molecule;
76
58
 
77
59
  return {
78
60
  molfile,
79
61
  label,
80
62
  id,
81
- fileCollectionId,
82
- sourceSelector,
83
- sourceId,
63
+ selector,
84
64
  };
85
65
  }
@@ -8,7 +8,6 @@ import { initMolecule } from './Molecule.js';
8
8
  //TODO: Move molecule initialization to nmrium-core and log an error if the molecule cannot be parsed.
9
9
  export function fromJSON(
10
10
  mols: StateMolecule[],
11
- fileCollectionId: string | undefined,
12
11
  reservedMolecules: StateMolecule[] = [],
13
12
  ) {
14
13
  const reservedNumbers = extractLabelsNumbers(reservedMolecules.concat(mols));
@@ -29,9 +28,6 @@ export function fromJSON(
29
28
  label: mol.label || `P${getLabelNumber(reservedNumbers)}`,
30
29
  id: mol.id,
31
30
  };
32
- if (fileCollectionId) {
33
- moleculeOverride.fileCollectionId = fileCollectionId;
34
- }
35
31
 
36
32
  molecules.push(initMolecule(moleculeOverride));
37
33
  }
package/src/index.tsx CHANGED
@@ -1,4 +1,3 @@
1
- import { FocusStyleManager } from '@blueprintjs/core';
2
1
  import { createRoot } from 'react-dom/client';
3
2
  import { HashRouter, Route, Routes } from 'react-router-dom';
4
3
 
@@ -15,8 +14,6 @@ import '@blueprintjs/select/lib/css/blueprint-select.css';
15
14
 
16
15
  import './demo/index.css';
17
16
 
18
- FocusStyleManager.alwaysShowFocus();
19
-
20
17
  const rootElement = document.querySelector('#root');
21
18
  if (!rootElement) {
22
19
  throw new Error('#root element not found');
@@ -1 +1 @@
1
- export default { version: 'v1.7.0' };
1
+ export default { version: 'v1.8.0' };
@@ -1,43 +0,0 @@
1
- import type { Spectrum } from '@zakodium/nmrium-core';
2
- import type { DiaIDAndInfo } from 'openchemlib-utils';
3
- import type { AssignmentContext, Axis } from '../../assignment/AssignmentsContext.js';
4
- interface TargetAssignment {
5
- key: string;
6
- index: number;
7
- }
8
- interface RangeTargetAssignKey extends TargetAssignment {
9
- target: 'range';
10
- }
11
- interface ZoneTargetAssignKey extends TargetAssignment {
12
- target: 'zone';
13
- }
14
- interface SignalTargetAssignKey extends TargetAssignment {
15
- target: 'signal';
16
- }
17
- export type TargetAssignKeys = [RangeTargetAssignKey | ZoneTargetAssignKey] | [RangeTargetAssignKey | ZoneTargetAssignKey, SignalTargetAssignKey];
18
- export interface AtomData {
19
- oclIDs: string[];
20
- nbAtoms: number;
21
- }
22
- /**
23
- * Returns the OCL id(s) and number of atoms of an atom when hovering over
24
- * or clicking on it. This is depending on an optional given axis.
25
- * In case of an heavy atom with bonded hydrogens the OCL id(s)
26
- * and number of these hydrogens are added as well.
27
- *
28
- * @param {DiaIDAndInfo} diaIDAndInfo - atom returned by OCLnmr component
29
- * @param {string} activeTab - active tab
30
- * @param {Axis} axis - current axis
31
- *
32
- */
33
- export declare function extractFromAtom(diaIDAndInfo: DiaIDAndInfo | undefined, activeTab: string, axis?: Axis | null): AtomData;
34
- export declare function getAssignIds(spectrum: Spectrum, id: string): TargetAssignKeys | null;
35
- export declare function getHighlightsOnHover(assignments: AssignmentContext, oclIDs: string[], spectra: Spectrum[]): string[];
36
- export declare function getCurrentDiaIDsToHighlight(assignmentData: AssignmentContext): string[];
37
- /** */
38
- export declare function getUniqueDiaIDs(diaIDs: string[], atomInformation: AtomData): {
39
- diaIDs: string[];
40
- nbAtoms: number;
41
- };
42
- export {};
43
- //# sourceMappingURL=Utilities.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Utilities.d.ts","sourceRoot":"","sources":["../../../../src/component/panels/MoleculesPanel/Utilities.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGtD,OAAO,KAAK,EACV,iBAAiB,EACjB,IAAI,EACL,MAAM,wCAAwC,CAAC;AAGhD,UAAU,gBAAgB;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED,UAAU,oBAAqB,SAAQ,gBAAgB;IACrD,MAAM,EAAE,OAAO,CAAC;CACjB;AACD,UAAU,mBAAoB,SAAQ,gBAAgB;IACpD,MAAM,EAAE,MAAM,CAAC;CAChB;AACD,UAAU,qBAAsB,SAAQ,gBAAgB;IACtD,MAAM,EAAE,QAAQ,CAAC;CAClB;AACD,MAAM,MAAM,gBAAgB,GACxB,CAAC,oBAAoB,GAAG,mBAAmB,CAAC,GAC5C,CAAC,oBAAoB,GAAG,mBAAmB,EAAE,qBAAqB,CAAC,CAAC;AAExE,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AASD;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,YAAY,EAAE,YAAY,GAAG,SAAS,EACtC,SAAS,EAAE,MAAM,EACjB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GACjB,QAAQ,CAkCV;AAUD,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,QAAQ,EAClB,EAAE,EAAE,MAAM,GACT,gBAAgB,GAAG,IAAI,CAwBzB;AAED,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,iBAAiB,EAC9B,MAAM,EAAE,MAAM,EAAE,EAChB,OAAO,EAAE,QAAQ,EAAE,YAyBpB;AAED,wBAAgB,2BAA2B,CAAC,cAAc,EAAE,iBAAiB,YAS5E;AACD,MAAM;AACN,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,eAAe,EAAE,QAAQ;;;EAiB1E"}
@@ -1,129 +0,0 @@
1
- import { isSpectrum1D } from '../../../data/data1d/Spectrum1D/isSpectrum1D.js';
2
- import { assignmentAxes } from '../../assignment/AssignmentsContext.js';
3
- function getElements(activeTab) {
4
- if (!activeTab)
5
- return;
6
- const nuclei = activeTab.split(',');
7
- return nuclei.map((nucleus) => nucleus.replaceAll(/\d/g, ''));
8
- }
9
- /**
10
- * Returns the OCL id(s) and number of atoms of an atom when hovering over
11
- * or clicking on it. This is depending on an optional given axis.
12
- * In case of an heavy atom with bonded hydrogens the OCL id(s)
13
- * and number of these hydrogens are added as well.
14
- *
15
- * @param {DiaIDAndInfo} diaIDAndInfo - atom returned by OCLnmr component
16
- * @param {string} activeTab - active tab
17
- * @param {Axis} axis - current axis
18
- *
19
- */
20
- export function extractFromAtom(diaIDAndInfo, activeTab, axis) {
21
- const elements = getElements(activeTab);
22
- if (elements && elements.length > 0 && diaIDAndInfo) {
23
- const dim = axis === 'x' ? 0 : axis === 'y' ? 1 : null;
24
- switch (dim !== null && elements[dim]) {
25
- case diaIDAndInfo.atomLabel: {
26
- // take always oclID if atom type is same as element of activeTab)
27
- return {
28
- oclIDs: [diaIDAndInfo.idCode],
29
- nbAtoms: diaIDAndInfo.nbEquivalentAtoms,
30
- };
31
- }
32
- case 'H': {
33
- // if we are in proton spectrum and use then the IDs of attached hydrogens of an atom
34
- return {
35
- oclIDs: diaIDAndInfo.attachedHydrogensIDCodes,
36
- nbAtoms: diaIDAndInfo.nbEquivalentAtoms * diaIDAndInfo.nbAttachedHydrogens,
37
- };
38
- }
39
- default:
40
- return {
41
- oclIDs: [diaIDAndInfo.idCode].concat(diaIDAndInfo.attachedHydrogensIDCodes),
42
- nbAtoms: diaIDAndInfo.nbEquivalentAtoms +
43
- diaIDAndInfo.nbEquivalentAtoms * diaIDAndInfo.nbAttachedHydrogens,
44
- };
45
- }
46
- }
47
- return { oclIDs: [], nbAtoms: 0 };
48
- }
49
- function getRangesOrZones(spectrum) {
50
- if (isSpectrum1D(spectrum)) {
51
- return spectrum.ranges.values;
52
- }
53
- else {
54
- return spectrum.zones.values;
55
- }
56
- }
57
- export function getAssignIds(spectrum, id) {
58
- if (!spectrum)
59
- return null;
60
- const data = getRangesOrZones(spectrum);
61
- const target = isSpectrum1D(spectrum) ? 'range' : 'zone';
62
- for (let i = 0; i < data.length; i++) {
63
- const datum = data[i];
64
- if (datum.id === id) {
65
- return [{ target, index: i, key: datum.id }];
66
- }
67
- const signalIndex = datum.signals.findIndex((signal) => signal.id === id);
68
- if (signalIndex !== -1) {
69
- const { id } = datum.signals[signalIndex];
70
- return [
71
- { target, index: i, key: datum.id },
72
- { target: 'signal', index: signalIndex, key: id },
73
- ];
74
- }
75
- }
76
- return null;
77
- }
78
- export function getHighlightsOnHover(assignments, oclIDs, spectra) {
79
- // set all IDs to highlight when hovering over an atom from AssignKey data
80
- let highlights = [];
81
- const assignmentsByKey = assignments.data;
82
- for (const key in assignmentsByKey) {
83
- const assignments = assignmentsByKey[key];
84
- for (const axis of assignmentAxes) {
85
- if (assignments[axis]?.some((oclKey) => oclIDs.includes(oclKey))) {
86
- highlights = highlights.concat(assignments[axis]);
87
- for (const spectrum of spectra) {
88
- const assignIds = getAssignIds(spectrum, key);
89
- if (!assignIds) {
90
- continue;
91
- }
92
- const ids = assignIds.map((item) => item.key);
93
- highlights.push(...ids);
94
- }
95
- }
96
- }
97
- }
98
- return highlights;
99
- }
100
- export function getCurrentDiaIDsToHighlight(assignmentData) {
101
- const { highlighted, data } = assignmentData;
102
- const assignment = highlighted ? data[highlighted.id] : null;
103
- const axisHover = highlighted ? highlighted.axis : null;
104
- if (axisHover && assignment?.[axisHover]) {
105
- return assignment[axisHover];
106
- }
107
- else {
108
- return (assignment?.x || []).concat(assignment?.y || []);
109
- }
110
- }
111
- /** */
112
- export function getUniqueDiaIDs(diaIDs, atomInformation) {
113
- // a previous version of the code prevented to assign many time the same atom
114
- // see revision cc13abc18f77b6787b923e3c4edaef51750d9e90
115
- const { nbAtoms, oclIDs } = atomInformation;
116
- const diaIDSet = new Set(diaIDs);
117
- let tempNbAtoms = nbAtoms;
118
- for (const oclID of oclIDs) {
119
- if (diaIDSet.has(oclID)) {
120
- tempNbAtoms *= -1;
121
- diaIDSet.delete(oclID);
122
- }
123
- else {
124
- diaIDSet.add(oclID);
125
- }
126
- }
127
- return { diaIDs: Array.from(diaIDSet), nbAtoms: tempNbAtoms };
128
- }
129
- //# sourceMappingURL=Utilities.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Utilities.js","sourceRoot":"","sources":["../../../../src/component/panels/MoleculesPanel/Utilities.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,iDAAiD,CAAC;AAK/E,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAyBxE,SAAS,WAAW,CAAC,SAAiB;IACpC,IAAI,CAAC,SAAS;QAAE,OAAO;IAEvB,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACpC,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;AAChE,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe,CAC7B,YAAsC,EACtC,SAAiB,EACjB,IAAkB;IAElB,MAAM,QAAQ,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;IAExC,IAAI,QAAQ,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,YAAY,EAAE,CAAC;QACpD,MAAM,GAAG,GAAG,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CA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,CAAC,IAAI,EAAE,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC;AACD,MAAM;AACN,MAAM,UAAU,eAAe,CAAC,MAAgB,EAAE,eAAyB;IACzE,6EAA6E;IAC7E,wDAAwD;IACxD,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,eAAe,CAAC;IAE5C,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;IACjC,IAAI,WAAW,GAAW,OAAO,CAAC;IAElC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YACxB,WAAW,IAAI,CAAC,CAAC,CAAC;YAClB,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;aAAM,CAAC;YACN,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;AAChE,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useAtomAssignment.d.ts","sourceRoot":"","sources":["../../../../src/component/panels/MoleculesPanel/useAtomAssignment.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAqExC,MAAM,CAAC,OAAO,UAAU,iBAAiB;sCAyKE,YAAY,GAAG,SAAS;sCA/CjD,YAAY,GAAG,SAAS,SAC/B,UAAU;;;EA8EpB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useAtomAssignment.js","sourceRoot":"","sources":["../../../../src/component/panels/MoleculesPanel/useAtomAssignment.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,C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E,GAAG,eAAe,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QAC1D,oBAAoB;QACpB,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtB,2EAA2E;YAC3E,MAAM,UAAU,GAAG,oBAAoB,CAAC,WAAW,EAAE,MAAM,EAAE;gBAC3D,QAAQ;gBACR,GAAG,aAAa;aACjB,CAAC,CAAC;YACH,kBAAkB,CAAC,OAAO,GAAG,UAAU,CAAC;YACxC,aAAa,CAAC,QAAQ,CAAC;gBACrB,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,mBAAmB,EAAE,UAAU;oBAC/B,UAAU,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;iBAC7B;aACF,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,aAAa,CAAC,QAAQ,CAAC;gBACrB,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,EAAE,mBAAmB,EAAE,kBAAkB,CAAC,OAAO,EAAE;aAC7D,CAAC,CAAC;YACH,kBAAkB,CAAC,OAAO,GAAG,EAAE,CAAC;QAClC,CAAC;IACH,CAAC;IAED,OAAO;QACL,iBAAiB;QACjB,iBAAiB;QACjB,wBAAwB;QACxB,oBAAoB;KACrB,CAAC;AACJ,CAAC"}
@@ -1,188 +0,0 @@
1
- import type { Range, Zone } from '@zakodium/nmr-types';
2
- import type { Spectrum } from '@zakodium/nmrium-core';
3
- import type { DiaIDAndInfo } from 'openchemlib-utils';
4
-
5
- import { isSpectrum1D } from '../../../data/data1d/Spectrum1D/isSpectrum1D.js';
6
- import type {
7
- AssignmentContext,
8
- Axis,
9
- } from '../../assignment/AssignmentsContext.js';
10
- import { assignmentAxes } from '../../assignment/AssignmentsContext.js';
11
-
12
- interface TargetAssignment {
13
- key: string;
14
- index: number;
15
- }
16
-
17
- interface RangeTargetAssignKey extends TargetAssignment {
18
- target: 'range';
19
- }
20
- interface ZoneTargetAssignKey extends TargetAssignment {
21
- target: 'zone';
22
- }
23
- interface SignalTargetAssignKey extends TargetAssignment {
24
- target: 'signal';
25
- }
26
- export type TargetAssignKeys =
27
- | [RangeTargetAssignKey | ZoneTargetAssignKey]
28
- | [RangeTargetAssignKey | ZoneTargetAssignKey, SignalTargetAssignKey];
29
-
30
- export interface AtomData {
31
- oclIDs: string[];
32
- nbAtoms: number;
33
- }
34
-
35
- function getElements(activeTab: string) {
36
- if (!activeTab) return;
37
-
38
- const nuclei = activeTab.split(',');
39
- return nuclei.map((nucleus) => nucleus.replaceAll(/\d/g, ''));
40
- }
41
-
42
- /**
43
- * Returns the OCL id(s) and number of atoms of an atom when hovering over
44
- * or clicking on it. This is depending on an optional given axis.
45
- * In case of an heavy atom with bonded hydrogens the OCL id(s)
46
- * and number of these hydrogens are added as well.
47
- *
48
- * @param {DiaIDAndInfo} diaIDAndInfo - atom returned by OCLnmr component
49
- * @param {string} activeTab - active tab
50
- * @param {Axis} axis - current axis
51
- *
52
- */
53
- export function extractFromAtom(
54
- diaIDAndInfo: DiaIDAndInfo | undefined,
55
- activeTab: string,
56
- axis?: Axis | null,
57
- ): AtomData {
58
- const elements = getElements(activeTab);
59
-
60
- if (elements && elements.length > 0 && diaIDAndInfo) {
61
- const dim = axis === 'x' ? 0 : axis === 'y' ? 1 : null;
62
- switch (dim !== null && elements[dim]) {
63
- case diaIDAndInfo.atomLabel: {
64
- // take always oclID if atom type is same as element of activeTab)
65
- return {
66
- oclIDs: [diaIDAndInfo.idCode],
67
- nbAtoms: diaIDAndInfo.nbEquivalentAtoms,
68
- };
69
- }
70
- case 'H': {
71
- // if we are in proton spectrum and use then the IDs of attached hydrogens of an atom
72
- return {
73
- oclIDs: diaIDAndInfo.attachedHydrogensIDCodes,
74
- nbAtoms:
75
- diaIDAndInfo.nbEquivalentAtoms * diaIDAndInfo.nbAttachedHydrogens,
76
- };
77
- }
78
- default:
79
- return {
80
- oclIDs: [diaIDAndInfo.idCode].concat(
81
- diaIDAndInfo.attachedHydrogensIDCodes,
82
- ),
83
- nbAtoms:
84
- diaIDAndInfo.nbEquivalentAtoms +
85
- diaIDAndInfo.nbEquivalentAtoms * diaIDAndInfo.nbAttachedHydrogens,
86
- };
87
- }
88
- }
89
-
90
- return { oclIDs: [], nbAtoms: 0 };
91
- }
92
-
93
- function getRangesOrZones(spectrum: Spectrum): Array<Range | Zone> {
94
- if (isSpectrum1D(spectrum)) {
95
- return spectrum.ranges.values;
96
- } else {
97
- return spectrum.zones.values;
98
- }
99
- }
100
-
101
- export function getAssignIds(
102
- spectrum: Spectrum,
103
- id: string,
104
- ): TargetAssignKeys | null {
105
- if (!spectrum) return null;
106
-
107
- const data = getRangesOrZones(spectrum);
108
- const target = isSpectrum1D(spectrum) ? 'range' : 'zone';
109
-
110
- for (let i = 0; i < data.length; i++) {
111
- const datum = data[i];
112
-
113
- if (datum.id === id) {
114
- return [{ target, index: i, key: datum.id }];
115
- }
116
-
117
- const signalIndex = datum.signals.findIndex((signal) => signal.id === id);
118
- if (signalIndex !== -1) {
119
- const { id } = datum.signals[signalIndex];
120
- return [
121
- { target, index: i, key: datum.id },
122
- { target: 'signal', index: signalIndex, key: id },
123
- ];
124
- }
125
- }
126
-
127
- return null;
128
- }
129
-
130
- export function getHighlightsOnHover(
131
- assignments: AssignmentContext,
132
- oclIDs: string[],
133
- spectra: Spectrum[],
134
- ) {
135
- // set all IDs to highlight when hovering over an atom from AssignKey data
136
- let highlights: string[] = [];
137
- const assignmentsByKey = assignments.data;
138
-
139
- for (const key in assignmentsByKey) {
140
- const assignments = assignmentsByKey[key];
141
- for (const axis of assignmentAxes) {
142
- if (assignments[axis]?.some((oclKey: any) => oclIDs.includes(oclKey))) {
143
- highlights = highlights.concat(assignments[axis]);
144
- for (const spectrum of spectra) {
145
- const assignIds = getAssignIds(spectrum, key);
146
- if (!assignIds) {
147
- continue;
148
- }
149
-
150
- const ids = assignIds.map<string>((item) => item.key);
151
- highlights.push(...ids);
152
- }
153
- }
154
- }
155
- }
156
-
157
- return highlights;
158
- }
159
-
160
- export function getCurrentDiaIDsToHighlight(assignmentData: AssignmentContext) {
161
- const { highlighted, data } = assignmentData;
162
- const assignment = highlighted ? data[highlighted.id] : null;
163
- const axisHover = highlighted ? highlighted.axis : null;
164
- if (axisHover && assignment?.[axisHover]) {
165
- return assignment[axisHover];
166
- } else {
167
- return (assignment?.x || []).concat(assignment?.y || []);
168
- }
169
- }
170
- /** */
171
- export function getUniqueDiaIDs(diaIDs: string[], atomInformation: AtomData) {
172
- // a previous version of the code prevented to assign many time the same atom
173
- // see revision cc13abc18f77b6787b923e3c4edaef51750d9e90
174
- const { nbAtoms, oclIDs } = atomInformation;
175
-
176
- const diaIDSet = new Set(diaIDs);
177
- let tempNbAtoms: number = nbAtoms;
178
-
179
- for (const oclID of oclIDs) {
180
- if (diaIDSet.has(oclID)) {
181
- tempNbAtoms *= -1;
182
- diaIDSet.delete(oclID);
183
- } else {
184
- diaIDSet.add(oclID);
185
- }
186
- }
187
- return { diaIDs: Array.from(diaIDSet), nbAtoms: tempNbAtoms };
188
- }