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.
- package/CHANGELOG.md +6 -0
- package/dist/victory-core.js +4371 -5749
- package/dist/victory-core.min.js +1 -1
- package/es/victory-accessible-group/victory-accessible-group.js +9 -15
- package/es/victory-animation/util.js +28 -47
- package/es/victory-animation/victory-animation.js +51 -67
- package/es/victory-clip-container/victory-clip-container.js +153 -229
- package/es/victory-container/victory-container.js +157 -216
- package/es/victory-label/victory-label.js +246 -323
- package/es/victory-portal/portal-context.js +1 -2
- package/es/victory-portal/portal.js +30 -76
- package/es/victory-portal/victory-portal.js +47 -104
- package/es/victory-primitives/arc.js +44 -47
- package/es/victory-primitives/background.js +14 -17
- package/es/victory-primitives/border.js +20 -24
- package/es/victory-primitives/circle.js +13 -27
- package/es/victory-primitives/clip-path.js +3 -7
- package/es/victory-primitives/line-segment.js +20 -24
- package/es/victory-primitives/line.js +13 -27
- package/es/victory-primitives/path.js +13 -27
- package/es/victory-primitives/point.js +36 -40
- package/es/victory-primitives/rect.js +13 -27
- package/es/victory-primitives/text.js +15 -28
- package/es/victory-primitives/tspan.js +13 -26
- package/es/victory-primitives/whisker.js +43 -47
- package/es/victory-theme/grayscale.js +22 -22
- package/es/victory-theme/material.js +46 -46
- package/es/victory-theme/victory-theme.js +3 -3
- package/es/victory-transition/victory-transition.js +126 -206
- package/es/victory-util/add-events.js +263 -374
- package/es/victory-util/axis.js +126 -222
- package/es/victory-util/collection.js +13 -41
- package/es/victory-util/data.js +159 -214
- package/es/victory-util/default-transitions.js +33 -51
- package/es/victory-util/domain.js +122 -171
- package/es/victory-util/events.js +168 -258
- package/es/victory-util/helpers.js +153 -178
- package/es/victory-util/hooks/use-animation-state.js +61 -99
- package/es/victory-util/hooks/use-previous-props.js +2 -2
- package/es/victory-util/immutable.js +6 -8
- package/es/victory-util/label-helpers.js +128 -130
- package/es/victory-util/line-helpers.js +29 -41
- package/es/victory-util/log.js +1 -1
- package/es/victory-util/point-path-helpers.js +89 -49
- package/es/victory-util/scale.js +24 -42
- package/es/victory-util/selection.js +39 -40
- package/es/victory-util/style.js +8 -13
- package/es/victory-util/textsize.js +80 -154
- package/es/victory-util/timer-context.js +2 -2
- package/es/victory-util/timer.js +40 -76
- package/es/victory-util/transitions.js +110 -150
- package/es/victory-util/type-helpers.js +2 -3
- package/es/victory-util/user-props.js +24 -49
- package/es/victory-util/wrapper.js +184 -247
- package/lib/index.js +0 -30
- package/lib/victory-accessible-group/victory-accessible-group.js +9 -19
- package/lib/victory-animation/util.js +28 -63
- package/lib/victory-animation/victory-animation.js +54 -83
- package/lib/victory-clip-container/victory-clip-container.js +156 -243
- package/lib/victory-container/victory-container.js +160 -232
- package/lib/victory-label/victory-label.js +248 -344
- package/lib/victory-portal/portal-context.js +1 -6
- package/lib/victory-portal/portal.js +31 -81
- package/lib/victory-portal/victory-portal.js +50 -116
- package/lib/victory-primitives/arc.js +48 -57
- package/lib/victory-primitives/background.js +16 -28
- package/lib/victory-primitives/border.js +22 -34
- package/lib/victory-primitives/circle.js +16 -36
- package/lib/victory-primitives/clip-path.js +3 -11
- package/lib/victory-primitives/index.js +0 -28
- package/lib/victory-primitives/line-segment.js +22 -34
- package/lib/victory-primitives/line.js +16 -36
- package/lib/victory-primitives/path.js +16 -36
- package/lib/victory-primitives/point.js +38 -52
- package/lib/victory-primitives/rect.js +16 -36
- package/lib/victory-primitives/text.js +15 -33
- package/lib/victory-primitives/tspan.js +13 -31
- package/lib/victory-primitives/whisker.js +45 -57
- package/lib/victory-theme/grayscale.js +23 -24
- package/lib/victory-theme/material.js +47 -48
- package/lib/victory-theme/victory-theme.js +2 -7
- package/lib/victory-transition/victory-transition.js +129 -224
- package/lib/victory-util/add-events.js +263 -380
- package/lib/victory-util/axis.js +128 -241
- package/lib/victory-util/collection.js +13 -50
- package/lib/victory-util/data.js +160 -239
- package/lib/victory-util/default-transitions.js +33 -54
- package/lib/victory-util/domain.js +123 -193
- package/lib/victory-util/events.js +167 -274
- package/lib/victory-util/helpers.js +156 -207
- package/lib/victory-util/hooks/index.js +0 -2
- package/lib/victory-util/hooks/use-animation-state.js +63 -113
- package/lib/victory-util/hooks/use-previous-props.js +2 -7
- package/lib/victory-util/immutable.js +6 -18
- package/lib/victory-util/index.js +2 -51
- package/lib/victory-util/label-helpers.js +130 -141
- package/lib/victory-util/line-helpers.js +31 -49
- package/lib/victory-util/log.js +1 -2
- package/lib/victory-util/point-path-helpers.js +91 -63
- package/lib/victory-util/scale.js +26 -57
- package/lib/victory-util/selection.js +41 -49
- package/lib/victory-util/style.js +8 -16
- package/lib/victory-util/textsize.js +80 -157
- package/lib/victory-util/timer-context.js +2 -8
- package/lib/victory-util/timer.js +40 -76
- package/lib/victory-util/transitions.js +110 -152
- package/lib/victory-util/type-helpers.js +2 -9
- package/lib/victory-util/user-props.js +25 -59
- package/lib/victory-util/wrapper.js +186 -281
- 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
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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
|
|
95
|
-
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
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
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";
|
|
129
|
+
return "right";
|
|
130
|
+
// eslint-disable-next-line no-magic-numbers
|
|
130
131
|
} else if (degrees >= 45 && degrees <= 135) {
|
|
131
|
-
return "top";
|
|
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
|
-
}
|
|
138
|
-
|
|
138
|
+
}
|
|
139
139
|
|
|
140
|
-
|
|
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
|
-
|
|
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
|
-
|
|
163
|
-
|
|
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
|
-
|
|
174
|
-
|
|
175
|
-
|
|
167
|
+
const {
|
|
168
|
+
labelPlacement,
|
|
169
|
+
datum
|
|
170
|
+
} = props;
|
|
176
171
|
if (!labelPlacement || labelPlacement === "vertical") {
|
|
177
172
|
return 0;
|
|
178
173
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
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
|
-
|
|
198
|
-
|
|
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
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
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
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
32
|
-
|
|
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
|
-
|
|
41
|
-
|
|
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
|
-
|
|
48
|
-
return "".concat(toNewName(interpolation), "Closed");
|
|
31
|
+
const toNewNameClosed = interpolation => {
|
|
32
|
+
return `${toNewName(interpolation)}Closed`;
|
|
49
33
|
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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;
|
package/lib/victory-util/log.js
CHANGED
|
@@ -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") {
|