victory-histogram 36.6.8 → 36.6.10

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,17 @@
1
1
  # victory-histogram
2
2
 
3
+ ## 36.6.10
4
+
5
+ ### Patch Changes
6
+
7
+ - Setup NPM Provenance ([#2590](https://github.com/FormidableLabs/victory/pull/2590))
8
+
9
+ ## 36.6.9
10
+
11
+ ### Patch Changes
12
+
13
+ - Setup NPM Provenance ([#2587](https://github.com/FormidableLabs/victory/pull/2587))
14
+
3
15
  ## 36.6.8
4
16
 
5
17
  ### Patch Changes
@@ -526,6 +526,48 @@ VictoryHistogram.getBaseProps = function (props) {
526
526
  VictoryHistogram.expectedComponents = ["dataComponent", "labelComponent", "groupComponent", "containerComponent"];
527
527
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,victory_core__WEBPACK_IMPORTED_MODULE_11__.addEvents)(VictoryHistogram));
528
528
 
529
+ /***/ }),
530
+
531
+ /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_MapCache.js":
532
+ /*!***********************************************************************************!*\
533
+ !*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_MapCache.js ***!
534
+ \***********************************************************************************/
535
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
536
+
537
+ var listCacheClear = __webpack_require__(/*! ./_listCacheClear */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheClear.js"),
538
+ listCacheDelete = __webpack_require__(/*! ./_listCacheDelete */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheDelete.js"),
539
+ listCacheGet = __webpack_require__(/*! ./_listCacheGet */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheGet.js"),
540
+ listCacheHas = __webpack_require__(/*! ./_listCacheHas */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheHas.js"),
541
+ listCacheSet = __webpack_require__(/*! ./_listCacheSet */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheSet.js");
542
+
543
+ /**
544
+ * Creates an list cache object.
545
+ *
546
+ * @private
547
+ * @constructor
548
+ * @param {Array} [entries] The key-value pairs to cache.
549
+ */
550
+ function ListCache(entries) {
551
+ var index = -1,
552
+ length = entries == null ? 0 : entries.length;
553
+
554
+ this.clear();
555
+ while (++index < length) {
556
+ var entry = entries[index];
557
+ this.set(entry[0], entry[1]);
558
+ }
559
+ }
560
+
561
+ // Add methods to `ListCache`.
562
+ ListCache.prototype.clear = listCacheClear;
563
+ ListCache.prototype['delete'] = listCacheDelete;
564
+ ListCache.prototype.get = listCacheGet;
565
+ ListCache.prototype.has = listCacheHas;
566
+ ListCache.prototype.set = listCacheSet;
567
+
568
+ module.exports = ListCache;
569
+
570
+
529
571
  /***/ }),
530
572
 
531
573
  /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_SetCache.js":
@@ -5100,6 +5142,89 @@ function last(array) {
5100
5142
  module.exports = last;
5101
5143
 
5102
5144
 
5145
+ /***/ }),
5146
+
5147
+ /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/memoize.js":
5148
+ /*!*********************************************************************************!*\
5149
+ !*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/memoize.js ***!
5150
+ \*********************************************************************************/
5151
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
5152
+
5153
+ var MapCache = __webpack_require__(/*! ./_MapCache */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_MapCache.js");
5154
+
5155
+ /** Error message constants. */
5156
+ var FUNC_ERROR_TEXT = 'Expected a function';
5157
+
5158
+ /**
5159
+ * Creates a function that memoizes the result of `func`. If `resolver` is
5160
+ * provided, it determines the cache key for storing the result based on the
5161
+ * arguments provided to the memoized function. By default, the first argument
5162
+ * provided to the memoized function is used as the map cache key. The `func`
5163
+ * is invoked with the `this` binding of the memoized function.
5164
+ *
5165
+ * **Note:** The cache is exposed as the `cache` property on the memoized
5166
+ * function. Its creation may be customized by replacing the `_.memoize.Cache`
5167
+ * constructor with one whose instances implement the
5168
+ * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
5169
+ * method interface of `clear`, `delete`, `get`, `has`, and `set`.
5170
+ *
5171
+ * @static
5172
+ * @memberOf _
5173
+ * @since 0.1.0
5174
+ * @category Function
5175
+ * @param {Function} func The function to have its output memoized.
5176
+ * @param {Function} [resolver] The function to resolve the cache key.
5177
+ * @returns {Function} Returns the new memoized function.
5178
+ * @example
5179
+ *
5180
+ * var object = { 'a': 1, 'b': 2 };
5181
+ * var other = { 'c': 3, 'd': 4 };
5182
+ *
5183
+ * var values = _.memoize(_.values);
5184
+ * values(object);
5185
+ * // => [1, 2]
5186
+ *
5187
+ * values(other);
5188
+ * // => [3, 4]
5189
+ *
5190
+ * object.a = 2;
5191
+ * values(object);
5192
+ * // => [1, 2]
5193
+ *
5194
+ * // Modify the result cache.
5195
+ * values.cache.set(object, ['a', 'b']);
5196
+ * values(object);
5197
+ * // => ['a', 'b']
5198
+ *
5199
+ * // Replace `_.memoize.Cache`.
5200
+ * _.memoize.Cache = WeakMap;
5201
+ */
5202
+ function memoize(func, resolver) {
5203
+ if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
5204
+ throw new TypeError(FUNC_ERROR_TEXT);
5205
+ }
5206
+ var memoized = function() {
5207
+ var args = arguments,
5208
+ key = resolver ? resolver.apply(this, args) : args[0],
5209
+ cache = memoized.cache;
5210
+
5211
+ if (cache.has(key)) {
5212
+ return cache.get(key);
5213
+ }
5214
+ var result = func.apply(this, args);
5215
+ memoized.cache = cache.set(key, result) || cache;
5216
+ return result;
5217
+ };
5218
+ memoized.cache = new (memoize.Cache || MapCache);
5219
+ return memoized;
5220
+ }
5221
+
5222
+ // Expose `MapCache`.
5223
+ memoize.Cache = MapCache;
5224
+
5225
+ module.exports = memoize;
5226
+
5227
+
5103
5228
  /***/ }),
5104
5229
 
5105
5230
  /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/negate.js":
@@ -14244,12 +14369,23 @@ __webpack_require__.r(__webpack_exports__);
14244
14369
  /* harmony export */ "approximateTextSize": () => (/* binding */ approximateTextSize),
14245
14370
  /* harmony export */ "convertLengthToPixels": () => (/* binding */ convertLengthToPixels)
14246
14371
  /* harmony export */ });
