add lisp packages
This commit is contained in:
27
lisp/emacs-application-framework/app/mermaid/node_modules/d3-path/LICENSE
generated
vendored
Normal file
27
lisp/emacs-application-framework/app/mermaid/node_modules/d3-path/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
Copyright 2015-2016 Mike Bostock
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of the author nor the names of contributors may be used to
|
||||
endorse or promote products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
78
lisp/emacs-application-framework/app/mermaid/node_modules/d3-path/README.md
generated
vendored
Normal file
78
lisp/emacs-application-framework/app/mermaid/node_modules/d3-path/README.md
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
# d3-path
|
||||
|
||||
Say you have some code that draws to a 2D canvas:
|
||||
|
||||
```js
|
||||
function drawCircle(context, radius) {
|
||||
context.moveTo(radius, 0);
|
||||
context.arc(0, 0, radius, 0, 2 * Math.PI);
|
||||
}
|
||||
```
|
||||
|
||||
The d3-path module lets you take this exact code and additionally render to [SVG](http://www.w3.org/TR/SVG/paths.html). It works by [serializing](#path_toString) [CanvasPathMethods](http://www.w3.org/TR/2dcontext/#canvaspathmethods) calls to [SVG path data](http://www.w3.org/TR/SVG/paths.html#PathData). For example:
|
||||
|
||||
```js
|
||||
var context = d3.path();
|
||||
drawCircle(context, 40);
|
||||
pathElement.setAttribute("d", context.toString());
|
||||
```
|
||||
|
||||
Now code you write once can be used with both Canvas (for performance) and SVG (for convenience). For a practical example, see [d3-shape](https://github.com/d3/d3-shape).
|
||||
|
||||
## Installing
|
||||
|
||||
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.v1.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.v1.min.js"></script>
|
||||
<script>
|
||||
|
||||
var path = d3.path();
|
||||
path.moveTo(1, 2);
|
||||
path.lineTo(3, 4);
|
||||
path.closePath();
|
||||
|
||||
</script>
|
||||
```
|
||||
|
||||
## API Reference
|
||||
|
||||
<a name="path" href="#path">#</a> d3.<b>path</b>() · [Source](https://github.com/d3/d3-path/blob/master/src/path.js), [Examples](https://observablehq.com/@d3/d3-path)
|
||||
|
||||
Constructs a new path serializer that implements [CanvasPathMethods](http://www.w3.org/TR/2dcontext/#canvaspathmethods).
|
||||
|
||||
<a name="path_moveTo" href="#path_moveTo">#</a> <i>path</i>.<b>moveTo</b>(<i>x</i>, <i>y</i>)
|
||||
|
||||
Move to the specified point ⟨*x*, *y*⟩. Equivalent to [*context*.moveTo](http://www.w3.org/TR/2dcontext/#dom-context-2d-moveto) and SVG’s [“moveto” command](http://www.w3.org/TR/SVG/paths.html#PathDataMovetoCommands).
|
||||
|
||||
<a name="path_closePath" href="#path_closePath">#</A> <i>path</i>.<b>closePath</b>()
|
||||
|
||||
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).
|
||||
|
||||
<a name="path_lineTo" href="#path_lineTo">#</a> <i>path</i>.<b>lineTo</b>(<i>x</i>, <i>y</i>)
|
||||
|
||||
Draws a straight line from the current point to the specified point ⟨*x*, *y*⟩. Equivalent to [*context*.lineTo](http://www.w3.org/TR/2dcontext/#dom-context-2d-lineto) and SVG’s [“lineto” command](http://www.w3.org/TR/SVG/paths.html#PathDataLinetoCommands).
|
||||
|
||||
<a name="path_quadraticCurveTo" href="#path_quadraticCurveTo">#</a> <i>path</i>.<b>quadraticCurveTo</b>(<i>cpx</i>, <i>cpy</i>, <i>x</i>, <i>y</i>)
|
||||
|
||||
Draws a quadratic Bézier segment from the current point to the specified point ⟨*x*, *y*⟩, with the specified control point ⟨*cpx*, *cpy*⟩. Equivalent to [*context*.quadraticCurveTo](http://www.w3.org/TR/2dcontext/#dom-context-2d-quadraticcurveto) and SVG’s [quadratic Bézier curve commands](http://www.w3.org/TR/SVG/paths.html#PathDataQuadraticBezierCommands).
|
||||
|
||||
<a name="path_bezierCurveTo" href="#path_bezierCurveTo">#</a> <i>path</i>.<b>bezierCurveTo</b>(<i>cpx1</i>, <i>cpy1</i>, <i>cpx2</i>, <i>cpy2</i>, <i>x</i>, <i>y</i>)
|
||||
|
||||
Draws a cubic Bézier segment from the current point to the specified point ⟨*x*, *y*⟩, with the specified control points ⟨*cpx1*, *cpy1*⟩ and ⟨*cpx2*, *cpy2*⟩. Equivalent to [*context*.bezierCurveTo](http://www.w3.org/TR/2dcontext/#dom-context-2d-beziercurveto) and SVG’s [cubic Bézier curve commands](http://www.w3.org/TR/SVG/paths.html#PathDataCubicBezierCommands).
|
||||
|
||||
<a name="path_arcTo" href="#path_arcTo">#</a> <i>path</i>.<b>arcTo</b>(<i>x1</i>, <i>y1</i>, <i>x2</i>, <i>y2</i>, <i>radius</i>)
|
||||
|
||||
Draws a circular arc segment with the specified *radius* that starts tangent to the line between the current point and the specified point ⟨*x1*, *y1*⟩ and ends tangent to the line between the specified points ⟨*x1*, *y1*⟩ and ⟨*x2*, *y2*⟩. If the first tangent point is not equal to the current point, a straight line is drawn between the current point and the first tangent point. Equivalent to [*context*.arcTo](http://www.w3.org/TR/2dcontext/#dom-context-2d-arcto) and uses SVG’s [elliptical arc curve commands](http://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands).
|
||||
|
||||
<a name="path_arc" href="#path_arc">#</a> <i>path</i>.<b>arc</b>(<i>x</i>, <i>y</i>, <i>radius</i>, <i>startAngle</i>, <i>endAngle</i>[, <i>anticlockwise</i>])
|
||||
|
||||
Draws a circular arc segment with the specified center ⟨*x*, *y*⟩, *radius*, *startAngle* and *endAngle*. If *anticlockwise* is true, the arc is drawn in the anticlockwise direction; otherwise, it is drawn in the clockwise direction. If the current point is not equal to the starting point of the arc, a straight line is drawn from the current point to the start of the arc. Equivalent to [*context*.arc](http://www.w3.org/TR/2dcontext/#dom-context-2d-arc) and uses SVG’s [elliptical arc curve commands](http://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands).
|
||||
|
||||
<a name="path_rect" href="#path_rect">#</a> <i>path</i>.<b>rect</b>(<i>x</i>, <i>y</i>, <i>w</i>, <i>h</i>)
|
||||
|
||||
Creates a new subpath containing just the four points ⟨*x*, *y*⟩, ⟨*x* + *w*, *y*⟩, ⟨*x* + *w*, *y* + *h*⟩, ⟨*x*, *y* + *h*⟩, with those four points connected by straight lines, and then marks the subpath as closed. Equivalent to [*context*.rect](http://www.w3.org/TR/2dcontext/#dom-context-2d-rect) and uses SVG’s [“lineto” commands](http://www.w3.org/TR/SVG/paths.html#PathDataLinetoCommands).
|
||||
|
||||
<a name="path_toString" href="#path_toString">#</a> <i>path</i>.<b>toString</b>()
|
||||
|
||||
Returns the string representation of this *path* according to SVG’s [path data specification](http://www.w3.org/TR/SVG/paths.html#PathData).
|
||||
141
lisp/emacs-application-framework/app/mermaid/node_modules/d3-path/dist/d3-path.js
generated
vendored
Normal file
141
lisp/emacs-application-framework/app/mermaid/node_modules/d3-path/dist/d3-path.js
generated
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
// https://d3js.org/d3-path/ v1.0.9 Copyright 2019 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';
|
||||
|
||||
var pi = Math.PI,
|
||||
tau = 2 * pi,
|
||||
epsilon = 1e-6,
|
||||
tauEpsilon = tau - epsilon;
|
||||
|
||||
function Path() {
|
||||
this._x0 = this._y0 = // start of current subpath
|
||||
this._x1 = this._y1 = null; // end of current subpath
|
||||
this._ = "";
|
||||
}
|
||||
|
||||
function path() {
|
||||
return new Path;
|
||||
}
|
||||
|
||||
Path.prototype = path.prototype = {
|
||||
constructor: Path,
|
||||
moveTo: function(x, y) {
|
||||
this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y);
|
||||
},
|
||||
closePath: function() {
|
||||
if (this._x1 !== null) {
|
||||
this._x1 = this._x0, this._y1 = this._y0;
|
||||
this._ += "Z";
|
||||
}
|
||||
},
|
||||
lineTo: function(x, y) {
|
||||
this._ += "L" + (this._x1 = +x) + "," + (this._y1 = +y);
|
||||
},
|
||||
quadraticCurveTo: function(x1, y1, x, y) {
|
||||
this._ += "Q" + (+x1) + "," + (+y1) + "," + (this._x1 = +x) + "," + (this._y1 = +y);
|
||||
},
|
||||
bezierCurveTo: function(x1, y1, x2, y2, x, y) {
|
||||
this._ += "C" + (+x1) + "," + (+y1) + "," + (+x2) + "," + (+y2) + "," + (this._x1 = +x) + "," + (this._y1 = +y);
|
||||
},
|
||||
arcTo: function(x1, y1, x2, y2, r) {
|
||||
x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;
|
||||
var x0 = this._x1,
|
||||
y0 = this._y1,
|
||||
x21 = x2 - x1,
|
||||
y21 = y2 - y1,
|
||||
x01 = x0 - x1,
|
||||
y01 = y0 - y1,
|
||||
l01_2 = x01 * x01 + y01 * y01;
|
||||
|
||||
// Is the radius negative? Error.
|
||||
if (r < 0) throw new Error("negative radius: " + r);
|
||||
|
||||
// Is this path empty? Move to (x1,y1).
|
||||
if (this._x1 === null) {
|
||||
this._ += "M" + (this._x1 = x1) + "," + (this._y1 = y1);
|
||||
}
|
||||
|
||||
// Or, is (x1,y1) coincident with (x0,y0)? Do nothing.
|
||||
else if (!(l01_2 > epsilon));
|
||||
|
||||
// Or, are (x0,y0), (x1,y1) and (x2,y2) collinear?
|
||||
// Equivalently, is (x1,y1) coincident with (x2,y2)?
|
||||
// Or, is the radius zero? Line to (x1,y1).
|
||||
else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) {
|
||||
this._ += "L" + (this._x1 = x1) + "," + (this._y1 = y1);
|
||||
}
|
||||
|
||||
// Otherwise, draw an arc!
|
||||
else {
|
||||
var x20 = x2 - x0,
|
||||
y20 = y2 - y0,
|
||||
l21_2 = x21 * x21 + y21 * y21,
|
||||
l20_2 = x20 * x20 + y20 * y20,
|
||||
l21 = Math.sqrt(l21_2),
|
||||
l01 = Math.sqrt(l01_2),
|
||||
l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2),
|
||||
t01 = l / l01,
|
||||
t21 = l / l21;
|
||||
|
||||
// If the start tangent is not coincident with (x0,y0), line to.
|
||||
if (Math.abs(t01 - 1) > epsilon) {
|
||||
this._ += "L" + (x1 + t01 * x01) + "," + (y1 + t01 * y01);
|
||||
}
|
||||
|
||||
this._ += "A" + r + "," + r + ",0,0," + (+(y01 * x20 > x01 * y20)) + "," + (this._x1 = x1 + t21 * x21) + "," + (this._y1 = y1 + t21 * y21);
|
||||
}
|
||||
},
|
||||
arc: function(x, y, r, a0, a1, ccw) {
|
||||
x = +x, y = +y, r = +r, ccw = !!ccw;
|
||||
var dx = r * Math.cos(a0),
|
||||
dy = r * Math.sin(a0),
|
||||
x0 = x + dx,
|
||||
y0 = y + dy,
|
||||
cw = 1 ^ ccw,
|
||||
da = ccw ? a0 - a1 : a1 - a0;
|
||||
|
||||
// Is the radius negative? Error.
|
||||
if (r < 0) throw new Error("negative radius: " + r);
|
||||
|
||||
// Is this path empty? Move to (x0,y0).
|
||||
if (this._x1 === null) {
|
||||
this._ += "M" + x0 + "," + y0;
|
||||
}
|
||||
|
||||
// Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0).
|
||||
else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) {
|
||||
this._ += "L" + x0 + "," + y0;
|
||||
}
|
||||
|
||||
// Is this arc empty? We’re done.
|
||||
if (!r) return;
|
||||
|
||||
// Does the angle go the wrong way? Flip the direction.
|
||||
if (da < 0) da = da % tau + tau;
|
||||
|
||||
// Is this a complete circle? Draw two arcs to complete the circle.
|
||||
if (da > tauEpsilon) {
|
||||
this._ += "A" + r + "," + r + ",0,1," + cw + "," + (x - dx) + "," + (y - dy) + "A" + r + "," + r + ",0,1," + cw + "," + (this._x1 = x0) + "," + (this._y1 = y0);
|
||||
}
|
||||
|
||||
// Is this arc non-empty? Draw an arc!
|
||||
else if (da > epsilon) {
|
||||
this._ += "A" + r + "," + r + ",0," + (+(da >= pi)) + "," + cw + "," + (this._x1 = x + r * Math.cos(a1)) + "," + (this._y1 = y + r * Math.sin(a1));
|
||||
}
|
||||
},
|
||||
rect: function(x, y, w, h) {
|
||||
this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y) + "h" + (+w) + "v" + (+h) + "h" + (-w) + "Z";
|
||||
},
|
||||
toString: function() {
|
||||
return this._;
|
||||
}
|
||||
};
|
||||
|
||||
exports.path = path;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
}));
|
||||
2
lisp/emacs-application-framework/app/mermaid/node_modules/d3-path/dist/d3-path.min.js
generated
vendored
Normal file
2
lisp/emacs-application-framework/app/mermaid/node_modules/d3-path/dist/d3-path.min.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
// https://d3js.org/d3-path/ v1.0.9 Copyright 2019 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";var 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,f=o-s,c=u*u+f*f;if(_<0)throw new Error("negative radius: "+_);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=s);else if(c>1e-6)if(Math.abs(f*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(c),v=_*Math.tan((i-Math.acos((M+c-l)/(2*d*p)))/2),b=v/p,w=v/d;Math.abs(b-1)>1e-6&&(this._+="L"+(t+b*u)+","+(s+b*f)),this._+="A"+_+","+_+",0,0,"+ +(f*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),f=t+a,c=e+u,x=1^r,y=r?n-o:o-n;if(_<0)throw new Error("negative radius: "+_);null===this._x1?this._+="M"+f+","+c:(Math.abs(this._x1-f)>1e-6||Math.abs(this._y1-c)>1e-6)&&(this._+="L"+f+","+c),_&&(y<0&&(y=y%s+s),y>h?this._+="A"+_+","+_+",0,1,"+x+","+(t-a)+","+(e-u)+"A"+_+","+_+",0,1,"+x+","+(this._x1=f)+","+(this._y1=c):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})});
|
||||
47
lisp/emacs-application-framework/app/mermaid/node_modules/d3-path/package.json
generated
vendored
Normal file
47
lisp/emacs-application-framework/app/mermaid/node_modules/d3-path/package.json
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"name": "d3-path",
|
||||
"version": "1.0.9",
|
||||
"description": "Serialize Canvas path commands to SVG.",
|
||||
"keywords": [
|
||||
"d3",
|
||||
"d3-module",
|
||||
"canvas",
|
||||
"path",
|
||||
"svg",
|
||||
"graphics",
|
||||
"CanvasRenderingContext2D",
|
||||
"CanvasPathMethods",
|
||||
"Path2D"
|
||||
],
|
||||
"homepage": "https://d3js.org/d3-path/",
|
||||
"license": "BSD-3-Clause",
|
||||
"author": {
|
||||
"name": "Mike Bostock",
|
||||
"url": "http://bost.ocks.org/mike"
|
||||
},
|
||||
"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"
|
||||
},
|
||||
"files": [
|
||||
"dist/**/*.js",
|
||||
"src/**/*.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"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"devDependencies": {
|
||||
"eslint": "6",
|
||||
"rollup": "1",
|
||||
"rollup-plugin-terser": "5",
|
||||
"tape": "4"
|
||||
}
|
||||
}
|
||||
1
lisp/emacs-application-framework/app/mermaid/node_modules/d3-path/src/index.js
generated
vendored
Normal file
1
lisp/emacs-application-framework/app/mermaid/node_modules/d3-path/src/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {default as path} from "./path.js";
|
||||
130
lisp/emacs-application-framework/app/mermaid/node_modules/d3-path/src/path.js
generated
vendored
Normal file
130
lisp/emacs-application-framework/app/mermaid/node_modules/d3-path/src/path.js
generated
vendored
Normal file
@@ -0,0 +1,130 @@
|
||||
var pi = Math.PI,
|
||||
tau = 2 * pi,
|
||||
epsilon = 1e-6,
|
||||
tauEpsilon = tau - epsilon;
|
||||
|
||||
function Path() {
|
||||
this._x0 = this._y0 = // start of current subpath
|
||||
this._x1 = this._y1 = null; // end of current subpath
|
||||
this._ = "";
|
||||
}
|
||||
|
||||
function path() {
|
||||
return new Path;
|
||||
}
|
||||
|
||||
Path.prototype = path.prototype = {
|
||||
constructor: Path,
|
||||
moveTo: function(x, y) {
|
||||
this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y);
|
||||
},
|
||||
closePath: function() {
|
||||
if (this._x1 !== null) {
|
||||
this._x1 = this._x0, this._y1 = this._y0;
|
||||
this._ += "Z";
|
||||
}
|
||||
},
|
||||
lineTo: function(x, y) {
|
||||
this._ += "L" + (this._x1 = +x) + "," + (this._y1 = +y);
|
||||
},
|
||||
quadraticCurveTo: function(x1, y1, x, y) {
|
||||
this._ += "Q" + (+x1) + "," + (+y1) + "," + (this._x1 = +x) + "," + (this._y1 = +y);
|
||||
},
|
||||
bezierCurveTo: function(x1, y1, x2, y2, x, y) {
|
||||
this._ += "C" + (+x1) + "," + (+y1) + "," + (+x2) + "," + (+y2) + "," + (this._x1 = +x) + "," + (this._y1 = +y);
|
||||
},
|
||||
arcTo: function(x1, y1, x2, y2, r) {
|
||||
x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;
|
||||
var x0 = this._x1,
|
||||
y0 = this._y1,
|
||||
x21 = x2 - x1,
|
||||
y21 = y2 - y1,
|
||||
x01 = x0 - x1,
|
||||
y01 = y0 - y1,
|
||||
l01_2 = x01 * x01 + y01 * y01;
|
||||
|
||||
// Is the radius negative? Error.
|
||||
if (r < 0) throw new Error("negative radius: " + r);
|
||||
|
||||
// Is this path empty? Move to (x1,y1).
|
||||
if (this._x1 === null) {
|
||||
this._ += "M" + (this._x1 = x1) + "," + (this._y1 = y1);
|
||||
}
|
||||
|
||||
// Or, is (x1,y1) coincident with (x0,y0)? Do nothing.
|
||||
else if (!(l01_2 > epsilon));
|
||||
|
||||
// Or, are (x0,y0), (x1,y1) and (x2,y2) collinear?
|
||||
// Equivalently, is (x1,y1) coincident with (x2,y2)?
|
||||
// Or, is the radius zero? Line to (x1,y1).
|
||||
else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) {
|
||||
this._ += "L" + (this._x1 = x1) + "," + (this._y1 = y1);
|
||||
}
|
||||
|
||||
// Otherwise, draw an arc!
|
||||
else {
|
||||
var x20 = x2 - x0,
|
||||
y20 = y2 - y0,
|
||||
l21_2 = x21 * x21 + y21 * y21,
|
||||
l20_2 = x20 * x20 + y20 * y20,
|
||||
l21 = Math.sqrt(l21_2),
|
||||
l01 = Math.sqrt(l01_2),
|
||||
l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2),
|
||||
t01 = l / l01,
|
||||
t21 = l / l21;
|
||||
|
||||
// If the start tangent is not coincident with (x0,y0), line to.
|
||||
if (Math.abs(t01 - 1) > epsilon) {
|
||||
this._ += "L" + (x1 + t01 * x01) + "," + (y1 + t01 * y01);
|
||||
}
|
||||
|
||||
this._ += "A" + r + "," + r + ",0,0," + (+(y01 * x20 > x01 * y20)) + "," + (this._x1 = x1 + t21 * x21) + "," + (this._y1 = y1 + t21 * y21);
|
||||
}
|
||||
},
|
||||
arc: function(x, y, r, a0, a1, ccw) {
|
||||
x = +x, y = +y, r = +r, ccw = !!ccw;
|
||||
var dx = r * Math.cos(a0),
|
||||
dy = r * Math.sin(a0),
|
||||
x0 = x + dx,
|
||||
y0 = y + dy,
|
||||
cw = 1 ^ ccw,
|
||||
da = ccw ? a0 - a1 : a1 - a0;
|
||||
|
||||
// Is the radius negative? Error.
|
||||
if (r < 0) throw new Error("negative radius: " + r);
|
||||
|
||||
// Is this path empty? Move to (x0,y0).
|
||||
if (this._x1 === null) {
|
||||
this._ += "M" + x0 + "," + y0;
|
||||
}
|
||||
|
||||
// Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0).
|
||||
else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) {
|
||||
this._ += "L" + x0 + "," + y0;
|
||||
}
|
||||
|
||||
// Is this arc empty? We’re done.
|
||||
if (!r) return;
|
||||
|
||||
// Does the angle go the wrong way? Flip the direction.
|
||||
if (da < 0) da = da % tau + tau;
|
||||
|
||||
// Is this a complete circle? Draw two arcs to complete the circle.
|
||||
if (da > tauEpsilon) {
|
||||
this._ += "A" + r + "," + r + ",0,1," + cw + "," + (x - dx) + "," + (y - dy) + "A" + r + "," + r + ",0,1," + cw + "," + (this._x1 = x0) + "," + (this._y1 = y0);
|
||||
}
|
||||
|
||||
// Is this arc non-empty? Draw an arc!
|
||||
else if (da > epsilon) {
|
||||
this._ += "A" + r + "," + r + ",0," + (+(da >= pi)) + "," + cw + "," + (this._x1 = x + r * Math.cos(a1)) + "," + (this._y1 = y + r * Math.sin(a1));
|
||||
}
|
||||
},
|
||||
rect: function(x, y, w, h) {
|
||||
this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y) + "h" + (+w) + "v" + (+h) + "h" + (-w) + "Z";
|
||||
},
|
||||
toString: function() {
|
||||
return this._;
|
||||
}
|
||||
};
|
||||
|
||||
export default path;
|
||||
Reference in New Issue
Block a user