Upload folder using huggingface_hub (part 29)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- tools/ui/node_modules/d3-shape/src/curve/bump.js +75 -0
- tools/ui/node_modules/d3-shape/src/curve/bundle.js +56 -0
- tools/ui/node_modules/d3-shape/src/curve/cardinal.js +61 -0
- tools/ui/node_modules/d3-shape/src/curve/cardinalClosed.js +61 -0
- tools/ui/node_modules/d3-shape/src/curve/cardinalOpen.js +49 -0
- tools/ui/node_modules/d3-shape/src/curve/catmullRom.js +88 -0
- tools/ui/node_modules/d3-shape/src/curve/catmullRomClosed.js +74 -0
- tools/ui/node_modules/d3-shape/src/curve/catmullRomOpen.js +62 -0
- tools/ui/node_modules/d3-shape/src/curve/linear.js +31 -0
- tools/ui/node_modules/d3-shape/src/curve/linearClosed.js +25 -0
- tools/ui/node_modules/d3-shape/src/curve/monotone.js +104 -0
- tools/ui/node_modules/d3-shape/src/curve/natural.js +65 -0
- tools/ui/node_modules/d3-shape/src/curve/radial.js +36 -0
- tools/ui/node_modules/d3-shape/src/curve/step.js +53 -0
- tools/ui/node_modules/d3-shape/src/descending.js +3 -0
- tools/ui/node_modules/d3-shape/src/identity.js +3 -0
- tools/ui/node_modules/d3-shape/src/index.js +53 -0
- tools/ui/node_modules/d3-shape/src/line.js +58 -0
- tools/ui/node_modules/d3-shape/src/lineRadial.js +19 -0
- tools/ui/node_modules/d3-shape/src/link.js +73 -0
- tools/ui/node_modules/d3-shape/src/math.js +20 -0
- tools/ui/node_modules/d3-shape/src/noop.js +1 -0
- tools/ui/node_modules/d3-shape/src/offset/diverging.js +14 -0
- tools/ui/node_modules/d3-shape/src/offset/expand.js +10 -0
- tools/ui/node_modules/d3-shape/src/offset/none.js +9 -0
- tools/ui/node_modules/d3-shape/src/offset/silhouette.js +10 -0
- tools/ui/node_modules/d3-shape/src/offset/wiggle.js +24 -0
- tools/ui/node_modules/d3-shape/src/order/appearance.js +12 -0
- tools/ui/node_modules/d3-shape/src/order/ascending.js +12 -0
- tools/ui/node_modules/d3-shape/src/order/descending.js +5 -0
- tools/ui/node_modules/d3-shape/src/order/insideOut.js +27 -0
- tools/ui/node_modules/d3-shape/src/order/none.js +5 -0
- tools/ui/node_modules/d3-shape/src/order/reverse.js +5 -0
- tools/ui/node_modules/d3-shape/src/path.js +19 -0
- tools/ui/node_modules/d3-shape/src/pie.js +80 -0
- tools/ui/node_modules/d3-shape/src/point.js +7 -0
- tools/ui/node_modules/d3-shape/src/pointRadial.js +3 -0
- tools/ui/node_modules/d3-shape/src/stack.js +58 -0
- tools/ui/node_modules/d3-shape/src/symbol.js +66 -0
- tools/ui/node_modules/d3-shape/src/symbol/asterisk.js +17 -0
- tools/ui/node_modules/d3-shape/src/symbol/circle.js +9 -0
- tools/ui/node_modules/d3-shape/src/symbol/cross.js +20 -0
- tools/ui/node_modules/d3-shape/src/symbol/diamond.js +16 -0
- tools/ui/node_modules/d3-shape/src/symbol/diamond2.js +12 -0
- tools/ui/node_modules/d3-shape/src/symbol/plus.js +11 -0
- tools/ui/node_modules/d3-shape/src/symbol/square.js +9 -0
- tools/ui/node_modules/d3-shape/src/symbol/square2.js +12 -0
- tools/ui/node_modules/d3-shape/src/symbol/star.js +24 -0
- tools/ui/node_modules/d3-shape/src/symbol/times.js +11 -0
- tools/ui/node_modules/d3-shape/src/symbol/triangle.js +13 -0
tools/ui/node_modules/d3-shape/src/curve/bump.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pointRadial from "../pointRadial.js";
|
| 2 |
+
|
| 3 |
+
class Bump {
|
| 4 |
+
constructor(context, x) {
|
| 5 |
+
this._context = context;
|
| 6 |
+
this._x = x;
|
| 7 |
+
}
|
| 8 |
+
areaStart() {
|
| 9 |
+
this._line = 0;
|
| 10 |
+
}
|
| 11 |
+
areaEnd() {
|
| 12 |
+
this._line = NaN;
|
| 13 |
+
}
|
| 14 |
+
lineStart() {
|
| 15 |
+
this._point = 0;
|
| 16 |
+
}
|
| 17 |
+
lineEnd() {
|
| 18 |
+
if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
|
| 19 |
+
this._line = 1 - this._line;
|
| 20 |
+
}
|
| 21 |
+
point(x, y) {
|
| 22 |
+
x = +x, y = +y;
|
| 23 |
+
switch (this._point) {
|
| 24 |
+
case 0: {
|
| 25 |
+
this._point = 1;
|
| 26 |
+
if (this._line) this._context.lineTo(x, y);
|
| 27 |
+
else this._context.moveTo(x, y);
|
| 28 |
+
break;
|
| 29 |
+
}
|
| 30 |
+
case 1: this._point = 2; // falls through
|
| 31 |
+
default: {
|
| 32 |
+
if (this._x) this._context.bezierCurveTo(this._x0 = (this._x0 + x) / 2, this._y0, this._x0, y, x, y);
|
| 33 |
+
else this._context.bezierCurveTo(this._x0, this._y0 = (this._y0 + y) / 2, x, this._y0, x, y);
|
| 34 |
+
break;
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
this._x0 = x, this._y0 = y;
|
| 38 |
+
}
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
class BumpRadial {
|
| 42 |
+
constructor(context) {
|
| 43 |
+
this._context = context;
|
| 44 |
+
}
|
| 45 |
+
lineStart() {
|
| 46 |
+
this._point = 0;
|
| 47 |
+
}
|
| 48 |
+
lineEnd() {}
|
| 49 |
+
point(x, y) {
|
| 50 |
+
x = +x, y = +y;
|
| 51 |
+
if (this._point === 0) {
|
| 52 |
+
this._point = 1;
|
| 53 |
+
} else {
|
| 54 |
+
const p0 = pointRadial(this._x0, this._y0);
|
| 55 |
+
const p1 = pointRadial(this._x0, this._y0 = (this._y0 + y) / 2);
|
| 56 |
+
const p2 = pointRadial(x, this._y0);
|
| 57 |
+
const p3 = pointRadial(x, y);
|
| 58 |
+
this._context.moveTo(...p0);
|
| 59 |
+
this._context.bezierCurveTo(...p1, ...p2, ...p3);
|
| 60 |
+
}
|
| 61 |
+
this._x0 = x, this._y0 = y;
|
| 62 |
+
}
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
export function bumpX(context) {
|
| 66 |
+
return new Bump(context, true);
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
export function bumpY(context) {
|
| 70 |
+
return new Bump(context, false);
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
export function bumpRadial(context) {
|
| 74 |
+
return new BumpRadial(context);
|
| 75 |
+
}
|
tools/ui/node_modules/d3-shape/src/curve/bundle.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import {Basis} from "./basis.js";
|
| 2 |
+
|
| 3 |
+
function Bundle(context, beta) {
|
| 4 |
+
this._basis = new Basis(context);
|
| 5 |
+
this._beta = beta;
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
Bundle.prototype = {
|
| 9 |
+
lineStart: function() {
|
| 10 |
+
this._x = [];
|
| 11 |
+
this._y = [];
|
| 12 |
+
this._basis.lineStart();
|
| 13 |
+
},
|
| 14 |
+
lineEnd: function() {
|
| 15 |
+
var x = this._x,
|
| 16 |
+
y = this._y,
|
| 17 |
+
j = x.length - 1;
|
| 18 |
+
|
| 19 |
+
if (j > 0) {
|
| 20 |
+
var x0 = x[0],
|
| 21 |
+
y0 = y[0],
|
| 22 |
+
dx = x[j] - x0,
|
| 23 |
+
dy = y[j] - y0,
|
| 24 |
+
i = -1,
|
| 25 |
+
t;
|
| 26 |
+
|
| 27 |
+
while (++i <= j) {
|
| 28 |
+
t = i / j;
|
| 29 |
+
this._basis.point(
|
| 30 |
+
this._beta * x[i] + (1 - this._beta) * (x0 + t * dx),
|
| 31 |
+
this._beta * y[i] + (1 - this._beta) * (y0 + t * dy)
|
| 32 |
+
);
|
| 33 |
+
}
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
this._x = this._y = null;
|
| 37 |
+
this._basis.lineEnd();
|
| 38 |
+
},
|
| 39 |
+
point: function(x, y) {
|
| 40 |
+
this._x.push(+x);
|
| 41 |
+
this._y.push(+y);
|
| 42 |
+
}
|
| 43 |
+
};
|
| 44 |
+
|
| 45 |
+
export default (function custom(beta) {
|
| 46 |
+
|
| 47 |
+
function bundle(context) {
|
| 48 |
+
return beta === 1 ? new Basis(context) : new Bundle(context, beta);
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
bundle.beta = function(beta) {
|
| 52 |
+
return custom(+beta);
|
| 53 |
+
};
|
| 54 |
+
|
| 55 |
+
return bundle;
|
| 56 |
+
})(0.85);
|
tools/ui/node_modules/d3-shape/src/curve/cardinal.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export function point(that, x, y) {
|
| 2 |
+
that._context.bezierCurveTo(
|
| 3 |
+
that._x1 + that._k * (that._x2 - that._x0),
|
| 4 |
+
that._y1 + that._k * (that._y2 - that._y0),
|
| 5 |
+
that._x2 + that._k * (that._x1 - x),
|
| 6 |
+
that._y2 + that._k * (that._y1 - y),
|
| 7 |
+
that._x2,
|
| 8 |
+
that._y2
|
| 9 |
+
);
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
export function Cardinal(context, tension) {
|
| 13 |
+
this._context = context;
|
| 14 |
+
this._k = (1 - tension) / 6;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
Cardinal.prototype = {
|
| 18 |
+
areaStart: function() {
|
| 19 |
+
this._line = 0;
|
| 20 |
+
},
|
| 21 |
+
areaEnd: function() {
|
| 22 |
+
this._line = NaN;
|
| 23 |
+
},
|
| 24 |
+
lineStart: function() {
|
| 25 |
+
this._x0 = this._x1 = this._x2 =
|
| 26 |
+
this._y0 = this._y1 = this._y2 = NaN;
|
| 27 |
+
this._point = 0;
|
| 28 |
+
},
|
| 29 |
+
lineEnd: function() {
|
| 30 |
+
switch (this._point) {
|
| 31 |
+
case 2: this._context.lineTo(this._x2, this._y2); break;
|
| 32 |
+
case 3: point(this, this._x1, this._y1); break;
|
| 33 |
+
}
|
| 34 |
+
if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
|
| 35 |
+
this._line = 1 - this._line;
|
| 36 |
+
},
|
| 37 |
+
point: function(x, y) {
|
| 38 |
+
x = +x, y = +y;
|
| 39 |
+
switch (this._point) {
|
| 40 |
+
case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
|
| 41 |
+
case 1: this._point = 2; this._x1 = x, this._y1 = y; break;
|
| 42 |
+
case 2: this._point = 3; // falls through
|
| 43 |
+
default: point(this, x, y); break;
|
| 44 |
+
}
|
| 45 |
+
this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
|
| 46 |
+
this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
|
| 47 |
+
}
|
| 48 |
+
};
|
| 49 |
+
|
| 50 |
+
export default (function custom(tension) {
|
| 51 |
+
|
| 52 |
+
function cardinal(context) {
|
| 53 |
+
return new Cardinal(context, tension);
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
cardinal.tension = function(tension) {
|
| 57 |
+
return custom(+tension);
|
| 58 |
+
};
|
| 59 |
+
|
| 60 |
+
return cardinal;
|
| 61 |
+
})(0);
|
tools/ui/node_modules/d3-shape/src/curve/cardinalClosed.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import noop from "../noop.js";
|
| 2 |
+
import {point} from "./cardinal.js";
|
| 3 |
+
|
| 4 |
+
export function CardinalClosed(context, tension) {
|
| 5 |
+
this._context = context;
|
| 6 |
+
this._k = (1 - tension) / 6;
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
CardinalClosed.prototype = {
|
| 10 |
+
areaStart: noop,
|
| 11 |
+
areaEnd: noop,
|
| 12 |
+
lineStart: function() {
|
| 13 |
+
this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =
|
| 14 |
+
this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;
|
| 15 |
+
this._point = 0;
|
| 16 |
+
},
|
| 17 |
+
lineEnd: function() {
|
| 18 |
+
switch (this._point) {
|
| 19 |
+
case 1: {
|
| 20 |
+
this._context.moveTo(this._x3, this._y3);
|
| 21 |
+
this._context.closePath();
|
| 22 |
+
break;
|
| 23 |
+
}
|
| 24 |
+
case 2: {
|
| 25 |
+
this._context.lineTo(this._x3, this._y3);
|
| 26 |
+
this._context.closePath();
|
| 27 |
+
break;
|
| 28 |
+
}
|
| 29 |
+
case 3: {
|
| 30 |
+
this.point(this._x3, this._y3);
|
| 31 |
+
this.point(this._x4, this._y4);
|
| 32 |
+
this.point(this._x5, this._y5);
|
| 33 |
+
break;
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
},
|
| 37 |
+
point: function(x, y) {
|
| 38 |
+
x = +x, y = +y;
|
| 39 |
+
switch (this._point) {
|
| 40 |
+
case 0: this._point = 1; this._x3 = x, this._y3 = y; break;
|
| 41 |
+
case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;
|
| 42 |
+
case 2: this._point = 3; this._x5 = x, this._y5 = y; break;
|
| 43 |
+
default: point(this, x, y); break;
|
| 44 |
+
}
|
| 45 |
+
this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
|
| 46 |
+
this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
|
| 47 |
+
}
|
| 48 |
+
};
|
| 49 |
+
|
| 50 |
+
export default (function custom(tension) {
|
| 51 |
+
|
| 52 |
+
function cardinal(context) {
|
| 53 |
+
return new CardinalClosed(context, tension);
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
cardinal.tension = function(tension) {
|
| 57 |
+
return custom(+tension);
|
| 58 |
+
};
|
| 59 |
+
|
| 60 |
+
return cardinal;
|
| 61 |
+
})(0);
|
tools/ui/node_modules/d3-shape/src/curve/cardinalOpen.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import {point} from "./cardinal.js";
|
| 2 |
+
|
| 3 |
+
export function CardinalOpen(context, tension) {
|
| 4 |
+
this._context = context;
|
| 5 |
+
this._k = (1 - tension) / 6;
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
CardinalOpen.prototype = {
|
| 9 |
+
areaStart: function() {
|
| 10 |
+
this._line = 0;
|
| 11 |
+
},
|
| 12 |
+
areaEnd: function() {
|
| 13 |
+
this._line = NaN;
|
| 14 |
+
},
|
| 15 |
+
lineStart: function() {
|
| 16 |
+
this._x0 = this._x1 = this._x2 =
|
| 17 |
+
this._y0 = this._y1 = this._y2 = NaN;
|
| 18 |
+
this._point = 0;
|
| 19 |
+
},
|
| 20 |
+
lineEnd: function() {
|
| 21 |
+
if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();
|
| 22 |
+
this._line = 1 - this._line;
|
| 23 |
+
},
|
| 24 |
+
point: function(x, y) {
|
| 25 |
+
x = +x, y = +y;
|
| 26 |
+
switch (this._point) {
|
| 27 |
+
case 0: this._point = 1; break;
|
| 28 |
+
case 1: this._point = 2; break;
|
| 29 |
+
case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break;
|
| 30 |
+
case 3: this._point = 4; // falls through
|
| 31 |
+
default: point(this, x, y); break;
|
| 32 |
+
}
|
| 33 |
+
this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
|
| 34 |
+
this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
|
| 35 |
+
}
|
| 36 |
+
};
|
| 37 |
+
|
| 38 |
+
export default (function custom(tension) {
|
| 39 |
+
|
| 40 |
+
function cardinal(context) {
|
| 41 |
+
return new CardinalOpen(context, tension);
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
cardinal.tension = function(tension) {
|
| 45 |
+
return custom(+tension);
|
| 46 |
+
};
|
| 47 |
+
|
| 48 |
+
return cardinal;
|
| 49 |
+
})(0);
|
tools/ui/node_modules/d3-shape/src/curve/catmullRom.js
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import {epsilon} from "../math.js";
|
| 2 |
+
import {Cardinal} from "./cardinal.js";
|
| 3 |
+
|
| 4 |
+
export function point(that, x, y) {
|
| 5 |
+
var x1 = that._x1,
|
| 6 |
+
y1 = that._y1,
|
| 7 |
+
x2 = that._x2,
|
| 8 |
+
y2 = that._y2;
|
| 9 |
+
|
| 10 |
+
if (that._l01_a > epsilon) {
|
| 11 |
+
var a = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a,
|
| 12 |
+
n = 3 * that._l01_a * (that._l01_a + that._l12_a);
|
| 13 |
+
x1 = (x1 * a - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n;
|
| 14 |
+
y1 = (y1 * a - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
if (that._l23_a > epsilon) {
|
| 18 |
+
var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a,
|
| 19 |
+
m = 3 * that._l23_a * (that._l23_a + that._l12_a);
|
| 20 |
+
x2 = (x2 * b + that._x1 * that._l23_2a - x * that._l12_2a) / m;
|
| 21 |
+
y2 = (y2 * b + that._y1 * that._l23_2a - y * that._l12_2a) / m;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
that._context.bezierCurveTo(x1, y1, x2, y2, that._x2, that._y2);
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
function CatmullRom(context, alpha) {
|
| 28 |
+
this._context = context;
|
| 29 |
+
this._alpha = alpha;
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
CatmullRom.prototype = {
|
| 33 |
+
areaStart: function() {
|
| 34 |
+
this._line = 0;
|
| 35 |
+
},
|
| 36 |
+
areaEnd: function() {
|
| 37 |
+
this._line = NaN;
|
| 38 |
+
},
|
| 39 |
+
lineStart: function() {
|
| 40 |
+
this._x0 = this._x1 = this._x2 =
|
| 41 |
+
this._y0 = this._y1 = this._y2 = NaN;
|
| 42 |
+
this._l01_a = this._l12_a = this._l23_a =
|
| 43 |
+
this._l01_2a = this._l12_2a = this._l23_2a =
|
| 44 |
+
this._point = 0;
|
| 45 |
+
},
|
| 46 |
+
lineEnd: function() {
|
| 47 |
+
switch (this._point) {
|
| 48 |
+
case 2: this._context.lineTo(this._x2, this._y2); break;
|
| 49 |
+
case 3: this.point(this._x2, this._y2); break;
|
| 50 |
+
}
|
| 51 |
+
if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
|
| 52 |
+
this._line = 1 - this._line;
|
| 53 |
+
},
|
| 54 |
+
point: function(x, y) {
|
| 55 |
+
x = +x, y = +y;
|
| 56 |
+
|
| 57 |
+
if (this._point) {
|
| 58 |
+
var x23 = this._x2 - x,
|
| 59 |
+
y23 = this._y2 - y;
|
| 60 |
+
this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
switch (this._point) {
|
| 64 |
+
case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
|
| 65 |
+
case 1: this._point = 2; break;
|
| 66 |
+
case 2: this._point = 3; // falls through
|
| 67 |
+
default: point(this, x, y); break;
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
this._l01_a = this._l12_a, this._l12_a = this._l23_a;
|
| 71 |
+
this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;
|
| 72 |
+
this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
|
| 73 |
+
this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
|
| 74 |
+
}
|
| 75 |
+
};
|
| 76 |
+
|
| 77 |
+
export default (function custom(alpha) {
|
| 78 |
+
|
| 79 |
+
function catmullRom(context) {
|
| 80 |
+
return alpha ? new CatmullRom(context, alpha) : new Cardinal(context, 0);
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
catmullRom.alpha = function(alpha) {
|
| 84 |
+
return custom(+alpha);
|
| 85 |
+
};
|
| 86 |
+
|
| 87 |
+
return catmullRom;
|
| 88 |
+
})(0.5);
|
tools/ui/node_modules/d3-shape/src/curve/catmullRomClosed.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import {CardinalClosed} from "./cardinalClosed.js";
|
| 2 |
+
import noop from "../noop.js";
|
| 3 |
+
import {point} from "./catmullRom.js";
|
| 4 |
+
|
| 5 |
+
function CatmullRomClosed(context, alpha) {
|
| 6 |
+
this._context = context;
|
| 7 |
+
this._alpha = alpha;
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
CatmullRomClosed.prototype = {
|
| 11 |
+
areaStart: noop,
|
| 12 |
+
areaEnd: noop,
|
| 13 |
+
lineStart: function() {
|
| 14 |
+
this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =
|
| 15 |
+
this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;
|
| 16 |
+
this._l01_a = this._l12_a = this._l23_a =
|
| 17 |
+
this._l01_2a = this._l12_2a = this._l23_2a =
|
| 18 |
+
this._point = 0;
|
| 19 |
+
},
|
| 20 |
+
lineEnd: function() {
|
| 21 |
+
switch (this._point) {
|
| 22 |
+
case 1: {
|
| 23 |
+
this._context.moveTo(this._x3, this._y3);
|
| 24 |
+
this._context.closePath();
|
| 25 |
+
break;
|
| 26 |
+
}
|
| 27 |
+
case 2: {
|
| 28 |
+
this._context.lineTo(this._x3, this._y3);
|
| 29 |
+
this._context.closePath();
|
| 30 |
+
break;
|
| 31 |
+
}
|
| 32 |
+
case 3: {
|
| 33 |
+
this.point(this._x3, this._y3);
|
| 34 |
+
this.point(this._x4, this._y4);
|
| 35 |
+
this.point(this._x5, this._y5);
|
| 36 |
+
break;
|
| 37 |
+
}
|
| 38 |
+
}
|
| 39 |
+
},
|
| 40 |
+
point: function(x, y) {
|
| 41 |
+
x = +x, y = +y;
|
| 42 |
+
|
| 43 |
+
if (this._point) {
|
| 44 |
+
var x23 = this._x2 - x,
|
| 45 |
+
y23 = this._y2 - y;
|
| 46 |
+
this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
switch (this._point) {
|
| 50 |
+
case 0: this._point = 1; this._x3 = x, this._y3 = y; break;
|
| 51 |
+
case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;
|
| 52 |
+
case 2: this._point = 3; this._x5 = x, this._y5 = y; break;
|
| 53 |
+
default: point(this, x, y); break;
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
this._l01_a = this._l12_a, this._l12_a = this._l23_a;
|
| 57 |
+
this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;
|
| 58 |
+
this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
|
| 59 |
+
this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
|
| 60 |
+
}
|
| 61 |
+
};
|
| 62 |
+
|
| 63 |
+
export default (function custom(alpha) {
|
| 64 |
+
|
| 65 |
+
function catmullRom(context) {
|
| 66 |
+
return alpha ? new CatmullRomClosed(context, alpha) : new CardinalClosed(context, 0);
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
catmullRom.alpha = function(alpha) {
|
| 70 |
+
return custom(+alpha);
|
| 71 |
+
};
|
| 72 |
+
|
| 73 |
+
return catmullRom;
|
| 74 |
+
})(0.5);
|
tools/ui/node_modules/d3-shape/src/curve/catmullRomOpen.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import {CardinalOpen} from "./cardinalOpen.js";
|
| 2 |
+
import {point} from "./catmullRom.js";
|
| 3 |
+
|
| 4 |
+
function CatmullRomOpen(context, alpha) {
|
| 5 |
+
this._context = context;
|
| 6 |
+
this._alpha = alpha;
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
CatmullRomOpen.prototype = {
|
| 10 |
+
areaStart: function() {
|
| 11 |
+
this._line = 0;
|
| 12 |
+
},
|
| 13 |
+
areaEnd: function() {
|
| 14 |
+
this._line = NaN;
|
| 15 |
+
},
|
| 16 |
+
lineStart: function() {
|
| 17 |
+
this._x0 = this._x1 = this._x2 =
|
| 18 |
+
this._y0 = this._y1 = this._y2 = NaN;
|
| 19 |
+
this._l01_a = this._l12_a = this._l23_a =
|
| 20 |
+
this._l01_2a = this._l12_2a = this._l23_2a =
|
| 21 |
+
this._point = 0;
|
| 22 |
+
},
|
| 23 |
+
lineEnd: function() {
|
| 24 |
+
if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();
|
| 25 |
+
this._line = 1 - this._line;
|
| 26 |
+
},
|
| 27 |
+
point: function(x, y) {
|
| 28 |
+
x = +x, y = +y;
|
| 29 |
+
|
| 30 |
+
if (this._point) {
|
| 31 |
+
var x23 = this._x2 - x,
|
| 32 |
+
y23 = this._y2 - y;
|
| 33 |
+
this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
switch (this._point) {
|
| 37 |
+
case 0: this._point = 1; break;
|
| 38 |
+
case 1: this._point = 2; break;
|
| 39 |
+
case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break;
|
| 40 |
+
case 3: this._point = 4; // falls through
|
| 41 |
+
default: point(this, x, y); break;
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
this._l01_a = this._l12_a, this._l12_a = this._l23_a;
|
| 45 |
+
this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;
|
| 46 |
+
this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
|
| 47 |
+
this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
|
| 48 |
+
}
|
| 49 |
+
};
|
| 50 |
+
|
| 51 |
+
export default (function custom(alpha) {
|
| 52 |
+
|
| 53 |
+
function catmullRom(context) {
|
| 54 |
+
return alpha ? new CatmullRomOpen(context, alpha) : new CardinalOpen(context, 0);
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
catmullRom.alpha = function(alpha) {
|
| 58 |
+
return custom(+alpha);
|
| 59 |
+
};
|
| 60 |
+
|
| 61 |
+
return catmullRom;
|
| 62 |
+
})(0.5);
|
tools/ui/node_modules/d3-shape/src/curve/linear.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
function Linear(context) {
|
| 2 |
+
this._context = context;
|
| 3 |
+
}
|
| 4 |
+
|
| 5 |
+
Linear.prototype = {
|
| 6 |
+
areaStart: function() {
|
| 7 |
+
this._line = 0;
|
| 8 |
+
},
|
| 9 |
+
areaEnd: function() {
|
| 10 |
+
this._line = NaN;
|
| 11 |
+
},
|
| 12 |
+
lineStart: function() {
|
| 13 |
+
this._point = 0;
|
| 14 |
+
},
|
| 15 |
+
lineEnd: function() {
|
| 16 |
+
if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
|
| 17 |
+
this._line = 1 - this._line;
|
| 18 |
+
},
|
| 19 |
+
point: function(x, y) {
|
| 20 |
+
x = +x, y = +y;
|
| 21 |
+
switch (this._point) {
|
| 22 |
+
case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
|
| 23 |
+
case 1: this._point = 2; // falls through
|
| 24 |
+
default: this._context.lineTo(x, y); break;
|
| 25 |
+
}
|
| 26 |
+
}
|
| 27 |
+
};
|
| 28 |
+
|
| 29 |
+
export default function(context) {
|
| 30 |
+
return new Linear(context);
|
| 31 |
+
}
|
tools/ui/node_modules/d3-shape/src/curve/linearClosed.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import noop from "../noop.js";
|
| 2 |
+
|
| 3 |
+
function LinearClosed(context) {
|
| 4 |
+
this._context = context;
|
| 5 |
+
}
|
| 6 |
+
|
| 7 |
+
LinearClosed.prototype = {
|
| 8 |
+
areaStart: noop,
|
| 9 |
+
areaEnd: noop,
|
| 10 |
+
lineStart: function() {
|
| 11 |
+
this._point = 0;
|
| 12 |
+
},
|
| 13 |
+
lineEnd: function() {
|
| 14 |
+
if (this._point) this._context.closePath();
|
| 15 |
+
},
|
| 16 |
+
point: function(x, y) {
|
| 17 |
+
x = +x, y = +y;
|
| 18 |
+
if (this._point) this._context.lineTo(x, y);
|
| 19 |
+
else this._point = 1, this._context.moveTo(x, y);
|
| 20 |
+
}
|
| 21 |
+
};
|
| 22 |
+
|
| 23 |
+
export default function(context) {
|
| 24 |
+
return new LinearClosed(context);
|
| 25 |
+
}
|
tools/ui/node_modules/d3-shape/src/curve/monotone.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
function sign(x) {
|
| 2 |
+
return x < 0 ? -1 : 1;
|
| 3 |
+
}
|
| 4 |
+
|
| 5 |
+
// Calculate the slopes of the tangents (Hermite-type interpolation) based on
|
| 6 |
+
// the following paper: Steffen, M. 1990. A Simple Method for Monotonic
|
| 7 |
+
// Interpolation in One Dimension. Astronomy and Astrophysics, Vol. 239, NO.
|
| 8 |
+
// NOV(II), P. 443, 1990.
|
| 9 |
+
function slope3(that, x2, y2) {
|
| 10 |
+
var h0 = that._x1 - that._x0,
|
| 11 |
+
h1 = x2 - that._x1,
|
| 12 |
+
s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0),
|
| 13 |
+
s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0),
|
| 14 |
+
p = (s0 * h1 + s1 * h0) / (h0 + h1);
|
| 15 |
+
return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0;
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
// Calculate a one-sided slope.
|
| 19 |
+
function slope2(that, t) {
|
| 20 |
+
var h = that._x1 - that._x0;
|
| 21 |
+
return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
// According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations
|
| 25 |
+
// "you can express cubic Hermite interpolation in terms of cubic Bézier curves
|
| 26 |
+
// with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1".
|
| 27 |
+
function point(that, t0, t1) {
|
| 28 |
+
var x0 = that._x0,
|
| 29 |
+
y0 = that._y0,
|
| 30 |
+
x1 = that._x1,
|
| 31 |
+
y1 = that._y1,
|
| 32 |
+
dx = (x1 - x0) / 3;
|
| 33 |
+
that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1);
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
function MonotoneX(context) {
|
| 37 |
+
this._context = context;
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
MonotoneX.prototype = {
|
| 41 |
+
areaStart: function() {
|
| 42 |
+
this._line = 0;
|
| 43 |
+
},
|
| 44 |
+
areaEnd: function() {
|
| 45 |
+
this._line = NaN;
|
| 46 |
+
},
|
| 47 |
+
lineStart: function() {
|
| 48 |
+
this._x0 = this._x1 =
|
| 49 |
+
this._y0 = this._y1 =
|
| 50 |
+
this._t0 = NaN;
|
| 51 |
+
this._point = 0;
|
| 52 |
+
},
|
| 53 |
+
lineEnd: function() {
|
| 54 |
+
switch (this._point) {
|
| 55 |
+
case 2: this._context.lineTo(this._x1, this._y1); break;
|
| 56 |
+
case 3: point(this, this._t0, slope2(this, this._t0)); break;
|
| 57 |
+
}
|
| 58 |
+
if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
|
| 59 |
+
this._line = 1 - this._line;
|
| 60 |
+
},
|
| 61 |
+
point: function(x, y) {
|
| 62 |
+
var t1 = NaN;
|
| 63 |
+
|
| 64 |
+
x = +x, y = +y;
|
| 65 |
+
if (x === this._x1 && y === this._y1) return; // Ignore coincident points.
|
| 66 |
+
switch (this._point) {
|
| 67 |
+
case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
|
| 68 |
+
case 1: this._point = 2; break;
|
| 69 |
+
case 2: this._point = 3; point(this, slope2(this, t1 = slope3(this, x, y)), t1); break;
|
| 70 |
+
default: point(this, this._t0, t1 = slope3(this, x, y)); break;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
this._x0 = this._x1, this._x1 = x;
|
| 74 |
+
this._y0 = this._y1, this._y1 = y;
|
| 75 |
+
this._t0 = t1;
|
| 76 |
+
}
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
function MonotoneY(context) {
|
| 80 |
+
this._context = new ReflectContext(context);
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
(MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x, y) {
|
| 84 |
+
MonotoneX.prototype.point.call(this, y, x);
|
| 85 |
+
};
|
| 86 |
+
|
| 87 |
+
function ReflectContext(context) {
|
| 88 |
+
this._context = context;
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
ReflectContext.prototype = {
|
| 92 |
+
moveTo: function(x, y) { this._context.moveTo(y, x); },
|
| 93 |
+
closePath: function() { this._context.closePath(); },
|
| 94 |
+
lineTo: function(x, y) { this._context.lineTo(y, x); },
|
| 95 |
+
bezierCurveTo: function(x1, y1, x2, y2, x, y) { this._context.bezierCurveTo(y1, x1, y2, x2, y, x); }
|
| 96 |
+
};
|
| 97 |
+
|
| 98 |
+
export function monotoneX(context) {
|
| 99 |
+
return new MonotoneX(context);
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
export function monotoneY(context) {
|
| 103 |
+
return new MonotoneY(context);
|
| 104 |
+
}
|
tools/ui/node_modules/d3-shape/src/curve/natural.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
function Natural(context) {
|
| 2 |
+
this._context = context;
|
| 3 |
+
}
|
| 4 |
+
|
| 5 |
+
Natural.prototype = {
|
| 6 |
+
areaStart: function() {
|
| 7 |
+
this._line = 0;
|
| 8 |
+
},
|
| 9 |
+
areaEnd: function() {
|
| 10 |
+
this._line = NaN;
|
| 11 |
+
},
|
| 12 |
+
lineStart: function() {
|
| 13 |
+
this._x = [];
|
| 14 |
+
this._y = [];
|
| 15 |
+
},
|
| 16 |
+
lineEnd: function() {
|
| 17 |
+
var x = this._x,
|
| 18 |
+
y = this._y,
|
| 19 |
+
n = x.length;
|
| 20 |
+
|
| 21 |
+
if (n) {
|
| 22 |
+
this._line ? this._context.lineTo(x[0], y[0]) : this._context.moveTo(x[0], y[0]);
|
| 23 |
+
if (n === 2) {
|
| 24 |
+
this._context.lineTo(x[1], y[1]);
|
| 25 |
+
} else {
|
| 26 |
+
var px = controlPoints(x),
|
| 27 |
+
py = controlPoints(y);
|
| 28 |
+
for (var i0 = 0, i1 = 1; i1 < n; ++i0, ++i1) {
|
| 29 |
+
this._context.bezierCurveTo(px[0][i0], py[0][i0], px[1][i0], py[1][i0], x[i1], y[i1]);
|
| 30 |
+
}
|
| 31 |
+
}
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
if (this._line || (this._line !== 0 && n === 1)) this._context.closePath();
|
| 35 |
+
this._line = 1 - this._line;
|
| 36 |
+
this._x = this._y = null;
|
| 37 |
+
},
|
| 38 |
+
point: function(x, y) {
|
| 39 |
+
this._x.push(+x);
|
| 40 |
+
this._y.push(+y);
|
| 41 |
+
}
|
| 42 |
+
};
|
| 43 |
+
|
| 44 |
+
// See https://www.particleincell.com/2012/bezier-splines/ for derivation.
|
| 45 |
+
function controlPoints(x) {
|
| 46 |
+
var i,
|
| 47 |
+
n = x.length - 1,
|
| 48 |
+
m,
|
| 49 |
+
a = new Array(n),
|
| 50 |
+
b = new Array(n),
|
| 51 |
+
r = new Array(n);
|
| 52 |
+
a[0] = 0, b[0] = 2, r[0] = x[0] + 2 * x[1];
|
| 53 |
+
for (i = 1; i < n - 1; ++i) a[i] = 1, b[i] = 4, r[i] = 4 * x[i] + 2 * x[i + 1];
|
| 54 |
+
a[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x[n - 1] + x[n];
|
| 55 |
+
for (i = 1; i < n; ++i) m = a[i] / b[i - 1], b[i] -= m, r[i] -= m * r[i - 1];
|
| 56 |
+
a[n - 1] = r[n - 1] / b[n - 1];
|
| 57 |
+
for (i = n - 2; i >= 0; --i) a[i] = (r[i] - a[i + 1]) / b[i];
|
| 58 |
+
b[n - 1] = (x[n] + a[n - 1]) / 2;
|
| 59 |
+
for (i = 0; i < n - 1; ++i) b[i] = 2 * x[i + 1] - a[i + 1];
|
| 60 |
+
return [a, b];
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
export default function(context) {
|
| 64 |
+
return new Natural(context);
|
| 65 |
+
}
|
tools/ui/node_modules/d3-shape/src/curve/radial.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import curveLinear from "./linear.js";
|
| 2 |
+
|
| 3 |
+
export var curveRadialLinear = curveRadial(curveLinear);
|
| 4 |
+
|
| 5 |
+
function Radial(curve) {
|
| 6 |
+
this._curve = curve;
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
Radial.prototype = {
|
| 10 |
+
areaStart: function() {
|
| 11 |
+
this._curve.areaStart();
|
| 12 |
+
},
|
| 13 |
+
areaEnd: function() {
|
| 14 |
+
this._curve.areaEnd();
|
| 15 |
+
},
|
| 16 |
+
lineStart: function() {
|
| 17 |
+
this._curve.lineStart();
|
| 18 |
+
},
|
| 19 |
+
lineEnd: function() {
|
| 20 |
+
this._curve.lineEnd();
|
| 21 |
+
},
|
| 22 |
+
point: function(a, r) {
|
| 23 |
+
this._curve.point(r * Math.sin(a), r * -Math.cos(a));
|
| 24 |
+
}
|
| 25 |
+
};
|
| 26 |
+
|
| 27 |
+
export default function curveRadial(curve) {
|
| 28 |
+
|
| 29 |
+
function radial(context) {
|
| 30 |
+
return new Radial(curve(context));
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
radial._curve = curve;
|
| 34 |
+
|
| 35 |
+
return radial;
|
| 36 |
+
}
|
tools/ui/node_modules/d3-shape/src/curve/step.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
function Step(context, t) {
|
| 2 |
+
this._context = context;
|
| 3 |
+
this._t = t;
|
| 4 |
+
}
|
| 5 |
+
|
| 6 |
+
Step.prototype = {
|
| 7 |
+
areaStart: function() {
|
| 8 |
+
this._line = 0;
|
| 9 |
+
},
|
| 10 |
+
areaEnd: function() {
|
| 11 |
+
this._line = NaN;
|
| 12 |
+
},
|
| 13 |
+
lineStart: function() {
|
| 14 |
+
this._x = this._y = NaN;
|
| 15 |
+
this._point = 0;
|
| 16 |
+
},
|
| 17 |
+
lineEnd: function() {
|
| 18 |
+
if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y);
|
| 19 |
+
if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
|
| 20 |
+
if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line;
|
| 21 |
+
},
|
| 22 |
+
point: function(x, y) {
|
| 23 |
+
x = +x, y = +y;
|
| 24 |
+
switch (this._point) {
|
| 25 |
+
case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
|
| 26 |
+
case 1: this._point = 2; // falls through
|
| 27 |
+
default: {
|
| 28 |
+
if (this._t <= 0) {
|
| 29 |
+
this._context.lineTo(this._x, y);
|
| 30 |
+
this._context.lineTo(x, y);
|
| 31 |
+
} else {
|
| 32 |
+
var x1 = this._x * (1 - this._t) + x * this._t;
|
| 33 |
+
this._context.lineTo(x1, this._y);
|
| 34 |
+
this._context.lineTo(x1, y);
|
| 35 |
+
}
|
| 36 |
+
break;
|
| 37 |
+
}
|
| 38 |
+
}
|
| 39 |
+
this._x = x, this._y = y;
|
| 40 |
+
}
|
| 41 |
+
};
|
| 42 |
+
|
| 43 |
+
export default function(context) {
|
| 44 |
+
return new Step(context, 0.5);
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
export function stepBefore(context) {
|
| 48 |
+
return new Step(context, 0);
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
export function stepAfter(context) {
|
| 52 |
+
return new Step(context, 1);
|
| 53 |
+
}
|
tools/ui/node_modules/d3-shape/src/descending.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export default function(a, b) {
|
| 2 |
+
return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
|
| 3 |
+
}
|
tools/ui/node_modules/d3-shape/src/identity.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export default function(d) {
|
| 2 |
+
return d;
|
| 3 |
+
}
|
tools/ui/node_modules/d3-shape/src/index.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export {default as arc} from "./arc.js";
|
| 2 |
+
export {default as area} from "./area.js";
|
| 3 |
+
export {default as line} from "./line.js";
|
| 4 |
+
export {default as pie} from "./pie.js";
|
| 5 |
+
export {default as areaRadial, default as radialArea} from "./areaRadial.js"; // Note: radialArea is deprecated!
|
| 6 |
+
export {default as lineRadial, default as radialLine} from "./lineRadial.js"; // Note: radialLine is deprecated!
|
| 7 |
+
export {default as pointRadial} from "./pointRadial.js";
|
| 8 |
+
export {link, linkHorizontal, linkVertical, linkRadial} from "./link.js";
|
| 9 |
+
|
| 10 |
+
export {default as symbol, symbolsStroke, symbolsFill, symbolsFill as symbols} from "./symbol.js";
|
| 11 |
+
export {default as symbolAsterisk} from "./symbol/asterisk.js";
|
| 12 |
+
export {default as symbolCircle} from "./symbol/circle.js";
|
| 13 |
+
export {default as symbolCross} from "./symbol/cross.js";
|
| 14 |
+
export {default as symbolDiamond} from "./symbol/diamond.js";
|
| 15 |
+
export {default as symbolDiamond2} from "./symbol/diamond2.js";
|
| 16 |
+
export {default as symbolPlus} from "./symbol/plus.js";
|
| 17 |
+
export {default as symbolSquare} from "./symbol/square.js";
|
| 18 |
+
export {default as symbolSquare2} from "./symbol/square2.js";
|
| 19 |
+
export {default as symbolStar} from "./symbol/star.js";
|
| 20 |
+
export {default as symbolTriangle} from "./symbol/triangle.js";
|
| 21 |
+
export {default as symbolTriangle2} from "./symbol/triangle2.js";
|
| 22 |
+
export {default as symbolWye} from "./symbol/wye.js";
|
| 23 |
+
export {default as symbolTimes, default as symbolX} from "./symbol/times.js";
|
| 24 |
+
|
| 25 |
+
export {default as curveBasisClosed} from "./curve/basisClosed.js";
|
| 26 |
+
export {default as curveBasisOpen} from "./curve/basisOpen.js";
|
| 27 |
+
export {default as curveBasis} from "./curve/basis.js";
|
| 28 |
+
export {bumpX as curveBumpX, bumpY as curveBumpY} from "./curve/bump.js";
|
| 29 |
+
export {default as curveBundle} from "./curve/bundle.js";
|
| 30 |
+
export {default as curveCardinalClosed} from "./curve/cardinalClosed.js";
|
| 31 |
+
export {default as curveCardinalOpen} from "./curve/cardinalOpen.js";
|
| 32 |
+
export {default as curveCardinal} from "./curve/cardinal.js";
|
| 33 |
+
export {default as curveCatmullRomClosed} from "./curve/catmullRomClosed.js";
|
| 34 |
+
export {default as curveCatmullRomOpen} from "./curve/catmullRomOpen.js";
|
| 35 |
+
export {default as curveCatmullRom} from "./curve/catmullRom.js";
|
| 36 |
+
export {default as curveLinearClosed} from "./curve/linearClosed.js";
|
| 37 |
+
export {default as curveLinear} from "./curve/linear.js";
|
| 38 |
+
export {monotoneX as curveMonotoneX, monotoneY as curveMonotoneY} from "./curve/monotone.js";
|
| 39 |
+
export {default as curveNatural} from "./curve/natural.js";
|
| 40 |
+
export {default as curveStep, stepAfter as curveStepAfter, stepBefore as curveStepBefore} from "./curve/step.js";
|
| 41 |
+
|
| 42 |
+
export {default as stack} from "./stack.js";
|
| 43 |
+
export {default as stackOffsetExpand} from "./offset/expand.js";
|
| 44 |
+
export {default as stackOffsetDiverging} from "./offset/diverging.js";
|
| 45 |
+
export {default as stackOffsetNone} from "./offset/none.js";
|
| 46 |
+
export {default as stackOffsetSilhouette} from "./offset/silhouette.js";
|
| 47 |
+
export {default as stackOffsetWiggle} from "./offset/wiggle.js";
|
| 48 |
+
export {default as stackOrderAppearance} from "./order/appearance.js";
|
| 49 |
+
export {default as stackOrderAscending} from "./order/ascending.js";
|
| 50 |
+
export {default as stackOrderDescending} from "./order/descending.js";
|
| 51 |
+
export {default as stackOrderInsideOut} from "./order/insideOut.js";
|
| 52 |
+
export {default as stackOrderNone} from "./order/none.js";
|
| 53 |
+
export {default as stackOrderReverse} from "./order/reverse.js";
|
tools/ui/node_modules/d3-shape/src/line.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import array from "./array.js";
|
| 2 |
+
import constant from "./constant.js";
|
| 3 |
+
import curveLinear from "./curve/linear.js";
|
| 4 |
+
import {withPath} from "./path.js";
|
| 5 |
+
import {x as pointX, y as pointY} from "./point.js";
|
| 6 |
+
|
| 7 |
+
export default function(x, y) {
|
| 8 |
+
var defined = constant(true),
|
| 9 |
+
context = null,
|
| 10 |
+
curve = curveLinear,
|
| 11 |
+
output = null,
|
| 12 |
+
path = withPath(line);
|
| 13 |
+
|
| 14 |
+
x = typeof x === "function" ? x : (x === undefined) ? pointX : constant(x);
|
| 15 |
+
y = typeof y === "function" ? y : (y === undefined) ? pointY : constant(y);
|
| 16 |
+
|
| 17 |
+
function line(data) {
|
| 18 |
+
var i,
|
| 19 |
+
n = (data = array(data)).length,
|
| 20 |
+
d,
|
| 21 |
+
defined0 = false,
|
| 22 |
+
buffer;
|
| 23 |
+
|
| 24 |
+
if (context == null) output = curve(buffer = path());
|
| 25 |
+
|
| 26 |
+
for (i = 0; i <= n; ++i) {
|
| 27 |
+
if (!(i < n && defined(d = data[i], i, data)) === defined0) {
|
| 28 |
+
if (defined0 = !defined0) output.lineStart();
|
| 29 |
+
else output.lineEnd();
|
| 30 |
+
}
|
| 31 |
+
if (defined0) output.point(+x(d, i, data), +y(d, i, data));
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
if (buffer) return output = null, buffer + "" || null;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
line.x = function(_) {
|
| 38 |
+
return arguments.length ? (x = typeof _ === "function" ? _ : constant(+_), line) : x;
|
| 39 |
+
};
|
| 40 |
+
|
| 41 |
+
line.y = function(_) {
|
| 42 |
+
return arguments.length ? (y = typeof _ === "function" ? _ : constant(+_), line) : y;
|
| 43 |
+
};
|
| 44 |
+
|
| 45 |
+
line.defined = function(_) {
|
| 46 |
+
return arguments.length ? (defined = typeof _ === "function" ? _ : constant(!!_), line) : defined;
|
| 47 |
+
};
|
| 48 |
+
|
| 49 |
+
line.curve = function(_) {
|
| 50 |
+
return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve;
|
| 51 |
+
};
|
| 52 |
+
|
| 53 |
+
line.context = function(_) {
|
| 54 |
+
return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context;
|
| 55 |
+
};
|
| 56 |
+
|
| 57 |
+
return line;
|
| 58 |
+
}
|
tools/ui/node_modules/d3-shape/src/lineRadial.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import curveRadial, {curveRadialLinear} from "./curve/radial.js";
|
| 2 |
+
import line from "./line.js";
|
| 3 |
+
|
| 4 |
+
export function lineRadial(l) {
|
| 5 |
+
var c = l.curve;
|
| 6 |
+
|
| 7 |
+
l.angle = l.x, delete l.x;
|
| 8 |
+
l.radius = l.y, delete l.y;
|
| 9 |
+
|
| 10 |
+
l.curve = function(_) {
|
| 11 |
+
return arguments.length ? c(curveRadial(_)) : c()._curve;
|
| 12 |
+
};
|
| 13 |
+
|
| 14 |
+
return l;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
export default function() {
|
| 18 |
+
return lineRadial(line().curve(curveRadialLinear));
|
| 19 |
+
}
|
tools/ui/node_modules/d3-shape/src/link.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import {slice} from "./array.js";
|
| 2 |
+
import constant from "./constant.js";
|
| 3 |
+
import {bumpX, bumpY, bumpRadial} from "./curve/bump.js";
|
| 4 |
+
import {withPath} from "./path.js";
|
| 5 |
+
import {x as pointX, y as pointY} from "./point.js";
|
| 6 |
+
|
| 7 |
+
function linkSource(d) {
|
| 8 |
+
return d.source;
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
function linkTarget(d) {
|
| 12 |
+
return d.target;
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
export function link(curve) {
|
| 16 |
+
let source = linkSource,
|
| 17 |
+
target = linkTarget,
|
| 18 |
+
x = pointX,
|
| 19 |
+
y = pointY,
|
| 20 |
+
context = null,
|
| 21 |
+
output = null,
|
| 22 |
+
path = withPath(link);
|
| 23 |
+
|
| 24 |
+
function link() {
|
| 25 |
+
let buffer;
|
| 26 |
+
const argv = slice.call(arguments);
|
| 27 |
+
const s = source.apply(this, argv);
|
| 28 |
+
const t = target.apply(this, argv);
|
| 29 |
+
if (context == null) output = curve(buffer = path());
|
| 30 |
+
output.lineStart();
|
| 31 |
+
argv[0] = s, output.point(+x.apply(this, argv), +y.apply(this, argv));
|
| 32 |
+
argv[0] = t, output.point(+x.apply(this, argv), +y.apply(this, argv));
|
| 33 |
+
output.lineEnd();
|
| 34 |
+
if (buffer) return output = null, buffer + "" || null;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
link.source = function(_) {
|
| 38 |
+
return arguments.length ? (source = _, link) : source;
|
| 39 |
+
};
|
| 40 |
+
|
| 41 |
+
link.target = function(_) {
|
| 42 |
+
return arguments.length ? (target = _, link) : target;
|
| 43 |
+
};
|
| 44 |
+
|
| 45 |
+
link.x = function(_) {
|
| 46 |
+
return arguments.length ? (x = typeof _ === "function" ? _ : constant(+_), link) : x;
|
| 47 |
+
};
|
| 48 |
+
|
| 49 |
+
link.y = function(_) {
|
| 50 |
+
return arguments.length ? (y = typeof _ === "function" ? _ : constant(+_), link) : y;
|
| 51 |
+
};
|
| 52 |
+
|
| 53 |
+
link.context = function(_) {
|
| 54 |
+
return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), link) : context;
|
| 55 |
+
};
|
| 56 |
+
|
| 57 |
+
return link;
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
export function linkHorizontal() {
|
| 61 |
+
return link(bumpX);
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
export function linkVertical() {
|
| 65 |
+
return link(bumpY);
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
export function linkRadial() {
|
| 69 |
+
const l = link(bumpRadial);
|
| 70 |
+
l.angle = l.x, delete l.x;
|
| 71 |
+
l.radius = l.y, delete l.y;
|
| 72 |
+
return l;
|
| 73 |
+
}
|
tools/ui/node_modules/d3-shape/src/math.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export const abs = Math.abs;
|
| 2 |
+
export const atan2 = Math.atan2;
|
| 3 |
+
export const cos = Math.cos;
|
| 4 |
+
export const max = Math.max;
|
| 5 |
+
export const min = Math.min;
|
| 6 |
+
export const sin = Math.sin;
|
| 7 |
+
export const sqrt = Math.sqrt;
|
| 8 |
+
|
| 9 |
+
export const epsilon = 1e-12;
|
| 10 |
+
export const pi = Math.PI;
|
| 11 |
+
export const halfPi = pi / 2;
|
| 12 |
+
export const tau = 2 * pi;
|
| 13 |
+
|
| 14 |
+
export function acos(x) {
|
| 15 |
+
return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
export function asin(x) {
|
| 19 |
+
return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);
|
| 20 |
+
}
|
tools/ui/node_modules/d3-shape/src/noop.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
export default function() {}
|
tools/ui/node_modules/d3-shape/src/offset/diverging.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export default function(series, order) {
|
| 2 |
+
if (!((n = series.length) > 0)) return;
|
| 3 |
+
for (var i, j = 0, d, dy, yp, yn, n, m = series[order[0]].length; j < m; ++j) {
|
| 4 |
+
for (yp = yn = 0, i = 0; i < n; ++i) {
|
| 5 |
+
if ((dy = (d = series[order[i]][j])[1] - d[0]) > 0) {
|
| 6 |
+
d[0] = yp, d[1] = yp += dy;
|
| 7 |
+
} else if (dy < 0) {
|
| 8 |
+
d[1] = yn, d[0] = yn += dy;
|
| 9 |
+
} else {
|
| 10 |
+
d[0] = 0, d[1] = dy;
|
| 11 |
+
}
|
| 12 |
+
}
|
| 13 |
+
}
|
| 14 |
+
}
|
tools/ui/node_modules/d3-shape/src/offset/expand.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import none from "./none.js";
|
| 2 |
+
|
| 3 |
+
export default function(series, order) {
|
| 4 |
+
if (!((n = series.length) > 0)) return;
|
| 5 |
+
for (var i, n, j = 0, m = series[0].length, y; j < m; ++j) {
|
| 6 |
+
for (y = i = 0; i < n; ++i) y += series[i][j][1] || 0;
|
| 7 |
+
if (y) for (i = 0; i < n; ++i) series[i][j][1] /= y;
|
| 8 |
+
}
|
| 9 |
+
none(series, order);
|
| 10 |
+
}
|
tools/ui/node_modules/d3-shape/src/offset/none.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export default function(series, order) {
|
| 2 |
+
if (!((n = series.length) > 1)) return;
|
| 3 |
+
for (var i = 1, j, s0, s1 = series[order[0]], n, m = s1.length; i < n; ++i) {
|
| 4 |
+
s0 = s1, s1 = series[order[i]];
|
| 5 |
+
for (j = 0; j < m; ++j) {
|
| 6 |
+
s1[j][1] += s1[j][0] = isNaN(s0[j][1]) ? s0[j][0] : s0[j][1];
|
| 7 |
+
}
|
| 8 |
+
}
|
| 9 |
+
}
|
tools/ui/node_modules/d3-shape/src/offset/silhouette.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import none from "./none.js";
|
| 2 |
+
|
| 3 |
+
export default function(series, order) {
|
| 4 |
+
if (!((n = series.length) > 0)) return;
|
| 5 |
+
for (var j = 0, s0 = series[order[0]], n, m = s0.length; j < m; ++j) {
|
| 6 |
+
for (var i = 0, y = 0; i < n; ++i) y += series[i][j][1] || 0;
|
| 7 |
+
s0[j][1] += s0[j][0] = -y / 2;
|
| 8 |
+
}
|
| 9 |
+
none(series, order);
|
| 10 |
+
}
|
tools/ui/node_modules/d3-shape/src/offset/wiggle.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import none from "./none.js";
|
| 2 |
+
|
| 3 |
+
export default function(series, order) {
|
| 4 |
+
if (!((n = series.length) > 0) || !((m = (s0 = series[order[0]]).length) > 0)) return;
|
| 5 |
+
for (var y = 0, j = 1, s0, m, n; j < m; ++j) {
|
| 6 |
+
for (var i = 0, s1 = 0, s2 = 0; i < n; ++i) {
|
| 7 |
+
var si = series[order[i]],
|
| 8 |
+
sij0 = si[j][1] || 0,
|
| 9 |
+
sij1 = si[j - 1][1] || 0,
|
| 10 |
+
s3 = (sij0 - sij1) / 2;
|
| 11 |
+
for (var k = 0; k < i; ++k) {
|
| 12 |
+
var sk = series[order[k]],
|
| 13 |
+
skj0 = sk[j][1] || 0,
|
| 14 |
+
skj1 = sk[j - 1][1] || 0;
|
| 15 |
+
s3 += skj0 - skj1;
|
| 16 |
+
}
|
| 17 |
+
s1 += sij0, s2 += s3 * sij0;
|
| 18 |
+
}
|
| 19 |
+
s0[j - 1][1] += s0[j - 1][0] = y;
|
| 20 |
+
if (s1) y -= s2 / s1;
|
| 21 |
+
}
|
| 22 |
+
s0[j - 1][1] += s0[j - 1][0] = y;
|
| 23 |
+
none(series, order);
|
| 24 |
+
}
|
tools/ui/node_modules/d3-shape/src/order/appearance.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import none from "./none.js";
|
| 2 |
+
|
| 3 |
+
export default function(series) {
|
| 4 |
+
var peaks = series.map(peak);
|
| 5 |
+
return none(series).sort(function(a, b) { return peaks[a] - peaks[b]; });
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
function peak(series) {
|
| 9 |
+
var i = -1, j = 0, n = series.length, vi, vj = -Infinity;
|
| 10 |
+
while (++i < n) if ((vi = +series[i][1]) > vj) vj = vi, j = i;
|
| 11 |
+
return j;
|
| 12 |
+
}
|
tools/ui/node_modules/d3-shape/src/order/ascending.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import none from "./none.js";
|
| 2 |
+
|
| 3 |
+
export default function(series) {
|
| 4 |
+
var sums = series.map(sum);
|
| 5 |
+
return none(series).sort(function(a, b) { return sums[a] - sums[b]; });
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
export function sum(series) {
|
| 9 |
+
var s = 0, i = -1, n = series.length, v;
|
| 10 |
+
while (++i < n) if (v = +series[i][1]) s += v;
|
| 11 |
+
return s;
|
| 12 |
+
}
|
tools/ui/node_modules/d3-shape/src/order/descending.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import ascending from "./ascending.js";
|
| 2 |
+
|
| 3 |
+
export default function(series) {
|
| 4 |
+
return ascending(series).reverse();
|
| 5 |
+
}
|
tools/ui/node_modules/d3-shape/src/order/insideOut.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import appearance from "./appearance.js";
|
| 2 |
+
import {sum} from "./ascending.js";
|
| 3 |
+
|
| 4 |
+
export default function(series) {
|
| 5 |
+
var n = series.length,
|
| 6 |
+
i,
|
| 7 |
+
j,
|
| 8 |
+
sums = series.map(sum),
|
| 9 |
+
order = appearance(series),
|
| 10 |
+
top = 0,
|
| 11 |
+
bottom = 0,
|
| 12 |
+
tops = [],
|
| 13 |
+
bottoms = [];
|
| 14 |
+
|
| 15 |
+
for (i = 0; i < n; ++i) {
|
| 16 |
+
j = order[i];
|
| 17 |
+
if (top < bottom) {
|
| 18 |
+
top += sums[j];
|
| 19 |
+
tops.push(j);
|
| 20 |
+
} else {
|
| 21 |
+
bottom += sums[j];
|
| 22 |
+
bottoms.push(j);
|
| 23 |
+
}
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
return bottoms.reverse().concat(tops);
|
| 27 |
+
}
|
tools/ui/node_modules/d3-shape/src/order/none.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export default function(series) {
|
| 2 |
+
var n = series.length, o = new Array(n);
|
| 3 |
+
while (--n >= 0) o[n] = n;
|
| 4 |
+
return o;
|
| 5 |
+
}
|
tools/ui/node_modules/d3-shape/src/order/reverse.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import none from "./none.js";
|
| 2 |
+
|
| 3 |
+
export default function(series) {
|
| 4 |
+
return none(series).reverse();
|
| 5 |
+
}
|
tools/ui/node_modules/d3-shape/src/path.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import {Path} from "d3-path";
|
| 2 |
+
|
| 3 |
+
export function withPath(shape) {
|
| 4 |
+
let digits = 3;
|
| 5 |
+
|
| 6 |
+
shape.digits = function(_) {
|
| 7 |
+
if (!arguments.length) return digits;
|
| 8 |
+
if (_ == null) {
|
| 9 |
+
digits = null;
|
| 10 |
+
} else {
|
| 11 |
+
const d = Math.floor(_);
|
| 12 |
+
if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`);
|
| 13 |
+
digits = d;
|
| 14 |
+
}
|
| 15 |
+
return shape;
|
| 16 |
+
};
|
| 17 |
+
|
| 18 |
+
return () => new Path(digits);
|
| 19 |
+
}
|
tools/ui/node_modules/d3-shape/src/pie.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import array from "./array.js";
|
| 2 |
+
import constant from "./constant.js";
|
| 3 |
+
import descending from "./descending.js";
|
| 4 |
+
import identity from "./identity.js";
|
| 5 |
+
import {tau} from "./math.js";
|
| 6 |
+
|
| 7 |
+
export default function() {
|
| 8 |
+
var value = identity,
|
| 9 |
+
sortValues = descending,
|
| 10 |
+
sort = null,
|
| 11 |
+
startAngle = constant(0),
|
| 12 |
+
endAngle = constant(tau),
|
| 13 |
+
padAngle = constant(0);
|
| 14 |
+
|
| 15 |
+
function pie(data) {
|
| 16 |
+
var i,
|
| 17 |
+
n = (data = array(data)).length,
|
| 18 |
+
j,
|
| 19 |
+
k,
|
| 20 |
+
sum = 0,
|
| 21 |
+
index = new Array(n),
|
| 22 |
+
arcs = new Array(n),
|
| 23 |
+
a0 = +startAngle.apply(this, arguments),
|
| 24 |
+
da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)),
|
| 25 |
+
a1,
|
| 26 |
+
p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)),
|
| 27 |
+
pa = p * (da < 0 ? -1 : 1),
|
| 28 |
+
v;
|
| 29 |
+
|
| 30 |
+
for (i = 0; i < n; ++i) {
|
| 31 |
+
if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) {
|
| 32 |
+
sum += v;
|
| 33 |
+
}
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
// Optionally sort the arcs by previously-computed values or by data.
|
| 37 |
+
if (sortValues != null) index.sort(function(i, j) { return sortValues(arcs[i], arcs[j]); });
|
| 38 |
+
else if (sort != null) index.sort(function(i, j) { return sort(data[i], data[j]); });
|
| 39 |
+
|
| 40 |
+
// Compute the arcs! They are stored in the original data's order.
|
| 41 |
+
for (i = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) {
|
| 42 |
+
j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = {
|
| 43 |
+
data: data[j],
|
| 44 |
+
index: i,
|
| 45 |
+
value: v,
|
| 46 |
+
startAngle: a0,
|
| 47 |
+
endAngle: a1,
|
| 48 |
+
padAngle: p
|
| 49 |
+
};
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
return arcs;
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
pie.value = function(_) {
|
| 56 |
+
return arguments.length ? (value = typeof _ === "function" ? _ : constant(+_), pie) : value;
|
| 57 |
+
};
|
| 58 |
+
|
| 59 |
+
pie.sortValues = function(_) {
|
| 60 |
+
return arguments.length ? (sortValues = _, sort = null, pie) : sortValues;
|
| 61 |
+
};
|
| 62 |
+
|
| 63 |
+
pie.sort = function(_) {
|
| 64 |
+
return arguments.length ? (sort = _, sortValues = null, pie) : sort;
|
| 65 |
+
};
|
| 66 |
+
|
| 67 |
+
pie.startAngle = function(_) {
|
| 68 |
+
return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), pie) : startAngle;
|
| 69 |
+
};
|
| 70 |
+
|
| 71 |
+
pie.endAngle = function(_) {
|
| 72 |
+
return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), pie) : endAngle;
|
| 73 |
+
};
|
| 74 |
+
|
| 75 |
+
pie.padAngle = function(_) {
|
| 76 |
+
return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), pie) : padAngle;
|
| 77 |
+
};
|
| 78 |
+
|
| 79 |
+
return pie;
|
| 80 |
+
}
|
tools/ui/node_modules/d3-shape/src/point.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export function x(p) {
|
| 2 |
+
return p[0];
|
| 3 |
+
}
|
| 4 |
+
|
| 5 |
+
export function y(p) {
|
| 6 |
+
return p[1];
|
| 7 |
+
}
|
tools/ui/node_modules/d3-shape/src/pointRadial.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export default function(x, y) {
|
| 2 |
+
return [(y = +y) * Math.cos(x -= Math.PI / 2), y * Math.sin(x)];
|
| 3 |
+
}
|
tools/ui/node_modules/d3-shape/src/stack.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import array from "./array.js";
|
| 2 |
+
import constant from "./constant.js";
|
| 3 |
+
import offsetNone from "./offset/none.js";
|
| 4 |
+
import orderNone from "./order/none.js";
|
| 5 |
+
|
| 6 |
+
function stackValue(d, key) {
|
| 7 |
+
return d[key];
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
function stackSeries(key) {
|
| 11 |
+
const series = [];
|
| 12 |
+
series.key = key;
|
| 13 |
+
return series;
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
export default function() {
|
| 17 |
+
var keys = constant([]),
|
| 18 |
+
order = orderNone,
|
| 19 |
+
offset = offsetNone,
|
| 20 |
+
value = stackValue;
|
| 21 |
+
|
| 22 |
+
function stack(data) {
|
| 23 |
+
var sz = Array.from(keys.apply(this, arguments), stackSeries),
|
| 24 |
+
i, n = sz.length, j = -1,
|
| 25 |
+
oz;
|
| 26 |
+
|
| 27 |
+
for (const d of data) {
|
| 28 |
+
for (i = 0, ++j; i < n; ++i) {
|
| 29 |
+
(sz[i][j] = [0, +value(d, sz[i].key, j, data)]).data = d;
|
| 30 |
+
}
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
for (i = 0, oz = array(order(sz)); i < n; ++i) {
|
| 34 |
+
sz[oz[i]].index = i;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
offset(sz, oz);
|
| 38 |
+
return sz;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
stack.keys = function(_) {
|
| 42 |
+
return arguments.length ? (keys = typeof _ === "function" ? _ : constant(Array.from(_)), stack) : keys;
|
| 43 |
+
};
|
| 44 |
+
|
| 45 |
+
stack.value = function(_) {
|
| 46 |
+
return arguments.length ? (value = typeof _ === "function" ? _ : constant(+_), stack) : value;
|
| 47 |
+
};
|
| 48 |
+
|
| 49 |
+
stack.order = function(_) {
|
| 50 |
+
return arguments.length ? (order = _ == null ? orderNone : typeof _ === "function" ? _ : constant(Array.from(_)), stack) : order;
|
| 51 |
+
};
|
| 52 |
+
|
| 53 |
+
stack.offset = function(_) {
|
| 54 |
+
return arguments.length ? (offset = _ == null ? offsetNone : _, stack) : offset;
|
| 55 |
+
};
|
| 56 |
+
|
| 57 |
+
return stack;
|
| 58 |
+
}
|
tools/ui/node_modules/d3-shape/src/symbol.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import constant from "./constant.js";
|
| 2 |
+
import {withPath} from "./path.js";
|
| 3 |
+
import asterisk from "./symbol/asterisk.js";
|
| 4 |
+
import circle from "./symbol/circle.js";
|
| 5 |
+
import cross from "./symbol/cross.js";
|
| 6 |
+
import diamond from "./symbol/diamond.js";
|
| 7 |
+
import diamond2 from "./symbol/diamond2.js";
|
| 8 |
+
import plus from "./symbol/plus.js";
|
| 9 |
+
import square from "./symbol/square.js";
|
| 10 |
+
import square2 from "./symbol/square2.js";
|
| 11 |
+
import star from "./symbol/star.js";
|
| 12 |
+
import triangle from "./symbol/triangle.js";
|
| 13 |
+
import triangle2 from "./symbol/triangle2.js";
|
| 14 |
+
import wye from "./symbol/wye.js";
|
| 15 |
+
import times from "./symbol/times.js";
|
| 16 |
+
|
| 17 |
+
// These symbols are designed to be filled.
|
| 18 |
+
export const symbolsFill = [
|
| 19 |
+
circle,
|
| 20 |
+
cross,
|
| 21 |
+
diamond,
|
| 22 |
+
square,
|
| 23 |
+
star,
|
| 24 |
+
triangle,
|
| 25 |
+
wye
|
| 26 |
+
];
|
| 27 |
+
|
| 28 |
+
// These symbols are designed to be stroked (with a width of 1.5px and round caps).
|
| 29 |
+
export const symbolsStroke = [
|
| 30 |
+
circle,
|
| 31 |
+
plus,
|
| 32 |
+
times,
|
| 33 |
+
triangle2,
|
| 34 |
+
asterisk,
|
| 35 |
+
square2,
|
| 36 |
+
diamond2
|
| 37 |
+
];
|
| 38 |
+
|
| 39 |
+
export default function Symbol(type, size) {
|
| 40 |
+
let context = null,
|
| 41 |
+
path = withPath(symbol);
|
| 42 |
+
|
| 43 |
+
type = typeof type === "function" ? type : constant(type || circle);
|
| 44 |
+
size = typeof size === "function" ? size : constant(size === undefined ? 64 : +size);
|
| 45 |
+
|
| 46 |
+
function symbol() {
|
| 47 |
+
let buffer;
|
| 48 |
+
if (!context) context = buffer = path();
|
| 49 |
+
type.apply(this, arguments).draw(context, +size.apply(this, arguments));
|
| 50 |
+
if (buffer) return context = null, buffer + "" || null;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
symbol.type = function(_) {
|
| 54 |
+
return arguments.length ? (type = typeof _ === "function" ? _ : constant(_), symbol) : type;
|
| 55 |
+
};
|
| 56 |
+
|
| 57 |
+
symbol.size = function(_) {
|
| 58 |
+
return arguments.length ? (size = typeof _ === "function" ? _ : constant(+_), symbol) : size;
|
| 59 |
+
};
|
| 60 |
+
|
| 61 |
+
symbol.context = function(_) {
|
| 62 |
+
return arguments.length ? (context = _ == null ? null : _, symbol) : context;
|
| 63 |
+
};
|
| 64 |
+
|
| 65 |
+
return symbol;
|
| 66 |
+
}
|
tools/ui/node_modules/d3-shape/src/symbol/asterisk.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import {min, sqrt} from "../math.js";
|
| 2 |
+
|
| 3 |
+
const sqrt3 = sqrt(3);
|
| 4 |
+
|
| 5 |
+
export default {
|
| 6 |
+
draw(context, size) {
|
| 7 |
+
const r = sqrt(size + min(size / 28, 0.75)) * 0.59436;
|
| 8 |
+
const t = r / 2;
|
| 9 |
+
const u = t * sqrt3;
|
| 10 |
+
context.moveTo(0, r);
|
| 11 |
+
context.lineTo(0, -r);
|
| 12 |
+
context.moveTo(-u, -t);
|
| 13 |
+
context.lineTo(u, t);
|
| 14 |
+
context.moveTo(-u, t);
|
| 15 |
+
context.lineTo(u, -t);
|
| 16 |
+
}
|
| 17 |
+
};
|
tools/ui/node_modules/d3-shape/src/symbol/circle.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import {pi, sqrt, tau} from "../math.js";
|
| 2 |
+
|
| 3 |
+
export default {
|
| 4 |
+
draw(context, size) {
|
| 5 |
+
const r = sqrt(size / pi);
|
| 6 |
+
context.moveTo(r, 0);
|
| 7 |
+
context.arc(0, 0, r, 0, tau);
|
| 8 |
+
}
|
| 9 |
+
};
|
tools/ui/node_modules/d3-shape/src/symbol/cross.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import {sqrt} from "../math.js";
|
| 2 |
+
|
| 3 |
+
export default {
|
| 4 |
+
draw(context, size) {
|
| 5 |
+
const r = sqrt(size / 5) / 2;
|
| 6 |
+
context.moveTo(-3 * r, -r);
|
| 7 |
+
context.lineTo(-r, -r);
|
| 8 |
+
context.lineTo(-r, -3 * r);
|
| 9 |
+
context.lineTo(r, -3 * r);
|
| 10 |
+
context.lineTo(r, -r);
|
| 11 |
+
context.lineTo(3 * r, -r);
|
| 12 |
+
context.lineTo(3 * r, r);
|
| 13 |
+
context.lineTo(r, r);
|
| 14 |
+
context.lineTo(r, 3 * r);
|
| 15 |
+
context.lineTo(-r, 3 * r);
|
| 16 |
+
context.lineTo(-r, r);
|
| 17 |
+
context.lineTo(-3 * r, r);
|
| 18 |
+
context.closePath();
|
| 19 |
+
}
|
| 20 |
+
};
|
tools/ui/node_modules/d3-shape/src/symbol/diamond.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import {sqrt} from "../math.js";
|
| 2 |
+
|
| 3 |
+
const tan30 = sqrt(1 / 3);
|
| 4 |
+
const tan30_2 = tan30 * 2;
|
| 5 |
+
|
| 6 |
+
export default {
|
| 7 |
+
draw(context, size) {
|
| 8 |
+
const y = sqrt(size / tan30_2);
|
| 9 |
+
const x = y * tan30;
|
| 10 |
+
context.moveTo(0, -y);
|
| 11 |
+
context.lineTo(x, 0);
|
| 12 |
+
context.lineTo(0, y);
|
| 13 |
+
context.lineTo(-x, 0);
|
| 14 |
+
context.closePath();
|
| 15 |
+
}
|
| 16 |
+
};
|
tools/ui/node_modules/d3-shape/src/symbol/diamond2.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import {sqrt} from "../math.js";
|
| 2 |
+
|
| 3 |
+
export default {
|
| 4 |
+
draw(context, size) {
|
| 5 |
+
const r = sqrt(size) * 0.62625;
|
| 6 |
+
context.moveTo(0, -r);
|
| 7 |
+
context.lineTo(r, 0);
|
| 8 |
+
context.lineTo(0, r);
|
| 9 |
+
context.lineTo(-r, 0);
|
| 10 |
+
context.closePath();
|
| 11 |
+
}
|
| 12 |
+
};
|
tools/ui/node_modules/d3-shape/src/symbol/plus.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import {min, sqrt} from "../math.js";
|
| 2 |
+
|
| 3 |
+
export default {
|
| 4 |
+
draw(context, size) {
|
| 5 |
+
const r = sqrt(size - min(size / 7, 2)) * 0.87559;
|
| 6 |
+
context.moveTo(-r, 0);
|
| 7 |
+
context.lineTo(r, 0);
|
| 8 |
+
context.moveTo(0, r);
|
| 9 |
+
context.lineTo(0, -r);
|
| 10 |
+
}
|
| 11 |
+
};
|
tools/ui/node_modules/d3-shape/src/symbol/square.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import {sqrt} from "../math.js";
|
| 2 |
+
|
| 3 |
+
export default {
|
| 4 |
+
draw(context, size) {
|
| 5 |
+
const w = sqrt(size);
|
| 6 |
+
const x = -w / 2;
|
| 7 |
+
context.rect(x, x, w, w);
|
| 8 |
+
}
|
| 9 |
+
};
|
tools/ui/node_modules/d3-shape/src/symbol/square2.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import {sqrt} from "../math.js";
|
| 2 |
+
|
| 3 |
+
export default {
|
| 4 |
+
draw(context, size) {
|
| 5 |
+
const r = sqrt(size) * 0.4431;
|
| 6 |
+
context.moveTo(r, r);
|
| 7 |
+
context.lineTo(r, -r);
|
| 8 |
+
context.lineTo(-r, -r);
|
| 9 |
+
context.lineTo(-r, r);
|
| 10 |
+
context.closePath();
|
| 11 |
+
}
|
| 12 |
+
};
|
tools/ui/node_modules/d3-shape/src/symbol/star.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import {sin, cos, sqrt, pi, tau} from "../math.js";
|
| 2 |
+
|
| 3 |
+
const ka = 0.89081309152928522810;
|
| 4 |
+
const kr = sin(pi / 10) / sin(7 * pi / 10);
|
| 5 |
+
const kx = sin(tau / 10) * kr;
|
| 6 |
+
const ky = -cos(tau / 10) * kr;
|
| 7 |
+
|
| 8 |
+
export default {
|
| 9 |
+
draw(context, size) {
|
| 10 |
+
const r = sqrt(size * ka);
|
| 11 |
+
const x = kx * r;
|
| 12 |
+
const y = ky * r;
|
| 13 |
+
context.moveTo(0, -r);
|
| 14 |
+
context.lineTo(x, y);
|
| 15 |
+
for (let i = 1; i < 5; ++i) {
|
| 16 |
+
const a = tau * i / 5;
|
| 17 |
+
const c = cos(a);
|
| 18 |
+
const s = sin(a);
|
| 19 |
+
context.lineTo(s * r, -c * r);
|
| 20 |
+
context.lineTo(c * x - s * y, s * x + c * y);
|
| 21 |
+
}
|
| 22 |
+
context.closePath();
|
| 23 |
+
}
|
| 24 |
+
};
|
tools/ui/node_modules/d3-shape/src/symbol/times.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import {min, sqrt} from "../math.js";
|
| 2 |
+
|
| 3 |
+
export default {
|
| 4 |
+
draw(context, size) {
|
| 5 |
+
const r = sqrt(size - min(size / 6, 1.7)) * 0.6189;
|
| 6 |
+
context.moveTo(-r, -r);
|
| 7 |
+
context.lineTo(r, r);
|
| 8 |
+
context.moveTo(-r, r);
|
| 9 |
+
context.lineTo(r, -r);
|
| 10 |
+
}
|
| 11 |
+
};
|
tools/ui/node_modules/d3-shape/src/symbol/triangle.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import {sqrt} from "../math.js";
|
| 2 |
+
|
| 3 |
+
const sqrt3 = sqrt(3);
|
| 4 |
+
|
| 5 |
+
export default {
|
| 6 |
+
draw(context, size) {
|
| 7 |
+
const y = -sqrt(size / (sqrt3 * 3));
|
| 8 |
+
context.moveTo(0, y * 2);
|
| 9 |
+
context.lineTo(-sqrt3 * y, -y);
|
| 10 |
+
context.lineTo(sqrt3 * y, -y);
|
| 11 |
+
context.closePath();
|
| 12 |
+
}
|
| 13 |
+
};
|