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.
Files changed (33) hide show
  1. package/dist/victory-core.js +3761 -620
  2. package/dist/victory-core.min.js +1 -1
  3. package/es/index.js +5 -1
  4. package/es/victory-accessible-group/victory-accessible-group.js +1 -3
  5. package/es/victory-animation/victory-animation.js +1 -3
  6. package/es/victory-clip-container/victory-clip-container.js +1 -3
  7. package/es/victory-container/victory-container.js +1 -3
  8. package/es/victory-portal/portal.js +1 -3
  9. package/es/victory-portal/victory-portal.js +1 -3
  10. package/es/victory-primitives/point.js +1 -1
  11. package/es/victory-transition/victory-transition.js +1 -3
  12. package/es/victory-util/add-events.js +305 -308
  13. package/es/victory-util/line-helpers.js +45 -0
  14. package/es/{victory-primitives/path-helpers.js → victory-util/point-path-helpers.js} +0 -0
  15. package/es/victory-util/timer.js +1 -3
  16. package/lib/index.js +16 -2
  17. package/lib/victory-accessible-group/victory-accessible-group.js +1 -3
  18. package/lib/victory-animation/victory-animation.js +1 -3
  19. package/lib/victory-clip-container/victory-clip-container.js +1 -3
  20. package/lib/victory-container/victory-container.js +1 -3
  21. package/lib/victory-portal/portal.js +1 -3
  22. package/lib/victory-portal/victory-portal.js +1 -3
  23. package/lib/victory-primitives/point.js +10 -10
  24. package/lib/victory-transition/victory-transition.js +1 -3
  25. package/lib/victory-util/add-events.js +301 -304
  26. package/lib/victory-util/line-helpers.js +56 -0
  27. package/lib/{victory-primitives/path-helpers.js → victory-util/point-path-helpers.js} +0 -0
  28. package/lib/victory-util/timer.js +1 -3
  29. package/package.json +2 -2
  30. package/src/index.js +3 -0
  31. package/src/victory-primitives/point.js +1 -1
  32. package/src/victory-util/line-helpers.js +54 -0
  33. /package/src/{victory-primitives/path-helpers.js → victory-util/point-path-helpers.js} +0 -0
@@ -0,0 +1,45 @@
1
+ import * as d3Shape from "d3-shape";
2
+
3
+ var defined = function (d) {
4
+ var y = d._y1 !== undefined ? d._y1 : d._y;
5
+ return y !== null && y !== undefined && d._y0 !== null;
6
+ };
7
+
8
+ var getXAccessor = function (scale) {
9
+ return function (d) {
10
+ return scale.x(d._x1 !== undefined ? d._x1 : d._x);
11
+ };
12
+ };
13
+
14
+ var getYAccessor = function (scale) {
15
+ return function (d) {
16
+ return scale.y(d._y1 !== undefined ? d._y1 : d._y);
17
+ };
18
+ };
19
+
20
+ var getAngleAccessor = function (scale) {
21
+ return function (d) {
22
+ var x = scale.x(d._x1 !== undefined ? d._x1 : d._x);
23
+ return -1 * x + Math.PI / 2;
24
+ };
25
+ };
26
+
27
+ var toNewName = function (interpolation) {
28
+ // d3 shape changed the naming scheme for interpolators from "basis" -> "curveBasis" etc.
29
+ var capitalize = function (s) {
30
+ return s && s[0].toUpperCase() + s.slice(1);
31
+ };
32
+
33
+ return "curve".concat(capitalize(interpolation));
34
+ };
35
+
36
+ export var getLineFunction = function (props) {
37
+ var polar = props.polar,
38
+ scale = props.scale,
39
+ horizontal = props.horizontal;
40
+ var defaultOpenCurve = polar ? false : true;
41
+ var openCurve = props.openCurve === undefined ? defaultOpenCurve : props.openCurve;
42
+ var interpolationFunction = typeof props.interpolation === "function" && props.interpolation;
43
+ var interpolationName = typeof props.interpolation === "string" && (!openCurve ? "".concat(toNewName(props.interpolation), "Closed") : toNewName(props.interpolation));
44
+ 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));
45
+ };
@@ -6,9 +6,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
6
6
 
7
7
  import { timer, now } from "d3-timer";
8
8
 
9
- var Timer =
10
- /*#__PURE__*/
11
- function () {
9
+ var Timer = /*#__PURE__*/function () {
12
10
  function Timer() {
13
11
  _classCallCheck(this, Timer);
14
12
 
package/lib/index.js CHANGED
@@ -48,7 +48,9 @@ var _exportNames = {
48
48
  Wrapper: true,
49
49
  Axis: true,
50
50
  TimerContext: true,
51
- PortalContext: true
51
+ PortalContext: true,
52
+ LineHelpers: true,
53
+ PointPathHelpers: true
52
54
  };
53
55
  Object.defineProperty(exports, "VictoryAccessibleGroup", {
54
56
  enumerable: true,
@@ -212,7 +214,13 @@ Object.defineProperty(exports, "PortalContext", {
212
214
  return _portalContext.default;
213
215
  }
214
216
  });
215
- exports.Axis = exports.Wrapper = exports.CommonProps = exports.Transitions = exports.TextSize = exports.Style = exports.Selection = exports.Scale = exports.PropTypes = exports.Log = exports.LabelHelpers = exports.Immutable = exports.Helpers = exports.Events = exports.Domain = exports.DefaultTransitions = exports.Data = exports.Collection = void 0;
217
+ Object.defineProperty(exports, "PointPathHelpers", {
218
+ enumerable: true,
219
+ get: function () {
220
+ return _pointPathHelpers.default;
221
+ }
222
+ });
223
+ exports.LineHelpers = exports.Axis = exports.Wrapper = exports.CommonProps = exports.Transitions = exports.TextSize = exports.Style = exports.Selection = exports.Scale = exports.PropTypes = exports.Log = exports.LabelHelpers = exports.Immutable = exports.Helpers = exports.Events = exports.Domain = exports.DefaultTransitions = exports.Data = exports.Collection = void 0;
216
224
 
217
225
  var _victoryAccessibleGroup = _interopRequireDefault(require("./victory-accessible-group/victory-accessible-group"));
218
226
 
@@ -351,6 +359,12 @@ Object.keys(_hooks).forEach(function (key) {
351
359
  });
352
360
  });
353
361
 
362
+ var _LineHelpers = _interopRequireWildcard(require("./victory-util/line-helpers"));
363
+
364
+ exports.LineHelpers = _LineHelpers;
365
+
366
+ var _pointPathHelpers = _interopRequireDefault(require("./victory-util/point-path-helpers"));
367
+
354
368
  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; } }
