@antv/g 5.0.22 → 5.0.23-alpha.11

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.
Files changed (168) hide show
  1. package/dist/index.umd.min.js +3 -3
  2. package/es/AbstractRenderer.js +5 -0
  3. package/es/camera/Camera.js +2 -2
  4. package/es/css/StyleValueRegistry.d.ts +2 -0
  5. package/es/css/StyleValueRegistry.js +7 -3
  6. package/es/css/cssom/CSSKeywordValue.d.ts +1 -1
  7. package/es/css/cssom/CSSNumericSumValue.d.ts +1 -1
  8. package/es/css/cssom/CSSNumericValue.d.ts +141 -4
  9. package/es/css/cssom/CSSNumericValue.js +1166 -5
  10. package/es/css/cssom/CSSTransformValue.d.ts +1 -1
  11. package/es/css/cssom/index.d.ts +0 -10
  12. package/es/css/cssom/index.js +1 -11
  13. package/es/css/parser/color.js +1 -1
  14. package/es/css/parser/dimension.js +1 -2
  15. package/es/css/parser/numeric.d.ts +1 -1
  16. package/es/css/parser/numeric.js +2 -2
  17. package/es/css/parser/path.d.ts +2 -2
  18. package/es/css/parser/path.js +1 -1
  19. package/es/css/parser/points.js +1 -1
  20. package/es/css/parser/transform-origin.d.ts +1 -1
  21. package/es/css/parser/transform-origin.js +2 -2
  22. package/es/css/parser/transform.d.ts +1 -3
  23. package/es/css/parser/transform.js +9 -8
  24. package/es/css/properties/CSSPropertyPath.d.ts +14 -2
  25. package/es/css/properties/CSSPropertyTextTransform.d.ts +2 -2
  26. package/es/css/properties/CSSPropertyTransform.js +3 -4
  27. package/es/display-objects/DisplayObject.js +4 -5
  28. package/es/display-objects/Path.d.ts +15 -15
  29. package/es/display-objects/Path.js +1 -1
  30. package/es/display-objects/Polygon.d.ts +8 -1
  31. package/es/display-objects/Polyline.d.ts +7 -5
  32. package/es/dom/Document.js +2 -2
  33. package/es/dom/Element.js +1 -2
  34. package/es/dom/EventTarget.js +1 -1
  35. package/es/dom/FederatedTouchEvent.d.ts +5 -3
  36. package/es/plugins/CullingPlugin.d.ts +0 -1
  37. package/es/plugins/CullingPlugin.js +3 -8
  38. package/es/plugins/DirtyCheckPlugin.d.ts +1 -1
  39. package/es/plugins/DirtyCheckPlugin.js +9 -8
  40. package/es/plugins/EventPlugin.d.ts +1 -1
  41. package/es/plugins/EventPlugin.js +163 -148
  42. package/es/plugins/PrepareRendererPlugin.d.ts +0 -1
  43. package/es/plugins/PrepareRendererPlugin.js +17 -18
  44. package/es/services/EventService.d.ts +8 -0
  45. package/es/services/EventService.js +274 -20
  46. package/es/services/RenderingService.d.ts +17 -16
  47. package/es/services/RenderingService.js +20 -19
  48. package/es/services/SceneGraphService.js +1 -1
  49. package/es/services/aabb/PathUpdater.d.ts +3 -3
  50. package/es/services/aabb/PolylineUpdater.d.ts +3 -3
  51. package/es/services/aabb/RectUpdater.js +1 -1
  52. package/es/types.d.ts +5 -3
  53. package/es/utils/assert.d.ts +6 -0
  54. package/es/utils/assert.js +18 -0
  55. package/es/utils/event.d.ts +18 -16
  56. package/es/utils/hooks.d.ts +280 -0
  57. package/es/utils/hooks.js +753 -0
  58. package/es/utils/index.d.ts +1 -0
  59. package/es/utils/index.js +2 -1
  60. package/es/utils/math.d.ts +1 -0
  61. package/es/utils/math.js +13 -2
  62. package/es/utils/string.d.ts +1 -0
  63. package/es/utils/string.js +8 -0
  64. package/es/utils/text.js +2 -1
  65. package/lib/AbstractRenderer.js +5 -0
  66. package/lib/camera/Camera.js +4 -4
  67. package/lib/css/StyleValueRegistry.d.ts +2 -0
  68. package/lib/css/StyleValueRegistry.js +13 -5
  69. package/lib/css/cssom/CSSKeywordValue.d.ts +1 -1
  70. package/lib/css/cssom/CSSNumericSumValue.d.ts +1 -1
  71. package/lib/css/cssom/CSSNumericValue.d.ts +141 -4
  72. package/lib/css/cssom/CSSNumericValue.js +1226 -52
  73. package/lib/css/cssom/CSSTransformValue.d.ts +1 -1
  74. package/lib/css/cssom/index.d.ts +0 -10
  75. package/lib/css/cssom/index.js +0 -130
  76. package/lib/css/parser/color.js +5 -5
  77. package/lib/css/parser/dimension.js +1 -3
  78. package/lib/css/parser/numeric.d.ts +1 -1
  79. package/lib/css/parser/numeric.js +7 -7
  80. package/lib/css/parser/path.d.ts +2 -2
  81. package/lib/css/parser/path.js +4 -4
  82. package/lib/css/parser/points.js +2 -2
  83. package/lib/css/parser/transform-origin.d.ts +1 -1
  84. package/lib/css/parser/transform-origin.js +4 -4
  85. package/lib/css/parser/transform.d.ts +1 -3
  86. package/lib/css/parser/transform.js +25 -24
  87. package/lib/css/properties/CSSPropertyPath.d.ts +14 -2
  88. package/lib/css/properties/CSSPropertyTextTransform.d.ts +2 -2
  89. package/lib/css/properties/CSSPropertyTransform.js +18 -20
  90. package/lib/display-objects/DisplayObject.js +7 -9
  91. package/lib/display-objects/Path.d.ts +15 -15
  92. package/lib/display-objects/Path.js +3 -3
  93. package/lib/display-objects/Polygon.d.ts +8 -1
  94. package/lib/display-objects/Polyline.d.ts +7 -5
  95. package/lib/dom/Document.js +2 -2
  96. package/lib/dom/Element.js +1 -3
  97. package/lib/dom/EventTarget.js +9 -9
  98. package/lib/dom/FederatedTouchEvent.d.ts +5 -3
  99. package/lib/plugins/CullingPlugin.d.ts +0 -1
  100. package/lib/plugins/CullingPlugin.js +3 -7
  101. package/lib/plugins/DirtyCheckPlugin.d.ts +1 -1
  102. package/lib/plugins/DirtyCheckPlugin.js +10 -8
  103. package/lib/plugins/EventPlugin.d.ts +1 -1
  104. package/lib/plugins/EventPlugin.js +172 -156
  105. package/lib/plugins/PrepareRendererPlugin.d.ts +0 -1
  106. package/lib/plugins/PrepareRendererPlugin.js +16 -16
  107. package/lib/services/EventService.d.ts +8 -0
  108. package/lib/services/EventService.js +274 -19
  109. package/lib/services/RenderingService.d.ts +17 -16
  110. package/lib/services/RenderingService.js +21 -20
  111. package/lib/services/SceneGraphService.js +3 -3
  112. package/lib/services/aabb/PathUpdater.d.ts +3 -3
  113. package/lib/services/aabb/PolylineUpdater.d.ts +3 -3
  114. package/lib/services/aabb/RectUpdater.js +3 -3
  115. package/lib/types.d.ts +5 -3
  116. package/lib/utils/assert.d.ts +6 -0
  117. package/lib/utils/assert.js +30 -0
  118. package/lib/utils/event.d.ts +18 -16
  119. package/lib/utils/hooks.d.ts +280 -0
  120. package/lib/utils/hooks.js +759 -0
  121. package/lib/utils/index.d.ts +1 -0
  122. package/lib/utils/index.js +13 -0
  123. package/lib/utils/math.d.ts +1 -0
  124. package/lib/utils/math.js +17 -4
  125. package/lib/utils/string.d.ts +1 -0
  126. package/lib/utils/string.js +11 -0
  127. package/lib/utils/text.js +5 -3
  128. package/package.json +4 -7
  129. package/es/css/cssom/CSSMathInvert.d.ts +0 -14
  130. package/es/css/cssom/CSSMathInvert.js +0 -84
  131. package/es/css/cssom/CSSMathMax.d.ts +0 -17
  132. package/es/css/cssom/CSSMathMax.js +0 -118
  133. package/es/css/cssom/CSSMathMin.d.ts +0 -17
  134. package/es/css/cssom/CSSMathMin.js +0 -119
  135. package/es/css/cssom/CSSMathNegate.d.ts +0 -14
  136. package/es/css/cssom/CSSMathNegate.js +0 -80
  137. package/es/css/cssom/CSSMathProduct.d.ts +0 -16
  138. package/es/css/cssom/CSSMathProduct.js +0 -109
  139. package/es/css/cssom/CSSMathSum.d.ts +0 -17
  140. package/es/css/cssom/CSSMathSum.js +0 -117
  141. package/es/css/cssom/CSSMathValue.d.ts +0 -11
  142. package/es/css/cssom/CSSMathValue.js +0 -27
  143. package/es/css/cssom/CSSMathVariadic.d.ts +0 -9
  144. package/es/css/cssom/CSSMathVariadic.js +0 -44
  145. package/es/css/cssom/CSSNumericValueType.d.ts +0 -33
  146. package/es/css/cssom/CSSNumericValueType.js +0 -259
  147. package/es/css/cssom/CSSUnitValue.d.ts +0 -33
  148. package/es/css/cssom/CSSUnitValue.js +0 -252
  149. package/lib/css/cssom/CSSMathInvert.d.ts +0 -14
  150. package/lib/css/cssom/CSSMathInvert.js +0 -94
  151. package/lib/css/cssom/CSSMathMax.d.ts +0 -17
  152. package/lib/css/cssom/CSSMathMax.js +0 -128
  153. package/lib/css/cssom/CSSMathMin.d.ts +0 -17
  154. package/lib/css/cssom/CSSMathMin.js +0 -128
  155. package/lib/css/cssom/CSSMathNegate.d.ts +0 -14
  156. package/lib/css/cssom/CSSMathNegate.js +0 -89
  157. package/lib/css/cssom/CSSMathProduct.d.ts +0 -16
  158. package/lib/css/cssom/CSSMathProduct.js +0 -119
  159. package/lib/css/cssom/CSSMathSum.d.ts +0 -17
  160. package/lib/css/cssom/CSSMathSum.js +0 -129
  161. package/lib/css/cssom/CSSMathValue.d.ts +0 -11
  162. package/lib/css/cssom/CSSMathValue.js +0 -35
  163. package/lib/css/cssom/CSSMathVariadic.d.ts +0 -9
  164. package/lib/css/cssom/CSSMathVariadic.js +0 -55
  165. package/lib/css/cssom/CSSNumericValueType.d.ts +0 -33
  166. package/lib/css/cssom/CSSNumericValueType.js +0 -272
  167. package/lib/css/cssom/CSSUnitValue.d.ts +0 -33
  168. package/lib/css/cssom/CSSUnitValue.js +0 -267
