{"_id":"@bmlt-enabled/qrcode-svg","name":"@bmlt-enabled/qrcode-svg","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@bmlt-enabled/qrcode-svg","version":"1.0.0","description":"A simple QR Code generator in pure JavaScript (browser and Node.js, ESM)","author":{"name":"bmlt-enabled"},"license":"MIT","type":"module","types":"./dist/qrcode.d.ts","exports":{".":{"types":"./dist/qrcode.d.ts","import":"./dist/qrcode.js","default":"./dist/qrcode.js"}},"sideEffects":false,"scripts":{"build":"vite build && cp src/qrcode.d.ts dist/qrcode.d.ts","test":"vitest run","test:watch":"vitest","lint":"eslint .","format":"prettier --write .","all":"npm run format && npm run lint && npm test && npm run build"},"prettier":{"singleQuote":true,"semi":false,"tabWidth":4},"publishConfig":{"access":"public"},"keywords":["qrcode","svg"],"repository":{"type":"git","url":"git+https://github.com/bmlt-enabled/qrcode-svg.git"},"bugs":{"url":"https://github.com/bmlt-enabled/qrcode-svg/issues"},"homepage":"https://github.com/bmlt-enabled/qrcode-svg","engines":{"node":">=22"},"devDependencies":{"eslint":"^10.1.0","eslint-config-prettier":"^10.1.8","globals":"^17.4.0","prettier":"^3.8.1","vite":"^8.0.0","vitest":"^4.1.0"},"gitHead":"7c98718d5edd7627670e70dff23c3ad167ccd330","_id":"@bmlt-enabled/qrcode-svg@1.0.0","_nodeVersion":"22.19.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-gbbqhx+QfQZ2IX3odx3lZE6IPHsqhUCxbPsBmugnHueA8VrgAn2VigvVyLQkQQCfXVg4I7Sfhe91Kllpl+0RLg==","shasum":"2211e8aeb1f4d12784277576c4d4580bdc771e51","tarball":"https://registry.npmjs.org/@bmlt-enabled/qrcode-svg/-/qrcode-svg-1.0.0.tgz","fileCount":5,"unpackedSize":36386,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIF+L3uUajyUF0rC8OIop7DgaocZTq3Hmikz1NoaKh6XBAiEA2iPdljySEc6HWLCgtHlSJL+3XcGvNAZtPGL/QF88X5A="}]},"_npmUser":{"name":"fortyseven","email":"admin@bmlt.app"},"directories":{},"maintainers":[{"name":"dgershman","email":"danny.gershman@gmail.com"},{"name":"pjaudiomv","email":"pjaudiomv@gmail.com"},{"name":"jbraswell","email":"jon.braswell@gmail.com"},{"name":"fortyseven","email":"admin@bmlt.app"},{"name":"weinberg135","email":"weinberg135@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/qrcode-svg_1.0.0_1775873275547_0.8628376500690562"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-11T02:07:55.472Z","1.0.0":"2026-04-11T02:07:55.686Z","modified":"2026-04-11T02:07:55.907Z"},"maintainers":[{"name":"dgershman","email":"danny.gershman@gmail.com"},{"name":"pjaudiomv","email":"pjaudiomv@gmail.com"},{"name":"jbraswell","email":"jon.braswell@gmail.com"},{"name":"fortyseven","email":"admin@bmlt.app"},{"name":"weinberg135","email":"weinberg135@gmail.com"}],"description":"A simple QR Code generator in pure JavaScript (browser and Node.js, ESM)","homepage":"https://github.com/bmlt-enabled/qrcode-svg","keywords":["qrcode","svg"],"repository":{"type":"git","url":"git+https://github.com/bmlt-enabled/qrcode-svg.git"},"author":{"name":"bmlt-enabled"},"bugs":{"url":"https://github.com/bmlt-enabled/qrcode-svg/issues"},"license":"MIT","readme":"## Introduction\n\nAn ES module for generating SVG QR codes in pure JavaScript. Works in the browser and Node.js (>=22).\n\n- pure JavaScript, zero dependencies\n- ESM only\n- SVG output\n\n## Getting Started\n\nInstall the package:\n\n```bash\nnpm install @bmlt-enabled/qrcode-svg\n```\n\nInline example:\n\n```javascript\nimport QRCode from '@bmlt-enabled/qrcode-svg'\n\nconst svg = new QRCode('Hello World!').svg()\n```\n\nMore options:\n\n```javascript\nconst qrcode = new QRCode({\n    content: 'http://github.com/',\n    padding: 4,\n    width: 256,\n    height: 256,\n    color: '#000000',\n    background: '#ffffff',\n    ecl: 'M',\n})\nconst svg = qrcode.svg()\n```\n\n## Options\n\n**List of options:**\n\n- **content** - QR Code content, the only **required** parameter\n- **padding** - white space padding, `4` modules by default, `0` for no border\n- **width** - QR Code width in pixels\n- **height** - QR Code height in pixels\n- **color** - color of modules (squares), color name or hex string, e.g. `#000000`\n- **background** - color of background, color name or hex string, e.g. `white`\n- **ecl** - error correction level: `L`, `M`, `Q`, `H`\n- **join** - join modules (squares) into one shape, into the SVG `path` element, **recommended** for web and responsive use, default: `false`\n- **predefined** - to create a squares as pattern, then populate the canvas, default: `false`, see the output examples below\n- **pretty** - apply indents and new lines, default: `true`\n- **swap** - swap X and Y modules, only if you have issues with some QR readers, default: `false`\n- **xmlDeclaration** - prepend XML declaration to the SVG document, i.e. `<?xml version=\"1.0\" standalone=\"yes\"?>`, default: `true`\n- **container** - wrapping element, default: `svg`, see below\n- **typeNumber** - QR version (1–40), determined automatically if not set\n\n**Container options:**\n\n- **svg** - populate squares in a SVG document with `width` and `height` attributes, recommended for converting to raster images or PDF where QR Code is being static (exact size)\n- **svg-viewbox** - populate squares in a SVG document with `viewBox` attribute, **recommended** for responsive web pages\n- **g** - put squares in `g` element, useful when you need to put multiple QR Codes in a single SVG document\n- **none** - no wrapper\n- **path-data** - returns only the raw SVG path data string (join mode is applied automatically)\n\n## SVG output\n\n### Editable squares\n\nThis mode is useful for designers to manipulate with particular squares.\nThus, one can open the QR Code in an editor, select particular modules, move around, change color, etc.\nHowever, some old SVG viewers may generate minor gaps between the squares - the side effect when rendering an image at certain zoom level.\n\nDefault options\n\n```javascript\nconst qrcode = new QRCode({\n    content: 'Pretty Fox',\n    join: false,\n    predefined: false,\n})\n```\n\nOutput with `rect` elements\n\n```xml\n<?xml version=\"1.0\" standalone=\"yes\"?>\n<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" width=\"256\" height=\"256\">\n  <rect x=\"0\" y=\"0\" width=\"256\" height=\"256\" style=\"fill:#ffffff;shape-rendering:crispEdges;\"/>\n  <rect x=\"16\" y=\"16\" width=\"8\" height=\"8\" style=\"fill:#000000;shape-rendering:crispEdges;\"/>\n  <rect x=\"24\" y=\"16\" width=\"8\" height=\"8\" style=\"fill:#000000;shape-rendering:crispEdges;\"/>\n  <rect x=\"32\" y=\"16\" width=\"8\" height=\"8\" style=\"fill:#000000;shape-rendering:crispEdges;\"/>\n  ...\n</svg>\n```\n\n### Responsive web page\n\nSquares joined into one `path` shape produce a compact file size, i.e. 4-5x reduced compared with `rect` elements.\nA single `path` element will result in an optimized rendering, thus not producing any minor gaps between the squares.\nAlso using the container with `viewBox` attribute may contribute to the responsive scaling on the web.\n\nSet `join` to `true`\n\n```javascript\nconst qrcode = new QRCode({\n    content: 'Pretty Fox',\n    join: true,\n    container: 'svg-viewbox', //Useful but not required\n})\n```\n\nOutput with `path` element\n\n```xml\n<?xml version=\"1.0\" standalone=\"yes\"?>\n<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewBox=\"0 0 256 256\">\n  <rect x=\"0\" y=\"0\" width=\"256\" height=\"256\" style=\"fill:beige;shape-rendering:crispEdges;\"/>\n  <path x=\"0\" y=\"0\" style=\"fill:blue;shape-rendering:crispEdges;\" d=\"M35.31,35.31 V44.14 H44.14 V35.31 H35.31 Z...\" />\n</svg>\n```\n\n### Predefined pattern\n\nAlgorithm defines the square pattern once before populating a canvas. Useful if you want to generate QR Code with candies.\nHowever, some SVG software and converters do not support `defs` or `use` elements.\n\nSet `predefined` to `true`\n\n```javascript\nconst qrcode = new QRCode({\n    content: 'Pretty Fox',\n    predefined: true,\n})\n```\n\nOutput with `defs` and `use` elements\n\n```xml\n<?xml version=\"1.0\" standalone=\"yes\"?>\n<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" width=\"256\" height=\"256\">\n  <defs><path id=\"qrmodule\" d=\"M0 0 h8.827586206896552 v8.827586206896552 H0 z\" style=\"fill:maroon;shape-rendering:crispEdges;\" /></defs>\n  <rect x=\"0\" y=\"0\" width=\"256\" height=\"256\" style=\"fill:beige;shape-rendering:crispEdges;\"/>\n  <use x=\"35.310344827586206\" y=\"35.310344827586206\" href=\"#qrmodule\" />\n  <use x=\"44.13793103448276\" y=\"35.310344827586206\" href=\"#qrmodule\" />\n  ...\n</svg>\n```\n\n## Usage in the browser\n\n```html\n<!DOCTYPE html>\n<html>\n    <body>\n        <div id=\"container\"></div>\n        <script type=\"module\">\n            import QRCode from 'https://cdn.jsdelivr.net/npm/@bmlt-enabled/qrcode-svg/dist/qrcode.js'\n            const qrcode = new QRCode({\n                content: 'Hello World!',\n                container: 'svg-viewbox',\n                join: true,\n            })\n            document.getElementById('container').innerHTML = qrcode.svg()\n        </script>\n    </body>\n</html>\n```\n\nWhen using a bundler (Vite, Webpack, etc.), you can use the bare specifier instead:\n\n```javascript\nimport QRCode from '@bmlt-enabled/qrcode-svg'\n```\n\n## Credits & lineage\n\nThis package is a modernized (ESM-only, browser and Node.js, Vite-built, typed) fork of the `qrcode-svg` library. Full lineage:\n\n- Originally created by [papnkukn/qrcode-svg](https://github.com/papnkukn/qrcode-svg).\n- Forked and deobfuscated by [leMaik/qrcode-svg](https://github.com/leMaik/qrcode-svg/)\n- This fork (`@bmlt-enabled/qrcode-svg`) drops the Node CLI, `save()`/`fs` usage, and the ASCII helper; converts to ESM; adds Vite + Vitest + TypeScript declarations.\n\nThanks to [davidshimjs](https://github.com/davidshimjs/qrcodejs) for the base library, and to [Kazuhiko Arase](http://www.d-project.com/) for the original QR Code in JavaScript algorithm.\n\n## Legal notice\n\nLicensed under the [MIT license](https://opensource.org/license/mit).\n\nThe word \"QR Code\" is a registered trademark of [DENSO WAVE INCORPORATED](https://www.qrcode.com/en/patent.html).\n","readmeFilename":"README.md","_rev":"1-ddc2f3244dc9ee651dd9a4f340f21766"}