victory-vendor 36.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +30 -0
- package/README.md +70 -0
- package/d3-array.js +7 -0
- package/d3-ease.js +7 -0
- package/d3-interpolate.js +7 -0
- package/d3-scale.js +7 -0
- package/d3-shape.js +7 -0
- package/d3-time.js +7 -0
- package/d3-timer.js +7 -0
- package/es/d3-array.js +6 -0
- package/es/d3-color.js +6 -0
- package/es/d3-ease.js +6 -0
- package/es/d3-format.js +6 -0
- package/es/d3-interpolate.js +6 -0
- package/es/d3-path.js +6 -0
- package/es/d3-scale.js +6 -0
- package/es/d3-shape.js +6 -0
- package/es/d3-time-format.js +6 -0
- package/es/d3-time.js +6 -0
- package/es/d3-timer.js +6 -0
- package/es/internmap.js +6 -0
- package/lib/d3-array.js +6 -0
- package/lib/d3-color.js +6 -0
- package/lib/d3-ease.js +6 -0
- package/lib/d3-format.js +6 -0
- package/lib/d3-interpolate.js +6 -0
- package/lib/d3-path.js +6 -0
- package/lib/d3-scale.js +6 -0
- package/lib/d3-shape.js +6 -0
- package/lib/d3-time-format.js +6 -0
- package/lib/d3-time.js +6 -0
- package/lib/d3-timer.js +6 -0
- package/lib/internmap.js +6 -0
- package/lib-vendor/d3-array/LICENSE +13 -0
- package/lib-vendor/d3-array/src/array.js +11 -0
- package/lib-vendor/d3-array/src/ascending.js +10 -0
- package/lib-vendor/d3-array/src/bin.js +142 -0
- package/lib-vendor/d3-array/src/bisect.js +24 -0
- package/lib-vendor/d3-array/src/bisector.js +73 -0
- package/lib-vendor/d3-array/src/constant.js +10 -0
- package/lib-vendor/d3-array/src/count.js +28 -0
- package/lib-vendor/d3-array/src/cross.js +42 -0
- package/lib-vendor/d3-array/src/cumsum.js +12 -0
- package/lib-vendor/d3-array/src/descending.js +10 -0
- package/lib-vendor/d3-array/src/deviation.js +15 -0
- package/lib-vendor/d3-array/src/difference.js +20 -0
- package/lib-vendor/d3-array/src/disjoint.js +29 -0
- package/lib-vendor/d3-array/src/every.js +19 -0
- package/lib-vendor/d3-array/src/extent.js +39 -0
- package/lib-vendor/d3-array/src/filter.js +20 -0
- package/lib-vendor/d3-array/src/fsum.js +93 -0
- package/lib-vendor/d3-array/src/greatest.js +38 -0
- package/lib-vendor/d3-array/src/greatestIndex.js +30 -0
- package/lib-vendor/d3-array/src/group.js +85 -0
- package/lib-vendor/d3-array/src/groupSort.js +22 -0
- package/lib-vendor/d3-array/src/identity.js +10 -0
- package/lib-vendor/d3-array/src/index.js +567 -0
- package/lib-vendor/d3-array/src/intersection.js +28 -0
- package/lib-vendor/d3-array/src/least.js +38 -0
- package/lib-vendor/d3-array/src/leastIndex.js +30 -0
- package/lib-vendor/d3-array/src/map.js +12 -0
- package/lib-vendor/d3-array/src/max.js +28 -0
- package/lib-vendor/d3-array/src/maxIndex.js +30 -0
- package/lib-vendor/d3-array/src/mean.js +29 -0
- package/lib-vendor/d3-array/src/median.js +14 -0
- package/lib-vendor/d3-array/src/merge.js +16 -0
- package/lib-vendor/d3-array/src/min.js +28 -0
- package/lib-vendor/d3-array/src/minIndex.js +30 -0
- package/lib-vendor/d3-array/src/mode.js +40 -0
- package/lib-vendor/d3-array/src/nice.js +28 -0
- package/lib-vendor/d3-array/src/number.js +29 -0
- package/lib-vendor/d3-array/src/pairs.js +25 -0
- package/lib-vendor/d3-array/src/permute.js +10 -0
- package/lib-vendor/d3-array/src/quantile.js +46 -0
- package/lib-vendor/d3-array/src/quickselect.js +53 -0
- package/lib-vendor/d3-array/src/range.js +19 -0
- package/lib-vendor/d3-array/src/rank.js +34 -0
- package/lib-vendor/d3-array/src/reduce.js +32 -0
- package/lib-vendor/d3-array/src/reverse.js +11 -0
- package/lib-vendor/d3-array/src/scan.js +15 -0
- package/lib-vendor/d3-array/src/shuffle.js +26 -0
- package/lib-vendor/d3-array/src/some.js +19 -0
- package/lib-vendor/d3-array/src/sort.js +55 -0
- package/lib-vendor/d3-array/src/subset.js +14 -0
- package/lib-vendor/d3-array/src/sum.js +28 -0
- package/lib-vendor/d3-array/src/superset.js +33 -0
- package/lib-vendor/d3-array/src/threshold/freedmanDiaconis.js +16 -0
- package/lib-vendor/d3-array/src/threshold/scott.js +16 -0
- package/lib-vendor/d3-array/src/threshold/sturges.js +14 -0
- package/lib-vendor/d3-array/src/ticks.js +60 -0
- package/lib-vendor/d3-array/src/transpose.js +26 -0
- package/lib-vendor/d3-array/src/union.js +20 -0
- package/lib-vendor/d3-array/src/variance.js +35 -0
- package/lib-vendor/d3-array/src/zip.js +14 -0
- package/lib-vendor/d3-color/LICENSE +13 -0
- package/lib-vendor/d3-color/src/color.js +413 -0
- package/lib-vendor/d3-color/src/cubehelix.js +74 -0
- package/lib-vendor/d3-color/src/define.js +20 -0
- package/lib-vendor/d3-color/src/index.js +65 -0
- package/lib-vendor/d3-color/src/lab.js +146 -0
- package/lib-vendor/d3-color/src/math.js +10 -0
- package/lib-vendor/d3-ease/LICENSE +28 -0
- package/lib-vendor/d3-ease/src/back.js +46 -0
- package/lib-vendor/d3-ease/src/bounce.js +30 -0
- package/lib-vendor/d3-ease/src/circle.js +20 -0
- package/lib-vendor/d3-ease/src/cubic.js +20 -0
- package/lib-vendor/d3-ease/src/elastic.js +72 -0
- package/lib-vendor/d3-ease/src/exp.js +22 -0
- package/lib-vendor/d3-ease/src/index.js +247 -0
- package/lib-vendor/d3-ease/src/linear.js +10 -0
- package/lib-vendor/d3-ease/src/math.js +11 -0
- package/lib-vendor/d3-ease/src/poly.js +46 -0
- package/lib-vendor/d3-ease/src/quad.js +20 -0
- package/lib-vendor/d3-ease/src/sin.js +22 -0
- package/lib-vendor/d3-format/LICENSE +13 -0
- package/lib-vendor/d3-format/src/defaultLocale.js +29 -0
- package/lib-vendor/d3-format/src/exponent.js +12 -0
- package/lib-vendor/d3-format/src/formatDecimal.js +24 -0
- package/lib-vendor/d3-format/src/formatGroup.js +25 -0
- package/lib-vendor/d3-format/src/formatNumerals.js +14 -0
- package/lib-vendor/d3-format/src/formatPrefixAuto.js +22 -0
- package/lib-vendor/d3-format/src/formatRounded.js +16 -0
- package/lib-vendor/d3-format/src/formatSpecifier.js +45 -0
- package/lib-vendor/d3-format/src/formatTrim.js +29 -0
- package/lib-vendor/d3-format/src/formatTypes.js +31 -0
- package/lib-vendor/d3-format/src/identity.js +10 -0
- package/lib-vendor/d3-format/src/index.js +77 -0
- package/lib-vendor/d3-format/src/locale.js +159 -0
- package/lib-vendor/d3-format/src/precisionFixed.js +14 -0
- package/lib-vendor/d3-format/src/precisionPrefix.js +14 -0
- package/lib-vendor/d3-format/src/precisionRound.js +15 -0
- package/lib-vendor/d3-interpolate/LICENSE +13 -0
- package/lib-vendor/d3-interpolate/src/array.js +39 -0
- package/lib-vendor/d3-interpolate/src/basis.js +25 -0
- package/lib-vendor/d3-interpolate/src/basisClosed.js +20 -0
- package/lib-vendor/d3-interpolate/src/color.js +40 -0
- package/lib-vendor/d3-interpolate/src/constant.js +10 -0
- package/lib-vendor/d3-interpolate/src/cubehelix.js +43 -0
- package/lib-vendor/d3-interpolate/src/date.js +13 -0
- package/lib-vendor/d3-interpolate/src/discrete.js +13 -0
- package/lib-vendor/d3-interpolate/src/hcl.js +36 -0
- package/lib-vendor/d3-interpolate/src/hsl.js +36 -0
- package/lib-vendor/d3-interpolate/src/hue.js +16 -0
- package/lib-vendor/d3-interpolate/src/index.js +215 -0
- package/lib-vendor/d3-interpolate/src/lab.js +26 -0
- package/lib-vendor/d3-interpolate/src/number.js +12 -0
- package/lib-vendor/d3-interpolate/src/numberArray.js +23 -0
- package/lib-vendor/d3-interpolate/src/object.js +32 -0
- package/lib-vendor/d3-interpolate/src/piecewise.js +25 -0
- package/lib-vendor/d3-interpolate/src/quantize.js +14 -0
- package/lib-vendor/d3-interpolate/src/rgb.js +77 -0
- package/lib-vendor/d3-interpolate/src/round.js +12 -0
- package/lib-vendor/d3-interpolate/src/string.js +83 -0
- package/lib-vendor/d3-interpolate/src/transform/decompose.js +33 -0
- package/lib-vendor/d3-interpolate/src/transform/index.js +100 -0
- package/lib-vendor/d3-interpolate/src/transform/parse.js +30 -0
- package/lib-vendor/d3-interpolate/src/value.js +36 -0
- package/lib-vendor/d3-interpolate/src/zoom.js +75 -0
- package/lib-vendor/d3-path/LICENSE +13 -0
- package/lib-vendor/d3-path/src/index.js +15 -0
- package/lib-vendor/d3-path/src/path.js +120 -0
- package/lib-vendor/d3-scale/LICENSE +13 -0
- package/lib-vendor/d3-scale/src/band.js +109 -0
- package/lib-vendor/d3-scale/src/colors.js +12 -0
- package/lib-vendor/d3-scale/src/constant.js +12 -0
- package/lib-vendor/d3-scale/src/continuous.js +140 -0
- package/lib-vendor/d3-scale/src/diverging.js +121 -0
- package/lib-vendor/d3-scale/src/identity.js +37 -0
- package/lib-vendor/d3-scale/src/index.js +213 -0
- package/lib-vendor/d3-scale/src/init.js +46 -0
- package/lib-vendor/d3-scale/src/linear.js +88 -0
- package/lib-vendor/d3-scale/src/log.js +156 -0
- package/lib-vendor/d3-scale/src/nice.js +24 -0
- package/lib-vendor/d3-scale/src/number.js +10 -0
- package/lib-vendor/d3-scale/src/ordinal.js +60 -0
- package/lib-vendor/d3-scale/src/pow.js +59 -0
- package/lib-vendor/d3-scale/src/quantile.js +64 -0
- package/lib-vendor/d3-scale/src/quantize.js +61 -0
- package/lib-vendor/d3-scale/src/radial.js +72 -0
- package/lib-vendor/d3-scale/src/sequential.js +120 -0
- package/lib-vendor/d3-scale/src/sequentialQuantile.js +51 -0
- package/lib-vendor/d3-scale/src/symlog.js +46 -0
- package/lib-vendor/d3-scale/src/threshold.js +44 -0
- package/lib-vendor/d3-scale/src/tickFormat.js +44 -0
- package/lib-vendor/d3-scale/src/time.js +82 -0
- package/lib-vendor/d3-scale/src/utcTime.js +18 -0
- package/lib-vendor/d3-shape/LICENSE +13 -0
- package/lib-vendor/d3-shape/src/arc.js +243 -0
- package/lib-vendor/d3-shape/src/area.js +125 -0
- package/lib-vendor/d3-shape/src/areaRadial.js +51 -0
- package/lib-vendor/d3-shape/src/array.js +14 -0
- package/lib-vendor/d3-shape/src/constant.js +12 -0
- package/lib-vendor/d3-shape/src/curve/basis.js +76 -0
- package/lib-vendor/d3-shape/src/curve/basisClosed.js +90 -0
- package/lib-vendor/d3-shape/src/curve/basisOpen.js +64 -0
- package/lib-vendor/d3-shape/src/curve/bump.js +104 -0
- package/lib-vendor/d3-shape/src/curve/bundle.js +65 -0
- package/lib-vendor/d3-shape/src/curve/cardinal.js +85 -0
- package/lib-vendor/d3-shape/src/curve/cardinalClosed.js +99 -0
- package/lib-vendor/d3-shape/src/curve/cardinalOpen.js +74 -0
- package/lib-vendor/d3-shape/src/curve/catmullRom.js +114 -0
- package/lib-vendor/d3-shape/src/curve/catmullRomClosed.js +108 -0
- package/lib-vendor/d3-shape/src/curve/catmullRomOpen.js +83 -0
- package/lib-vendor/d3-shape/src/curve/linear.js +49 -0
- package/lib-vendor/d3-shape/src/curve/linearClosed.js +33 -0
- package/lib-vendor/d3-shape/src/curve/monotone.js +139 -0
- package/lib-vendor/d3-shape/src/curve/natural.js +82 -0
- package/lib-vendor/d3-shape/src/curve/radial.js +45 -0
- package/lib-vendor/d3-shape/src/curve/step.js +76 -0
- package/lib-vendor/d3-shape/src/descending.js +10 -0
- package/lib-vendor/d3-shape/src/identity.js +10 -0
- package/lib-vendor/d3-shape/src/index.js +483 -0
- package/lib-vendor/d3-shape/src/line.js +68 -0
- package/lib-vendor/d3-shape/src/lineRadial.js +33 -0
- package/lib-vendor/d3-shape/src/link.js +90 -0
- package/lib-vendor/d3-shape/src/math.js +39 -0
- package/lib-vendor/d3-shape/src/noop.js +8 -0
- package/lib-vendor/d3-shape/src/offset/diverging.js +22 -0
- package/lib-vendor/d3-shape/src/offset/expand.js +22 -0
- package/lib-vendor/d3-shape/src/offset/none.js +18 -0
- package/lib-vendor/d3-shape/src/offset/silhouette.js +22 -0
- package/lib-vendor/d3-shape/src/offset/wiggle.js +38 -0
- package/lib-vendor/d3-shape/src/order/appearance.js +29 -0
- package/lib-vendor/d3-shape/src/order/ascending.js +29 -0
- package/lib-vendor/d3-shape/src/order/descending.js +14 -0
- package/lib-vendor/d3-shape/src/order/insideOut.js +38 -0
- package/lib-vendor/d3-shape/src/order/none.js +15 -0
- package/lib-vendor/d3-shape/src/order/reverse.js +14 -0
- package/lib-vendor/d3-shape/src/pie.js +95 -0
- package/lib-vendor/d3-shape/src/point.js +15 -0
- package/lib-vendor/d3-shape/src/pointRadial.js +10 -0
- package/lib-vendor/d3-shape/src/stack.js +72 -0
- package/lib-vendor/d3-shape/src/symbol/asterisk.js +25 -0
- package/lib-vendor/d3-shape/src/symbol/circle.js +18 -0
- package/lib-vendor/d3-shape/src/symbol/cross.js +29 -0
- package/lib-vendor/d3-shape/src/symbol/diamond.js +24 -0
- package/lib-vendor/d3-shape/src/symbol/diamond2.js +21 -0
- package/lib-vendor/d3-shape/src/symbol/plus.js +20 -0
- package/lib-vendor/d3-shape/src/symbol/square.js +18 -0
- package/lib-vendor/d3-shape/src/symbol/square2.js +21 -0
- package/lib-vendor/d3-shape/src/symbol/star.js +34 -0
- package/lib-vendor/d3-shape/src/symbol/triangle.js +21 -0
- package/lib-vendor/d3-shape/src/symbol/triangle2.js +24 -0
- package/lib-vendor/d3-shape/src/symbol/wye.js +36 -0
- package/lib-vendor/d3-shape/src/symbol/x.js +20 -0
- package/lib-vendor/d3-shape/src/symbol.js +73 -0
- package/lib-vendor/d3-time/LICENSE +13 -0
- package/lib-vendor/d3-time/src/day.js +18 -0
- package/lib-vendor/d3-time/src/duration.js +20 -0
- package/lib-vendor/d3-time/src/hour.js +26 -0
- package/lib-vendor/d3-time/src/index.js +433 -0
- package/lib-vendor/d3-time/src/interval.js +79 -0
- package/lib-vendor/d3-time/src/millisecond.js +35 -0
- package/lib-vendor/d3-time/src/minute.js +26 -0
- package/lib-vendor/d3-time/src/month.js +25 -0
- package/lib-vendor/d3-time/src/second.js +26 -0
- package/lib-vendor/d3-time/src/ticks.js +71 -0
- package/lib-vendor/d3-time/src/utcDay.js +26 -0
- package/lib-vendor/d3-time/src/utcHour.js +26 -0
- package/lib-vendor/d3-time/src/utcMinute.js +26 -0
- package/lib-vendor/d3-time/src/utcMonth.js +25 -0
- package/lib-vendor/d3-time/src/utcWeek.js +52 -0
- package/lib-vendor/d3-time/src/utcYear.js +36 -0
- package/lib-vendor/d3-time/src/week.js +52 -0
- package/lib-vendor/d3-time/src/year.js +36 -0
- package/lib-vendor/d3-time-format/LICENSE +13 -0
- package/lib-vendor/d3-time-format/src/defaultLocale.js +40 -0
- package/lib-vendor/d3-time-format/src/index.js +67 -0
- package/lib-vendor/d3-time-format/src/isoFormat.js +19 -0
- package/lib-vendor/d3-time-format/src/isoParse.js +19 -0
- package/lib-vendor/d3-time-format/src/locale.js +713 -0
- package/lib-vendor/d3-timer/LICENSE +13 -0
- package/lib-vendor/d3-timer/src/index.js +43 -0
- package/lib-vendor/d3-timer/src/interval.js +30 -0
- package/lib-vendor/d3-timer/src/timeout.js +18 -0
- package/lib-vendor/d3-timer/src/timer.js +138 -0
- package/lib-vendor/internmap/LICENSE +13 -0
- package/lib-vendor/internmap/src/index.js +111 -0
- package/package.json +43 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _cardinalOpen = require("./cardinalOpen.js");
|
|
9
|
+
|
|
10
|
+
var _catmullRom = require("./catmullRom.js");
|
|
11
|
+
|
|
12
|
+
function CatmullRomOpen(context, alpha) {
|
|
13
|
+
this._context = context;
|
|
14
|
+
this._alpha = alpha;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
CatmullRomOpen.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 = this._y0 = this._y1 = this._y2 = NaN;
|
|
26
|
+
this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
|
|
27
|
+
},
|
|
28
|
+
lineEnd: function () {
|
|
29
|
+
if (this._line || this._line !== 0 && this._point === 3) this._context.closePath();
|
|
30
|
+
this._line = 1 - this._line;
|
|
31
|
+
},
|
|
32
|
+
point: function (x, y) {
|
|
33
|
+
x = +x, y = +y;
|
|
34
|
+
|
|
35
|
+
if (this._point) {
|
|
36
|
+
var x23 = this._x2 - x,
|
|
37
|
+
y23 = this._y2 - y;
|
|
38
|
+
this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
switch (this._point) {
|
|
42
|
+
case 0:
|
|
43
|
+
this._point = 1;
|
|
44
|
+
break;
|
|
45
|
+
|
|
46
|
+
case 1:
|
|
47
|
+
this._point = 2;
|
|
48
|
+
break;
|
|
49
|
+
|
|
50
|
+
case 2:
|
|
51
|
+
this._point = 3;
|
|
52
|
+
this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2);
|
|
53
|
+
break;
|
|
54
|
+
|
|
55
|
+
case 3:
|
|
56
|
+
this._point = 4;
|
|
57
|
+
// falls through
|
|
58
|
+
|
|
59
|
+
default:
|
|
60
|
+
(0, _catmullRom.point)(this, x, y);
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
this._l01_a = this._l12_a, this._l12_a = this._l23_a;
|
|
65
|
+
this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;
|
|
66
|
+
this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
|
|
67
|
+
this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
var _default = function custom(alpha) {
|
|
72
|
+
function catmullRom(context) {
|
|
73
|
+
return alpha ? new CatmullRomOpen(context, alpha) : new _cardinalOpen.CardinalOpen(context, 0);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
catmullRom.alpha = function (alpha) {
|
|
77
|
+
return custom(+alpha);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
return catmullRom;
|
|
81
|
+
}(0.5);
|
|
82
|
+
|
|
83
|
+
exports.default = _default;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = _default;
|
|
7
|
+
|
|
8
|
+
function Linear(context) {
|
|
9
|
+
this._context = context;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
Linear.prototype = {
|
|
13
|
+
areaStart: function () {
|
|
14
|
+
this._line = 0;
|
|
15
|
+
},
|
|
16
|
+
areaEnd: function () {
|
|
17
|
+
this._line = NaN;
|
|
18
|
+
},
|
|
19
|
+
lineStart: function () {
|
|
20
|
+
this._point = 0;
|
|
21
|
+
},
|
|
22
|
+
lineEnd: function () {
|
|
23
|
+
if (this._line || this._line !== 0 && this._point === 1) this._context.closePath();
|
|
24
|
+
this._line = 1 - this._line;
|
|
25
|
+
},
|
|
26
|
+
point: function (x, y) {
|
|
27
|
+
x = +x, y = +y;
|
|
28
|
+
|
|
29
|
+
switch (this._point) {
|
|
30
|
+
case 0:
|
|
31
|
+
this._point = 1;
|
|
32
|
+
this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y);
|
|
33
|
+
break;
|
|
34
|
+
|
|
35
|
+
case 1:
|
|
36
|
+
this._point = 2;
|
|
37
|
+
// falls through
|
|
38
|
+
|
|
39
|
+
default:
|
|
40
|
+
this._context.lineTo(x, y);
|
|
41
|
+
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
function _default(context) {
|
|
48
|
+
return new Linear(context);
|
|
49
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = _default;
|
|
7
|
+
|
|
8
|
+
var _noop = _interopRequireDefault(require("../noop.js"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
function LinearClosed(context) {
|
|
13
|
+
this._context = context;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
LinearClosed.prototype = {
|
|
17
|
+
areaStart: _noop.default,
|
|
18
|
+
areaEnd: _noop.default,
|
|
19
|
+
lineStart: function () {
|
|
20
|
+
this._point = 0;
|
|
21
|
+
},
|
|
22
|
+
lineEnd: function () {
|
|
23
|
+
if (this._point) this._context.closePath();
|
|
24
|
+
},
|
|
25
|
+
point: function (x, y) {
|
|
26
|
+
x = +x, y = +y;
|
|
27
|
+
if (this._point) this._context.lineTo(x, y);else this._point = 1, this._context.moveTo(x, y);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
function _default(context) {
|
|
32
|
+
return new LinearClosed(context);
|
|
33
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.monotoneX = monotoneX;
|
|
7
|
+
exports.monotoneY = monotoneY;
|
|
8
|
+
|
|
9
|
+
function sign(x) {
|
|
10
|
+
return x < 0 ? -1 : 1;
|
|
11
|
+
} // Calculate the slopes of the tangents (Hermite-type interpolation) based on
|
|
12
|
+
// the following paper: Steffen, M. 1990. A Simple Method for Monotonic
|
|
13
|
+
// Interpolation in One Dimension. Astronomy and Astrophysics, Vol. 239, NO.
|
|
14
|
+
// NOV(II), P. 443, 1990.
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
function slope3(that, x2, y2) {
|
|
18
|
+
var h0 = that._x1 - that._x0,
|
|
19
|
+
h1 = x2 - that._x1,
|
|
20
|
+
s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0),
|
|
21
|
+
s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0),
|
|
22
|
+
p = (s0 * h1 + s1 * h0) / (h0 + h1);
|
|
23
|
+
return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0;
|
|
24
|
+
} // Calculate a one-sided slope.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
function slope2(that, t) {
|
|
28
|
+
var h = that._x1 - that._x0;
|
|
29
|
+
return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t;
|
|
30
|
+
} // According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations
|
|
31
|
+
// "you can express cubic Hermite interpolation in terms of cubic Bézier curves
|
|
32
|
+
// with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1".
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
function point(that, t0, t1) {
|
|
36
|
+
var x0 = that._x0,
|
|
37
|
+
y0 = that._y0,
|
|
38
|
+
x1 = that._x1,
|
|
39
|
+
y1 = that._y1,
|
|
40
|
+
dx = (x1 - x0) / 3;
|
|
41
|
+
|
|
42
|
+
that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function MonotoneX(context) {
|
|
46
|
+
this._context = context;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
MonotoneX.prototype = {
|
|
50
|
+
areaStart: function () {
|
|
51
|
+
this._line = 0;
|
|
52
|
+
},
|
|
53
|
+
areaEnd: function () {
|
|
54
|
+
this._line = NaN;
|
|
55
|
+
},
|
|
56
|
+
lineStart: function () {
|
|
57
|
+
this._x0 = this._x1 = this._y0 = this._y1 = this._t0 = NaN;
|
|
58
|
+
this._point = 0;
|
|
59
|
+
},
|
|
60
|
+
lineEnd: function () {
|
|
61
|
+
switch (this._point) {
|
|
62
|
+
case 2:
|
|
63
|
+
this._context.lineTo(this._x1, this._y1);
|
|
64
|
+
|
|
65
|
+
break;
|
|
66
|
+
|
|
67
|
+
case 3:
|
|
68
|
+
point(this, this._t0, slope2(this, this._t0));
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (this._line || this._line !== 0 && this._point === 1) this._context.closePath();
|
|
73
|
+
this._line = 1 - this._line;
|
|
74
|
+
},
|
|
75
|
+
point: function (x, y) {
|
|
76
|
+
var t1 = NaN;
|
|
77
|
+
x = +x, y = +y;
|
|
78
|
+
if (x === this._x1 && y === this._y1) return; // Ignore coincident points.
|
|
79
|
+
|
|
80
|
+
switch (this._point) {
|
|
81
|
+
case 0:
|
|
82
|
+
this._point = 1;
|
|
83
|
+
this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y);
|
|
84
|
+
break;
|
|
85
|
+
|
|
86
|
+
case 1:
|
|
87
|
+
this._point = 2;
|
|
88
|
+
break;
|
|
89
|
+
|
|
90
|
+
case 2:
|
|
91
|
+
this._point = 3;
|
|
92
|
+
point(this, slope2(this, t1 = slope3(this, x, y)), t1);
|
|
93
|
+
break;
|
|
94
|
+
|
|
95
|
+
default:
|
|
96
|
+
point(this, this._t0, t1 = slope3(this, x, y));
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
this._x0 = this._x1, this._x1 = x;
|
|
101
|
+
this._y0 = this._y1, this._y1 = y;
|
|
102
|
+
this._t0 = t1;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
function MonotoneY(context) {
|
|
107
|
+
this._context = new ReflectContext(context);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
(MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function (x, y) {
|
|
111
|
+
MonotoneX.prototype.point.call(this, y, x);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
function ReflectContext(context) {
|
|
115
|
+
this._context = context;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
ReflectContext.prototype = {
|
|
119
|
+
moveTo: function (x, y) {
|
|
120
|
+
this._context.moveTo(y, x);
|
|
121
|
+
},
|
|
122
|
+
closePath: function () {
|
|
123
|
+
this._context.closePath();
|
|
124
|
+
},
|
|
125
|
+
lineTo: function (x, y) {
|
|
126
|
+
this._context.lineTo(y, x);
|
|
127
|
+
},
|
|
128
|
+
bezierCurveTo: function (x1, y1, x2, y2, x, y) {
|
|
129
|
+
this._context.bezierCurveTo(y1, x1, y2, x2, y, x);
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
function monotoneX(context) {
|
|
134
|
+
return new MonotoneX(context);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function monotoneY(context) {
|
|
138
|
+
return new MonotoneY(context);
|
|
139
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = _default;
|
|
7
|
+
|
|
8
|
+
function Natural(context) {
|
|
9
|
+
this._context = context;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
Natural.prototype = {
|
|
13
|
+
areaStart: function () {
|
|
14
|
+
this._line = 0;
|
|
15
|
+
},
|
|
16
|
+
areaEnd: function () {
|
|
17
|
+
this._line = NaN;
|
|
18
|
+
},
|
|
19
|
+
lineStart: function () {
|
|
20
|
+
this._x = [];
|
|
21
|
+
this._y = [];
|
|
22
|
+
},
|
|
23
|
+
lineEnd: function () {
|
|
24
|
+
var x = this._x,
|
|
25
|
+
y = this._y,
|
|
26
|
+
n = x.length;
|
|
27
|
+
|
|
28
|
+
if (n) {
|
|
29
|
+
this._line ? this._context.lineTo(x[0], y[0]) : this._context.moveTo(x[0], y[0]);
|
|
30
|
+
|
|
31
|
+
if (n === 2) {
|
|
32
|
+
this._context.lineTo(x[1], y[1]);
|
|
33
|
+
} else {
|
|
34
|
+
var px = controlPoints(x),
|
|
35
|
+
py = controlPoints(y);
|
|
36
|
+
|
|
37
|
+
for (var i0 = 0, i1 = 1; i1 < n; ++i0, ++i1) {
|
|
38
|
+
this._context.bezierCurveTo(px[0][i0], py[0][i0], px[1][i0], py[1][i0], x[i1], y[i1]);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (this._line || this._line !== 0 && n === 1) this._context.closePath();
|
|
44
|
+
this._line = 1 - this._line;
|
|
45
|
+
this._x = this._y = null;
|
|
46
|
+
},
|
|
47
|
+
point: function (x, y) {
|
|
48
|
+
this._x.push(+x);
|
|
49
|
+
|
|
50
|
+
this._y.push(+y);
|
|
51
|
+
}
|
|
52
|
+
}; // See https://www.particleincell.com/2012/bezier-splines/ for derivation.
|
|
53
|
+
|
|
54
|
+
function controlPoints(x) {
|
|
55
|
+
var i,
|
|
56
|
+
n = x.length - 1,
|
|
57
|
+
m,
|
|
58
|
+
a = new Array(n),
|
|
59
|
+
b = new Array(n),
|
|
60
|
+
r = new Array(n);
|
|
61
|
+
a[0] = 0, b[0] = 2, r[0] = x[0] + 2 * x[1];
|
|
62
|
+
|
|
63
|
+
for (i = 1; i < n - 1; ++i) a[i] = 1, b[i] = 4, r[i] = 4 * x[i] + 2 * x[i + 1];
|
|
64
|
+
|
|
65
|
+
a[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x[n - 1] + x[n];
|
|
66
|
+
|
|
67
|
+
for (i = 1; i < n; ++i) m = a[i] / b[i - 1], b[i] -= m, r[i] -= m * r[i - 1];
|
|
68
|
+
|
|
69
|
+
a[n - 1] = r[n - 1] / b[n - 1];
|
|
70
|
+
|
|
71
|
+
for (i = n - 2; i >= 0; --i) a[i] = (r[i] - a[i + 1]) / b[i];
|
|
72
|
+
|
|
73
|
+
b[n - 1] = (x[n] + a[n - 1]) / 2;
|
|
74
|
+
|
|
75
|
+
for (i = 0; i < n - 1; ++i) b[i] = 2 * x[i + 1] - a[i + 1];
|
|
76
|
+
|
|
77
|
+
return [a, b];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function _default(context) {
|
|
81
|
+
return new Natural(context);
|
|
82
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.curveRadialLinear = void 0;
|
|
7
|
+
exports.default = curveRadial;
|
|
8
|
+
|
|
9
|
+
var _linear = _interopRequireDefault(require("./linear.js"));
|
|
10
|
+
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
|
|
13
|
+
var curveRadialLinear = curveRadial(_linear.default);
|
|
14
|
+
exports.curveRadialLinear = curveRadialLinear;
|
|
15
|
+
|
|
16
|
+
function Radial(curve) {
|
|
17
|
+
this._curve = curve;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
Radial.prototype = {
|
|
21
|
+
areaStart: function () {
|
|
22
|
+
this._curve.areaStart();
|
|
23
|
+
},
|
|
24
|
+
areaEnd: function () {
|
|
25
|
+
this._curve.areaEnd();
|
|
26
|
+
},
|
|
27
|
+
lineStart: function () {
|
|
28
|
+
this._curve.lineStart();
|
|
29
|
+
},
|
|
30
|
+
lineEnd: function () {
|
|
31
|
+
this._curve.lineEnd();
|
|
32
|
+
},
|
|
33
|
+
point: function (a, r) {
|
|
34
|
+
this._curve.point(r * Math.sin(a), r * -Math.cos(a));
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
function curveRadial(curve) {
|
|
39
|
+
function radial(context) {
|
|
40
|
+
return new Radial(curve(context));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
radial._curve = curve;
|
|
44
|
+
return radial;
|
|
45
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = _default;
|
|
7
|
+
exports.stepAfter = stepAfter;
|
|
8
|
+
exports.stepBefore = stepBefore;
|
|
9
|
+
|
|
10
|
+
function Step(context, t) {
|
|
11
|
+
this._context = context;
|
|
12
|
+
this._t = t;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
Step.prototype = {
|
|
16
|
+
areaStart: function () {
|
|
17
|
+
this._line = 0;
|
|
18
|
+
},
|
|
19
|
+
areaEnd: function () {
|
|
20
|
+
this._line = NaN;
|
|
21
|
+
},
|
|
22
|
+
lineStart: function () {
|
|
23
|
+
this._x = this._y = NaN;
|
|
24
|
+
this._point = 0;
|
|
25
|
+
},
|
|
26
|
+
lineEnd: function () {
|
|
27
|
+
if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y);
|
|
28
|
+
if (this._line || this._line !== 0 && this._point === 1) this._context.closePath();
|
|
29
|
+
if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line;
|
|
30
|
+
},
|
|
31
|
+
point: function (x, y) {
|
|
32
|
+
x = +x, y = +y;
|
|
33
|
+
|
|
34
|
+
switch (this._point) {
|
|
35
|
+
case 0:
|
|
36
|
+
this._point = 1;
|
|
37
|
+
this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y);
|
|
38
|
+
break;
|
|
39
|
+
|
|
40
|
+
case 1:
|
|
41
|
+
this._point = 2;
|
|
42
|
+
// falls through
|
|
43
|
+
|
|
44
|
+
default:
|
|
45
|
+
{
|
|
46
|
+
if (this._t <= 0) {
|
|
47
|
+
this._context.lineTo(this._x, y);
|
|
48
|
+
|
|
49
|
+
this._context.lineTo(x, y);
|
|
50
|
+
} else {
|
|
51
|
+
var x1 = this._x * (1 - this._t) + x * this._t;
|
|
52
|
+
|
|
53
|
+
this._context.lineTo(x1, this._y);
|
|
54
|
+
|
|
55
|
+
this._context.lineTo(x1, y);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
this._x = x, this._y = y;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
function _default(context) {
|
|
67
|
+
return new Step(context, 0.5);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function stepBefore(context) {
|
|
71
|
+
return new Step(context, 0);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function stepAfter(context) {
|
|
75
|
+
return new Step(context, 1);
|
|
76
|
+
}
|