victory-chart 36.6.7 → 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,27 @@
1
1
  # victory-chart
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
+
15
+ ## 36.6.8
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies []:
20
+ - victory-axis@36.6.8
21
+ - victory-core@36.6.8
22
+ - victory-polar-axis@36.6.8
23
+ - victory-shared-events@36.6.8
24
+
3
25
  ## 36.6.7
4
26
 
5
27
  ### Patch Changes
@@ -503,6 +503,48 @@ function serializer(replacer, cycleReplacer) {
503
503
  }
504
504
 
505
505
 
506
+ /***/ }),
507
+
508
+ /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_MapCache.js":
509
+ /*!***********************************************************************************!*\
510
+ !*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_MapCache.js ***!
511
+ \***********************************************************************************/
512
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
513
+
514
+ var listCacheClear = __webpack_require__(/*! ./_listCacheClear */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheClear.js"),
515
+ listCacheDelete = __webpack_require__(/*! ./_listCacheDelete */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheDelete.js"),
516
+ listCacheGet = __webpack_require__(/*! ./_listCacheGet */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheGet.js"),
517
+ listCacheHas = __webpack_require__(/*! ./_listCacheHas */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheHas.js"),
518
+ listCacheSet = __webpack_require__(/*! ./_listCacheSet */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheSet.js");
519
+
520
+ /**
521
+ * Creates an list cache object.
522
+ *
523
+ * @private
524
+ * @constructor
525
+ * @param {Array} [entries] The key-value pairs to cache.
526
+ */
527
+ function ListCache(entries) {
528
+ var index = -1,
529
+ length = entries == null ? 0 : entries.length;
530
+
531
+ this.clear();
532
+ while (++index < length) {
533
+ var entry = entries[index];
534
+ this.set(entry[0], entry[1]);
535
+ }
536
+ }
537
+
538
+ // Add methods to `ListCache`.
539
+ ListCache.prototype.clear = listCacheClear;
540
+ ListCache.prototype['delete'] = listCacheDelete;
541
+ ListCache.prototype.get = listCacheGet;
542
+ ListCache.prototype.has = listCacheHas;
543
+ ListCache.prototype.set = listCacheSet;
544
+
545
+ module.exports = ListCache;
546
+
547
+
506
548
  /***/ }),
507
549
 
508
550
  /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_SetCache.js":
@@ -5525,6 +5567,89 @@ function last(array) {
5525
5567
  module.exports = last;
5526
5568
 
5527
5569
 
5570
+ /***/ }),
5571
+
5572
+ /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/memoize.js":
5573
+ /*!*********************************************************************************!*\
5574
+ !*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/memoize.js ***!
5575
+ \*********************************************************************************/
5576
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
5577
+
5578
+ var MapCache = __webpack_require__(/*! ./_MapCache */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_MapCache.js");
5579
+
5580
+ /** Error message constants. */
5581
+ var FUNC_ERROR_TEXT = 'Expected a function';
5582
+
5583
+ /**
5584
+ * Creates a function that memoizes the result of `func`. If `resolver` is
5585
+ * provided, it determines the cache key for storing the result based on the
5586
+ * arguments provided to the memoized function. By default, the first argument
5587
+ * provided to the memoized function is used as the map cache key. The `func`
5588
+ * is invoked with the `this` binding of the memoized function.
5589
+ *
5590
+ * **Note:** The cache is exposed as the `cache` property on the memoized
5591
+ * function. Its creation may be customized by replacing the `_.memoize.Cache`
5592
+ * constructor with one whose instances implement the
5593
+ * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
5594
+ * method interface of `clear`, `delete`, `get`, `has`, and `set`.
5595
+ *
5596
+ * @static
5597
+ * @memberOf _
5598
+ * @since 0.1.0
5599
+ * @category Function
5600
+ * @param {Function} func The function to have its output memoized.
5601
+ * @param {Function} [resolver] The function to resolve the cache key.
5602
+ * @returns {Function} Returns the new memoized function.
5603
+ * @example
5604
+ *
5605
+ * var object = { 'a': 1, 'b': 2 };
5606
+ * var other = { 'c': 3, 'd': 4 };
5607
+ *
5608
+ * var values = _.memoize(_.values);
5609
+ * values(object);
5610
+ * // => [1, 2]
5611
+ *
5612
+ * values(other);
5613
+ * // => [3, 4]
5614
+ *
5615
+ * object.a = 2;
5616
+ * values(object);
5617
+ * // => [1, 2]
5618
+ *
5619
+ * // Modify the result cache.
5620
+ * values.cache.set(object, ['a', 'b']);
5621
+ * values(object);
5622
+ * // => ['a', 'b']
5623
+ *
5624
+ * // Replace `_.memoize.Cache`.
5625
+ * _.memoize.Cache = WeakMap;
5626
+ */
5627
+ function memoize(func, resolver) {
5628
+ if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
5629
+ throw new TypeError(FUNC_ERROR_TEXT);
5630
+ }
5631
+ var memoized = function() {
5632
+ var args = arguments,
5633
+ key = resolver ? resolver.apply(this, args) : args[0],
5634
+ cache = memoized.cache;
5635
+
5636
+ if (cache.has(key)) {
5637
+ return cache.get(key);
5638
+ }
5639
+ var result = func.apply(this, args);
5640
+ memoized.cache = cache.set(key, result) || cache;
5641
+ return result;
5642
+ };
5643
+ memoized.cache = new (memoize.Cache || MapCache);
5644
+ return memoized;
5645
+ }
5646
+
5647
+ // Expose `MapCache`.
5648
+ memoize.Cache = MapCache;
5649
+
5650
+ module.exports = memoize;
5651
+
5652
+
5528
5653
  /***/ }),
