@antv/g 5.0.22-alpha.3 → 5.0.22-alpha.6

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 (328) hide show
  1. package/dist/index.umd.min.js +30 -0
  2. package/es/AbstractRenderer.js +3 -1
  3. package/es/Canvas.d.ts +1 -4
  4. package/es/Canvas.js +5 -3
  5. package/es/DisplayObjectPool.js +3 -1
  6. package/es/camera/Camera.d.ts +105 -66
  7. package/es/camera/Camera.js +307 -171
  8. package/es/camera/Landmark.d.ts +18 -25
  9. package/es/camera/Landmark.js +1 -72
  10. package/es/canvas-module.js +2 -4
  11. package/es/components/Cullable.js +3 -1
  12. package/es/components/Geometry.js +3 -1
  13. package/es/components/Renderable.js +3 -1
  14. package/es/components/Sortable.js +3 -1
  15. package/es/components/Transform.js +3 -1
  16. package/es/css/LayoutRegistry.js +3 -1
  17. package/es/css/StyleValueRegistry.d.ts +10 -1
  18. package/es/css/StyleValueRegistry.js +28 -22
  19. package/es/css/cssom/CSSColorValue.js +3 -1
  20. package/es/css/cssom/CSSGradientValue.js +8 -6
  21. package/es/css/cssom/CSSKeywordValue.js +3 -1
  22. package/es/css/cssom/CSSMathInvert.js +3 -1
  23. package/es/css/cssom/CSSMathMax.js +3 -1
  24. package/es/css/cssom/CSSMathMin.js +3 -1
  25. package/es/css/cssom/CSSMathNegate.js +3 -1
  26. package/es/css/cssom/CSSMathProduct.js +3 -1
  27. package/es/css/cssom/CSSMathSum.js +3 -1
  28. package/es/css/cssom/CSSMathValue.js +3 -1
  29. package/es/css/cssom/CSSMathVariadic.js +3 -1
  30. package/es/css/cssom/CSSNumericValue.js +3 -1
  31. package/es/css/cssom/CSSNumericValueType.d.ts +1 -1
  32. package/es/css/cssom/CSSNumericValueType.js +3 -1
  33. package/es/css/cssom/CSSRGB.js +4 -2
  34. package/es/css/cssom/CSSStyleValue.d.ts +1 -1
  35. package/es/css/cssom/CSSStyleValue.js +3 -1
  36. package/es/css/cssom/CSSTransformComponent.js +3 -1
  37. package/es/css/cssom/CSSTransformValue.js +3 -1
  38. package/es/css/cssom/CSSTranslate.js +3 -1
  39. package/es/css/cssom/CSSUnitValue.js +4 -2
  40. package/es/css/parser/color.js +2 -2
  41. package/es/css/parser/dimension.d.ts +2 -1
  42. package/es/css/parser/dimension.js +2 -2
  43. package/es/css/parser/numeric.js +1 -1
  44. package/es/css/parser/path.d.ts +1 -1
  45. package/es/css/parser/points.js +1 -1
  46. package/es/css/parser/transform-origin.d.ts +1 -1
  47. package/es/css/parser/transform-origin.js +3 -3
  48. package/es/css/properties/CSSPropertyAnchor.d.ts +4 -2
  49. package/es/css/properties/CSSPropertyAnchor.js +5 -2
  50. package/es/css/properties/CSSPropertyClipPath.d.ts +2 -1
  51. package/es/css/properties/CSSPropertyClipPath.js +4 -2
  52. package/es/css/properties/CSSPropertyColor.d.ts +3 -2
  53. package/es/css/properties/CSSPropertyColor.js +4 -2
  54. package/es/css/properties/CSSPropertyFilter.d.ts +3 -2
  55. package/es/css/properties/CSSPropertyFilter.js +4 -2
  56. package/es/css/properties/CSSPropertyLengthOrPercentage.d.ts +4 -2
  57. package/es/css/properties/CSSPropertyLengthOrPercentage.js +5 -2
  58. package/es/css/properties/CSSPropertyLineDash.d.ts +4 -2
  59. package/es/css/properties/CSSPropertyLineDash.js +4 -2
  60. package/es/css/properties/CSSPropertyLocalPosition.d.ts +4 -2
  61. package/es/css/properties/CSSPropertyLocalPosition.js +4 -2
  62. package/es/css/properties/CSSPropertyOffsetDistance.d.ts +4 -2
  63. package/es/css/properties/CSSPropertyOffsetDistance.js +5 -2
  64. package/es/css/properties/CSSPropertyOffsetPath.d.ts +2 -1
  65. package/es/css/properties/CSSPropertyOffsetPath.js +3 -1
  66. package/es/css/properties/CSSPropertyOpacity.d.ts +3 -2
  67. package/es/css/properties/CSSPropertyOpacity.js +4 -2
  68. package/es/css/properties/CSSPropertyPath.d.ts +3 -2
  69. package/es/css/properties/CSSPropertyPath.js +6 -2
  70. package/es/css/properties/CSSPropertyPoints.d.ts +3 -2
  71. package/es/css/properties/CSSPropertyPoints.js +4 -2
  72. package/es/css/properties/CSSPropertyShadowBlur.d.ts +1 -1
  73. package/es/css/properties/CSSPropertyShadowBlur.js +4 -2
  74. package/es/css/properties/CSSPropertyText.d.ts +3 -2
  75. package/es/css/properties/CSSPropertyText.js +5 -3
  76. package/es/css/properties/CSSPropertyTextTransform.d.ts +2 -1
  77. package/es/css/properties/CSSPropertyTextTransform.js +4 -2
  78. package/es/css/properties/CSSPropertyTransform.d.ts +3 -2
  79. package/es/css/properties/CSSPropertyTransform.js +5 -3
  80. package/es/css/properties/CSSPropertyTransformOrigin.d.ts +3 -2
  81. package/es/css/properties/CSSPropertyTransformOrigin.js +4 -2
  82. package/es/css/properties/CSSPropertyVisibility.d.ts +3 -1
  83. package/es/css/properties/CSSPropertyVisibility.js +3 -1
  84. package/es/css/properties/CSSPropertyZIndex.d.ts +4 -2
  85. package/es/css/properties/CSSPropertyZIndex.js +4 -2
  86. package/es/display-objects/Circle.js +3 -1
  87. package/es/display-objects/CustomElement.js +3 -1
  88. package/es/display-objects/DisplayObject.js +7 -4
  89. package/es/display-objects/Ellipse.js +3 -1
  90. package/es/display-objects/Group.js +3 -1
  91. package/es/display-objects/HTML.js +6 -3
  92. package/es/display-objects/Image.js +3 -1
  93. package/es/display-objects/Line.js +3 -1
  94. package/es/display-objects/Path.js +5 -3
  95. package/es/display-objects/Polygon.js +3 -1
  96. package/es/display-objects/Polyline.js +3 -1
  97. package/es/display-objects/Rect.js +3 -1
  98. package/es/display-objects/Text.js +6 -3
  99. package/es/dom/Animation.js +4 -2
  100. package/es/dom/AnimationEffectTiming.js +3 -1
  101. package/es/dom/AnimationEvent.js +3 -1
  102. package/es/dom/AnimationTimeline.js +3 -1
  103. package/es/dom/CustomElementRegistry.js +3 -1
  104. package/es/dom/CustomEvent.js +3 -1
  105. package/es/dom/Document.js +3 -1
  106. package/es/dom/Element.js +8 -6
  107. package/es/dom/EventTarget.js +6 -4
  108. package/es/dom/FederatedEvent.js +3 -1
  109. package/es/dom/FederatedMouseEvent.js +3 -1
  110. package/es/dom/FederatedPointerEvent.js +3 -1
  111. package/es/dom/FederatedTouchEvent.d.ts +13 -0
  112. package/es/dom/FederatedTouchEvent.js +19 -0
  113. package/es/dom/FederatedWheelEvent.js +3 -1
  114. package/es/dom/KeyframeEffect.js +3 -1
  115. package/es/dom/KeyframeList.js +1 -1
  116. package/es/dom/MutationEvent.d.ts +1 -1
  117. package/es/dom/MutationEvent.js +3 -1
  118. package/es/dom/MutationObserver.d.ts +2 -1
  119. package/es/dom/MutationObserver.js +11 -4
  120. package/es/dom/MutationRecord.d.ts +1 -1
  121. package/es/dom/MutationRecord.js +3 -1
  122. package/es/dom/Node.js +5 -3
  123. package/es/dom/interfaces.d.ts +2 -1
  124. package/es/plugins/CullingPlugin.js +3 -1
  125. package/es/plugins/DirtyCheckPlugin.js +3 -1
  126. package/es/plugins/EventPlugin.js +4 -2
  127. package/es/plugins/FrustumCullingStrategy.js +3 -1
  128. package/es/plugins/PrepareRendererPlugin.d.ts +1 -1
  129. package/es/plugins/PrepareRendererPlugin.js +3 -1
  130. package/es/services/EventService.js +5 -3
  131. package/es/services/OffscreenCanvasCreator.js +3 -1
  132. package/es/services/RenderingService.d.ts +2 -2
  133. package/es/services/RenderingService.js +3 -1
  134. package/es/services/SceneGraphSelector.js +3 -1
  135. package/es/services/SceneGraphService.js +4 -2
  136. package/es/services/TextService.d.ts +2 -2
  137. package/es/services/TextService.js +7 -4
  138. package/es/services/aabb/CircleUpdater.js +3 -1
  139. package/es/services/aabb/EllipseUpdater.js +3 -1
  140. package/es/services/aabb/LineUpdater.js +3 -1
  141. package/es/services/aabb/PathUpdater.js +3 -1
  142. package/es/services/aabb/PolylineUpdater.js +3 -1
  143. package/es/services/aabb/RectUpdater.js +4 -2
  144. package/es/services/aabb/TextUpdater.d.ts +1 -2
  145. package/es/services/aabb/TextUpdater.js +3 -1
  146. package/es/shapes/AABB.js +3 -1
  147. package/es/shapes/BoundingSphere.js +3 -1
  148. package/es/shapes/Frustum.js +3 -1
  149. package/es/shapes/Plane.js +3 -1
  150. package/es/shapes/Point.js +3 -1
  151. package/es/shapes/Ray.js +3 -1
  152. package/es/shapes/Rectangle.js +3 -1
  153. package/es/types.d.ts +4 -0
  154. package/es/utils/custom-easing.js +1 -1
  155. package/es/utils/math.d.ts +1 -2
  156. package/es/utils/math.js +11 -6
  157. package/es/utils/path.d.ts +2 -2
  158. package/es/utils/path.js +3 -3
  159. package/es/utils/text.js +4 -4
  160. package/lib/AbstractRenderer.js +3 -1
  161. package/lib/Canvas.d.ts +1 -4
  162. package/lib/Canvas.js +5 -3
  163. package/lib/DisplayObjectPool.js +3 -1
  164. package/lib/camera/Camera.d.ts +105 -66
  165. package/lib/camera/Camera.js +314 -179
  166. package/lib/camera/Landmark.d.ts +18 -25
  167. package/lib/camera/Landmark.js +1 -75
  168. package/lib/canvas-module.js +1 -3
  169. package/lib/components/Cullable.js +4 -2
  170. package/lib/components/Geometry.js +3 -1
  171. package/lib/components/Renderable.js +3 -1
  172. package/lib/components/Sortable.js +3 -1
  173. package/lib/components/Transform.js +3 -1
  174. package/lib/css/LayoutRegistry.js +3 -1
  175. package/lib/css/StyleValueRegistry.d.ts +10 -1
  176. package/lib/css/StyleValueRegistry.js +38 -27
  177. package/lib/css/cssom/CSSColorValue.js +3 -1
  178. package/lib/css/cssom/CSSGradientValue.js +9 -7
  179. package/lib/css/cssom/CSSKeywordValue.js +3 -1
  180. package/lib/css/cssom/CSSMathInvert.js +3 -1
  181. package/lib/css/cssom/CSSMathMax.js +3 -1
  182. package/lib/css/cssom/CSSMathMin.js +3 -1
  183. package/lib/css/cssom/CSSMathNegate.js +3 -1
  184. package/lib/css/cssom/CSSMathOperator.js +1 -1
  185. package/lib/css/cssom/CSSMathProduct.js +3 -1
  186. package/lib/css/cssom/CSSMathSum.js +3 -1
  187. package/lib/css/cssom/CSSMathValue.js +3 -1
  188. package/lib/css/cssom/CSSMathVariadic.js +4 -2
  189. package/lib/css/cssom/CSSNumericValue.js +3 -1
  190. package/lib/css/cssom/CSSNumericValueType.d.ts +1 -1
  191. package/lib/css/cssom/CSSNumericValueType.js +5 -3
  192. package/lib/css/cssom/CSSRGB.js +4 -2
  193. package/lib/css/cssom/CSSStyleValue.d.ts +1 -1
  194. package/lib/css/cssom/CSSStyleValue.js +4 -2
  195. package/lib/css/cssom/CSSTransformComponent.js +4 -2
  196. package/lib/css/cssom/CSSTransformValue.js +3 -1
  197. package/lib/css/cssom/CSSTranslate.js +3 -1
  198. package/lib/css/cssom/CSSUnitValue.js +4 -2
  199. package/lib/css/cssom/types.js +1 -1
  200. package/lib/css/parser/color.js +7 -7
  201. package/lib/css/parser/dimension.d.ts +2 -1
  202. package/lib/css/parser/dimension.js +9 -8
  203. package/lib/css/parser/numeric.js +6 -6
  204. package/lib/css/parser/path.d.ts +1 -1
  205. package/lib/css/parser/path.js +1 -1
  206. package/lib/css/parser/points.js +2 -2
  207. package/lib/css/parser/transform-origin.d.ts +1 -1
  208. package/lib/css/parser/transform-origin.js +7 -5
  209. package/lib/css/parser/transform.js +2 -2
  210. package/lib/css/properties/CSSPropertyAnchor.d.ts +4 -2
  211. package/lib/css/properties/CSSPropertyAnchor.js +8 -4
  212. package/lib/css/properties/CSSPropertyClipPath.d.ts +2 -1
  213. package/lib/css/properties/CSSPropertyClipPath.js +5 -3
  214. package/lib/css/properties/CSSPropertyColor.d.ts +3 -2
  215. package/lib/css/properties/CSSPropertyColor.js +6 -4
  216. package/lib/css/properties/CSSPropertyFilter.d.ts +3 -2
  217. package/lib/css/properties/CSSPropertyFilter.js +5 -3
  218. package/lib/css/properties/CSSPropertyLengthOrPercentage.d.ts +4 -2
  219. package/lib/css/properties/CSSPropertyLengthOrPercentage.js +14 -10
  220. package/lib/css/properties/CSSPropertyLineDash.d.ts +4 -2
  221. package/lib/css/properties/CSSPropertyLineDash.js +6 -4
  222. package/lib/css/properties/CSSPropertyLocalPosition.d.ts +4 -2
  223. package/lib/css/properties/CSSPropertyLocalPosition.js +6 -4
  224. package/lib/css/properties/CSSPropertyOffsetDistance.d.ts +4 -2
  225. package/lib/css/properties/CSSPropertyOffsetDistance.js +9 -5
  226. package/lib/css/properties/CSSPropertyOffsetPath.d.ts +2 -1
  227. package/lib/css/properties/CSSPropertyOffsetPath.js +3 -1
  228. package/lib/css/properties/CSSPropertyOpacity.d.ts +3 -2
  229. package/lib/css/properties/CSSPropertyOpacity.js +6 -4
  230. package/lib/css/properties/CSSPropertyPath.d.ts +3 -2
  231. package/lib/css/properties/CSSPropertyPath.js +12 -6
  232. package/lib/css/properties/CSSPropertyPoints.d.ts +3 -2
  233. package/lib/css/properties/CSSPropertyPoints.js +5 -3
  234. package/lib/css/properties/CSSPropertyShadowBlur.d.ts +1 -1
  235. package/lib/css/properties/CSSPropertyShadowBlur.js +5 -3
  236. package/lib/css/properties/CSSPropertyText.d.ts +3 -2
  237. package/lib/css/properties/CSSPropertyText.js +6 -4
  238. package/lib/css/properties/CSSPropertyTextTransform.d.ts +2 -1
  239. package/lib/css/properties/CSSPropertyTextTransform.js +8 -6
  240. package/lib/css/properties/CSSPropertyTransform.d.ts +3 -2
  241. package/lib/css/properties/CSSPropertyTransform.js +26 -24
  242. package/lib/css/properties/CSSPropertyTransformOrigin.d.ts +3 -2
  243. package/lib/css/properties/CSSPropertyTransformOrigin.js +5 -3
  244. package/lib/css/properties/CSSPropertyVisibility.d.ts +3 -1
  245. package/lib/css/properties/CSSPropertyVisibility.js +3 -1
  246. package/lib/css/properties/CSSPropertyZIndex.d.ts +4 -2
  247. package/lib/css/properties/CSSPropertyZIndex.js +5 -3
  248. package/lib/display-objects/Circle.js +3 -1
  249. package/lib/display-objects/CustomElement.js +3 -1
  250. package/lib/display-objects/DisplayObject.js +14 -11
  251. package/lib/display-objects/Ellipse.js +3 -1
  252. package/lib/display-objects/Group.js +3 -1
  253. package/lib/display-objects/HTML.js +6 -4
  254. package/lib/display-objects/Image.js +3 -1
  255. package/lib/display-objects/Line.js +3 -1
  256. package/lib/display-objects/Path.js +8 -6
  257. package/lib/display-objects/Polygon.js +3 -1
  258. package/lib/display-objects/Polyline.js +3 -1
  259. package/lib/display-objects/Rect.js +3 -1
  260. package/lib/display-objects/Text.js +6 -4
  261. package/lib/dom/Animation.js +4 -2
  262. package/lib/dom/AnimationEffectTiming.js +3 -1
  263. package/lib/dom/AnimationEvent.js +3 -1
  264. package/lib/dom/AnimationTimeline.js +4 -2
  265. package/lib/dom/CustomElementRegistry.js +3 -1
  266. package/lib/dom/CustomEvent.js +3 -1
  267. package/lib/dom/Document.js +3 -1
  268. package/lib/dom/Element.js +11 -9
  269. package/lib/dom/EventTarget.js +13 -11
  270. package/lib/dom/FederatedEvent.js +3 -1
  271. package/lib/dom/FederatedMouseEvent.js +3 -1
  272. package/lib/dom/FederatedPointerEvent.js +3 -1
  273. package/lib/dom/FederatedTouchEvent.d.ts +13 -0
  274. package/lib/dom/FederatedTouchEvent.js +27 -0
  275. package/lib/dom/FederatedWheelEvent.js +3 -1
  276. package/lib/dom/KeyframeEffect.js +4 -2
  277. package/lib/dom/KeyframeList.js +1 -1
  278. package/lib/dom/MutationEvent.d.ts +1 -1
  279. package/lib/dom/MutationEvent.js +3 -1
  280. package/lib/dom/MutationObserver.d.ts +2 -1
  281. package/lib/dom/MutationObserver.js +22 -15
  282. package/lib/dom/MutationRecord.d.ts +1 -1
  283. package/lib/dom/MutationRecord.js +3 -1
  284. package/lib/dom/Node.js +8 -6
  285. package/lib/dom/interfaces.d.ts +2 -1
  286. package/lib/index.js +1 -1
  287. package/lib/plugins/CullingPlugin.js +4 -2
  288. package/lib/plugins/DirtyCheckPlugin.js +3 -1
  289. package/lib/plugins/EventPlugin.js +26 -24
  290. package/lib/plugins/FrustumCullingStrategy.js +3 -1
  291. package/lib/plugins/PrepareRendererPlugin.d.ts +1 -1
  292. package/lib/plugins/PrepareRendererPlugin.js +3 -1
  293. package/lib/services/EventService.js +5 -3
  294. package/lib/services/OffscreenCanvasCreator.js +3 -1
  295. package/lib/services/RenderingService.d.ts +2 -2
  296. package/lib/services/RenderingService.js +3 -1
  297. package/lib/services/SceneGraphSelector.js +4 -2
  298. package/lib/services/SceneGraphService.js +7 -5
  299. package/lib/services/TextService.d.ts +2 -2
  300. package/lib/services/TextService.js +10 -6
  301. package/lib/services/aabb/CircleUpdater.js +3 -1
  302. package/lib/services/aabb/EllipseUpdater.js +3 -1
  303. package/lib/services/aabb/LineUpdater.js +3 -1
  304. package/lib/services/aabb/PathUpdater.js +3 -1
  305. package/lib/services/aabb/PolylineUpdater.js +3 -1
  306. package/lib/services/aabb/RectUpdater.js +5 -3
  307. package/lib/services/aabb/TextUpdater.d.ts +1 -2
  308. package/lib/services/aabb/TextUpdater.js +3 -1
  309. package/lib/services/aabb/index.js +10 -10
  310. package/lib/services/aabb/interfaces.js +1 -1
  311. package/lib/shapes/AABB.js +3 -1
  312. package/lib/shapes/BoundingSphere.js +3 -1
  313. package/lib/shapes/Frustum.js +4 -2
  314. package/lib/shapes/Plane.js +3 -1
  315. package/lib/shapes/Point.js +3 -1
  316. package/lib/shapes/Ray.js +3 -1
  317. package/lib/shapes/Rectangle.js +3 -1
  318. package/lib/types.d.ts +4 -0
  319. package/lib/types.js +1 -1
  320. package/lib/utils/animation.js +3 -2
  321. package/lib/utils/bezier-easing.js +1 -1
  322. package/lib/utils/custom-easing.js +2 -2
  323. package/lib/utils/math.d.ts +1 -2
  324. package/lib/utils/math.js +20 -17
  325. package/lib/utils/path.d.ts +2 -2
  326. package/lib/utils/path.js +6 -6
  327. package/lib/utils/text.js +5 -5
  328. package/package.json +7 -5
