@antv/g 5.0.24 → 5.1.2

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 +2 -2
  2. package/es/Canvas.js +2 -0
  3. package/es/css/CSS.d.ts +4 -2
  4. package/es/css/CSS.js +6 -2
  5. package/es/css/CSSProperty.d.ts +2 -1
  6. package/es/css/StyleValueRegistry.d.ts +24 -55
  7. package/es/css/StyleValueRegistry.js +120 -138
  8. package/es/css/interfaces.d.ts +110 -0
  9. package/es/css/interfaces.js +75 -0
  10. package/es/css/parser/color.d.ts +1 -1
  11. package/es/css/parser/color.js +2 -2
  12. package/es/css/parser/dimension.js +5 -1
  13. package/es/css/parser/path.d.ts +2 -2
  14. package/es/css/parser/path.js +9 -2
  15. package/es/css/parser/points.d.ts +8 -1
  16. package/es/css/parser/points.js +33 -3
  17. package/es/css/parser/transform.js +1 -1
  18. package/es/css/properties/CSSPropertyClipPath.js +7 -1
  19. package/es/css/properties/CSSPropertyLengthOrPercentage.d.ts +1 -2
  20. package/es/css/properties/CSSPropertyLengthOrPercentage.js +34 -14
  21. package/es/css/properties/CSSPropertyLengthOrPercentage12.d.ts +15 -0
  22. package/es/css/properties/CSSPropertyLengthOrPercentage12.js +38 -0
  23. package/es/css/properties/CSSPropertyLengthOrPercentage14.d.ts +25 -0
  24. package/es/css/properties/CSSPropertyLengthOrPercentage14.js +42 -0
  25. package/es/css/properties/CSSPropertyLocalPosition.d.ts +0 -9
  26. package/es/css/properties/CSSPropertyLocalPosition.js +59 -20
  27. package/es/css/properties/CSSPropertyPath.d.ts +3 -3
  28. package/es/css/properties/CSSPropertyPath.js +11 -6
  29. package/es/css/properties/CSSPropertyPoints.js +7 -5
  30. package/es/css/properties/CSSPropertyTransform.d.ts +1 -1
  31. package/es/css/properties/CSSPropertyTransform.js +76 -104
  32. package/es/css/properties/index.d.ts +2 -2
  33. package/es/css/properties/index.js +2 -2
  34. package/es/display-objects/Circle.d.ts +4 -0
  35. package/es/display-objects/Circle.js +2 -0
  36. package/es/display-objects/CustomElement.d.ts +6 -2
  37. package/es/display-objects/CustomElement.js +15 -5
  38. package/es/display-objects/DisplayObject.d.ts +1 -7
  39. package/es/display-objects/DisplayObject.js +6 -26
  40. package/es/display-objects/Ellipse.d.ts +4 -0
  41. package/es/display-objects/Ellipse.js +2 -0
  42. package/es/display-objects/Group.d.ts +4 -0
  43. package/es/display-objects/Group.js +2 -0
  44. package/es/display-objects/HTML.d.ts +4 -4
  45. package/es/display-objects/HTML.js +5 -3
  46. package/es/display-objects/Image.d.ts +4 -0
  47. package/es/display-objects/Image.js +2 -0
  48. package/es/display-objects/Line.js +2 -0
  49. package/es/display-objects/Polygon.js +1 -1
  50. package/es/display-objects/Polyline.js +1 -1
  51. package/es/display-objects/Rect.d.ts +11 -4
  52. package/es/display-objects/Rect.js +2 -0
  53. package/es/display-objects/Text.d.ts +4 -0
  54. package/es/display-objects/Text.js +4 -2
  55. package/es/dom/Element.js +1 -0
  56. package/es/global-module.js +4 -4
  57. package/es/services/EventService.js +10 -2
  58. package/es/services/SceneGraphService.d.ts +2 -0
  59. package/es/services/SceneGraphService.js +9 -0
  60. package/es/services/aabb/CircleUpdater.d.ts +0 -2
  61. package/es/services/aabb/CircleUpdater.js +2 -6
  62. package/es/services/aabb/EllipseUpdater.d.ts +0 -2
  63. package/es/services/aabb/EllipseUpdater.js +2 -6
  64. package/es/services/aabb/LineUpdater.d.ts +0 -2
  65. package/es/services/aabb/LineUpdater.js +1 -3
  66. package/es/services/aabb/PathUpdater.d.ts +0 -2
  67. package/es/services/aabb/PathUpdater.js +1 -5
  68. package/es/services/aabb/PolylineUpdater.d.ts +0 -2
  69. package/es/services/aabb/PolylineUpdater.js +1 -3
  70. package/es/services/aabb/RectUpdater.d.ts +0 -2
  71. package/es/services/aabb/RectUpdater.js +1 -5
  72. package/es/services/aabb/TextUpdater.d.ts +7 -0
  73. package/es/services/aabb/TextUpdater.js +0 -4
  74. package/es/services/aabb/interfaces.d.ts +0 -3
  75. package/es/types.d.ts +6 -19
  76. package/es/types.js +1 -0
  77. package/es/utils/interpolation.js +5 -10
  78. package/es/utils/math.js +4 -3
  79. package/es/utils/path.d.ts +2 -2
  80. package/es/utils/path.js +76 -26
  81. package/lib/Canvas.js +2 -0
  82. package/lib/css/CSS.d.ts +4 -2
  83. package/lib/css/CSS.js +6 -2
  84. package/lib/css/CSSProperty.d.ts +2 -1
  85. package/lib/css/StyleValueRegistry.d.ts +24 -55
  86. package/lib/css/StyleValueRegistry.js +120 -137
  87. package/lib/css/interfaces.d.ts +110 -0
  88. package/lib/css/interfaces.js +76 -1
  89. package/lib/css/parser/color.d.ts +1 -1
  90. package/lib/css/parser/color.js +1 -1
  91. package/lib/css/parser/dimension.js +4 -0
  92. package/lib/css/parser/path.d.ts +2 -2
  93. package/lib/css/parser/path.js +9 -2
  94. package/lib/css/parser/points.d.ts +8 -1
  95. package/lib/css/parser/points.js +33 -3
  96. package/lib/css/parser/transform.js +1 -1
  97. package/lib/css/properties/CSSPropertyClipPath.js +8 -1
  98. package/lib/css/properties/CSSPropertyLengthOrPercentage.d.ts +1 -2
  99. package/lib/css/properties/CSSPropertyLengthOrPercentage.js +34 -14
  100. package/lib/css/properties/CSSPropertyLengthOrPercentage12.d.ts +15 -0
  101. package/lib/css/properties/CSSPropertyLengthOrPercentage12.js +48 -0
  102. package/lib/css/properties/CSSPropertyLengthOrPercentage14.d.ts +25 -0
  103. package/lib/css/properties/CSSPropertyLengthOrPercentage14.js +52 -0
  104. package/lib/css/properties/CSSPropertyLocalPosition.d.ts +0 -9
  105. package/lib/css/properties/CSSPropertyLocalPosition.js +60 -20
  106. package/lib/css/properties/CSSPropertyPath.d.ts +3 -3
  107. package/lib/css/properties/CSSPropertyPath.js +12 -6
  108. package/lib/css/properties/CSSPropertyPoints.js +8 -5
  109. package/lib/css/properties/CSSPropertyTransform.d.ts +1 -1
  110. package/lib/css/properties/CSSPropertyTransform.js +75 -103
  111. package/lib/css/properties/index.d.ts +2 -2
  112. package/lib/css/properties/index.js +17 -17
  113. package/lib/display-objects/Circle.d.ts +4 -0
  114. package/lib/display-objects/Circle.js +2 -0
  115. package/lib/display-objects/CustomElement.d.ts +6 -2
  116. package/lib/display-objects/CustomElement.js +13 -4
  117. package/lib/display-objects/DisplayObject.d.ts +1 -7
  118. package/lib/display-objects/DisplayObject.js +6 -27
  119. package/lib/display-objects/Ellipse.d.ts +4 -0
  120. package/lib/display-objects/Ellipse.js +2 -0
  121. package/lib/display-objects/Group.d.ts +4 -0
  122. package/lib/display-objects/Group.js +2 -0
  123. package/lib/display-objects/HTML.d.ts +4 -4
  124. package/lib/display-objects/HTML.js +5 -3
  125. package/lib/display-objects/Image.d.ts +4 -0
  126. package/lib/display-objects/Image.js +2 -0
  127. package/lib/display-objects/Line.js +2 -0
  128. package/lib/display-objects/Polygon.js +1 -1
  129. package/lib/display-objects/Polyline.js +1 -1
  130. package/lib/display-objects/Rect.d.ts +11 -4
  131. package/lib/display-objects/Rect.js +2 -0
  132. package/lib/display-objects/Text.d.ts +4 -0
  133. package/lib/display-objects/Text.js +4 -2
  134. package/lib/dom/Element.js +1 -0
  135. package/lib/global-module.js +3 -3
  136. package/lib/services/EventService.js +10 -2
  137. package/lib/services/SceneGraphService.d.ts +2 -0
  138. package/lib/services/SceneGraphService.js +12 -0
  139. package/lib/services/aabb/CircleUpdater.d.ts +0 -2
  140. package/lib/services/aabb/CircleUpdater.js +2 -6
  141. package/lib/services/aabb/EllipseUpdater.d.ts +0 -2
  142. package/lib/services/aabb/EllipseUpdater.js +2 -6
  143. package/lib/services/aabb/LineUpdater.d.ts +0 -2
  144. package/lib/services/aabb/LineUpdater.js +1 -3
  145. package/lib/services/aabb/PathUpdater.d.ts +0 -2
  146. package/lib/services/aabb/PathUpdater.js +1 -5
  147. package/lib/services/aabb/PolylineUpdater.d.ts +0 -2
  148. package/lib/services/aabb/PolylineUpdater.js +1 -3
  149. package/lib/services/aabb/RectUpdater.d.ts +0 -2
  150. package/lib/services/aabb/RectUpdater.js +1 -5
  151. package/lib/services/aabb/TextUpdater.d.ts +7 -0
  152. package/lib/services/aabb/TextUpdater.js +0 -4
  153. package/lib/services/aabb/interfaces.d.ts +0 -3
  154. package/lib/types.d.ts +6 -19
  155. package/lib/types.js +1 -0
  156. package/lib/utils/interpolation.js +6 -10
  157. package/lib/utils/math.js +4 -3
  158. package/lib/utils/path.d.ts +2 -2
  159. package/lib/utils/path.js +70 -26
  160. package/package.json +3 -3
  161. package/es/css/properties/CSSPropertyAnchor.d.ts +0 -8
  162. package/es/css/properties/CSSPropertyAnchor.js +0 -25
  163. package/es/css/properties/CSSPropertyLineDash.d.ts +0 -9
  164. package/es/css/properties/CSSPropertyLineDash.js +0 -25
  165. package/lib/css/properties/CSSPropertyAnchor.d.ts +0 -8
  166. package/lib/css/properties/CSSPropertyAnchor.js +0 -35
  167. package/lib/css/properties/CSSPropertyLineDash.d.ts +0 -9
  168. package/lib/css/properties/CSSPropertyLineDash.js +0 -34
