victory-create-container 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,29 @@
1
1
  # victory-create-container
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 [[`c5b4f660c`](https://github.com/FormidableLabs/victory/commit/c5b4f660cb91d8d1979d216b846a44f0c5030ec1)]:
20
+ - victory-zoom-container@36.6.8
21
+ - victory-brush-container@36.6.8
22
+ - victory-core@36.6.8
23
+ - victory-cursor-container@36.6.8
24
+ - victory-selection-container@36.6.8
25
+ - victory-voronoi-container@36.6.8
26
+
3
27
  ## 36.6.7
4
28
 
5
29
  ### Patch Changes
@@ -1044,6 +1044,48 @@ function noop() {
1044
1044
  module.exports = noop;
1045
1045
 
1046
1046
 
1047
+ /***/ }),
1048
+
1049
+ /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_MapCache.js":
1050
+ /*!***********************************************************************************!*\
1051
+ !*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_MapCache.js ***!
1052
+ \***********************************************************************************/
1053
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1054
+
1055
+ var listCacheClear = __webpack_require__(/*! ./_listCacheClear */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheClear.js"),
1056
+ listCacheDelete = __webpack_require__(/*! ./_listCacheDelete */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheDelete.js"),
1057
+ listCacheGet = __webpack_require__(/*! ./_listCacheGet */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheGet.js"),
1058
+ listCacheHas = __webpack_require__(/*! ./_listCacheHas */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheHas.js"),
1059
+ listCacheSet = __webpack_require__(/*! ./_listCacheSet */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheSet.js");
1060
+
1061
+ /**
1062
+ * Creates an list cache object.
1063
+ *
1064
+ * @private
1065
+ * @constructor
1066
+ * @param {Array} [entries] The key-value pairs to cache.
1067
+ */
1068
+ function ListCache(entries) {
1069
+ var index = -1,
1070
+ length = entries == null ? 0 : entries.length;
1071
+
1072
+ this.clear();
1073
+ while (++index < length) {
1074
+ var entry = entries[index];
1075
+ this.set(entry[0], entry[1]);
1076
+ }
1077
+ }
1078
+
1079
+ // Add methods to `ListCache`.
1080
+ ListCache.prototype.clear = listCacheClear;
1081
+ ListCache.prototype['delete'] = listCacheDelete;
1082
+ ListCache.prototype.get = listCacheGet;
1083
+ ListCache.prototype.has = listCacheHas;
1084
+ ListCache.prototype.set = listCacheSet;
1085
+
1086
+ module.exports = ListCache;
1087
+
1088
+
1047
1089
  /***/ }),
1048
1090
 
1049
1091
  /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_SetCache.js":
@@ -6732,6 +6774,89 @@ function mapValues(object, iteratee) {
6732
6774
  module.exports = mapValues;
6733
6775
 
6734
6776
 
6777
+ /***/ }),
6778
+
6779
+ /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/memoize.js":
6780
+ /*!*********************************************************************************!*\
6781
+ !*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/memoize.js ***!
6782
+ \*********************************************************************************/
6783
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6784
+
6785
+ var MapCache = __webpack_require__(/*! ./_MapCache */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_MapCache.js");
6786
+
6787
+ /** Error message constants. */
6788
+ var FUNC_ERROR_TEXT = 'Expected a function';
6789
+
6790
+ /**
6791
+ * Creates a function that memoizes the result of `func`. If `resolver` is
6792
+ * provided, it determines the cache key for storing the result based on the
6793
+ * arguments provided to the memoized function. By default, the first argument
6794
+ * provided to the memoized function is used as the map cache key. The `func`
6795
+ * is invoked with the `this` binding of the memoized function.
6796
+ *
6797
+ * **Note:** The cache is exposed as the `cache` property on the memoized
6798
+ * function. Its creation may be customized by replacing the `_.memoize.Cache`
6799
+ * constructor with one whose instances implement the
6800
+ * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
6801
+ * method interface of `clear`, `delete`, `get`, `has`, and `set`.
6802
+ *
6803
+ * @static
6804
+ * @memberOf _
6805
+ * @since 0.1.0
6806
+ * @category Function
6807
+ * @param {Function} func The function to have its output memoized.
6808
+ * @param {Function} [resolver] The function to resolve the cache key.
6809
+ * @returns {Function} Returns the new memoized function.
6810
+ * @example
6811
+ *
6812
+ * var object = { 'a': 1, 'b': 2 };
6813
+ * var other = { 'c': 3, 'd': 4 };
6814
+ *
6815
+ * var values = _.memoize(_.values);
6816
+ * values(object);
6817
+ * // => [1, 2]
6818
+ *
6819
+ * values(other);
6820
+ * // => [3, 4]
6821
+ *
6822
+ * object.a = 2;
6823
+ * values(object);
6824
+ * // => [1, 2]
6825
+ *
6826
+ * // Modify the result cache.
6827
+ * values.cache.set(object, ['a', 'b']);
6828
+ * values(object);
6829
+ * // => ['a', 'b']
6830
+ *
6831
+ * // Replace `_.memoize.Cache`.
6832
+ * _.memoize.Cache = WeakMap;
6833
+ */
6834
+ function memoize(func, resolver) {
6835
+ if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
6836
+ throw new TypeError(FUNC_ERROR_TEXT);
6837
+ }
6838
+ var memoized = function() {
6839
+ var args = arguments,
6840
+ key = resolver ? resolver.apply(this, args) : args[0],
6841
+ cache = memoized.cache;
6842
+
6843
+ if (cache.has(key)) {
6844
+ return cache.get(key);
6845
+ }
6846
+ var result = func.apply(this, args);
6847
+ memoized.cache = cache.set(key, result) || cache;
6848
+ return result;
6849
+ };
6850
+ memoized.cache = new (memoize.Cache || MapCache);
6851
+ return memoized;
6852
+ }
6853
+
6854
+ // Expose `MapCache`.
6855
+ memoize.Cache = MapCache;
6856
+
6857
+ module.exports = memoize;
6858
+
6859
+
6735
6860
  /***/ }),
6736
6861
 
6737
6862
  /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/negate.js":
@@ -15815,12 +15940,23 @@ __webpack_require__.r(__webpack_exports__);
15815
15940
  /* harmony export */ "approximateTextSize": () => (/* binding */ approximateTextSize),
15816
15941
  /* harmony export */ "convertLengthToPixels": () => (/* binding */ convertLengthToPixels)
15817
15942
  /* harmony export */ });
