victory-scatter 36.6.8 → 36.6.11
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 +14 -0
- package/dist/victory-scatter.js +230 -15
- package/dist/victory-scatter.min.js +1 -1
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# victory-scatter
|
|
2
2
|
|
|
3
|
+
## 36.6.11
|
|
4
|
+
|
|
5
|
+
## 36.6.10
|
|
6
|
+
|
|
7
|
+
### Patch Changes
|
|
8
|
+
|
|
9
|
+
- Setup NPM Provenance ([#2590](https://github.com/FormidableLabs/victory/pull/2590))
|
|
10
|
+
|
|
11
|
+
## 36.6.9
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Setup NPM Provenance ([#2587](https://github.com/FormidableLabs/victory/pull/2587))
|
|
16
|
+
|
|
3
17
|
## 36.6.8
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/victory-scatter.js
CHANGED
|
@@ -347,6 +347,48 @@ VictoryScatterBase.getBaseProps = function (props) {
|
|
|
347
347
|
VictoryScatterBase.expectedComponents = ["dataComponent", "labelComponent", "groupComponent", "containerComponent"];
|
|
348
348
|
var VictoryScatter = (0,victory_core__WEBPACK_IMPORTED_MODULE_14__.addEvents)(VictoryScatterBase);
|
|
349
349
|
|
|
350
|
+
/***/ }),
|
|
351
|
+
|
|
352
|
+
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_MapCache.js":
|
|
353
|
+
/*!***********************************************************************************!*\
|
|
354
|
+
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_MapCache.js ***!
|
|
355
|
+
\***********************************************************************************/
|
|
356
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
357
|
+
|
|
358
|
+
var listCacheClear = __webpack_require__(/*! ./_listCacheClear */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheClear.js"),
|
|
359
|
+
listCacheDelete = __webpack_require__(/*! ./_listCacheDelete */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheDelete.js"),
|
|
360
|
+
listCacheGet = __webpack_require__(/*! ./_listCacheGet */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheGet.js"),
|
|
361
|
+
listCacheHas = __webpack_require__(/*! ./_listCacheHas */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheHas.js"),
|
|
362
|
+
listCacheSet = __webpack_require__(/*! ./_listCacheSet */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheSet.js");
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Creates an list cache object.
|
|
366
|
+
*
|
|
367
|
+
* @private
|
|
368
|
+
* @constructor
|
|
369
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
370
|
+
*/
|
|
371
|
+
function ListCache(entries) {
|
|
372
|
+
var index = -1,
|
|
373
|
+
length = entries == null ? 0 : entries.length;
|
|
374
|
+
|
|
375
|
+
this.clear();
|
|
376
|
+
while (++index < length) {
|
|
377
|
+
var entry = entries[index];
|
|
378
|
+
this.set(entry[0], entry[1]);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
// Add methods to `ListCache`.
|
|
383
|
+
ListCache.prototype.clear = listCacheClear;
|
|
384
|
+
ListCache.prototype['delete'] = listCacheDelete;
|
|
385
|
+
ListCache.prototype.get = listCacheGet;
|
|
386
|
+
ListCache.prototype.has = listCacheHas;
|
|
387
|
+
ListCache.prototype.set = listCacheSet;
|
|
388
|
+
|
|
389
|
+
module.exports = ListCache;
|
|
390
|
+
|
|
391
|
+
|
|
350
392
|
/***/ }),
|
|
351
393
|
|
|
352
394
|
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_SetCache.js":
|
|
@@ -4950,6 +4992,89 @@ function last(array) {
|
|
|
4950
4992
|
module.exports = last;
|
|
4951
4993
|
|
|
4952
4994
|
|
|
4995
|
+
/***/ }),
|
|
4996
|
+
|
|
4997
|
+
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/memoize.js":
|
|
4998
|
+
/*!*********************************************************************************!*\
|
|
4999
|
+
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/memoize.js ***!
|
|
5000
|
+
\*********************************************************************************/
|
|
5001
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
5002
|
+
|
|
5003
|
+
var MapCache = __webpack_require__(/*! ./_MapCache */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_MapCache.js");
|
|
5004
|
+
|
|
5005
|
+
/** Error message constants. */
|
|
5006
|
+
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
5007
|
+
|
|
5008
|
+
/**
|
|
5009
|
+
* Creates a function that memoizes the result of `func`. If `resolver` is
|
|
5010
|
+
* provided, it determines the cache key for storing the result based on the
|
|
5011
|
+
* arguments provided to the memoized function. By default, the first argument
|
|
5012
|
+
* provided to the memoized function is used as the map cache key. The `func`
|
|
5013
|
+
* is invoked with the `this` binding of the memoized function.
|
|
5014
|
+
*
|
|
5015
|
+
* **Note:** The cache is exposed as the `cache` property on the memoized
|
|
5016
|
+
* function. Its creation may be customized by replacing the `_.memoize.Cache`
|
|
5017
|
+
* constructor with one whose instances implement the
|
|
5018
|
+
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
|
5019
|
+
* method interface of `clear`, `delete`, `get`, `has`, and `set`.
|
|
5020
|
+
*
|
|
5021
|
+
* @static
|
|
5022
|
+
* @memberOf _
|
|
5023
|
+
* @since 0.1.0
|
|
5024
|
+
* @category Function
|
|
5025
|
+
* @param {Function} func The function to have its output memoized.
|
|
5026
|
+
* @param {Function} [resolver] The function to resolve the cache key.
|
|
5027
|
+
* @returns {Function} Returns the new memoized function.
|
|
5028
|
+
* @example
|
|
5029
|
+
*
|
|
5030
|
+
* var object = { 'a': 1, 'b': 2 };
|
|
5031
|
+
* var other = { 'c': 3, 'd': 4 };
|
|
5032
|
+
*
|
|
5033
|
+
* var values = _.memoize(_.values);
|
|
5034
|
+
* values(object);
|
|
5035
|
+
* // => [1, 2]
|
|
5036
|
+
*
|
|
5037
|
+
* values(other);
|
|
5038
|
+
* // => [3, 4]
|
|
5039
|
+
*
|
|
5040
|
+
* object.a = 2;
|
|
5041
|
+
* values(object);
|
|
5042
|
+
* // => [1, 2]
|
|
5043
|
+
*
|
|
5044
|
+
* // Modify the result cache.
|
|
5045
|
+
* values.cache.set(object, ['a', 'b']);
|
|
5046
|
+
* values(object);
|
|
5047
|
+
* // => ['a', 'b']
|
|
5048
|
+
*
|
|
5049
|
+
* // Replace `_.memoize.Cache`.
|
|
5050
|
+
* _.memoize.Cache = WeakMap;
|
|
5051
|
+
*/
|
|
5052
|
+
function memoize(func, resolver) {
|
|
5053
|
+
if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
|
|
5054
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
5055
|
+
}
|
|
5056
|
+
var memoized = function() {
|
|
5057
|
+
var args = arguments,
|
|
5058
|
+
key = resolver ? resolver.apply(this, args) : args[0],
|
|
5059
|
+
cache = memoized.cache;
|
|
5060
|
+
|
|
5061
|
+
if (cache.has(key)) {
|
|
5062
|
+
return cache.get(key);
|
|
5063
|
+
}
|
|
5064
|
+
var result = func.apply(this, args);
|
|
5065
|
+
memoized.cache = cache.set(key, result) || cache;
|
|
5066
|
+
return result;
|
|
5067
|
+
};
|
|
5068
|
+
memoized.cache = new (memoize.Cache || MapCache);
|
|
5069
|
+
return memoized;
|
|
5070
|
+
}
|
|
5071
|
+
|
|
5072
|
+
// Expose `MapCache`.
|
|
5073
|
+
memoize.Cache = MapCache;
|
|
5074
|
+
|
|
5075
|
+
module.exports = memoize;
|
|
5076
|
+
|
|
5077
|
+
|
|
4953
5078
|
/***/ }),
|
|
4954
5079
|
|
|
4955
5080
|
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/negate.js":
|
|
@@ -13430,13 +13555,24 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
13430
13555
|
/* harmony export */ "approximateTextSize": () => (/* binding */ approximateTextSize),
|
|
13431
13556
|
/* harmony export */ "convertLengthToPixels": () => (/* binding */ convertLengthToPixels)
|
|
13432
13557
|
/* harmony export */ });
|
|
13433
|
-
/* harmony import */ var
|
|
13434
|
-
/* harmony import */ var
|
|
13435
|
-
/* harmony import */ var
|
|
13436
|
-
/* harmony import */ var
|
|
13558
|
+
/* harmony import */ var lodash_memoize__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/memoize */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/memoize.js");
|
|
13559
|
+
/* harmony import */ var lodash_memoize__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_memoize__WEBPACK_IMPORTED_MODULE_0__);
|
|
13560
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/defaults */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/defaults.js");
|
|
13561
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_1__);
|
|
13562
|
+
/* harmony import */ var lodash_assign__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash/assign */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/assign.js");
|
|
13563
|
+
/* harmony import */ var lodash_assign__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_assign__WEBPACK_IMPORTED_MODULE_2__);
|
|
13564
|
+
|
|
13437
13565
|
|
|
13438
13566
|
|
|
13439
13567
|
|
|
13568
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
13569
|
+
|
|
13570
|
+
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."); }
|
|
13571
|
+
|
|
13572
|
+
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; }
|
|
13573
|
+
|
|
13574
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13575
|
+
|
|
13440
13576
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
13441
13577
|
|
|
13442
13578
|
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."); }
|
|
@@ -13640,9 +13776,9 @@ var convertLengthToPixels = function (length, fontSize) {
|
|
|
13640
13776
|
var _prepareParams = function (inputStyle, index) {
|
|
13641
13777
|
var lineStyle = Array.isArray(inputStyle) ? inputStyle[index] : inputStyle;
|
|
13642
13778
|
|
|
13643
|
-
var style =
|
|
13779
|
+
var style = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, lineStyle, defaultStyle);
|
|
13644
13780
|
|
|
13645
|
-
return
|
|
13781
|
+
return lodash_assign__WEBPACK_IMPORTED_MODULE_2___default()({}, style, {
|
|
13646
13782
|
fontFamily: style.fontFamily,
|
|
13647
13783
|
letterSpacing: typeof style.letterSpacing === "number" ? style.letterSpacing : convertLengthToPixels(String(style.letterSpacing), style.fontSize),
|
|
13648
13784
|
fontSize: typeof style.fontSize === "number" ? style.fontSize : convertLengthToPixels(String(style.fontSize))
|
|
@@ -13689,21 +13825,100 @@ var _approximateTextHeightInternal = function (text, style) {
|
|
|
13689
13825
|
}, 0);
|
|
13690
13826
|
};
|
|
13691
13827
|
|
|
13828
|
+
var _approximateDimensionsInternal = function (text, style) {
|
|
13829
|
+
var angle = Array.isArray(style) ? style[0] && style[0].angle : style && style.angle;
|
|
13830
|
+
|
|
13831
|
+
var height = _approximateTextHeightInternal(text, style);
|
|
13832
|
+
|
|
13833
|
+
var width = _approximateTextWidthInternal(text, style);
|
|
13834
|
+
|
|
13835
|
+
var widthWithRotate = angle ? _getSizeWithRotate(width, height, angle) : width;
|
|
13836
|
+
var heightWithRotate = angle ? _getSizeWithRotate(height, width, angle) : height;
|
|
13837
|
+
return {
|
|
13838
|
+
width: widthWithRotate,
|
|
13839
|
+
height: heightWithRotate * coefficients.heightOverlapCoef
|
|
13840
|
+
};
|
|
13841
|
+
};
|
|
13842
|
+
|
|
13843
|
+
var _getMeasurementContainer = lodash_memoize__WEBPACK_IMPORTED_MODULE_0___default()(function () {
|
|
13844
|
+
var element = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
13845
|
+
element.setAttribute("xlink", "http://www.w3.org/1999/xlink");
|
|
13846
|
+
element.setAttribute("width", "300");
|
|
13847
|
+
element.setAttribute("height", "300");
|
|
13848
|
+
element.setAttribute("viewBox", "0 0 300 300");
|
|
13849
|
+
var containerElement = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
13850
|
+
element.appendChild(containerElement);
|
|
13851
|
+
element.style.position = "fixed";
|
|
13852
|
+
element.style.top = "-9999px";
|
|
13853
|
+
element.style.left = "-9999px";
|
|
13854
|
+
document.body.appendChild(element);
|
|
13855
|
+
return containerElement;
|
|
13856
|
+
});
|
|
13857
|
+
|
|
13858
|
+
var styleToKeyComponent = function (style) {
|
|
13859
|
+
if (!style) {
|
|
13860
|
+
return "null";
|
|
13861
|
+
}
|
|
13862
|
+
|
|
13863
|
+
return "".concat(style.angle, ":").concat(style.fontFamily, ":").concat(style.fontSize, ":").concat(style.letterSpacing, ":").concat(style.lineHeight);
|
|
13864
|
+
};
|
|
13865
|
+
|
|
13866
|
+
var _measureDimensionsInternal = lodash_memoize__WEBPACK_IMPORTED_MODULE_0___default()(function (text, style) {
|
|
13867
|
+
var containerElement = _getMeasurementContainer();
|
|
13868
|
+
|
|
13869
|
+
var lines = _splitToLines(text);
|
|
13870
|
+
|
|
13871
|
+
var heightAcc = 0;
|
|
13872
|
+
|
|
13873
|
+
for (var _ref of lines.entries()) {
|
|
13874
|
+
var _ref2 = _slicedToArray(_ref, 2);
|
|
13875
|
+
|
|
13876
|
+
var i = _ref2[0];
|
|
13877
|
+
var line = _ref2[1];
|
|
13878
|
+
var textElement = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
|
|
13879
|
+
|
|
13880
|
+
var params = _prepareParams(style, i);
|
|
13881
|
+
|
|
13882
|
+
textElement.style.fontFamily = params.fontFamily;
|
|
13883
|
+
textElement.style.fontSize = "".concat(params.fontSize, "px");
|
|
13884
|
+
textElement.style.lineHeight = params.lineHeight;
|
|
13885
|
+
textElement.style.fontFamily = params.fontFamily;
|
|
13886
|
+
textElement.style.letterSpacing = params.letterSpacing;
|
|
13887
|
+
textElement.textContent = line;
|
|
13888
|
+
textElement.setAttribute("x", "0");
|
|
13889
|
+
textElement.setAttribute("y", "".concat(heightAcc));
|
|
13890
|
+
containerElement.appendChild(textElement);
|
|
13891
|
+
heightAcc += params.lineHeight * textElement.getBoundingClientRect().height;
|
|
13892
|
+
}
|
|
13893
|
+
|
|
13894
|
+
var _containerElement$get = containerElement.getBoundingClientRect(),
|
|
13895
|
+
width = _containerElement$get.width;
|
|
13896
|
+
|
|
13897
|
+
containerElement.innerHTML = "";
|
|
13898
|
+
return {
|
|
13899
|
+
width: style !== null && style !== void 0 && style.angle ? _getSizeWithRotate(width, heightAcc, style === null || style === void 0 ? void 0 : style.angle) : width,
|
|
13900
|
+
height: style !== null && style !== void 0 && style.angle ? _getSizeWithRotate(heightAcc, width, style === null || style === void 0 ? void 0 : style.angle) : heightAcc
|
|
13901
|
+
};
|
|
13902
|
+
}, function (text, style) {
|
|
13903
|
+
var totalText = Array.isArray(text) ? text.join() : text;
|
|
13904
|
+
var totalStyle = Array.isArray(style) ? style.map(styleToKeyComponent).join() : styleToKeyComponent(style);
|
|
13905
|
+
return "".concat(totalText, "::").concat(totalStyle);
|
|
13906
|
+
});
|
|
13907
|
+
|
|
13692
13908
|
// Stubbable implementation.
|
|
13693
13909
|
var _approximateTextSizeInternal = {
|
|
13694
13910
|
impl: function (text, style) {
|
|
13695
|
-
var
|
|
13911
|
+
var __debugForceApproximate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
13696
13912
|
|
|
13697
|
-
|
|
13913
|
+
// Attempt to first measure the element in DOM. If there is no DOM, fallback
|
|
13914
|
+
// to the less accurate approximation algorithm.
|
|
13915
|
+
var isClient = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
13698
13916
|
|
|
13699
|
-
|
|
13917
|
+
if (!isClient || __debugForceApproximate) {
|
|
13918
|
+
return _approximateDimensionsInternal(text, style);
|
|
13919
|
+
}
|
|
13700
13920
|
|
|
13701
|
-
|
|
13702
|
-
var heightWithRotate = angle ? _getSizeWithRotate(height, width, angle) : height;
|
|
13703
|
-
return {
|
|
13704
|
-
width: widthWithRotate,
|
|
13705
|
-
height: heightWithRotate * coefficients.heightOverlapCoef
|
|
13706
|
-
};
|
|
13921
|
+
return _measureDimensionsInternal(text, style);
|
|
13707
13922
|
}
|
|
13708
13923
|
};
|
|
13709
13924
|
/**
|