@@ -9,6 +9,8 @@ var _tslib = require("tslib");
9
9
 
10
10
  var _manaSyringe = require("mana-syringe");
11
11
 
12
+ var _ = require("../..");
13
+
12
14
  var _parser = require("../parser");
13
15
 
14
16
  var CSSPropertyPoints =
@@ -23,11 +25,12 @@ function () {
23
25
 
24
26
 
25
27
  CSSPropertyPoints.prototype.postProcessor = function (object) {
26
- var _a = object.parsedStyle,
27
- x = _a.x,
28
- y = _a.y,
29
- z = _a.z;
30
- object.setLocalPosition(x && x.value || 0, y && y.value || 0, z && z.value || 0);
28
+ if (object.nodeName === _.Shape.POLYGON || object.nodeName === _.Shape.POLYLINE) {
29
+ var _a = object.parsedStyle,
30
+ defX = _a.defX,
31
+ defY = _a.defY;
32
+ object.setLocalPosition(defX, defY);
33
+ }
31
34
  };
32
35
 
33
36
  CSSPropertyPoints = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)()], CSSPropertyPoints);
@@ -34,5 +34,5 @@ import { parseTransform, mergeTransforms } from '../parser';
34
34
  export declare class CSSPropertyTransform implements Partial<CSSProperty<any[], any[]>> {
35
35
  parser: typeof parseTransform;
36
36
  mixer: typeof mergeTransforms;
37
- calculator(name: string, oldValue: any[], newValue: any[], object: DisplayObject): any[];
37
+ postProcessor(object: DisplayObject): void;
38
38
  }