@@ -1,4 +1,4 @@
1
- import type { Nested, ParenLess } from '.';
1
+ import type { Nested, ParenLess } from './types';
2
2
  import { CSSStyleValue, CSSStyleValueType } from './CSSStyleValue';
3
3
  import type { CSSTransformComponent } from './CSSTransformComponent';
4
4
  /**
@@ -10,20 +10,10 @@ export * from './types';
10
10
  export * from './CSSColorValue';
11
11
  export * from './CSSKeywordValue';
12
12
  export * from './CSSMathOperator';
13
- export * from './CSSMathInvert';
14
- export * from './CSSMathMax';
15
- export * from './CSSMathMin';
16
- export * from './CSSMathNegate';
17
- export * from './CSSMathProduct';
18
- export * from './CSSMathSum';
19
- export * from './CSSMathValue';
20
- export * from './CSSMathVariadic';
21
13
  export * from './CSSNumericSumValue';
22
14
  export * from './CSSNumericValue';
23
- export * from './CSSNumericValueType';
24
15
  export * from './CSSRGB';
25
16
  export * from './CSSGradientValue';
26
17
  export * from './CSSStyleValue';
27
18
  export * from './CSSTransformValue';
28
19
  export * from './CSSTranslate';
29
- export * from './CSSUnitValue';
@@ -56,110 +56,6 @@ Object.keys(_CSSMathOperator).forEach(function (key) {
56
56
  });
57
57
  });
58
58
 
59
- var _CSSMathInvert = require("./CSSMathInvert");
60
-
61
- Object.keys(_CSSMathInvert).forEach(function (key) {
62
- if (key === "default" || key === "__esModule") return;
63
- if (key in exports && exports[key] === _CSSMathInvert[key]) return;
64
- Object.defineProperty(exports, key, {
65
- enumerable: true,
66
- get: function get() {
67
- return _CSSMathInvert[key];
68
- }
69
- });
70
- });
71
-
72
- var _CSSMathMax = require("./CSSMathMax");
73
-
74
- Object.keys(_CSSMathMax).forEach(function (key) {
75
- if (key === "default" || key === "__esModule") return;
76
- if (key in exports && exports[key] === _CSSMathMax[key]) return;
77
- Object.defineProperty(exports, key, {
78
- enumerable: true,
79
- get: function get() {
80
- return _CSSMathMax[key];
81
- }
82
- });
83
- });
84
-
85
- var _CSSMathMin = require("./CSSMathMin");
86
-
87
- Object.keys(_CSSMathMin).forEach(function (key) {
88
- if (key === "default" || key === "__esModule") return;
89
- if (key in exports && exports[key] === _CSSMathMin[key]) return;
90
- Object.defineProperty(exports, key, {
91
- enumerable: true,
92
- get: function get() {
93
- return _CSSMathMin[key];
94
- }
95
- });
96
- });
97
-
98
- var _CSSMathNegate = require("./CSSMathNegate");
99
-
100
- Object.keys(_CSSMathNegate).forEach(function (key) {
101
- if (key === "default" || key === "__esModule") return;
102
- if (key in exports && exports[key] === _CSSMathNegate[key]) return;
103
- Object.defineProperty(exports, key, {
104
- enumerable: true,
105
- get: function get() {
106
- return _CSSMathNegate[key];
107
- }
108
- });
109
- });
110
-
111
- var _CSSMathProduct = require("./CSSMathProduct");
112
-
113
- Object.keys(_CSSMathProduct).forEach(function (key) {
114
- if (key === "default" || key === "__esModule") return;
115
- if (key in exports && exports[key] === _CSSMathProduct[key]) return;
116
- Object.defineProperty(exports, key, {
117
- enumerable: true,
118
- get: function get() {
119
- return _CSSMathProduct[key];
120
- }
121
- });
122
- });
123
-
124
- var _CSSMathSum = require("./CSSMathSum");
125
-
126
- Object.keys(_CSSMathSum).forEach(function (key) {
127
- if (key === "default" || key === "__esModule") return;
128
- if (key in exports && exports[key] === _CSSMathSum[key]) return;
129
- Object.defineProperty(exports, key, {
130
- enumerable: true,
131
- get: function get() {
132
- return _CSSMathSum[key];
133
- }
134
- });
135
- });
136
-
137
- var _CSSMathValue = require("./CSSMathValue");
138
-
139
- Object.keys(_CSSMathValue).forEach(function (key) {
140
- if (key === "default" || key === "__esModule") return;
141
- if (key in exports && exports[key] === _CSSMathValue[key]) return;
142
- Object.defineProperty(exports, key, {
143
- enumerable: true,
144
- get: function get() {
145
- return _CSSMathValue[key];
146
- }
147
- });
148
- });
149
-
150
- var _CSSMathVariadic = require("./CSSMathVariadic");
151
-
152
- Object.keys(_CSSMathVariadic).forEach(function (key) {
153
- if (key === "default" || key === "__esModule") return;
154
- if (key in exports && exports[key] === _CSSMathVariadic[key]) return;
155
- Object.defineProperty(exports, key, {
156
- enumerable: true,
157
- get: function get() {
158
- return _CSSMathVariadic[key];
159
- }
160
- });
161
- });
162
-
163
59
  var _CSSNumericSumValue = require("./CSSNumericSumValue");
164
60
 
165
61
  Object.keys(_CSSNumericSumValue).forEach(function (key) {
@@ -186,19 +82,6 @@ Object.keys(_CSSNumericValue).forEach(function (key) {
186
82
  });
187
83
  });
188
84
 
189
- var _CSSNumericValueType = require("./CSSNumericValueType");
190
-
191
- Object.keys(_CSSNumericValueType).forEach(function (key) {
192
- if (key === "default" || key === "__esModule") return;
193
- if (key in exports && exports[key] === _CSSNumericValueType[key]) return;
194
- Object.defineProperty(exports, key, {
195
- enumerable: true,
196
- get: function get() {
197
- return _CSSNumericValueType[key];
198
- }
199
- });
200
- });
201
-
202
85
  var _CSSRGB = require("./CSSRGB");
203
86
 
204
87
  Object.keys(_CSSRGB).forEach(function (key) {
@@ -262,17 +145,4 @@ Object.keys(_CSSTranslate).forEach(function (key) {
262
145
  return _CSSTranslate[key];
263
146
  }
264
147
  });
265
- });
266
-
267
- var _CSSUnitValue = require("./CSSUnitValue");
268
-
269
- Object.keys(_CSSUnitValue).forEach(function (key) {
270
- if (key === "default" || key === "__esModule") return;
271
- if (key in exports && exports[key] === _CSSUnitValue[key]) return;
272
- Object.defineProperty(exports, key, {
273
- enumerable: true,
274
- get: function get() {
275
- return _CSSUnitValue[key];
276
- }
277
- });
278
148
  });
@@ -12,10 +12,10 @@ var _tslib = require("tslib");
12
12
 
13
13
  var d3 = _interopRequireWildcard(require("d3-color"));
14
14
 
15
- var _lodashEs = require("lodash-es");
16
-
17
15
  var _cssom = require("../cssom");
18
16
 
17
+ var _utils = require("../../utils");
18
+
19
19
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
20
20
 
21
21
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -54,7 +54,7 @@ function parseColor(colorStr) {
54
54
  var parsedRadialGradient = parseRadialGradient(colorStr);
55
55
 
56
56
  if (parsedRadialGradient) {
57
- if ((0, _lodashEs.isString)(parsedRadialGradient)) {
57
+ if ((0, _utils.isString)(parsedRadialGradient)) {
58
58
  colorStr = parsedRadialGradient;
59
59
  } else {
60
60
  return new _cssom.CSSGradientValue(_cssom.GradientPatternType.RadialGradient, parsedRadialGradient);
@@ -102,11 +102,11 @@ function mergeColors(left, right) {
102
102
 
103
103
  if (rgba[3]) {
104
104
  for (var i = 0; i < 3; i++) {
105
- rgba[i] = Math.round((0, _lodashEs.clamp)(rgba[i], 0, 255));
105
+ rgba[i] = Math.round((0, _utils.clamp)(rgba[i], 0, 255));
106
106
  }
107
107
  }
108
108
 
109
- rgba[3] = (0, _lodashEs.clamp)(rgba[3], 0, 1);
109
+ rgba[3] = (0, _utils.clamp)(rgba[3], 0, 1);
110
110
  return "rgba(".concat(rgba.join(','), ")");
111
111
  }];
112
112
  }
@@ -12,8 +12,6 @@ exports.parseDimension = parseDimension;
12
12
  exports.parseDimensionArray = parseDimensionArray;
13
13
  exports.parserPercentage = exports.parseLengthOrPercentage = exports.parseLength = void 0;
14
14
 
15
- var _lodashEs = require("lodash-es");
16
-
17
15
  var _shapes = require("../../shapes");
18
16
 
19
17
  var _utils = require("../../utils");
@@ -124,7 +122,7 @@ function convertAngleUnit(value) {
124
122
  }
125
123
 
126
124
  function parseDimensionArray(string) {
127
- if ((0, _lodashEs.isString)(string)) {
125
+ if ((0, _utils.isString)(string)) {
128
126
  // "1px 2px 3px"
129
127
  return string.split(' ').map(function (segment) {
130
128
  return parseLengthOrPercentage(segment);
@@ -1,4 +1,4 @@
1
- import { CSSUnitValue } from '../cssom';
1
+ import { CSSUnitValue } from '../cssom/CSSNumericValue';
2
2
  export declare function numberToString(x: number): string;
3
3
  /**
4
4
  * parse string or number to CSSUnitValue(numeric)
@@ -10,9 +10,9 @@ exports.numberToString = numberToString;
10
10
  exports.parseNumber = parseNumber;
11
11
  exports.parseNumberList = parseNumberList;
12
12
 
13
- var _lodashEs = require("lodash-es");
13
+ var _utils = require("../../utils");
14
14
 
15
- var _cssom = require("../cssom");
15
+ var _CSSNumericValue = require("../cssom/CSSNumericValue");
16
16
 
17
17
  function numberToString(x) {
18
18
  // scale(0.00000001) -> scale(0)
@@ -30,13 +30,13 @@ function numberToString(x) {
30
30
 
31
31
  function parseNumber(string) {
32
32
  if (typeof string === 'number') {
33
- return new _cssom.CSSUnitValue(string);
33
+ return new _CSSNumericValue.CSSUnitValue(string);
34
34
  }
35
35
 
36
36
  if (/^\s*[-+]?(\d*\.)?\d+\s*$/.test(string)) {
37
- return new _cssom.CSSUnitValue(Number(string));
37
+ return new _CSSNumericValue.CSSUnitValue(Number(string));
38
38
  } else {
39
- return new _cssom.CSSUnitValue(0);
39
+ return new _CSSNumericValue.CSSUnitValue(0);
40
40
  }
41
41
  }
42
42
  /**
@@ -47,7 +47,7 @@ function parseNumber(string) {
47
47
 
48
48
 
49
49
  function parseNumberList(string) {
50
- if ((0, _lodashEs.isString)(string)) {
50
+ if ((0, _utils.isString)(string)) {
51
51
  return string.split(' ').map(parseNumber);
52
52
  } else {
53
53
  return string.map(parseNumber);
@@ -61,7 +61,7 @@ function mergeNumbers(left, right) {
61
61
  function clampedMergeNumbers(min, max) {
62
62
  return function (left, right) {
63
63
  return [left.value, right.value, function (x) {
64
- return numberToString((0, _lodashEs.clamp)(x, min, max));
64
+ return numberToString((0, _utils.clamp)(x, min, max));
65
65
  }];
66
66
  };
67
67
  }
@@ -1,5 +1,5 @@
1
1
  import type { PathCommand } from '../../types';
2
2
  import type { ParsedPathStyleProps } from '../../display-objects';
3
3
  import type { IElement } from '../../dom';
4
- export declare function parsePath(path: string): ParsedPathStyleProps;
5
- export declare function mergePaths(left: ParsedPathStyleProps, right: ParsedPathStyleProps, object: IElement): [PathCommand[], PathCommand[], (b: PathCommand[]) => PathCommand[]];
4
+ export declare function parsePath(path: string): ParsedPathStyleProps['path'];
5
+ export declare function mergePaths(left: ParsedPathStyleProps['path'], right: ParsedPathStyleProps['path'], object: IElement): [PathCommand[], PathCommand[], (b: PathCommand[]) => PathCommand[]];
@@ -8,7 +8,7 @@ exports.parsePath = parsePath;
8
8
 
9
9
  var _tslib = require("tslib");
10
10
 
11
- var _pathUtil = require("@antv/path-util");
11
+ var _util = require("@antv/util");
12
12
 
13
13
  var _gMath = require("@antv/g-math");
14
14
 
@@ -17,7 +17,7 @@ var _path = require("../../utils/path");
17
17
  var _Rectangle = require("../../shapes/Rectangle");
18
18
 
19
19
  function parsePath(path) {
20
- var absolutePath = (0, _pathUtil.path2Absolute)(path);
20
+ var absolutePath = (0, _util.path2Absolute)(path);
21
21
  var hasArc = hasArcOrBezier(absolutePath);
22
22
  var clonedAbsolutePath = absolutePath.slice();
23
23
 
@@ -27,11 +27,11 @@ function parsePath(path) {
27
27
  // @see http://thednp.github.io/kute.js/svgCubicMorph.html
28
28
 
29
29
 
30
- var _b = (0, _tslib.__read)((0, _pathUtil.path2Curve)(clonedAbsolutePath, true), 2),
30
+ var _b = (0, _tslib.__read)((0, _util.path2Curve)(clonedAbsolutePath, true), 2),
31
31
  curve = _b[0],
32
32
  zCommandIndexes = _b[1];
33
33
 
34
- var segments = (0, _pathUtil.path2Segments)(clonedAbsolutePath);
34
+ var segments = (0, _util.path2Segments)(clonedAbsolutePath);
35
35
 
36
36
  var _c = calcLength(curve),
37
37
  totalLength = _c.totalLength,
@@ -7,10 +7,10 @@ exports.parsePoints = parsePoints;
7
7
 
8
8
  var _gMath = require("@antv/g-math");
9
9
 
10
- var _lodashEs = require("lodash-es");
10
+ var _utils = require("../../utils");
11
11
 
12
12
  function parsePoints(points) {
13
- if ((0, _lodashEs.isString)(points)) {
13
+ if ((0, _utils.isString)(points)) {
14
14
  return null;
15
15
  }
16
16
 
@@ -1,4 +1,4 @@
1
- import { CSSUnitValue } from '../cssom';
1
+ import { CSSUnitValue } from '../cssom/CSSNumericValue';
2
2
  /**
3
3
  * @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/transform-origin
4
4
  * eg. 'center' 'top left' '50px 50px'
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.parseTransformOrigin = parseTransformOrigin;
7
7
 
8
- var _lodashEs = require("lodash-es");
8
+ var _utils = require("../../utils");
9
9
 
10
- var _cssom = require("../cssom");
10
+ var _CSSNumericValue = require("../cssom/CSSNumericValue");
11
11
 
12
12
  var _dimension = require("./dimension");
13
13
 
@@ -16,7 +16,7 @@ var _dimension = require("./dimension");
16
16
  * eg. 'center' 'top left' '50px 50px'
17
17
  */
