{"name":"path2d-polyfill","version":"3.1.0","keywords":["Path2D","polyfill","canvas","roundRect"],"author":{"name":"nilzona"},"license":"MIT","_id":"path2d-polyfill@3.1.0","maintainers":[{"name":"nilzona_user","email":"nilssonanders79@gmail.com"}],"homepage":"https://github.com/nilzona/path2d-polyfill#readme","bugs":{"url":"https://github.com/nilzona/path2d-polyfill/issues"},"dist":{"shasum":"0e15c2d45e90f0ca70950d4ecc52779ed9a7a482","tarball":"http://registry-npm.ywwl.com/path2d-polyfill/download/path2d-polyfill-3.1.0.tgz","fileCount":4,"integrity":"sha512-9Lg30etRKikOEz1pKBEk1rQRAJ/Kv7WACvVVPJao7BSJvYzJpLwPwFaHpFtyrIJD0lh/deISU7GIM46vCK3I+g==","signatures":[{"sig":"MEYCIQDl1nfaB+vuIlk0X9EjLpPKC96E0eGn9IbUuI5iudmHYAIhAIU8SNKbwM+r84lbQ7mqah0zABeOxD/7JxFQaPHKyY0k","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11004,"size":4491,"noattachment":false,"key":"/path2d-polyfill/-/path2d-polyfill-3.1.0.tgz"},"type":"module","_from":"file:path2d-polyfill-3.1.0.tgz","browser":"dist/path2d-polyfill.min.js","engines":{"node":">=18"},"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/f0136680a2131c32febc6cc182f231db/path2d-polyfill-3.1.0.tgz","_integrity":"sha512-9Lg30etRKikOEz1pKBEk1rQRAJ/Kv7WACvVVPJao7BSJvYzJpLwPwFaHpFtyrIJD0lh/deISU7GIM46vCK3I+g==","repository":{"url":"git+https://github.com/nilzona/path2d-polyfill.git","type":"git"},"_npmVersion":"10.2.4","description":"Polyfills Path2D api for canvas rendering","directories":{},"_nodeVersion":"18.19.1","browserslist":[">0.1%","ie >= 11","last 2 versions","not dead"],"dependencies":{"path2d":"0.2.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vite":"5.2.7","jsdom":"24.0.0","eslint":"8.57.0","vitest":"1.4.0","prettier":"3.2.5","typescript":"5.4.3","@babel/core":"7.24.3","@qlik/tsconfig":"0.2.4","@babel/preset-env":"7.24.3","@qlik/eslint-config":"0.7.15","@vitest/coverage-v8":"1.4.0","@rollup/plugin-babel":"6.0.4","@qlik/prettier-config":"0.4.11"},"_npmOperationalInternal":{"tmp":"tmp/path2d-polyfill_3.1.0_1712233791369_0.47985398658327916","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":1712233791525,"_cnpm_publish_time":1712233791525,"dist-tags":{"beta":"2.0.0-beta.0","latest":"3.2.4"}}