{"_id":"@butlerov-chemistry/core","_rev":"5-6457277feca9c70aec9a7912271ae277","name":"@butlerov-chemistry/core","dist-tags":{"latest":"0.1.6"},"versions":{"0.1.1":{"name":"@butlerov-chemistry/core","version":"0.1.1","keywords":["chemistry","structure","2d"],"author":{"name":"Project team"},"license":"MIT","_id":"@butlerov-chemistry/core@0.1.1","maintainers":[{"name":"au1985","email":"austinov@yandex.ru"}],"dist":{"shasum":"096a1a7b74376be974c9a8bfff5388fc91b94a04","tarball":"https://registry.npmjs.org/@butlerov-chemistry/core/-/core-0.1.1.tgz","fileCount":31,"integrity":"sha512-Nf3Hq5JKVou5N+wfdwL5aUbexOFeJqV23CyHF25dQuuKwWTs+EH74qhCaHeJg/b04V56Ad8LfmYQlZxa2d/W5w==","signatures":[{"sig":"MEYCIQDFc3bYwJrdT4zO4suXGE9DseOGO9UNSCcgA1XbG+qs6AIhAMU5T4b0CM0RxPlj3PjGmpG532FqTZoYFb1UJrstSHzK","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":759868},"main":"dist/butlerov.umd.cjs","type":"module","build":{"appId":"com.lumiprobe.butlerov.app"},"types":"dist/main.d.js","module":"src/main.ts","gitHead":"71f4f50eee0def1f2b09e7e864729fce671a1119","scripts":{"dev":"vite","lint":"eslint","test":"jest","build":"vite build","clean":"rimraf -g dist","prepare":"npm run build","prepublishOnly":"npm run test"},"_npmUser":{"name":"au1985","email":"austinov@yandex.ru"},"_npmVersion":"10.8.2","description":"Draw chemical structures with js and Konva","directories":{},"_nodeVersion":"20.18.2","dependencies":{"konva":"^9.3.16"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","canvas":"^2.11.2","ts-jest":"^29.2.5","ts-node":"^10.9.2","@types/jest":"^29.5.14","vite-plugin-dts":"^4.3.0","@testing-library/dom":"^10.4.0","jest-environment-jsdom":"^29.7.0","@stylistic/eslint-plugin-js":"^2.13.0","@testing-library/user-event":"^14.5.2"},"_npmOperationalInternal":{"tmp":"tmp/core_0.1.1_1740254515196_0.3694443628322319","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@butlerov-chemistry/core","version":"0.1.3","keywords":["chemistry","structure","2d"],"author":{"name":"Project team"},"license":"MIT","_id":"@butlerov-chemistry/core@0.1.3","maintainers":[{"name":"au1985","email":"austinov@yandex.ru"}],"dist":{"shasum":"d3d9174b38ff2b20993f455b1fde485b3f984e57","tarball":"https://registry.npmjs.org/@butlerov-chemistry/core/-/core-0.1.3.tgz","fileCount":5,"integrity":"sha512-XP0Ds5c9DM5VzzNzDZsLUO5xQrvswePo6ep47Tyco4p0GLCQY2rkWSTBP814L+gJ2Z03pj37RslAgGCMRUbb9Q==","signatures":[{"sig":"MEUCIFSMOnu5BX6OxkKPWrIrE8k1HYd4W7D9SNhnYXZh6nH9AiEAlOfzMJdil4Ys3zJNo/Ao9OwRlJ9w9I+oKQNl502F6vA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":706057},"main":"./dist/butlerov.umd.cjs","type":"module","build":{"appId":"com.lumiprobe.butlerov.app"},"types":"./dist/main.d.ts","module":"./dist/butlerov.es.cjs","exports":{".":{"import":{"types":"./dist/main.d.ts","default":"./dist/butlerov.es.cjs"},"require":{"types":"./dist/main.d.ts","default":"./dist/butlerov.umd.cjs"}}},"gitHead":"83d230ec3f40efed1f198ad0e689e26e425fca71","scripts":{"dev":"vite","lint":"eslint","test":"jest","build":"vite build","clean":"rimraf -g dist","prepare":"npm run build","prepublishOnly":"npm run test"},"_npmUser":{"name":"au1985","email":"austinov@yandex.ru"},"_npmVersion":"10.8.2","description":"Draw chemical structures with js and Konva","directories":{},"_nodeVersion":"20.19.6","dependencies":{"konva":"^9.3.16"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","canvas":"^2.11.2","ts-jest":"^29.2.5","ts-node":"^10.9.2","@types/jest":"^29.5.14","vite-plugin-dts":"^4.3.0","@testing-library/dom":"^10.4.0","jest-environment-jsdom":"^29.7.0","@stylistic/eslint-plugin-js":"^2.13.0","@testing-library/user-event":"^14.5.2"},"_npmOperationalInternal":{"tmp":"tmp/core_0.1.3_1766586393612_0.6717600440790978","host":"s3://npm-registry-packages-npm-production"}},"0.1.4":{"name":"@butlerov-chemistry/core","version":"0.1.4","keywords":["chemistry","structure","2d"],"author":{"name":"Project team"},"license":"MIT","_id":"@butlerov-chemistry/core@0.1.4","maintainers":[{"name":"au1985","email":"austinov@yandex.ru"}],"homepage":"https://github.com/eizemazal/butlerov#readme","bugs":{"url":"https://github.com/eizemazal/butlerov/issues"},"dist":{"shasum":"7ae88036f3689590469c9c4af860fc4df46cfdfc","tarball":"https://registry.npmjs.org/@butlerov-chemistry/core/-/core-0.1.4.tgz","fileCount":5,"integrity":"sha512-9UMxokzsMyFE4FEY/rgZ9Tft8GUoiNplO0sxL7Cln6Lz+GeSH0ictBSKm5RSlnXpkF+RcOqUUxXUGpPEIIH+rQ==","signatures":[{"sig":"MEYCIQCsgr0yAj681t7hWCvd1+CJFRTCIMvbivizrE8uIbVqMAIhAK3MEtMZZ+KjAG+GnhAMaXm98bZhmz1IQLh+/ENcCoY/","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@butlerov-chemistry%2fcore@0.1.4","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":777425},"main":"./dist/butlerov.umd.cjs","type":"module","build":{"appId":"com.lumiprobe.butlerov.app"},"types":"./dist/main.d.ts","module":"./dist/butlerov.es.cjs","exports":{".":{"import":{"types":"./dist/main.d.ts","default":"./dist/butlerov.es.cjs"},"require":{"types":"./dist/main.d.ts","default":"./dist/butlerov.umd.cjs"}}},"gitHead":"b767341cfc441180e13e0736d12f12b9ab8bf3e2","scripts":{"dev":"vite","lint":"eslint","test":"vitest run","build":"vite build","clean":"rimraf -g dist","prepare":"npm run build","pretest":"playwright install chromium"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:02c1a1b3-20a8-4d3d-baa9-60ed48a75365"}},"repository":{"url":"git+https://github.com/eizemazal/butlerov.git","type":"git","directory":"packages/core"},"_npmVersion":"11.5.1","description":"Draw chemical structures with js and Konva","directories":{},"_nodeVersion":"24.14.0","dependencies":{"konva":"^9.3.18"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.0","globals":"^15.15.0","playwright":"^1.53.2","vite-plugin-dts":"^4.5.0","@vitest/coverage-v8":"^4.1.0","@testing-library/dom":"^10.4.0","@vitest/browser-playwright":"^4.1.0","@stylistic/eslint-plugin-js":"^2.13.0","@testing-library/user-event":"^14.6.1"},"_npmOperationalInternal":{"tmp":"tmp/core_0.1.4_1774732634010_0.6168496678578224","host":"s3://npm-registry-packages-npm-production"}},"0.1.5":{"name":"@butlerov-chemistry/core","version":"0.1.5","keywords":["chemistry","structure","2d"],"author":{"name":"Project team"},"license":"MIT","_id":"@butlerov-chemistry/core@0.1.5","maintainers":[{"name":"au1985","email":"austinov@yandex.ru"}],"homepage":"https://github.com/eizemazal/butlerov#readme","bugs":{"url":"https://github.com/eizemazal/butlerov/issues"},"dist":{"shasum":"34b01e6aedb43573d5db036d434a9583293f94d4","tarball":"https://registry.npmjs.org/@butlerov-chemistry/core/-/core-0.1.5.tgz","fileCount":5,"integrity":"sha512-Qk9rboATW77/v+S3rusNeMzeEzAcEkjQGZLZMsXRD57iUBFp2Sa+qu3T7wsjR+UfZjHL38Gbf7St/VGJj4x+ZA==","signatures":[{"sig":"MEQCIBxef7j4TR/9ljPdqwjG682Xy6FqqgjMIpmwkz+xo+kaAiBKAwWNEw5TQ98JZg/C4GoGYLl3bGJh+ivfXXXg5s40FA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@butlerov-chemistry%2fcore@0.1.5","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":779945},"main":"./dist/butlerov.umd.cjs","type":"module","build":{"appId":"com.lumiprobe.butlerov.app"},"types":"./dist/main.d.ts","module":"./dist/butlerov.es.cjs","exports":{".":{"import":{"types":"./dist/main.d.ts","default":"./dist/butlerov.es.cjs"},"require":{"types":"./dist/main.d.ts","default":"./dist/butlerov.umd.cjs"}}},"gitHead":"ac01ad1b039e8fc5315825b122768e415d722a45","scripts":{"dev":"vite","lint":"eslint","test":"vitest run","build":"vite build","clean":"rimraf -g dist","prepare":"npm run build","pretest":"playwright install chromium"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:02c1a1b3-20a8-4d3d-baa9-60ed48a75365"}},"repository":{"url":"git+https://github.com/eizemazal/butlerov.git","type":"git","directory":"packages/core"},"_npmVersion":"11.5.1","description":"Draw chemical structures with js and Konva","directories":{},"_nodeVersion":"24.14.0","dependencies":{"konva":"^9.3.18"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.0","globals":"^15.15.0","playwright":"^1.53.2","vite-plugin-dts":"^4.5.0","@vitest/coverage-v8":"^4.1.0","@testing-library/dom":"^10.4.0","@vitest/browser-playwright":"^4.1.0","@stylistic/eslint-plugin-js":"^2.13.0","@testing-library/user-event":"^14.6.1"},"_npmOperationalInternal":{"tmp":"tmp/core_0.1.5_1774874010179_0.9230261318667705","host":"s3://npm-registry-packages-npm-production"}},"0.1.6":{"name":"@butlerov-chemistry/core","version":"0.1.6","description":"Draw chemical structures with js and Konva","type":"module","main":"./dist/butlerov.umd.cjs","module":"./dist/butlerov.es.cjs","types":"./dist/main.d.ts","exports":{".":{"import":{"types":"./dist/main.d.ts","default":"./dist/butlerov.es.cjs"},"require":{"types":"./dist/main.d.ts","default":"./dist/butlerov.umd.cjs"}}},"build":{"appId":"com.lumiprobe.butlerov.app"},"scripts":{"build":"vite build","dev":"vite","clean":"rimraf -g dist","lint":"eslint","pretest":"playwright install chromium","test":"vitest run","prepare":"npm run build"},"keywords":["chemistry","structure","2d"],"author":{"name":"Project team"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/eizemazal/butlerov.git","directory":"packages/core"},"devDependencies":{"@stylistic/eslint-plugin-js":"^2.13.0","@testing-library/dom":"^10.4.0","@testing-library/user-event":"^14.6.1","@vitest/browser-playwright":"^4.1.0","@vitest/coverage-v8":"^4.1.0","globals":"^15.15.0","playwright":"^1.53.2","vite-plugin-dts":"^4.5.0","vitest":"^4.1.0"},"dependencies":{"konva":"^9.3.18"},"_id":"@butlerov-chemistry/core@0.1.6","gitHead":"4679d8eb8b0986f2c9838851d67ca318b4ea54ee","bugs":{"url":"https://github.com/eizemazal/butlerov/issues"},"homepage":"https://github.com/eizemazal/butlerov#readme","_nodeVersion":"24.14.0","_npmVersion":"11.5.1","dist":{"integrity":"sha512-q8JKe2MFogJVJSvwEcFa7qtcbbSLRwR7bdjvgQ+imrbtpBhKhssbNGUsJJubPL3MnqCnISu1dy0ad5pwQdboDg==","shasum":"170b8d601b5176415b1efbe7f7398a5b7b0e76f9","tarball":"https://registry.npmjs.org/@butlerov-chemistry/core/-/core-0.1.6.tgz","fileCount":5,"unpackedSize":781406,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@butlerov-chemistry%2fcore@0.1.6","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD1xF/hAnZXKh87QeM1yLbXJacE+JjfAsapryivwkZucgIhAPQWiXJIvyYdlM13feASN0bY5i9gTUWVgu2Gk0KeZ8ms"}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:02c1a1b3-20a8-4d3d-baa9-60ed48a75365"}},"directories":{},"maintainers":[{"name":"au1985","email":"austinov@yandex.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/core_0.1.6_1774988772984_0.5280444781969884"},"_hasShrinkwrap":false}},"time":{"created":"2025-02-22T20:01:55.092Z","modified":"2026-03-31T20:26:13.529Z","0.1.1":"2025-02-22T20:01:55.450Z","0.1.3":"2025-12-24T14:26:33.799Z","0.1.4":"2026-03-28T21:17:14.207Z","0.1.5":"2026-03-30T12:33:30.391Z","0.1.6":"2026-03-31T20:26:13.198Z"},"bugs":{"url":"https://github.com/eizemazal/butlerov/issues"},"author":{"name":"Project team"},"license":"MIT","homepage":"https://github.com/eizemazal/butlerov#readme","keywords":["chemistry","structure","2d"],"repository":{"type":"git","url":"git+https://github.com/eizemazal/butlerov.git","directory":"packages/core"},"description":"Draw chemical structures with js and Konva","maintainers":[{"name":"au1985","email":"austinov@yandex.ru"}],"readme":"# `@butlerov-chemistry/core`\n\nButlerov **core** is the Konva-based chemical structure editor. Use it from **npm** in bundled apps or from a **single script tag** on vanilla HTML pages.\n\nThe UMD build exposes the global name **`butlerov`** (see [Build output](#build-output)).\n\n---\n\n## Install\n\n```bash\nnpm i @butlerov-chemistry/core\n```\n\n---\n\n## ES modules (bundlers, `type=\"module\"`)\n\n```javascript\nimport {\n  MoleculeEditor,\n  MolConverter,\n  SmilesConverter,\n  MW,\n  Formula,\n  defaultStyle,\n  lightTheme,\n} from \"@butlerov-chemistry/core\";\n\nconst stageEl = document.getElementById(\"editor\");\nconst mol = new MolConverter();\n\nconst editor = new MoleculeEditor({\n  stage: stageEl,\n  mode: \"structure\",\n  theme: \"light\",\n  style: defaultStyle,\n  autofocus: true,\n});\n\neditor.onchange = () => {\n  const mw = new MW(editor.graph).compute();\n  console.log(\"Molecular weight:\", mw != null ? mw.toFixed(2) : \"—\");\n};\n\n// Optional: load / save MOL text\n// editor.load(molString, mol);\n// const molText = editor.save(mol);\n```\n\n`MoleculeEditor` expects a **stage** that is either an `HTMLDivElement` (Konva creates the stage inside it) or an existing Konva `Stage`. You must pass **`mode`**: `\"structure\"` for molecule editing, or `\"scheme\"` for document-style canvases.\n\n---\n\n## Vanilla HTML page (UMD script)\n\nAfter `npm run build` in this package, the browser bundle is:\n\n| File | Role |\n|------|------|\n| `dist/butlerov.umd.cjs` | UMD bundle, global `butlerov` |\n| `dist/butlerov.es.cjs` | ES module |\n\nCopy `dist/butlerov.umd.cjs` into your site (or consume it from npm and serve from `node_modules`), then:\n\n```html\n<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\" />\n    <title>Butlerov</title>\n    <script src=\"./butlerov.umd.cjs\"></script>\n  </head>\n  <body>\n    <div id=\"stage\" style=\"width: 800px; height: 500px; border: 1px solid #ccc\"></div>\n    <script>\n      const editor = new butlerov.MoleculeEditor({\n        stage: document.getElementById(\"stage\"),\n        mode: \"structure\",\n      });\n      editor.onchange = function () {\n        const g = editor.graph;\n        const mw = new butlerov.MW(g).compute();\n        console.log(\"MW\", mw);\n      };\n    </script>\n  </body>\n</html>\n```\n\nFrom a CDN (adjust version as needed):\n\n```html\n<script src=\"https://unpkg.com/@butlerov-chemistry/core@latest/dist/butlerov.umd.cjs\"></script>\n```\n\n---\n\n## Main API (quick reference)\n\n| Member | Purpose |\n|--------|---------|\n| `new MoleculeEditor({ stage, mode, ... })` | Create editor; `mode` is `\"structure\"` or `\"scheme\"`. |\n| `editor.graph` / `editor.graph = graph` | Read/write native **`Graph`** model. |\n| `editor.document` | Read/write full **`Document`** (scheme mode / multi-object). |\n| `editor.load(string, converter)` | Load from MOL/SMILES/etc. via a **`Converter`**. |\n| `editor.save(converter)` | Serialize with **`MolConverter`**, **`SmilesConverter`**, etc. |\n| `editor.onchange` | Callback after edits. |\n| `editor.readonly` | When `true`, view-only (no editing). |\n| `editor.clear(fromUserspace?)` | Clear canvas. |\n| `new MW(graph).compute()` | Molecular weight. |\n| `new Formula(graph).compute_as_html()` | Formula HTML. |\n| `new MolConverter()` / `new SmilesConverter()` | MOL V2000/V3000 and SMILES interop where implemented. |\n\nFor themes and styling, import `defaultStyle`, `lightTheme`, `darkTheme`, and pass `theme` / `style` in the constructor or assign `editor.theme` / `editor.style` after creation.\n\n---\n\n## Development server (this package)\n\n```bash\nnpm run dev\n```\n\nVite dev server with HMR (default `http://localhost:5173/`).\n\n---\n\n## Repository layout\n\nMonorepo root: [README.md](../../README.md). Related packages: [Vue component](../vue/README.md), [desktop app](../app/README.md).\n","readmeFilename":"README.md"}