@@ -51,112 +51,84 @@ function () {
51
51
  this.mixer = _parser.mergeTransforms;
52
52
  }
53
53
 
54
- CSSPropertyTransform.prototype.calculator = function (name, oldValue, newValue, object) {
55
- if (newValue instanceof _cssom.CSSKeywordValue) {
56
- newValue = [];
57
- } // const uniqTypes = uniq([
58
- // ...(oldValue || []).map(({ t }) => t),
59
- // ...(newValue || []).map(({ t }) => t),
60
- // ]);
54
+ CSSPropertyTransform.prototype.postProcessor = function (object) {
55
+ var _a = object.parsedStyle,
56
+ transform = _a.transform,
57
+ defX = _a.defX,
58
+ defY = _a.defY;
61
59
 
60
+ if (transform && transform.length) {
61
+ // reset transform
62
+ object.resetLocalTransform();
63
+ object.setLocalPosition(defX, defY);
64
+ transform.forEach(function (_a) {
65
+ var t = _a.t,
66
+ d = _a.d;
62
67
 
63
- newValue.forEach(function (transform) {
64
- var t = transform.t;
65
- var value = (newValue || []).find(function (o) {
66
- return o.t === t;
68
+ if (t === 'scale') {
69
+ // scale(1) scale(1, 1)
70
+ var newScale = d.map(function (s) {
71
+ return s.value;
72
+ }) || [1, 1];
73
+ object.scaleLocal(newScale[0], newScale[1], 1);
74
+ } else if (t === 'scalex') {
75
+ var newScale = d.map(function (s) {
76
+ return s.value;
77
+ }) || [1];
78
+ object.scaleLocal(newScale[0], 1, 1);
79
+ } else if (t === 'scaley') {
80
+ var newScale = d.map(function (s) {
81
+ return s.value;
82
+ }) || [1];
83
+ object.scaleLocal(1, newScale[0], 1);
84
+ } else if (t === 'scalez') {
85
+ var newScale = d.map(function (s) {
86
+ return s.value;
87
+ }) || [1];
88
+ object.scaleLocal(1, 1, newScale[0]);
89
+ } else if (t === 'scale3d') {
90
+ var newScale = d.map(function (s) {
91
+ return s.value;
92
+ }) || [1, 1, 1];
93
+ object.scaleLocal(newScale[0], newScale[1], newScale[2]);
94
+ } else if (t === 'translate') {
95
+ var newTranslation = d || [_cssom.Opx, _cssom.Opx];
96
+ object.translateLocal(newTranslation[0].value, newTranslation[1].value, 0);
97
+ } else if (t === 'translatex') {
98
+ var newTranslation = d || [_cssom.Opx];
99
+ object.translateLocal(newTranslation[0].value, 0, 0);
100
+ } else if (t === 'translatey') {
101
+ var newTranslation = d || [_cssom.Opx];
102
+ object.translateLocal(0, newTranslation[0].value, 0);
103
+ } else if (t === 'translatez') {
104
+ var newTranslation = d || [_cssom.Opx];
105
+ object.translateLocal(0, 0, newTranslation[0].value);
106
+ } else if (t === 'translate3d') {
107
+ var newTranslation = d || [_cssom.Opx, _cssom.Opx, _cssom.Opx];
108
+ object.translateLocal(newTranslation[0].value, newTranslation[1].value, newTranslation[2].value);
109
+ } else if (t === 'rotate') {
110
+ var newAngles = d || [_cssom.Odeg];
111
+ object.rotateLocal(0, 0, newAngles[0].value);
112
+ } else if (t === 'rotatex') {
113
+ var newAngles = d || [_cssom.Odeg];
114
+ object.rotateLocal(newAngles[0].value, 0, 0);
115
+ } else if (t === 'rotatey') {
116
+ var newAngles = d || [_cssom.Odeg];
117
+ object.rotateLocal(0, newAngles[0].value, 0);
118
+ } else if (t === 'rotatez') {
119
+ var newAngles = d || [_cssom.Odeg];
120
+ object.rotateLocal(0, 0, newAngles[0].value);
121
+ } else if (t === 'rotate3d') {// 暂不支持绕指定轴旋转
122
+ // const newAngles = value && value.d || [Odeg, Odeg, Odeg];
123
+ // const oldAngles = old && old.d || [Odeg, Odeg, Odeg];
124
+ // object.rotateLocal(
125
+ // newAngles[0].value - oldAngles[0].value,
126
+ // newAngles[1].value - oldAngles[1].value,
127
+ // newAngles[2].value - oldAngles[2].value,
128
+ // );
129
+ }
67
130
  });
68
- var old = (oldValue || []).find(function (o) {
69
- return o.t === t;
70
- });
71
-
72
- if (t === 'scale') {
73
- // scale(1) scale(1, 1)
74
- var newScale = value && value.d && value.d.map(function (s) {
75
- return s.value;
76
- }) || [1, 1];
77
- var oldScale = old && old.d && old.d.map(function (s) {
78
- return s.value;
79
- }) || [1, 1];
80
- object.scaleLocal(newScale[0] / oldScale[0], newScale[1] / oldScale[1], 1);
81
- } else if (t === 'scalex') {
82
- var newScale = value && value.d && value.d.map(function (s) {
83
- return s.value;
84
- }) || [1];
85
- var oldScale = old && old.d && old.d.map(function (s) {
86
- return s.value;
87
- }) || [1];
88
- object.scaleLocal(newScale[0] / oldScale[0], 1, 1);
89
- } else if (t === 'scaley') {
90
- var newScale = value && value.d && value.d.map(function (s) {
91
- return s.value;
92
- }) || [1];
93
- var oldScale = old && old.d && old.d.map(function (s) {
94
- return s.value;
95
- }) || [1];
96
- object.scaleLocal(1, newScale[0] / oldScale[0], 1);
97
- } else if (t === 'scalez') {
98
- var newScale = value && value.d && value.d.map(function (s) {
99
- return s.value;
100
- }) || [1];
101
- var oldScale = old && old.d && old.d.map(function (s) {
102
- return s.value;
103
- }) || [1];
104
- object.scaleLocal(1, 1, newScale[0] / oldScale[0]);
105
- } else if (t === 'scale3d') {
106
- var newScale = value && value.d && value.d.map(function (s) {
107
- return s.value;
108
- }) || [1, 1, 1];
109
- var oldScale = old && old.d && old.d.map(function (s) {
110
- return s.value;
111
- }) || [1, 1, 1];
112
- object.scaleLocal(newScale[0] / oldScale[0], newScale[1] / oldScale[1], newScale[2] / oldScale[2]);
113
- } else if (t === 'translate') {
114
- var newTranslation = value && value.d || [_cssom.Opx, _cssom.Opx];
115
- var oldTranslation = old && old.d || [_cssom.Opx, _cssom.Opx];
116
- object.translateLocal(newTranslation[0].value - oldTranslation[0].value, newTranslation[1].value - oldTranslation[1].value, 0);
117
- } else if (t === 'translatex') {
118
- var newTranslation = value && value.d || [_cssom.Opx];
119
- var oldTranslation = old && old.d || [_cssom.Opx];
120
- object.translateLocal(newTranslation[0].value - oldTranslation[0].value, 0, 0);
121
- } else if (t === 'translatey') {
122
- var newTranslation = value && value.d || [_cssom.Opx];
123
- var oldTranslation = old && old.d || [_cssom.Opx];
124
- object.translateLocal(0, newTranslation[0].value - oldTranslation[0].value, 0);
125
- } else if (t === 'translatez') {
126
- var newTranslation = value && value.d || [_cssom.Opx];
127
- var oldTranslation = old && old.d || [_cssom.Opx];
128
- object.translateLocal(0, 0, newTranslation[0].value - oldTranslation[0].value);
129
- } else if (t === 'translate3d') {
130
- var newTranslation = value && value.d || [_cssom.Opx, _cssom.Opx, _cssom.Opx];
131
- var oldTranslation = old && old.d || [_cssom.Opx, _cssom.Opx, _cssom.Opx];
132
- object.translateLocal(newTranslation[0].value - oldTranslation[0].value, newTranslation[1].value - oldTranslation[1].value, newTranslation[2].value - oldTranslation[2].value);
133
- } else if (t === 'rotate') {
134
- var newAngles = value && value.d || [_cssom.Odeg];
135
- var oldAngles = old && old.d || [_cssom.Odeg];
136
- object.rotateLocal(0, 0, newAngles[0].value - oldAngles[0].value);
137
- } else if (t === 'rotatex') {
138
- var newAngles = value && value.d || [_cssom.Odeg];
139
- var oldAngles = old && old.d || [_cssom.Odeg];
140
- object.rotateLocal(newAngles[0].value - oldAngles[0].value, 0, 0);
141
- } else if (t === 'rotatey') {
142
- var newAngles = value && value.d || [_cssom.Odeg];
143
- var oldAngles = old && old.d || [_cssom.Odeg];
144
- object.rotateLocal(0, newAngles[0].value - oldAngles[0].value, 0);
145
- } else if (t === 'rotatez') {
146
- var newAngles = value && value.d || [_cssom.Odeg];
147
- var oldAngles = old && old.d || [_cssom.Odeg];
148
- object.rotateLocal(0, 0, newAngles[0].value - oldAngles[0].value);
149
- } else if (t === 'rotate3d') {// 暂不支持绕指定轴旋转
150
- // const newAngles = value && value.d || [Odeg, Odeg, Odeg];
151
- // const oldAngles = old && old.d || [Odeg, Odeg, Odeg];
152
- // object.rotateLocal(
153
- // newAngles[0].value - oldAngles[0].value,
154
- // newAngles[1].value - oldAngles[1].value,
155
- // newAngles[2].value - oldAngles[2].value,
156
- // );
157
- }
158
- });
159
- return newValue;
131
+ }
160
132
  };
161
133
 
162
134
  CSSPropertyTransform = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)()], CSSPropertyTransform);
