@antv/g 1.0.0-alpha.20 → 1.0.0-alpha.24

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 (293) hide show
  1. package/es/Canvas.d.ts +40 -18
  2. package/es/Canvas.js +121 -65
  3. package/es/DisplayObjectPool.d.ts +2 -1
  4. package/es/DisplayObjectPool.js +4 -0
  5. package/{lib → es/camera}/Camera.d.ts +6 -3
  6. package/es/{Camera.js → camera/Camera.js} +22 -16
  7. package/es/{Landmark.d.ts → camera/Landmark.d.ts} +2 -2
  8. package/es/{Landmark.js → camera/Landmark.js} +1 -1
  9. package/es/camera/index.d.ts +2 -0
  10. package/es/camera/index.js +2 -0
  11. package/es/components/Cullable.js +1 -1
  12. package/es/components/Geometry.d.ts +8 -1
  13. package/es/components/Renderable.d.ts +9 -8
  14. package/es/components/Renderable.js +2 -6
  15. package/es/components/Sortable.d.ts +6 -2
  16. package/es/display-objects/Circle.d.ts +2 -3
  17. package/es/display-objects/Circle.js +2 -5
  18. package/es/{CustomElement.d.ts → display-objects/CustomElement.d.ts} +1 -1
  19. package/es/{CustomElement.js → display-objects/CustomElement.js} +22 -12
  20. package/{lib → es/display-objects}/DisplayObject.d.ts +136 -141
  21. package/es/{DisplayObject.js → display-objects/DisplayObject.js} +408 -292
  22. package/es/display-objects/Ellipse.d.ts +2 -3
  23. package/es/display-objects/Ellipse.js +2 -5
  24. package/es/display-objects/Group.d.ts +2 -1
  25. package/es/display-objects/Group.js +13 -5
  26. package/es/display-objects/HTML.d.ts +2 -2
  27. package/es/display-objects/HTML.js +4 -7
  28. package/es/display-objects/Image.d.ts +2 -2
  29. package/es/display-objects/Image.js +2 -6
  30. package/es/display-objects/Line.d.ts +2 -2
  31. package/es/display-objects/Line.js +8 -8
  32. package/es/display-objects/Path.d.ts +3 -2
  33. package/es/display-objects/Path.js +8 -8
  34. package/es/display-objects/Polygon.d.ts +2 -2
  35. package/es/display-objects/Polygon.js +2 -6
  36. package/es/display-objects/Polyline.d.ts +2 -2
  37. package/es/display-objects/Polyline.js +8 -8
  38. package/es/display-objects/Rect.d.ts +2 -2
  39. package/es/display-objects/Rect.js +2 -6
  40. package/es/display-objects/Text.d.ts +2 -3
  41. package/es/display-objects/Text.js +8 -7
  42. package/es/display-objects/index.d.ts +2 -0
  43. package/es/display-objects/index.js +2 -0
  44. package/es/{Animation.d.ts → dom/Animation.d.ts} +3 -3
  45. package/es/{Animation.js → dom/Animation.js} +2 -3
  46. package/{lib → es/dom}/AnimationEffectTiming.d.ts +2 -0
  47. package/es/{AnimationEffectTiming.js → dom/AnimationEffectTiming.js} +3 -2
  48. package/es/{AnimationEvent.d.ts → dom/AnimationEvent.d.ts} +3 -2
  49. package/es/{AnimationEvent.js → dom/AnimationEvent.js} +1 -1
  50. package/es/{Timeline.d.ts → dom/AnimationTimeline.d.ts} +1 -1
  51. package/es/{Timeline.js → dom/AnimationTimeline.js} +1 -1
  52. package/es/dom/CustomElementRegistry.d.ts +15 -0
  53. package/es/dom/CustomElementRegistry.js +40 -0
  54. package/{lib → es/dom}/CustomEvent.d.ts +1 -1
  55. package/es/{CustomEvent.js → dom/CustomEvent.js} +1 -1
  56. package/es/dom/Document.d.ts +36 -17
  57. package/es/dom/Document.js +98 -14
  58. package/es/dom/Element.d.ts +71 -92
  59. package/es/dom/Element.js +179 -195
  60. package/es/dom/EventTarget.d.ts +11 -6
  61. package/es/dom/EventTarget.js +12 -4
  62. package/es/dom/FederatedEvent.d.ts +15 -7
  63. package/es/dom/FederatedEvent.js +33 -0
  64. package/es/dom/FederatedMouseEvent.d.ts +1 -1
  65. package/es/{KeyframeEffect.d.ts → dom/KeyframeEffect.d.ts} +16 -5
  66. package/es/{KeyframeEffect.js → dom/KeyframeEffect.js} +50 -4
  67. package/es/{KeyframeList.d.ts → dom/KeyframeList.d.ts} +1 -1
  68. package/es/{KeyframeList.js → dom/KeyframeList.js} +0 -0
  69. package/es/dom/Node.d.ts +38 -23
  70. package/es/dom/Node.js +37 -33
  71. package/es/dom/index.d.ts +15 -2
  72. package/es/dom/index.js +16 -3
  73. package/es/dom/interfaces.d.ts +301 -0
  74. package/es/dom/interfaces.js +1 -0
  75. package/es/global-module.d.ts +0 -2
  76. package/es/global-module.js +31 -29
  77. package/es/index.d.ts +7 -14
  78. package/es/index.js +8 -15
  79. package/es/plugins/CullingPlugin.d.ts +2 -2
  80. package/es/plugins/CullingPlugin.js +13 -16
  81. package/es/plugins/DirtyCheckPlugin.d.ts +1 -1
  82. package/es/plugins/DirtyCheckPlugin.js +8 -7
  83. package/es/plugins/EventPlugin.js +52 -31
  84. package/es/plugins/FrustumCullingStrategy.d.ts +1 -1
  85. package/es/plugins/FrustumCullingStrategy.js +5 -4
  86. package/es/plugins/PrepareRendererPlugin.d.ts +0 -1
  87. package/es/plugins/PrepareRendererPlugin.js +42 -38
  88. package/es/property-handlers/aabb.d.ts +2 -3
  89. package/es/property-handlers/aabb.js +29 -21
  90. package/es/property-handlers/anchor.d.ts +3 -0
  91. package/es/property-handlers/anchor.js +21 -0
  92. package/es/property-handlers/clipPath.d.ts +1 -1
  93. package/es/property-handlers/clipPath.js +3 -4
  94. package/es/property-handlers/color.d.ts +1 -1
  95. package/es/property-handlers/dimension.d.ts +1 -1
  96. package/es/property-handlers/dimension.js +6 -9
  97. package/es/property-handlers/filter.d.ts +1 -1
  98. package/es/property-handlers/index.d.ts +5 -4
  99. package/es/property-handlers/index.js +1 -0
  100. package/es/property-handlers/localPosition.d.ts +1 -1
  101. package/es/property-handlers/localPosition.js +1 -6
  102. package/es/property-handlers/offsetDistance.d.ts +1 -1
  103. package/es/property-handlers/offsetPath.d.ts +1 -1
  104. package/es/property-handlers/origin.d.ts +1 -1
  105. package/es/property-handlers/origin.js +9 -2
  106. package/es/property-handlers/path.d.ts +2 -2
  107. package/es/property-handlers/path.js +8 -4
  108. package/es/property-handlers/points.d.ts +1 -1
  109. package/es/property-handlers/transform.d.ts +1 -1
  110. package/es/property-handlers/zIndex.d.ts +1 -1
  111. package/es/services/ContextService.d.ts +3 -2
  112. package/es/services/EventService.d.ts +18 -13
  113. package/es/services/EventService.js +604 -384
  114. package/es/services/RenderingContext.d.ts +1 -1
  115. package/es/services/RenderingService.d.ts +23 -29
  116. package/es/services/RenderingService.js +63 -54
  117. package/es/services/SceneGraphSelector.d.ts +7 -7
  118. package/es/services/SceneGraphSelector.js +10 -6
  119. package/es/services/SceneGraphService.d.ts +73 -78
  120. package/es/services/SceneGraphService.js +165 -78
  121. package/es/services/aabb/PathUpdater.d.ts +1 -1
  122. package/es/services/aabb/RectUpdater.d.ts +2 -2
  123. package/es/services/aabb/interfaces.d.ts +1 -1
  124. package/es/shapes/Point.d.ts +4 -0
  125. package/es/shapes/Polygon.d.ts +9 -0
  126. package/es/shapes/Polygon.js +62 -0
  127. package/es/shapes/index.d.ts +1 -0
  128. package/es/shapes/index.js +2 -1
  129. package/es/types.d.ts +18 -6
  130. package/es/utils/animation.d.ts +1 -2
  131. package/es/utils/animation.js +5 -10
  132. package/es/utils/canvas.d.ts +1 -1
  133. package/es/utils/custom-easing.d.ts +3 -2
  134. package/es/utils/custom-easing.js +12 -6
  135. package/es/utils/event.js +1 -1
  136. package/es/utils/index.d.ts +1 -0
  137. package/es/utils/index.js +2 -1
  138. package/es/utils/interpolation.d.ts +3 -4
  139. package/es/utils/interpolation.js +0 -16
  140. package/es/utils/path.d.ts +2 -2
  141. package/lib/Canvas.d.ts +40 -18
  142. package/lib/Canvas.js +131 -74
  143. package/lib/DisplayObjectPool.d.ts +2 -1
  144. package/lib/DisplayObjectPool.js +4 -0
  145. package/{es → lib/camera}/Camera.d.ts +6 -3
  146. package/lib/{Camera.js → camera/Camera.js} +25 -20
  147. package/lib/{Landmark.d.ts → camera/Landmark.d.ts} +2 -2
  148. package/lib/{Landmark.js → camera/Landmark.js} +2 -3
  149. package/lib/camera/index.d.ts +2 -0
  150. package/lib/camera/index.js +31 -0
  151. package/lib/components/Cullable.js +1 -1
  152. package/lib/components/Geometry.d.ts +8 -1
  153. package/lib/components/Renderable.d.ts +9 -8
  154. package/lib/components/Renderable.js +2 -6
  155. package/lib/components/Sortable.d.ts +6 -2
  156. package/lib/display-objects/Circle.d.ts +2 -3
  157. package/lib/display-objects/Circle.js +3 -6
  158. package/lib/{CustomElement.d.ts → display-objects/CustomElement.d.ts} +1 -1
  159. package/lib/{CustomElement.js → display-objects/CustomElement.js} +22 -12
  160. package/{es → lib/display-objects}/DisplayObject.d.ts +136 -141
  161. package/lib/{DisplayObject.js → display-objects/DisplayObject.js} +418 -299
  162. package/lib/display-objects/Ellipse.d.ts +2 -3
  163. package/lib/display-objects/Ellipse.js +3 -6
  164. package/lib/display-objects/Group.d.ts +2 -1
  165. package/lib/display-objects/Group.js +12 -4
  166. package/lib/display-objects/HTML.d.ts +2 -2
  167. package/lib/display-objects/HTML.js +4 -7
  168. package/lib/display-objects/Image.d.ts +2 -2
  169. package/lib/display-objects/Image.js +2 -6
  170. package/lib/display-objects/Line.d.ts +2 -2
  171. package/lib/display-objects/Line.js +8 -8
  172. package/lib/display-objects/Path.d.ts +3 -2
  173. package/lib/display-objects/Path.js +8 -8
  174. package/lib/display-objects/Polygon.d.ts +2 -2
  175. package/lib/display-objects/Polygon.js +2 -6
  176. package/lib/display-objects/Polyline.d.ts +2 -2
  177. package/lib/display-objects/Polyline.js +8 -8
  178. package/lib/display-objects/Rect.d.ts +2 -2
  179. package/lib/display-objects/Rect.js +2 -6
  180. package/lib/display-objects/Text.d.ts +2 -3
  181. package/lib/display-objects/Text.js +9 -8
  182. package/lib/display-objects/index.d.ts +2 -0
  183. package/lib/display-objects/index.js +26 -0
  184. package/lib/{Animation.d.ts → dom/Animation.d.ts} +3 -3
  185. package/lib/{Animation.js → dom/Animation.js} +2 -3
  186. package/{es → lib/dom}/AnimationEffectTiming.d.ts +2 -0
  187. package/lib/{AnimationEffectTiming.js → dom/AnimationEffectTiming.js} +3 -3
  188. package/lib/{AnimationEvent.d.ts → dom/AnimationEvent.d.ts} +3 -2
  189. package/lib/{AnimationEvent.js → dom/AnimationEvent.js} +1 -1
  190. package/lib/{Timeline.d.ts → dom/AnimationTimeline.d.ts} +1 -1
  191. package/lib/{Timeline.js → dom/AnimationTimeline.js} +1 -1
  192. package/lib/dom/CustomElementRegistry.d.ts +15 -0
  193. package/lib/dom/CustomElementRegistry.js +48 -0
  194. package/{es → lib/dom}/CustomEvent.d.ts +1 -1
  195. package/lib/{CustomEvent.js → dom/CustomEvent.js} +1 -1
  196. package/lib/dom/Document.d.ts +36 -17
  197. package/lib/dom/Document.js +99 -15
  198. package/lib/dom/Element.d.ts +71 -92
  199. package/lib/dom/Element.js +180 -198
  200. package/lib/dom/EventTarget.d.ts +11 -6
  201. package/lib/dom/EventTarget.js +20 -10
  202. package/lib/dom/FederatedEvent.d.ts +15 -7
  203. package/lib/dom/FederatedEvent.js +33 -0
  204. package/lib/dom/FederatedMouseEvent.d.ts +1 -1
  205. package/lib/{KeyframeEffect.d.ts → dom/KeyframeEffect.d.ts} +16 -5
  206. package/lib/{KeyframeEffect.js → dom/KeyframeEffect.js} +50 -4
  207. package/lib/{KeyframeList.d.ts → dom/KeyframeList.d.ts} +1 -1
  208. package/lib/{KeyframeList.js → dom/KeyframeList.js} +0 -0
  209. package/lib/dom/Node.d.ts +38 -23
  210. package/lib/dom/Node.js +37 -33
  211. package/lib/dom/index.d.ts +15 -2
  212. package/lib/dom/index.js +177 -8
  213. package/lib/dom/interfaces.d.ts +301 -0
  214. package/lib/dom/interfaces.js +5 -0
  215. package/lib/global-module.d.ts +0 -2
  216. package/lib/global-module.js +30 -30
  217. package/lib/index.d.ts +7 -14
  218. package/lib/index.js +44 -135
  219. package/lib/plugins/CullingPlugin.d.ts +2 -2
  220. package/lib/plugins/CullingPlugin.js +14 -16
  221. package/lib/plugins/DirtyCheckPlugin.d.ts +1 -1
  222. package/lib/plugins/DirtyCheckPlugin.js +9 -7
  223. package/lib/plugins/EventPlugin.js +52 -30
  224. package/lib/plugins/FrustumCullingStrategy.d.ts +1 -1
  225. package/lib/plugins/FrustumCullingStrategy.js +5 -4
  226. package/lib/plugins/PrepareRendererPlugin.d.ts +0 -1
  227. package/lib/plugins/PrepareRendererPlugin.js +41 -37
  228. package/lib/property-handlers/aabb.d.ts +2 -3
  229. package/lib/property-handlers/aabb.js +28 -22
  230. package/lib/property-handlers/anchor.d.ts +3 -0
  231. package/lib/property-handlers/anchor.js +34 -0
  232. package/lib/property-handlers/clipPath.d.ts +1 -1
  233. package/lib/property-handlers/clipPath.js +3 -4
  234. package/lib/property-handlers/color.d.ts +1 -1
  235. package/lib/property-handlers/dimension.d.ts +1 -1
  236. package/lib/property-handlers/dimension.js +6 -9
  237. package/lib/property-handlers/filter.d.ts +1 -1
  238. package/lib/property-handlers/index.d.ts +5 -4
  239. package/lib/property-handlers/index.js +14 -0
  240. package/lib/property-handlers/localPosition.d.ts +1 -1
  241. package/lib/property-handlers/localPosition.js +1 -7
  242. package/lib/property-handlers/offsetDistance.d.ts +1 -1
  243. package/lib/property-handlers/offsetPath.d.ts +1 -1
  244. package/lib/property-handlers/origin.d.ts +1 -1
  245. package/lib/property-handlers/origin.js +10 -2
  246. package/lib/property-handlers/path.d.ts +2 -2
  247. package/lib/property-handlers/path.js +8 -4
  248. package/lib/property-handlers/points.d.ts +1 -1
  249. package/lib/property-handlers/transform.d.ts +1 -1
  250. package/lib/property-handlers/zIndex.d.ts +1 -1
  251. package/lib/services/ContextService.d.ts +3 -2
  252. package/lib/services/EventService.d.ts +18 -13
  253. package/lib/services/EventService.js +616 -385
  254. package/lib/services/RenderingContext.d.ts +1 -1
  255. package/lib/services/RenderingService.d.ts +23 -29
  256. package/lib/services/RenderingService.js +66 -56
  257. package/lib/services/SceneGraphSelector.d.ts +7 -7
  258. package/lib/services/SceneGraphSelector.js +10 -6
  259. package/lib/services/SceneGraphService.d.ts +73 -78
  260. package/lib/services/SceneGraphService.js +166 -79
  261. package/lib/services/aabb/PathUpdater.d.ts +1 -1
  262. package/lib/services/aabb/RectUpdater.d.ts +2 -2
  263. package/lib/services/aabb/interfaces.d.ts +1 -1
  264. package/lib/shapes/Point.d.ts +4 -0
  265. package/lib/shapes/Polygon.d.ts +9 -0
  266. package/lib/shapes/Polygon.js +69 -0
  267. package/lib/shapes/index.d.ts +1 -0
  268. package/lib/shapes/index.js +13 -0
  269. package/lib/types.d.ts +18 -6
  270. package/lib/utils/animation.d.ts +1 -2
  271. package/lib/utils/animation.js +8 -16
  272. package/lib/utils/canvas.d.ts +1 -1
  273. package/lib/utils/custom-easing.d.ts +3 -2
  274. package/lib/utils/custom-easing.js +16 -8
  275. package/lib/utils/event.js +1 -1
  276. package/lib/utils/index.d.ts +1 -0
  277. package/lib/utils/index.js +13 -0
  278. package/lib/utils/interpolation.d.ts +3 -4
  279. package/lib/utils/interpolation.js +0 -17
  280. package/lib/utils/path.d.ts +2 -2
  281. package/package.json +6 -6
  282. package/es/Batch.d.ts +0 -25
  283. package/es/Batch.js +0 -82
  284. package/es/shapes-type.d.ts +0 -175
  285. package/es/shapes-type.js +0 -18
  286. package/es/utils/matrix-decompose.d.ts +0 -3
  287. package/es/utils/matrix-decompose.js +0 -404
  288. package/lib/Batch.d.ts +0 -25
  289. package/lib/Batch.js +0 -91
  290. package/lib/shapes-type.d.ts +0 -175
  291. package/lib/shapes-type.js +0 -41
  292. package/lib/utils/matrix-decompose.d.ts +0 -3
  293. package/lib/utils/matrix-decompose.js +0 -414