5529
5654
 
5530
5655
  /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/negate.js":
@@ -15775,12 +15900,23 @@ __webpack_require__.r(__webpack_exports__);
15775
15900
  /* harmony export */ "approximateTextSize": () => (/* binding */ approximateTextSize),
15776
15901
  /* harmony export */ "convertLengthToPixels": () => (/* binding */ convertLengthToPixels)
15777
15902
  /* harmony export */ });
15778
- /* 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");
15779
- /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_0__);
15780
- /* 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");
15781
- /* harmony import */ var lodash_assign__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_assign__WEBPACK_IMPORTED_MODULE_1__);
15903
+ /* 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");
15904
+ /* harmony import */ var lodash_memoize__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_memoize__WEBPACK_IMPORTED_MODULE_0__);
15905
+ /* 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");
15906
+ /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_1__);
15907
+ /* 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");
15908
+ /* harmony import */ var lodash_assign__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_assign__WEBPACK_IMPORTED_MODULE_2__);
15909
+
15910
+
15782
15911
 
15783
15912
 
15913
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
15914
+
15915
+ 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."); }
15916
+
15917
+ 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; }
15918
+
15919
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
15784
15920
 
15785
15921
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
15786
15922
 
@@ -15985,9 +16121,9 @@ var convertLengthToPixels = function (length, fontSize) {
15985
16121
  var _prepareParams = function (inputStyle, index) {
15986
16122
  var lineStyle = Array.isArray(inputStyle) ? inputStyle[index] : inputStyle;
15987
16123
 
15988
- var style = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, lineStyle, defaultStyle);
16124
+ var style = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, lineStyle, defaultStyle);
15989
16125
 
