victory-pie 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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # victory-pie
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
@@ -705,6 +705,48 @@ VictoryPie.getData = victory_core__WEBPACK_IMPORTED_MODULE_10__.getData;
705
705
  VictoryPie.expectedComponents = ["dataComponent", "labelComponent", "groupComponent", "containerComponent"];
706
706
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,victory_core__WEBPACK_IMPORTED_MODULE_11__.addEvents)(VictoryPie));
707
707
 
708
+ /***/ }),
709
+
710
+ /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_MapCache.js":
711
+ /*!***********************************************************************************!*\
712
+ !*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_MapCache.js ***!
713
+ \***********************************************************************************/
714
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
715
+
716
+ var listCacheClear = __webpack_require__(/*! ./_listCacheClear */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheClear.js"),
717
+ listCacheDelete = __webpack_require__(/*! ./_listCacheDelete */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheDelete.js"),
718
+ listCacheGet = __webpack_require__(/*! ./_listCacheGet */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheGet.js"),
719
+ listCacheHas = __webpack_require__(/*! ./_listCacheHas */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheHas.js"),
720
+ listCacheSet = __webpack_require__(/*! ./_listCacheSet */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheSet.js");
721
+
722
+ /**
723
+ * Creates an list cache object.
724
+ *
725
+ * @private
726
+ * @constructor
727
+ * @param {Array} [entries] The key-value pairs to cache.
728
+ */
729
+ function ListCache(entries) {
730
+ var index = -1,
731
+ length = entries == null ? 0 : entries.length;
732
+
733
+ this.clear();
734
+ while (++index < length) {
735
+ var entry = entries[index];
736
+ this.set(entry[0], entry[1]);
737
+ }
738
+ }
739
+
740
+ // Add methods to `ListCache`.
741
+ ListCache.prototype.clear = listCacheClear;
742
+ ListCache.prototype['delete'] = listCacheDelete;
743
+ ListCache.prototype.get = listCacheGet;
744
+ ListCache.prototype.has = listCacheHas;
745
+ ListCache.prototype.set = listCacheSet;
746
+
747
+ module.exports = ListCache;
748
+
749
+
708
750
  /***/ }),
709
751
 
710
752
  /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_SetCache.js":
@@ -5174,6 +5216,89 @@ function last(array) {
5174
5216
  module.exports = last;
5175
5217
 
5176
5218
 
5219
+ /***/ }),
5220
+
5221
+ /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/memoize.js":
5222
+ /*!*********************************************************************************!*\
5223
+ !*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/memoize.js ***!
5224
+ \*********************************************************************************/
5225
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
5226
+
5227
+ var MapCache = __webpack_require__(/*! ./_MapCache */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_MapCache.js");
5228
+
5229
+ /** Error message constants. */
5230
+ var FUNC_ERROR_TEXT = 'Expected a function';
5231
+
5232
+ /**
5233
+ * Creates a function that memoizes the result of `func`. If `resolver` is
5234
+ * provided, it determines the cache key for storing the result based on the
5235
+ * arguments provided to the memoized function. By default, the first argument
5236
+ * provided to the memoized function is used as the map cache key. The `func`
5237
+ * is invoked with the `this` binding of the memoized function.
5238
+ *
5239
+ * **Note:** The cache is exposed as the `cache` property on the memoized
5240
+ * function. Its creation may be customized by replacing the `_.memoize.Cache`
5241
+ * constructor with one whose instances implement the
5242
+ * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
5243
+ * method interface of `clear`, `delete`, `get`, `has`, and `set`.
5244
+ *
5245
+ * @static
5246
+ * @memberOf _
5247
+ * @since 0.1.0
5248
+ * @category Function
5249
+ * @param {Function} func The function to have its output memoized.
5250
+ * @param {Function} [resolver] The function to resolve the cache key.
5251
+ * @returns {Function} Returns the new memoized function.
5252
+ * @example
5253
+ *
5254
+ * var object = { 'a': 1, 'b': 2 };
5255
+ * var other = { 'c': 3, 'd': 4 };
5256
+ *
5257
+ * var values = _.memoize(_.values);
5258
+ * values(object);
5259
+ * // => [1, 2]
5260
+ *
5261
+ * values(other);
5262
+ * // => [3, 4]
5263
+ *
5264
+ * object.a = 2;
5265
+ * values(object);
5266
+ * // => [1, 2]
5267
+ *
5268
+ * // Modify the result cache.
5269
+ * values.cache.set(object, ['a', 'b']);
5270
+ * values(object);
5271
+ * // => ['a', 'b']
5272
+ *
5273
+ * // Replace `_.memoize.Cache`.
5274
+ * _.memoize.Cache = WeakMap;
5275
+ */
5276
+ function memoize(func, resolver) {
5277
+ if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
5278
+ throw new TypeError(FUNC_ERROR_TEXT);
5279
+ }
5280
+ var memoized = function() {
5281
+ var args = arguments,
5282
+ key = resolver ? resolver.apply(this, args) : args[0],
5283
+ cache = memoized.cache;
5284
+
5285
+ if (cache.has(key)) {
5286
+ return cache.get(key);
5287
+ }
5288
+ var result = func.apply(this, args);
5289
+ memoized.cache = cache.set(key, result) || cache;
5290
+ return result;
5291
+ };
5292
+ memoized.cache = new (memoize.Cache || MapCache);
5293
+ return memoized;
5294
+ }
5295
+
5296
+ // Expose `MapCache`.
5297
+ memoize.Cache = MapCache;
5298
+
5299
+ module.exports = memoize;
5300
+
5301
+
5177
5302
  /***/ }),
