victory-core 36.5.3 → 36.6.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 +18 -0
- package/dist/victory-core.js +5299 -4724
- package/dist/victory-core.min.js +1 -1
- package/es/index.d.ts +2 -1
- package/es/victory-animation/victory-animation.js +1 -1
- package/es/victory-label/victory-label.js +19 -19
- package/es/victory-portal/portal.js +2 -2
- package/es/victory-primitives/arc.js +1 -1
- package/es/victory-primitives/circle.d.ts +1 -0
- package/es/victory-primitives/line.d.ts +1 -0
- package/es/victory-primitives/path.d.ts +1 -0
- package/es/victory-primitives/rect.d.ts +1 -0
- package/es/victory-primitives/tspan.d.ts +1 -0
- package/es/victory-state/victory-provider.d.ts +1 -0
- package/es/victory-transition/victory-transition.js +22 -22
- package/es/victory-util/add-events.d.ts +5 -2
- package/es/victory-util/add-events.js +4 -5
- package/es/victory-util/axis.js +22 -20
- package/es/victory-util/collection.d.ts +2 -2
- package/es/victory-util/data.d.ts +1 -1
- package/es/victory-util/data.js +2 -2
- package/es/victory-util/domain.js +4 -4
- package/es/victory-util/events.js +2 -2
- package/es/victory-util/hooks/use-animation-state.d.ts +22 -0
- package/es/victory-util/hooks/use-animation-state.js +2 -2
- package/es/victory-util/label-helpers.js +12 -12
- package/es/victory-util/prop-types.js +2 -2
- package/es/victory-util/scale.js +1 -1
- package/es/victory-util/selection.d.ts +5 -1
- package/es/victory-util/selection.js +15 -15
- package/es/victory-util/style.js +12 -12
- package/es/victory-util/textsize.js +2 -2
- package/es/victory-util/transitions.js +2 -2
- package/es/victory-util/with-container.d.ts +1 -1
- package/es/victory-util/with-container.js +2 -1
- package/es/victory-util/wrapper.js +8 -8
- package/lib/index.d.ts +2 -1
- package/lib/victory-label/victory-label.js +19 -19
- package/lib/victory-portal/portal.js +2 -2
- package/lib/victory-primitives/circle.d.ts +1 -0
- package/lib/victory-primitives/line.d.ts +1 -0
- package/lib/victory-primitives/path.d.ts +1 -0
- package/lib/victory-primitives/rect.d.ts +1 -0
- package/lib/victory-primitives/tspan.d.ts +1 -0
- package/lib/victory-state/victory-provider.d.ts +1 -0
- package/lib/victory-transition/victory-transition.js +21 -21
- package/lib/victory-util/add-events.d.ts +5 -2
- package/lib/victory-util/add-events.js +4 -4
- package/lib/victory-util/axis.js +22 -20
- package/lib/victory-util/collection.d.ts +2 -2
- package/lib/victory-util/data.d.ts +1 -1
- package/lib/victory-util/data.js +2 -2
- package/lib/victory-util/domain.js +4 -4
- package/lib/victory-util/events.js +2 -2
- package/lib/victory-util/hooks/use-animation-state.d.ts +22 -0
- package/lib/victory-util/hooks/use-animation-state.js +2 -2
- package/lib/victory-util/label-helpers.js +12 -12
- package/lib/victory-util/prop-types.js +2 -2
- package/lib/victory-util/scale.js +1 -1
- package/lib/victory-util/selection.d.ts +5 -1
- package/lib/victory-util/selection.js +15 -15
- package/lib/victory-util/style.js +12 -12
- package/lib/victory-util/textsize.js +2 -2
- package/lib/victory-util/transitions.js +2 -2
- package/lib/victory-util/with-container.d.ts +1 -1
- package/lib/victory-util/with-container.js +5 -3
- package/lib/victory-util/wrapper.js +8 -8
- package/package.json +252 -7
- package/src/index.ts +2 -4
- package/src/victory-animation/victory-animation.tsx +1 -1
- package/src/victory-label/victory-label.tsx +20 -25
- package/src/victory-primitives/arc.tsx +1 -1
- package/src/victory-transition/victory-transition.tsx +24 -26
- package/src/victory-util/add-events.tsx +14 -9
- package/src/victory-util/axis.tsx +12 -13
- package/src/victory-util/collection.tsx +13 -4
- package/src/victory-util/data.ts +2 -3
- package/src/victory-util/domain.ts +6 -6
- package/src/victory-util/events.ts +1 -2
- package/src/victory-util/hooks/{use-animation-state.js → use-animation-state.ts} +23 -8
- package/src/victory-util/label-helpers.ts +8 -12
- package/src/victory-util/point-path-helpers.ts +1 -1
- package/src/victory-util/prop-types.ts +1 -2
- package/src/victory-util/scale.ts +1 -1
- package/src/victory-util/selection.ts +12 -13
- package/src/victory-util/style.ts +10 -11
- package/src/victory-util/textsize.ts +3 -3
- package/src/victory-util/transitions.ts +1 -2
- package/src/victory-util/with-container.tsx +2 -5
- package/src/victory-util/wrapper.tsx +8 -10
|
@@ -42,9 +42,9 @@ function getParentSVG(evt) {
|
|
|
42
42
|
var getParent = function (target) {
|
|
43
43
|
if (target.nodeName === "svg") {
|
|
44
44
|
return target;
|
|
45
|
-
} else {
|
|
46
|
-
return target.parentNode ? getParent(target.parentNode) : target;
|
|
47
45
|
}
|
|
46
|
+
|
|
47
|
+
return target.parentNode ? getParent(target.parentNode) : target;
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
return getParent(evt.target);
|
|
@@ -93,20 +93,20 @@ function getDataCoordinates(props, scale, x, y) {
|
|
|
93
93
|
x: horizontal ? scale.x.invert(y) : scale.x.invert(x),
|
|
94
94
|
y: horizontal ? scale.y.invert(x) : scale.y.invert(y)
|
|
95
95
|
};
|
|
96
|
-
} else {
|
|
97
|
-
var origin = props.origin || {
|
|
98
|
-
x: 0,
|
|
99
|
-
y: 0
|
|
100
|
-
};
|
|
101
|
-
var baseX = x - origin.x;
|
|
102
|
-
var baseY = y - origin.y;
|
|
103
|
-
var radius = Math.abs(baseX * Math.sqrt(1 + Math.pow(-baseY / baseX, 2)));
|
|
104
|
-
var angle = (-Math.atan2(baseY, baseX) + Math.PI * 2) % (Math.PI * 2);
|
|
105
|
-
return {
|
|
106
|
-
x: scale.x.invert(angle),
|
|
107
|
-
y: scale.y.invert(radius)
|
|
108
|
-
};
|
|
109
96
|
}
|
|
97
|
+
|
|
98
|
+
var origin = props.origin || {
|
|
99
|
+
x: 0,
|
|
100
|
+
y: 0
|
|
101
|
+
};
|
|
102
|
+
var baseX = x - origin.x;
|
|
103
|
+
var baseY = y - origin.y;
|
|
104
|
+
var radius = Math.abs(baseX * Math.sqrt(1 + Math.pow(-baseY / baseX, 2)));
|
|
105
|
+
var angle = (-Math.atan2(baseY, baseX) + Math.PI * 2) % (Math.PI * 2);
|
|
106
|
+
return {
|
|
107
|
+
x: scale.x.invert(angle),
|
|
108
|
+
y: scale.y.invert(radius)
|
|
109
|
+
};
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
function getBounds(props) {
|
|
@@ -24,22 +24,22 @@ var toTransformString = function (obj) {
|
|
|
24
24
|
return more.reduce(function (memo, currentObj) {
|
|
25
25
|
return [memo, toTransformString(currentObj)].join(" ");
|
|
26
26
|
}, toTransformString(obj)).trim();
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (obj === undefined || obj === null || typeof obj === "string") {
|
|
30
|
+
return obj;
|
|
31
|
+
}
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
var transforms = [];
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
35
|
+
for (var key in obj) {
|
|
36
|
+
if (obj.hasOwnProperty(key)) {
|
|
37
|
+
var value = obj[key];
|
|
38
|
+
transforms.push("".concat(key, "(").concat(value, ")"));
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
return transforms.join(" ").trim();
|
|
42
40
|
}
|
|
41
|
+
|
|
42
|
+
return transforms.join(" ").trim();
|
|
43
43
|
};
|
|
44
44
|
/**
|
|
45
45
|
* Given the name of a color scale, getColorScale will return an array
|
|
@@ -25,7 +25,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
25
25
|
|
|
26
26
|
// Based on measuring specific character widths
|
|
27
27
|
// as in the following example https://bl.ocks.org/tophtucker/62f93a4658387bb61e4510c37e2e97cf
|
|
28
|
-
//prettier-ignore
|
|
28
|
+
// prettier-ignore
|
|
29
29
|
var fonts = {
|
|
30
30
|
"American Typewriter": {
|
|
31
31
|
widths: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.25, 0.4203125, 0.3296875, 0.6, 0.6375, 0.8015625, 0.8203125, 0.1875, 0.45625, 0.45625, 0.6375, 0.5, 0.2734375, 0.309375, 0.2734375, 0.4390625, 0.6375, 0.6375, 0.6375, 0.6375, 0.6375, 0.6375, 0.6375, 0.6375, 0.6375, 0.6375, 0.2734375, 0.2734375, 0.5, 0.5, 0.5, 0.6, 0.6921875, 0.7640625, 0.6921875, 0.6375, 0.728125, 0.6734375, 0.6203125, 0.7109375, 0.784375, 0.3828125, 0.6421875, 0.7859375, 0.6375, 0.9484375, 0.7640625, 0.65625, 0.6375, 0.65625, 0.7296875, 0.6203125, 0.6375, 0.7109375, 0.740625, 0.940625, 0.784375, 0.7578125, 0.6203125, 0.4375, 0.5, 0.4375, 0.5, 0.5, 0.4921875, 0.5734375, 0.5890625, 0.5109375, 0.6, 0.528125, 0.43125, 0.5578125, 0.6375, 0.3109375, 0.40625, 0.6234375, 0.309375, 0.928125, 0.6375, 0.546875, 0.6, 0.58125, 0.4921875, 0.4921875, 0.4, 0.6203125, 0.625, 0.825, 0.6375, 0.640625, 0.528125, 0.5, 0.5, 0.5, 0.6671875],
|
|
@@ -131,7 +131,7 @@ var fonts = {
|
|
|
131
131
|
widths: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.35, 0.39375, 0.459375, 0.81875, 0.6359375, 1.0765625, 0.759375, 0.26875, 0.4546875, 0.4546875, 0.6359375, 0.81875, 0.3640625, 0.4546875, 0.3640625, 0.4703125, 0.6359375, 0.6359375, 0.6359375, 0.6359375, 0.6359375, 0.6359375, 0.6359375, 0.6359375, 0.6359375, 0.6359375, 0.4546875, 0.4546875, 0.81875, 0.81875, 0.81875, 0.546875, 1, 0.684375, 0.6859375, 0.6984375, 0.771875, 0.6328125, 0.575, 0.7765625, 0.7515625, 0.421875, 0.4546875, 0.69375, 0.5578125, 0.84375, 0.7484375, 0.7875, 0.603125, 0.7875, 0.7, 0.684375, 0.6171875, 0.7328125, 0.684375, 0.9890625, 0.6859375, 0.615625, 0.6859375, 0.4546875, 0.46875, 0.4546875, 0.81875, 0.6421875, 0.6359375, 0.6015625, 0.6234375, 0.521875, 0.6234375, 0.596875, 0.384375, 0.6234375, 0.6328125, 0.275, 0.3765625, 0.5921875, 0.275, 0.9734375, 0.6328125, 0.6078125, 0.6234375, 0.6234375, 0.43125, 0.521875, 0.3953125, 0.6328125, 0.5921875, 0.81875, 0.5921875, 0.5921875, 0.5265625, 0.6359375, 0.4546875, 0.6359375, 0.81875],
|
|
132
132
|
avg: 0.6171875000000003
|
|
133
133
|
}
|
|
134
|
-
}; //https://developer.mozilla.org/en/docs/Web/CSS/length
|
|
134
|
+
}; // https://developer.mozilla.org/en/docs/Web/CSS/length
|
|
135
135
|
// Absolute sizes in pixels for obsolete measurement units.
|
|
136
136
|
|
|
137
137
|
var absoluteMeasurementUnitsToPixels = {
|
|
@@ -357,9 +357,9 @@ function getTransitionPropsFactory(props, state, setState) {
|
|
|
357
357
|
if (defaultTransitions) {
|
|
358
358
|
var animationDuration = animate[type] && animate[type].duration;
|
|
359
359
|
return animationDuration !== undefined ? animationDuration : defaultTransitions[type] && defaultTransitions[type].duration;
|
|
360
|
-
} else {
|
|
361
|
-
return {};
|
|
362
360
|
}
|
|
361
|
+
|
|
362
|
+
return {};
|
|
363
363
|
}; // eslint-disable-next-line max-statements, complexity, max-len
|
|
364
364
|
|
|
365
365
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { VictoryProviderProps } from "victory-
|
|
2
|
+
import { VictoryProviderProps } from "../victory-state";
|
|
3
3
|
import { VictoryCommonProps } from "./common-props";
|
|
4
4
|
export declare function withContainer<Props extends VictoryCommonProps>(WrappedComponent: (props: Props) => React.ReactElement, initialProviderProps?: Partial<VictoryProviderProps>): (props: Props) => JSX.Element;
|
|
5
5
|
//# sourceMappingURL=with-container.d.ts.map
|
|
@@ -7,7 +7,9 @@ exports.withContainer = withContainer;
|
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _victoryState = require("../victory-state");
|
|
11
|
+
|
|
12
|
+
var _victoryContainer = require("../victory-container/victory-container");
|
|
11
13
|
|
|
12
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
15
|
|
|
@@ -32,10 +34,10 @@ function withContainer(WrappedComponent) {
|
|
|
32
34
|
var _props$standalone = props.standalone,
|
|
33
35
|
standalone = _props$standalone === void 0 ? true : _props$standalone,
|
|
34
36
|
_props$containerCompo = props.containerComponent,
|
|
35
|
-
containerComponent = _props$containerCompo === void 0 ? /*#__PURE__*/_react.default.createElement(
|
|
37
|
+
containerComponent = _props$containerCompo === void 0 ? /*#__PURE__*/_react.default.createElement(_victoryContainer.VictoryContainer, null) : _props$containerCompo;
|
|
36
38
|
|
|
37
39
|
if (standalone) {
|
|
38
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
40
|
+
return /*#__PURE__*/_react.default.createElement(_victoryState.VictoryProvider, providerProps, /*#__PURE__*/_react.default.cloneElement(containerComponent, providerProps, /*#__PURE__*/_react.default.createElement(WrappedComponent, props)));
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
return /*#__PURE__*/_react.default.createElement(WrappedComponent, props);
|
|
@@ -292,9 +292,9 @@ function getDomainFromChildren(props, axis, childComponents) {
|
|
|
292
292
|
return null;
|
|
293
293
|
} else if (child.type && (0, _isFunction2.default)(child.type.getDomain)) {
|
|
294
294
|
return child.props && child.type.getDomain(sharedProps, axis);
|
|
295
|
-
} else {
|
|
296
|
-
return Domain.getDomain(sharedProps, axis);
|
|
297
295
|
}
|
|
296
|
+
|
|
297
|
+
return Domain.getDomain(sharedProps, axis);
|
|
298
298
|
};
|
|
299
299
|
|
|
300
300
|
var childDomains = Helpers.reduceChildren(children, iteratee, props);
|
|
@@ -419,13 +419,13 @@ function getStringsFromCategories(childComponents, axis) {
|
|
|
419
419
|
|
|
420
420
|
if (!Domain.isDomainComponent(child) || !childProps.categories) {
|
|
421
421
|
return null;
|
|
422
|
-
} else {
|
|
423
|
-
var categories = childProps.categories && !Array.isArray(childProps.categories) ? childProps.categories[axis] : childProps.props.categories;
|
|
424
|
-
var categoryStrings = categories && categories.filter(function (val) {
|
|
425
|
-
return typeof val === "string";
|
|
426
|
-
});
|
|
427
|
-
return categoryStrings ? Collection.removeUndefined(categoryStrings) : [];
|
|
428
422
|
}
|
|
423
|
+
|
|
424
|
+
var categories = childProps.categories && !Array.isArray(childProps.categories) ? childProps.categories[axis] : childProps.props.categories;
|
|
425
|
+
var categoryStrings = categories && categories.filter(function (val) {
|
|
426
|
+
return typeof val === "string";
|
|
427
|
+
});
|
|
428
|
+
return categoryStrings ? Collection.removeUndefined(categoryStrings) : [];
|
|
429
429
|
};
|
|
430
430
|
|
|
431
431
|
return Helpers.reduceChildren(childComponents.slice(0), iteratee);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "victory-core",
|
|
3
|
-
"version": "36.
|
|
3
|
+
"version": "36.6.0",
|
|
4
4
|
"description": "Victory Core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data visualization",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"url": "https://github.com/formidablelabs/victory.git"
|
|
14
14
|
},
|
|
15
15
|
"homepage": "https://formidable.com/open-source/victory",
|
|
16
|
+
"sideEffects": false,
|
|
16
17
|
"main": "lib/index.js",
|
|
17
18
|
"module": "es/index.js",
|
|
18
19
|
"jsnext:main": "es/index.js",
|
|
@@ -22,14 +23,258 @@
|
|
|
22
23
|
"lodash": "^4.17.21",
|
|
23
24
|
"prop-types": "^15.8.1",
|
|
24
25
|
"react-fast-compare": "^3.2.0",
|
|
25
|
-
"victory-vendor": "^36.
|
|
26
|
+
"victory-vendor": "^36.6.0"
|
|
26
27
|
},
|
|
27
28
|
"peerDependencies": {
|
|
28
29
|
"react": ">=16.6.0"
|
|
29
30
|
},
|
|
30
|
-
"
|
|
31
|
-
"
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"victory-axis": "*",
|
|
33
|
+
"victory-bar": "*",
|
|
34
|
+
"victory-core": "*",
|
|
35
|
+
"victory-line": "*"
|
|
32
36
|
},
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
}
|
|
37
|
+
"wireit": {
|
|
38
|
+
"### THESE WIREIT CONFIGS ARE GENERATED ####": {},
|
|
39
|
+
"### DO NOT MODIFY THESE MANUALLY ####": {},
|
|
40
|
+
"build": {
|
|
41
|
+
"dependencies": [
|
|
42
|
+
"build:lib",
|
|
43
|
+
"build:dist",
|
|
44
|
+
"types:create"
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
"build:lib": {
|
|
48
|
+
"dependencies": [
|
|
49
|
+
"build:lib:esm",
|
|
50
|
+
"build:lib:cjs"
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
"build:lib:esm": {
|
|
54
|
+
"command": "nps build:lib:esm",
|
|
55
|
+
"files": [
|
|
56
|
+
"src/**",
|
|
57
|
+
"!src/**/*.test.*",
|
|
58
|
+
"../../.babelrc.build.js"
|
|
59
|
+
],
|
|
60
|
+
"output": [
|
|
61
|
+
"es/**/*.js",
|
|
62
|
+
"es/**/*.js.map"
|
|
63
|
+
],
|
|
64
|
+
"dependencies": [
|
|
65
|
+
"../victory-vendor:build:lib:esm"
|
|
66
|
+
],
|
|
67
|
+
"packageLocks": [
|
|
68
|
+
"pnpm-lock.yaml"
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
"build:lib:cjs": {
|
|
72
|
+
"command": "nps build:lib:cjs",
|
|
73
|
+
"files": [
|
|
74
|
+
"src/**",
|
|
75
|
+
"!src/**/*.test.*",
|
|
76
|
+
"../../.babelrc.build.js"
|
|
77
|
+
],
|
|
78
|
+
"output": [
|
|
79
|
+
"lib/**/*.js",
|
|
80
|
+
"lib/**/*.js.map"
|
|
81
|
+
],
|
|
82
|
+
"dependencies": [
|
|
83
|
+
"../victory-vendor:build:lib:cjs"
|
|
84
|
+
],
|
|
85
|
+
"packageLocks": [
|
|
86
|
+
"pnpm-lock.yaml"
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
"build:dist": {
|
|
90
|
+
"dependencies": [
|
|
91
|
+
"build:dist:dev",
|
|
92
|
+
"build:dist:min"
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
"build:dist:dev": {
|
|
96
|
+
"command": "nps build:dist:dev",
|
|
97
|
+
"files": [
|
|
98
|
+
"src/**",
|
|
99
|
+
"!src/**/*.test.*",
|
|
100
|
+
"../../.babelrc.build.js",
|
|
101
|
+
"../../config/webpack.config.js",
|
|
102
|
+
"../../config/webpack.config.dev.js"
|
|
103
|
+
],
|
|
104
|
+
"output": [
|
|
105
|
+
"dist/victory*.js",
|
|
106
|
+
"!dist/victory*.min.js*"
|
|
107
|
+
],
|
|
108
|
+
"dependencies": [
|
|
109
|
+
"../victory-vendor:build:lib:esm"
|
|
110
|
+
],
|
|
111
|
+
"packageLocks": [
|
|
112
|
+
"pnpm-lock.yaml"
|
|
113
|
+
]
|
|
114
|
+
},
|
|
115
|
+
"build:dist:min": {
|
|
116
|
+
"command": "nps build:dist:min",
|
|
117
|
+
"files": [
|
|
118
|
+
"src/**",
|
|
119
|
+
"!src/**/*.test.*",
|
|
120
|
+
"../../.babelrc.build.js",
|
|
121
|
+
"../../config/webpack.config.js"
|
|
122
|
+
],
|
|
123
|
+
"output": [
|
|
124
|
+
"dist/victory*.min.js*"
|
|
125
|
+
],
|
|
126
|
+
"dependencies": [
|
|
127
|
+
"../victory-vendor:build:lib:esm"
|
|
128
|
+
],
|
|
129
|
+
"packageLocks": [
|
|
130
|
+
"pnpm-lock.yaml"
|
|
131
|
+
]
|
|
132
|
+
},
|
|
133
|
+
"types:check": {
|
|
134
|
+
"command": "nps types:pkg:check",
|
|
135
|
+
"files": [
|
|
136
|
+
"src/**/*.{ts,tsx}",
|
|
137
|
+
"../../tsconfig.base.json",
|
|
138
|
+
"tsconfig.json"
|
|
139
|
+
],
|
|
140
|
+
"dependencies": [
|
|
141
|
+
"types:create",
|
|
142
|
+
"../victory-vendor:types:create",
|
|
143
|
+
"../victory-axis:types:create",
|
|
144
|
+
"../victory-bar:types:create",
|
|
145
|
+
"../victory-line:types:create",
|
|
146
|
+
"../victory-voronoi:types:create"
|
|
147
|
+
],
|
|
148
|
+
"output": [],
|
|
149
|
+
"packageLocks": [
|
|
150
|
+
"pnpm-lock.yaml"
|
|
151
|
+
]
|
|
152
|
+
},
|
|
153
|
+
"types:create": {
|
|
154
|
+
"command": "nps types:pkg:create",
|
|
155
|
+
"files": [
|
|
156
|
+
"src/**",
|
|
157
|
+
"!src/**/*.test.*",
|
|
158
|
+
"../../tsconfig.base.json",
|
|
159
|
+
"tsconfig.build.json"
|
|
160
|
+
],
|
|
161
|
+
"output": [
|
|
162
|
+
"es/**/*.d.ts",
|
|
163
|
+
"es/**/*.d.ts.map",
|
|
164
|
+
"lib/**/*.d.ts",
|
|
165
|
+
"lib/**/*.d.ts.map"
|
|
166
|
+
],
|
|
167
|
+
"dependencies": [
|
|
168
|
+
"../victory-vendor:types:create"
|
|
169
|
+
],
|
|
170
|
+
"packageLocks": [
|
|
171
|
+
"pnpm-lock.yaml"
|
|
172
|
+
]
|
|
173
|
+
},
|
|
174
|
+
"format": {
|
|
175
|
+
"command": "nps format:pkg",
|
|
176
|
+
"files": [
|
|
177
|
+
"src/**",
|
|
178
|
+
"*.json",
|
|
179
|
+
"../../.prettierignore",
|
|
180
|
+
"../../.prettierrc.json"
|
|
181
|
+
],
|
|
182
|
+
"output": [],
|
|
183
|
+
"packageLocks": [
|
|
184
|
+
"pnpm-lock.yaml"
|
|
185
|
+
]
|
|
186
|
+
},
|
|
187
|
+
"lint": {
|
|
188
|
+
"command": "nps lint:pkg",
|
|
189
|
+
"files": [
|
|
190
|
+
"src/**",
|
|
191
|
+
"../../.eslintignore",
|
|
192
|
+
"../../.eslintrc.js"
|
|
193
|
+
],
|
|
194
|
+
"output": [],
|
|
195
|
+
"dependencies": [
|
|
196
|
+
"../victory-vendor:build",
|
|
197
|
+
"../victory-vendor:types:create",
|
|
198
|
+
"../victory-axis:types:create",
|
|
199
|
+
"../victory-bar:types:create",
|
|
200
|
+
"../victory-line:types:create",
|
|
201
|
+
"../victory-voronoi:types:create"
|
|
202
|
+
],
|
|
203
|
+
"packageLocks": [
|
|
204
|
+
"pnpm-lock.yaml"
|
|
205
|
+
]
|
|
206
|
+
},
|
|
207
|
+
"format:fix": {
|
|
208
|
+
"command": "pnpm run format || nps format:pkg:fix",
|
|
209
|
+
"files": [
|
|
210
|
+
"src/**",
|
|
211
|
+
"*.json",
|
|
212
|
+
"../../.prettierignore",
|
|
213
|
+
"../../.prettierrc.json"
|
|
214
|
+
],
|
|
215
|
+
"output": [],
|
|
216
|
+
"packageLocks": [
|
|
217
|
+
"pnpm-lock.yaml"
|
|
218
|
+
]
|
|
219
|
+
},
|
|
220
|
+
"lint:fix": {
|
|
221
|
+
"command": "pnpm run lint || nps lint:pkg:fix",
|
|
222
|
+
"files": [
|
|
223
|
+
"src/**",
|
|
224
|
+
"../../.eslintignore",
|
|
225
|
+
"../../.eslintrc.js"
|
|
226
|
+
],
|
|
227
|
+
"output": [],
|
|
228
|
+
"dependencies": [
|
|
229
|
+
"../victory-vendor:build",
|
|
230
|
+
"../victory-vendor:types:create",
|
|
231
|
+
"../victory-axis:types:create",
|
|
232
|
+
"../victory-bar:types:create",
|
|
233
|
+
"../victory-line:types:create",
|
|
234
|
+
"../victory-voronoi:types:create"
|
|
235
|
+
],
|
|
236
|
+
"packageLocks": [
|
|
237
|
+
"pnpm-lock.yaml"
|
|
238
|
+
]
|
|
239
|
+
},
|
|
240
|
+
"jest": {
|
|
241
|
+
"command": "nps jest:pkg",
|
|
242
|
+
"files": [
|
|
243
|
+
"src/**/*.test.*",
|
|
244
|
+
"../../.babelrc.js",
|
|
245
|
+
"../../test/jest-config.js",
|
|
246
|
+
"../../test/jest-setup.ts"
|
|
247
|
+
],
|
|
248
|
+
"output": [],
|
|
249
|
+
"dependencies": [
|
|
250
|
+
"build:lib:cjs",
|
|
251
|
+
"../victory-axis:build:lib:cjs",
|
|
252
|
+
"../victory-bar:build:lib:cjs",
|
|
253
|
+
"../victory-line:build:lib:cjs",
|
|
254
|
+
"../victory-vendor:build:lib:cjs",
|
|
255
|
+
"../victory-voronoi:build:lib:cjs"
|
|
256
|
+
],
|
|
257
|
+
"packageLocks": [
|
|
258
|
+
"pnpm-lock.yaml"
|
|
259
|
+
]
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
"scripts": {
|
|
263
|
+
"### THESE SCRIPTS ARE GENERATED ###": "true",
|
|
264
|
+
"### DO NOT MODIFY THESE MANUALLY ###": "true",
|
|
265
|
+
"build": "wireit",
|
|
266
|
+
"build:lib": "wireit",
|
|
267
|
+
"build:lib:esm": "wireit",
|
|
268
|
+
"build:lib:cjs": "wireit",
|
|
269
|
+
"build:dist": "wireit",
|
|
270
|
+
"build:dist:dev": "wireit",
|
|
271
|
+
"build:dist:min": "wireit",
|
|
272
|
+
"types:check": "wireit",
|
|
273
|
+
"types:create": "wireit",
|
|
274
|
+
"format": "wireit",
|
|
275
|
+
"format:fix": "wireit",
|
|
276
|
+
"lint": "wireit",
|
|
277
|
+
"lint:fix": "wireit",
|
|
278
|
+
"jest": "wireit"
|
|
279
|
+
}
|
|
280
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -12,9 +12,7 @@ export * from "./victory-portal/portal";
|
|
|
12
12
|
export * from "./victory-portal/portal-context";
|
|
13
13
|
export * from "./victory-portal/victory-portal";
|
|
14
14
|
export * from "./victory-primitives";
|
|
15
|
-
export {
|
|
16
|
-
|
|
17
|
-
type BorderProps as BoxProps,
|
|
18
|
-
} from "./victory-primitives";
|
|
15
|
+
export { Border as Box } from "./victory-primitives";
|
|
16
|
+
export type { BorderProps as BoxProps } from "./victory-primitives";
|
|
19
17
|
export * from "./victory-util";
|
|
20
18
|
export * from "./victory-state";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*eslint no-magic-numbers: ["error", { "ignore": [-0.5, 0.5, 0, 1, 2] }]*/
|
|
1
|
+
/* eslint no-magic-numbers: ["error", { "ignore": [-0.5, 0.5, 0, 1, 2] }]*/
|
|
2
2
|
import { assign, defaults, isEmpty } from "lodash";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import React from "react";
|
|
@@ -89,13 +89,12 @@ const getFontSize = (style) => {
|
|
|
89
89
|
} else if (baseSize === undefined || baseSize === null) {
|
|
90
90
|
return defaultStyles.fontSize;
|
|
91
91
|
} else if (typeof baseSize === "string") {
|
|
92
|
-
const fontSize =
|
|
92
|
+
const fontSize = Number(baseSize.replace("px", ""));
|
|
93
93
|
if (!isNaN(fontSize)) {
|
|
94
94
|
return fontSize;
|
|
95
|
-
} else {
|
|
96
|
-
Log.warn("fontSize should be expressed as a number of pixels");
|
|
97
|
-
return defaultStyles.fontSize;
|
|
98
95
|
}
|
|
96
|
+
Log.warn("fontSize should be expressed as a number of pixels");
|
|
97
|
+
return defaultStyles.fontSize;
|
|
99
98
|
}
|
|
100
99
|
return defaultStyles.fontSize;
|
|
101
100
|
};
|
|
@@ -146,19 +145,17 @@ const getBackgroundPadding = (props) => {
|
|
|
146
145
|
const padding = Helpers.evaluateProp(backgroundPadding, props);
|
|
147
146
|
return Helpers.getPadding({ padding });
|
|
148
147
|
});
|
|
149
|
-
} else {
|
|
150
|
-
const padding = Helpers.evaluateProp(props.backgroundPadding, props);
|
|
151
|
-
return Helpers.getPadding({ padding });
|
|
152
148
|
}
|
|
149
|
+
const padding = Helpers.evaluateProp(props.backgroundPadding, props);
|
|
150
|
+
return Helpers.getPadding({ padding });
|
|
153
151
|
};
|
|
154
152
|
|
|
155
153
|
const getLineHeight = (props) => {
|
|
156
154
|
const lineHeight = Helpers.evaluateProp(props.lineHeight, props);
|
|
157
155
|
if (Array.isArray(lineHeight)) {
|
|
158
156
|
return isEmpty(lineHeight) ? [1] : lineHeight;
|
|
159
|
-
} else {
|
|
160
|
-
return lineHeight;
|
|
161
157
|
}
|
|
158
|
+
return lineHeight;
|
|
162
159
|
};
|
|
163
160
|
|
|
164
161
|
const getContent = (text, props) => {
|
|
@@ -200,20 +197,19 @@ const getDy = (props, verticalAnchor, lineHeight) => {
|
|
|
200
197
|
? dy + (capHeight / 2 + (0.5 - length) * lineHeights[0]) * fontSizes[0]
|
|
201
198
|
: dy +
|
|
202
199
|
(capHeight / 2 + (0.5 - length / 2) * lineHeights[0]) * fontSizes[0];
|
|
203
|
-
} else {
|
|
204
|
-
const allHeights = [...Array(length).keys()].reduce((memo, i) => {
|
|
205
|
-
return (
|
|
206
|
-
memo +
|
|
207
|
-
((capHeight / 2 + (0.5 - length) * lineHeights[i]) * fontSizes[i]) /
|
|
208
|
-
length
|
|
209
|
-
);
|
|
210
|
-
}, 0);
|
|
211
|
-
return anchor === "end"
|
|
212
|
-
? dy + allHeights
|
|
213
|
-
: dy +
|
|
214
|
-
allHeights / 2 +
|
|
215
|
-
(capHeight / 2) * lineHeights[length - 1] * fontSizes[length - 1];
|
|
216
200
|
}
|
|
201
|
+
const allHeights = [...Array(length).keys()].reduce((memo, i) => {
|
|
202
|
+
return (
|
|
203
|
+
memo +
|
|
204
|
+
((capHeight / 2 + (0.5 - length) * lineHeights[i]) * fontSizes[i]) /
|
|
205
|
+
length
|
|
206
|
+
);
|
|
207
|
+
}, 0);
|
|
208
|
+
return anchor === "end"
|
|
209
|
+
? dy + allHeights
|
|
210
|
+
: dy +
|
|
211
|
+
allHeights / 2 +
|
|
212
|
+
(capHeight / 2) * lineHeights[length - 1] * fontSizes[length - 1];
|
|
217
213
|
};
|
|
218
214
|
|
|
219
215
|
const getTransform = (props, x, y) => {
|
|
@@ -455,9 +451,8 @@ const getTSpanDy = (tspanValues, calculatedProps, i) => {
|
|
|
455
451
|
return calculateSpanDy(tspanValues, i, calculatedProps);
|
|
456
452
|
} else if (inline) {
|
|
457
453
|
return i === 0 ? current.backgroundPadding.top : undefined;
|
|
458
|
-
} else {
|
|
459
|
-
return current.backgroundPadding.top;
|
|
460
454
|
}
|
|
455
|
+
return current.backgroundPadding.top;
|
|
461
456
|
};
|
|
462
457
|
|
|
463
458
|
const evaluateProps = (props) => {
|
|
@@ -73,7 +73,7 @@ export class VictoryTransition extends React.Component<
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
componentDidMount() {
|
|
76
|
-
this.setState({ nodesShouldLoad: true }); //eslint-disable-line react/no-did-mount-set-state
|
|
76
|
+
this.setState({ nodesShouldLoad: true }); // eslint-disable-line react/no-did-mount-set-state
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
shouldComponentUpdate(nextProps: VictoryTransitionProps) {
|
|
@@ -101,24 +101,23 @@ export class VictoryTransition extends React.Component<
|
|
|
101
101
|
const state = animate.parentState;
|
|
102
102
|
const oldProps = state.nodesWillExit ? props : null;
|
|
103
103
|
return { oldProps, nextProps };
|
|
104
|
-
} else {
|
|
105
|
-
const oldChildren = React.Children.toArray(props.children);
|
|
106
|
-
const nextChildren = React.Children.toArray(nextProps.children);
|
|
107
|
-
const {
|
|
108
|
-
nodesWillExit,
|
|
109
|
-
nodesWillEnter,
|
|
110
|
-
childrenTransitions,
|
|
111
|
-
nodesShouldEnter,
|
|
112
|
-
} = Transitions.getInitialTransitionState(oldChildren, nextChildren);
|
|
113
|
-
return {
|
|
114
|
-
nodesWillExit,
|
|
115
|
-
nodesWillEnter,
|
|
116
|
-
childrenTransitions,
|
|
117
|
-
nodesShouldEnter,
|
|
118
|
-
oldProps: nodesWillExit ? props : null,
|
|
119
|
-
nextProps,
|
|
120
|
-
};
|
|
121
104
|
}
|
|
105
|
+
const oldChildren = React.Children.toArray(props.children);
|
|
106
|
+
const nextChildren = React.Children.toArray(nextProps.children);
|
|
107
|
+
const {
|
|
108
|
+
nodesWillExit,
|
|
109
|
+
nodesWillEnter,
|
|
110
|
+
childrenTransitions,
|
|
111
|
+
nodesShouldEnter,
|
|
112
|
+
} = Transitions.getInitialTransitionState(oldChildren, nextChildren);
|
|
113
|
+
return {
|
|
114
|
+
nodesWillExit,
|
|
115
|
+
nodesWillEnter,
|
|
116
|
+
childrenTransitions,
|
|
117
|
+
nodesShouldEnter,
|
|
118
|
+
oldProps: nodesWillExit ? props : null,
|
|
119
|
+
nextProps,
|
|
120
|
+
};
|
|
122
121
|
}
|
|
123
122
|
|
|
124
123
|
private getDomainFromChildren(
|
|
@@ -149,15 +148,14 @@ export class VictoryTransition extends React.Component<
|
|
|
149
148
|
: childProps.domain && childProps.domain[axis];
|
|
150
149
|
if (!childProps.children && domain) {
|
|
151
150
|
return domain;
|
|
152
|
-
} else {
|
|
153
|
-
const childDomains = getChildDomains([child]);
|
|
154
|
-
return childDomains.length === 0
|
|
155
|
-
? [0, 1]
|
|
156
|
-
: [
|
|
157
|
-
Collection.getMinValue(childDomains),
|
|
158
|
-
Collection.getMaxValue(childDomains),
|
|
159
|
-
];
|
|
160
151
|
}
|
|
152
|
+
const childDomains = getChildDomains([child]);
|
|
153
|
+
return childDomains.length === 0
|
|
154
|
+
? [0, 1]
|
|
155
|
+
: [
|
|
156
|
+
Collection.getMinValue(childDomains),
|
|
157
|
+
Collection.getMaxValue(childDomains),
|
|
158
|
+
];
|
|
161
159
|
}
|
|
162
160
|
|
|
163
161
|
pickProps() {
|