{"_id":"path2d","_rev":"3397728","name":"path2d","description":"Path2D API for node. Can be used for server-side rendering with canvas","dist-tags":{"latest":"0.2.1"},"maintainers":[{"name":"nilzona_user","email":""}],"time":{"modified":"2024-08-27T19:03:21.000Z","created":"2024-03-16T22:48:04.794Z","0.2.1":"2024-06-29T12:49:37.467Z","0.2.0":"2024-04-04T12:29:51.639Z","0.1.2":"2024-03-17T19:25:53.748Z","0.1.1":"2024-03-16T23:15:26.830Z","0.0.1":"2024-03-16T22:48:04.794Z"},"users":{},"author":{"name":"nilzona"},"repository":{"type":"git","url":"git+https://github.com/nilzona/path2d-polyfill.git"},"versions":{"0.2.1":{"name":"path2d","version":"0.2.1","description":"Path2D API for node. Can be used for server-side rendering with canvas","keywords":["Path2D","polyfill","canvas","roundRect"],"homepage":"https://github.com/nilzona/path2d-polyfill#readme","bugs":{"url":"https://github.com/nilzona/path2d-polyfill/issues"},"repository":{"type":"git","url":"git+https://github.com/nilzona/path2d-polyfill.git"},"license":"MIT","author":{"name":"nilzona"},"type":"module","exports":{".":{"import":"./dist/index.js","require":"./dist/index.cjs"}},"main":"dist/index.cjs","module":"./dist/index.js","prettier":"@qlik/prettier-config","devDependencies":{"@qlik/eslint-config":"^0.7.25","@qlik/prettier-config":"^0.4.15","@qlik/tsconfig":"^0.2.6","@swc/core":"^1.6.5","@types/node":"^20.14.9","@vitest/coverage-v8":"^1.6.0","eslint":"^8.57.0","prettier":"^3.3.2","rimraf":"^5.0.7","tsup":"^8.1.0","typescript":"^5.5.2","vitest":"^1.6.0"},"engines":{"node":">=6"},"publishConfig":{"access":"public"},"scripts":{"build":"tsup-node src/index.ts --target node18 --format esm,cjs --dts","check-types":"tsc --noEmit","format:check":"prettier --check '**' --ignore-unknown","format:write":"prettier --write '**' --ignore-unknown","lint":"eslint .","test":"vitest run","test:coverage":"vitest run --coverage","test:watch":"vitest","watch":"pnpm build --watch"},"_id":"path2d@0.2.1","types":"./dist/index.d.ts","_integrity":"sha512-Fl2z/BHvkTNvkuBzYTpTuirHZg6wW9z8+4SND/3mDTEcYbbNKWAy21dz9D3ePNNwrrK8pqZO5vLPZ1hLF6T7XA==","_resolved":"/tmp/d4442b358215100036ed407069579cd4/path2d-0.2.1.tgz","_from":"file:path2d-0.2.1.tgz","_nodeVersion":"20.15.0","_npmVersion":"10.7.0","dist":{"shasum":"faf98e5e2222541805a6ac232adc026332330765","size":7596,"noattachment":false,"key":"/path2d/-/path2d-0.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/path2d/download/path2d-0.2.1.tgz"},"_npmUser":{"name":"nilzona_user","email":"nilssonanders79@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/path2d_0.2.1_1719665377330_0.4351380571864356"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-06-29T12:49:37.467Z","publish_time":1719665377467,"_source_registry_name":"default","maintainers":[{"name":"nilzona_user","email":""}],"_cnpm_publish_time":1719665377467},"0.2.0":{"name":"path2d","version":"0.2.0","description":"Path2D API for node. Can be used for server-side rendering with canvas","keywords":["Path2D","polyfill","canvas","roundRect"],"homepage":"https://github.com/nilzona/path2d-polyfill#readme","bugs":{"url":"https://github.com/nilzona/path2d-polyfill/issues"},"repository":{"type":"git","url":"git+https://github.com/nilzona/path2d-polyfill.git"},"license":"MIT","author":{"name":"nilzona"},"type":"module","exports":{".":{"import":"./dist/index.js","require":"./dist/index.cjs"}},"main":"dist/index.cjs","module":"./dist/index.js","prettier":"@qlik/prettier-config","devDependencies":{"@qlik/eslint-config":"0.7.15","@qlik/prettier-config":"0.4.11","@qlik/tsconfig":"0.2.4","@swc/core":"1.4.11","@types/node":"20.11.30","@vitest/coverage-v8":"1.4.0","eslint":"8.57.0","prettier":"3.2.5","rimraf":"5.0.5","tsup":"8.0.2","typescript":"5.4.3","vitest":"1.4.0"},"engines":{"node":">=6"},"publishConfig":{"access":"public"},"scripts":{"build":"tsup-node src/index.ts --target node18 --format esm,cjs --dts","check-types":"tsc --noEmit","format:check":"prettier --check '**' --ignore-unknown","format:write":"prettier --write '**' --ignore-unknown","lint":"eslint .","test":"vitest run","test:coverage":"vitest run --coverage","test:watch":"vitest","watch":"pnpm build --watch"},"types":"./dist/index.d.ts","_id":"path2d@0.2.0","_integrity":"sha512-KdPAykQX6kmLSOO6Jpu2KNcCED7CKjmaBNGGNuctOsG0hgYO1OdYQaan6cYXJiG0WmXOwZZPILPBimu5QAIw3A==","_resolved":"/tmp/4c03ec0605b30a24d01474fc4f073fba/path2d-0.2.0.tgz","_from":"file:path2d-0.2.0.tgz","_nodeVersion":"18.19.1","_npmVersion":"10.2.4","dist":{"shasum":"28bb0e8e6298b2a1adb75ab1b4ffd8c263c28c19","size":7614,"noattachment":false,"key":"/path2d/-/path2d-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/path2d/download/path2d-0.2.0.tgz"},"_npmUser":{"name":"nilzona_user","email":"nilssonanders79@gmail.com"},"directories":{},"maintainers":[{"name":"nilzona_user","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/path2d_0.2.0_1712233791381_0.44043801707784924"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-04-04T12:29:51.639Z","publish_time":1712233791639,"_source_registry_name":"default","_cnpm_publish_time":1712233791639},"0.1.2":{"name":"path2d","version":"0.1.2","description":"Path2D API for node. Can be used for server-side rendering with canvas","keywords":["Path2D","polyfill","canvas","roundRect"],"homepage":"https://github.com/nilzona/path2d-polyfill#readme","bugs":{"url":"https://github.com/nilzona/path2d-polyfill/issues"},"repository":{"type":"git","url":"git+https://github.com/nilzona/path2d-polyfill.git"},"license":"MIT","author":{"name":"nilzona"},"type":"module","exports":{".":{"import":"./dist/index.js","require":"./dist/index.cjs"}},"main":"dist/index.cjs","module":"./dist/index.js","prettier":"@qlik/prettier-config","devDependencies":{"@qlik/eslint-config":"0.7.13","@qlik/prettier-config":"0.4.11","@qlik/tsconfig":"0.2.4","@swc/core":"1.4.8","@types/node":"20.11.28","@vitest/coverage-v8":"1.4.0","eslint":"8.57.0","prettier":"3.2.5","rimraf":"5.0.5","tsup":"8.0.2","typescript":"5.4.2","vitest":"1.4.0"},"engines":{"node":">=6"},"publishConfig":{"access":"public"},"scripts":{"build":"tsup-node src/index.ts --target node18 --format esm,cjs --dts","check-types":"tsc --noEmit","format:check":"prettier --check '**' --ignore-unknown","format:write":"prettier --write '**' --ignore-unknown","lint":"eslint .","test":"vitest run","test:coverage":"vitest run --coverage","test:watch":"vitest","watch":"pnpm build --watch"},"types":"./dist/index.d.ts","_id":"path2d@0.1.2","_integrity":"sha512-LW++2uxgHNL/FANhgGTPo/yDDQcgsVbKotwIVbpTgTBgRlKUpjOpjp3s3+KjG4OWCQ/r6z+WLDljH1/fC03PWw==","_resolved":"/tmp/9f677aeab308a3aefcae2d066f2c3a43/path2d-0.1.2.tgz","_from":"file:path2d-0.1.2.tgz","_nodeVersion":"18.19.1","_npmVersion":"10.2.4","dist":{"shasum":"b6ae1dcce306cd75137cf6705961d128bbe8009a","size":7554,"noattachment":false,"key":"/path2d/-/path2d-0.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/path2d/download/path2d-0.1.2.tgz"},"_npmUser":{"name":"nilzona_user","email":"nilssonanders79@gmail.com"},"directories":{},"maintainers":[{"name":"nilzona_user","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/path2d_0.1.2_1710703553587_0.5555343066975107"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-03-17T19:25:53.748Z","publish_time":1710703553748,"_source_registry_name":"default","_cnpm_publish_time":1710703553748},"0.1.1":{"name":"path2d","version":"0.1.1","description":"Path2D API for node. Can be used for server-side rendering with canvas","keywords":["Path2D","polyfill","canvas","roundRect"],"homepage":"https://github.com/nilzona/path2d-polyfill#readme","bugs":{"url":"https://github.com/nilzona/path2d-polyfill/issues"},"repository":{"type":"git","url":"git+https://github.com/nilzona/path2d-polyfill.git"},"license":"MIT","author":{"name":"nilzona"},"type":"module","exports":{".":{"import":"./dist/index.js","require":"./dist/index.cjs"}},"main":"dist/index.cjs","prettier":"@qlik/prettier-config","devDependencies":{"@qlik/eslint-config":"0.7.13","@qlik/prettier-config":"0.4.11","@qlik/tsconfig":"0.2.4","@swc/core":"1.4.8","@types/node":"20.11.28","@vitest/coverage-v8":"1.4.0","eslint":"8.57.0","prettier":"3.2.5","rimraf":"5.0.5","tsup":"8.0.2","typescript":"5.4.2","vitest":"1.4.0"},"engines":{"node":">=6"},"publishConfig":{"access":"public"},"scripts":{"build":"tsup-node src/index.ts --target node18 --format esm,cjs --dts","check-types":"tsc --noEmit","format:check":"prettier --check '**' --ignore-unknown","format:write":"prettier --write '**' --ignore-unknown","lint":"eslint .","test":"vitest run","test:coverage":"vitest run --coverage","test:watch":"vitest","watch":"pnpm build --watch"},"types":"./dist/index.d.ts","_id":"path2d@0.1.1","_integrity":"sha512-/+S03c8AGsDYKKBtRDqieTJv2GlkMb0bWjnqOgtF6MkjdUQ9a8ARAtxWf9NgKLGm2+WQr6+/tqJdU8HNGsIDoA==","_resolved":"/tmp/c0dfa9859a979fbbc2b986d351b71b93/path2d-0.1.1.tgz","_from":"file:path2d-0.1.1.tgz","_nodeVersion":"18.19.1","_npmVersion":"10.2.4","dist":{"shasum":"d3c3886cd2252fb2a7830c27ea7bb9a862d937ea","size":7496,"noattachment":false,"key":"/path2d/-/path2d-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/path2d/download/path2d-0.1.1.tgz"},"_npmUser":{"name":"nilzona_user","email":"nilssonanders79@gmail.com"},"directories":{},"maintainers":[{"name":"nilzona_user","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/path2d_0.1.1_1710630926634_0.92970499977353"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-03-16T23:15:26.830Z","publish_time":1710630926830,"_source_registry_name":"default","_cnpm_publish_time":1710630926830},"0.0.1":{"name":"path2d","version":"0.0.1","description":"Path2D API for node. Can be used for server-side rendering with canvas","keywords":["Path2D","polyfill","canvas","roundRect"],"homepage":"https://github.com/nilzona/path2d-polyfill#readme","bugs":{"url":"https://github.com/nilzona/path2d-polyfill/issues"},"repository":{"type":"git","url":"git+https://github.com/nilzona/path2d-polyfill.git"},"license":"MIT","author":{"name":"nilzona"},"type":"module","exports":{".":{"import":"./dist/index.js","require":"./dist/index.cjs"}},"main":"dist/index.cjs","prettier":"@qlik/prettier-config","devDependencies":{"@qlik/eslint-config":"0.7.13","@qlik/prettier-config":"0.4.11","@qlik/tsconfig":"0.2.4","@swc/core":"1.4.8","@types/node":"20.11.28","@vitest/coverage-v8":"1.4.0","eslint":"8.57.0","prettier":"3.2.5","rimraf":"5.0.5","tsup":"8.0.2","typescript":"5.4.2","vitest":"1.4.0"},"engines":{"node":">=6"},"scripts":{"build":"tsup-node src/index.ts --target node18 --format esm,cjs --dts","check-types":"tsc --noEmit","format:check":"prettier --check '**' --ignore-unknown","format:write":"prettier --write '**' --ignore-unknown","lint":"eslint .","test":"vitest run","test:coverage":"vitest run --coverage","test:watch":"vitest","watch":"pnpm build --watch"},"types":"./dist/index.d.ts","_id":"path2d@0.0.1","_integrity":"sha512-PxH3lqy9AmyVxRj3NLJTLt8Y3ZtV1MB5DzFJ7OeOSJ1RKW1XH6X4O3TW8cqH5vWiB5ySuAPYxq1IAj00ojGZeg==","_resolved":"/private/var/folders/vd/_cm8vng50bbbh9gy5_lqf0hr0000gp/T/781257b6d89978feac74ede575285b93/path2d-0.0.1.tgz","_from":"file:path2d-0.0.1.tgz","_nodeVersion":"18.15.0","_npmVersion":"9.5.0","dist":{"shasum":"54fec2ef92ae8e622d8c399fced62f10e5fdc25c","size":7464,"noattachment":false,"key":"/path2d/-/path2d-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/path2d/download/path2d-0.0.1.tgz"},"_npmUser":{"name":"nilzona_user","email":"nilssonanders79@gmail.com"},"directories":{},"maintainers":[{"name":"nilzona_user","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/path2d_0.0.1_1710629284644_0.18008352236749237"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-03-16T22:48:04.794Z","publish_time":1710629284794,"_source_registry_name":"default","_cnpm_publish_time":1710629284794}},"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\nImplements `Path2D` api and `roundRect` for CanvasRenderingContext2D\n\n## Usage\n\n```shell\nnpm install --save path2d\n```\n\n## Use in a node environment\n\nThe package exports a few functions that can be used in a node environment:\n\n- `Path2D` - class to create Path2D objects used by the polyfill methods\n- `parsePath` - function for parsing an SVG path string into canvas commands\n- 'roundRect' - implementation of roundRect using canvas commans\n- `applyPath2DToCanvasRenderingContext` - Adds Path2D functions (if needed) to a CanvasRenderingContext and augments the fill, stroke and clip command\n- `applyRoundRectToCanvasRenderingContext2D` - Adds roundRect function (if needed) to a CanvasRenderingContext\n\n```js\nimport { Path2D } from \"path2d\";\n```\n\n### usage with node-canvas\n\nTo get Path2D features with the [node-canvas library](https://github.com/Automattic/node-canvas) use the following pattern:\n\n```js\nconst { createCanvas, CanvasRenderingContext2D } = require(\"canvas\");\nconst { applyPath2DToCanvasRenderingContext, Path2D } = require(\"path2d\");\n\napplyPath2DToCanvasRenderingContext(CanvasRenderingContext2D);\n// Path2D features has now been added to CanvasRenderingContext2D\n\nconst canvas = createCanvas(200, 200);\nconst ctx = canvas.getContext(\"2d\");\n\nconst p = new Path2D(\"M10 10 l 20 0 l 0 20 Z\");\nctx.fillStyle = \"green\";\nctx.fill(p);\n```\n\nA working example of a node express server that serves an image drawn with canvas can be seen [here](https://gist.github.com/nilzona/e611c99336d8ea1f645bd391a459c24f)\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","_attachments":{},"homepage":"https://github.com/nilzona/path2d-polyfill#readme","bugs":{"url":"https://github.com/nilzona/path2d-polyfill/issues"},"license":"MIT"}