victory-scatter 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,24 @@
1
1
  # victory-scatter
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-core@36.6.8
21
+
3
22
  ## 36.6.7
4
23
 
5
24
  ### Patch Changes
@@ -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,12 +13555,23 @@ __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 lodash_defaults__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/defaults */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/defaults.js");
13434
- /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_0__);
13435
- /* 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");
13436
- /* harmony import */ var lodash_assign__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_assign__WEBPACK_IMPORTED_MODULE_1__);
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
+
13565
+
13437
13566
 
13438
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; }
13439
13575
 
13440
13576
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
13441
13577
 
@@ -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 = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, lineStyle, defaultStyle);
13779
+ var style = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, lineStyle, defaultStyle);
13644
13780
 
13645
- return lodash_assign__WEBPACK_IMPORTED_MODULE_1___default()({}, style, {
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,99 @@ 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
+ var containerElement = document.createElementNS("http://www.w3.org/2000/svg", "text");
13847
+ element.appendChild(containerElement);
13848
+ element.style.position = "fixed";
13849
+ element.style.top = "-9999px";
13850
+ element.style.left = "-9999px";
13851
+ document.body.appendChild(element);
13852
+ return containerElement;
13853
+ });
13854
+
13855
+ var styleToKeyComponent = function (style) {
13856
+ if (!style) {
13857
+ return "null";
13858
+ }
13859
+
13860
+ return "".concat(style.angle, ":").concat(style.fontFamily, ":").concat(style.fontSize, ":").concat(style.letterSpacing, ":").concat(style.lineHeight);
13861
+ };
13862
+
13863
+ var _measureDimensionsInternal = lodash_memoize__WEBPACK_IMPORTED_MODULE_0___default()(function (text, style) {
13864
+ var containerElement = _getMeasurementContainer();
13865
+
13866
+ var lines = _splitToLines(text);
13867
+
13868
+ var heightAcc = 0;
13869
+
13870
+ for (var _ref of lines.entries()) {
13871
+ var _ref2 = _slicedToArray(_ref, 2);
13872
+
13873
+ var i = _ref2[0];
13874
+ var line = _ref2[1];
13875
+ var textElement = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
13876
+
13877
+ var params = _prepareParams(style, i);
13878
+
13879
+ textElement.style.fontFamily = params.fontFamily;
13880
+ textElement.style.transform = "rotate(".concat(params.angle, ")");
13881
+ textElement.style.fontSize = "".concat(params.fontSize, "px");
13882
+ textElement.style.lineHeight = params.lineHeight;
13883
+ textElement.style.fontFamily = params.fontFamily;
13884
+ textElement.style.letterSpacing = params.letterSpacing;
13885
+ textElement.textContent = line;
13886
+ textElement.setAttribute("x", "0");
13887
+ textElement.setAttribute("y", "".concat(heightAcc));
13888
+ heightAcc += params.lineHeight * params.fontSize;
13889
+ containerElement.appendChild(textElement);
13890
+ }
13891
+
13892
+ var _containerElement$get = containerElement.getBoundingClientRect(),
13893
+ width = _containerElement$get.width,
13894
+ height = _containerElement$get.height;
13895
+
13896
+ containerElement.innerHTML = "";
13897
+ return {
13898
+ width: width,
13899
+ height: height
13900
+ };
13901
+ }, function (text, style) {
13902
+ var totalText = Array.isArray(text) ? text.join() : text;
13903
+ var totalStyle = Array.isArray(style) ? style.map(styleToKeyComponent).join() : styleToKeyComponent(style);
13904
+ return "".concat(totalText, "::").concat(totalStyle);
13905
+ });
13906
+
13692
13907
  // Stubbable implementation.
13693
13908
  var _approximateTextSizeInternal = {
13694
13909
  impl: function (text, style) {
13695
- var angle = Array.isArray(style) ? style[0] && style[0].angle : style && style.angle;
13910
+ var __debugForceApproximate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
13696
13911
 
13697
- var height = _approximateTextHeightInternal(text, style);
13912
+ // Attempt to first measure the element in DOM. If there is no DOM, fallback
13913
+ // to the less accurate approximation algorithm.
13914
+ var isClient = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
13698
13915
 
13699
- var width = _approximateTextWidthInternal(text, style);
13916
+ if (!isClient || __debugForceApproximate) {
13917
+ return _approximateDimensionsInternal(text, style);
13918
+ }
13700
13919
 
13701
- var widthWithRotate = angle ? _getSizeWithRotate(width, height, angle) : width;
13702
- var heightWithRotate = angle ? _getSizeWithRotate(height, width, angle) : height;
13703
- return {
13704
- width: widthWithRotate,
13705
- height: heightWithRotate * coefficients.heightOverlapCoef
13706
- };
13920
+ return _measureDimensionsInternal(text, style);
13707
13921
  }
13708
13922
  };
13709
13923
  /**