5178
5303
 
5179
5304
  /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/negate.js":
@@ -12789,13 +12914,24 @@ __webpack_require__.r(__webpack_exports__);
12789
12914
  /* harmony export */ "approximateTextSize": () => (/* binding */ approximateTextSize),
12790
12915
  /* harmony export */ "convertLengthToPixels": () => (/* binding */ convertLengthToPixels)
12791
12916
  /* harmony export */ });
12792
- /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/defaults */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/defaults.js");
12793
- /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_0__);
12794
- /* harmony import */ var lodash_assign__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/assign */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/assign.js");
12795
- /* harmony import */ var lodash_assign__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_assign__WEBPACK_IMPORTED_MODULE_1__);
12917
+ /* 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");
12918
+ /* harmony import */ var lodash_memoize__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_memoize__WEBPACK_IMPORTED_MODULE_0__);
12919
+ /* 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");
12920
+ /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_1__);
12921
+ /* 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");
12922
+ /* harmony import */ var lodash_assign__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_assign__WEBPACK_IMPORTED_MODULE_2__);
12923
+
12796
12924
 
12797
12925
 
12798
12926
 
12927
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
12928
+
12929
+ 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."); }
12930
+
12931
+ 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; }
12932
+
12933
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12934
+
12799
12935
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
12800
12936
 
12801
12937
  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."); }
@@ -12999,9 +13135,9 @@ var convertLengthToPixels = function (length, fontSize) {
12999
13135
  var _prepareParams = function (inputStyle, index) {
13000
13136
  var lineStyle = Array.isArray(inputStyle) ? inputStyle[index] : inputStyle;
13001
13137
 
13002
- var style = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, lineStyle, defaultStyle);
13138
+ var style = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, lineStyle, defaultStyle);
13003
13139
 
