victory-core 36.9.2 → 37.0.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 (110) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/victory-core.js +4371 -5749
  3. package/dist/victory-core.min.js +1 -1
  4. package/es/victory-accessible-group/victory-accessible-group.js +9 -15
  5. package/es/victory-animation/util.js +28 -47
  6. package/es/victory-animation/victory-animation.js +51 -67
  7. package/es/victory-clip-container/victory-clip-container.js +153 -229
  8. package/es/victory-container/victory-container.js +157 -216
  9. package/es/victory-label/victory-label.js +246 -323
  10. package/es/victory-portal/portal-context.js +1 -2
  11. package/es/victory-portal/portal.js +30 -76
  12. package/es/victory-portal/victory-portal.js +47 -104
  13. package/es/victory-primitives/arc.js +44 -47
  14. package/es/victory-primitives/background.js +14 -17
  15. package/es/victory-primitives/border.js +20 -24
  16. package/es/victory-primitives/circle.js +13 -27
  17. package/es/victory-primitives/clip-path.js +3 -7
  18. package/es/victory-primitives/line-segment.js +20 -24
  19. package/es/victory-primitives/line.js +13 -27
  20. package/es/victory-primitives/path.js +13 -27
  21. package/es/victory-primitives/point.js +36 -40
  22. package/es/victory-primitives/rect.js +13 -27
  23. package/es/victory-primitives/text.js +15 -28
  24. package/es/victory-primitives/tspan.js +13 -26
  25. package/es/victory-primitives/whisker.js +43 -47
  26. package/es/victory-theme/grayscale.js +22 -22
  27. package/es/victory-theme/material.js +46 -46
  28. package/es/victory-theme/victory-theme.js +3 -3
  29. package/es/victory-transition/victory-transition.js +126 -206
  30. package/es/victory-util/add-events.js +263 -374
  31. package/es/victory-util/axis.js +126 -222
  32. package/es/victory-util/collection.js +13 -41
  33. package/es/victory-util/data.js +159 -214
  34. package/es/victory-util/default-transitions.js +33 -51
  35. package/es/victory-util/domain.js +122 -171
  36. package/es/victory-util/events.js +168 -258
  37. package/es/victory-util/helpers.js +153 -178
  38. package/es/victory-util/hooks/use-animation-state.js +61 -99
  39. package/es/victory-util/hooks/use-previous-props.js +2 -2
  40. package/es/victory-util/immutable.js +6 -8
  41. package/es/victory-util/label-helpers.js +128 -130
  42. package/es/victory-util/line-helpers.js +29 -41
  43. package/es/victory-util/log.js +1 -1
  44. package/es/victory-util/point-path-helpers.js +89 -49
  45. package/es/victory-util/scale.js +24 -42
  46. package/es/victory-util/selection.js +39 -40
  47. package/es/victory-util/style.js +8 -13
  48. package/es/victory-util/textsize.js +80 -154
  49. package/es/victory-util/timer-context.js +2 -2
  50. package/es/victory-util/timer.js +40 -76
  51. package/es/victory-util/transitions.js +110 -150
  52. package/es/victory-util/type-helpers.js +2 -3
  53. package/es/victory-util/user-props.js +24 -49
  54. package/es/victory-util/wrapper.js +184 -247
  55. package/lib/index.js +0 -30
  56. package/lib/victory-accessible-group/victory-accessible-group.js +9 -19
  57. package/lib/victory-animation/util.js +28 -63
  58. package/lib/victory-animation/victory-animation.js +54 -83
  59. package/lib/victory-clip-container/victory-clip-container.js +156 -243
  60. package/lib/victory-container/victory-container.js +160 -232
  61. package/lib/victory-label/victory-label.js +248 -344
  62. package/lib/victory-portal/portal-context.js +1 -6
  63. package/lib/victory-portal/portal.js +31 -81
  64. package/lib/victory-portal/victory-portal.js +50 -116
  65. package/lib/victory-primitives/arc.js +48 -57
  66. package/lib/victory-primitives/background.js +16 -28
  67. package/lib/victory-primitives/border.js +22 -34
  68. package/lib/victory-primitives/circle.js +16 -36
  69. package/lib/victory-primitives/clip-path.js +3 -11
  70. package/lib/victory-primitives/index.js +0 -28
  71. package/lib/victory-primitives/line-segment.js +22 -34
  72. package/lib/victory-primitives/line.js +16 -36
  73. package/lib/victory-primitives/path.js +16 -36
  74. package/lib/victory-primitives/point.js +38 -52
  75. package/lib/victory-primitives/rect.js +16 -36
  76. package/lib/victory-primitives/text.js +15 -33
  77. package/lib/victory-primitives/tspan.js +13 -31
  78. package/lib/victory-primitives/whisker.js +45 -57
  79. package/lib/victory-theme/grayscale.js +23 -24
  80. package/lib/victory-theme/material.js +47 -48
  81. package/lib/victory-theme/victory-theme.js +2 -7
  82. package/lib/victory-transition/victory-transition.js +129 -224
  83. package/lib/victory-util/add-events.js +263 -380
  84. package/lib/victory-util/axis.js +128 -241
  85. package/lib/victory-util/collection.js +13 -50
  86. package/lib/victory-util/data.js +160 -239
  87. package/lib/victory-util/default-transitions.js +33 -54
  88. package/lib/victory-util/domain.js +123 -193
  89. package/lib/victory-util/events.js +167 -274
  90. package/lib/victory-util/helpers.js +156 -207
  91. package/lib/victory-util/hooks/index.js +0 -2
  92. package/lib/victory-util/hooks/use-animation-state.js +63 -113
  93. package/lib/victory-util/hooks/use-previous-props.js +2 -7
  94. package/lib/victory-util/immutable.js +6 -18
  95. package/lib/victory-util/index.js +2 -51
  96. package/lib/victory-util/label-helpers.js +130 -141
  97. package/lib/victory-util/line-helpers.js +31 -49
  98. package/lib/victory-util/log.js +1 -2
  99. package/lib/victory-util/point-path-helpers.js +91 -63
  100. package/lib/victory-util/scale.js +26 -57
  101. package/lib/victory-util/selection.js +41 -49
  102. package/lib/victory-util/style.js +8 -16
  103. package/lib/victory-util/textsize.js +80 -157
  104. package/lib/victory-util/timer-context.js +2 -8
  105. package/lib/victory-util/timer.js +40 -76
  106. package/lib/victory-util/transitions.js +110 -152
  107. package/lib/victory-util/type-helpers.js +2 -9
  108. package/lib/victory-util/user-props.js +25 -59
  109. package/lib/victory-util/wrapper.js +186 -281
  110. package/package.json +2 -2
