victory 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 +16 -0
- package/dist/victory.js +232 -16
- package/dist/victory.min.js +1 -1
- package/package.json +32 -29
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# victory
|
|
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
|
+
|
|
17
|
+
* Setup NPM Provenance ([#2587](https://github.com/FormidableLabs/victory/pull/2587))
|
|
18
|
+
|
|
3
19
|
## 36.6.8
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/victory.js
CHANGED
|
@@ -2023,6 +2023,48 @@ function noop() {
|
|
|
2023
2023
|
module.exports = noop;
|
|
2024
2024
|
|
|
2025
2025
|
|
|
2026
|
+
/***/ }),
|
|
2027
|
+
|
|
2028
|
+
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_MapCache.js":
|
|
2029
|
+
/*!***********************************************************************************!*\
|
|
2030
|
+
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_MapCache.js ***!
|
|
2031
|
+
\***********************************************************************************/
|
|
2032
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2033
|
+
|
|
2034
|
+
var listCacheClear = __webpack_require__(/*! ./_listCacheClear */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheClear.js"),
|
|
2035
|
+
listCacheDelete = __webpack_require__(/*! ./_listCacheDelete */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheDelete.js"),
|
|
2036
|
+
listCacheGet = __webpack_require__(/*! ./_listCacheGet */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheGet.js"),
|
|
2037
|
+
listCacheHas = __webpack_require__(/*! ./_listCacheHas */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheHas.js"),
|
|
2038
|
+
listCacheSet = __webpack_require__(/*! ./_listCacheSet */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheSet.js");
|
|
2039
|
+
|
|
2040
|
+
/**
|
|
2041
|
+
* Creates an list cache object.
|
|
2042
|
+
*
|
|
2043
|
+
* @private
|
|
2044
|
+
* @constructor
|
|
2045
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
2046
|
+
*/
|
|
2047
|
+
function ListCache(entries) {
|
|
2048
|
+
var index = -1,
|
|
2049
|
+
length = entries == null ? 0 : entries.length;
|
|
2050
|
+
|
|
2051
|
+
this.clear();
|
|
2052
|
+
while (++index < length) {
|
|
2053
|
+
var entry = entries[index];
|
|
2054
|
+
this.set(entry[0], entry[1]);
|
|
2055
|
+
}
|
|
2056
|
+
}
|
|
2057
|
+
|
|
2058
|
+
// Add methods to `ListCache`.
|
|
2059
|
+
ListCache.prototype.clear = listCacheClear;
|
|
2060
|
+
ListCache.prototype['delete'] = listCacheDelete;
|
|
2061
|
+
ListCache.prototype.get = listCacheGet;
|
|
2062
|
+
ListCache.prototype.has = listCacheHas;
|
|
2063
|
+
ListCache.prototype.set = listCacheSet;
|
|
2064
|
+
|
|
2065
|
+
module.exports = ListCache;
|
|
2066
|
+
|
|
2067
|
+
|
|
2026
2068
|
/***/ }),
|
|
2027
2069
|
|
|
2028
2070
|
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_SetCache.js":
|
|
@@ -7957,6 +7999,89 @@ function mapValues(object, iteratee) {
|
|
|
7957
7999
|
module.exports = mapValues;
|
|
7958
8000
|
|
|
7959
8001
|
|
|
8002
|
+
/***/ }),
|
|
8003
|
+
|
|
8004
|
+
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/memoize.js":
|
|
8005
|
+
/*!*********************************************************************************!*\
|
|
8006
|
+
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/memoize.js ***!
|
|
8007
|
+
\*********************************************************************************/
|
|
8008
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
8009
|
+
|
|
8010
|
+
var MapCache = __webpack_require__(/*! ./_MapCache */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_MapCache.js");
|
|
8011
|
+
|
|
8012
|
+
/** Error message constants. */
|
|
8013
|
+
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
8014
|
+
|
|
8015
|
+
/**
|
|
8016
|
+
* Creates a function that memoizes the result of `func`. If `resolver` is
|
|
8017
|
+
* provided, it determines the cache key for storing the result based on the
|
|
8018
|
+
* arguments provided to the memoized function. By default, the first argument
|
|
8019
|
+
* provided to the memoized function is used as the map cache key. The `func`
|
|
8020
|
+
* is invoked with the `this` binding of the memoized function.
|
|
8021
|
+
*
|
|
8022
|
+
* **Note:** The cache is exposed as the `cache` property on the memoized
|
|
8023
|
+
* function. Its creation may be customized by replacing the `_.memoize.Cache`
|
|
8024
|
+
* constructor with one whose instances implement the
|
|
8025
|
+
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
|
8026
|
+
* method interface of `clear`, `delete`, `get`, `has`, and `set`.
|
|
8027
|
+
*
|
|
8028
|
+
* @static
|
|
8029
|
+
* @memberOf _
|
|
8030
|
+
* @since 0.1.0
|
|
8031
|
+
* @category Function
|
|
8032
|
+
* @param {Function} func The function to have its output memoized.
|
|
8033
|
+
* @param {Function} [resolver] The function to resolve the cache key.
|
|
8034
|
+
* @returns {Function} Returns the new memoized function.
|
|
8035
|
+
* @example
|
|
8036
|
+
*
|
|
8037
|
+
* var object = { 'a': 1, 'b': 2 };
|
|
8038
|
+
* var other = { 'c': 3, 'd': 4 };
|
|
8039
|
+
*
|
|
8040
|
+
* var values = _.memoize(_.values);
|
|
8041
|
+
* values(object);
|
|
8042
|
+
* // => [1, 2]
|
|
8043
|
+
*
|
|
8044
|
+
* values(other);
|
|
8045
|
+
* // => [3, 4]
|
|
8046
|
+
*
|
|
8047
|
+
* object.a = 2;
|
|
8048
|
+
* values(object);
|
|
8049
|
+
* // => [1, 2]
|
|
8050
|
+
*
|
|
8051
|
+
* // Modify the result cache.
|
|
8052
|
+
* values.cache.set(object, ['a', 'b']);
|
|
8053
|
+
* values(object);
|
|
8054
|
+
* // => ['a', 'b']
|
|
8055
|
+
*
|
|
8056
|
+
* // Replace `_.memoize.Cache`.
|
|
8057
|
+
* _.memoize.Cache = WeakMap;
|
|
8058
|
+
*/
|
|
8059
|
+
function memoize(func, resolver) {
|
|
8060
|
+
if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
|
|
8061
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
8062
|
+
}
|
|
8063
|
+
var memoized = function() {
|
|
8064
|
+
var args = arguments,
|
|
8065
|
+
key = resolver ? resolver.apply(this, args) : args[0],
|
|
8066
|
+
cache = memoized.cache;
|
|
8067
|
+
|
|
8068
|
+
if (cache.has(key)) {
|
|
8069
|
+
return cache.get(key);
|
|
8070
|
+
}
|
|
8071
|
+
var result = func.apply(this, args);
|
|
8072
|
+
memoized.cache = cache.set(key, result) || cache;
|
|
8073
|
+
return result;
|
|
8074
|
+
};
|
|
8075
|
+
memoized.cache = new (memoize.Cache || MapCache);
|
|
8076
|
+
return memoized;
|
|
8077
|
+
}
|
|
8078
|
+
|
|
8079
|
+
// Expose `MapCache`.
|
|
8080
|
+
memoize.Cache = MapCache;
|
|
8081
|
+
|
|
8082
|
+
module.exports = memoize;
|
|
8083
|
+
|
|
8084
|
+
|
|
7960
8085
|
/***/ }),
|
|
7961
8086
|
|
|
7962
8087
|
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/negate.js":
|
|
@@ -26097,13 +26222,24 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
26097
26222
|
/* harmony export */ "approximateTextSize": () => (/* binding */ approximateTextSize),
|
|
26098
26223
|
/* harmony export */ "convertLengthToPixels": () => (/* binding */ convertLengthToPixels)
|
|
26099
26224
|
/* harmony export */ });
|
|
26100
|
-
/* harmony import */ var
|
|
26101
|
-
/* harmony import */ var
|
|
26102
|
-
/* harmony import */ var
|
|
26103
|
-
/* harmony import */ var
|
|
26225
|
+
/* 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");
|
|
26226
|
+
/* harmony import */ var lodash_memoize__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_memoize__WEBPACK_IMPORTED_MODULE_0__);
|
|
26227
|
+
/* 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");
|
|
26228
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_1__);
|
|
26229
|
+
/* 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");
|
|
26230
|
+
/* harmony import */ var lodash_assign__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_assign__WEBPACK_IMPORTED_MODULE_2__);
|
|
26231
|
+
|
|
26104
26232
|
|
|
26105
26233
|
|
|
26106
26234
|
|
|
26235
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
26236
|
+
|
|
26237
|
+
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."); }
|
|
26238
|
+
|
|
26239
|
+
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; }
|
|
26240
|
+
|
|
26241
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
26242
|
+
|
|
26107
26243
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
26108
26244
|
|
|
26109
26245
|
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."); }
|
|
@@ -26307,9 +26443,9 @@ var convertLengthToPixels = function (length, fontSize) {
|
|
|
26307
26443
|
var _prepareParams = function (inputStyle, index) {
|
|
26308
26444
|
var lineStyle = Array.isArray(inputStyle) ? inputStyle[index] : inputStyle;
|
|
26309
26445
|
|
|
26310
|
-
var style =
|
|
26446
|
+
var style = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, lineStyle, defaultStyle);
|
|
26311
26447
|
|
|
26312
|
-
return
|
|
26448
|
+
return lodash_assign__WEBPACK_IMPORTED_MODULE_2___default()({}, style, {
|
|
26313
26449
|
fontFamily: style.fontFamily,
|
|
26314
26450
|
letterSpacing: typeof style.letterSpacing === "number" ? style.letterSpacing : convertLengthToPixels(String(style.letterSpacing), style.fontSize),
|
|
26315
26451
|
fontSize: typeof style.fontSize === "number" ? style.fontSize : convertLengthToPixels(String(style.fontSize))
|
|
@@ -26356,21 +26492,100 @@ var _approximateTextHeightInternal = function (text, style) {
|
|
|
26356
26492
|
}, 0);
|
|
26357
26493
|
};
|
|
26358
26494
|
|
|
26495
|
+
var _approximateDimensionsInternal = function (text, style) {
|
|
26496
|
+
var angle = Array.isArray(style) ? style[0] && style[0].angle : style && style.angle;
|
|
26497
|
+
|
|
26498
|
+
var height = _approximateTextHeightInternal(text, style);
|
|
26499
|
+
|
|
26500
|
+
var width = _approximateTextWidthInternal(text, style);
|
|
26501
|
+
|
|
26502
|
+
var widthWithRotate = angle ? _getSizeWithRotate(width, height, angle) : width;
|
|
26503
|
+
var heightWithRotate = angle ? _getSizeWithRotate(height, width, angle) : height;
|
|
26504
|
+
return {
|
|
26505
|
+
width: widthWithRotate,
|
|
26506
|
+
height: heightWithRotate * coefficients.heightOverlapCoef
|
|
26507
|
+
};
|
|
26508
|
+
};
|
|
26509
|
+
|
|
26510
|
+
var _getMeasurementContainer = lodash_memoize__WEBPACK_IMPORTED_MODULE_0___default()(function () {
|
|
26511
|
+
var element = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
26512
|
+
element.setAttribute("xlink", "http://www.w3.org/1999/xlink");
|
|
26513
|
+
element.setAttribute("width", "300");
|
|
26514
|
+
element.setAttribute("height", "300");
|
|
26515
|
+
element.setAttribute("viewBox", "0 0 300 300");
|
|
26516
|
+
var containerElement = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
26517
|
+
element.appendChild(containerElement);
|
|
26518
|
+
element.style.position = "fixed";
|
|
26519
|
+
element.style.top = "-9999px";
|
|
26520
|
+
element.style.left = "-9999px";
|
|
26521
|
+
document.body.appendChild(element);
|
|
26522
|
+
return containerElement;
|
|
26523
|
+
});
|
|
26524
|
+
|
|
26525
|
+
var styleToKeyComponent = function (style) {
|
|
26526
|
+
if (!style) {
|
|
26527
|
+
return "null";
|
|
26528
|
+
}
|
|
26529
|
+
|
|
26530
|
+
return "".concat(style.angle, ":").concat(style.fontFamily, ":").concat(style.fontSize, ":").concat(style.letterSpacing, ":").concat(style.lineHeight);
|
|
26531
|
+
};
|
|
26532
|
+
|
|
26533
|
+
var _measureDimensionsInternal = lodash_memoize__WEBPACK_IMPORTED_MODULE_0___default()(function (text, style) {
|
|
26534
|
+
var containerElement = _getMeasurementContainer();
|
|
26535
|
+
|
|
26536
|
+
var lines = _splitToLines(text);
|
|
26537
|
+
|
|
26538
|
+
var heightAcc = 0;
|
|
26539
|
+
|
|
26540
|
+
for (var _ref of lines.entries()) {
|
|
26541
|
+
var _ref2 = _slicedToArray(_ref, 2);
|
|
26542
|
+
|
|
26543
|
+
var i = _ref2[0];
|
|
26544
|
+
var line = _ref2[1];
|
|
26545
|
+
var textElement = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
|
|
26546
|
+
|
|
26547
|
+
var params = _prepareParams(style, i);
|
|
26548
|
+
|
|
26549
|
+
textElement.style.fontFamily = params.fontFamily;
|
|
26550
|
+
textElement.style.fontSize = "".concat(params.fontSize, "px");
|
|
26551
|
+
textElement.style.lineHeight = params.lineHeight;
|
|
26552
|
+
textElement.style.fontFamily = params.fontFamily;
|
|
26553
|
+
textElement.style.letterSpacing = params.letterSpacing;
|
|
26554
|
+
textElement.textContent = line;
|
|
26555
|
+
textElement.setAttribute("x", "0");
|
|
26556
|
+
textElement.setAttribute("y", "".concat(heightAcc));
|
|
26557
|
+
containerElement.appendChild(textElement);
|
|
26558
|
+
heightAcc += params.lineHeight * textElement.getBoundingClientRect().height;
|
|
26559
|
+
}
|
|
26560
|
+
|
|
26561
|
+
var _containerElement$get = containerElement.getBoundingClientRect(),
|
|
26562
|
+
width = _containerElement$get.width;
|
|
26563
|
+
|
|
26564
|
+
containerElement.innerHTML = "";
|
|
26565
|
+
return {
|
|
26566
|
+
width: style !== null && style !== void 0 && style.angle ? _getSizeWithRotate(width, heightAcc, style === null || style === void 0 ? void 0 : style.angle) : width,
|
|
26567
|
+
height: style !== null && style !== void 0 && style.angle ? _getSizeWithRotate(heightAcc, width, style === null || style === void 0 ? void 0 : style.angle) : heightAcc
|
|
26568
|
+
};
|
|
26569
|
+
}, function (text, style) {
|
|
26570
|
+
var totalText = Array.isArray(text) ? text.join() : text;
|
|
26571
|
+
var totalStyle = Array.isArray(style) ? style.map(styleToKeyComponent).join() : styleToKeyComponent(style);
|
|
26572
|
+
return "".concat(totalText, "::").concat(totalStyle);
|
|
26573
|
+
});
|
|
26574
|
+
|
|
26359
26575
|
// Stubbable implementation.
|
|
26360
26576
|
var _approximateTextSizeInternal = {
|
|
26361
26577
|
impl: function (text, style) {
|
|
26362
|
-
var
|
|
26578
|
+
var __debugForceApproximate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
26363
26579
|
|
|
26364
|
-
|
|
26580
|
+
// Attempt to first measure the element in DOM. If there is no DOM, fallback
|
|
26581
|
+
// to the less accurate approximation algorithm.
|
|
26582
|
+
var isClient = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
26365
26583
|
|
|
26366
|
-
|
|
26584
|
+
if (!isClient || __debugForceApproximate) {
|
|
26585
|
+
return _approximateDimensionsInternal(text, style);
|
|
26586
|
+
}
|
|
26367
26587
|
|
|
26368
|
-
|
|
26369
|
-
var heightWithRotate = angle ? _getSizeWithRotate(height, width, angle) : height;
|
|
26370
|
-
return {
|
|
26371
|
-
width: widthWithRotate,
|
|
26372
|
-
height: heightWithRotate * coefficients.heightOverlapCoef
|
|
26373
|
-
};
|
|
26588
|
+
return _measureDimensionsInternal(text, style);
|
|
26374
26589
|
}
|
|
26375
26590
|
};
|
|
26376
26591
|
/**
|
|
@@ -30617,7 +30832,8 @@ var evaluateProps = function (props) {
|
|
|
30617
30832
|
var id = victory_core__WEBPACK_IMPORTED_MODULE_2__.evaluateProp(props.id, props);
|
|
30618
30833
|
var style = victory_core__WEBPACK_IMPORTED_MODULE_2__.evaluateStyle(lodash_assign__WEBPACK_IMPORTED_MODULE_0___default()({
|
|
30619
30834
|
fill: "none",
|
|
30620
|
-
stroke: "black"
|
|
30835
|
+
stroke: "black",
|
|
30836
|
+
pointerEvents: "stroke"
|
|
30621
30837
|
}, props.style), props);
|
|
30622
30838
|
var tabIndex = victory_core__WEBPACK_IMPORTED_MODULE_2__.evaluateProp(props.tabIndex, props);
|
|
30623
30839
|
return lodash_assign__WEBPACK_IMPORTED_MODULE_0___default()({}, props, {
|