Comparing version 2.0.0 to 3.0.0
@@ -1,7 +0,7 @@ | ||
// https://d3js.org/d3-path/ v2.0.0 Copyright 2020 Mike Bostock | ||
// https://d3js.org/d3-path/ v3.0.0 Copyright 2021 Mike Bostock | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(global = global || self, factory(global.d3 = global.d3 || {})); | ||
}(this, function (exports) { 'use strict'; | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.d3 = global.d3 || {})); | ||
}(this, (function (exports) { 'use strict'; | ||
@@ -141,2 +141,2 @@ const pi = Math.PI, | ||
})); | ||
}))); |
@@ -1,2 +0,2 @@ | ||
// https://d3js.org/d3-path/ v2.0.0 Copyright 2020 Mike Bostock | ||
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((t=t||self).d3=t.d3||{})}(this,function(t){"use strict";const i=Math.PI,s=2*i,h=s-1e-6;function e(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function _(){return new e}e.prototype=_.prototype={constructor:e,moveTo:function(t,i){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+i)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,i){this._+="L"+(this._x1=+t)+","+(this._y1=+i)},quadraticCurveTo:function(t,i,s,h){this._+="Q"+ +t+","+ +i+","+(this._x1=+s)+","+(this._y1=+h)},bezierCurveTo:function(t,i,s,h,e,_){this._+="C"+ +t+","+ +i+","+ +s+","+ +h+","+(this._x1=+e)+","+(this._y1=+_)},arcTo:function(t,s,h,e,_){t=+t,s=+s,h=+h,e=+e,_=+_;var n=this._x1,o=this._y1,r=h-t,a=e-s,u=n-t,c=o-s,f=u*u+c*c;if(_<0)throw new Error("negative radius: "+_);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=s);else if(f>1e-6)if(Math.abs(c*r-a*u)>1e-6&&_){var x=h-n,y=e-o,M=r*r+a*a,l=x*x+y*y,d=Math.sqrt(M),p=Math.sqrt(f),v=_*Math.tan((i-Math.acos((M+f-l)/(2*d*p)))/2),b=v/p,w=v/d;Math.abs(b-1)>1e-6&&(this._+="L"+(t+b*u)+","+(s+b*c)),this._+="A"+_+","+_+",0,0,"+ +(c*x>u*y)+","+(this._x1=t+w*r)+","+(this._y1=s+w*a)}else this._+="L"+(this._x1=t)+","+(this._y1=s);else;},arc:function(t,e,_,n,o,r){t=+t,e=+e,r=!!r;var a=(_=+_)*Math.cos(n),u=_*Math.sin(n),c=t+a,f=e+u,x=1^r,y=r?n-o:o-n;if(_<0)throw new Error("negative radius: "+_);null===this._x1?this._+="M"+c+","+f:(Math.abs(this._x1-c)>1e-6||Math.abs(this._y1-f)>1e-6)&&(this._+="L"+c+","+f),_&&(y<0&&(y=y%s+s),y>h?this._+="A"+_+","+_+",0,1,"+x+","+(t-a)+","+(e-u)+"A"+_+","+_+",0,1,"+x+","+(this._x1=c)+","+(this._y1=f):y>1e-6&&(this._+="A"+_+","+_+",0,"+ +(y>=i)+","+x+","+(this._x1=t+_*Math.cos(o))+","+(this._y1=e+_*Math.sin(o))))},rect:function(t,i,s,h){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+i)+"h"+ +s+"v"+ +h+"h"+-s+"Z"},toString:function(){return this._}},t.path=_,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
// https://d3js.org/d3-path/ v3.0.0 Copyright 2021 Mike Bostock | ||
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((t="undefined"!=typeof globalThis?globalThis:t||self).d3=t.d3||{})}(this,(function(t){"use strict";const i=Math.PI,s=2*i,h=1e-6,_=s-h;function e(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function n(){return new e}e.prototype=n.prototype={constructor:e,moveTo:function(t,i){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+i)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,i){this._+="L"+(this._x1=+t)+","+(this._y1=+i)},quadraticCurveTo:function(t,i,s,h){this._+="Q"+ +t+","+ +i+","+(this._x1=+s)+","+(this._y1=+h)},bezierCurveTo:function(t,i,s,h,_,e){this._+="C"+ +t+","+ +i+","+ +s+","+ +h+","+(this._x1=+_)+","+(this._y1=+e)},arcTo:function(t,s,_,e,n){t=+t,s=+s,_=+_,e=+e,n=+n;var o=this._x1,r=this._y1,a=_-t,u=e-s,f=o-t,c=r-s,y=f*f+c*c;if(n<0)throw new Error("negative radius: "+n);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=s);else if(y>h)if(Math.abs(c*a-u*f)>h&&n){var x=_-o,l=e-r,M=a*a+u*u,d=x*x+l*l,p=Math.sqrt(M),v=Math.sqrt(y),b=n*Math.tan((i-Math.acos((M+y-d)/(2*p*v)))/2),T=b/v,g=b/p;Math.abs(T-1)>h&&(this._+="L"+(t+T*f)+","+(s+T*c)),this._+="A"+n+","+n+",0,0,"+ +(c*x>f*l)+","+(this._x1=t+g*a)+","+(this._y1=s+g*u)}else this._+="L"+(this._x1=t)+","+(this._y1=s);else;},arc:function(t,e,n,o,r,a){t=+t,e=+e,a=!!a;var u=(n=+n)*Math.cos(o),f=n*Math.sin(o),c=t+u,y=e+f,x=1^a,l=a?o-r:r-o;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+c+","+y:(Math.abs(this._x1-c)>h||Math.abs(this._y1-y)>h)&&(this._+="L"+c+","+y),n&&(l<0&&(l=l%s+s),l>_?this._+="A"+n+","+n+",0,1,"+x+","+(t-u)+","+(e-f)+"A"+n+","+n+",0,1,"+x+","+(this._x1=c)+","+(this._y1=y):l>h&&(this._+="A"+n+","+n+",0,"+ +(l>=i)+","+x+","+(this._x1=t+n*Math.cos(r))+","+(this._y1=e+n*Math.sin(r))))},rect:function(t,i,s,h){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+i)+"h"+ +s+"v"+ +h+"h"+-s+"Z"},toString:function(){return this._}},t.path=n,Object.defineProperty(t,"__esModule",{value:!0})})); |
{ | ||
"name": "d3-path", | ||
"version": "2.0.0", | ||
"version": "3.0.0", | ||
"description": "Serialize Canvas path commands to SVG.", | ||
"homepage": "https://d3js.org/d3-path/", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/d3/d3-path.git" | ||
}, | ||
"keywords": [ | ||
@@ -16,4 +21,3 @@ "d3", | ||
], | ||
"homepage": "https://d3js.org/d3-path/", | ||
"license": "BSD-3-Clause", | ||
"license": "ISC", | ||
"author": { | ||
@@ -23,10 +27,3 @@ "name": "Mike Bostock", | ||
}, | ||
"main": "dist/d3-path.js", | ||
"unpkg": "dist/d3-path.min.js", | ||
"jsdelivr": "dist/d3-path.min.js", | ||
"module": "src/index.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/d3/d3-path.git" | ||
}, | ||
"type": "module", | ||
"files": [ | ||
@@ -36,15 +33,25 @@ "dist/**/*.js", | ||
], | ||
"scripts": { | ||
"pretest": "rollup -c", | ||
"test": "tape 'test/**/*-test.js' && eslint src test", | ||
"prepublishOnly": "rm -rf dist && yarn test", | ||
"postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../${npm_package_name}/dist/${npm_package_name}.js ${npm_package_name}.v${npm_package_version%%.*}.js && cp ../${npm_package_name}/dist/${npm_package_name}.min.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git add ${npm_package_name}.v${npm_package_version%%.*}.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git commit -m \"${npm_package_name} ${npm_package_version}\" && git push && cd - && zip -j dist/${npm_package_name}.zip -- LICENSE README.md dist/${npm_package_name}.js dist/${npm_package_name}.min.js" | ||
"module": "src/index.js", | ||
"main": "src/index.js", | ||
"jsdelivr": "dist/d3-path.min.js", | ||
"unpkg": "dist/d3-path.min.js", | ||
"exports": { | ||
"umd": "./dist/d3-path.min.js", | ||
"default": "./src/index.js" | ||
}, | ||
"sideEffects": false, | ||
"devDependencies": { | ||
"eslint": "6", | ||
"rollup": "1", | ||
"rollup-plugin-terser": "5", | ||
"tape": "4" | ||
"eslint": "7", | ||
"mocha": "8", | ||
"rollup": "2", | ||
"rollup-plugin-terser": "7" | ||
}, | ||
"scripts": { | ||
"test": "mocha 'test/**/*-test.js' && eslint src test", | ||
"prepublishOnly": "rm -rf dist && yarn test && rollup -c", | ||
"postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../${npm_package_name}/dist/${npm_package_name}.js ${npm_package_name}.v${npm_package_version%%.*}.js && cp ../${npm_package_name}/dist/${npm_package_name}.min.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git add ${npm_package_name}.v${npm_package_version%%.*}.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git commit -m \"${npm_package_name} ${npm_package_version}\" && git push && cd -" | ||
}, | ||
"engines": { | ||
"node": ">=12" | ||
} | ||
} |
@@ -15,3 +15,3 @@ # d3-path | ||
```js | ||
var context = d3.path(); | ||
const context = d3.path(); | ||
drawCircle(context, 40); | ||
@@ -25,12 +25,24 @@ pathElement.setAttribute("d", context.toString()); | ||
If you use NPM, `npm install d3-path`. Otherwise, download the [latest release](https://github.com/d3/d3-path/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-path.v2.min.js) or as part of [D3](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported: | ||
If you use npm, `npm install d3-path`. You can also download the [latest release on GitHub](https://github.com/d3/d3-path/releases/latest). In modern browsers, you can import d3-path from Skypack: | ||
```html | ||
<script src="https://d3js.org/d3-path.v2.min.js"></script> | ||
<script type="module"> | ||
import {path} from "https://cdn.skypack.dev/d3-path@3"; | ||
const p = path(); | ||
p.moveTo(1, 2); | ||
p.lineTo(3, 4); | ||
p.closePath(); | ||
</script> | ||
``` | ||
For legacy environments, you can load d3-path’s UMD bundle from an npm-based CDN such as jsDelivr; a `d3` global is exported: | ||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/d3-path@3"></script> | ||
<script> | ||
var path = d3.path(); | ||
path.moveTo(1, 2); | ||
path.lineTo(3, 4); | ||
path.closePath(); | ||
const path = d3.path(); | ||
@@ -50,3 +62,3 @@ </script> | ||
<a name="path_closePath" href="#path_closePath">#</A> <i>path</i>.<b>closePath</b>() | ||
<a name="path_closePath" href="#path_closePath">#</a> <i>path</i>.<b>closePath</b>() | ||
@@ -53,0 +65,0 @@ Ends the current subpath and causes an automatic straight line to be drawn from the current point to the initial point of the current subpath. Equivalent to [*context*.closePath](http://www.w3.org/TR/2dcontext/#dom-context-2d-closepath) and SVG’s [“closepath” command](http://www.w3.org/TR/SVG/paths.html#PathDataClosePathCommand). |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
91
Yes
19625