@chemistry/molecule 3.1.0 → 3.1.1

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.
@@ -1,3 +1,6 @@
1
+ import { MoleculeDataFormat } from '../models.js';
1
2
  import type { IMoleculeState } from './reducer.js';
2
- export declare const exportMolecule: (molecule: IMoleculeState, _format: string) => IMoleculeState;
3
+ export declare const exportMolecule: (molecule: IMoleculeState, format: MoleculeDataFormat) => IMoleculeState;
4
+ export declare const selectAtomCount: (state: IMoleculeState) => number;
5
+ export declare const selectBondCount: (state: IMoleculeState) => number;
3
6
  //# sourceMappingURL=selectors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../src/store/selectors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,eAAO,MAAM,cAAc,GAAI,UAAU,cAAc,EAAE,SAAS,MAAM,KAAG,cAE1E,CAAC"}
1
+ {"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../src/store/selectors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,eAAO,MAAM,cAAc,GACzB,UAAU,cAAc,EACxB,QAAQ,kBAAkB,KACzB,cAKF,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,OAAO,cAAc,KAAG,MAEvD,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,OAAO,cAAc,KAAG,MAEvD,CAAC"}
@@ -1,4 +1,14 @@
1
- export const exportMolecule = (molecule, _format) => {
2
- return molecule;
1
+ import { MoleculeDataFormat } from '../models.js';
2
+ export const exportMolecule = (molecule, format) => {
3
+ if (format === MoleculeDataFormat.jnmol) {
4
+ return JSON.parse(JSON.stringify(molecule));
5
+ }
6
+ throw new Error(format + ' is not supported');
7
+ };
8
+ export const selectAtomCount = (state) => {
9
+ return Object.keys(state.atoms).length;
10
+ };
11
+ export const selectBondCount = (state) => {
12
+ return Object.keys(state.bonds).length;
3
13
  };
4
14
  //# sourceMappingURL=selectors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"selectors.js","sourceRoot":"","sources":["../../src/store/selectors.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,QAAwB,EAAE,OAAe,EAAkB,EAAE;IAC1F,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC"}
1
+ {"version":3,"file":"selectors.js","sourceRoot":"","sources":["../../src/store/selectors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAGlD,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,QAAwB,EACxB,MAA0B,EACV,EAAE;IAClB,IAAI,MAAM,KAAK,kBAAkB,CAAC,KAAK,EAAE,CAAC;QACxC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAmB,CAAC;IAChE,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,MAAM,GAAG,mBAAmB,CAAC,CAAC;AAChD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAqB,EAAU,EAAE;IAC/D,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC;AACzC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAqB,EAAU,EAAE;IAC/D,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC;AACzC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chemistry/molecule",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "description": "Molecule",
5
5
  "type": "module",
6
6
  "author": {
@@ -21,7 +21,7 @@
21
21
  "directory": "packages/molecule"
22
22
  },
23
23
  "engines": {
24
- "node": ">=20.0.0"
24
+ "node": ">=22.0.0"
25
25
  },
26
26
  "publishConfig": {
27
27
  "registry": "https://registry.npmjs.org/",