@@ -9,178 +9,171 @@ exports.getPolarTextAnchor = getPolarTextAnchor;
9
9
  exports.getPolarVerticalAnchor = getPolarVerticalAnchor;
10
10
  exports.getProps = getProps;
11
11
  exports.getText = getText;
12
-
13
12
  var _defaults2 = _interopRequireDefault(require("lodash/defaults"));
14
-
15
13
  var Helpers = _interopRequireWildcard(require("./helpers"));
16
-
17
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
18
-
19
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
20
-
14
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
15
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
21
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+ /* eslint-disable no-use-before-define */
22
18
 
23
19
  // Private Functions
24
- function getVerticalAnchor(props) {
25
- var datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
26
- var sign = datum._y >= 0 ? 1 : -1;
27
- var labelStyle = props.style && props.style.labels || {};
28
20
 
21
+ function getVerticalAnchor(props, datum) {
22
+ if (datum === void 0) {
23
+ datum = {};
24
+ }
25
+ const sign = datum._y >= 0 ? 1 : -1;
26
+ const labelStyle = props.style && props.style.labels || {};
29
27
  if (datum.verticalAnchor || labelStyle.verticalAnchor) {
30
28
  return datum.verticalAnchor || labelStyle.verticalAnchor;
31
29
  } else if (!props.horizontal) {
32
30
  return sign >= 0 ? "end" : "start";
33
31
  }
34
-
35
32
  return "middle";
36
33
  }
37
-
38
- function getTextAnchor(props) {
39
- var datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
40
- var style = props.style,
41
- horizontal = props.horizontal;
42
- var sign = datum._y >= 0 ? 1 : -1;
43
- var labelStyle = style && style.labels || {};
44
-
34
+ function getTextAnchor(props, datum) {
35
+ if (datum === void 0) {
36
+ datum = {};
37
+ }
38
+ const {
39
+ style,
40
+ horizontal
41
+ } = props;
42
+ const sign = datum._y >= 0 ? 1 : -1;
43
+ const labelStyle = style && style.labels || {};
45
44
  if (datum.verticalAnchor || labelStyle.verticalAnchor) {
46
45
  return datum.verticalAnchor || labelStyle.verticalAnchor;
47
46
  } else if (!horizontal) {
48
47
  return "middle";
49
48
  }
50
-
51
49
  return sign >= 0 ? "start" : "end";
52
50
  }
53
-
54
- function getAngle(props) {
55
- var datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
56
- var labelStyle = props.style && props.style.labels || {};
51
+ function getAngle(props, datum) {
52
+ if (datum === void 0) {
53
+ datum = {};
54
+ }
55
+ const labelStyle = props.style && props.style.labels || {};
57
56
  return datum.angle === undefined ? labelStyle.angle : datum.angle;
58
57
  }
59
-
60
- function getPadding(props) {
61
- var datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
62
- var horizontal = props.horizontal,
63
- style = props.style;
64
- var labelStyle = style.labels || {};
65
- var defaultPadding = Helpers.evaluateProp(labelStyle.padding, props) || 0;
66
- var sign = datum._y < 0 ? -1 : 1;
58
+ function getPadding(props, datum) {
59
+ if (datum === void 0) {
60
+ datum = {};
61
+ }
62
+ const {
63
+ horizontal,
64
+ style
65
+ } = props;
66
+ const labelStyle = style.labels || {};
67
+ const defaultPadding = Helpers.evaluateProp(labelStyle.padding, props) || 0;
68
+ const sign = datum._y < 0 ? -1 : 1;
67
69
  return {
68
70
  x: horizontal ? sign * defaultPadding : 0,
69
71
  y: horizontal ? 0 : -1 * sign * defaultPadding
70
72
  };
71
73
  }
72
-
73
74
  function getOffset(props, datum) {
74
75
  if (props.polar) {
75
76
  return {};
76
77
  }
77
-
78
- var padding = getPadding(props, datum);
78
+ const padding = getPadding(props, datum);
79
79
  return {
80
80
  dx: padding.x,
81
81
  dy: padding.y
82
82
  };
83
83
  }
84
-
85
84
  function getPosition(props, datum) {
86
- var polar = props.polar;
87
-
88
- var _Helpers$scalePoint = Helpers.scalePoint(props, datum),
89
- x = _Helpers$scalePoint.x,
90
- y = _Helpers$scalePoint.y;
91
-
85
+ const {
86
+ polar
87
+ } = props;
88
+ const {
89
+ x,
90
+ y
91
+ } = Helpers.scalePoint(props, datum);
92
92
  if (!polar) {
93
93
  return {
94
- x: x,
95
- y: y
94
+ x,
95
+ y
96
96
  };
97
97
  }
98
-
99
- var polarPadding = getPolarPadding(props, datum);
98
+ const polarPadding = getPolarPadding(props, datum);
100
99
  return {
101
100
  x: x + polarPadding.x,
102
101
  y: y + polarPadding.y
103
102
  };
104
103
  }
105
-
106
104
  function getPolarPadding(props, datum) {
107
- var style = props.style;
108
- var degrees = getDegrees(props, datum);
109
- var labelStyle = style.labels || {};
110
- var padding = Helpers.evaluateProp(labelStyle.padding, props) || 0;
111
- var angle = Helpers.degreesToRadians(degrees);
105
+ const {
106
+ style
107
+ } = props;
108
+ const degrees = getDegrees(props, datum);
109
+ const labelStyle = style.labels || {};
110
+ const padding = Helpers.evaluateProp(labelStyle.padding, props) || 0;
111
+ const angle = Helpers.degreesToRadians(degrees);
112
112
  return {
113
113
  x: padding * Math.cos(angle),
114
114
  y: -padding * Math.sin(angle)
115
115
  };
116
116
  }
117
-
118
117
  function getLabelPlacement(props) {
119
- var labelComponent = props.labelComponent,
120
- labelPlacement = props.labelPlacement,
121
- polar = props.polar;
122
- var defaultLabelPlacement = polar ? "perpendicular" : "vertical";
118
+ const {
119
+ labelComponent,
120
+ labelPlacement,
121
+ polar
122
+ } = props;
123
+ const defaultLabelPlacement = polar ? "perpendicular" : "vertical";
123
124
  return labelPlacement ? labelPlacement : labelComponent.props && labelComponent.props.labelPlacement || defaultLabelPlacement;
124
125
  }
125
-
126
126
  function getPolarOrientation(degrees) {
127
127
  // eslint-disable-next-line no-magic-numbers
128
128
  if (degrees < 45 || degrees > 315) {
129
- return "right"; // eslint-disable-next-line no-magic-numbers
129
+ return "right";
130
+ // eslint-disable-next-line no-magic-numbers
130
131
  } else if (degrees >= 45 && degrees <= 135) {
131
- return "top"; // eslint-disable-next-line no-magic-numbers
132
+ return "top";
133
+ // eslint-disable-next-line no-magic-numbers
132
134
  } else if (degrees > 135 && degrees < 225) {
133
135
  return "left";
134
136
  }
135
-
136
137
  return "bottom";
137
- } // Exported Functions
138
-
138
+ }
139
139
 
140
- function getText(props) {
141
- var datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
142
- var index = arguments.length > 2 ? arguments[2] : undefined;
140
+ // Exported Functions
143
141
 
142
+ function getText(props, datum, index) {
143
+ if (datum === void 0) {
144
+ datum = {};
145
+ }
144
146
  if (datum.label !== undefined) {
145
147
  return datum.label;
146
148
  }
147
-
148
149
  return Array.isArray(props.labels) ? props.labels[index] : props.labels;
149
150
  }
150
-
151
151
  function getPolarTextAnchor(props, degrees) {
152
- var labelPlacement = getLabelPlacement(props);
153
-
152
+ const labelPlacement = getLabelPlacement(props);
154
153
  if (labelPlacement === "perpendicular" || labelPlacement === "vertical" && (degrees === 90 || degrees === 270)) {
155
154
  return "middle";
156
155
  }
157
-
158
156
  return degrees <= 90 || degrees > 270 ? "start" : "end";
159
157
  }
160
-
161
158
  function getPolarVerticalAnchor(props, degrees) {
162
- var labelPlacement = getLabelPlacement(props);
163
- var orientation = getPolarOrientation(degrees);
164
-
159
+ const labelPlacement = getLabelPlacement(props);
160
+ const orientation = getPolarOrientation(degrees);
165
161
  if (labelPlacement === "parallel" || orientation === "left" || orientation === "right") {
166
162
  return "middle";
167
163
  }
168
-
169
164
  return orientation === "top" ? "end" : "start";
170
165
  }
171
-
172
166
  function getPolarAngle(props, baseAngle) {
173
- var labelPlacement = props.labelPlacement,
174
- datum = props.datum;
175
-
167
+ const {
168
+ labelPlacement,
169
+ datum
170
+ } = props;
176
171
  if (!labelPlacement || labelPlacement === "vertical") {
177
172
  return 0;
178
173
  }
179
-
180
- var degrees = baseAngle !== undefined ? baseAngle % 360 : getDegrees(props, datum);
181
- var sign = degrees > 90 && degrees < 180 || degrees > 270 ? 1 : -1;
182
- var angle = 0;
183
-
174
+ const degrees = baseAngle !== undefined ? baseAngle % 360 : getDegrees(props, datum);
175
+ const sign = degrees > 90 && degrees < 180 || degrees > 270 ? 1 : -1;
176
+ let angle = 0;
184
177
  if (degrees === 0 || degrees === 180) {
185
178
  angle = 90;
186
179
  } else if (degrees > 0 && degrees < 180) {
@@ -188,71 +181,67 @@ function getPolarAngle(props, baseAngle) {
188
181
  } else if (degrees > 180 && degrees < 360) {
189
182
  angle = 270 - degrees;
190
183
  }
191
-
192
- var labelRotation = labelPlacement === "perpendicular" ? 0 : 90;
184
+ const labelRotation = labelPlacement === "perpendicular" ? 0 : 90;
193
185
  return angle + sign * labelRotation;
194
186
  }
195
-
196
187
  function getDegrees(props, datum) {
197
- var _Helpers$getPoint = Helpers.getPoint(datum),
198
- x = _Helpers$getPoint.x;
199
-
188
+ const {
189
+ x
190
+ } = Helpers.getPoint(datum);
200
191
  return Helpers.radiansToDegrees(props.scale.x(x)) % 360;
201
192
  }
202
-
203
193
  function getProps(props, index) {
204
- var scale = props.scale,
205
- data = props.data,
206
- style = props.style,
207
- horizontal = props.horizontal,
208
- polar = props.polar,
209
- width = props.width,
210
- height = props.height,
211
- theme = props.theme,
212
- labelComponent = props.labelComponent,
213
- disableInlineStyles = props.disableInlineStyles;
214
- var datum = data[index];
215
- var degrees = getDegrees(props, datum);
216
- var textAnchor = polar ? getPolarTextAnchor(props, degrees) : getTextAnchor(props, datum);
217
- var verticalAnchor = polar ? getPolarVerticalAnchor(props, degrees) : getVerticalAnchor(props, datum);
218
- var angle = getAngle(props, datum);
219
- var text = getText(props, datum, index);
220
- var labelPlacement = getLabelPlacement(props);
221
-
222
- var _getPosition = getPosition(props, datum),
223
- x = _getPosition.x,
224
- y = _getPosition.y;
225
-
226
- var _getOffset = getOffset(props, datum),
227
- dx = _getOffset.dx,
228
- dy = _getOffset.dy;
229
-
230
- var labelProps = {
231
- angle: angle,
232
- data: data,
233
- datum: datum,
234
- disableInlineStyles: disableInlineStyles,
235
- horizontal: horizontal,
236
- index: index,
237
- polar: polar,
238
- scale: scale,
239
- labelPlacement: labelPlacement,
240
- text: text,
241
- textAnchor: textAnchor,
242
- verticalAnchor: verticalAnchor,
243
- x: x,
244
- y: y,
245
- dx: dx,
246
- dy: dy,
247
- width: width,
248
- height: height,
194
+ const {
195
+ scale,
196
+ data,
197
+ style,
198
+ horizontal,
199
+ polar,
200
+ width,
201
+ height,
202
+ theme,
203
+ labelComponent,
204
+ disableInlineStyles
205
+ } = props;
206
+ const datum = data[index];
207
+ const degrees = getDegrees(props, datum);
208
+ const textAnchor = polar ? getPolarTextAnchor(props, degrees) : getTextAnchor(props, datum);
209
+ const verticalAnchor = polar ? getPolarVerticalAnchor(props, degrees) : getVerticalAnchor(props, datum);
210
+ const angle = getAngle(props, datum);
211
+ const text = getText(props, datum, index);
212
+ const labelPlacement = getLabelPlacement(props);
213
+ const {
214
+ x,
215
+ y
216
+ } = getPosition(props, datum);
217
+ const {
218
+ dx,
219
+ dy
220
+ } = getOffset(props, datum);
221
+ const labelProps = {
222
+ angle,
223
+ data,
224
+ datum,
225
+ disableInlineStyles,
226
+ horizontal,
227
+ index,
228
+ polar,
229
+ scale,
230
+ labelPlacement,
231
+ text,
232
+ textAnchor,
233
+ verticalAnchor,
234
+ x,
235
+ y,
236
+ dx,
237
+ dy,
238
+ width,
239
+ height,
249
240
  style: style.labels
250
241
  };
251
-
252
242
  if (!Helpers.isTooltip(labelComponent)) {
253
243
  return labelProps;
254
244
  }
255
-
256
- var tooltipTheme = theme && theme.tooltip || {};
245
+ const tooltipTheme = theme && theme.tooltip || {};
257
246
  return (0, _defaults2.default)({}, labelProps, Helpers.omit(tooltipTheme, ["style"]));
258
247
  }
@@ -4,75 +4,57 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getLineFunction = exports.getInterpolationFunction = void 0;
7
-
8
7
  var d3Shape = _interopRequireWildcard(require("victory-vendor/d3-shape"));
9
-
10
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
11
-
12
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13
-
14
- var defined = function (d) {
15
- var y = d._y1 !== undefined ? d._y1 : d._y;
8
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
9
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
10
+ const defined = d => {
11
+ const y = d._y1 !== undefined ? d._y1 : d._y;
16
12
  return y !== null && y !== undefined && d._y0 !== null;
17
13
  };
18
-
19
- var getXAccessor = function (scale) {
20
- return function (d) {
21
- return scale.x(d._x1 !== undefined ? d._x1 : d._x);
22
- };
14
+ const getXAccessor = scale => {
15
+ return d => scale.x(d._x1 !== undefined ? d._x1 : d._x);
23
16
  };
24
-
25
- var getYAccessor = function (scale) {
26
- return function (d) {
27
- return scale.y(d._y1 !== undefined ? d._y1 : d._y);
28
- };
17
+ const getYAccessor = scale => {
18
+ return d => scale.y(d._y1 !== undefined ? d._y1 : d._y);
29
19
  };
30
-
31
- var getAngleAccessor = function (scale) {
32
- return function (d) {
33
- var x = scale.x(d._x1 !== undefined ? d._x1 : d._x);
20
+ const getAngleAccessor = scale => {
21
+ return d => {
22
+ const x = scale.x(d._x1 !== undefined ? d._x1 : d._x);
34
23
  return -1 * x + Math.PI / 2;
35
24
  };
36
25
  };
37
-
38
- var toNewName = function (interpolation) {
26
+ const toNewName = interpolation => {
39
27
  // d3 shape changed the naming scheme for interpolators from "basis" -> "curveBasis" etc.
40
- var capitalize = function (s) {
41
- return s && s[0].toUpperCase() + s.slice(1);
42
- };
43
-
44
- return "curve".concat(capitalize(interpolation));
28
+ const capitalize = s => s && s[0].toUpperCase() + s.slice(1);
29
+ return `curve${capitalize(interpolation)}`;
45
30
  };
46
-
47
- var toNewNameClosed = function (interpolation) {
48
- return "".concat(toNewName(interpolation), "Closed");
31
+ const toNewNameClosed = interpolation => {
32
+ return `${toNewName(interpolation)}Closed`;
49
33
  };
50
-
51
- var getInterpolationFunction = function (props) {
52
- var interpolation = props.interpolation;
53
-
34
+ const getInterpolationFunction = props => {
35
+ const {
36
+ interpolation
37
+ } = props;
54
38
  if (typeof interpolation === "function") {
55
39
  return interpolation;
56
40
  }
57
-
58
41
  if (typeof interpolation === "string") {
59
- var polar = props.polar,
60
- _props$openCurve = props.openCurve,
61
- openCurve = _props$openCurve === void 0 ? !polar : _props$openCurve;
62
- var interpolationName = !openCurve ? toNewNameClosed(interpolation) : toNewName(interpolation);
42
+ const {
43
+ polar,
44
+ openCurve = !polar
45
+ } = props;
46
+ const interpolationName = !openCurve ? toNewNameClosed(interpolation) : toNewName(interpolation);
63
47
  return d3Shape[interpolationName];
64
48
  }
65
-
66
49
  return d3Shape.curveLinear;
67
50
  };
68
-
69
51
  exports.getInterpolationFunction = getInterpolationFunction;
70
-
71
- var getLineFunction = function (props) {
72
- var polar = props.polar,
73
- scale = props.scale,
74
- horizontal = props.horizontal;
52
+ const getLineFunction = props => {
53
+ const {
54
+ polar,
55
+ scale,
56
+ horizontal
57
+ } = props;
75
58
  return polar ? d3Shape.lineRadial().defined(defined).curve(getInterpolationFunction(props)).angle(getAngleAccessor(scale)).radius(getYAccessor(scale)) : d3Shape.line().defined(defined).curve(getInterpolationFunction(props)).x(horizontal ? getYAccessor(scale) : getXAccessor(scale)).y(horizontal ? getXAccessor(scale) : getYAccessor(scale));
76
59
  };
77
-
78
60
  exports.getLineFunction = getLineFunction;
@@ -4,10 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.warn = warn;
7
-
8
7
  /* global console */
9
-
10
8
  /* eslint-disable no-console */
9
+
11
10
  // TODO: Use "warning" npm module like React is switching to.
12
11
  function warn(message) {
13
12
  if (process.env.NODE_ENV !== "production") {