18
18
  function parseTransformOrigin(value) {
19
- if ((0, _lodashEs.isString)(value)) {
19
+ if ((0, _utils.isString)(value)) {
20
20
  var values = value.split(' ');
21
21
 
22
22
  if (values.length === 1) {
@@ -37,7 +37,7 @@ function parseTransformOrigin(value) {
37
37
 
38
38
  return [(0, _dimension.parseLengthOrPercentage)(convertKeyword2Percent(values[0])), (0, _dimension.parseLengthOrPercentage)(convertKeyword2Percent(values[1]))];
39
39
  } else {
40
- return [new _cssom.CSSUnitValue(value[0] || 0, 'px'), new _cssom.CSSUnitValue(value[1] || 0, 'px')];
40
+ return [new _CSSNumericValue.CSSUnitValue(value[0] || 0, 'px'), new _CSSNumericValue.CSSUnitValue(value[1] || 0, 'px')];
41
41
  }
42
42
  }
43
43
 
@@ -1,11 +1,9 @@
1
1
  import type { DisplayObject } from '../../display-objects/DisplayObject';
2
- import { CSSUnitValue } from '../cssom';
2
+ import { CSSUnitValue } from '../cssom/CSSNumericValue';
3
3
  export interface ParsedTransform {
4
4
  t: string;
5
5
  d: CSSUnitValue[];
6
6
  }
7
- export declare const Opx: CSSUnitValue;
8
- export declare const Odeg: CSSUnitValue;
9
7
  /**
10
8
  * none
11
9
  * scale(1) scale(1, 2)
@@ -3,19 +3,20 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.Opx = exports.Odeg = void 0;
7
6
  exports.mergeTransforms = mergeTransforms;
8
7
  exports.parseTransform = parseTransform;
9
8
 
10
- var _2 = require("./");
9
+ var _types = require("../cssom/types");
11
10
 
12
- var _cssom = require("../cssom");
11
+ var _CSSNumericValue = require("../cssom/CSSNumericValue");
12
+
13
+ var _dimension = require("./dimension");
14
+
15
+ var _numeric = require("./numeric");
16
+
17
+ var _CSS = require("../CSS");
13
18
 
14
19
  var _ = null;
15
- var Opx = new _cssom.CSSUnitValue(0, 'px');
16
- exports.Opx = Opx;
17
- var Odeg = new _cssom.CSSUnitValue(0, 'deg');
18
- exports.Odeg = Odeg;
19
20
 
20
21
  function cast(pattern) {
21
22
  return function (contents) {
@@ -41,18 +42,18 @@ var transformFunctions = {
41
42
  rotatez: ['A'],
42
43
  rotate3d: ['NNNA'],
43
44
  // perspective: ['L'],
44
- scale: ['Nn', cast([_, _, new _cssom.CSSUnitValue(1)]), id],
45
- scalex: ['N', cast([_, new _cssom.CSSUnitValue(1), new _cssom.CSSUnitValue(1)]), cast([_, new _cssom.CSSUnitValue(1)])],
46
- scaley: ['N', cast([new _cssom.CSSUnitValue(1), _, new _cssom.CSSUnitValue(1)]), cast([new _cssom.CSSUnitValue(1), _])],
47
- scalez: ['N', cast([new _cssom.CSSUnitValue(1), new _cssom.CSSUnitValue(1), _])],
45
+ scale: ['Nn', cast([_, _, _CSS.CSS.number(1)]), id],
46
+ scalex: ['N', cast([_, _CSS.CSS.number(1), _CSS.CSS.number(1)]), cast([_, _CSS.CSS.number(1)])],
47
+ scaley: ['N', cast([_CSS.CSS.number(1), _, _CSS.CSS.number(1)]), cast([_CSS.CSS.number(1), _])],
48
+ scalez: ['N', cast([_CSS.CSS.number(1), _CSS.CSS.number(1), _])],
48
49
  scale3d: ['NNN', id],
49
50
  // skew: ['Aa', null, id],
50
51
  // skewx: ['A', null, cast([_, Odeg])],
51
52
  // skewy: ['A', null, cast([Odeg, _])],
52
- translate: ['Tt', cast([_, _, Opx]), id],
53
- translatex: ['T', cast([_, Opx, Opx]), cast([_, Opx])],
54
- translatey: ['T', cast([Opx, _, Opx]), cast([Opx, _])],
55
- translatez: ['L', cast([Opx, Opx, _])],
53
+ translate: ['Tt', cast([_, _, _CSSNumericValue.Opx]), id],
54
+ translatex: ['T', cast([_, _CSSNumericValue.Opx, _CSSNumericValue.Opx]), cast([_, _CSSNumericValue.Opx])],
55
+ translatey: ['T', cast([_CSSNumericValue.Opx, _, _CSSNumericValue.Opx]), cast([_CSSNumericValue.Opx, _])],
56
+ translatez: ['L', cast([_CSSNumericValue.Opx, _CSSNumericValue.Opx, _])],
56
57
  translate3d: ['TTL', id]
57
58
  };
58
59
  /**
@@ -107,19 +108,19 @@ function parseTransform(string) {
107
108
  if (!arg) {
108
109
  // @ts-ignore
109
110
  parsedArg = {
110
- a: Odeg,
111
+ a: _CSSNumericValue.Odeg,
111
112
  n: parsedArgs[0],
112
- t: Opx
113
+ t: _CSSNumericValue.Opx
113
114
  }[type];
114
115
  } else {
115
116
  // @ts-ignore
116
117
  parsedArg = {
117
118
  A: function A(s) {
118
- return s.trim() === '0' ? Odeg : (0, _2.parseAngle)(s);
119
+ return s.trim() === '0' ? _CSSNumericValue.Odeg : (0, _dimension.parseAngle)(s);
119
120
  },
120
- N: _2.parseNumber,
121
- T: _2.parseLengthOrPercentage,
122
- L: _2.parseLength
121
+ N: _numeric.parseNumber,
122
+ T: _dimension.parseLengthOrPercentage,
123
+ L: _dimension.parseLength
123
124
  }[type.toUpperCase()](arg);
124
125
  }
125
126
 
@@ -203,10 +204,10 @@ function mergeTransforms(left, right, target) {
203
204
  t: type,
204
205
  d: args.map(function (arg) {
205
206
  if (typeof arg === 'number') {
206
- return new _cssom.CSSUnitValue(defaultValue);
207
+ return new _CSSNumericValue.CSSUnitValue(defaultValue);
207
208
  }
208
209
 
209
- return new _cssom.CSSUnitValue(defaultValue, arg.unit); // {
210
+ return new _CSSNumericValue.CSSUnitValue(defaultValue, arg.unit); // {
210
211
  // unit: arg.unit,
211
212
  // value: defaultValue,
212
213
  // };
@@ -270,7 +271,7 @@ function mergeTransforms(left, right, target) {
270
271
  var stringConversions = [];
271
272
 
272
273
  for (var j = 0; j < leftArgs.length; j++) {
273
- var merge = leftArgs[j].unit === _cssom.UnitType.kNumber ? _2.mergeNumbers : _2.mergeDimensions; // @ts-ignore
274
+ var merge = leftArgs[j].unit === _types.UnitType.kNumber ? _numeric.mergeNumbers : _dimension.mergeDimensions; // @ts-ignore
274
275
 
275
276
  var merged = merge(leftArgs[j], rightArgs[j], target, false, j);
276
277
  leftArgsCopy[j] = merged[0];
@@ -1,12 +1,24 @@
1
1
  import type { DisplayObject, ParsedPathStyleProps } from '../../display-objects';
2
+ import { Rectangle } from '../../shapes';
2
3
  import type { CSSProperty } from '../CSSProperty';
3
4
  import { parsePath, mergePaths } from '../parser';
4
- export declare class CSSPropertyPath implements Partial<CSSProperty<ParsedPathStyleProps, ParsedPathStyleProps>> {
5
+ export declare class CSSPropertyPath implements Partial<CSSProperty<ParsedPathStyleProps['path'], ParsedPathStyleProps['path']>> {
5
6
  /**
6
7
  * path2Curve
7
8
  */
8
9
  parser: typeof parsePath;
9
- calculator(name: string, oldParsed: ParsedPathStyleProps, parsed: ParsedPathStyleProps): ParsedPathStyleProps;
10
+ calculator(name: string, oldParsed: ParsedPathStyleProps['path'], parsed: ParsedPathStyleProps['path']): {
11
+ absolutePath: import("../../types").PathCommand[];
12
+ hasArc: boolean;
13
+ segments: import("../../display-objects").PathSegment[];
14
+ polygons: [number, number][][];
15
+ polylines: [number, number][][];
16
+ curve: import("../../types").PathCommand[];
17
+ totalLength: number;
18
+ curveSegments: number[][];
19
+ zCommandIndexes: number[];
20
+ rect: Rectangle;
21
+ };
10
22
  mixer: typeof mergePaths;
11
23
  /**
12
24
  * update local position
@@ -1,5 +1,5 @@
1
1
  import type { CSSProperty } from '../CSSProperty';
2
- import type { DisplayObject, ParsedPathStyleProps } from '../../display-objects';
3
- export declare class CSSPropertyTextTransform implements Partial<CSSProperty<ParsedPathStyleProps, ParsedPathStyleProps>> {
2
+ import type { DisplayObject } from '../../display-objects';
3
+ export declare class CSSPropertyTextTransform implements Partial<CSSProperty<any, any>> {
4
4
  postProcessor(o: DisplayObject): void;
5
5
  }
@@ -13,8 +13,6 @@ var _cssom = require("../cssom");
13
13
 
14
14
  var _parser = require("../parser");
15
15
 
16
- // import { uniq } from '@lodash-es';
17
-
18
16
  /**
19
17
  * @see /zh/docs/api/animation#支持变换的属性
20
18
  *
@@ -113,40 +111,40 @@ function () {
113
111
  }) || [1, 1, 1];
114
112
  object.scaleLocal(newScale[0] / oldScale[0], newScale[1] / oldScale[1], newScale[2] / oldScale[2]);
115
113
  } else if (t === 'translate') {
116
- var newTranslation = value && value.d || [_parser.Opx, _parser.Opx];
117
- var oldTranslation = old && old.d || [_parser.Opx, _parser.Opx];
114
+ var newTranslation = value && value.d || [_cssom.Opx, _cssom.Opx];
115
+ var oldTranslation = old && old.d || [_cssom.Opx, _cssom.Opx];
118
116
  object.translateLocal(newTranslation[0].value - oldTranslation[0].value, newTranslation[1].value - oldTranslation[1].value, 0);
119
117
  } else if (t === 'translatex') {
120
- var newTranslation = value && value.d || [_parser.Opx];
121
- var oldTranslation = old && old.d || [_parser.Opx];
118
+ var newTranslation = value && value.d || [_cssom.Opx];
119
+ var oldTranslation = old && old.d || [_cssom.Opx];
122
120
  object.translateLocal(newTranslation[0].value - oldTranslation[0].value, 0, 0);
123
121
  } else if (t === 'translatey') {
124
- var newTranslation = value && value.d || [_parser.Opx];
125
- var oldTranslation = old && old.d || [_parser.Opx];
122
+ var newTranslation = value && value.d || [_cssom.Opx];
123
+ var oldTranslation = old && old.d || [_cssom.Opx];
126
124
  object.translateLocal(0, newTranslation[0].value - oldTranslation[0].value, 0);
127
125
  } else if (t === 'translatez') {
128
- var newTranslation = value && value.d || [_parser.Opx];
129
- var oldTranslation = old && old.d || [_parser.Opx];
126
+ var newTranslation = value && value.d || [_cssom.Opx];
127
+ var oldTranslation = old && old.d || [_cssom.Opx];
130
128
  object.translateLocal(0, 0, newTranslation[0].value - oldTranslation[0].value);
131
129
  } else if (t === 'translate3d') {
132
- var newTranslation = value && value.d || [_parser.Opx, _parser.Opx, _parser.Opx];
133
- var oldTranslation = old && old.d || [_parser.Opx, _parser.Opx, _parser.Opx];
130
+ var newTranslation = value && value.d || [_cssom.Opx, _cssom.Opx, _cssom.Opx];
131
+ var oldTranslation = old && old.d || [_cssom.Opx, _cssom.Opx, _cssom.Opx];
134
132
  object.translateLocal(newTranslation[0].value - oldTranslation[0].value, newTranslation[1].value - oldTranslation[1].value, newTranslation[2].value - oldTranslation[2].value);
135
133
  } else if (t === 'rotate') {
136
- var newAngles = value && value.d || [_parser.Odeg];
137
- var oldAngles = old && old.d || [_parser.Odeg];
134
+ var newAngles = value && value.d || [_cssom.Odeg];
135
+ var oldAngles = old && old.d || [_cssom.Odeg];
138
136
  object.rotateLocal(0, 0, newAngles[0].value - oldAngles[0].value);
139
137
  } else if (t === 'rotatex') {
140
- var newAngles = value && value.d || [_parser.Odeg];
141
- var oldAngles = old && old.d || [_parser.Odeg];
138
+ var newAngles = value && value.d || [_cssom.Odeg];
139
+ var oldAngles = old && old.d || [_cssom.Odeg];
142
140
  object.rotateLocal(newAngles[0].value - oldAngles[0].value, 0, 0);
143
141
  } else if (t === 'rotatey') {
144
- var newAngles = value && value.d || [_parser.Odeg];
145
- var oldAngles = old && old.d || [_parser.Odeg];
142
+ var newAngles = value && value.d || [_cssom.Odeg];
143
+ var oldAngles = old && old.d || [_cssom.Odeg];
146
144
  object.rotateLocal(0, newAngles[0].value - oldAngles[0].value, 0);
147
145
  } else if (t === 'rotatez') {
148
- var newAngles = value && value.d || [_parser.Odeg];
149
- var oldAngles = old && old.d || [_parser.Odeg];
146
+ var newAngles = value && value.d || [_cssom.Odeg];
147
+ var oldAngles = old && old.d || [_cssom.Odeg];
150
148
  object.rotateLocal(0, 0, newAngles[0].value - oldAngles[0].value);
151
149
  } else if (t === 'rotate3d') {// 暂不支持绕指定轴旋转
152
150
  // const newAngles = value && value.d || [Odeg, Odeg, Odeg];
@@ -9,8 +9,6 @@ var _tslib = require("tslib");
9
9
 
10
10
  var _manaSyringe = require("mana-syringe");
11
11
 
12
- var _lodashEs = require("lodash-es");
13
-
14
12
  var _glMatrix = require("gl-matrix");
15
13
 
16
14
  var _DisplayObjectPool = require("../DisplayObjectPool");
@@ -115,11 +113,11 @@ function (_super) {
115
113
  interactive: (_c = _this.config.interactive) !== null && _c !== void 0 ? _c : true
116
114
  }), _this.config.style), _this.config.attrs);
117
115
 
118
- if (!(0, _lodashEs.isNil)(_this.config.visible)) {
116
+ if (_this.config.visible != null) {
119
117
  _this.config.style.visibility = _this.config.visible === false ? 'hidden' : 'visible';
120
118
  }
121
119
 
122
- if (!(0, _lodashEs.isNil)(_this.config.interactive)) {
120
+ if (_this.config.interactive != null) {
123
121
  _this.config.style.pointerEvents = _this.config.interactive === false ? 'none' : 'auto';
124
122
  }
125
123
 
@@ -213,11 +211,11 @@ function (_super) {
213
211
  attributeValue = _a[1]; // ignore undefined value
214
212
 
215
213
 
216
- if ((0, _lodashEs.isUndefined)(value)) {
214
+ if ((0, _utils.isUndefined)(value)) {
217
215
  return;
218
216
  }
219
217
 
220
- if (force || !(0, _lodashEs.isEqual)(attributeValue, this.attributes[attributeName])) {
218
+ if (force || attributeValue != this.attributes[attributeName]) {
221
219
  this.internalSetAttribute(attributeName, attributeValue);
222
220
 
223
221
  _super.prototype.setAttribute.call(this, attributeName, attributeValue);
@@ -476,7 +474,7 @@ function (_super) {
476
474
  };
477
475
 
478
476
  DisplayObject.prototype.rotateLocal = function (x, y, z) {
479
- if ((0, _lodashEs.isNil)(y) && (0, _lodashEs.isNil)(z)) {
477
+ if ((0, _utils.isNil)(y) && (0, _utils.isNil)(z)) {
480
478
  this.sceneGraphService.rotateLocal(this, 0, 0, x);
481
479
  } else {
482
480
  this.sceneGraphService.rotateLocal(this, x, y, z);
@@ -486,7 +484,7 @@ function (_super) {
486
484
  };
487
485
 
488
486
  DisplayObject.prototype.rotate = function (x, y, z) {
489
- if ((0, _lodashEs.isNil)(y) && (0, _lodashEs.isNil)(z)) {
487
+ if ((0, _utils.isNil)(y) && (0, _utils.isNil)(z)) {
490
488
  this.sceneGraphService.rotate(this, 0, 0, x);
491
489
  } else {
492
490
  this.sceneGraphService.rotate(this, x, y, z);
@@ -796,7 +794,7 @@ function (_super) {
796
794
  return this.attributes;
797
795
  }
798
796
 
799
- if ((0, _lodashEs.isObject)(name)) {
797
+ if ((0, _utils.isObject)(name)) {
800
798
  Object.keys(name).forEach(function (key) {
801
799
  _this.setAttribute(key, name[key]);
802
800
  });