Comparing version 0.1.5 to 0.2.0
@@ -0,5 +1,6 @@ | ||
// https://d3js.org/d3-path/ Version 0.2.0. Copyright 2016 Mike Bostock. | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(factory((global.d3_path = global.d3_path || {}))); | ||
(factory((global.d3 = global.d3 || {}))); | ||
}(this, function (exports) { 'use strict'; | ||
@@ -150,7 +151,6 @@ | ||
var version = "0.1.5"; | ||
exports.version = version; | ||
exports.path = path; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
})); |
@@ -1,1 +0,2 @@ | ||
!function(t,s){"object"==typeof exports&&"undefined"!=typeof module?s(exports):"function"==typeof define&&define.amd?define(["exports"],s):s(t.d3_path=t.d3_path||{})}(this,function(t){"use strict";function s(){this._x0=this._y0=this._x1=this._y1=null,this._=[]}function i(){return new s}var h=Math.PI,_=2*h,n=1e-6,o=_-n;s.prototype=i.prototype={constructor:s,moveTo:function(t,s){this._.push("M",this._x0=this._x1=+t,",",this._y0=this._y1=+s)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._.push("Z"))},lineTo:function(t,s){this._.push("L",this._x1=+t,",",this._y1=+s)},quadraticCurveTo:function(t,s,i,h){this._.push("Q",+t,",",+s,",",this._x1=+i,",",this._y1=+h)},bezierCurveTo:function(t,s,i,h,_,n){this._.push("C",+t,",",+s,",",+i,",",+h,",",this._x1=+_,",",this._y1=+n)},arcTo:function(t,s,i,_,o){t=+t,s=+s,i=+i,_=+_,o=+o;var e=this._x1,u=this._y1,r=i-t,a=_-s,p=e-t,c=u-s,f=p*p+c*c;if(0>o)throw new Error("negative radius: "+o);if(null===this._x1)this._.push("M",this._x1=t,",",this._y1=s);else if(f>n)if(Math.abs(c*r-a*p)>n&&o){var x=i-e,y=_-u,M=r*r+a*a,l=x*x+y*y,d=Math.sqrt(M),v=Math.sqrt(f),b=o*Math.tan((h-Math.acos((M+f-l)/(2*d*v)))/2),w=b/v,T=b/d;Math.abs(w-1)>n&&this._.push("L",t+w*p,",",s+w*c),this._.push("A",o,",",o,",0,0,",+(c*x>p*y),",",this._x1=t+T*r,",",this._y1=s+T*a)}else this._.push("L",this._x1=t,",",this._y1=s);else;},arc:function(t,s,i,e,u,r){t=+t,s=+s,i=+i;var a=i*Math.cos(e),p=i*Math.sin(e),c=t+a,f=s+p,x=1^r,y=r?e-u:u-e;if(0>i)throw new Error("negative radius: "+i);null===this._x1?this._.push("M",c,",",f):(Math.abs(this._x1-c)>n||Math.abs(this._y1-f)>n)&&this._.push("L",c,",",f),i&&(y>o?this._.push("A",i,",",i,",0,1,",x,",",t-a,",",s-p,"A",i,",",i,",0,1,",x,",",this._x1=c,",",this._y1=f):(0>y&&(y=y%_+_),this._.push("A",i,",",i,",0,",+(y>=h),",",x,",",this._x1=t+i*Math.cos(u),",",this._y1=s+i*Math.sin(u))))},rect:function(t,s,i,h){this._.push("M",this._x0=this._x1=+t,",",this._y0=this._y1=+s,"h",+i,"v",+h,"h",-i,"Z")},toString:function(){return this._.join("")}};var e="0.1.5";t.version=e,t.path=i}); | ||
// https://d3js.org/d3-path/ Version 0.2.0. Copyright 2016 Mike Bostock. | ||
!function(t,s){"object"==typeof exports&&"undefined"!=typeof module?s(exports):"function"==typeof define&&define.amd?define(["exports"],s):s(t.d3=t.d3||{})}(this,function(t){"use strict";function s(){this._x0=this._y0=this._x1=this._y1=null,this._=[]}function i(){return new s}var h=Math.PI,_=2*h,n=1e-6,e=_-n;s.prototype=i.prototype={constructor:s,moveTo:function(t,s){this._.push("M",this._x0=this._x1=+t,",",this._y0=this._y1=+s)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._.push("Z"))},lineTo:function(t,s){this._.push("L",this._x1=+t,",",this._y1=+s)},quadraticCurveTo:function(t,s,i,h){this._.push("Q",+t,",",+s,",",this._x1=+i,",",this._y1=+h)},bezierCurveTo:function(t,s,i,h,_,n){this._.push("C",+t,",",+s,",",+i,",",+h,",",this._x1=+_,",",this._y1=+n)},arcTo:function(t,s,i,_,e){t=+t,s=+s,i=+i,_=+_,e=+e;var o=this._x1,u=this._y1,r=i-t,a=_-s,c=o-t,f=u-s,p=c*c+f*f;if(0>e)throw new Error("negative radius: "+e);if(null===this._x1)this._.push("M",this._x1=t,",",this._y1=s);else if(p>n)if(Math.abs(f*r-a*c)>n&&e){var x=i-o,y=_-u,M=r*r+a*a,l=x*x+y*y,d=Math.sqrt(M),v=Math.sqrt(p),b=e*Math.tan((h-Math.acos((M+p-l)/(2*d*v)))/2),w=b/v,T=b/d;Math.abs(w-1)>n&&this._.push("L",t+w*c,",",s+w*f),this._.push("A",e,",",e,",0,0,",+(f*x>c*y),",",this._x1=t+T*r,",",this._y1=s+T*a)}else this._.push("L",this._x1=t,",",this._y1=s);else;},arc:function(t,s,i,o,u,r){t=+t,s=+s,i=+i;var a=i*Math.cos(o),c=i*Math.sin(o),f=t+a,p=s+c,x=1^r,y=r?o-u:u-o;if(0>i)throw new Error("negative radius: "+i);null===this._x1?this._.push("M",f,",",p):(Math.abs(this._x1-f)>n||Math.abs(this._y1-p)>n)&&this._.push("L",f,",",p),i&&(y>e?this._.push("A",i,",",i,",0,1,",x,",",t-a,",",s-c,"A",i,",",i,",0,1,",x,",",this._x1=f,",",this._y1=p):(0>y&&(y=y%_+_),this._.push("A",i,",",i,",0,",+(y>=h),",",x,",",this._x1=t+i*Math.cos(u),",",this._y1=s+i*Math.sin(u))))},rect:function(t,s,i,h){this._.push("M",this._x0=this._x1=+t,",",this._y0=this._y1=+s,"h",+i,"v",+h,"h",-i,"Z")},toString:function(){return this._.join("")}},t.path=i,Object.defineProperty(t,"__esModule",{value:!0})}); |
{ | ||
"name": "d3-path", | ||
"version": "0.1.5", | ||
"version": "0.2.0", | ||
"description": "Serialize Canvas path commands to SVG.", | ||
@@ -15,3 +15,3 @@ "keywords": [ | ||
], | ||
"homepage": "https://github.com/d3/d3-path", | ||
"homepage": "https://d3js.org/d3-path/", | ||
"license": "BSD-3-Clause", | ||
@@ -29,10 +29,11 @@ "author": { | ||
"scripts": { | ||
"pretest": "mkdir -p build && node -e 'process.stdout.write(\"var version = \\\"\" + require(\"./package.json\").version + \"\\\"; export * from \\\"../index\\\"; export {version};\");' > build/bundle.js && rollup -f umd -n d3_path -o build/d3-path.js -- build/bundle.js", | ||
"test": "faucet `find test -name '*-test.js'` && eslint index.js src", | ||
"prepublish": "npm run test && uglifyjs build/d3-path.js -c -m -o build/d3-path.min.js && rm -f build/d3-path.zip && zip -j build/d3-path.zip -- LICENSE README.md build/d3-path.js build/d3-path.min.js", | ||
"postpublish": "VERSION=`node -e 'console.log(require(\"./package.json\").version)'`; git push && git push --tags && cp build/d3-path.js ../d3.github.com/d3-path.v0.1.js && cp build/d3-path.min.js ../d3.github.com/d3-path.v0.1.min.js && cd ../d3.github.com && git add d3-path.v0.1.js d3-path.v0.1.min.js && git commit -m \"d3-path ${VERSION}\" && git push" | ||
"pretest": "rm -rf build && mkdir build && rollup --banner \"$(preamble)\" -f umd -n d3 -o build/d3-path.js -- index.js", | ||
"test": "tape 'test/**/*-test.js' && eslint index.js src", | ||
"prepublish": "npm run test && uglifyjs --preamble \"$(preamble)\" build/d3-path.js -c -m -o build/d3-path.min.js", | ||
"postpublish": "VERSION=`node -e 'console.log(require(\"./package.json\").version)'`; git push && git push --tags && cp build/d3-path.js ../d3.github.com/d3-path.v0.3.js && cp build/d3-path.min.js ../d3.github.com/d3-path.v0.3.min.js && cd ../d3.github.com && git add d3-path.v0.3.js d3-path.v0.3.min.js && git commit -m \"d3-path ${VERSION}\" && git push && cd - && zip -j build/d3-path.zip -- LICENSE README.md build/d3-path.js build/d3-path.min.js" | ||
}, | ||
"devDependencies": { | ||
"faucet": "0.0", | ||
"rollup": "0.25", | ||
"eslint": "2", | ||
"package-preamble": "0.0", | ||
"rollup": "0.27", | ||
"tape": "4", | ||
@@ -39,0 +40,0 @@ "uglify-js": "2" |
@@ -24,9 +24,17 @@ # d3-path | ||
If you use NPM, `npm install d3-path`. Otherwise, download the [latest release](https://github.com/d3/d3-path/releases/latest). The released bundle supports AMD, CommonJS, and vanilla environments. Create a custom build using [Rollup](https://github.com/rollup/rollup) or your preferred bundler. You can also load directly from [d3js.org](https://d3js.org): | ||
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.v0.2.min.js) or as part of [D3 4.0](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported: | ||
```html | ||
<script src="https://d3js.org/d3-path.v0.1.min.js"></script> | ||
<script src="https://d3js.org/d3-path.v0.2.min.js"></script> | ||
<script> | ||
var path = d3.path(); | ||
path.moveTo(1, 2); | ||
path.lineTo(3, 4); | ||
path.closePath(); | ||
</script> | ||
``` | ||
In a vanilla environment, a `d3_path` global is exported. [Try d3-path in your browser.](https://tonicdev.com/npm/d3-path) | ||
[Try d3-path in your browser.](https://tonicdev.com/npm/d3-path) | ||
@@ -33,0 +41,0 @@ ## API Reference |
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
20331
265
81
5
9