{"name":"path2d-polyfill","version":"3.1.2","keywords":["Path2D","polyfill","canvas","roundRect"],"author":{"name":"nilzona"},"license":"MIT","_id":"path2d-polyfill@3.1.2","homepage":"https://github.com/nilzona/path2d-polyfill#readme","bugs":{"url":"https://github.com/nilzona/path2d-polyfill/issues"},"dist":{"shasum":"da4b4e46d8c45f2ff070546e1693c50ea9659cc5","tarball":"http://registry-npm.ywwl.com/path2d-polyfill/download/path2d-polyfill-3.1.2.tgz","fileCount":4,"integrity":"sha512-rmd/vZBtonqV3eOF+47cVEOyp6APiG7m4V0ue1+R79Fgqq2eNgScY/LCEAvTM86vTeMnrePpqrCIeZMLKJKAXw==","signatures":[{"sig":"MEYCIQDAxOUiRvBDVG2zsfJNYWNj7/1T8Qtw3j7xBoRG4OMA4QIhANKKfF8uplE4z/lS7hsoWlJg/EnhyFbsYRnnEKTWzese","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":10979,"size":4475,"noattachment":false,"key":"/path2d-polyfill/-/path2d-polyfill-3.1.2.tgz"},"type":"module","_from":"file:path2d-polyfill-3.1.2.tgz","browser":"dist/path2d-polyfill.min.js","exports":{"browser":"./dist/path2d-polyfill.min.js"},"scripts":{"dev":"vite","lint":"eslint .","test":"vitest run","build":"vite build && cp dist/path2d-polyfill.min.js test/path2d-polyfill.min.js","preview":"vite preview","test:watch":"vitest","check-types":"tsc --noEmit","format:check":"prettier --check '**' --ignore-unknown","format:write":"prettier --write '**' --ignore-unknown","test:coverage":"vitest run --coverage"},"_npmUser":{"name":"nilzona_user","email":"nilssonanders79@gmail.com"},"prettier":"@qlik/prettier-config","_resolved":"/tmp/32bc2f0b88547dc2ebc67815518661d8/path2d-polyfill-3.1.2.tgz","_integrity":"sha512-rmd/vZBtonqV3eOF+47cVEOyp6APiG7m4V0ue1+R79Fgqq2eNgScY/LCEAvTM86vTeMnrePpqrCIeZMLKJKAXw==","repository":{"url":"git+https://github.com/nilzona/path2d-polyfill.git","type":"git"},"_npmVersion":"10.7.0","description":"Polyfills Path2D api for canvas rendering","directories":{},"_nodeVersion":"20.15.0","browserslist":[">0.1%","ie >= 11","last 2 versions","not dead"],"dependencies":{"path2d":"^0.2.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^5.3.2","jsdom":"^24.1.0","eslint":"^8.57.0","vitest":"^1.6.0","prettier":"^3.3.2","typescript":"^5.5.2","@babel/core":"^7.24.7","@qlik/tsconfig":"^0.2.6","@babel/preset-env":"^7.24.7","@qlik/eslint-config":"^0.7.25","@vitest/coverage-v8":"^1.6.0","@rollup/plugin-babel":"^6.0.4","@qlik/prettier-config":"^0.4.15"},"_npmOperationalInternal":{"tmp":"tmp/path2d-polyfill_3.1.2_1719665377242_0.6101447201694894","host":"s3://npm-registry-packages"},"readme":"# path2d-polyfill\n\n[![CI](https://github.com/nilzona/path2d-polyfill/actions/workflows/ci.yml/badge.svg)](https://github.com/nilzona/path2d-polyfill/actions/workflows/ci.yml)\n\nPolyfills `Path2D` api and `roundRect` for CanvasRenderingContext2D\n\n## Usage\n\nAdd this script tag to your page to enable the feature.\n\n```html\n<script lang=\"javascript\" src=\"https://cdn.jsdelivr.net/npm/path2d-polyfill/dist/path2d-polyfill.min.js\"></script>\n```\n\nThis will polyfill the browser's window object with Path2D features and it will also polyfill roundRect if they are missing in both CanvasRenderingContexst and Path2D.\n\nExample of usage\n\n```javascript\nctx.fill(new Path2D(\"M 80 80 A 45 45 0 0 0 125 125 L 125 80 Z\"));\nctx.stroke(new Path2D(\"M 80 80 A 45 45 0 0 0 125 125 L 125 80 Z\"));\n\n// or ...\nconst path = new Path2D();\npath.roundRect(10, 10, 100, 60, { x: 20, y: 10 }); // Elliptical corners\nctx.stroke(path);\n\n// Mixed corner types\nconst path2 = new Path2D();\npath2.roundRect(10, 10, 100, 60, [{ x: 15, y: 5 }, 10, { x: 5, y: 15 }, 8]);\nctx.stroke(path2);\n```\n\n## Support table\n\n| Method               | Supported |\n| -------------------- | :-------: |\n| constructor(SVGPath) |    Yes    |\n| addPath()            |    Yes    |\n| closePath()          |    Yes    |\n| moveTo()             |    Yes    |\n| lineTo()             |    Yes    |\n| bezierCurveTo()      |    Yes    |\n| quadraticCurveTo()   |    Yes    |\n| arc()                |    Yes    |\n| ellipse()            |    Yes    |\n| rect()               |    Yes    |\n| roundRect()          |    Yes    |\n\n## See it in action\n\nClone [path2d-polyfill](https://github.com/nilzona/path2d-polyfill)\n\n```shell\npnpm install\npnpm dev\n```\n\nopen <http://localhost:5173/> to see the example page.\n\n## Contributing\n\nRecommended to use vscode with the prettier extension to keep formatting intact.\n","publish_time":1719665377389,"maintainers":[{"name":"nilzona_user","email":"nilssonanders79@gmail.com"}],"_cnpm_publish_time":1719665377389,"dist-tags":{"beta":"2.0.0-beta.0","latest":"3.2.4"}}