victory-core 36.0.0 → 36.1.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/dist/victory-core.js +3761 -620
- package/dist/victory-core.min.js +1 -1
- package/es/index.js +5 -1
- package/es/victory-accessible-group/victory-accessible-group.js +1 -3
- package/es/victory-animation/victory-animation.js +1 -3
- package/es/victory-clip-container/victory-clip-container.js +1 -3
- package/es/victory-container/victory-container.js +1 -3
- package/es/victory-portal/portal.js +1 -3
- package/es/victory-portal/victory-portal.js +1 -3
- package/es/victory-primitives/point.js +1 -1
- package/es/victory-transition/victory-transition.js +1 -3
- package/es/victory-util/add-events.js +305 -308
- package/es/victory-util/line-helpers.js +45 -0
- package/es/{victory-primitives/path-helpers.js → victory-util/point-path-helpers.js} +0 -0
- package/es/victory-util/timer.js +1 -3
- package/lib/index.js +16 -2
- package/lib/victory-accessible-group/victory-accessible-group.js +1 -3
- package/lib/victory-animation/victory-animation.js +1 -3
- package/lib/victory-clip-container/victory-clip-container.js +1 -3
- package/lib/victory-container/victory-container.js +1 -3
- package/lib/victory-portal/portal.js +1 -3
- package/lib/victory-portal/victory-portal.js +1 -3
- package/lib/victory-primitives/point.js +10 -10
- package/lib/victory-transition/victory-transition.js +1 -3
- package/lib/victory-util/add-events.js +301 -304
- package/lib/victory-util/line-helpers.js +56 -0
- package/lib/{victory-primitives/path-helpers.js → victory-util/point-path-helpers.js} +0 -0
- package/lib/victory-util/timer.js +1 -3
- package/package.json +2 -2
- package/src/index.js +3 -0
- package/src/victory-primitives/point.js +1 -1
- package/src/victory-util/line-helpers.js +54 -0
- /package/src/{victory-primitives/path-helpers.js → victory-util/point-path-helpers.js} +0 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getLineFunction = void 0;
|
|
7
|
+
|
|
8
|
+
var d3Shape = _interopRequireWildcard(require("d3-shape"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
|
11
|
+
|
|
12
|
+
var defined = function (d) {
|
|
13
|
+
var y = d._y1 !== undefined ? d._y1 : d._y;
|
|
14
|
+
return y !== null && y !== undefined && d._y0 !== null;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
var getXAccessor = function (scale) {
|
|
18
|
+
return function (d) {
|
|
19
|
+
return scale.x(d._x1 !== undefined ? d._x1 : d._x);
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
var getYAccessor = function (scale) {
|
|
24
|
+
return function (d) {
|
|
25
|
+
return scale.y(d._y1 !== undefined ? d._y1 : d._y);
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
var getAngleAccessor = function (scale) {
|
|
30
|
+
return function (d) {
|
|
31
|
+
var x = scale.x(d._x1 !== undefined ? d._x1 : d._x);
|
|
32
|
+
return -1 * x + Math.PI / 2;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
var toNewName = function (interpolation) {
|
|
37
|
+
// d3 shape changed the naming scheme for interpolators from "basis" -> "curveBasis" etc.
|
|
38
|
+
var capitalize = function (s) {
|
|
39
|
+
return s && s[0].toUpperCase() + s.slice(1);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
return "curve".concat(capitalize(interpolation));
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
var getLineFunction = function (props) {
|
|
46
|
+
var polar = props.polar,
|
|
47
|
+
scale = props.scale,
|
|
48
|
+
horizontal = props.horizontal;
|
|
49
|
+
var defaultOpenCurve = polar ? false : true;
|
|
50
|
+
var openCurve = props.openCurve === undefined ? defaultOpenCurve : props.openCurve;
|
|
51
|
+
var interpolationFunction = typeof props.interpolation === "function" && props.interpolation;
|
|
52
|
+
var interpolationName = typeof props.interpolation === "string" && (!openCurve ? "".concat(toNewName(props.interpolation), "Closed") : toNewName(props.interpolation));
|
|
53
|
+
return polar ? d3Shape.lineRadial().defined(defined).curve(interpolationFunction || d3Shape[interpolationName]).angle(getAngleAccessor(scale)).radius(getYAccessor(scale)) : d3Shape.line().defined(defined).curve(interpolationFunction || d3Shape[interpolationName]).x(horizontal ? getYAccessor(scale) : getXAccessor(scale)).y(horizontal ? getXAccessor(scale) : getYAccessor(scale));
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
exports.getLineFunction = getLineFunction;
|
|
File without changes
|
|
@@ -13,9 +13,7 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
|
|
|
13
13
|
|
|
14
14
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
15
15
|
|
|
16
|
-
var Timer =
|
|
17
|
-
/*#__PURE__*/
|
|
18
|
-
function () {
|
|
16
|
+
var Timer = /*#__PURE__*/function () {
|
|
19
17
|
function Timer() {
|
|
20
18
|
_classCallCheck(this, Timer);
|
|
21
19
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "victory-core",
|
|
3
|
-
"version": "36.
|
|
3
|
+
"version": "36.1.0",
|
|
4
4
|
"description": "Victory Core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data visualization",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"version": "yarn run nps build-libs && nps build-dists"
|
|
39
39
|
},
|
|
40
40
|
"sideEffects": false,
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "038cd9b70d9ce54ac6b861014165583760734c99"
|
|
42
42
|
}
|
package/src/index.js
CHANGED
|
@@ -45,3 +45,6 @@ export * as Axis from "./victory-util/axis";
|
|
|
45
45
|
export { default as TimerContext } from "./victory-util/timer-context";
|
|
46
46
|
export { default as PortalContext } from "./victory-portal/portal-context";
|
|
47
47
|
export * from "./victory-util/hooks";
|
|
48
|
+
export * as LineHelpers from "./victory-util/line-helpers";
|
|
49
|
+
// TODO: Fix this default export
|
|
50
|
+
export { default as PointPathHelpers } from "./victory-util/point-path-helpers";
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import { assign } from "lodash";
|
|
4
4
|
import * as Helpers from "../victory-util/helpers";
|
|
5
|
-
import pathHelpers from "
|
|
5
|
+
import pathHelpers from "../victory-util/point-path-helpers";
|
|
6
6
|
import * as CommonProps from "../victory-util/common-props";
|
|
7
7
|
import Path from "./path";
|
|
8
8
|
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as d3Shape from "d3-shape";
|
|
2
|
+
|
|
3
|
+
const defined = (d) => {
|
|
4
|
+
const y = d._y1 !== undefined ? d._y1 : d._y;
|
|
5
|
+
return y !== null && y !== undefined && d._y0 !== null;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const getXAccessor = (scale) => {
|
|
9
|
+
return (d) => scale.x(d._x1 !== undefined ? d._x1 : d._x);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const getYAccessor = (scale) => {
|
|
13
|
+
return (d) => scale.y(d._y1 !== undefined ? d._y1 : d._y);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const getAngleAccessor = (scale) => {
|
|
17
|
+
return (d) => {
|
|
18
|
+
const x = scale.x(d._x1 !== undefined ? d._x1 : d._x);
|
|
19
|
+
return -1 * x + Math.PI / 2;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const toNewName = (interpolation) => {
|
|
24
|
+
// d3 shape changed the naming scheme for interpolators from "basis" -> "curveBasis" etc.
|
|
25
|
+
const capitalize = (s) => s && s[0].toUpperCase() + s.slice(1);
|
|
26
|
+
return `curve${capitalize(interpolation)}`;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const getLineFunction = (props) => {
|
|
30
|
+
const { polar, scale, horizontal } = props;
|
|
31
|
+
const defaultOpenCurve = polar ? false : true;
|
|
32
|
+
const openCurve =
|
|
33
|
+
props.openCurve === undefined ? defaultOpenCurve : props.openCurve;
|
|
34
|
+
const interpolationFunction =
|
|
35
|
+
typeof props.interpolation === "function" && props.interpolation;
|
|
36
|
+
const interpolationName =
|
|
37
|
+
typeof props.interpolation === "string" &&
|
|
38
|
+
(!openCurve
|
|
39
|
+
? `${toNewName(props.interpolation)}Closed`
|
|
40
|
+
: toNewName(props.interpolation));
|
|
41
|
+
return polar
|
|
42
|
+
? d3Shape
|
|
43
|
+
.lineRadial()
|
|
44
|
+
.defined(defined)
|
|
45
|
+
.curve(interpolationFunction || d3Shape[interpolationName])
|
|
46
|
+
.angle(getAngleAccessor(scale))
|
|
47
|
+
.radius(getYAccessor(scale))
|
|
48
|
+
: d3Shape
|
|
49
|
+
.line()
|
|
50
|
+
.defined(defined)
|
|
51
|
+
.curve(interpolationFunction || d3Shape[interpolationName])
|
|
52
|
+
.x(horizontal ? getYAccessor(scale) : getXAccessor(scale))
|
|
53
|
+
.y(horizontal ? getXAccessor(scale) : getYAccessor(scale));
|
|
54
|
+
};
|
|
File without changes
|