@@ -9,11 +9,11 @@ exports.normalizeTimingInput = normalizeTimingInput;
9
9
  exports.parseEasingFunction = parseEasingFunction;
10
10
  exports.calculateActiveDuration = calculateActiveDuration;
11
11
  exports.calculateIterationProgress = calculateIterationProgress;
12
- exports.convertToDash = exports.getEase = exports.EasingKeys = exports.EASINGS = exports.linear = void 0;
12
+ exports.getEase = exports.EasingKeys = exports.EASINGS = exports.linear = void 0;
13
13
 
14
14
  var _tslib = require("tslib");
15
15
 
16
- var _AnimationEffectTiming = require("../AnimationEffectTiming");
16
+ var _dom = require("../dom");
17
17
 
18
18
  var _customEasing = require("./custom-easing");
19
19
 
@@ -29,7 +29,7 @@ var linear = function linear(x) {
29
29
  exports.linear = linear;
30
30
 
31
31
  function makeTiming(timingInput, forGroup) {
32
- var timing = new _AnimationEffectTiming.AnimationEffectTiming();
32
+ var timing = new _dom.AnimationEffectTiming();
33
33
 
34
34
  if (forGroup) {
35
35
  timing.fill = 'both';
@@ -271,7 +271,9 @@ function calculateIterationProgress(activeDuration, localTime, timing) {
271
271
  var overallProgress = calculateOverallProgress(duration, phase, timing.iterations, activeTime, timing.iterationStart);
272
272
  var simpleIterationProgress = calculateSimpleIterationProgress(overallProgress, timing.iterationStart, phase, timing.iterations, activeTime, duration);
273
273
  var currentIteration = calculateCurrentIteration(phase, timing.iterations, simpleIterationProgress, overallProgress);
274
- var directedProgress = calculateDirectedProgress(timing.direction, currentIteration, simpleIterationProgress); // https://drafts.csswg.org/web-animations/#calculating-the-transformed-progress
274
+ var directedProgress = calculateDirectedProgress(timing.direction, currentIteration, simpleIterationProgress);
275
+ timing.currentIteration = currentIteration;
276
+ timing.progress = directedProgress; // https://drafts.csswg.org/web-animations/#calculating-the-transformed-progress
275
277
  // https://drafts.csswg.org/web-animations/#calculating-the-iteration-progress
276
278
 
277
279
  return timing.easingFunction(directedProgress);
@@ -333,18 +335,8 @@ var getEase = function getEase(ease) {
333
335
  } // Convert camelCase strings into dashed strings, then Remove the "ease-" keyword
334
336
 
335
337
 
336
- var search = convertToDash(ease).replace(/^ease-/, '');
338
+ var search = (0, _customEasing.convertToDash)(ease).replace(/^ease-/, '');
337
339
  return EASINGS[search] || ease;
338
340
  };
339
341
 
340
- exports.getEase = getEase;
341
-
342
- var convertToDash = function convertToDash(str) {
343
- str = str.replace(/([A-Z])/g, function (letter) {
344
- return "-" + letter.toLowerCase();
345
- }); // Remove first dash
346
-
347
- return str.charAt(0) === '-' ? str.substr(1) : str;
348
- };
349
-
350
- exports.convertToDash = convertToDash;
342
+ exports.getEase = getEase;
@@ -1,4 +1,4 @@
1
- import { Canvas } from '../Canvas';
1
+ import type { Canvas } from '../Canvas';
2
2
  /**
3
3
  * destroy existed canvas with the same id
4
4
  */
@@ -1,3 +1,4 @@
1
+ export declare const convertToDash: (str: string) => string;
1
2
  export declare const limit: (value: number, min: number, max: number) => number;
2
3
  /**
3
4
  * The format to use when defining custom easing functions
@@ -69,6 +70,6 @@ export declare const getEasingFunction: (ease: string) => TypeEasingFunction;
69
70
  */
70
71
  export declare const registerEasingFunction: (key: string, fn: TypeEasingFunction) => void;
71
72
  /**
72
- * Allows you to register multiple new easing functions
73
- */
73
+ * Allows you to register multiple new easing functions
74
+ */
74
75
  export declare const registerEasingFunctions: (...obj: Array<typeof EasingFunctions>) => void;
@@ -3,17 +3,25 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.registerEasingFunctions = exports.registerEasingFunction = exports.getEasingFunction = exports.complexEasingSyntax = exports.EasingFunctions = exports.EaseOutIn = exports.EaseInOut = exports.EaseOut = exports.easein = exports.Bezier = exports.Steps = exports.getEasingDuration = exports.parseEasingParameters = exports.INTINITE_LOOP_LIMIT = exports.EasingDurationCache = exports.Spring = exports.Elastic = exports.Bounce = exports.Back = exports.Circ = exports.Sine = exports.Expo = exports.Quint = exports.Quart = exports.Cubic = exports.Quad = exports.limit = void 0;
6
+ exports.registerEasingFunctions = exports.registerEasingFunction = exports.getEasingFunction = exports.complexEasingSyntax = exports.EasingFunctions = exports.EaseOutIn = exports.EaseInOut = exports.EaseOut = exports.easein = exports.Bezier = exports.Steps = exports.getEasingDuration = exports.parseEasingParameters = exports.INTINITE_LOOP_LIMIT = exports.EasingDurationCache = exports.Spring = exports.Elastic = exports.Bounce = exports.Back = exports.Circ = exports.Sine = exports.Expo = exports.Quint = exports.Quart = exports.Cubic = exports.Quad = exports.limit = exports.convertToDash = void 0;
7
7
 
8
8
  var _tslib = require("tslib");
9
9
 
10
10
  var _bezierEasing = require("./bezier-easing");
11
11
 
12
- var _animation = require("./animation");
13
-
14
12
  /**
15
13
  * ported from https://github.com/okikio/native/blob/master/packages/animate/src/custom-easing.ts
16
14
  */
15
+ var convertToDash = function convertToDash(str) {
16
+ str = str.replace(/([A-Z])/g, function (letter) {
17
+ return "-" + letter.toLowerCase();
18
+ }); // Remove first dash
19
+
20
+ return str.charAt(0) === '-' ? str.substr(1) : str;
21
+ };
22
+
23
+ exports.convertToDash = convertToDash;
24
+
17
25
  var limit = function limit(value, min, max) {
18
26
  return Math.min(Math.max(value, min), max);
19
27
  };
@@ -156,7 +164,7 @@ exports.INTINITE_LOOP_LIMIT = INTINITE_LOOP_LIMIT;
156
164
 
157
165
  var parseEasingParameters = function parseEasingParameters(str) {
158
166
  var match = /(\(|\s)([^)]+)\)?/.exec(str);
159
- return match ? match[2].split(",").map(function (value) {
167
+ return match ? match[2].split(',').map(function (value) {
160
168
  var num = parseFloat(value);
161
169
  return !Number.isNaN(num) ? num : value.trim();
162
170
  }) : [];
@@ -363,8 +371,8 @@ var EasingFunctions = {
363
371
  exports.EasingFunctions = EasingFunctions;
364
372
 
365
373
  var complexEasingSyntax = function complexEasingSyntax(ease) {
366
- return (0, _animation.convertToDash)(ease).replace(/^ease-/, "") // Remove the "ease-" keyword
367
- .replace(/(\(|\s).+/, "") // Remove the function brackets and parameters
374
+ return convertToDash(ease).replace(/^ease-/, '') // Remove the "ease-" keyword
375
+ .replace(/(\(|\s).+/, '') // Remove the function brackets and parameters
368
376
  .toLowerCase().trim();
369
377
  };
370
378
  /** Re-maps a number from one range to another. Numbers outside the range are not clamped to 0 and 1, because out-of-range values are often intentional and useful. */
@@ -388,8 +396,8 @@ var registerEasingFunction = function registerEasingFunction(key, fn) {
388
396
  Object.assign(EasingFunctions, (_a = {}, _a[key] = fn, _a));
389
397
  };
390
398
  /**
391
- * Allows you to register multiple new easing functions
392
- */
399
+ * Allows you to register multiple new easing functions
400
+ */
393
401
 
394
402
 
395
403
  exports.registerEasingFunction = registerEasingFunction;
@@ -12,7 +12,7 @@ var _util = require("@antv/util");
12
12
 
13
13
  // use `self` instead of `window`, account for non-window contexts, such as in Web Workers
14
14
  // @see https://developer.mozilla.org/en-US/docs/Web/API/Window/self
15
- var supportsTouchEvents = ('ontouchstart' in self);
15
+ var supportsTouchEvents = !!self.TouchEvent;
16
16
  exports.supportsTouchEvents = supportsTouchEvents;
17
17
  var supportsPointerEvents = !!self.PointerEvent;
18
18
  exports.supportsPointerEvents = supportsPointerEvents;
@@ -2,3 +2,4 @@ export * from './math';
2
2
  export * from './interpolation';
3
3
  export * from './path';
4
4
  export * from './raf';
5
+ export * from './text';
@@ -54,4 +54,17 @@ Object.keys(_raf).forEach(function (key) {
54
54
  return _raf[key];
55
55
  }
56
56
  });
57
+ });
58
+
59
+ var _text = require("./text");
60
+
61
+ Object.keys(_text).forEach(function (key) {
62
+ if (key === "default" || key === "__esModule") return;
63
+ if (key in exports && exports[key] === _text[key]) return;
64
+ Object.defineProperty(exports, key, {
65
+ enumerable: true,
66
+ get: function get() {
67
+ return _text[key];
68
+ }
69
+ });
57
70
  });
@@ -1,4 +1,3 @@
1
- import { AnimationEffectTiming } from '../AnimationEffectTiming';
2
- import { DisplayObject } from '../DisplayObject';
3
- export declare function addPropertiesHandler(parser: Function, merger: Function, properties: string[]): void;
4
- export declare function convertEffectInput(keyframes: ComputedKeyframe[], timing: AnimationEffectTiming, target: DisplayObject | null): (target: DisplayObject, fraction: number) => void;
1
+ import type { AnimationEffectTiming } from '../dom';
2
+ import type { IElement } from '../dom/interfaces';
3
+ export declare function convertEffectInput(keyframes: ComputedKeyframe[], timing: AnimationEffectTiming, target: IElement | null): (target: IElement, fraction: number) => void;
@@ -3,7 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.addPropertiesHandler = addPropertiesHandler;
7
6
  exports.convertEffectInput = convertEffectInput;
8
7
 
9
8
  var _tslib = require("tslib");
@@ -14,22 +13,6 @@ var _propertyHandlers = require("../property-handlers");
14
13
 
15
14
  var _animation = require("./animation");
16
15
 
17
- /**
18
- * handlers for valid properties
19
- */
20
- var propertyHandlers = {};
21
-
22
- function addPropertyHandler(parser, merger, property) {
23
- propertyHandlers[property] = propertyHandlers[property] || [];
24
- propertyHandlers[property].push([parser, merger]);
25
- }
26
-
27
- function addPropertiesHandler(parser, merger, properties) {
28
- for (var i = 0; i < properties.length; i++) {
29
- addPropertyHandler(parser, merger, toCamelCase(properties[i]));
30
- }
31
- }
32
-
33
16
  function convertEffectInput(keyframes, timing, target) {
34
17
  var propertySpecificKeyframeGroups = makePropertySpecificKeyframeGroups(keyframes, timing);
35
18
  var interpolations = makeInterpolations(propertySpecificKeyframeGroups, target);
@@ -1,11 +1,11 @@
1
- import type { DisplayObject } from '../DisplayObject';
1
+ import type { DisplayObject } from '../display-objects/DisplayObject';
2
2
  import { PathCommand } from '../types';
3
3
  export declare function equalizeSegments(path1: PathCommand[], path2: PathCommand[], TL?: number): PathCommand[][];
4
4
  export declare function getDrawDirection(pathArray: PathCommand[]): boolean;
5
5
  export declare function getPathArea(pathArray: PathCommand[]): number;
6
6
  export declare function reverseCurve(pathArray: PathCommand[]): PathCommand[];
7
7
  export declare function clonePath(pathArray: PathCommand[]): PathCommand[];
8
- export declare function getRotatedCurve(a: PathCommand[], b: PathCommand[]): (string[] | ["a" | "A", number, number, number, number, number, number, number] | ["c" | "C", number, number, number, number, number, number] | ["o" | "O", number, number] | ["h" | "H", number] | ["l" | "L", number, number] | ["m" | "M", number, number] | ["r" | "R", number, number, number, number] | ["q" | "Q", number, number, number, number] | ["s" | "S", number, number, number, number, number, number, number] | ["T" | "t", number, number] | ["v" | "V", number] | ["u" | "U", number, number, number])[];
8
+ export declare function getRotatedCurve(a: PathCommand[], b: PathCommand[]): (string[] | ["a" | "A", number, number, number, number, number, number, number] | ["C" | "c", number, number, number, number, number, number] | ["o" | "O", number, number] | ["h" | "H", number] | ["l" | "L", number, number] | ["m" | "M", number, number] | ["r" | "R", number, number, number, number] | ["q" | "Q", number, number, number, number] | ["s" | "S", number, number, number, number, number, number, number] | ["t" | "T", number, number] | ["v" | "V", number] | ["u" | "U", number, number, number])[];
9
9
  /**
10
10
  * convert object to path, should account for:
11
11
  * * transform & origin
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/g",
3
- "version": "1.0.0-alpha.20",
3
+ "version": "1.0.0-alpha.24",
4
4
  "description": "A core module including ECS and DI container.",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -37,16 +37,16 @@
37
37
  },
38
38
  "homepage": "https://github.com/antvis/g#readme",
39
39
  "dependencies": {
40
- "@antv/g-ecs": "^1.0.0-alpha.7",
40
+ "@antv/g-ecs": "^1.0.0-alpha.8",
41
41
  "@antv/g-math": "^1.0.0-alpha.5",
42
- "@antv/path-util": "^2.0.12",
42
+ "@antv/path-util": "^2.0.14",
43
43
  "@antv/util": "^2.0.13",
44
+ "async-eventemitter": "0.2.4",
44
45
  "d3-color": "^1.4.0",
45
46
  "eventemitter3": "^4.0.0",
46
47
  "gl-matrix": "^3.1.0",
47
48
  "inversify": "^5.0.1",
48
- "reflect-metadata": "^0.1.13",
49
- "tapable": "^2.2.0"
49
+ "reflect-metadata": "^0.1.13"
50
50
  },
51
- "gitHead": "9dd75b27ba6bf0c42256b1971cde602a765e7f23"
51
+ "gitHead": "fb9ebf362059d1f55a855856f05d42514a72c922"
52
52
  }
package/es/Batch.d.ts DELETED
@@ -1,25 +0,0 @@
1
- import { CustomElement } from './CustomElement';
2
- import { DisplayObjectConfig } from './DisplayObject';
3
- import { BaseStyleProps } from './types';
4
- export interface BatchStyleProps extends BaseStyleProps {
5
- instances: this[];
6
- }
7
- /**
8
- * A container for multiple display objects with the same `style`,
9
- * eg. 1000 Circles with the same stroke color, but their position, radius can be different
10
- *
11
- * @see https://developer.playcanvas.com/en/user-manual/optimization/batching/
12
- */
13
- export declare class Batch extends CustomElement<BatchStyleProps> {
14
- static tag: string;
15
- private batchType?;
16
- /**
17
- * need to reconstruct batch
18
- */
19
- dirty: boolean;
20
- constructor({ style, ...rest }: DisplayObjectConfig<BatchStyleProps>);
21
- getBatchType(): string;
22
- appendChild(child: this): this;
23
- removeChild(child: this): this;
24
- attributeChangedCallback(name: string, value: any): void;
25
- }
package/es/Batch.js DELETED
@@ -1,82 +0,0 @@
1
- import { __assign, __extends, __rest } from "tslib";
2
- import { Renderable, Cullable } from './components';
3
- import { CustomElement } from './CustomElement';
4
- /**
5
- * A container for multiple display objects with the same `style`,
6
- * eg. 1000 Circles with the same stroke color, but their position, radius can be different
7
- *
8
- * @see https://developer.playcanvas.com/en/user-manual/optimization/batching/
9
- */
10
-
11
- var Batch = function (_super) {
12
- __extends(Batch, _super);
13
-
14
- function Batch(_a) {
15
- var _b = _a.style,
16
- style = _b === void 0 ? {
17
- instances: []
18
- } : _b,
19
- rest = __rest(_a, ["style"]);
20
-
21
- var _this = _super.call(this, __assign({
22
- // @ts-ignore
23
- type: Batch.tag,
24
- style: style
25
- }, rest)) || this;
26
- /**
27
- * need to reconstruct batch
28
- */
29
-
30
-
31
- _this.dirty = true;
32
- _this.getEntity().getComponent(Cullable).enable = false;
33
-
34
- if (style.instances) {
35
- style.instances.forEach(function (instance) {
36
- // @ts-ignore
37
- _this.appendChild(instance);
38
- });
39
- }
40
-
41
- return _this;
42
- }
43
-
44
- Batch.prototype.getBatchType = function () {
45
- return this.batchType;
46
- };
47
-
48
- Batch.prototype.appendChild = function (child) {
49
- if (!this.batchType) {
50
- this.batchType = child.nodeName;
51
- }
52
-
53
- _super.prototype.appendChild.call(this, child);
54
-
55
- child.getEntity().getComponent(Renderable).instanced = true;
56
- var renderable = this.getEntity().getComponent(Renderable);
57
- renderable.aabbDirty = true;
58
- renderable.dirty = true;
59
- this.dirty = true;
60
- return child;
61
- };
62
-
63
- Batch.prototype.removeChild = function (child) {
64
- _super.prototype.removeChild.call(this, child);
65
-
66
- child.getEntity().getComponent(Renderable).instanced = false;
67
- var renderable = this.getEntity().getComponent(Renderable);
68
- renderable.aabbDirty = true;
69
- renderable.dirty = true;
70
- this.dirty = true;
71
- return child;
72
- };
73
-
74
- Batch.prototype.attributeChangedCallback = function (name, value) {
75
- throw new Error('Method not implemented.');
76
- };
77
-
78
- Batch.tag = 'batch';
79
- return Batch;
80
- }(CustomElement);
81
-
82
- export { Batch };
@@ -1,175 +0,0 @@
1
- import type { BaseStyleProps, Cursor, PathCommand } from './types';
2
- export declare const G_CANVAS_ELEMENT: readonly ["Group", "Rect", "Text", "Circle", "Ellipse", "Image", "Line", "Marker", "Path", "Polygon", "Polyline"];
3
- export declare const ELEMENT_PROPS: string[];
4
- export declare const GENERAL_SHAPE_ATTR: readonly ["cursor"];
5
- export declare const COLOR_ATTRS: readonly ["fill", "stroke", "opacity", "fillOpacity", "strokeOpacity", "shadowColor", "shadowBlur", "shadowOffsetX", "shadowOffsetY", "globalCompositeOperation"];
6
- export declare const GENERAL_LINE_ATTRS: readonly ["lineCap", "lineJoin", "lineWidth", "lineAppendWidth", "miterLimit", "lineDash", "startArrow", "endArrow"];
7
- export declare const FONT_ATTRS: readonly ["font", "textAlign", "textBaseline", "fontStyle", "fontVariant", "fontSize", "fontFamily", "fontWeight"];
8
- export declare const CIRCLE_ATTRS: readonly ["x", "y", "r", "lineWidth"];
9
- export declare const DOM_ATTRS: readonly ["x", "y", "width", "height", "html"];
10
- export declare const ELLIPSE_ATTRS: readonly ["x", "y", "rx", "ry"];
11
- export declare const IMAGE_ATTRS: readonly ["x", "y", "width", "height", "img"];
12
- export declare const LINE_ATTRS: readonly ["x1", "y1", "x2", "y2"];
13
- export declare const MARKER_ATTRS: readonly ["x", "y", "r", "symbol"];
14
- export declare const PATH_ATTRS: readonly ["path"];
15
- export declare const POLYGON_ATTRS: readonly ["points"];
16
- export declare const POLYLINE_ATTRS: readonly ["points"];
17
- export declare const RECT_ATTRS: readonly ["x", "y", "width", "height", "radius"];
18
- export declare const TEXT_ATTRS: readonly ["x", "y", "text"];
19
- /**
20
- * event
21
- */
22
- export declare type GEvents = Partial<{
23
- onMousedown: (evt: Event) => void;
24
- onMouseup: (evt: Event) => void;
25
- onClick: (evt: Event) => void;
26
- onDblclick: (evt: Event) => void;
27
- onMousemove: (evt: Event) => void;
28
- onMouseover: (evt: Event) => void;
29
- onMouseout: (evt: Event) => void;
30
- onMouseenter: (evt: Event) => void;
31
- onMouseleave: (evt: Event) => void;
32
- onTouchstart: (evt: Event) => void;
33
- onTouchmove: (evt: Event) => void;
34
- onTouchend: (evt: Event) => void;
35
- onDragstart: (evt: Event) => void;
36
- onDrag: (evt: Event) => void;
37
- onDragend: (evt: Event) => void;
38
- onDragenter: (evt: Event) => void;
39
- onDragleave: (evt: Event) => void;
40
- onDragover: (evt: Event) => void;
41
- onDrop: (evt: Event) => void;
42
- onContextmenu: (evt: Event) => void;
43
- onMousewheel: (evt: Event) => void;
44
- }>;
45
- export declare type Matrix = [number, number, number, number, number, number];
46
- export declare type PathType = string | PathCommand[];
47
- export declare type Point = [number, number];
48
- export declare type Anchor = Point;
49
- export declare type Points = Point[];
50
- export declare type Arrow = {
51
- path: PathType;
52
- d?: number;
53
- stroke?: string;
54
- fill?: string;
55
- lineWidth?: string;
56
- } | boolean;
57
- export declare type ElementProps = Partial<{
58
- id: string;
59
- name: string;
60
- visible: boolean;
61
- capture: boolean;
62
- zIndex: number;
63
- draggable: boolean;
64
- cursor: Cursor;
65
- }>;
66
- export declare type StyleProps = Partial<{
67
- fill: string;
68
- stroke: string;
69
- opacity: number;
70
- strokeOpacity: number;
71
- fillOpacity: number;
72
- shadowColor: string;
73
- shadowBlur: number;
74
- shadowOffsetX: number;
75
- shadowOffsetY: number;
76
- globalCompositeOperation: string;
77
- }>;
78
- export declare type LineSizeProps = Partial<{
79
- lineWidth: number;
80
- lineAppendWidth: number;
81
- }>;
82
- export declare type LineStyleProps = Partial<{
83
- lineCap: 'butt' | 'round' | 'square';
84
- lineJoin: 'bevel' | 'round' | 'miter';
85
- lineDash: number[];
86
- miterLimit: number;
87
- startArrow: Arrow;
88
- endArrow: Arrow;
89
- }> & LineSizeProps;
90
- export declare type Radius = number | [number] | [number, number] | [number, number, number] | [number, number, number, number];
91
- export declare type RectProps = BaseStyleProps & Partial<{
92
- x: number;
93
- y: number;
94
- width: number;
95
- height: number;
96
- radius: Radius;
97
- anchor: Anchor;
98
- opacity: number;
99
- }> & LineStyleProps;
100
- export declare type TextProps = BaseStyleProps & Partial<{
101
- x: number;
102
- y: number;
103
- text: string;
104
- fontSize: number;
105
- fontFamily: string;
106
- fontStyle: 'normal' | 'italic' | 'oblique';
107
- fontWeight: 'normal' | 'bold' | 'bolder' | 'lighter' | number;
108
- fontVariant: 'normal' | 'small-caps' | string;
109
- textAlign: 'start' | 'center' | 'end' | 'left' | 'right';
110
- textBaseline: 'top' | 'hanging' | 'middle' | 'alphabetic' | 'ideographic' | 'bottom';
111
- lineWidth: number;
112
- fill?: string;
113
- stroke?: string;
114
- whiteSpace?: string;
115
- wordWrap?: boolean;
116
- wordWrapWidth?: number;
117
- leading?: number;
118
- letterSpacing?: number;
119
- lineHeight?: number;
120
- lineJoin?: string;
121
- lineCap?: string;
122
- miterLimit?: number;
123
- padding?: number;
124
- opacity?: number;
125
- }>;
126
- export declare type CircleProps = BaseStyleProps & Partial<{
127
- x: number;
128
- y: number;
129
- r: number;
130
- opacity: number;
131
- }> & LineSizeProps;
132
- export declare type EllipseProps = BaseStyleProps & Partial<{
133
- x: number;
134
- y: number;
135
- rx: number;
136
- ry: number;
137
- opacity: number;
138
- }> & LineSizeProps;
139
- export declare type ImageProps = BaseStyleProps & {
140
- img: string | HTMLImageElement | HTMLCanvasElement;
141
- } & Partial<{
142
- x: number;
143
- y: number;
144
- width: number;
145
- height: number;
146
- opacity: number;
147
- }>;
148
- export declare type LineProps = BaseStyleProps & Partial<{
149
- x1: number;
150
- y1: number;
151
- x2: number;
152
- y2: number;
153
- anchor: Anchor;
154
- opacity: number;
155
- strokeOpacity: number;
156
- }> & LineStyleProps;
157
- export declare type PathProps = BaseStyleProps & {
158
- path: PathType;
159
- anchor: Anchor;
160
- opacity?: number;
161
- strokeOpacity?: number;
162
- } & LineStyleProps;
163
- export declare type PolygonProps = BaseStyleProps & {
164
- points: Points;
165
- opacity?: number;
166
- strokeOpacity?: number;
167
- };
168
- export declare type PolylineProps = BaseStyleProps & {
169
- points: Points;
170
- anchor: Anchor;
171
- opacity?: number;
172
- strokeOpacity?: number;
173
- } & LineStyleProps;
174
- export declare type AllShapeProps = RectProps & TextProps & CircleProps & EllipseProps & ImageProps & LineProps & PathProps & PolygonProps & PolylineProps;
175
- export declare type ShapeProps = RectProps | TextProps | CircleProps | EllipseProps | ImageProps | LineProps | PathProps | PolygonProps | PolylineProps;
package/es/shapes-type.js DELETED
@@ -1,18 +0,0 @@
1
- export var G_CANVAS_ELEMENT = ['Group', 'Rect', 'Text', 'Circle', 'Ellipse', 'Image', 'Line', 'Marker', 'Path', 'Polygon', 'Polyline']; // type ElementType = typeof G_CANVAS_ELEMENT[number];
2
-
3
- export var ELEMENT_PROPS = ['id', 'name', 'type', 'visible', 'capture', 'destroyed', 'zIndex', 'draggable'];
4
- export var GENERAL_SHAPE_ATTR = ['cursor'];
5
- export var COLOR_ATTRS = ['fill', 'stroke', 'opacity', 'fillOpacity', 'strokeOpacity', 'shadowColor', 'shadowBlur', 'shadowOffsetX', 'shadowOffsetY', 'globalCompositeOperation'];
6
- export var GENERAL_LINE_ATTRS = ['lineCap', 'lineJoin', 'lineWidth', 'lineAppendWidth', 'miterLimit', 'lineDash', 'startArrow', 'endArrow'];
7
- export var FONT_ATTRS = ['font', 'textAlign', 'textBaseline', 'fontStyle', 'fontVariant', 'fontSize', 'fontFamily', 'fontWeight'];
8
- export var CIRCLE_ATTRS = ['x', 'y', 'r', 'lineWidth'];
9
- export var DOM_ATTRS = ['x', 'y', 'width', 'height', 'html'];
10
- export var ELLIPSE_ATTRS = ['x', 'y', 'rx', 'ry'];
11
- export var IMAGE_ATTRS = ['x', 'y', 'width', 'height', 'img'];
12
- export var LINE_ATTRS = ['x1', 'y1', 'x2', 'y2'];
13
- export var MARKER_ATTRS = ['x', 'y', 'r', 'symbol'];
14
- export var PATH_ATTRS = ['path'];
15
- export var POLYGON_ATTRS = ['points'];
16
- export var POLYLINE_ATTRS = ['points'];
17
- export var RECT_ATTRS = ['x', 'y', 'width', 'height', 'radius'];
18
- export var TEXT_ATTRS = ['x', 'y', 'text'];
@@ -1,3 +0,0 @@
1
- export declare function makeMatrixDecomposition(transformList: number[][]): any[][];
2
- export declare function quat(fromQ: any, toQ: any, f: any): any[];
3
- export declare function composeMatrix(translate: any, scale: any, skew: any, quat: any, perspective: any): number[];