14247
- /* 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");
14248
- /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_0__);
14249
- /* 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");
14250
- /* harmony import */ var lodash_assign__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_assign__WEBPACK_IMPORTED_MODULE_1__);
14372
+ /* 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");
14373
+ /* harmony import */ var lodash_memoize__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_memoize__WEBPACK_IMPORTED_MODULE_0__);
14374
+ /* 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");
14375
+ /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_1__);
14376
+ /* 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");
14377
+ /* harmony import */ var lodash_assign__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_assign__WEBPACK_IMPORTED_MODULE_2__);
14378
+
14379
+
14251
14380
 
14252
14381
 
14382
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
14383
+
14384
+ 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."); }
14385
+
14386
+ 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; }
14387
+
14388
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14253
14389
 
14254
14390
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
14255
14391
 
@@ -14454,9 +14590,9 @@ var convertLengthToPixels = function (length, fontSize) {
14454
14590
  var _prepareParams = function (inputStyle, index) {
14455
14591
  var lineStyle = Array.isArray(inputStyle) ? inputStyle[index] : inputStyle;
14456
14592
 
14457
- var style = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, lineStyle, defaultStyle);
14593
+ var style = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, lineStyle, defaultStyle);
14458
14594
 
14459
- return lodash_assign__WEBPACK_IMPORTED_MODULE_1___default()({}, style, {
14595
+ return lodash_assign__WEBPACK_IMPORTED_MODULE_2___default()({}, style, {
14460
14596
  fontFamily: style.fontFamily,
14461
14597
  letterSpacing: typeof style.letterSpacing === "number" ? style.letterSpacing : convertLengthToPixels(String(style.letterSpacing), style.fontSize),
14462
14598
  fontSize: typeof style.fontSize === "number" ? style.fontSize : convertLengthToPixels(String(style.fontSize))
@@ -14503,21 +14639,99 @@ var _approximateTextHeightInternal = function (text, style) {
14503
14639
  }, 0);
14504
14640
  };
14505
14641
 
14642
+ var _approximateDimensionsInternal = function (text, style) {
14643
+ var angle = Array.isArray(style) ? style[0] && style[0].angle : style && style.angle;
14644
+
14645
+ var height = _approximateTextHeightInternal(text, style);
14646
+
14647
+ var width = _approximateTextWidthInternal(text, style);
14648
+
14649
+ var widthWithRotate = angle ? _getSizeWithRotate(width, height, angle) : width;
14650
+ var heightWithRotate = angle ? _getSizeWithRotate(height, width, angle) : height;
14651
+ return {
14652
+ width: widthWithRotate,
14653
+ height: heightWithRotate * coefficients.heightOverlapCoef
14654
+ };
14655
+ };
14656
+
14657
+ var _getMeasurementContainer = lodash_memoize__WEBPACK_IMPORTED_MODULE_0___default()(function () {
14658
+ var element = document.createElementNS("http://www.w3.org/2000/svg", "svg");
14659
+ element.setAttribute("xlink", "http://www.w3.org/1999/xlink");
14660
+ var containerElement = document.createElementNS("http://www.w3.org/2000/svg", "text");
14661
+ element.appendChild(containerElement);
14662
+ element.style.position = "fixed";
14663
+ element.style.top = "-9999px";
14664
+ element.style.left = "-9999px";
14665
+ document.body.appendChild(element);
14666
+ return containerElement;
14667
+ });
14668
+
14669
+ var styleToKeyComponent = function (style) {
14670
+ if (!style) {
14671
+ return "null";
14672
+ }
14673
+
14674
+ return "".concat(style.angle, ":").concat(style.fontFamily, ":").concat(style.fontSize, ":").concat(style.letterSpacing, ":").concat(style.lineHeight);
14675
+ };
14676
+
14677
+ var _measureDimensionsInternal = lodash_memoize__WEBPACK_IMPORTED_MODULE_0___default()(function (text, style) {
14678
+ var containerElement = _getMeasurementContainer();
14679
+
14680
+ var lines = _splitToLines(text);
14681
+
14682
+ var heightAcc = 0;
14683
+
14684
+ for (var _ref of lines.entries()) {
14685
+ var _ref2 = _slicedToArray(_ref, 2);
14686
+
14687
+ var i = _ref2[0];
14688
+ var line = _ref2[1];
14689
+ var textElement = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
14690
+
14691
+ var params = _prepareParams(style, i);
14692
+
14693
+ textElement.style.fontFamily = params.fontFamily;
14694
+ textElement.style.transform = "rotate(".concat(params.angle, ")");
14695
+ textElement.style.fontSize = "".concat(params.fontSize, "px");
14696
+ textElement.style.lineHeight = params.lineHeight;
14697
+ textElement.style.fontFamily = params.fontFamily;
14698
+ textElement.style.letterSpacing = params.letterSpacing;
14699
+ textElement.textContent = line;
14700
+ textElement.setAttribute("x", "0");
14701
+ textElement.setAttribute("y", "".concat(heightAcc));
14702
+ heightAcc += params.lineHeight * params.fontSize;
14703
+ containerElement.appendChild(textElement);
14704
+ }
14705
+
14706
+ var _containerElement$get = containerElement.getBoundingClientRect(),
14707
+ width = _containerElement$get.width,
14708
+ height = _containerElement$get.height;
14709
+
14710
+ containerElement.innerHTML = "";
14711
+ return {
14712
+ width: width,
14713
+ height: height
14714
+ };
14715
+ }, function (text, style) {
14716
+ var totalText = Array.isArray(text) ? text.join() : text;
14717
+ var totalStyle = Array.isArray(style) ? style.map(styleToKeyComponent).join() : styleToKeyComponent(style);
14718
+ return "".concat(totalText, "::").concat(totalStyle);
14719
+ });
14720
+
14506
14721
  // Stubbable implementation.
14507
14722
  var _approximateTextSizeInternal = {
14508
14723
  impl: function (text, style) {
14509
- var angle = Array.isArray(style) ? style[0] && style[0].angle : style && style.angle;
14724
+ var __debugForceApproximate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
14510
14725
 
14511
- var height = _approximateTextHeightInternal(text, style);
14726
+ // Attempt to first measure the element in DOM. If there is no DOM, fallback
14727
+ // to the less accurate approximation algorithm.
14728
+ var isClient = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
14512
14729
 
14513
- var width = _approximateTextWidthInternal(text, style);
14730
+ if (!isClient || __debugForceApproximate) {
14731
+ return _approximateDimensionsInternal(text, style);
14732
+ }
14514
14733
 
14515
- var widthWithRotate = angle ? _getSizeWithRotate(width, height, angle) : width;
14516
- var heightWithRotate = angle ? _getSizeWithRotate(height, width, angle) : height;
14517
- return {
14518
- width: widthWithRotate,
14519
- height: heightWithRotate * coefficients.heightOverlapCoef
14520
- };
14734
+ return _measureDimensionsInternal(text, style);
14521
14735
  }
14522
14736
  };
14523
14737
  /**