@antv/g 5.0.15 → 5.0.16

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 (224) hide show
  1. package/dist/index.umd.min.js +18 -2
  2. package/es/Canvas.d.ts +3 -0
  3. package/es/Canvas.js +8 -9
  4. package/es/camera/Camera.d.ts +3 -2
  5. package/es/camera/Camera.js +16 -8
  6. package/es/canvas-module.js +4 -2
  7. package/es/components/Transform.d.ts +0 -1
  8. package/es/components/Transform.js +0 -1
  9. package/es/display-objects/Circle.d.ts +1 -1
  10. package/es/display-objects/Circle.js +8 -3
  11. package/es/display-objects/CustomElement.d.ts +3 -2
  12. package/es/display-objects/CustomElement.js +9 -6
  13. package/es/display-objects/DisplayObject.d.ts +4 -3
  14. package/es/display-objects/DisplayObject.js +77 -50
  15. package/es/display-objects/Ellipse.d.ts +1 -1
  16. package/es/display-objects/Ellipse.js +8 -3
  17. package/es/display-objects/Group.d.ts +18 -2
  18. package/es/display-objects/Group.js +11 -9
  19. package/es/display-objects/HTML.d.ts +1 -1
  20. package/es/display-objects/HTML.js +9 -4
  21. package/es/display-objects/Image.d.ts +5 -3
  22. package/es/display-objects/Image.js +8 -3
  23. package/es/display-objects/Line.d.ts +1 -1
  24. package/es/display-objects/Line.js +12 -4
  25. package/es/display-objects/Path.d.ts +3 -2
  26. package/es/display-objects/Path.js +10 -5
  27. package/es/display-objects/Polygon.d.ts +1 -1
  28. package/es/display-objects/Polygon.js +9 -3
  29. package/es/display-objects/Polyline.d.ts +1 -1
  30. package/es/display-objects/Polyline.js +10 -5
  31. package/es/display-objects/Rect.d.ts +1 -1
  32. package/es/display-objects/Rect.js +8 -3
  33. package/es/display-objects/Text.d.ts +9 -4
  34. package/es/display-objects/Text.js +14 -9
  35. package/es/dom/Animation.js +1 -1
  36. package/es/dom/AnimationTimeline.js +1 -2
  37. package/es/dom/CustomElementRegistry.js +12 -12
  38. package/es/dom/Document.d.ts +1 -0
  39. package/es/dom/Document.js +21 -1
  40. package/es/dom/Element.d.ts +10 -5
  41. package/es/dom/Element.js +41 -15
  42. package/es/dom/EventTarget.d.ts +2 -2
  43. package/es/dom/EventTarget.js +4 -3
  44. package/es/dom/KeyframeList.js +1 -1
  45. package/es/dom/MutationEvent.d.ts +15 -0
  46. package/es/dom/MutationEvent.js +29 -0
  47. package/es/dom/MutationObserver.d.ts +36 -0
  48. package/es/dom/MutationObserver.js +413 -0
  49. package/es/dom/MutationRecord.d.ts +14 -0
  50. package/es/dom/MutationRecord.js +31 -0
  51. package/es/dom/Node.d.ts +35 -3
  52. package/es/dom/Node.js +184 -17
  53. package/es/dom/index.d.ts +3 -0
  54. package/es/dom/index.js +3 -0
  55. package/es/dom/interfaces.d.ts +36 -8
  56. package/es/dom/interfaces.js +23 -5
  57. package/es/global-module.d.ts +1 -0
  58. package/es/global-module.js +11 -13
  59. package/es/index.d.ts +1 -0
  60. package/es/index.js +1 -0
  61. package/es/plugins/CullingPlugin.d.ts +0 -2
  62. package/es/plugins/CullingPlugin.js +3 -24
  63. package/es/plugins/DirtyCheckPlugin.js +2 -2
  64. package/es/plugins/FrustumCullingStrategy.d.ts +1 -0
  65. package/es/plugins/FrustumCullingStrategy.js +40 -33
  66. package/es/plugins/PrepareRendererPlugin.js +21 -5
  67. package/es/property-handlers/aabb.js +19 -20
  68. package/es/property-handlers/color.js +5 -2
  69. package/es/property-handlers/dimension.d.ts +15 -3
  70. package/es/property-handlers/dimension.js +50 -9
  71. package/es/property-handlers/index.d.ts +3 -0
  72. package/es/property-handlers/index.js +4 -1
  73. package/es/property-handlers/inherit.d.ts +6 -0
  74. package/es/property-handlers/inherit.js +25 -0
  75. package/es/property-handlers/interfaces.d.ts +2 -2
  76. package/es/property-handlers/lineDash.d.ts +6 -1
  77. package/es/property-handlers/lineDash.js +23 -4
  78. package/es/property-handlers/offsetDistance.js +2 -2
  79. package/es/property-handlers/text.d.ts +2 -0
  80. package/es/property-handlers/text.js +3 -0
  81. package/es/property-handlers/textTransform.d.ts +6 -0
  82. package/es/property-handlers/textTransform.js +19 -0
  83. package/es/services/EventService.js +3 -5
  84. package/es/services/RenderingContext.d.ts +5 -8
  85. package/es/services/RenderingContext.js +6 -7
  86. package/es/services/RenderingService.js +2 -8
  87. package/es/services/SceneGraphSelector.d.ts +3 -2
  88. package/es/services/SceneGraphSelector.js +8 -4
  89. package/es/services/SceneGraphService.d.ts +0 -7
  90. package/es/services/SceneGraphService.js +9 -77
  91. package/es/services/aabb/CircleUpdater.js +3 -3
  92. package/es/services/aabb/EllipseUpdater.js +2 -2
  93. package/es/services/aabb/LineUpdater.js +2 -2
  94. package/es/services/aabb/PathUpdater.js +2 -2
  95. package/es/services/aabb/PolylineUpdater.js +3 -3
  96. package/es/services/aabb/RectUpdater.js +4 -4
  97. package/es/services/aabb/TextUpdater.js +19 -10
  98. package/es/services/text/index.js +19 -21
  99. package/es/types.d.ts +48 -24
  100. package/es/types.js +50 -31
  101. package/es/utils/custom-easing.js +1 -1
  102. package/es/utils/event.js +5 -3
  103. package/es/utils/index.d.ts +1 -0
  104. package/es/utils/index.js +2 -1
  105. package/es/utils/interpolation.d.ts +1 -0
  106. package/es/utils/interpolation.js +41 -8
  107. package/es/utils/path.js +11 -11
  108. package/es/utils/raf.d.ts +1 -1
  109. package/es/utils/raf.js +0 -2
  110. package/es/utils/string.d.ts +1 -0
  111. package/es/utils/string.js +9 -0
  112. package/es/utils/text.js +3 -3
  113. package/lib/Canvas.d.ts +3 -0
  114. package/lib/Canvas.js +6 -7
  115. package/lib/camera/Camera.d.ts +3 -2
  116. package/lib/camera/Camera.js +20 -10
  117. package/lib/canvas-module.js +3 -1
  118. package/lib/components/Transform.d.ts +0 -1
  119. package/lib/components/Transform.js +0 -1
  120. package/lib/display-objects/Circle.d.ts +1 -1
  121. package/lib/display-objects/Circle.js +7 -2
  122. package/lib/display-objects/CustomElement.d.ts +3 -2
  123. package/lib/display-objects/CustomElement.js +9 -6
  124. package/lib/display-objects/DisplayObject.d.ts +4 -3
  125. package/lib/display-objects/DisplayObject.js +76 -47
  126. package/lib/display-objects/Ellipse.d.ts +1 -1
  127. package/lib/display-objects/Ellipse.js +7 -2
  128. package/lib/display-objects/Group.d.ts +18 -2
  129. package/lib/display-objects/Group.js +10 -9
  130. package/lib/display-objects/HTML.d.ts +1 -1
  131. package/lib/display-objects/HTML.js +8 -4
  132. package/lib/display-objects/Image.d.ts +5 -3
  133. package/lib/display-objects/Image.js +7 -2
  134. package/lib/display-objects/Line.d.ts +1 -1
  135. package/lib/display-objects/Line.js +11 -3
  136. package/lib/display-objects/Path.d.ts +3 -2
  137. package/lib/display-objects/Path.js +9 -4
  138. package/lib/display-objects/Polygon.d.ts +1 -1
  139. package/lib/display-objects/Polygon.js +8 -2
  140. package/lib/display-objects/Polyline.d.ts +1 -1
  141. package/lib/display-objects/Polyline.js +9 -4
  142. package/lib/display-objects/Rect.d.ts +1 -1
  143. package/lib/display-objects/Rect.js +7 -2
  144. package/lib/display-objects/Text.d.ts +9 -4
  145. package/lib/display-objects/Text.js +13 -8
  146. package/lib/dom/Animation.js +1 -1
  147. package/lib/dom/AnimationTimeline.js +1 -2
  148. package/lib/dom/CustomElementRegistry.js +11 -11
  149. package/lib/dom/Document.d.ts +1 -0
  150. package/lib/dom/Document.js +22 -1
  151. package/lib/dom/Element.d.ts +10 -5
  152. package/lib/dom/Element.js +43 -15
  153. package/lib/dom/EventTarget.d.ts +2 -2
  154. package/lib/dom/EventTarget.js +4 -3
  155. package/lib/dom/KeyframeList.js +1 -1
  156. package/lib/dom/MutationEvent.d.ts +15 -0
  157. package/lib/dom/MutationEvent.js +37 -0
  158. package/lib/dom/MutationObserver.d.ts +36 -0
  159. package/lib/dom/MutationObserver.js +424 -0
  160. package/lib/dom/MutationRecord.d.ts +14 -0
  161. package/lib/dom/MutationRecord.js +38 -0
  162. package/lib/dom/Node.d.ts +35 -3
  163. package/lib/dom/Node.js +185 -16
  164. package/lib/dom/index.d.ts +3 -0
  165. package/lib/dom/index.js +39 -0
  166. package/lib/dom/interfaces.d.ts +36 -8
  167. package/lib/dom/interfaces.js +23 -5
  168. package/lib/global-module.d.ts +1 -0
  169. package/lib/global-module.js +12 -8
  170. package/lib/index.d.ts +1 -0
  171. package/lib/index.js +3 -1
  172. package/lib/plugins/CullingPlugin.d.ts +0 -2
  173. package/lib/plugins/CullingPlugin.js +2 -23
  174. package/lib/plugins/DirtyCheckPlugin.js +1 -1
  175. package/lib/plugins/FrustumCullingStrategy.d.ts +1 -0
  176. package/lib/plugins/FrustumCullingStrategy.js +41 -33
  177. package/lib/plugins/PrepareRendererPlugin.js +24 -4
  178. package/lib/property-handlers/aabb.js +18 -19
  179. package/lib/property-handlers/color.js +6 -3
  180. package/lib/property-handlers/dimension.d.ts +15 -3
  181. package/lib/property-handlers/dimension.js +50 -8
  182. package/lib/property-handlers/index.d.ts +3 -0
  183. package/lib/property-handlers/index.js +39 -0
  184. package/lib/property-handlers/inherit.d.ts +6 -0
  185. package/lib/property-handlers/inherit.js +34 -0
  186. package/lib/property-handlers/interfaces.d.ts +2 -2
  187. package/lib/property-handlers/lineDash.d.ts +6 -1
  188. package/lib/property-handlers/lineDash.js +25 -4
  189. package/lib/property-handlers/offsetDistance.js +1 -1
  190. package/lib/property-handlers/text.d.ts +2 -0
  191. package/lib/property-handlers/text.js +10 -0
  192. package/lib/property-handlers/textTransform.d.ts +6 -0
  193. package/lib/property-handlers/textTransform.js +27 -0
  194. package/lib/services/EventService.js +3 -5
  195. package/lib/services/RenderingContext.d.ts +5 -8
  196. package/lib/services/RenderingContext.js +8 -9
  197. package/lib/services/RenderingService.js +1 -7
  198. package/lib/services/SceneGraphSelector.d.ts +3 -2
  199. package/lib/services/SceneGraphSelector.js +10 -3
  200. package/lib/services/SceneGraphService.d.ts +0 -7
  201. package/lib/services/SceneGraphService.js +10 -77
  202. package/lib/services/aabb/CircleUpdater.js +2 -2
  203. package/lib/services/aabb/EllipseUpdater.js +1 -1
  204. package/lib/services/aabb/LineUpdater.js +1 -1
  205. package/lib/services/aabb/PathUpdater.js +1 -1
  206. package/lib/services/aabb/PolylineUpdater.js +2 -2
  207. package/lib/services/aabb/RectUpdater.js +3 -3
  208. package/lib/services/aabb/TextUpdater.js +18 -9
  209. package/lib/services/text/index.js +19 -21
  210. package/lib/types.d.ts +48 -24
  211. package/lib/types.js +56 -35
  212. package/lib/utils/custom-easing.js +1 -1
  213. package/lib/utils/event.js +5 -3
  214. package/lib/utils/index.d.ts +1 -0
  215. package/lib/utils/index.js +13 -0
  216. package/lib/utils/interpolation.d.ts +1 -0
  217. package/lib/utils/interpolation.js +43 -7
  218. package/lib/utils/path.js +10 -10
  219. package/lib/utils/raf.d.ts +1 -1
  220. package/lib/utils/raf.js +0 -2
  221. package/lib/utils/string.d.ts +1 -0
  222. package/lib/utils/string.js +16 -0
  223. package/lib/utils/text.js +3 -3
  224. package/package.json +5 -3