@@ -3,11 +3,11 @@ export * from './CSSPropertyLocalPosition';
3
3
  export * from './CSSPropertyOpacity';
4
4
  export * from './CSSPropertyColor';
5
5
  export * from './CSSPropertyFilter';
6
- export * from './CSSPropertyLineDash';
6
+ export * from './CSSPropertyLengthOrPercentage12';
7
+ export * from './CSSPropertyLengthOrPercentage14';
7
8
  export * from './CSSPropertyShadowBlur';
8
9
  export * from './CSSPropertyOffsetPath';
9
10
  export * from './CSSPropertyOffsetDistance';
10
- export * from './CSSPropertyAnchor';
11
11
  export * from './CSSPropertyZIndex';
12
12
  export * from './CSSPropertyTransform';
13
13
  export * from './CSSPropertyTransformOrigin';
@@ -69,15 +69,28 @@ Object.keys(_CSSPropertyFilter).forEach(function (key) {
69
69
  });
70
70
  });
71
71
 
72
- var _CSSPropertyLineDash = require("./CSSPropertyLineDash");
72
+ var _CSSPropertyLengthOrPercentage2 = require("./CSSPropertyLengthOrPercentage12");
73
73
 
74
- Object.keys(_CSSPropertyLineDash).forEach(function (key) {
74
+ Object.keys(_CSSPropertyLengthOrPercentage2).forEach(function (key) {
75
75
  if (key === "default" || key === "__esModule") return;
76
- if (key in exports && exports[key] === _CSSPropertyLineDash[key]) return;
76
+ if (key in exports && exports[key] === _CSSPropertyLengthOrPercentage2[key]) return;
77
77
  Object.defineProperty(exports, key, {
78
78
  enumerable: true,
79
79
  get: function get() {
80
- return _CSSPropertyLineDash[key];
80
+ return _CSSPropertyLengthOrPercentage2[key];
81
+ }
82
+ });
83
+ });
84
+
85
+ var _CSSPropertyLengthOrPercentage3 = require("./CSSPropertyLengthOrPercentage14");
86
+
87
+ Object.keys(_CSSPropertyLengthOrPercentage3).forEach(function (key) {
88
+ if (key === "default" || key === "__esModule") return;
89
+ if (key in exports && exports[key] === _CSSPropertyLengthOrPercentage3[key]) return;
90
+ Object.defineProperty(exports, key, {
91
+ enumerable: true,
92
+ get: function get() {
93
+ return _CSSPropertyLengthOrPercentage3[key];
81
94
  }
82
95
  });
83
96
  });
@@ -121,19 +134,6 @@ Object.keys(_CSSPropertyOffsetDistance).forEach(function (key) {
121
134
  });
122
135
  });
