victory-core 36.3.2 → 36.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/victory-core.js +14175 -14191
- package/dist/victory-core.min.js +1 -1
- package/es/victory-accessible-group/victory-accessible-group.js +38 -40
- package/es/victory-animation/util.js +1 -1
- package/es/victory-animation/victory-animation.js +46 -48
- package/es/victory-clip-container/victory-clip-container.js +71 -73
- package/es/victory-container/victory-container.js +82 -92
- package/es/victory-label/victory-label.js +29 -24
- package/es/victory-portal/portal-context.js +1 -1
- package/es/victory-portal/portal.js +28 -26
- package/es/victory-portal/victory-portal.js +31 -41
- package/es/victory-primitives/arc.js +6 -4
- package/es/victory-primitives/background.js +8 -6
- package/es/victory-primitives/border.js +6 -4
- package/es/victory-primitives/circle.js +8 -4
- package/es/victory-primitives/clip-path.js +1 -1
- package/es/victory-primitives/line-segment.js +6 -4
- package/es/victory-primitives/line.js +8 -4
- package/es/victory-primitives/path.js +7 -3
- package/es/victory-primitives/point.js +6 -4
- package/es/victory-primitives/rect.js +8 -4
- package/es/victory-primitives/text.js +7 -3
- package/es/victory-primitives/tspan.js +1 -1
- package/es/victory-primitives/whisker.js +9 -7
- package/es/victory-transition/victory-transition.js +30 -32
- package/es/victory-util/add-events.js +326 -317
- package/es/victory-util/axis.js +12 -5
- package/es/victory-util/collection.js +8 -4
- package/es/victory-util/data.js +9 -5
- package/es/victory-util/domain.js +8 -4
- package/es/victory-util/events.js +8 -4
- package/es/victory-util/helpers.js +1 -1
- package/es/victory-util/hooks/use-animation-state.js +11 -5
- package/es/victory-util/line-helpers.js +1 -1
- package/es/victory-util/scale.js +19 -19
- package/es/victory-util/textsize.js +11 -7
- package/es/victory-util/timer-context.js +1 -1
- package/es/victory-util/timer.js +3 -5
- package/es/victory-util/user-props.js +31 -4
- package/es/victory-util/wrapper.js +18 -12
- package/lib/index.js +68 -58
- package/lib/victory-accessible-group/victory-accessible-group.js +38 -40
- package/lib/victory-animation/util.js +2 -2
- package/lib/victory-animation/victory-animation.js +49 -49
- package/lib/victory-clip-container/victory-clip-container.js +74 -74
- package/lib/victory-container/victory-container.js +85 -93
- package/lib/victory-label/victory-label.js +35 -27
- package/lib/victory-portal/portal-context.js +1 -1
- package/lib/victory-portal/portal.js +31 -27
- package/lib/victory-portal/victory-portal.js +34 -42
- package/lib/victory-primitives/arc.js +9 -5
- package/lib/victory-primitives/background.js +11 -7
- package/lib/victory-primitives/border.js +9 -5
- package/lib/victory-primitives/circle.js +8 -4
- package/lib/victory-primitives/clip-path.js +1 -1
- package/lib/victory-primitives/line-segment.js +9 -5
- package/lib/victory-primitives/line.js +8 -4
- package/lib/victory-primitives/path.js +7 -3
- package/lib/victory-primitives/point.js +9 -5
- package/lib/victory-primitives/rect.js +8 -4
- package/lib/victory-primitives/text.js +7 -3
- package/lib/victory-primitives/tspan.js +1 -1
- package/lib/victory-primitives/whisker.js +12 -8
- package/lib/victory-transition/victory-transition.js +33 -33
- package/lib/victory-util/add-events.js +325 -313
- package/lib/victory-util/axis.js +20 -11
- package/lib/victory-util/collection.js +11 -7
- package/lib/victory-util/common-props.js +4 -2
- package/lib/victory-util/data.js +13 -7
- package/lib/victory-util/default-transitions.js +1 -1
- package/lib/victory-util/domain.js +11 -5
- package/lib/victory-util/events.js +17 -11
- package/lib/victory-util/helpers.js +14 -14
- package/lib/victory-util/hooks/index.js +4 -4
- package/lib/victory-util/hooks/use-animation-state.js +14 -6
- package/lib/victory-util/immutable.js +3 -3
- package/lib/victory-util/label-helpers.js +6 -4
- package/lib/victory-util/line-helpers.js +4 -2
- package/lib/victory-util/prop-types.js +5 -3
- package/lib/victory-util/scale.js +24 -21
- package/lib/victory-util/selection.js +6 -4
- package/lib/victory-util/textsize.js +12 -8
- package/lib/victory-util/timer-context.js +1 -1
- package/lib/victory-util/timer.js +3 -5
- package/lib/victory-util/user-props.js +31 -4
- package/lib/victory-util/wrapper.js +31 -23
- package/package.json +4 -11
- package/src/victory-animation/util.js +1 -1
- package/src/victory-animation/victory-animation.js +1 -1
- package/src/victory-label/victory-label.js +6 -6
- package/src/victory-util/axis.js +3 -0
- package/src/victory-util/line-helpers.js +1 -1
- package/src/victory-util/scale.js +18 -9
- package/src/victory-util/timer.js +1 -1
- package/src/victory-util/user-props.js +18 -1
package/es/victory-util/axis.js
CHANGED
|
@@ -11,13 +11,17 @@ import _identity from "lodash/identity";
|
|
|
11
11
|
import _defaults from "lodash/defaults";
|
|
12
12
|
import _assign from "lodash/assign";
|
|
13
13
|
|
|
14
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
|
|
14
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
15
15
|
|
|
16
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
|
|
16
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
17
17
|
|
|
18
|
-
function
|
|
18
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
19
19
|
|
|
20
|
-
function
|
|
20
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
21
|
+
|
|
22
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
23
|
+
|
|
24
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
21
25
|
|
|
22
26
|
/* eslint-disable func-style */
|
|
23
27
|
import React from "react";
|
|
@@ -251,7 +255,10 @@ export function getTickFormat(props, scale) {
|
|
|
251
255
|
var stringMap = props.stringMap && props.stringMap[axis];
|
|
252
256
|
|
|
253
257
|
if (!tickFormat) {
|
|
254
|
-
var defaultTickFormat = getDefaultTickFormat(props);
|
|
258
|
+
var defaultTickFormat = getDefaultTickFormat(props); // If there is no user-provided tick format, we use d3's tickFormat function
|
|
259
|
+
// by default. This changed the default formatting for some scale types when
|
|
260
|
+
// we upgraded to d3-scale@4..
|
|
261
|
+
|
|
255
262
|
var scaleTickFormat = scale.tickFormat && _isFunction(scale.tickFormat) ? scale.tickFormat() : function (x) {
|
|
256
263
|
return x;
|
|
257
264
|
};
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
2
|
|
|
3
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
4
|
|
|
5
|
-
function
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
6
|
|
|
7
|
-
function
|
|
7
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
|
+
|
|
9
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
|
+
|
|
11
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
8
12
|
|
|
9
13
|
/* eslint-disable func-style */
|
|
10
14
|
|
package/es/victory-util/data.js
CHANGED
|
@@ -12,13 +12,17 @@ import _range from "lodash/range";
|
|
|
12
12
|
import _uniq from "lodash/uniq";
|
|
13
13
|
import _assign from "lodash/assign";
|
|
14
14
|
|
|
15
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
|
|
15
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
16
16
|
|
|
17
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
|
|
17
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
18
18
|
|
|
19
|
-
function
|
|
19
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
20
20
|
|
|
21
|
-
function
|
|
21
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
22
|
+
|
|
23
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
24
|
+
|
|
25
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
22
26
|
|
|
23
27
|
/* eslint-disable func-style */
|
|
24
28
|
|
|
@@ -212,7 +216,7 @@ export function createStringMap(props, axis) {
|
|
|
212
216
|
var stringsFromCategories = getStringsFromCategories(props, axis);
|
|
213
217
|
var stringsFromData = getStringsFromData(props, axis);
|
|
214
218
|
|
|
215
|
-
var allStrings = _uniq(_toConsumableArray(stringsFromAxes)
|
|
219
|
+
var allStrings = _uniq([].concat(_toConsumableArray(stringsFromAxes), _toConsumableArray(stringsFromCategories), _toConsumableArray(stringsFromData)));
|
|
216
220
|
|
|
217
221
|
return allStrings.length === 0 ? null : allStrings.reduce(function (memo, string, index) {
|
|
218
222
|
memo[string] = index + 1;
|
|
@@ -5,13 +5,17 @@ import _sortedUniq from "lodash/sortedUniq";
|
|
|
5
5
|
import _isPlainObject from "lodash/isPlainObject";
|
|
6
6
|
import _flatten from "lodash/flatten";
|
|
7
7
|
|
|
8
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
|
|
8
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
9
9
|
|
|
10
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
|
|
10
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
11
|
|
|
12
|
-
function
|
|
12
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
13
13
|
|
|
14
|
-
function
|
|
14
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
15
|
+
|
|
16
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
17
|
+
|
|
18
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
15
19
|
|
|
16
20
|
/* eslint-disable func-style */
|
|
17
21
|
|
|
@@ -10,13 +10,17 @@ import _assign from "lodash/assign";
|
|
|
10
10
|
|
|
11
11
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
12
|
|
|
13
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
|
|
13
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
14
14
|
|
|
15
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
|
|
15
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
16
16
|
|
|
17
|
-
function
|
|
17
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
18
18
|
|
|
19
|
-
function
|
|
19
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
20
|
+
|
|
21
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
22
|
+
|
|
23
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
20
24
|
|
|
21
25
|
var GLOBAL_EVENT_REGEX = /^onGlobal(.*)$/;
|
|
22
26
|
/* Returns all own and shared events that should be attached to a single target element,
|
|
@@ -295,7 +295,7 @@ export function reduceChildren(children, iteratee) {
|
|
|
295
295
|
var nestedChildren = child.type && child.type.role === "stack" && _isFunction(child.type.getChildren) ? child.type.getChildren(childProps) : React.Children.toArray(child.props.children).map(function (c) {
|
|
296
296
|
var nestedChildProps = _assign({}, c.props, _pick(childProps, sharedProps));
|
|
297
297
|
|
|
298
|
-
return React.cloneElement(c, nestedChildProps);
|
|
298
|
+
return /*#__PURE__*/React.cloneElement(c, nestedChildProps);
|
|
299
299
|
});
|
|
300
300
|
|
|
301
301
|
var _childNames = nestedChildren.map(function (c, i) {
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import _some from "lodash/some";
|
|
2
2
|
import _defaults from "lodash/defaults";
|
|
3
3
|
|
|
4
|
-
function
|
|
4
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
+
|
|
6
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
7
|
|
|
6
8
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
9
|
|
|
8
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
|
|
10
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
|
+
|
|
12
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
|
+
|
|
14
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
9
15
|
|
|
10
|
-
function
|
|
16
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
11
17
|
|
|
12
|
-
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e
|
|
18
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
13
19
|
|
|
14
20
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
21
|
|
|
@@ -32,7 +38,7 @@ export var useAnimationState = function () {
|
|
|
32
38
|
|
|
33
39
|
var setState = React.useCallback(function (newState) {
|
|
34
40
|
_setState(function (oldState) {
|
|
35
|
-
return _objectSpread({}, oldState, newState);
|
|
41
|
+
return _objectSpread(_objectSpread({}, oldState), newState);
|
|
36
42
|
});
|
|
37
43
|
}, [_setState]); // This is a copy of Wrapper.getAnimationProps
|
|
38
44
|
|
package/es/victory-util/scale.js
CHANGED
|
@@ -3,7 +3,7 @@ import _isFunction from "lodash/isFunction";
|
|
|
3
3
|
import _includes from "lodash/includes";
|
|
4
4
|
import * as Helpers from "./helpers";
|
|
5
5
|
import * as Collection from "./collection";
|
|
6
|
-
import * as d3Scale from "d3-scale";
|
|
6
|
+
import * as d3Scale from "victory-vendor/d3-scale";
|
|
7
7
|
var supportedScaleStrings = ["linear", "time", "log", "sqrt"]; // Private Functions
|
|
8
8
|
|
|
9
9
|
function toNewName(scale) {
|
|
@@ -106,29 +106,29 @@ export function getScaleFromProps(props, axis) {
|
|
|
106
106
|
export function getScaleType(props, axis) {
|
|
107
107
|
// if the scale was not given in props, it will be set to linear or time depending on data
|
|
108
108
|
return getScaleTypeFromProps(props, axis) || getScaleTypeFromData(props, axis);
|
|
109
|
-
}
|
|
109
|
+
} // Ordered type inference off of function fields.
|
|
110
|
+
// **Note**: Brittle because reliant on d3 internals.
|
|
111
|
+
|
|
112
|
+
var DUCK_TYPES = [{
|
|
113
|
+
name: "quantile",
|
|
114
|
+
method: "quantiles"
|
|
115
|
+
}, {
|
|
116
|
+
name: "log",
|
|
117
|
+
method: "base"
|
|
118
|
+
} // TODO(2214): Re-evaluate (1) duck typing approach, and (2) if duck typing,
|
|
119
|
+
// do we need a different approach? (Multiple keys? Stringifying functions?)
|
|
120
|
+
// https://github.com/FormidableLabs/victory/issues/2214
|
|
121
|
+
// Below are matches that don't seem to otherwise occur in Victory code base.
|
|
122
|
+
// { name: "ordinal", method: "unknown" },
|
|
123
|
+
// { name: "pow-sqrt", method: "exponent" },
|
|
124
|
+
// { name: "quantize-threshold", method: "invertExtent" }
|
|
125
|
+
];
|
|
110
126
|
export function getType(scale) {
|
|
111
127
|
if (typeof scale === "string") {
|
|
112
128
|
return scale;
|
|
113
129
|
}
|
|
114
130
|
|
|
115
|
-
var
|
|
116
|
-
name: "log",
|
|
117
|
-
method: "base"
|
|
118
|
-
}, {
|
|
119
|
-
name: "ordinal",
|
|
120
|
-
method: "unknown"
|
|
121
|
-
}, {
|
|
122
|
-
name: "pow-sqrt",
|
|
123
|
-
method: "exponent"
|
|
124
|
-
}, {
|
|
125
|
-
name: "quantile",
|
|
126
|
-
method: "quantiles"
|
|
127
|
-
}, {
|
|
128
|
-
name: "quantize-threshold",
|
|
129
|
-
method: "invertExtent"
|
|
130
|
-
}];
|
|
131
|
-
var scaleType = duckTypes.filter(function (type) {
|
|
131
|
+
var scaleType = DUCK_TYPES.filter(function (type) {
|
|
132
132
|
return scale[type.method] !== undefined;
|
|
133
133
|
})[0];
|
|
134
134
|
return scaleType ? scaleType.name : undefined;
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import _defaults from "lodash/defaults";
|
|
2
2
|
import _assign from "lodash/assign";
|
|
3
3
|
|
|
4
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
|
|
4
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
5
5
|
|
|
6
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
|
|
6
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
7
|
|
|
8
|
-
function
|
|
8
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
9
9
|
|
|
10
|
-
function
|
|
10
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
11
|
+
|
|
12
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
13
|
+
|
|
14
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
11
15
|
|
|
12
16
|
// Based on measuring specific character widths
|
|
13
17
|
// as in the following example https://bl.ocks.org/tophtucker/62f93a4658387bb61e4510c37e2e97cf
|
|
@@ -116,10 +120,10 @@ var fonts = {
|
|
|
116
120
|
Verdana: {
|
|
117
121
|
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],
|
|
118
122
|
avg: 0.6171875000000003
|
|
119
|
-
}
|
|
120
|
-
|
|
123
|
+
}
|
|
124
|
+
}; //https://developer.mozilla.org/en/docs/Web/CSS/length
|
|
125
|
+
// Absolute sizes in pixels for obsolete measurement units.
|
|
121
126
|
|
|
122
|
-
};
|
|
123
127
|
var absoluteMeasurementUnitsToPixels = {
|
|
124
128
|
mm: 3.8,
|
|
125
129
|
sm: 38,
|
package/es/victory-util/timer.js
CHANGED
|
@@ -2,13 +2,11 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
2
2
|
|
|
3
3
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
4
4
|
|
|
5
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
5
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
6
6
|
|
|
7
|
-
import { timer, now } from "d3-timer";
|
|
7
|
+
import { timer, now } from "victory-vendor/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
|
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
2
|
|
|
3
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
4
|
|
|
5
|
-
function
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
8
|
+
|
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
6
10
|
|
|
7
11
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
12
|
|
|
9
|
-
function
|
|
13
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
14
|
+
|
|
15
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
16
|
|
|
11
17
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
18
|
|
|
@@ -61,6 +67,21 @@ var testIfSafeProp = function (key) {
|
|
|
61
67
|
if (doesPropStartWith(key) || isExactMatch(key)) return true;
|
|
62
68
|
return false;
|
|
63
69
|
};
|
|
70
|
+
/**
|
|
71
|
+
* Gets the value from props if a function value is provided
|
|
72
|
+
* @param {any} value: maybe function value
|
|
73
|
+
* @param {Object} props: props object
|
|
74
|
+
* @returns {any} newValue
|
|
75
|
+
*/
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
var getValue = function (value, props) {
|
|
79
|
+
if (typeof value === "function") {
|
|
80
|
+
return value(props);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return value;
|
|
84
|
+
};
|
|
64
85
|
/**
|
|
65
86
|
* getSafeUserProps - function that takes in a props object and removes any
|
|
66
87
|
* key-value entries that do not match filter strings in the USER_PROPS_SAFELIST
|
|
@@ -79,5 +100,11 @@ export var getSafeUserProps = function (props) {
|
|
|
79
100
|
key = _ref2[0];
|
|
80
101
|
|
|
81
102
|
return testIfSafeProp(key);
|
|
103
|
+
}).map(function (_ref3) {
|
|
104
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
105
|
+
key = _ref4[0],
|
|
106
|
+
value = _ref4[1];
|
|
107
|
+
|
|
108
|
+
return [key, getValue(value, props)];
|
|
82
109
|
}));
|
|
83
110
|
};
|
|
@@ -8,15 +8,21 @@ import _flatten from "lodash/flatten";
|
|
|
8
8
|
import _defaults from "lodash/defaults";
|
|
9
9
|
import _assign from "lodash/assign";
|
|
10
10
|
|
|
11
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
|
|
11
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
12
12
|
|
|
13
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
|
|
13
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
14
14
|
|
|
15
|
-
function
|
|
15
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
16
16
|
|
|
17
|
-
function
|
|
17
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
18
18
|
|
|
19
|
-
function
|
|
19
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
20
|
+
|
|
21
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
22
|
+
|
|
23
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
24
|
+
|
|
25
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
20
26
|
|
|
21
27
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
22
28
|
|
|
@@ -76,7 +82,7 @@ export function addBinsToParentPropsIfHistogram(_ref) {
|
|
|
76
82
|
}, []);
|
|
77
83
|
}
|
|
78
84
|
|
|
79
|
-
return _objectSpread({}, parentProps, {
|
|
85
|
+
return _objectSpread(_objectSpread({}, parentProps), {}, {
|
|
80
86
|
bins: childBins
|
|
81
87
|
});
|
|
82
88
|
}
|
|
@@ -112,7 +118,7 @@ export function getDataFromChildren(props, childComponents) {
|
|
|
112
118
|
if (!Data.isDataComponent(child)) {
|
|
113
119
|
return null;
|
|
114
120
|
} else if (child.type && _isFunction(child.type.getData)) {
|
|
115
|
-
child = parent ? React.cloneElement(child, parent.props) : child;
|
|
121
|
+
child = parent ? /*#__PURE__*/React.cloneElement(child, parent.props) : child;
|
|
116
122
|
childData = child.type.getData(childProps);
|
|
117
123
|
} else {
|
|
118
124
|
childData = Data.getData(childProps);
|
|
@@ -259,8 +265,8 @@ export function getDomain(props, axis, childComponents) {
|
|
|
259
265
|
var dataset = (props.data || props.y) && Data.getData(props);
|
|
260
266
|
var dataDomain = dataset ? Domain.getDomainFromData(props, axis, dataset) : [];
|
|
261
267
|
var childDomain = getDomainFromChildren(props, axis, childComponents);
|
|
262
|
-
var min = minDomain || Collection.getMinValue(_toConsumableArray(dataDomain)
|
|
263
|
-
var max = maxDomain || Collection.getMaxValue(_toConsumableArray(dataDomain)
|
|
268
|
+
var min = minDomain || Collection.getMinValue([].concat(_toConsumableArray(dataDomain), _toConsumableArray(childDomain)));
|
|
269
|
+
var max = maxDomain || Collection.getMaxValue([].concat(_toConsumableArray(dataDomain), _toConsumableArray(childDomain)));
|
|
264
270
|
domain = Domain.getDomainFromMinMax(min, max);
|
|
265
271
|
}
|
|
266
272
|
|
|
@@ -417,7 +423,7 @@ export function getCategoryAndAxisStringsFromChildren(props, axis, childComponen
|
|
|
417
423
|
var axisComponent = Axis.getAxisComponent(childComponents, axis);
|
|
418
424
|
var axisStrings = axisComponent ? Data.getStringsFromAxes(axisComponent.props, axis) : [];
|
|
419
425
|
var categoryStrings = categories || getStringsFromCategories(childComponents, axis);
|
|
420
|
-
return _uniq(_flatten(_toConsumableArray(categoryStrings)
|
|
426
|
+
return _uniq(_flatten([].concat(_toConsumableArray(categoryStrings), _toConsumableArray(axisStrings))));
|
|
421
427
|
}
|
|
422
428
|
export function getStringsFromChildren(props, childComponents) {
|
|
423
429
|
childComponents = childComponents || React.Children.toArray(props.children);
|
|
@@ -425,8 +431,8 @@ export function getStringsFromChildren(props, childComponents) {
|
|
|
425
431
|
var yStrings = getCategoryAndAxisStringsFromChildren(props, "y", childComponents);
|
|
426
432
|
var dataStrings = getStringsFromData(childComponents);
|
|
427
433
|
return {
|
|
428
|
-
x: _uniq(_flatten(_toConsumableArray(xStrings)
|
|
429
|
-
y: _uniq(_flatten(_toConsumableArray(yStrings)
|
|
434
|
+
x: _uniq(_flatten([].concat(_toConsumableArray(xStrings), _toConsumableArray(dataStrings.x)))),
|
|
435
|
+
y: _uniq(_flatten([].concat(_toConsumableArray(yStrings), _toConsumableArray(dataStrings.y))))
|
|
430
436
|
};
|
|
431
437
|
}
|
|
432
438
|
export function getCategories(props, childComponents, allStrings) {
|