15818
- /* 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");
15819
- /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_0__);
15820
- /* 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");
15821
- /* harmony import */ var lodash_assign__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_assign__WEBPACK_IMPORTED_MODULE_1__);
15943
+ /* 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");
15944
+ /* harmony import */ var lodash_memoize__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_memoize__WEBPACK_IMPORTED_MODULE_0__);
15945
+ /* 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");
15946
+ /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_1__);
15947
+ /* 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");
15948
+ /* harmony import */ var lodash_assign__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_assign__WEBPACK_IMPORTED_MODULE_2__);
15949
+
15950
+
15822
15951
 
15823
15952
 
15953
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
15954
+
15955
+ 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."); }
15956
+
15957
+ 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; }
15958
+
15959
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
15824
15960
 
15825
15961
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
15826
15962
 
@@ -16025,9 +16161,9 @@ var convertLengthToPixels = function (length, fontSize) {
16025
16161
  var _prepareParams = function (inputStyle, index) {
16026
16162
  var lineStyle = Array.isArray(inputStyle) ? inputStyle[index] : inputStyle;
16027
16163
 
16028
- var style = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, lineStyle, defaultStyle);
16164
+ var style = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, lineStyle, defaultStyle);
16029
16165
 
16030
- return lodash_assign__WEBPACK_IMPORTED_MODULE_1___default()({}, style, {
16166
+ return lodash_assign__WEBPACK_IMPORTED_MODULE_2___default()({}, style, {
16031
16167
  fontFamily: style.fontFamily,
16032
16168
  letterSpacing: typeof style.letterSpacing === "number" ? style.letterSpacing : convertLengthToPixels(String(style.letterSpacing), style.fontSize),
16033
16169
  fontSize: typeof style.fontSize === "number" ? style.fontSize : convertLengthToPixels(String(style.fontSize))
@@ -16074,21 +16210,99 @@ var _approximateTextHeightInternal = function (text, style) {
16074
16210
  }, 0);
16075
16211
  };
16076
16212
 
16213
+ var _approximateDimensionsInternal = function (text, style) {
16214
+ var angle = Array.isArray(style) ? style[0] && style[0].angle : style && style.angle;
16215
+
16216
+ var height = _approximateTextHeightInternal(text, style);
16217
+
16218
+ var width = _approximateTextWidthInternal(text, style);
16219
+
16220
+ var widthWithRotate = angle ? _getSizeWithRotate(width, height, angle) : width;
16221
+ var heightWithRotate = angle ? _getSizeWithRotate(height, width, angle) : height;
16222
+ return {
16223
+ width: widthWithRotate,
16224
+ height: heightWithRotate * coefficients.heightOverlapCoef
16225
+ };
16226
+ };
16227
+
16228
+ var _getMeasurementContainer = lodash_memoize__WEBPACK_IMPORTED_MODULE_0___default()(function () {
16229
+ var element = document.createElementNS("http://www.w3.org/2000/svg", "svg");
16230
+ element.setAttribute("xlink", "http://www.w3.org/1999/xlink");
16231
+ var containerElement = document.createElementNS("http://www.w3.org/2000/svg", "text");
16232
+ element.appendChild(containerElement);
16233
+ element.style.position = "fixed";
16234
+ element.style.top = "-9999px";
16235
+ element.style.left = "-9999px";
16236
+ document.body.appendChild(element);
16237
+ return containerElement;
16238
+ });
16239
+
16240
+ var styleToKeyComponent = function (style) {
16241
+ if (!style) {
16242
+ return "null";
16243
+ }
16244
+
16245
+ return "".concat(style.angle, ":").concat(style.fontFamily, ":").concat(style.fontSize, ":").concat(style.letterSpacing, ":").concat(style.lineHeight);
16246
+ };
16247
+
16248
+ var _measureDimensionsInternal = lodash_memoize__WEBPACK_IMPORTED_MODULE_0___default()(function (text, style) {
16249
+ var containerElement = _getMeasurementContainer();
16250
+
16251
+ var lines = _splitToLines(text);
16252
+
16253
+ var heightAcc = 0;
16254
+
16255
+ for (var _ref of lines.entries()) {
16256
+ var _ref2 = _slicedToArray(_ref, 2);
16257
+
16258
+ var i = _ref2[0];
16259
+ var line = _ref2[1];
16260
+ var textElement = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
16261
+
16262
+ var params = _prepareParams(style, i);
16263
+
16264
+ textElement.style.fontFamily = params.fontFamily;
16265
+ textElement.style.transform = "rotate(".concat(params.angle, ")");
16266
+ textElement.style.fontSize = "".concat(params.fontSize, "px");
16267
+ textElement.style.lineHeight = params.lineHeight;
16268
+ textElement.style.fontFamily = params.fontFamily;
16269
+ textElement.style.letterSpacing = params.letterSpacing;
16270
+ textElement.textContent = line;
16271
+ textElement.setAttribute("x", "0");
16272
+ textElement.setAttribute("y", "".concat(heightAcc));
16273
+ heightAcc += params.lineHeight * params.fontSize;
16274
+ containerElement.appendChild(textElement);
16275
+ }
16276
+
16277
+ var _containerElement$get = containerElement.getBoundingClientRect(),
16278
+ width = _containerElement$get.width,
16279
+ height = _containerElement$get.height;
16280
+
16281
+ containerElement.innerHTML = "";
16282
+ return {
16283
+ width: width,
16284
+ height: height
16285
+ };
16286
+ }, function (text, style) {
16287
+ var totalText = Array.isArray(text) ? text.join() : text;
16288
+ var totalStyle = Array.isArray(style) ? style.map(styleToKeyComponent).join() : styleToKeyComponent(style);
16289
+ return "".concat(totalText, "::").concat(totalStyle);
16290
+ });
16291
+
16077
16292
  // Stubbable implementation.
16078
16293
  var _approximateTextSizeInternal = {
16079
16294
  impl: function (text, style) {
16080
- var angle = Array.isArray(style) ? style[0] && style[0].angle : style && style.angle;
16295
+ var __debugForceApproximate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
16081
16296
 
16082
- var height = _approximateTextHeightInternal(text, style);
16297
+ // Attempt to first measure the element in DOM. If there is no DOM, fallback
16298
+ // to the less accurate approximation algorithm.
16299
+ var isClient = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
16083
16300
 
16084
- var width = _approximateTextWidthInternal(text, style);
16301
+ if (!isClient || __debugForceApproximate) {
16302
+ return _approximateDimensionsInternal(text, style);
16303
+ }
16085
16304
 
16086
- var widthWithRotate = angle ? _getSizeWithRotate(width, height, angle) : width;
16087
- var heightWithRotate = angle ? _getSizeWithRotate(height, width, angle) : height;
16088
- return {
16089
- width: widthWithRotate,
16090
- height: heightWithRotate * coefficients.heightOverlapCoef
16091
- };
16305
+ return _measureDimensionsInternal(text, style);
16092
16306
  }
16093
16307
  };
16094
16308
  /**