package/lib/types.js CHANGED
@@ -3,41 +3,62 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.SHAPE = exports.LINE_JOIN = exports.LINE_CAP = exports.CanvasConfig = void 0;
7
- var SHAPE;
8
- exports.SHAPE = SHAPE;
9
-
10
- (function (SHAPE) {
11
- SHAPE["Group"] = "group";
12
- SHAPE["Circle"] = "circle";
13
- SHAPE["Ellipse"] = "ellipse";
14
- SHAPE["Image"] = "image";
15
- SHAPE["Rect"] = "rect";
16
- SHAPE["Line"] = "line";
17
- SHAPE["Polyline"] = "polyline";
18
- SHAPE["Polygon"] = "polygon";
19
- SHAPE["Text"] = "text";
20
- SHAPE["Path"] = "path";
21
- SHAPE["HTML"] = "html";
22
- })(SHAPE || (exports.SHAPE = SHAPE = {}));
23
-
24
- var LINE_CAP;
25
- exports.LINE_CAP = LINE_CAP;
26
-
27
- (function (LINE_CAP) {
28
- LINE_CAP["Butt"] = "butt";
29
- LINE_CAP["Round"] = "round";
30
- LINE_CAP["Square"] = "square";
31
- })(LINE_CAP || (exports.LINE_CAP = LINE_CAP = {}));
32
-
33
- var LINE_JOIN;
34
- exports.LINE_JOIN = LINE_JOIN;
35
-
36
- (function (LINE_JOIN) {
37
- LINE_JOIN["Bevel"] = "bevel";
38
- LINE_JOIN["Round"] = "round";
39
- LINE_JOIN["Miter"] = "miter";
40
- })(LINE_JOIN || (exports.LINE_JOIN = LINE_JOIN = {}));
6
+ exports.TextTransform = exports.TextAlign = exports.Shape = exports.LineJoin = exports.LineCap = exports.CanvasConfig = void 0;
7
+ var Shape;
8
+ exports.Shape = Shape;
9
+
10
+ (function (Shape) {
11
+ Shape["GROUP"] = "g";
12
+ Shape["CIRCLE"] = "circle";
13
+ Shape["ELLIPSE"] = "ellipse";
14
+ Shape["IMAGE"] = "image";
15
+ Shape["RECT"] = "rect";
16
+ Shape["LINE"] = "line";
17
+ Shape["POLYLINE"] = "polyline";
18
+ Shape["POLYGON"] = "polygon";
19
+ Shape["TEXT"] = "text";
20
+ Shape["PATH"] = "path";
21
+ Shape["HTML"] = "html";
22
+ })(Shape || (exports.Shape = Shape = {}));
23
+
24
+ var LineCap;
25
+ exports.LineCap = LineCap;
26
+
27
+ (function (LineCap) {
28
+ LineCap["BUTT"] = "butt";
29
+ LineCap["ROUND"] = "round";
30
+ LineCap["SQUARE"] = "square";
31
+ })(LineCap || (exports.LineCap = LineCap = {}));
32
+
33
+ var LineJoin;
34
+ exports.LineJoin = LineJoin;
35
+
36
+ (function (LineJoin) {
37
+ LineJoin["BEVEL"] = "bevel";
38
+ LineJoin["ROUND"] = "round";
39
+ LineJoin["MITER"] = "miter";
40
+ })(LineJoin || (exports.LineJoin = LineJoin = {}));
41
+
42
+ var TextTransform;
43
+ exports.TextTransform = TextTransform;
44
+
45
+ (function (TextTransform) {
46
+ TextTransform["CAPITALIZE"] = "capitalize";
47
+ TextTransform["UPPERCASE"] = "uppercase";
48
+ TextTransform["LOWERCASE"] = "lowercase";
49
+ TextTransform["NONE"] = "none";
50
+ })(TextTransform || (exports.TextTransform = TextTransform = {}));
51
+
52
+ var TextAlign;
53
+ exports.TextAlign = TextAlign;
54
+
55
+ (function (TextAlign) {
56
+ TextAlign["START"] = "start";
57
+ TextAlign["CENTER"] = "center";
58
+ TextAlign["END"] = "end";
59
+ TextAlign["LEFT"] = "left";
60
+ TextAlign["RIGHT"] = "right";
61
+ })(TextAlign || (exports.TextAlign = TextAlign = {}));
41
62
 
