@antv/g 5.1.8 → 5.2.0

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/dist/index.js CHANGED
@@ -10,12 +10,14 @@ var glMatrix = require('gl-matrix');
10
10
  var gMath = require('@antv/g-math');
11
11
  var eventemitter3 = require('eventemitter3');
12
12
  var d3 = require('d3-color');
13
+ var memoize = require('lodash.memoize');
13
14
  var util = require('@antv/util');
14
15
  var requestAnimationFramePolyfill = require('request-animation-frame-polyfill');
15
16
 
16
17
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
17
18
 
18
19
  var RBush__default = /*#__PURE__*/_interopDefaultLegacy(RBush);
20
+ var memoize__default = /*#__PURE__*/_interopDefaultLegacy(memoize);
19
21
 
20
22
  function _regeneratorRuntime() {
21
23
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
@@ -1688,6 +1690,379 @@ var TOUCH_TO_POINTER = {
1688
1690
  touchcancel: 'pointercancel'
1689
1691
  };
1690
1692
 
1693
+ /**
1694
+ * borrow from gradient-parser, but we delete some browser compatible prefix such as `-webkit-`
1695
+ * @see https://github.com/rafaelcaricio/gradient-parser
1696
+ */
1697
+ function colorStopToString(colorStop) {
1698
+ var type = colorStop.type,
1699
+ value = colorStop.value;
1700
+
1701
+ if (type === 'hex') {
1702
+ return "#" + value;
1703
+ } else if (type === 'literal') {
1704
+ return value;
1705
+ } else if (type === 'rgb') {
1706
+ return "rgb(" + value.join(',') + ")";
1707
+ } else {
1708
+ return "rgba(" + value.join(',') + ")";
1709
+ }
1710
+ }
1711
+ var parseGradient = function () {
1712
+ var tokens = {
1713
+ linearGradient: /^(linear\-gradient)/i,
1714
+ repeatingLinearGradient: /^(repeating\-linear\-gradient)/i,
1715
+ radialGradient: /^(radial\-gradient)/i,
1716
+ repeatingRadialGradient: /^(repeating\-radial\-gradient)/i,
1717
+
1718
+ /**
1719
+ * @see https://projects.verou.me/conic-gradient/
1720
+ */
1721
+ conicGradient: /^(conic\-gradient)/i,
1722
+ sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,
1723
+ extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,
1724
+ positionKeywords: /^(left|center|right|top|bottom)/i,
1725
+ pixelValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,
1726
+ percentageValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,
1727
+ emValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,
1728
+ angleValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,
1729
+ startCall: /^\(/,
1730
+ endCall: /^\)/,
1731
+ comma: /^,/,
1732
+ hexColor: /^\#([0-9a-fA-F]+)/,
1733
+ literalColor: /^([a-zA-Z]+)/,
1734
+ rgbColor: /^rgb/i,
1735
+ rgbaColor: /^rgba/i,
1736
+ number: /^(([0-9]*\.[0-9]+)|([0-9]+\.?))/
1737
+ };
1738
+ var input = '';
1739
+
1740
+ function error(msg) {
1741
+ throw new Error(input + ': ' + msg);
1742
+ }
1743
+
1744
+ function getAST() {
1745
+ var ast = matchListDefinitions();
1746
+
1747
+ if (input.length > 0) {
1748
+ error('Invalid input not EOF');
1749
+ }
1750
+
1751
+ return ast;
1752
+ }
1753
+
1754
+ function matchListDefinitions() {
1755
+ return matchListing(matchDefinition);
1756
+ }
1757
+
1758
+ function matchDefinition() {
1759
+ return matchGradient('linear-gradient', tokens.linearGradient, matchLinearOrientation) || matchGradient('repeating-linear-gradient', tokens.repeatingLinearGradient, matchLinearOrientation) || matchGradient('radial-gradient', tokens.radialGradient, matchListRadialOrientations) || matchGradient('repeating-radial-gradient', tokens.repeatingRadialGradient, matchListRadialOrientations) || matchGradient('conic-gradient', tokens.conicGradient, matchListRadialOrientations);
1760
+ }
1761
+
1762
+ function matchGradient(gradientType, pattern, orientationMatcher) {
1763
+ return matchCall(pattern, function (captures) {
1764
+ var orientation = orientationMatcher();
1765
+
1766
+ if (orientation) {
1767
+ if (!scan(tokens.comma)) {
1768
+ error('Missing comma before color stops');
1769
+ }
1770
+ }
1771
+
1772
+ return {
1773
+ type: gradientType,
1774
+ orientation: orientation,
1775
+ colorStops: matchListing(matchColorStop)
1776
+ };
1777
+ });
1778
+ }
1779
+
1780
+ function matchCall(pattern, callback) {
1781
+ var captures = scan(pattern);
1782
+
1783
+ if (captures) {
1784
+ if (!scan(tokens.startCall)) {
1785
+ error('Missing (');
1786
+ }
1787
+
1788
+ var result = callback(captures);
1789
+
1790
+ if (!scan(tokens.endCall)) {
1791
+ error('Missing )');
1792
+ }
1793
+
1794
+ return result;
1795
+ }
1796
+ }
1797
+
1798
+ function matchLinearOrientation() {
1799
+ return matchSideOrCorner() || matchAngle();
1800
+ }
1801
+
1802
+ function matchSideOrCorner() {
1803
+ return match('directional', tokens.sideOrCorner, 1);
1804
+ }
1805
+
1806
+ function matchAngle() {
1807
+ return match('angular', tokens.angleValue, 1);
1808
+ }
1809
+
1810
+ function matchListRadialOrientations() {
1811
+ var radialOrientations,
1812
+ radialOrientation = matchRadialOrientation(),
1813
+ lookaheadCache;
1814
+
1815
+ if (radialOrientation) {
1816
+ radialOrientations = [];
1817
+ radialOrientations.push(radialOrientation);
1818
+ lookaheadCache = input;
1819
+
1820
+ if (scan(tokens.comma)) {
1821
+ radialOrientation = matchRadialOrientation();
1822
+
1823
+ if (radialOrientation) {
1824
+ radialOrientations.push(radialOrientation);
1825
+ } else {
1826
+ input = lookaheadCache;
1827
+ }
1828
+ }
1829
+ }
1830
+
1831
+ return radialOrientations;
1832
+ }
1833
+
1834
+ function matchRadialOrientation() {
1835
+ var radialType = matchCircle() || matchEllipse();
1836
+
1837
+ if (radialType) {
1838
+ // @ts-ignore
1839
+ radialType.at = matchAtPosition();
1840
+ } else {
1841
+ var extent = matchExtentKeyword();
1842
+
1843
+ if (extent) {
1844
+ radialType = extent;
1845
+ var positionAt = matchAtPosition();
1846
+
1847
+ if (positionAt) {
1848
+ // @ts-ignore
1849
+ radialType.at = positionAt;
1850
+ }
1851
+ } else {
1852
+ var defaultPosition = matchPositioning();
1853
+
1854
+ if (defaultPosition) {
1855
+ radialType = {
1856
+ type: 'default-radial',
1857
+ // @ts-ignore
1858
+ at: defaultPosition
1859
+ };
1860
+ }
1861
+ }
1862
+ }
1863
+
1864
+ return radialType;
1865
+ }
1866
+
1867
+ function matchCircle() {
1868
+ var circle = match('shape', /^(circle)/i, 0);
1869
+
1870
+ if (circle) {
1871
+ // @ts-ignore
1872
+ circle.style = matchLength() || matchExtentKeyword();
1873
+ }
1874
+
1875
+ return circle;
1876
+ }
1877
+
1878
+ function matchEllipse() {
1879
+ var ellipse = match('shape', /^(ellipse)/i, 0);
1880
+
1881
+ if (ellipse) {
1882
+ // @ts-ignore
1883
+ ellipse.style = matchDistance() || matchExtentKeyword();
1884
+ }
1885
+
1886
+ return ellipse;
1887
+ }
1888
+
1889
+ function matchExtentKeyword() {
1890
+ return match('extent-keyword', tokens.extentKeywords, 1);
1891
+ }
1892
+
1893
+ function matchAtPosition() {
1894
+ if (match('position', /^at/, 0)) {
1895
+ var positioning = matchPositioning();
1896
+
1897
+ if (!positioning) {
1898
+ error('Missing positioning value');
1899
+ }
1900
+
1901
+ return positioning;
1902
+ }
1903
+ }
1904
+
1905
+ function matchPositioning() {
1906
+ var location = matchCoordinates();
1907
+
1908
+ if (location.x || location.y) {
1909
+ return {
1910
+ type: 'position',
1911
+ value: location
1912
+ };
1913
+ }
1914
+ }
1915
+
1916
+ function matchCoordinates() {
1917
+ return {
1918
+ x: matchDistance(),
1919
+ y: matchDistance()
1920
+ };
1921
+ }
1922
+
1923
+ function matchListing(matcher) {
1924
+ var captures = matcher();
1925
+ var result = [];
1926
+
1927
+ if (captures) {
1928
+ result.push(captures);
1929
+
1930
+ while (scan(tokens.comma)) {
1931
+ captures = matcher();
1932
+
1933
+ if (captures) {
1934
+ result.push(captures);
1935
+ } else {
1936
+ error('One extra comma');
1937
+ }
1938
+ }
1939
+ }
1940
+
1941
+ return result;
1942
+ }
1943
+
1944
+ function matchColorStop() {
1945
+ var color = matchColor();
1946
+
1947
+ if (!color) {
1948
+ error('Expected color definition');
1949
+ }
1950
+
1951
+ color.length = matchDistance();
1952
+ return color;
1953
+ }
1954
+
1955
+ function matchColor() {
1956
+ return matchHexColor() || matchRGBAColor() || matchRGBColor() || matchLiteralColor();
1957
+ }
1958
+
1959
+ function matchLiteralColor() {
1960
+ return match('literal', tokens.literalColor, 0);
1961
+ }
1962
+
1963
+ function matchHexColor() {
1964
+ return match('hex', tokens.hexColor, 1);
1965
+ }
1966
+
1967
+ function matchRGBColor() {
1968
+ return matchCall(tokens.rgbColor, function () {
1969
+ return {
1970
+ type: 'rgb',
1971
+ value: matchListing(matchNumber)
1972
+ };
1973
+ });
1974
+ }
1975
+
1976
+ function matchRGBAColor() {
1977
+ return matchCall(tokens.rgbaColor, function () {
1978
+ return {
1979
+ type: 'rgba',
1980
+ value: matchListing(matchNumber)
1981
+ };
1982
+ });
1983
+ }
1984
+
1985
+ function matchNumber() {
1986
+ return scan(tokens.number)[1];
1987
+ }
1988
+
1989
+ function matchDistance() {
1990
+ return match('%', tokens.percentageValue, 1) || matchPositionKeyword() || matchLength();
1991
+ }
1992
+
1993
+ function matchPositionKeyword() {
1994
+ return match('position-keyword', tokens.positionKeywords, 1);
1995
+ }
1996
+
1997
+ function matchLength() {
1998
+ return match('px', tokens.pixelValue, 1) || match('em', tokens.emValue, 1);
1999
+ }
2000
+
2001
+ function match(type, pattern, captureIndex) {
2002
+ var captures = scan(pattern);
2003
+
2004
+ if (captures) {
2005
+ return {
2006
+ type: type,
2007
+ value: captures[captureIndex]
2008
+ };
2009
+ }
2010
+ }
2011
+
2012
+ function scan(regexp) {
2013
+ var blankCaptures = /^[\n\r\t\s]+/.exec(input);
2014
+
2015
+ if (blankCaptures) {
2016
+ consume(blankCaptures[0].length);
2017
+ }
2018
+
2019
+ var captures = regexp.exec(input);
2020
+
2021
+ if (captures) {
2022
+ consume(captures[0].length);
2023
+ }
2024
+
2025
+ return captures;
2026
+ }
2027
+
2028
+ function consume(size) {
2029
+ input = input.substring(size);
2030
+ }
2031
+
2032
+ return function (code) {
2033
+ input = code;
2034
+ return getAST();
2035
+ };
2036
+ }();
2037
+ function computeLinearGradient(width, height, angle) {
2038
+ var rad = angle * Math.PI / 180;
2039
+ var rx = 0;
2040
+ var ry = 0;
2041
+ var rcx = rx + width / 2;
2042
+ var rcy = ry + height / 2; // get the length of gradient line
2043
+ // @see https://observablehq.com/@danburzo/css-gradient-line
2044
+
2045
+ var length = Math.abs(width * Math.cos(rad)) + Math.abs(height * Math.sin(rad));
2046
+ var x1 = rcx - Math.cos(rad) * length / 2;
2047
+ var y1 = rcy - Math.sin(rad) * length / 2;
2048
+ var x2 = rcx + Math.cos(rad) * length / 2;
2049
+ var y2 = rcy + Math.sin(rad) * length / 2;
2050
+ return {
2051
+ x1: x1,
2052
+ y1: y1,
2053
+ x2: x2,
2054
+ y2: y2
2055
+ };
2056
+ }
2057
+ function computeRadialGradient(width, height, cx, cy) {
2058
+ var r = Math.sqrt(width * width + height * height) / 2;
2059
+ return {
2060
+ x: cx * width,
2061
+ y: cy * height,
2062
+ r: r
2063
+ };
2064
+ }
2065
+
1691
2066
  (function (PropertySyntax) {
1692
2067
  /**
1693
2068
  * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#coordinate
@@ -2498,7 +2873,11 @@ function rectToCommands(width, height, x, y, radius) {
2498
2873
  trr = radius[1],
2499
2874
  brr = radius[2],
2500
2875
  blr = radius[3];
2501
- return [['M', x, tlr + y], tlr ? ['A', tlr, tlr, 0, 0, 1, tlr + x, y] : null, ['L', width - trr + x, y], trr ? ['A', trr, trr, 0, 0, 1, width + x, trr + y] : null, ['L', width + x, height - brr + y], brr ? ['A', brr, brr, 0, 0, 1, width - brr + x, height + y] : null, ['L', blr + x, height + y], blr ? ['A', blr, blr, 0, 0, 1, x, height - blr + y] : null, ['Z']].filter(function (command) {
2876
+ var signX = width > 0 ? 1 : -1;
2877
+ var signY = height > 0 ? 1 : -1; // sweep-flag @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Tutorial/Paths#arcs
2878
+
2879
+ var sweepFlag = signX + signY !== 0 ? 1 : 0;
2880
+ return [['M', signX * tlr + x, y], ['L', width - signX * trr + x, y], trr ? ['A', trr, trr, 0, 0, sweepFlag, width + x, signY * trr + y] : null, ['L', width + x, height - signY * brr + y], brr ? ['A', brr, brr, 0, 0, sweepFlag, width + x - signX * brr, height + y] : null, ['L', x + signX * blr, height + y], blr ? ['A', blr, blr, 0, 0, sweepFlag, x, height + y - signY * blr] : null, ['L', x, signY * tlr + y], tlr ? ['A', tlr, tlr, 0, 0, sweepFlag, signX * tlr + x, y] : null, ['Z']].filter(function (command) {
2502
2881
  return command;
2503
2882
  });
2504
2883
  }
@@ -2568,7 +2947,7 @@ function convertToPath(object, applyLocalTransform) {
2568
2947
  return r.value !== 0;
2569
2948
  });
2570
2949
  commands = rectToCommands(width.value, height.value, x.value, y.value, hasRadius && radius.map(function (r) {
2571
- return clamp(r.value, 0, Math.min(width.value / 2, height.value / 2));
2950
+ return clamp(r.value, 0, Math.min(Math.abs(width.value) / 2, Math.abs(height.value) / 2));
2572
2951
  }));
2573
2952
  break;
2574
2953
 
@@ -6634,12 +7013,11 @@ var CSSRGB = /*#__PURE__*/function (_CSSColorValue) {
6634
7013
  return CSSRGB;
6635
7014
  }(CSSColorValue);
6636
7015
 
6637
- (function (GradientPatternType) {
6638
- GradientPatternType[GradientPatternType["Constant"] = 0] = "Constant";
6639
- GradientPatternType[GradientPatternType["LinearGradient"] = 1] = "LinearGradient";
6640
- GradientPatternType[GradientPatternType["RadialGradient"] = 2] = "RadialGradient";
6641
- GradientPatternType[GradientPatternType["Pattern"] = 3] = "Pattern";
6642
- })(exports.GradientPatternType || (exports.GradientPatternType = {}));
7016
+ (function (GradientType) {
7017
+ GradientType[GradientType["Constant"] = 0] = "Constant";
7018
+ GradientType[GradientType["LinearGradient"] = 1] = "LinearGradient";
7019
+ GradientType[GradientType["RadialGradient"] = 2] = "RadialGradient";
7020
+ })(exports.GradientType || (exports.GradientType = {}));
6643
7021
 
6644
7022
  var CSSGradientValue = /*#__PURE__*/function (_CSSStyleValue) {
6645
7023
  _inheritsLoose(CSSGradientValue, _CSSStyleValue);
@@ -6662,21 +7040,7 @@ var CSSGradientValue = /*#__PURE__*/function (_CSSStyleValue) {
6662
7040
  };
6663
7041
 
6664
7042
  _proto.buildCSSText = function buildCSSText(n, p, result) {
6665
- var text = '';
6666
-
6667
- if (this.type === exports.GradientPatternType.LinearGradient) {
6668
- text = "linear-gradient(" + this.value.steps.map(function (step) {
6669
- return step.join(',');
6670
- }).join(',') + ")";
6671
- } else if (this.type === exports.GradientPatternType.RadialGradient) {
6672
- text = "radial-gradient(" + this.value.steps.map(function (step) {
6673
- return step.join(',');
6674
- }).join(',') + ")";
6675
- } else if (this.type === exports.GradientPatternType.Pattern) {
6676
- text = "url(" + this.value.src + ")";
6677
- }
6678
-
6679
- return result += text;
7043
+ return result;
6680
7044
  };
6681
7045
 
6682
7046
  _proto.getType = function getType() {
@@ -6690,31 +7054,192 @@ var regexLG = /^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i;
6690
7054
  var regexRG = /^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i;
6691
7055
  var regexPR = /^p\s*\(\s*([axyn])\s*\)\s*(.*)/i;
6692
7056
  var regexColorStop = /[\d.]+:(#[^\s]+|[^\)]+\))/gi;
6693
- /**
6694
- * @see https://github.com/WebKit/WebKit/blob/main/Source/WebCore/css/parser/CSSParser.cpp#L97
6695
- */
6696
7057
 
6697
- function parseColor(colorStr) {
6698
- if (isNil(colorStr)) {
6699
- colorStr = '';
7058
+ function spaceColorStops(colorStops) {
7059
+ var _colorStops$length;
7060
+
7061
+ var length = colorStops.length;
7062
+ colorStops[length - 1].length = (_colorStops$length = colorStops[length - 1].length) !== null && _colorStops$length !== void 0 ? _colorStops$length : {
7063
+ type: '%',
7064
+ value: '100'
7065
+ };
7066
+
7067
+ if (length > 1) {
7068
+ var _colorStops$0$length;
7069
+
7070
+ colorStops[0].length = (_colorStops$0$length = colorStops[0].length) !== null && _colorStops$0$length !== void 0 ? _colorStops$0$length : {
7071
+ type: '%',
7072
+ value: '0'
7073
+ };
6700
7074
  }
6701
7075
 
6702
- if (colorStr === 'transparent') {
6703
- // transparent black
6704
- return new CSSRGB(0, 0, 0, 0);
6705
- } else if (colorStr === 'currentColor') {
6706
- // @see https://github.com/adobe-webplatform/Snap.svg/issues/526
6707
- colorStr = 'black';
7076
+ var previousIndex = 0;
7077
+ var previousOffset = Number(colorStops[0].length.value);
7078
+
7079
+ for (var i = 1; i < length; i++) {
7080
+ var _colorStops$i$length;
7081
+
7082
+ var offset = (_colorStops$i$length = colorStops[i].length) === null || _colorStops$i$length === void 0 ? void 0 : _colorStops$i$length.value;
7083
+
7084
+ if (!isNil(offset) && !isNil(previousOffset)) {
7085
+ for (var j = 1; j < i - previousIndex; j++) {
7086
+ colorStops[previousIndex + j].length = {
7087
+ type: '%',
7088
+ value: "" + (previousOffset + (Number(offset) - previousOffset) * j / (i - previousIndex))
7089
+ };
7090
+ }
7091
+
7092
+ previousIndex = i;
7093
+ previousOffset = Number(offset);
7094
+ }
7095
+ }
7096
+ } // The position of the gradient line's starting point.
7097
+ // different from CSS side(to top) @see https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/linear-gradient#values
7098
+
7099
+
7100
+ var SideOrCornerToDegMap = {
7101
+ left: 270 - 90,
7102
+ top: 0 - 90,
7103
+ bottom: 180 - 90,
7104
+ right: 90 - 90,
7105
+ 'left top': 315 - 90,
7106
+ 'top left': 315 - 90,
7107
+ 'left bottom': 225 - 90,
7108
+ 'bottom left': 225 - 90,
7109
+ 'right top': 45 - 90,
7110
+ 'top right': 45 - 90,
7111
+ 'right bottom': 135 - 90,
7112
+ 'bottom right': 135 - 90
7113
+ };
7114
+ var angleToDeg = memoize__default['default'](function (orientation) {
7115
+ var angle;
7116
+
7117
+ if (orientation.type === 'angular') {
7118
+ angle = Number(orientation.value);
7119
+ } else {
7120
+ angle = SideOrCornerToDegMap[orientation.value] || 0;
7121
+ }
7122
+
7123
+ return angle;
7124
+ });
7125
+ var positonToPercentage = memoize__default['default'](function (position) {
7126
+ var cx = 0.5;
7127
+ var cy = 0.5;
7128
+
7129
+ if ((position === null || position === void 0 ? void 0 : position.type) === 'position') {
7130
+ var _position$value = position.value,
7131
+ x = _position$value.x,
7132
+ y = _position$value.y;
7133
+
7134
+ if ((x === null || x === void 0 ? void 0 : x.type) === 'position-keyword') {
7135
+ if (x.value === 'left') {
7136
+ cx = 0;
7137
+ } else if (x.value === 'center') {
7138
+ cx = 0.5;
7139
+ } else if (x.value === 'right') {
7140
+ cx = 1;
7141
+ } else if (x.value === 'top') {
7142
+ cy = 0;
7143
+ } else if (x.value === 'bottom') {
7144
+ cy = 1;
7145
+ }
7146
+ }
7147
+
7148
+ if ((y === null || y === void 0 ? void 0 : y.type) === 'position-keyword') {
7149
+ if (y.value === 'left') {
7150
+ cx = 0;
7151
+ } else if (y.value === 'center') {
7152
+ cy = 0.5;
7153
+ } else if (y.value === 'right') {
7154
+ cx = 1;
7155
+ } else if (y.value === 'top') {
7156
+ cy = 0;
7157
+ } else if (y.value === 'bottom') {
7158
+ cy = 1;
7159
+ }
7160
+ }
7161
+
7162
+ if ((x === null || x === void 0 ? void 0 : x.type) === '%') {
7163
+ cx = Number(x.value) / 100;
7164
+ }
7165
+
7166
+ if ((y === null || y === void 0 ? void 0 : y.type) === '%') {
7167
+ cy = Number(x.value) / 100;
7168
+ }
6708
7169
  }
6709
7170
 
7171
+ return {
7172
+ cx: cx,
7173
+ cy: cy
7174
+ };
7175
+ });
7176
+ var parseGradient$1 = memoize__default['default'](function (colorStr) {
7177
+ if (colorStr.indexOf('linear') > -1 || colorStr.indexOf('radial') > -1) {
7178
+ var ast = parseGradient(colorStr);
7179
+ return ast.map(function (_ref) {
7180
+ var type = _ref.type,
7181
+ orientation = _ref.orientation,
7182
+ colorStops = _ref.colorStops;
7183
+ spaceColorStops(colorStops);
7184
+ var steps = colorStops.map(function (colorStop) {
7185
+ // TODO: only support % for now, should calc percentage of axis length when using px/em
7186
+ return [Number(colorStop.length.value) / 100, colorStopToString(colorStop)];
7187
+ });
7188
+
7189
+ if (type === 'linear-gradient') {
7190
+ return new CSSGradientValue(exports.GradientType.LinearGradient, {
7191
+ angle: orientation ? angleToDeg(orientation) : 0,
7192
+ steps: steps,
7193
+ hash: colorStr
7194
+ });
7195
+ } else if (type === 'radial-gradient') {
7196
+ if (!orientation) {
7197
+ orientation = [{
7198
+ type: 'shape',
7199
+ value: 'circle'
7200
+ }];
7201
+ }
7202
+
7203
+ if (orientation[0].type === 'shape' && orientation[0].value === 'circle') {
7204
+ var _positonToPercentage = positonToPercentage(orientation[0].at),
7205
+ cx = _positonToPercentage.cx,
7206
+ cy = _positonToPercentage.cy;
7207
+
7208
+ return new CSSGradientValue(exports.GradientType.RadialGradient, {
7209
+ cx: cx,
7210
+ cy: cy,
7211
+ steps: steps,
7212
+ hash: colorStr
7213
+ });
7214
+ } // } else if (type === 'repeating-linear-gradient') {
7215
+ // } else if (type === 'repeating-radial-gradient') {
7216
+
7217
+ }
7218
+ });
7219
+ } // legacy format, should be deprecated later
7220
+
7221
+
6710
7222
  var type = colorStr[0];
6711
7223
 
6712
7224
  if (colorStr[1] === '(' || colorStr[2] === '(') {
6713
7225
  if (type === 'l') {
6714
- var parsedLineGradient = parseLineGradient(colorStr);
6715
-
6716
- if (parsedLineGradient) {
6717
- return new CSSGradientValue(exports.GradientPatternType.LinearGradient, parsedLineGradient);
7226
+ var arr = regexLG.exec(colorStr);
7227
+
7228
+ if (arr) {
7229
+ var _arr$2$match;
7230
+
7231
+ var steps = ((_arr$2$match = arr[2].match(regexColorStop)) === null || _arr$2$match === void 0 ? void 0 : _arr$2$match.map(function (stop) {
7232
+ return stop.split(':');
7233
+ })) || [];
7234
+ return [new CSSGradientValue(exports.GradientType.LinearGradient, {
7235
+ angle: parseFloat(arr[1]),
7236
+ steps: steps.map(function (_ref2) {
7237
+ var offset = _ref2[0],
7238
+ color = _ref2[1];
7239
+ return [Number(offset), color];
7240
+ }),
7241
+ hash: colorStr
7242
+ })];
6718
7243
  }
6719
7244
  } else if (type === 'r') {
6720
7245
  var parsedRadialGradient = parseRadialGradient(colorStr);
@@ -6723,57 +7248,37 @@ function parseColor(colorStr) {
6723
7248
  if (isString(parsedRadialGradient)) {
6724
7249
  colorStr = parsedRadialGradient;
6725
7250
  } else {
6726
- return new CSSGradientValue(exports.GradientPatternType.RadialGradient, parsedRadialGradient);
7251
+ return [new CSSGradientValue(exports.GradientType.RadialGradient, parsedRadialGradient)];
6727
7252
  }
6728
7253
  }
6729
7254
  } else if (type === 'p') {
6730
- var pattern = parsePattern(colorStr);
6731
-
6732
- if (pattern) {
6733
- return new CSSGradientValue(exports.GradientPatternType.Pattern, pattern);
6734
- }
7255
+ return parsePattern(colorStr);
6735
7256
  }
6736
- } // constants
6737
-
6738
-
6739
- var color = d3.color(colorStr);
6740
- var rgba = [0, 0, 0, 0];
6741
-
6742
- if (color !== null) {
6743
- rgba[0] = color.r || 0;
6744
- rgba[1] = color.g || 0;
6745
- rgba[2] = color.b || 0;
6746
- rgba[3] = color.opacity;
6747
7257
  }
7258
+ });
6748
7259
 
6749
- return _construct(CSSRGB, rgba); // return {
6750
- // type: PARSED_COLOR_TYPE.Constant,
6751
- // value: rgba,
6752
- // formatted:
6753
- // // rgba(255,255,255,0) -> [NaN, NaN, NaN, 0]
6754
- // // @see https://github.com/d3/d3-color/issues/52
6755
- // (color && `rgba(${color.r || 0},${color.g || 0},${color.b || 0},${color.opacity})`) ||
6756
- // 'rgba(0,0,0,0)',
6757
- // };
6758
- }
6759
- function mergeColors(left, right) {
6760
- // only support constant value, exclude gradient & pattern
6761
- if (!(left instanceof CSSRGB) || !(right instanceof CSSRGB)) {
6762
- return;
6763
- }
7260
+ function parseRadialGradient(gradientStr) {
7261
+ var arr = regexRG.exec(gradientStr);
6764
7262
 
6765
- return [[Number(left.r), Number(left.g), Number(left.b), Number(left.alpha)], [Number(right.r), Number(right.g), Number(right.b), Number(right.alpha)], function (color) {
6766
- var rgba = color.slice();
7263
+ if (arr) {
7264
+ var _arr$4$match;
6767
7265
 
6768
- if (rgba[3]) {
6769
- for (var i = 0; i < 3; i++) {
6770
- rgba[i] = Math.round(clamp(rgba[i], 0, 255));
6771
- }
6772
- }
7266
+ var steps = ((_arr$4$match = arr[4].match(regexColorStop)) === null || _arr$4$match === void 0 ? void 0 : _arr$4$match.map(function (stop) {
7267
+ return stop.split(':');
7268
+ })) || [];
7269
+ return {
7270
+ cx: 0.5,
7271
+ cy: 0.5,
7272
+ steps: steps.map(function (_ref3) {
7273
+ var offset = _ref3[0],
7274
+ color = _ref3[1];
7275
+ return [Number(offset), color];
7276
+ }),
7277
+ hash: gradientStr
7278
+ };
7279
+ }
6773
7280
 
6774
- rgba[3] = clamp(rgba[3], 0, 1);
6775
- return "rgba(" + rgba.join(',') + ")";
6776
- }];
7281
+ return null;
6777
7282
  }
6778
7283
 
6779
7284
  function parsePattern(patternStr) {
@@ -6805,118 +7310,87 @@ function parsePattern(patternStr) {
6805
7310
  }
6806
7311
 
6807
7312
  return {
6808
- src: src,
6809
- repetition: repetition,
6810
- hash: patternStr
7313
+ image: src,
7314
+ // @ts-ignore
7315
+ repetition: repetition
6811
7316
  };
6812
7317
  }
6813
7318
 
6814
7319
  return null;
6815
7320
  }
6816
7321
 
6817
- function parseLineGradient(gradientStr) {
6818
- var arr = regexLG.exec(gradientStr);
6819
-
6820
- if (arr) {
6821
- var _arr$2$match;
7322
+ function isPattern(object) {
7323
+ return isObject(object) && !!object.image;
7324
+ }
7325
+ /**
7326
+ * @see https://github.com/WebKit/WebKit/blob/main/Source/WebCore/css/parser/CSSParser.cpp#L97
7327
+ */
6822
7328
 
6823
- var angle = parseFloat(arr[1]) % 360 * (Math.PI / 180);
6824
- var steps = ((_arr$2$match = arr[2].match(regexColorStop)) === null || _arr$2$match === void 0 ? void 0 : _arr$2$match.map(function (stop) {
6825
- return stop.split(':');
6826
- })) || [];
6827
- var maxX = 1,
6828
- maxY = 1;
6829
- var minX = 0,
6830
- minY = 0;
6831
- var start;
6832
- var end;
6833
-
6834
- if (angle >= 0 && angle < 1 / 2 * Math.PI) {
6835
- start = {
6836
- x: minX,
6837
- y: minY
6838
- };
6839
- end = {
6840
- x: maxX,
6841
- y: maxY
6842
- };
6843
- } else if (1 / 2 * Math.PI <= angle && angle < Math.PI) {
6844
- start = {
6845
- x: maxX,
6846
- y: minY
6847
- };
6848
- end = {
6849
- x: minX,
6850
- y: maxY
6851
- };
6852
- } else if (Math.PI <= angle && angle < 3 / 2 * Math.PI) {
6853
- start = {
6854
- x: maxX,
6855
- y: maxY
6856
- };
6857
- end = {
6858
- x: minX,
6859
- y: minY
6860
- };
6861
- } else {
6862
- start = {
6863
- x: minX,
6864
- y: maxY
6865
- };
6866
- end = {
6867
- x: maxX,
6868
- y: minY
6869
- };
6870
- }
7329
+ var parseColor = memoize__default['default'](function (colorStr) {
7330
+ if (isPattern(colorStr)) {
7331
+ return _extends({
7332
+ repetition: 'repeat'
7333
+ }, colorStr);
7334
+ }
6871
7335
 
6872
- var tanTheta = Math.tan(angle);
6873
- var tanTheta2 = tanTheta * tanTheta;
6874
- var x = (end.x - start.x + tanTheta * (end.y - start.y)) / (tanTheta2 + 1) + start.x;
6875
- var y = tanTheta * (end.x - start.x + tanTheta * (end.y - start.y)) / (tanTheta2 + 1) + start.y;
6876
- return {
6877
- x0: start.x,
6878
- y0: start.y,
6879
- x1: x,
6880
- y1: y,
6881
- steps: steps,
6882
- hash: gradientStr
6883
- };
7336
+ if (isNil(colorStr)) {
7337
+ colorStr = '';
6884
7338
  }
6885
7339
 
6886
- return null;
6887
- }
7340
+ if (colorStr === 'transparent') {
7341
+ // transparent black
7342
+ return new CSSRGB(0, 0, 0, 0);
7343
+ } else if (colorStr === 'currentColor') {
7344
+ // @see https://github.com/adobe-webplatform/Snap.svg/issues/526
7345
+ colorStr = 'black';
7346
+ } // support CSS gradient syntax
6888
7347
 
6889
- function parseRadialGradient(gradientStr) {
6890
- var arr = regexRG.exec(gradientStr);
6891
7348
 
6892
- if (arr) {
6893
- var _arr$4$match;
7349
+ var g = parseGradient$1(colorStr);
6894
7350
 
6895
- var fx = parseFloat(arr[1]);
6896
- var fy = parseFloat(arr[2]);
6897
- var fr = parseFloat(arr[3]);
6898
- var steps = ((_arr$4$match = arr[4].match(regexColorStop)) === null || _arr$4$match === void 0 ? void 0 : _arr$4$match.map(function (stop) {
6899
- return stop.split(':');
6900
- })) || []; // 环半径为0时,默认无渐变,取渐变序列的最后一个颜色
7351
+ if (g) {
7352
+ return g;
7353
+ } // constants
6901
7354
 
6902
- if (fr === 0) {
6903
- var colors = arr[4].match(regexColorStop);
6904
- return colors[colors.length - 1].split(':')[1];
6905
- }
6906
7355
 
6907
- return {
6908
- x0: fx,
6909
- y0: fy,
6910
- r0: 0,
6911
- x1: 0.5,
6912
- y1: 0.5,
6913
- r1: fr,
6914
- steps: steps,
6915
- hash: gradientStr
6916
- };
7356
+ var color = d3.color(colorStr);
7357
+ var rgba = [0, 0, 0, 0];
7358
+
7359
+ if (color !== null) {
7360
+ rgba[0] = color.r || 0;
7361
+ rgba[1] = color.g || 0;
7362
+ rgba[2] = color.b || 0;
7363
+ rgba[3] = color.opacity;
6917
7364
  }
6918
7365
 
6919
- return null;
7366
+ return _construct(CSSRGB, rgba); // return {
7367
+ // type: PARSED_COLOR_TYPE.Constant,
7368
+ // value: rgba,
7369
+ // formatted:
7370
+ // // rgba(255,255,255,0) -> [NaN, NaN, NaN, 0]
7371
+ // // @see https://github.com/d3/d3-color/issues/52
7372
+ // (color && `rgba(${color.r || 0},${color.g || 0},${color.b || 0},${color.opacity})`) ||
7373
+ // 'rgba(0,0,0,0)',
7374
+ // };
7375
+ });
7376
+ function mergeColors(left, right) {
7377
+ // only support constant value, exclude gradient & pattern
7378
+ if (!(left instanceof CSSRGB) || !(right instanceof CSSRGB)) {
7379
+ return;
7380
+ }
7381
+
7382
+ return [[Number(left.r), Number(left.g), Number(left.b), Number(left.alpha)], [Number(right.r), Number(right.g), Number(right.b), Number(right.alpha)], function (color) {
7383
+ var rgba = color.slice();
7384
+
7385
+ if (rgba[3]) {
7386
+ for (var i = 0; i < 3; i++) {
7387
+ rgba[i] = Math.round(clamp(rgba[i], 0, 255));
7388
+ }
7389
+ }
7390
+
7391
+ rgba[3] = clamp(rgba[3], 0, 1);
7392
+ return "rgba(" + rgba.join(',') + ")";
7393
+ }];
6920
7394
  }
6921
7395
 
6922
7396
  /**
@@ -7632,8 +8106,7 @@ function convertPercentUnit(valueWithUnit, vec3Index, target) {
7632
8106
  if (valueWithUnit.unit === exports.UnitType.kPixels) {
7633
8107
  return Number(valueWithUnit.value);
7634
8108
  } else if (valueWithUnit.unit === exports.UnitType.kPercentage && target) {
7635
- // use bounds
7636
- var bounds = target.getGeometryBounds();
8109
+ var bounds = target.nodeName === exports.Shape.GROUP ? target.getLocalBounds() : target.getGeometryBounds();
7637
8110
  var size = 0;
7638
8111
 
7639
8112
  if (!AABB.isEmpty(bounds)) {
@@ -13234,6 +13707,7 @@ function dispatchCallbacks() {
13234
13707
  scale: [1, 10],
13235
13708
  }
13236
13709
  */
13710
+
13237
13711
  function convertToArrayForm(effectInput) {
13238
13712
  var normalizedEffectInput = [];
13239
13713
 
@@ -13346,7 +13820,7 @@ function normalizeKeyframes(effectInput, timing) {
13346
13820
  for (var i = 0; i < keyframes.length; i++) {
13347
13821
  var offset = keyframes[i].offset;
13348
13822
 
13349
- if (offset !== null && offset !== undefined) {
13823
+ if (!isNil(offset)) {
13350
13824
  if (offset < previousOffset) {
13351
13825
  throw new TypeError('Keyframes are not loosely sorted by offset. Sort or specify offsets.');
13352
13826
  }
@@ -13377,15 +13851,15 @@ function normalizeKeyframes(effectInput, timing) {
13377
13851
  var previousOffset = Number(keyframes[0].computedOffset);
13378
13852
 
13379
13853
  for (var _i = 1; _i < length; _i++) {
13380
- var _offset = Number(keyframes[_i].computedOffset);
13854
+ var _offset = keyframes[_i].computedOffset;
13381
13855
 
13382
- if (_offset !== null && _offset !== undefined && previousOffset !== null && previousOffset !== undefined) {
13856
+ if (!isNil(_offset) && !isNil(previousOffset)) {
13383
13857
  for (var j = 1; j < _i - previousIndex; j++) {
13384
- keyframes[previousIndex + j].computedOffset = previousOffset + (_offset - previousOffset) * j / (_i - previousIndex);
13858
+ keyframes[previousIndex + j].computedOffset = previousOffset + (Number(_offset) - previousOffset) * j / (_i - previousIndex);
13385
13859
  }
13386
13860
 
13387
13861
  previousIndex = _i;
13388
- previousOffset = _offset;
13862
+ previousOffset = Number(_offset);
13389
13863
  }
13390
13864
  }
13391
13865
  }
@@ -18841,28 +19315,6 @@ exports.CSSPropertyZIndex = tslib.__decorate([manaSyringe.singleton({
18841
19315
  }
18842
19316
  })], exports.CSSPropertyZIndex);
18843
19317
 
18844
- // [PropertySyntax.COORDINATE]: CSSPropertyLocalPosition,
18845
- // [PropertySyntax.ANGLE]: CSSPropertyAngle,
18846
- // [PropertySyntax.COLOR]: CSSPropertyColor,
18847
- // [PropertySyntax.PAINT]: CSSPropertyColor,
18848
- // [PropertySyntax.OPACITY_VALUE]: CSSPropertyOpacity,
18849
- // [PropertySyntax.LENGTH_PERCENTAGE]: CSSPropertyLengthOrPercentage,
18850
- // [PropertySyntax.LENGTH_PERCENTAGE_12]: CSSPropertyLengthOrPercentage12,
18851
- // [PropertySyntax.LENGTH_PERCENTAGE_14]: CSSPropertyLengthOrPercentage14,
18852
- // [PropertySyntax.SHADOW_BLUR]: CSSPropertyShadowBlur,
18853
- // [PropertySyntax.LIST_OF_POINTS]: CSSPropertyPoints,
18854
- // [PropertySyntax.PATH]: CSSPropertyPath,
18855
- // [PropertySyntax.FILTER]: CSSPropertyFilter,
18856
- // [PropertySyntax.Z_INDEX]: CSSPropertyZIndex,
18857
- // [PropertySyntax.OFFSET_PATH]: CSSPropertyOffsetPath,
18858
- // [PropertySyntax.OFFSET_DISTANCE]: CSSPropertyOffsetDistance,
18859
- // [PropertySyntax.CLIP_PATH]: CSSPropertyClipPath,
18860
- // [PropertySyntax.TRANSFORM]: CSSPropertyTransform,
18861
- // [PropertySyntax.TRANSFORM_ORIGIN]: CSSPropertyTransformOrigin,
18862
- // [PropertySyntax.TEXT]: CSSPropertyText,
18863
- // [PropertySyntax.TEXT_TRANSFORM]: CSSPropertyTextTransform,
18864
- // };
18865
-
18866
19318
  /**
18867
19319
  * Blink used them in code generation(css_properties.json5)
18868
19320
  */
@@ -19628,10 +20080,14 @@ exports.DefaultStyleValueRegistry = /*#__PURE__*/function () {
19628
20080
  _geometryUpdater$upda4 = _geometryUpdater$upda.offsetY,
19629
20081
  offsetY = _geometryUpdater$upda4 === void 0 ? 0 : _geometryUpdater$upda4,
19630
20082
  _geometryUpdater$upda5 = _geometryUpdater$upda.offsetZ,
19631
- offsetZ = _geometryUpdater$upda5 === void 0 ? 0 : _geometryUpdater$upda5; // init with content box
20083
+ offsetZ = _geometryUpdater$upda5 === void 0 ? 0 : _geometryUpdater$upda5; // account for negative width / height of Rect
20084
+ // @see https://github.com/antvis/g/issues/957
20085
+
19632
20086
 
20087
+ var flipY = width < 0;
20088
+ var flipX = height < 0; // init with content box
19633
20089
 
19634
- var halfExtents = glMatrix.vec3.fromValues(width / 2, height / 2, depth / 2); // anchor is center by default, don't account for lineWidth here
20090
+ var halfExtents = glMatrix.vec3.fromValues(Math.abs(width) / 2, Math.abs(height) / 2, depth / 2); // anchor is center by default, don't account for lineWidth here
19635
20091
 
19636
20092
  var lineWidth = parsedStyle.lineWidth,
19637
20093
  increasedLineWidthForHitTesting = parsedStyle.increasedLineWidthForHitTesting,
@@ -19645,7 +20101,7 @@ exports.DefaultStyleValueRegistry = /*#__PURE__*/function () {
19645
20101
  delete parsedStyle.anchor;
19646
20102
  }
19647
20103
 
19648
- var center = glMatrix.vec3.fromValues((1 - (anchor && anchor[0].value || 0) * 2) * halfExtents[0] + offsetX, (1 - (anchor && anchor[1].value || 0) * 2) * halfExtents[1] + offsetY, (1 - (anchor && ((_anchor$ = anchor[2]) === null || _anchor$ === void 0 ? void 0 : _anchor$.value) || 0) * 2) * halfExtents[2] + offsetZ); // update geometry's AABB
20104
+ var center = glMatrix.vec3.fromValues((1 - (anchor && anchor[0].value || 0) * 2) * width / 2 + offsetX, (1 - (anchor && anchor[1].value || 0) * 2) * height / 2 + offsetY, (1 - (anchor && ((_anchor$ = anchor[2]) === null || _anchor$ === void 0 ? void 0 : _anchor$.value) || 0) * 2) * halfExtents[2] + offsetZ); // update geometry's AABB
19649
20105
 
19650
20106
  geometry.contentBounds.update(center, halfExtents);
19651
20107
  var halfLineWidth = (((lineWidth === null || lineWidth === void 0 ? void 0 : lineWidth.value) || 0) + ((increasedLineWidthForHitTesting === null || increasedLineWidthForHitTesting === void 0 ? void 0 : increasedLineWidthForHitTesting.value) || 0)) / 2; // append border
@@ -19707,10 +20163,10 @@ exports.DefaultStyleValueRegistry = /*#__PURE__*/function () {
19707
20163
  });
19708
20164
  anchor = parsedStyle.anchor; // set transform origin
19709
20165
 
19710
- var usedOriginXValue = convertPercentUnit(transformOrigin[0], 0, object);
19711
- var usedOriginYValue = convertPercentUnit(transformOrigin[1], 1, object);
19712
- usedOriginXValue -= (anchor && anchor[0].value || 0) * geometry.contentBounds.halfExtents[0] * 2;
19713
- usedOriginYValue -= (anchor && anchor[1].value || 0) * geometry.contentBounds.halfExtents[1] * 2;
20166
+ var usedOriginXValue = (flipY ? -1 : 1) * convertPercentUnit(transformOrigin[0], 0, object);
20167
+ var usedOriginYValue = (flipX ? -1 : 1) * convertPercentUnit(transformOrigin[1], 1, object);
20168
+ usedOriginXValue = usedOriginXValue - (flipY ? -1 : 1) * (anchor && anchor[0].value || 0) * geometry.contentBounds.halfExtents[0] * 2;
20169
+ usedOriginYValue = usedOriginYValue - (flipX ? -1 : 1) * (anchor && anchor[1].value || 0) * geometry.contentBounds.halfExtents[1] * 2;
19714
20170
  object.setOrigin(usedOriginXValue, usedOriginYValue);
19715
20171
  object.dispatchEvent(new CustomEvent(exports.ElementEvent.GEOMETRY_BOUNDS_CHANGED));
19716
20172
  dirtifyToRoot(object);
@@ -21269,7 +21725,7 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
21269
21725
  }
21270
21726
  });
21271
21727
  } else {
21272
- console.error("[g]: You are trying to call `canvas.appendChild` before canvas' initialization finished. You can either await `canvas.ready` or listen to `CanvasEvent.READY` manually.", 'appended child: ', parent);
21728
+ console.warn("[g]: You are trying to call `canvas.appendChild` before canvas' initialization finished. You can either await `canvas.ready` or listen to `CanvasEvent.READY` manually.", 'appended child: ', parent);
21273
21729
  }
21274
21730
  };
21275
21731
 
@@ -21470,7 +21926,10 @@ exports.clamp = clamp;
21470
21926
  exports.clampedMergeNumbers = clampedMergeNumbers;
21471
21927
  exports.cleanExistedCanvas = cleanExistedCanvas;
21472
21928
  exports.clonePath = clonePath;
21929
+ exports.colorStopToString = colorStopToString;
21473
21930
  exports.compareAnimations = compareAnimations;
21931
+ exports.computeLinearGradient = computeLinearGradient;
21932
+ exports.computeRadialGradient = computeRadialGradient;
21474
21933
  exports.convertAngleUnit = convertAngleUnit;
21475
21934
  exports.convertEffectInput = convertEffectInput;
21476
21935
  exports.convertPercentUnit = convertPercentUnit;
@@ -21505,6 +21964,7 @@ exports.isFunction = isFunction;
21505
21964
  exports.isNil = isNil;
21506
21965
  exports.isNumber = isNumber;
21507
21966
  exports.isObject = isObject;
21967
+ exports.isPattern = isPattern;
21508
21968
  exports.isString = isString;
21509
21969
  exports.isUndefined = isUndefined;
21510
21970
  exports.layoutEngine = layoutEngine;
@@ -21527,6 +21987,7 @@ exports.parseColor = parseColor;
21527
21987
  exports.parseDimension = parseDimension;
21528
21988
  exports.parseDimensionArray = parseDimensionArray;
21529
21989
  exports.parseFilter = parseFilter;
21990
+ exports.parseGradient = parseGradient;
21530
21991
  exports.parseLength = parseLength;
21531
21992
  exports.parseLengthOrPercentage = parseLengthOrPercentage;
21532
21993
  exports.parseNumber = parseNumber;