355
369
 
356
370
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -23,9 +23,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
23
23
 
24
24
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
25
25
 
26
- var VictoryAccessibleGroup =
27
- /*#__PURE__*/
28
- function (_React$Component) {
26
+ var VictoryAccessibleGroup = /*#__PURE__*/function (_React$Component) {
29
27
  _inherits(VictoryAccessibleGroup, _React$Component);
30
28
 
31
29
  function VictoryAccessibleGroup() {
@@ -41,9 +41,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
41
41
 
42
42
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
43
43
 
44
- var VictoryAnimation =
45
- /*#__PURE__*/
46
- function (_React$Component) {
44
+ var VictoryAnimation = /*#__PURE__*/function (_React$Component) {
47
45
  _inherits(VictoryAnimation, _React$Component);
48
46
 
49
47
  function VictoryAnimation(props, context) {
@@ -55,9 +55,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
55
55
 
56
56
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
57
57
 
58
- var VictoryClipContainer =
59
- /*#__PURE__*/
60
- function (_React$Component) {
58
+ var VictoryClipContainer = /*#__PURE__*/function (_React$Component) {
61
59
  _inherits(VictoryClipContainer, _React$Component);
62
60
 
63
61
  function VictoryClipContainer(props) {
@@ -51,9 +51,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
51
51
 
52
52
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
53
53
 
54
- var VictoryContainer =
55
- /*#__PURE__*/
56
- function (_React$Component) {
54
+ var VictoryContainer = /*#__PURE__*/function (_React$Component) {
57
55
  _inherits(VictoryContainer, _React$Component);
58
56
 
59
57
  function VictoryContainer(props) {
@@ -29,9 +29,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
29
29
 
30
30
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
31
31
 
32
- var Portal =
33
- /*#__PURE__*/
34
- function (_React$Component) {
32
+ var Portal = /*#__PURE__*/function (_React$Component) {
35
33
  _inherits(Portal, _React$Component);
36
34
 
37
35
  function Portal(props) {
@@ -33,9 +33,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
33
33
 
34
34
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
35
35
 
36
- var VictoryPortal =
37
- /*#__PURE__*/
38
- function (_React$Component) {
36
+ var VictoryPortal = /*#__PURE__*/function (_React$Component) {
39
37
  _inherits(VictoryPortal, _React$Component);
40
38
 
41
39
  function VictoryPortal() {
@@ -13,7 +13,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
13
13
 
14
14
  var Helpers = _interopRequireWildcard(require("../victory-util/helpers"));
15
15
 
16
- var _pathHelpers = _interopRequireDefault(require("./path-helpers"));
16
+ var _pointPathHelpers = _interopRequireDefault(require("../victory-util/point-path-helpers"));
17
17
 
18
18
  var CommonProps = _interopRequireWildcard(require("../victory-util/common-props"));
19
19
 
@@ -38,15 +38,15 @@ var getPath = function (props) {
38
38
  }
39
39
 
40
40
  var pathFunctions = {
41
- circle: _pathHelpers.default.circle,
42
- square: _pathHelpers.default.square,
43
- diamond: _pathHelpers.default.diamond,
44
- triangleDown: _pathHelpers.default.triangleDown,
45
- triangleUp: _pathHelpers.default.triangleUp,
46
- plus: _pathHelpers.default.plus,
47
- minus: _pathHelpers.default.minus,
48
- star: _pathHelpers.default.star,
49
- cross: _pathHelpers.default.cross
41
+ circle: _pointPathHelpers.default.circle,
42
+ square: _pointPathHelpers.default.square,
43
+ diamond: _pointPathHelpers.default.diamond,
44
+ triangleDown: _pointPathHelpers.default.triangleDown,
45
+ triangleUp: _pointPathHelpers.default.triangleUp,
46
+ plus: _pointPathHelpers.default.plus,
47
+ minus: _pointPathHelpers.default.minus,
48
+ star: _pointPathHelpers.default.star,
49
+ cross: _pointPathHelpers.default.cross
50
50
  };
51
51
  var symbolFunction = typeof pathFunctions[symbol] === "function" ? pathFunctions[symbol] : pathFunctions.circle;
52
52
  return symbolFunction(x, y, size);
@@ -47,9 +47,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
47
47
 
48
48
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
49
49
 
50
- var VictoryTransition =
51
- /*#__PURE__*/
52
- function (_React$Component) {
50
+ var VictoryTransition = /*#__PURE__*/function (_React$Component) {
53
51
  _inherits(VictoryTransition, _React$Component);
54
52
 
55
53
  function VictoryTransition(props, context) {