42
63
  var CanvasConfig = 'CanvasConfig';
43
64
  exports.CanvasConfig = CanvasConfig;
@@ -14,7 +14,7 @@ var _bezierEasing = require("./bezier-easing");
14
14
  */
15
15
  var convertToDash = function convertToDash(str) {
16
16
  str = str.replace(/([A-Z])/g, function (letter) {
17
- return "-" + letter.toLowerCase();
17
+ return "-".concat(letter.toLowerCase());
18
18
  }); // Remove first dash
19
19
 
20
20
  return str.charAt(0) === '-' ? str.substr(1) : str;
@@ -45,9 +45,11 @@ function normalizeToPointerEvent(event) {
45
45
 
46
46
  if (isTouchEvent(event)) {
47
47
  for (var i = 0; i < event.changedTouches.length; i++) {
48
- var touch = event.changedTouches[i];
49
- if ((0, _util.isUndefined)(touch.button)) touch.button = event.touches.length ? 1 : 0;
50
- if ((0, _util.isUndefined)(touch.buttons)) touch.buttons = event.touches.length ? 1 : 0;
48
+ var touch = event.changedTouches[i]; // use changedTouches instead of touches since touchend has no touches
49
+ // @see https://stackoverflow.com/a/10079076
50
+
51
+ if ((0, _util.isUndefined)(touch.button)) touch.button = event.changedTouches.length ? 1 : 0;
52
+ if ((0, _util.isUndefined)(touch.buttons)) touch.buttons = event.changedTouches.length ? 1 : 0;
51
53
 
52
54
  if ((0, _util.isUndefined)(touch.isPrimary)) {
53
55
  touch.isPrimary = event.touches.length === 1 && event.type === 'touchstart';
@@ -3,3 +3,4 @@ export * from './interpolation';
3
3
  export * from './path';
4
4
  export * from './raf';
5
5
  export * from './text';
6
+ export * from './string';
@@ -67,4 +67,17 @@ Object.keys(_text).forEach(function (key) {
67
67
  return _text[key];
68
68
  }
69
69
  });
70
+ });
71
+
72
+ var _string = require("./string");
73
+
74
+ Object.keys(_string).forEach(function (key) {
75
+ if (key === "default" || key === "__esModule") return;
76
+ if (key in exports && exports[key] === _string[key]) return;
77
+ Object.defineProperty(exports, key, {
78
+ enumerable: true,
79
+ get: function get() {
80
+ return _string[key];
81
+ }
82
+ });
70
83
  });
@@ -1,3 +1,4 @@
1
1
  import type { AnimationEffectTiming } from '../dom';
2
2
  import type { IElement } from '../dom/interfaces';
3
3
  export declare function convertEffectInput(keyframes: ComputedKeyframe[], timing: AnimationEffectTiming, target: IElement | null): (target: IElement, fraction: number) => void;
4
+ export declare function formatAttribute(name: string, value: any): [string, any];
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.convertEffectInput = convertEffectInput;
7
+ exports.formatAttribute = formatAttribute;
7
8
 
8
9
  var _tslib = require("tslib");
9
10
 
@@ -11,10 +12,8 @@ var _globalModule = require("../global-module");
11
12
 
12
13
  var _animation = require("./animation");
13
14
 
14
- // import {
15
- // StylePropertyMergerFactory,
16
- // StylePropertyParserFactory,
17
- // } from '../property-handlers/interfaces';
15
+ var _string = require("./string");
16
+
18
17
  function convertEffectInput(keyframes, timing, target) {
19
18
  var propertySpecificKeyframeGroups = makePropertySpecificKeyframeGroups(keyframes, timing);
20
19
  var interpolations = makeInterpolations(propertySpecificKeyframeGroups, target);
@@ -130,9 +129,9 @@ function propertyInterpolation(property, left, right, target) {
130
129
 
131
130
  if (parser) {
132
131
  // @ts-ignore
133
- parsedLeft = parser(left, target); // @ts-ignore
132
+ parsedLeft = parser(left, target, property); // @ts-ignore
134
133
 
135
- parsedRight = parser(right, target);
134
+ parsedRight = parser(right, target, property);
136
135
  } // merger [left, right, n2string()]
137
136
 
138
137
 
@@ -189,4 +188,41 @@ convertToString) {
189
188
  return function (f) {
190
189
  return convertToString(interpolate(from, to, f));
191
190
  };
192
- };
191
+ };
192
+
193
+ var FORMAT_ATTR_MAP = {
194
+ d: {
195
+ alias: 'path'
196
+ },
197
+ cx: {
198
+ alias: 'x'
199
+ },
200
+ cy: {
201
+ alias: 'y'
202
+ },
203
+ strokeDasharray: {
204
+ alias: 'lineDash'
205
+ },
206
+ strokeWidth: {
207
+ alias: 'lineWidth'
208
+ },
209
+ textAnchor: {
210
+ alias: 'textAlign',
211
+ values: {
212
+ middle: 'center'
213
+ }
214
+ },
215
+ src: {
216
+ alias: 'img'
217
+ }
218
+ };
219
+
220
+ function formatAttribute(name, value) {
221
+ var _a;
222
+
223
+ var attributeName = (0, _string.camelCase)(name);
224
+ var map = FORMAT_ATTR_MAP[attributeName];
225
+ attributeName = (map === null || map === void 0 ? void 0 : map.alias) || attributeName;
226
+ var attributeValue = ((_a = map === null || map === void 0 ? void 0 : map.values) === null || _a === void 0 ? void 0 : _a[value]) || value;
227
+ return [attributeName, attributeValue];
228
+ }
package/lib/utils/path.js CHANGED
@@ -234,7 +234,7 @@ function commandsToPathString(commands, localTransform, anchor, parsedStyle) {
234
234
 
235
235
  _glMatrix.vec3.transformMat4(p, p, localTransform);
236
236
 
237
- path = "" + cur[0] + p[0] + "," + p[1];
237
+ path = "".concat(cur[0]).concat(p[0], ",").concat(p[1]);
238
238
  } else if (cur[0] === 'Z') {
239
239
  path = cur[0];
240
240
  } else if (cur[0] === 'C') {
@@ -250,13 +250,13 @@ function commandsToPathString(commands, localTransform, anchor, parsedStyle) {
250
250
 
251
251
  _glMatrix.vec3.transformMat4(p3, p3, localTransform);
252
252
 
253
- path = "" + cur[0] + p1[0] + "," + p1[1] + "," + p2[0] + "," + p2[1] + "," + p3[0] + "," + p3[1];
253
+ path = "".concat(cur[0]).concat(p1[0], ",").concat(p1[1], ",").concat(p2[0], ",").concat(p2[1], ",").concat(p3[0], ",").concat(p3[1]);
254
254
  } else if (cur[0] === 'A') {
255
255
  var c = _glMatrix.vec3.fromValues(cur[6] - x, cur[7] - y, 0);
256
256
 
257
257
  _glMatrix.vec3.transformMat4(c, c, localTransform);
258
258
 
259
- path = "" + cur[0] + cur[1] + "," + cur[2] + "," + cur[3] + "," + cur[4] + "," + cur[5] + "," + c[0] + "," + c[1];
259
+ path = "".concat(cur[0]).concat(cur[1], ",").concat(cur[2], ",").concat(cur[3], ",").concat(cur[4], ",").concat(cur[5], ",").concat(c[0], ",").concat(c[1]);
260
260
  }
261
261
 
262
262
  return prev += path;
@@ -306,7 +306,7 @@ function convertToPath(object) {
306
306
  var commands = [];
307
307
 
308
308
  switch (object.nodeName) {
309
- case _types.SHAPE.Line:
309
+ case _types.Shape.LINE:
310
310
  var _a = object.parsedStyle,
311
311
  x1 = _a.x1,
312
312
  y1 = _a.y1,
@@ -315,7 +315,7 @@ function convertToPath(object) {
315
315
  commands = lineToCommands(x1, y1, x2, y2);
316
316
  break;
317
317
 
318
- case _types.SHAPE.Circle:
318
+ case _types.Shape.CIRCLE:
319
319
  {
320
320
  var _b = object.parsedStyle,
321
321
  r = _b.rInPixels,
@@ -327,7 +327,7 @@ function convertToPath(object) {
327
327
  break;
328
328
  }
329
329
 
330
- case _types.SHAPE.Ellipse:
330
+ case _types.Shape.ELLIPSE:
331
331
  {
332
332
  var _e = object.parsedStyle,
333
333
  rx = _e.rxInPixels,
@@ -340,13 +340,13 @@ function convertToPath(object) {
340
340
  break;
341
341
  }
342
342
 
343
- case _types.SHAPE.Polyline:
344
- case _types.SHAPE.Polygon:
343
+ case _types.Shape.POLYLINE:
344
+ case _types.Shape.POLYGON:
345
345
  var points = object.parsedStyle.points;
346
346
  commands = polygonToCommands(points.points);
347
347
  break;
348
348
 
349
- case _types.SHAPE.Rect:
349
+ case _types.Shape.RECT:
350
350
  var _h = object.parsedStyle,
351
351
  width = _h.widthInPixels,
352
352
  height = _h.heightInPixels,
@@ -356,7 +356,7 @@ function convertToPath(object) {
356
356
  commands = rectToCommands(width, height, x, y, radius);
357
357
  break;
358
358
 
359
- case _types.SHAPE.Path:
359
+ case _types.Shape.PATH:
360
360
  commands = object.parsedStyle.path.curve;
361
361
  break;
362
362
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * use user-defined raf instead of requestAnimationFrame
3
3
  */
4
- export declare function patch(requestAFPatch: (callback: Function) => number, cancelAFPatch: (id: number) => void): void;
4
+ export declare function patch(requestAFPatch: (callback: (timestamp: number) => void) => number, cancelAFPatch: (id: number) => void): void;
5
5
  export declare const requestAnimationFrame: (callback: Function) => number;
6
6
  export declare const cancelAnimationFrame: (id: number) => void;
package/lib/utils/raf.js CHANGED
@@ -9,8 +9,6 @@ exports.requestAnimationFrame = void 0;
9
9
 
10
10
  var _requestAnimationFramePolyfill = require("request-animation-frame-polyfill");
11
11
 
12
- // import { requestAnimationFrame, cancelAnimationFrame } from 'request-animation-frame-polyfill';
13
- // export { requestAnimationFrame, cancelAnimationFrame };
14
12
  var requestAF = _requestAnimationFramePolyfill.requestAnimationFrame;
15
13
  var cancelAF = _requestAnimationFramePolyfill.cancelAnimationFrame;
16
14
  /**
@@ -0,0 +1 @@
1
+ export declare function camelCase(str?: string): string;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.camelCase = camelCase;
7
+
8
+ function camelCase(str) {
9
+ if (str === void 0) {
10
+ str = '';
11
+ }
12
+
13
+ return str.replace(/-([a-z])/g, function (g) {
14
+ return g[1].toUpperCase();
15
+ });
16
+ }
package/lib/utils/text.js CHANGED
@@ -16,7 +16,7 @@ function toFontString(attributes) {
16
16
  fontVariant = attributes.fontVariant,
17
17
  fontWeight = attributes.fontWeight; // build canvas api font setting from individual components. Convert a numeric this.fontSize to px
18
18
 
19
- var fontSizeString = (0, _util.isNumber)(fontSize) ? fontSize + "px" : fontSize; // Clean-up fontFamily property by quoting each font name
19
+ var fontSizeString = (0, _util.isNumber)(fontSize) ? "".concat(fontSize, "px") : "".concat(fontSize.value).concat(fontSize.unit || 'px'); // Clean-up fontFamily property by quoting each font name
20
20
  // this will support font names with spaces
21
21
  // @ts-ignore
22
22
 
@@ -31,11 +31,11 @@ function toFontString(attributes) {
31
31
  var fontFamily_1 = fontFamilies[i].trim(); // Check if font already contains strings
32
32
 
33
33
  if (!/([\"\'])[^\'\"]+\1/.test(fontFamily_1) && genericFontFamilies.indexOf(fontFamily_1) < 0) {
34
- fontFamily_1 = "\"" + fontFamily_1 + "\"";
34
+ fontFamily_1 = "\"".concat(fontFamily_1, "\"");
35
35
  }
36
36
 
37
37
  fontFamilies[i] = fontFamily_1;
38
38
  }
39
39
 
40
- return fontStyle + " " + fontVariant + " " + fontWeight + " " + fontSizeString + " " + fontFamilies.join(',');
40
+ return "".concat(fontStyle, " ").concat(fontVariant, " ").concat(fontWeight, " ").concat(fontSizeString, " ").concat(fontFamilies.join(','));
41
41
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/g",
3
- "version": "5.0.15",
3
+ "version": "5.0.16",
4
4
  "description": "A core module including ECS and DI container.",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "homepage": "https://github.com/antvis/g#readme",
39
39
  "dependencies": {
40
- "@antv/g-math": "^1.0.12",
40
+ "@antv/g-math": "^1.0.13",
41
41
  "@antv/path-util": "^2.0.14",
42
42
  "@antv/util": "^2.0.13",
43
43
  "@types/offscreencanvas": "^2019.6.4",
@@ -45,12 +45,14 @@
45
45
  "eventemitter3": "^4.0.0",
46
46
  "gl-matrix": "^3.1.0",
47
47
  "mana-syringe": "^0.3.0",
48
+ "reflect-metadata": "^0.1.13",
48
49
  "request-animation-frame-polyfill": "^1.1.2",
50
+ "setimmediate": "^1.0.5",
49
51
  "tapable": "^2.2.1",
50
52
  "tslib": "^2.3.1"
51
53
  },
52
54
  "scripts": {
53
55
  "umd": "webpack"
54
56
  },
55
- "gitHead": "d16e3247e33491b76e38a6deb6cc1ee4f737ab1d"
57
+ "gitHead": "0c7b71ca68a0ada7e50c9eeec3c47f9b7de44f01"
56
58
  }