123
136
 
124
- var _CSSPropertyAnchor = require("./CSSPropertyAnchor");
125
-
126
- Object.keys(_CSSPropertyAnchor).forEach(function (key) {
127
- if (key === "default" || key === "__esModule") return;
128
- if (key in exports && exports[key] === _CSSPropertyAnchor[key]) return;
129
- Object.defineProperty(exports, key, {
130
- enumerable: true,
131
- get: function get() {
132
- return _CSSPropertyAnchor[key];
133
- }
134
- });
135
- });
136
-
137
137
  var _CSSPropertyZIndex = require("./CSSPropertyZIndex");
138
138
 
139
139
  Object.keys(_CSSPropertyZIndex).forEach(function (key) {
@@ -3,9 +3,13 @@ import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
3
3
  import { DisplayObject } from './DisplayObject';
4
4
  import type { CSSUnitValue } from '../css';
5
5
  export interface CircleStyleProps extends BaseStyleProps {
6
+ cx?: number | string;
7
+ cy?: number | string;
6
8
  r: number | string;
7
9
  }
8
10
  export interface ParsedCircleStyleProps extends ParsedBaseStyleProps {
11
+ cx: CSSUnitValue;
12
+ cy: CSSUnitValue;
9
13
  r: CSSUnitValue;
10
14
  }
11
15
  export declare class Circle extends DisplayObject<CircleStyleProps, ParsedCircleStyleProps> {
@@ -26,6 +26,8 @@ function (_super) {
26
26
  return _super.call(this, (0, _tslib.__assign)({
27
27
  type: _types.Shape.CIRCLE,
28
28
  style: (0, _tslib.__assign)({
29
+ cx: '',
30
+ cy: '',
29
31
  r: '',
30
32
  anchor: [0.5, 0.5],
31
33
  transformOrigin: 'center',
@@ -1,12 +1,16 @@
1
1
  import { DisplayObject } from './DisplayObject';
2
2
  import type { DisplayObjectConfig } from '../dom/interfaces';
3
3
  import type { BaseStyleProps } from '../types';
4
+ export interface BaseCustomElementStyleProps extends BaseStyleProps {
5
+ x?: number | string;
6
+ y?: number | string;
7
+ }
4
8
  /**
5
9
  * shadow root
6
10
  * @see https://yuque.antfin-inc.com/antv/czqvg5/pgqipg
7
11
  */
8
- export declare abstract class CustomElement<CustomElementStyleProps extends BaseStyleProps> extends DisplayObject<CustomElementStyleProps> {
9
- constructor(config?: DisplayObjectConfig<CustomElementStyleProps>);
12
+ export declare abstract class CustomElement<CustomElementStyleProps extends BaseCustomElementStyleProps> extends DisplayObject<CustomElementStyleProps> {
13
+ constructor({ style, ...rest }?: DisplayObjectConfig<CustomElementStyleProps>);
10
14
  /**
11
15
  * fired after element insert into DOM tree
12
16
  */
@@ -20,12 +20,21 @@ var CustomElement =
20
20
  function (_super) {
21
21
  (0, _tslib.__extends)(CustomElement, _super); // private shadowNodes: DisplayObject[] = [];
22
22
 
23
- function CustomElement(config) {
24
- if (config === void 0) {
25
- config = {};
23
+ function CustomElement(_a) {
24
+ if (_a === void 0) {
25
+ _a = {};
26
26
  }
27
27
 
28
- var _this = _super.call(this, config) || this;
28
+ var _this = this;
29
+
30
+ var style = _a.style,
31
+ rest = (0, _tslib.__rest)(_a, ["style"]);
32
+ _this = _super.call(this, (0, _tslib.__assign)({
33
+ style: (0, _tslib.__assign)({
34
+ x: '',
35
+ y: ''
36
+ }, style)
37
+ }, rest)) || this;
29
38
 
30
39
  _this.handleMounted = function (e) {
31
40
  if (e.target === e.currentTarget) {
@@ -116,14 +116,8 @@ export declare class DisplayObject<StyleProps extends BaseStyleProps = any, Pars
116
116
  getLocalRotation(): quat;
117
117
  getLocalTransform(): mat4;
118
118
  getWorldTransform(): mat4;
119
+ setLocalTransform(transform: mat4): this;
119
120
  resetLocalTransform(): void;
120
- /**
121
- * sync style.x/y when local position changed
122
- *
123
- * Mixins may not declare private/protected properties
124
- * however, you can use ES2020 private fields
125
- */
126
- private syncLocalPosition;
127
121
  /**
128
122
  * returns an array of all Animation objects affecting this element
129
123
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getAnimations
@@ -31,18 +31,14 @@ var _shapes = require("../shapes");
31
31
 
32
32
  var _interfaces2 = require("../css/interfaces");
33
33
 
34
- var _css = require("../css");
35
-
36
34
  var DEFAULT_STYLE_PROPS = {
37
- x: '',
38
- y: '',
39
- z: '',
40
35
  anchor: [0, 0],
41
36
  opacity: '',
42
37
  fillOpacity: '',
43
38
  strokeOpacity: '',
44
39
  fill: '',
45
40
  stroke: '',
41
+ transform: '',
46
42
  transformOrigin: '',
47
43
  visibility: '',
48
44
  pointerEvents: '',
@@ -307,7 +303,6 @@ function (_super) {
307
303
  }
308
304
 
309
305
  this.sceneGraphService.setPosition(this, (0, _utils.createVec3)(position, y, z));
310
- this.syncLocalPosition();
311
306
  return this;
312
307
  };
313
308
  /**
@@ -325,7 +320,6 @@ function (_super) {
325
320
  }
326
321
 
327
322
  this.sceneGraphService.setLocalPosition(this, (0, _utils.createVec3)(position, y, z));
328
- this.syncLocalPosition();
329
323
  return this;
330
324
  };
331
325
  /**
@@ -343,7 +337,6 @@ function (_super) {
343
337
  }
344
338
 
345
339
  this.sceneGraphService.translate(this, (0, _utils.createVec3)(position, y, z));
346
- this.syncLocalPosition();
347
340
  return this;
348
341
  };
349
342
  /**
@@ -361,7 +354,6 @@ function (_super) {
361
354
  }
362
355
 
363
356
  this.sceneGraphService.translateLocal(this, (0, _utils.createVec3)(position, y, z));
364
- this.syncLocalPosition();
365
357
  return this;
366
358
  };
367
359
 
@@ -520,26 +512,13 @@ function (_super) {
520
512
  return this.sceneGraphService.getWorldTransform(this);
521
513
  };
522
514
 
523
- DisplayObject.prototype.resetLocalTransform = function () {
524
- this.sceneGraphService.resetLocalTransform(this);
515
+ DisplayObject.prototype.setLocalTransform = function (transform) {
516
+ this.sceneGraphService.setLocalTransform(this, transform);
517
+ return this;
525
518
  };
526
- /**
527
- * sync style.x/y when local position changed
528
- *
529
- * Mixins may not declare private/protected properties
530
- * however, you can use ES2020 private fields
531
- */
532
-
533
-
534
- DisplayObject.prototype.syncLocalPosition = function () {
535
- var localPosition = this.getLocalPosition();
536
- this.attributes.x = localPosition[0];
537
- this.attributes.y = localPosition[1];
538
- this.attributes.z = localPosition[2]; // should not affect computed style
539
519
 
540
- this.parsedStyle.x = new _css.CSSUnitValue(this.attributes.x, 'px');
541
- this.parsedStyle.y = new _css.CSSUnitValue(this.attributes.y, 'px');
542
- this.parsedStyle.z = new _css.CSSUnitValue(this.attributes.z, 'px');
520
+ DisplayObject.prototype.resetLocalTransform = function () {
521
+ this.sceneGraphService.resetLocalTransform(this);
543
522
  }; // #endregion transformable
544
523
  // #region animatable
545
524
 
@@ -3,10 +3,14 @@ import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
3
3
  import { DisplayObject } from './DisplayObject';
4
4
  import type { CSSUnitValue } from '../css';
5
5
  export interface EllipseStyleProps extends BaseStyleProps {
6
+ cx?: number | string;
7
+ cy?: number | string;
6
8
  rx: number | string;
7
9
  ry: number | string;
8
10
  }
9
11
  export interface ParsedEllipseStyleProps extends ParsedBaseStyleProps {
12
+ cx: CSSUnitValue;
13
+ cy: CSSUnitValue;
10
14
  rx: CSSUnitValue;
11
15
  ry: CSSUnitValue;
12
16
  }
@@ -26,6 +26,8 @@ function (_super) {
26
26
  return _super.call(this, (0, _tslib.__assign)({
27
27
  type: _types.Shape.ELLIPSE,
28
28
  style: (0, _tslib.__assign)({
29
+ cx: '',
30
+ cy: '',
29
31
  rx: '',
30
32
  ry: '',
31
33
  anchor: [0.5, 0.5],
@@ -3,10 +3,14 @@ import { DisplayObject } from './DisplayObject';
3
3
  import type { DisplayObjectConfig } from '../dom';
4
4
  import type { CSSUnitValue } from '../css';
5
5
  export interface GroupStyleProps extends BaseStyleProps {
6
+ x?: number | string;
7
+ y?: number | string;
6
8
  width?: number | string;
7
9
  height?: number | string;
8
10
  }
9
11
  export interface ParsedGroupStyleProps extends ParsedBaseStyleProps {
12
+ x: CSSUnitValue;
13
+ y: CSSUnitValue;
10
14
  width?: CSSUnitValue;
11
15
  height?: CSSUnitValue;
12
16
  }
@@ -36,6 +36,8 @@ function (_super) {
36
36
  return _super.call(this, (0, _tslib.__assign)({
37
37
  type: _types.Shape.GROUP,
38
38
  style: (0, _tslib.__assign)({
39
+ x: '',
40
+ y: '',
39
41
  width: '',
40
42
  height: ''
41
43
  }, style)
@@ -4,19 +4,19 @@ import type { DisplayObjectConfig } from '../dom';
4
4
  import { AABB } from '../shapes';
5
5
  import type { CSSUnitValue } from '../css';
6
6
  export interface HTMLStyleProps extends BaseStyleProps {
7
+ x?: number | string;
8
+ y?: number | string;
7
9
  innerHTML: string | HTMLElement;
8
10
  width: number;
9
11
  height: number;
10
- className?: string | string[];
11
- style?: string;
12
12
  }
13
13
  export interface ParsedHTMLStyleProps extends ParsedBaseStyleProps {
14
+ x: CSSUnitValue;
15
+ y: CSSUnitValue;
14
16
  $el: HTMLElement;
15
17
  innerHTML: string | HTMLElement;
16
18
  width: CSSUnitValue;
17
19
  height: CSSUnitValue;
18
- className?: string | string[];
19
- style?: string;
20
20
  }
21
21
  /**
22
22
  * HTML container
@@ -36,9 +36,11 @@ function (_super) {
36
36
  _this = _super.call(this, (0, _tslib.__assign)({
37
37
  type: _types.Shape.HTML,
38
38
  style: (0, _tslib.__assign)({
39
- innerHTML: '',
40
- className: '',
41
- style: ''
39
+ x: '',
40
+ y: '',
41
+ width: '',
42
+ height: '',
43
+ innerHTML: ''
42
44
  }, style)
43
45
  }, rest)) || this;
44
46
  _this.cullable.enable = false;
@@ -3,12 +3,16 @@ import { DisplayObject } from './DisplayObject';
3
3
  import type { DisplayObjectConfig } from '../dom';
4
4
  import type { CSSUnitValue } from '../css';
5
5
  export interface ImageStyleProps extends BaseStyleProps {
6
+ x?: number | string;
7
+ y?: number | string;
6
8
  img?: string | HTMLImageElement;
7
9
  src?: string | HTMLImageElement;
8
10
  width?: number | string;
9
11
  height?: number | string;
10
12
  }
11
13
  export interface ParsedImageStyleProps extends ParsedBaseStyleProps {
14
+ x: CSSUnitValue;
15
+ y: CSSUnitValue;
12
16
  img?: string | HTMLImageElement;
13
17
  src?: string | HTMLImageElement;
14
18
  width?: CSSUnitValue;
@@ -26,6 +26,8 @@ function (_super) {
26
26
  return _super.call(this, (0, _tslib.__assign)({
27
27
  type: _types.Shape.IMAGE,
28
28
  style: (0, _tslib.__assign)({
29
+ x: '',
30
+ y: '',
29
31
  img: '',
30
32
  width: '',
31
33
  height: '',
@@ -47,6 +47,7 @@ function (_super) {
47
47
  }
48
48
 
49
49
  Line.prototype.getPoint = function (ratio) {
50
+ // TODO: account for z1/z2 in 3D line
50
51
  var _a = this.parsedStyle,
51
52
  x1 = _a.x1,
52
53
  y1 = _a.y1,
@@ -59,6 +60,7 @@ function (_super) {
59
60
  };
60
61
 
61
62
  Line.prototype.getTotalLength = function () {
63
+ // TODO: account for z1/z2 in 3D line
62
64
  var _a = this.parsedStyle,
63
65
  x1 = _a.x1,
64
66
  y1 = _a.y1,
@@ -26,7 +26,7 @@ function (_super) {
26
26
  return _super.call(this, (0, _tslib.__assign)({
27
27
  type: _types.Shape.POLYGON,
28
28
  style: (0, _tslib.__assign)({
29
- points: [],
29
+ points: '',
30
30
  miterLimit: 4,
31
31
  lineWidth: 1
32
32
  }, style)
@@ -30,7 +30,7 @@ function (_super) {
30
30
  return _super.call(this, (0, _tslib.__assign)({
31
31
  type: _types.Shape.POLYLINE,
32
32
  style: (0, _tslib.__assign)({
33
- points: [],
33
+ points: '',
34
34
  lineWidth: 1,
35
35
  miterLimit: 4
36
36
  }, style)
@@ -3,14 +3,21 @@ import { DisplayObject } from './DisplayObject';
3
3
  import type { DisplayObjectConfig } from '../dom';
4
4
  import type { CSSUnitValue } from '../css';
5
5
  export interface RectStyleProps extends BaseStyleProps {
6
+ x?: number | string;
7
+ y?: number | string;
6
8
  width: number | string;
7
9
  height: number | string;
8
- radius?: number | string;
10
+ /**
11
+ * top-left, top-right, bottom-right, bottom-left
12
+ */
13
+ radius?: number | string | number[];
9
14
  }
10
15
  export interface ParsedRectStyleProps extends ParsedBaseStyleProps {
11
- width?: CSSUnitValue;
12
- height?: CSSUnitValue;
13
- radius?: CSSUnitValue;
16
+ x: CSSUnitValue;
17
+ y: CSSUnitValue;
18
+ width: CSSUnitValue;
19
+ height: CSSUnitValue;
20
+ radius?: [CSSUnitValue, CSSUnitValue, CSSUnitValue, CSSUnitValue];
14
21
  }
15
22
  export declare class Rect extends DisplayObject<RectStyleProps, ParsedRectStyleProps> {
16
23
  constructor({ style, ...rest }?: DisplayObjectConfig<RectStyleProps>);
@@ -26,6 +26,8 @@ function (_super) {
26
26
  return _super.call(this, (0, _tslib.__assign)({
27
27
  type: _types.Shape.RECT,
28
28
  style: (0, _tslib.__assign)({
29
+ x: '',
30
+ y: '',
29
31
  width: '',
30
32
  height: '',
31
33
  radius: '',