rdkit-esm 0.6.0 → 0.7.0-rc.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.
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  RDKit minimal lib for the modern web.
4
4
 
5
+ ![RDKit v2026.03.1](https://img.shields.io/badge/RDKit-v2026--03--1-brightgreen?style=flat)
6
+
5
7
  ## About
6
8
 
7
9
  > A scientific library for Cheminformatics (depict, search, compare, process molecular data). Same features as the RDKit.js library, distributed as a standard ES module for modern development environments (install from npm, import in your code). Type safety for every method and parameters, autocomplete and documentation in your IDE.
@@ -100,8 +102,8 @@ Wraps a single molecule with a typed, camelCase API.
100
102
  - **Drawing** — `getSVG(options?)`, `drawToCanvas(canvas, ...)`
101
103
  - **Coordinates** — `setNewCoords()`, `generateAlignedCoords(template, options?)`
102
104
  - **Mutations** — `addHs()` / `removeHs()`, `convertToAromaticForm()` / `convertToKekuleForm()`, `combineWith()`, `zipWith()`
103
- - **Properties** — `hasProp()`, `getProp()`, `setProp()`, `clearProp()`, `getPropList()`
104
- - **Info** — `isValid()`, `getNumAtoms()`, `getNumBonds()`, `hasCoords()`, `getStereoTags()`
105
+ - **Properties** — `hasProp()`, `getProp()`, `setProp()`, `clearProp()`, `getPropMap()`
106
+ - **Info** — `isDeleted`, `numAtoms`, `numHeavyAtoms`, `numBonds`, `hasCoords()`, `getStereoTags()`
105
107
 
106
108
  ### `MolArray`
107
109
 
Binary file
package/dist/index.d.ts CHANGED
@@ -272,7 +272,10 @@ interface JSMol {
272
272
  * @param {boolean} acceptFailure
273
273
  */
274
274
  generate_aligned_coords(templateMol: JSMol, options: JSONString): string;
275
- /** Returns true if the molecule's structure is valid */
275
+ /**
276
+ * Returns true if the molecule's structure is valid
277
+ * @deprecated An invalid molecule is `null`. Kept for backward compatibility.
278
+ */
276
279
  is_valid(): boolean;
277
280
  /** Returns the total number of atoms in the molecule */
278
281
  get_num_atoms(): number;
@@ -1377,7 +1380,13 @@ declare class Mol implements Disposable {
1377
1380
  * // With atom highlighting
1378
1381
  * const svg = mol.getSVG({ atoms: [0, 1, 2], highlightColour: [1, 0, 0, 1] });
1379
1382
  */
1380
- getSVG(options?: Partial<RDKitDepictionDetails>): string;
1383
+ getSVG(options?: Partial<Exclude<RDKitDepictionDetails, 'returnDrawCoords'> & {
1384
+ returnDrawCoords: never;
1385
+ }>): string;
1386
+ getSVGWithDrawCoords(options?: Partial<RDKitDepictionDetails>): {
1387
+ svg: string;
1388
+ drawCoords: [number, number, number][];
1389
+ };
1381
1390
  /**
1382
1391
  * Returns the first substructure match
1383
1392
  *
@@ -1445,8 +1454,6 @@ declare class Mol implements Disposable {
1445
1454
  includePrivate?: boolean;
1446
1455
  includeComputed?: boolean;
1447
1456
  }): Map<string, any>;
1448
- /** Returns true if the molecule's structure is valid */
1449
- isValid(): boolean;
1450
1457
  /** Returns the number of atoms in the molecule */
1451
1458
  get numAtoms(): number;
1452
1459
  /** Returns the number of heavy atoms in the molecule (excluding hydrogens and dummy atoms) */
@@ -1832,7 +1839,8 @@ declare class RDKit {
1832
1839
  * @returns A Mol instance, or null if the input is invalid.
1833
1840
  * Pass `{ throwOnError: true }` to throw a {@link RDKitParseError} instead.
1834
1841
  */
1835
- getMol(input: string | Uint8Array, options?: Partial<RDKitGetMolOptions> & {
1842
+ getMol(input: string | Uint8Array): Mol | null;
1843
+ getMol(input: string | Uint8Array, options: Partial<RDKitGetMolOptions> & {
1836
1844
  throwOnError: true;
1837
1845
  }): Mol;
1838
1846
  getMol(input: string | Uint8Array, options?: Partial<RDKitGetMolOptions>): Mol | null;
@@ -1843,7 +1851,8 @@ declare class RDKit {
1843
1851
  * @returns A Mol instance, or null if the input is invalid.
1844
1852
  * Pass `{ throwOnError: true }` to throw a {@link RDKitParseError} instead.
1845
1853
  */
1846
- getQMol(input: string, options?: Partial<RDKitGetQMolOptions> & {
1854
+ getQMol(input: string): Mol | null;
1855
+ getQMol(input: string, options: Partial<RDKitGetQMolOptions> & {
1847
1856
  throwOnError: true;
1848
1857
  }): Mol;
1849
1858
  getQMol(input: string, options?: Partial<RDKitGetQMolOptions>): Mol | null;
package/dist/index.js CHANGED
@@ -110,8 +110,6 @@ var import_RDKit_minimal = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMi
110
110
  if (HEAPU32[0] != 1668509029) abort("Runtime error: The application has corrupted its heap memory area (address zero)!");
111
111
  }
112
112
  var readyPromiseResolve, readyPromiseReject;
113
- var HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;
114
- var HEAP64, HEAPU64;
115
113
  var runtimeInitialized = false;
116
114
  function updateMemoryViews() {
117
115
  var b = wasmMemory.buffer;
@@ -218,6 +216,16 @@ var import_RDKit_minimal = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMi
218
216
  wasmBinaryFile ??= findWasmBinary();
219
217
  return receiveInstantiationResult(await instantiateAsync(wasmBinary, wasmBinaryFile, info));
220
218
  }
219
+ var HEAP16;
220
+ var HEAP32;
221
+ var HEAP64;
222
+ var HEAP8;
223
+ var HEAPF32;
224
+ var HEAPF64;
225
+ var HEAPU16;
226
+ var HEAPU32;
227
+ var HEAPU64;
228
+ var HEAPU8;
221
229
  var callRuntimeCallbacks = (callbacks) => {
222
230
  while (callbacks.length > 0) callbacks.shift()(Module);
223
231
  };
@@ -225,10 +233,10 @@ var import_RDKit_minimal = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMi
225
233
  var addOnPostRun = (cb) => onPostRuns.push(cb);
226
234
  var onPreRuns = [];
227
235
  var addOnPreRun = (cb) => onPreRuns.push(cb);
228
- var ptrToString = (ptr) => {
236
+ function ptrToString(ptr) {
229
237
  ptr >>>= 0;
230
238
  return "0x" + ptr.toString(16).padStart(8, "0");
231
- };
239
+ }
232
240
  var syscallGetVarargI = () => {
233
241
  var ret = HEAP32[+SYSCALLS.varargs >>> 2 >>> 0];
234
242
  SYSCALLS.varargs += 4;
@@ -4130,10 +4138,19 @@ var Mol = class Mol {
4130
4138
  * const svg = mol.getSVG({ atoms: [0, 1, 2], highlightColour: [1, 0, 0, 1] });
4131
4139
  */
4132
4140
  getSVG(options) {
4141
+ if (options?.returnDrawCoords) throw new Error("getSVG does not support returnDrawCoords option. Use getSVGWithDrawCoords instead.");
4133
4142
  const mol = this.jsMol;
4134
4143
  if (!options) return mol.get_svg();
4135
4144
  return mol.get_svg_with_highlights(JSON.stringify(options));
4136
4145
  }
4146
+ getSVGWithDrawCoords(options) {
4147
+ const opts = {
4148
+ ...options,
4149
+ returnDrawCoords: true
4150
+ };
4151
+ const resultJson = this.jsMol.get_svg_with_highlights(JSON.stringify(opts));
4152
+ return JSON.parse(resultJson);
4153
+ }
4137
4154
  /**
4138
4155
  * Returns the first substructure match
4139
4156
  *
@@ -4268,10 +4285,6 @@ var Mol = class Mol {
4268
4285
  sl.delete();
4269
4286
  return result;
4270
4287
  }
4271
- /** Returns true if the molecule's structure is valid */
4272
- isValid() {
4273
- return this.jsMol.is_valid();
4274
- }
4275
4288
  /** Returns the number of atoms in the molecule */
4276
4289
  get numAtoms() {
4277
4290
  return this.jsMol.get_num_atoms();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rdkit-esm",
3
- "version": "0.6.0",
3
+ "version": "0.7.0-rc.0",
4
4
  "description": "RDKit minimal lib for the modern web.",
5
5
  "homepage": "https://github.com/tandemai/rdkit-esm#readme",
6
6
  "bugs": {
@@ -27,7 +27,7 @@
27
27
  "dev": "tsdown --watch",
28
28
  "fmt": "oxfmt",
29
29
  "fmt:check": "oxfmt --check",
30
- "test": "vitest",
30
+ "test": "vitest --typecheck",
31
31
  "coverage": "vitest run --coverage",
32
32
  "typecheck": "tsgo --noEmit",
33
33
  "prepublishOnly": "pnpm run build"