13004
- return lodash_assign__WEBPACK_IMPORTED_MODULE_1___default()({}, style, {
13140
+ return lodash_assign__WEBPACK_IMPORTED_MODULE_2___default()({}, style, {
13005
13141
  fontFamily: style.fontFamily,
13006
13142
  letterSpacing: typeof style.letterSpacing === "number" ? style.letterSpacing : convertLengthToPixels(String(style.letterSpacing), style.fontSize),
13007
13143
  fontSize: typeof style.fontSize === "number" ? style.fontSize : convertLengthToPixels(String(style.fontSize))
@@ -13048,21 +13184,100 @@ var _approximateTextHeightInternal = function (text, style) {
13048
13184
  }, 0);
13049
13185
  };
13050
13186
 
13187
+ var _approximateDimensionsInternal = function (text, style) {
13188
+ var angle = Array.isArray(style) ? style[0] && style[0].angle : style && style.angle;
13189
+
13190
+ var height = _approximateTextHeightInternal(text, style);
13191
+
13192
+ var width = _approximateTextWidthInternal(text, style);
13193
+
13194
+ var widthWithRotate = angle ? _getSizeWithRotate(width, height, angle) : width;
13195
+ var heightWithRotate = angle ? _getSizeWithRotate(height, width, angle) : height;
13196
+ return {
13197
+ width: widthWithRotate,
13198
+ height: heightWithRotate * coefficients.heightOverlapCoef
13199
+ };
13200
+ };
13201
+
13202
+ var _getMeasurementContainer = lodash_memoize__WEBPACK_IMPORTED_MODULE_0___default()(function () {
13203
+ var element = document.createElementNS("http://www.w3.org/2000/svg", "svg");
13204
+ element.setAttribute("xlink", "http://www.w3.org/1999/xlink");
13205
+ element.setAttribute("width", "300");
13206
+ element.setAttribute("height", "300");
13207
+ element.setAttribute("viewBox", "0 0 300 300");
13208
+ var containerElement = document.createElementNS("http://www.w3.org/2000/svg", "text");
13209
+ element.appendChild(containerElement);
13210
+ element.style.position = "fixed";
13211
+ element.style.top = "-9999px";
13212
+ element.style.left = "-9999px";
13213
+ document.body.appendChild(element);
13214
+ return containerElement;
13215
+ });
13216
+
13217
+ var styleToKeyComponent = function (style) {
13218
+ if (!style) {
13219
+ return "null";
13220
+ }
13221
+
13222
+ return "".concat(style.angle, ":").concat(style.fontFamily, ":").concat(style.fontSize, ":").concat(style.letterSpacing, ":").concat(style.lineHeight);
13223
+ };
13224
+
13225
+ var _measureDimensionsInternal = lodash_memoize__WEBPACK_IMPORTED_MODULE_0___default()(function (text, style) {
13226
+ var containerElement = _getMeasurementContainer();
13227
+
13228
+ var lines = _splitToLines(text);
13229
+
13230
+ var heightAcc = 0;
13231
+
13232
+ for (var _ref of lines.entries()) {
13233
+ var _ref2 = _slicedToArray(_ref, 2);
13234
+
13235
+ var i = _ref2[0];
13236
+ var line = _ref2[1];
13237
+ var textElement = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
13238
+
13239
+ var params = _prepareParams(style, i);
13240
+
13241
+ textElement.style.fontFamily = params.fontFamily;
13242
+ textElement.style.fontSize = "".concat(params.fontSize, "px");
13243
+ textElement.style.lineHeight = params.lineHeight;
13244
+ textElement.style.fontFamily = params.fontFamily;
13245
+ textElement.style.letterSpacing = params.letterSpacing;
13246
+ textElement.textContent = line;
13247
+ textElement.setAttribute("x", "0");
13248
+ textElement.setAttribute("y", "".concat(heightAcc));
13249
+ containerElement.appendChild(textElement);
13250
+ heightAcc += params.lineHeight * textElement.getBoundingClientRect().height;
13251
+ }
13252
+
13253
+ var _containerElement$get = containerElement.getBoundingClientRect(),
13254
+ width = _containerElement$get.width;
13255
+
13256
+ containerElement.innerHTML = "";
13257
+ return {
13258
+ width: style !== null && style !== void 0 && style.angle ? _getSizeWithRotate(width, heightAcc, style === null || style === void 0 ? void 0 : style.angle) : width,
13259
+ height: style !== null && style !== void 0 && style.angle ? _getSizeWithRotate(heightAcc, width, style === null || style === void 0 ? void 0 : style.angle) : heightAcc
13260
+ };
13261
+ }, function (text, style) {
13262
+ var totalText = Array.isArray(text) ? text.join() : text;
13263
+ var totalStyle = Array.isArray(style) ? style.map(styleToKeyComponent).join() : styleToKeyComponent(style);
13264
+ return "".concat(totalText, "::").concat(totalStyle);
13265
+ });
13266
+
13051
13267
  // Stubbable implementation.
13052
13268
  var _approximateTextSizeInternal = {
13053
13269
  impl: function (text, style) {
13054
- var angle = Array.isArray(style) ? style[0] && style[0].angle : style && style.angle;
13270
+ var __debugForceApproximate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
13055
13271
 
13056
- var height = _approximateTextHeightInternal(text, style);
13272
+ // Attempt to first measure the element in DOM. If there is no DOM, fallback
13273
+ // to the less accurate approximation algorithm.
13274
+ var isClient = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
13057
13275
 
13058
- var width = _approximateTextWidthInternal(text, style);
13276
+ if (!isClient || __debugForceApproximate) {
13277
+ return _approximateDimensionsInternal(text, style);
13278
+ }
13059
13279
 
13060
- var widthWithRotate = angle ? _getSizeWithRotate(width, height, angle) : width;
13061
- var heightWithRotate = angle ? _getSizeWithRotate(height, width, angle) : height;
13062
- return {
13063
- width: widthWithRotate,
13064
- height: heightWithRotate * coefficients.heightOverlapCoef
13065
- };
13280
+ return _measureDimensionsInternal(text, style);
13066
13281
  }
13067
13282
  };
13068
13283
  /**