15990
- return lodash_assign__WEBPACK_IMPORTED_MODULE_1___default()({}, style, {
16126
+ return lodash_assign__WEBPACK_IMPORTED_MODULE_2___default()({}, style, {
15991
16127
  fontFamily: style.fontFamily,
15992
16128
  letterSpacing: typeof style.letterSpacing === "number" ? style.letterSpacing : convertLengthToPixels(String(style.letterSpacing), style.fontSize),
15993
16129
  fontSize: typeof style.fontSize === "number" ? style.fontSize : convertLengthToPixels(String(style.fontSize))
@@ -16034,21 +16170,99 @@ var _approximateTextHeightInternal = function (text, style) {
16034
16170
  }, 0);
16035
16171
  };
16036
16172
 
16173
+ var _approximateDimensionsInternal = function (text, style) {
16174
+ var angle = Array.isArray(style) ? style[0] && style[0].angle : style && style.angle;
16175
+
16176
+ var height = _approximateTextHeightInternal(text, style);
16177
+
16178
+ var width = _approximateTextWidthInternal(text, style);
16179
+
16180
+ var widthWithRotate = angle ? _getSizeWithRotate(width, height, angle) : width;
16181
+ var heightWithRotate = angle ? _getSizeWithRotate(height, width, angle) : height;
16182
+ return {
16183
+ width: widthWithRotate,
16184
+ height: heightWithRotate * coefficients.heightOverlapCoef
16185
+ };
16186
+ };
16187
+
16188
+ var _getMeasurementContainer = lodash_memoize__WEBPACK_IMPORTED_MODULE_0___default()(function () {
16189
+ var element = document.createElementNS("http://www.w3.org/2000/svg", "svg");
16190
+ element.setAttribute("xlink", "http://www.w3.org/1999/xlink");
16191
+ var containerElement = document.createElementNS("http://www.w3.org/2000/svg", "text");
16192
+ element.appendChild(containerElement);
16193
+ element.style.position = "fixed";
16194
+ element.style.top = "-9999px";
16195
+ element.style.left = "-9999px";
16196
+ document.body.appendChild(element);
16197
+ return containerElement;
16198
+ });
16199
+
16200
+ var styleToKeyComponent = function (style) {
16201
+ if (!style) {
16202
+ return "null";
16203
+ }
16204
+
16205
+ return "".concat(style.angle, ":").concat(style.fontFamily, ":").concat(style.fontSize, ":").concat(style.letterSpacing, ":").concat(style.lineHeight);
16206
+ };
16207
+
16208
+ var _measureDimensionsInternal = lodash_memoize__WEBPACK_IMPORTED_MODULE_0___default()(function (text, style) {
16209
+ var containerElement = _getMeasurementContainer();
16210
+
16211
+ var lines = _splitToLines(text);
16212
+
16213
+ var heightAcc = 0;
16214
+
16215
+ for (var _ref of lines.entries()) {
16216
+ var _ref2 = _slicedToArray(_ref, 2);
16217
+
16218
+ var i = _ref2[0];
16219
+ var line = _ref2[1];
16220
+ var textElement = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
16221
+
16222
+ var params = _prepareParams(style, i);
16223
+
16224
+ textElement.style.fontFamily = params.fontFamily;
16225
+ textElement.style.transform = "rotate(".concat(params.angle, ")");
16226
+ textElement.style.fontSize = "".concat(params.fontSize, "px");
16227
+ textElement.style.lineHeight = params.lineHeight;
16228
+ textElement.style.fontFamily = params.fontFamily;
16229
+ textElement.style.letterSpacing = params.letterSpacing;
16230
+ textElement.textContent = line;
16231
+ textElement.setAttribute("x", "0");
16232
+ textElement.setAttribute("y", "".concat(heightAcc));
16233
+ heightAcc += params.lineHeight * params.fontSize;
16234
+ containerElement.appendChild(textElement);
16235
+ }
16236
+
16237
+ var _containerElement$get = containerElement.getBoundingClientRect(),
16238
+ width = _containerElement$get.width,
16239
+ height = _containerElement$get.height;
16240
+
16241
+ containerElement.innerHTML = "";
16242
+ return {
16243
+ width: width,
16244
+ height: height
16245
+ };
16246
+ }, function (text, style) {
16247
+ var totalText = Array.isArray(text) ? text.join() : text;
16248
+ var totalStyle = Array.isArray(style) ? style.map(styleToKeyComponent).join() : styleToKeyComponent(style);
16249
+ return "".concat(totalText, "::").concat(totalStyle);
16250
+ });
16251
+
16037
16252
  // Stubbable implementation.
16038
16253
  var _approximateTextSizeInternal = {
16039
16254
  impl: function (text, style) {
16040
- var angle = Array.isArray(style) ? style[0] && style[0].angle : style && style.angle;
16255
+ var __debugForceApproximate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
16041
16256
 
16042
- var height = _approximateTextHeightInternal(text, style);
16257
+ // Attempt to first measure the element in DOM. If there is no DOM, fallback
16258
+ // to the less accurate approximation algorithm.
16259
+ var isClient = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
16043
16260
 
16044
- var width = _approximateTextWidthInternal(text, style);
16261
+ if (!isClient || __debugForceApproximate) {
16262
+ return _approximateDimensionsInternal(text, style);
16263
+ }
16045
16264
 
16046
- var widthWithRotate = angle ? _getSizeWithRotate(width, height, angle) : width;
16047
- var heightWithRotate = angle ? _getSizeWithRotate(height, width, angle) : height;
16048
- return {
16049
- width: widthWithRotate,
16050
- height: heightWithRotate * coefficients.heightOverlapCoef
16051
- };
16265
+ return _measureDimensionsInternal(text, style);
16052
16266
  }
16053
16267
  };
16054
16268
  /**