@@ -1,4 +1,4 @@
1
- import type { RenderingService, RenderingPlugin } from '../services/RenderingService';
1
+ import type { RenderingService, RenderingPlugin } from '../services';
2
2
  export declare class PrepareRendererPlugin implements RenderingPlugin {
3
3
  static tag: string;
4
4
  private renderingContext;
@@ -4,7 +4,9 @@ import { StyleValueRegistry } from '../css';
4
4
  import { ElementEvent } from '../dom';
5
5
  import { RenderingContext, RenderingPluginContribution, dirtifyToRoot } from '../services';
6
6
 
7
- var PrepareRendererPlugin = function () {
7
+ var PrepareRendererPlugin =
8
+ /** @class */
9
+ function () {
8
10
  function PrepareRendererPlugin() {}
9
11
 
10
12
  PrepareRendererPlugin_1 = PrepareRendererPlugin;
@@ -13,7 +13,9 @@ import { Point } from '../shapes';
13
13
  import { ContextService } from './ContextService';
14
14
  var PROPAGATION_LIMIT = 2048;
15
15
 
16
- var EventService = function (_super) {
16
+ var EventService =
17
+ /** @class */
18
+ function (_super) {
17
19
  __extends(EventService, _super);
18
20
 
19
21
  function EventService() {
@@ -561,7 +563,7 @@ var EventService = function (_super) {
561
563
  mappers[i].fn(e);
562
564
  }
563
565
  } else {
564
- console.warn("[EventService]: Event mapping not defined for " + e.type);
566
+ console.warn("[EventService]: Event mapping not defined for ".concat(e.type));
565
567
  }
566
568
  };
567
569
 
@@ -893,7 +895,7 @@ var EventService = function (_super) {
893
895
 
894
896
  EventService.prototype.notifyTarget = function (e, type) {
895
897
  type = type !== null && type !== void 0 ? type : e.type;
896
- var key = e.eventPhase === e.CAPTURING_PHASE || e.eventPhase === e.AT_TARGET ? type + "capture" : type;
898
+ var key = e.eventPhase === e.CAPTURING_PHASE || e.eventPhase === e.AT_TARGET ? "".concat(type, "capture") : type;
897
899
  this.notifyListeners(e, key);
898
900
 
899
901
  if (e.eventPhase === e.AT_TARGET) {
@@ -7,7 +7,9 @@ import { singleton } from 'mana-syringe';
7
7
  * - g-plugin-webgl-renderer `ctx.createLinearGradient` and generate texture
8
8
  */
9
9
 
10
- var OffscreenCanvasCreator = function () {
10
+ var OffscreenCanvasCreator =
11
+ /** @class */
12
+ function () {
11
13
  function OffscreenCanvasCreator() {}
12
14
 
13
15
  OffscreenCanvasCreator.prototype.getOrCreateCanvas = function (offscreenCanvas) {
@@ -1,7 +1,7 @@
1
1
  import { Syringe } from 'mana-syringe';
2
2
  import { SyncHook, SyncWaterfallHook, AsyncParallelHook, AsyncSeriesWaterfallHook } from 'tapable';
3
- import type { CanvasConfig, DisplayObject } from '..';
4
- import type { EventPosition, InteractivePointerEvent } from '../types';
3
+ import type { DisplayObject } from '../display-objects';
4
+ import type { CanvasConfig, EventPosition, InteractivePointerEvent } from '../types';
5
5
  export interface RenderingPlugin {
6
6
  apply: (renderer: RenderingService) => void;
7
7
  }
@@ -16,7 +16,9 @@ export var RenderingPluginContribution = Syringe.defineToken('RenderingPluginCon
16
16
  * * end frame
17
17
  */
18
18
 
19
- var RenderingService = function () {
19
+ var RenderingService =
20
+ /** @class */
21
+ function () {
20
22
  function RenderingService() {
21
23
  this.inited = false;
22
24
  this.stats = {
@@ -15,7 +15,9 @@ var NAME_REGEXP = /\[\s*name=(.*)\s*\]/;
15
15
  * * querySelectorAll
16
16
  */
17
17
 
18
- var DefaultSceneGraphSelector = function () {
18
+ var DefaultSceneGraphSelector =
19
+ /** @class */
20
+ function () {
19
21
  function DefaultSceneGraphSelector() {}
20
22
 
21
23
  DefaultSceneGraphSelector.prototype.selectOne = function (query, root) {
@@ -1,6 +1,6 @@
1
1
  import { __decorate, __metadata, __read } from "tslib";
2
2
  import { inject, singleton, Syringe } from 'mana-syringe';
3
- import { isNil } from '@antv/util';
3
+ import { isNil } from 'lodash-es';
4
4
  import { mat4, quat, vec3 } from 'gl-matrix';
5
5
  import { AABB, Rectangle } from '../shapes';
6
6
  import { SceneGraphSelectorFactory } from './SceneGraphSelector';
@@ -52,7 +52,9 @@ export var SceneGraphService = Syringe.defineToken('SceneGraphService');
52
52
  * @see https://community.khronos.org/t/scene-graphs/50542/7
53
53
  */
54
54
 
55
- var DefaultSceneGraphService = function () {
55
+ var DefaultSceneGraphService =
56
+ /** @class */
57
+ function () {
56
58
  function DefaultSceneGraphService() {
57
59
  var _this = this;
58
60
  /**
@@ -1,6 +1,6 @@
1
1
  /// <reference types="offscreencanvas" />
2
- import type { ParsedTextStyleProps } from '..';
3
- import { Rectangle } from '..';
2
+ import type { ParsedTextStyleProps } from '../display-objects';
3
+ import { Rectangle } from '../shapes';
4
4
  export interface TextMetrics {
5
5
  font: string;
6
6
  width: number;
@@ -1,6 +1,7 @@
1
1
  import { __decorate, __metadata, __read, __spreadArray } from "tslib";
2
2
  import { singleton, inject } from 'mana-syringe';
3
- import { toFontString, Rectangle } from '..';
3
+ import { toFontString } from '../utils';
4
+ import { Rectangle } from '../shapes';
4
5
  import { OffscreenCanvasCreator } from './OffscreenCanvasCreator';
5
6
  var TEXT_METRICS = {
6
7
  MetricsString: '|ÉqÅ',
@@ -23,10 +24,12 @@ var regexCannotStartJaJp = /[)\]}〕〉》」』】〙〗〟'"⦆»ヽヾー
23
24
  var regexCannotEndJaJp = /[([{〔〈《「『【〘〖〝'"⦅«—...‥〳〴〵]/;
24
25
  var regexCannotStartKoKr = /[!%),.:;?\]}¢°'"†‡℃〆〈《「『〕!%),.:;?]}]/;
25
26
  var regexCannotEndKoKr = /[$([{£¥'"々〇〉》」〔$([{⦆¥₩#]/;
26
- var regexCannotStart = new RegExp(regexCannotStartZhCn.source + "|" + regexCannotStartZhTw.source + "|" + regexCannotStartJaJp.source + "|" + regexCannotStartKoKr.source);
27
- var regexCannotEnd = new RegExp(regexCannotEndZhCn.source + "|" + regexCannotEndZhTw.source + "|" + regexCannotEndJaJp.source + "|" + regexCannotEndKoKr.source);
27
+ var regexCannotStart = new RegExp("".concat(regexCannotStartZhCn.source, "|").concat(regexCannotStartZhTw.source, "|").concat(regexCannotStartJaJp.source, "|").concat(regexCannotStartKoKr.source));
28
+ var regexCannotEnd = new RegExp("".concat(regexCannotEndZhCn.source, "|").concat(regexCannotEndZhTw.source, "|").concat(regexCannotEndJaJp.source, "|").concat(regexCannotEndKoKr.source));
28
29
 
29
- var TextService = function () {
30
+ var TextService =
31
+ /** @class */
32
+ function () {
30
33
  function TextService() {
31
34
  var _this = this;
32
35
 
@@ -3,7 +3,9 @@ import { singleton } from 'mana-syringe';
3
3
  import { GeometryAABBUpdater } from './interfaces';
4
4
  import { Shape } from '../../types';
5
5
 
6
- var CircleUpdater = function () {
6
+ var CircleUpdater =
7
+ /** @class */
8
+ function () {
7
9
  function CircleUpdater() {}
8
10
 
9
11
  CircleUpdater.prototype.update = function (parsedStyle, object) {
@@ -3,7 +3,9 @@ import { singleton } from 'mana-syringe';
3
3
  import { GeometryAABBUpdater } from './interfaces';
4
4
  import { Shape } from '../../types';
5
5
 
6
- var EllipseUpdater = function () {
6
+ var EllipseUpdater =
7
+ /** @class */
8
+ function () {
7
9
  function EllipseUpdater() {}
8
10
 
9
11
  EllipseUpdater.prototype.update = function (parsedStyle, object) {
@@ -3,7 +3,9 @@ import { singleton } from 'mana-syringe';
3
3
  import { GeometryAABBUpdater } from './interfaces';
4
4
  import { Shape } from '../../types';
5
5
 
6
- var LineUpdater = function () {
6
+ var LineUpdater =
7
+ /** @class */
8
+ function () {
7
9
  function LineUpdater() {}
8
10
 
9
11
  LineUpdater.prototype.update = function (parsedStyle) {
@@ -3,7 +3,9 @@ import { singleton } from 'mana-syringe';
3
3
  import { GeometryAABBUpdater } from './interfaces';
4
4
  import { Shape } from '../../types';
5
5
 
6
- var PathUpdater = function () {
6
+ var PathUpdater =
7
+ /** @class */
8
+ function () {
7
9
  function PathUpdater() {}
8
10
 
9
11
  PathUpdater.prototype.update = function (parsedStyle) {
@@ -3,7 +3,9 @@ import { singleton } from 'mana-syringe';
3
3
  import { GeometryAABBUpdater } from './interfaces';
4
4
  import { Shape } from '../../types';
5
5
 
6
- var PolylineUpdater = function () {
6
+ var PolylineUpdater =
7
+ /** @class */
8
+ function () {
7
9
  function PolylineUpdater() {}
8
10
 
9
11
  PolylineUpdater.prototype.update = function (parsedStyle) {
@@ -1,11 +1,13 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { singleton } from 'mana-syringe';
3
- import { isString } from '@antv/util';
3
+ import { isString } from 'lodash-es';
4
4
  import { GeometryAABBUpdater } from './interfaces';
5
5
  import { Shape } from '../../types';
6
6
  import { CSSUnitValue, UnitType } from '../../css';
7
7
 
8
- var RectUpdater = function () {
8
+ var RectUpdater =
9
+ /** @class */
10
+ function () {
9
11
  function RectUpdater() {}
10
12
 
11
13
  RectUpdater.prototype.update = function (parsedStyle, object) {
@@ -1,6 +1,5 @@
1
1
  import { GeometryAABBUpdater } from './interfaces';
2
- import type { ParsedTextStyleProps } from '../../display-objects/Text';
3
- import type { DisplayObject } from '../..';
2
+ import type { DisplayObject, ParsedTextStyleProps } from '../../display-objects';
4
3
  export declare class TextUpdater implements GeometryAABBUpdater<ParsedTextStyleProps> {
5
4
  private textService;
6
5
  private isReadyToMeasure;
@@ -6,7 +6,9 @@ import { TextService } from '../TextService';
6
6
  import { Shape } from '../../types';
7
7
  import { CSSUnitValue } from '../../css';
8
8
 
9
- var TextUpdater = function () {
9
+ var TextUpdater =
10
+ /** @class */
11
+ function () {
10
12
  function TextUpdater() {}
11
13
 
12
14
  TextUpdater.prototype.isReadyToMeasure = function (parsedStyle, object) {
package/es/shapes/AABB.js CHANGED
@@ -5,7 +5,9 @@ import { vec3 } from 'gl-matrix';
5
5
  * @see https://github.com/antvis/GWebGPUEngine/issues/3
6
6
  */
7
7
 
8
- var AABB = function () {
8
+ var AABB =
9
+ /** @class */
10
+ function () {
9
11
  function AABB(center, halfExtents) {
10
12
  this.min = vec3.create();
11
13
  this.max = vec3.create();
@@ -1,7 +1,9 @@
1
1
  import { vec3 } from 'gl-matrix';
2
2
  var tmpVecA = vec3.create();
3
3
 
4
- var BoundingSphere = function () {
4
+ var BoundingSphere =
5
+ /** @class */
6
+ function () {
5
7
  function BoundingSphere(center, radius) {
6
8
  this.center = center || vec3.create();
7
9
  this.radius = radius || 0.5;
@@ -9,7 +9,9 @@ export var Mask;
9
9
  Mask[Mask["INDETERMINATE"] = 2147483647] = "INDETERMINATE";
10
10
  })(Mask || (Mask = {}));
11
11
 
12
- var Frustum = function () {
12
+ var Frustum =
13
+ /** @class */
14
+ function () {
13
15
  function Frustum(planes) {
14
16
  this.planes = [];
15
17
 
@@ -1,6 +1,8 @@
1
1
  import { vec3 } from 'gl-matrix';
2
2
 
3
- var Plane = function () {
3
+ var Plane =
4
+ /** @class */
5
+ function () {
4
6
  function Plane(distance, normal) {
5
7
  this.distance = distance || 0;
6
8
  this.normal = normal || vec3.fromValues(0, 1, 0);
@@ -1,4 +1,6 @@
1
- var Point = function () {
1
+ var Point =
2
+ /** @class */
3
+ function () {
2
4
  function Point(x, y) {
3
5
  if (x === void 0) {
4
6
  x = 0;
package/es/shapes/Ray.js CHANGED
@@ -11,7 +11,9 @@ var tmpVecE = vec3.create();
11
11
  * @see https://github.com/mrdoob/three.js/blob/dev/src/math/Ray.js
12
12
  */
13
13
 
14
- var Ray = function () {
14
+ var Ray =
15
+ /** @class */
16
+ function () {
15
17
  function Ray(origin, direction) {
16
18
  this.origin = origin || vec3.create();
17
19
  this.direction = direction || vec3.fromValues(0, 0, -1);
@@ -1,4 +1,6 @@
1
- var Rectangle = function () {
1
+ var Rectangle =
2
+ /** @class */
3
+ function () {
2
4
  function Rectangle(x, y, width, height) {
3
5
  this.x = x;
4
6
  this.y = y;
package/es/types.d.ts CHANGED
@@ -120,6 +120,10 @@ export interface BaseStyleProps {
120
120
  opacity?: number;
121
121
  /** 线宽 */
122
122
  lineWidth?: string | number;
123
+ /**
124
+ * 交互区域
125
+ */
126
+ hitArea?: DisplayObject | null;
123
127
  /** 指定如何绘制每一条线段末端 */
124
128
  lineCap?: CanvasLineCap;
125
129
  /** 用来设置2个长度不为0的相连部分(线段,圆弧,曲线)如何连接在一起的属性(长度为0的变形部分,其指定的末端和控制点在同一位置,会被忽略) */
@@ -6,7 +6,7 @@ import { __read } from "tslib";
6
6
  import { bezier } from './bezier-easing';
7
7
  export var convertToDash = function convertToDash(str) {
8
8
  str = str.replace(/([A-Z])/g, function (letter) {
9
- return "-" + letter.toLowerCase();
9
+ return "-".concat(letter.toLowerCase());
10
10
  }); // Remove first dash
11
11
 
12
12
  return str.charAt(0) === '-' ? str.substr(1) : str;
@@ -1,6 +1,6 @@
1
1
  import type { quat, vec2, vec4 } from 'gl-matrix';
2
2
  import { mat3, mat4, vec3 } from 'gl-matrix';
3
- export declare function getAngle(angle: number | undefined): number;
3
+ export declare function getAngle(angle?: number): number;
4
4
  export declare function createVec3(x: number | vec2 | vec3 | vec4, y?: number, z?: number): vec3;
5
5
  export declare function deg2rad(deg: number): number;
6
6
  export declare function rad2deg(rad: number): number;
@@ -25,5 +25,4 @@ export declare function getRotationInRadians(mat: mat3): number;
25
25
  export declare function getEuler(out: vec3, quat: quat | mat4): vec3;
26
26
  export declare function fromRotationTranslationScale(rotation: number, x: number, y: number, scaleX: number, scaleY: number): mat3;
27
27
  export declare function makePerspective(out: mat4, left: number, right: number, top: number, bottom: number, near: number, far: number): mat4;
28
- export declare function blend(from: number, to: number, progress: number): number;
29
28
  export declare function decompose(mat: mat3): number[];
package/es/utils/math.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { __read } from "tslib";
2
- import { isNumber } from '@antv/util';
2
+ import { isArray, isNumber } from 'lodash-es';
3
3
  import { mat3, mat4, vec3 } from 'gl-matrix';
4
4
  export function getAngle(angle) {
5
5
  if (angle === undefined) {
@@ -11,15 +11,23 @@ export function getAngle(angle) {
11
11
  return angle;
12
12
  }
13
13
  export function createVec3(x, y, z) {
14
+ if (y === void 0) {
15
+ y = 0;
16
+ }
17
+
18
+ if (z === void 0) {
19
+ z = 0;
20
+ }
21
+
14
22
  if (isNumber(x)) {
15
23
  return vec3.fromValues(x, y, z);
16
24
  }
17
25
 
18
- if (x.length === 3) {
26
+ if (isArray(x) && x.length === 3) {
19
27
  return vec3.clone(x);
20
28
  }
21
29
 
22
- return vec3.fromValues(x[0], x[1], x[2] || 0);
30
+ return vec3.fromValues(x[0], x[1] || y, x[2] || z);
23
31
  }
24
32
  export function deg2rad(deg) {
25
33
  return deg * (Math.PI / 180);
@@ -178,9 +186,6 @@ export function makePerspective(out, left, right, top, bottom, near, far) {
178
186
  out[15] = 0;
179
187
  return out;
180
188
  }
181
- export function blend(from, to, progress) {
182
- return from + (to - from) * progress;
183
- }
184
189
  export function decompose(mat) {
185
190
  var row0x = mat[0];
186
191
  var row0y = mat[3];
@@ -1,11 +1,11 @@
1
- import type { DisplayObject } from '../display-objects/DisplayObject';
1
+ import type { DisplayObject } from '../display-objects';
2
2
  import type { 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/es/utils/path.js CHANGED
@@ -216,7 +216,7 @@ function commandsToPathString(commands, localTransform, anchor, parsedStyle) {
216
216
  if (cur[0] === 'M' || cur[0] === 'L') {
217
217
  var p = vec3.fromValues(cur[1] - defX, cur[2] - defY, 0);
218
218
  vec3.transformMat4(p, p, localTransform);
219
- path = "" + cur[0] + p[0] + "," + p[1];
219
+ path = "".concat(cur[0]).concat(p[0], ",").concat(p[1]);
220
220
  } else if (cur[0] === 'Z') {
221
221
  path = cur[0];
222
222
  } else if (cur[0] === 'C') {
@@ -226,11 +226,11 @@ function commandsToPathString(commands, localTransform, anchor, parsedStyle) {
226
226
  vec3.transformMat4(p1, p1, localTransform);
227
227
  vec3.transformMat4(p2, p2, localTransform);
228
228
  vec3.transformMat4(p3, p3, localTransform);
229
- path = "" + cur[0] + p1[0] + "," + p1[1] + "," + p2[0] + "," + p2[1] + "," + p3[0] + "," + p3[1];
229
+ path = "".concat(cur[0]).concat(p1[0], ",").concat(p1[1], ",").concat(p2[0], ",").concat(p2[1], ",").concat(p3[0], ",").concat(p3[1]);
230
230
  } else if (cur[0] === 'A') {
231
231
  var c = vec3.fromValues(cur[6] - defX, cur[7] - defY, 0);
232
232
  vec3.transformMat4(c, c, localTransform);
233
- path = "" + cur[0] + cur[1] + "," + cur[2] + "," + cur[3] + "," + cur[4] + "," + cur[5] + "," + c[0] + "," + c[1];
233
+ 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]);
234
234
  }
235
235
 
236
236
  return prev += path;
package/es/utils/text.js CHANGED
@@ -1,4 +1,4 @@
1
- import { isNumber, isString } from '@antv/util';
1
+ import { isNumber, isString } from 'lodash-es';
2
2
  var genericFontFamilies = ['serif', 'sans-serif', 'monospace', 'cursive', 'fantasy', 'system-ui'];
3
3
  export function toFontString(attributes) {
4
4
  var fontSize = attributes.fontSize,
@@ -7,7 +7,7 @@ export function toFontString(attributes) {
7
7
  fontVariant = attributes.fontVariant,
8
8
  fontWeight = attributes.fontWeight; // build canvas api font setting from individual components. Convert a numeric this.fontSize to px
9
9
 
10
- var fontSizeString = isNumber(fontSize) ? fontSize + "px" : fontSize.toString(); // Clean-up fontFamily property by quoting each font name
10
+ var fontSizeString = isNumber(fontSize) ? "".concat(fontSize, "px") : fontSize.toString(); // Clean-up fontFamily property by quoting each font name
11
11
  // this will support font names with spaces
12
12
  // @ts-ignore
13
13
 
@@ -18,11 +18,11 @@ export function toFontString(attributes) {
18
18
  var fontFamily_1 = fontFamilies[i].trim(); // Check if font already contains strings
19
19
 
20
20
  if (!/([\"\'])[^\'\"]+\1/.test(fontFamily_1) && genericFontFamilies.indexOf(fontFamily_1) < 0) {
21
- fontFamily_1 = "\"" + fontFamily_1 + "\"";
21
+ fontFamily_1 = "\"".concat(fontFamily_1, "\"");
22
22
  }
23
23
 
24
24
  fontFamilies[i] = fontFamily_1;
25
25
  }
26
26
 
27
- return fontStyle + " " + fontVariant + " " + fontWeight + " " + fontSizeString + " " + fontFamilies.join(',');
27
+ return "".concat(fontStyle, " ").concat(fontVariant, " ").concat(fontWeight, " ").concat(fontSizeString, " ").concat(fontFamilies.join(','));
28
28
  }
@@ -7,7 +7,9 @@ exports.AbstractRenderer = void 0;
7
7
 
8
8
  var _tslib = require("tslib");
9
9
 
10
- var AbstractRenderer = function () {
10
+ var AbstractRenderer =
11
+ /** @class */
12
+ function () {
11
13
  function AbstractRenderer(config) {
12
14
  this.plugins = [];
13
15
  this.config = (0, _tslib.__assign)({
package/lib/Canvas.d.ts CHANGED
@@ -96,7 +96,7 @@ export declare class Canvas extends EventTarget implements ICanvas {
96
96
  * get the root displayObject in scenegraph
97
97
  * @alias this.document.documentElement
98
98
  */
99
- getRoot(): import(".").Group;
99
+ getRoot(): import("./display-objects").Group;
100
100
  /**
101
101
  * get the camera of canvas
102
102
  */
@@ -107,9 +107,6 @@ export declare class Canvas extends EventTarget implements ICanvas {
107
107
  getRenderingContext(): RenderingContext;
108
108
  getStats(): {
109
109
  total: number;
110
- /**
111
- * window.document
112
- */
113
110
  rendered: number;
114
111
  renderedOnscreen: number;
115
112
  };
package/lib/Canvas.js CHANGED
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.Canvas = exports.CanvasEvent = void 0;
6
+ exports.CanvasEvent = exports.Canvas = void 0;
7
7
 
8
8
  var _tslib = require("tslib");
9
9
 
@@ -54,7 +54,9 @@ exports.CanvasEvent = CanvasEvent;
54
54
  */
55
55
 
56
56
 
57
- var Canvas = function (_super) {
57
+ var Canvas =
58
+ /** @class */
59
+ function (_super) {
58
60
  (0, _tslib.__extends)(Canvas, _super);
59
61
 
60
62
  function Canvas(config) {
@@ -313,7 +315,7 @@ var Canvas = function (_super) {
313
315
  var projectionMode = camera.getProjectionMode();
314
316
  camera.setPosition(width / 2, height / 2, 500).setFocalPoint(width / 2, height / 2, 0);
315
317
 
316
- if (projectionMode === _camera.CAMERA_PROJECTION_MODE.ORTHOGRAPHIC) {
318
+ if (projectionMode === _camera.CameraProjectionMode.ORTHOGRAPHIC) {
317
319
  camera.setOrthographic(width / -2, width / 2, height / 2, height / -2, camera.getNear(), camera.getFar());
318
320
  } else {
319
321
  camera.setAspect(width / height);
@@ -9,7 +9,9 @@ var _tslib = require("tslib");
9
9
 
10
10
  var _manaSyringe = require("mana-syringe");
11
11
 
12
- var DisplayObjectPool = function () {
12
+ var DisplayObjectPool =
13
+ /** @class */
14
+ function () {
13
15
  function DisplayObjectPool() {
14
16
  this.pool = {};
15
17
  }