@antv/g 5.0.16 → 5.0.17

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 (188) hide show
  1. package/es/AbstractRenderer.js +1 -3
  2. package/es/Canvas.js +1 -3
  3. package/es/DisplayObjectPool.js +1 -3
  4. package/es/camera/Camera.js +1 -3
  5. package/es/camera/Landmark.js +1 -3
  6. package/es/components/Cullable.js +1 -3
  7. package/es/components/Geometry.js +1 -3
  8. package/es/components/Renderable.js +1 -3
  9. package/es/components/Sortable.js +1 -3
  10. package/es/components/Transform.js +1 -3
  11. package/es/display-objects/Circle.js +1 -3
  12. package/es/display-objects/CustomElement.js +1 -3
  13. package/es/display-objects/DisplayObject.d.ts +5 -0
  14. package/es/display-objects/DisplayObject.js +23 -6
  15. package/es/display-objects/Ellipse.js +1 -3
  16. package/es/display-objects/Group.js +1 -3
  17. package/es/display-objects/HTML.js +3 -6
  18. package/es/display-objects/Image.js +1 -3
  19. package/es/display-objects/Line.js +1 -3
  20. package/es/display-objects/Path.js +1 -3
  21. package/es/display-objects/Polygon.js +1 -3
  22. package/es/display-objects/Polyline.js +1 -3
  23. package/es/display-objects/Rect.js +1 -3
  24. package/es/display-objects/TSpan.d.ts +1 -0
  25. package/es/display-objects/TSpan.js +0 -0
  26. package/es/display-objects/Text.d.ts +23 -0
  27. package/es/display-objects/Text.js +56 -4
  28. package/es/dom/Animation.js +3 -5
  29. package/es/dom/AnimationEffectTiming.js +1 -3
  30. package/es/dom/AnimationEvent.js +1 -3
  31. package/es/dom/AnimationTimeline.js +1 -3
  32. package/es/dom/CustomElementRegistry.js +1 -3
  33. package/es/dom/CustomEvent.js +1 -3
  34. package/es/dom/Document.d.ts +1 -1
  35. package/es/dom/Document.js +3 -5
  36. package/es/dom/Element.d.ts +22 -0
  37. package/es/dom/Element.js +68 -6
  38. package/es/dom/EventTarget.js +3 -5
  39. package/es/dom/FederatedEvent.d.ts +5 -2
  40. package/es/dom/FederatedEvent.js +1 -3
  41. package/es/dom/FederatedMouseEvent.js +1 -3
  42. package/es/dom/FederatedPointerEvent.js +1 -3
  43. package/es/dom/FederatedWheelEvent.js +1 -3
  44. package/es/dom/KeyframeEffect.js +1 -3
  45. package/es/dom/KeyframeList.js +1 -1
  46. package/es/dom/MutationEvent.js +1 -3
  47. package/es/dom/MutationObserver.js +3 -10
  48. package/es/dom/MutationRecord.js +1 -3
  49. package/es/dom/Node.js +2 -4
  50. package/es/plugins/CullingPlugin.js +1 -3
  51. package/es/plugins/DirtyCheckPlugin.js +1 -3
  52. package/es/plugins/EventPlugin.d.ts +2 -1
  53. package/es/plugins/EventPlugin.js +16 -8
  54. package/es/plugins/FrustumCullingStrategy.js +1 -3
  55. package/es/plugins/PrepareRendererPlugin.js +1 -3
  56. package/es/property-handlers/color.js +2 -2
  57. package/es/property-handlers/dimension.js +1 -1
  58. package/es/property-handlers/path.d.ts +1 -1
  59. package/es/property-handlers/text.js +1 -1
  60. package/es/services/EventService.js +3 -5
  61. package/es/services/RenderingService.js +1 -3
  62. package/es/services/SceneGraphSelector.js +1 -3
  63. package/es/services/SceneGraphService.js +1 -3
  64. package/es/services/aabb/CircleUpdater.js +1 -3
  65. package/es/services/aabb/EllipseUpdater.js +1 -3
  66. package/es/services/aabb/LineUpdater.js +1 -3
  67. package/es/services/aabb/PathUpdater.js +1 -3
  68. package/es/services/aabb/PolylineUpdater.js +1 -3
  69. package/es/services/aabb/RectUpdater.js +1 -3
  70. package/es/services/aabb/TextUpdater.js +1 -3
  71. package/es/services/text/OffscreenCanvasCreator.js +1 -3
  72. package/es/services/text/index.js +3 -5
  73. package/es/shapes/AABB.js +1 -3
  74. package/es/shapes/BoundingSphere.js +1 -3
  75. package/es/shapes/Frustum.js +1 -3
  76. package/es/shapes/Plane.js +1 -3
  77. package/es/shapes/Point.js +1 -3
  78. package/es/shapes/Polygon.js +1 -3
  79. package/es/shapes/Ray.js +1 -3
  80. package/es/shapes/Rect.js +1 -3
  81. package/es/shapes/Rectangle.js +1 -3
  82. package/es/utils/animation.js +1 -1
  83. package/es/utils/custom-easing.js +1 -1
  84. package/es/utils/path.d.ts +1 -1
  85. package/es/utils/path.js +3 -3
  86. package/es/utils/text.js +3 -3
  87. package/lib/AbstractRenderer.js +1 -3
  88. package/lib/Canvas.js +2 -4
  89. package/lib/DisplayObjectPool.js +1 -3
  90. package/lib/camera/Camera.js +2 -4
  91. package/lib/camera/Landmark.js +1 -3
  92. package/lib/components/Cullable.js +2 -4
  93. package/lib/components/Geometry.js +1 -3
  94. package/lib/components/Renderable.js +1 -3
  95. package/lib/components/Sortable.js +1 -3
  96. package/lib/components/Transform.js +1 -3
  97. package/lib/display-objects/Circle.js +1 -3
  98. package/lib/display-objects/CustomElement.js +1 -3
  99. package/lib/display-objects/DisplayObject.d.ts +5 -0
  100. package/lib/display-objects/DisplayObject.js +24 -6
  101. package/lib/display-objects/Ellipse.js +1 -3
  102. package/lib/display-objects/Group.js +1 -3
  103. package/lib/display-objects/HTML.js +4 -6
  104. package/lib/display-objects/Image.js +1 -3
  105. package/lib/display-objects/Line.js +1 -3
  106. package/lib/display-objects/Path.js +1 -3
  107. package/lib/display-objects/Polygon.js +1 -3
  108. package/lib/display-objects/Polyline.js +1 -3
  109. package/lib/display-objects/Rect.js +1 -3
  110. package/lib/display-objects/TSpan.d.ts +1 -0
  111. package/lib/display-objects/TSpan.js +1 -0
  112. package/lib/display-objects/Text.d.ts +23 -0
  113. package/lib/display-objects/Text.js +57 -4
  114. package/lib/dom/Animation.js +3 -5
  115. package/lib/dom/AnimationEffectTiming.js +1 -3
  116. package/lib/dom/AnimationEvent.js +1 -3
  117. package/lib/dom/AnimationTimeline.js +2 -4
  118. package/lib/dom/CustomElementRegistry.js +1 -3
  119. package/lib/dom/CustomEvent.js +1 -3
  120. package/lib/dom/Document.d.ts +1 -1
  121. package/lib/dom/Document.js +4 -6
  122. package/lib/dom/Element.d.ts +22 -0
  123. package/lib/dom/Element.js +68 -6
  124. package/lib/dom/EventTarget.js +3 -5
  125. package/lib/dom/FederatedEvent.d.ts +5 -2
  126. package/lib/dom/FederatedEvent.js +1 -3
  127. package/lib/dom/FederatedMouseEvent.js +1 -3
  128. package/lib/dom/FederatedPointerEvent.js +1 -3
  129. package/lib/dom/FederatedWheelEvent.js +1 -3
  130. package/lib/dom/KeyframeEffect.js +2 -4
  131. package/lib/dom/KeyframeList.js +1 -1
  132. package/lib/dom/MutationEvent.js +1 -3
  133. package/lib/dom/MutationObserver.js +4 -11
  134. package/lib/dom/MutationRecord.js +1 -3
  135. package/lib/dom/Node.js +2 -4
  136. package/lib/global-module.js +2 -3
  137. package/lib/index.js +1 -1
  138. package/lib/plugins/CullingPlugin.js +2 -4
  139. package/lib/plugins/DirtyCheckPlugin.js +1 -3
  140. package/lib/plugins/EventPlugin.d.ts +2 -1
  141. package/lib/plugins/EventPlugin.js +14 -8
  142. package/lib/plugins/FrustumCullingStrategy.js +1 -3
  143. package/lib/plugins/PrepareRendererPlugin.js +1 -3
  144. package/lib/property-handlers/color.js +5 -5
  145. package/lib/property-handlers/dimension.js +5 -6
  146. package/lib/property-handlers/inherit.js +1 -1
  147. package/lib/property-handlers/interfaces.js +1 -1
  148. package/lib/property-handlers/numeric.js +3 -3
  149. package/lib/property-handlers/path.d.ts +1 -1
  150. package/lib/property-handlers/path.js +1 -1
  151. package/lib/property-handlers/text.js +1 -1
  152. package/lib/property-handlers/transform.js +1 -1
  153. package/lib/services/EventService.js +3 -5
  154. package/lib/services/RenderingService.js +1 -3
  155. package/lib/services/SceneGraphSelector.js +2 -4
  156. package/lib/services/SceneGraphService.js +3 -5
  157. package/lib/services/aabb/CircleUpdater.js +1 -3
  158. package/lib/services/aabb/EllipseUpdater.js +1 -3
  159. package/lib/services/aabb/LineUpdater.js +1 -3
  160. package/lib/services/aabb/PathUpdater.js +1 -3
  161. package/lib/services/aabb/PolylineUpdater.js +1 -3
  162. package/lib/services/aabb/RectUpdater.js +1 -3
  163. package/lib/services/aabb/TextUpdater.js +1 -3
  164. package/lib/services/aabb/index.js +10 -10
  165. package/lib/services/aabb/interfaces.js +1 -1
  166. package/lib/services/text/OffscreenCanvasCreator.js +1 -3
  167. package/lib/services/text/index.js +3 -5
  168. package/lib/shapes/AABB.js +1 -3
  169. package/lib/shapes/BoundingSphere.js +1 -3
  170. package/lib/shapes/Frustum.js +2 -4
  171. package/lib/shapes/Plane.js +1 -3
  172. package/lib/shapes/Point.js +1 -3
  173. package/lib/shapes/Polygon.js +1 -3
  174. package/lib/shapes/Ray.js +1 -3
  175. package/lib/shapes/Rect.js +1 -3
  176. package/lib/shapes/Rectangle.js +1 -3
  177. package/lib/types.js +1 -1
  178. package/lib/utils/animation.js +3 -4
  179. package/lib/utils/bezier-easing.js +1 -1
  180. package/lib/utils/custom-easing.js +2 -2
  181. package/lib/utils/event.js +2 -3
  182. package/lib/utils/math.js +5 -5
  183. package/lib/utils/path.d.ts +1 -1
  184. package/lib/utils/path.js +6 -6
  185. package/lib/utils/raf.js +1 -2
  186. package/lib/utils/text.js +3 -3
  187. package/package.json +2 -2
  188. package/dist/index.umd.min.js +0 -31
@@ -1,8 +1,6 @@
1
1
  import { __assign } from "tslib";
2
2
 
3
- var AbstractRenderer =
4
- /** @class */
5
- function () {
3
+ var AbstractRenderer = function () {
6
4
  function AbstractRenderer(config) {
7
5
  this.plugins = [];
8
6
  this.config = __assign({
package/es/Canvas.js CHANGED
@@ -29,9 +29,7 @@ export var CanvasEvent;
29
29
  */
30
30
 
31
31
 
32
- var Canvas =
33
- /** @class */
34
- function (_super) {
32
+ var Canvas = function (_super) {
35
33
  __extends(Canvas, _super);
36
34
 
37
35
  function Canvas(config) {
@@ -1,9 +1,7 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { singleton } from 'mana-syringe';
3
3
 
4
- var DisplayObjectPool =
5
- /** @class */
6
- function () {
4
+ var DisplayObjectPool = function () {
7
5
  function DisplayObjectPool() {
8
6
  this.pool = {};
9
7
  }
@@ -44,9 +44,7 @@ var RAD_2_DEG = 180 / Math.PI;
44
44
  * 4. 移动到 Landmark,具有平滑的动画效果,其间禁止其他用户交互
45
45
  */
46
46
 
47
- var Camera =
48
- /** @class */
49
- function (_super) {
47
+ var Camera = function (_super) {
50
48
  __extends(Camera, _super);
51
49
 
52
50
  function Camera() {
@@ -3,9 +3,7 @@ import { mat4, vec3 } from 'gl-matrix';
3
3
  * 保存相机状态,便于后续在多个 Landmark 间移动
4
4
  */
5
5
 
6
- var Landmark =
7
- /** @class */
8
- function () {
6
+ var Landmark = function () {
9
7
  // private zoom = 1;
10
8
  function Landmark(name, c) {
11
9
  this.azimuth = 0;
@@ -7,9 +7,7 @@ export var Strategy;
7
7
  Strategy[Strategy["Standard"] = 0] = "Standard";
8
8
  })(Strategy || (Strategy = {}));
9
9
 
10
- var Cullable =
11
- /** @class */
12
- function () {
10
+ var Cullable = function () {
13
11
  function Cullable() {
14
12
  this.strategy = Strategy.Standard;
15
13
  this.visibilityPlaneMask = -1;
@@ -1,6 +1,4 @@
1
- var Geometry =
2
- /** @class */
3
- function () {
1
+ var Geometry = function () {
4
2
  function Geometry() {}
5
3
 
6
4
  Geometry.tag = 'c-geometry';
@@ -1,6 +1,4 @@
1
- var Renderable =
2
- /** @class */
3
- function () {
1
+ var Renderable = function () {
4
2
  function Renderable() {
5
3
  this.boundsDirty = true;
6
4
  this.renderBoundsDirty = true;
@@ -1,6 +1,4 @@
1
- var Sortable =
2
- /** @class */
3
- function () {
1
+ var Sortable = function () {
4
2
  function Sortable() {
5
3
  /**
6
4
  * need to re-sort
@@ -3,9 +3,7 @@ import { mat4, quat, vec3 } from 'gl-matrix';
3
3
  * do RTS transformation for 2D/3D
4
4
  */
5
5
 
6
- var Transform =
7
- /** @class */
8
- function () {
6
+ var Transform = function () {
9
7
  function Transform() {
10
8
  this.dirtyFlag = false;
11
9
  this.localDirtyFlag = false;
@@ -2,9 +2,7 @@ import { __assign, __extends, __rest } from "tslib";
2
2
  import { Shape } from '../types';
3
3
  import { DisplayObject } from './DisplayObject';
4
4
 
5
- var Circle =
6
- /** @class */
7
- function (_super) {
5
+ var Circle = function (_super) {
8
6
  __extends(Circle, _super);
9
7
 
10
8
  function Circle(_a) {
@@ -6,9 +6,7 @@ import { ElementEvent } from '../dom/interfaces';
6
6
  * @see https://yuque.antfin-inc.com/antv/czqvg5/pgqipg
7
7
  */
8
8
 
9
- var CustomElement =
10
- /** @class */
11
- function (_super) {
9
+ var CustomElement = function (_super) {
12
10
  __extends(CustomElement, _super); // private shadowNodes: DisplayObject[] = [];
13
11
 
14
12
 
@@ -48,6 +48,11 @@ export declare class DisplayObject<StyleProps extends BaseStyleProps = any, Pars
48
48
  * called when attributes get changed or initialized
49
49
  */
50
50
  private changeAttribute;
51
+ /**
52
+ * returns different values than getBoundingClientRect(), as the latter returns value relative to the viewport
53
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/SVGGraphicsElement/getBBox
54
+ */
55
+ getBBox(): DOMRect;
51
56
  setOrigin(position: vec3 | vec2 | number, y?: number, z?: number): this;
52
57
  getOrigin(): vec3;
53
58
  /**
@@ -10,6 +10,7 @@ import { createVec3, formatAttribute, fromRotationTranslationScale, getEuler, ra
10
10
  import { globalContainer, stylePropertyParserFactory, stylePropertyUpdaterFactory } from '../global-module';
11
11
  import { dirtifyToRoot } from '../services';
12
12
  import { MutationEvent } from '../dom/MutationEvent';
13
+ import { Rectangle } from '../shapes';
13
14
  var DEFAULT_STYLE_PROPS = {
14
15
  anchor: [0, 0, 0],
15
16
  origin: [0, 0, 0],
@@ -38,21 +39,18 @@ var DEFAULT_STYLE_PROPS = {
38
39
  * * attributeChanged
39
40
  */
40
41
 
41
- var DisplayObject =
42
- /** @class */
43
- function (_super) {
42
+ var DisplayObject = function (_super) {
44
43
  __extends(DisplayObject, _super);
45
44
 
46
45
  function DisplayObject(config) {
47
- var _this = this;
48
-
49
46
  var _a, _b, _c;
50
47
 
51
- _this = _super.call(this) || this;
48
+ var _this = _super.call(this) || this;
52
49
  /**
53
50
  * push to active animations after calling `animate()`
54
51
  */
55
52
 
53
+
56
54
  _this.activeAnimations = []; // assign name, id to config
57
55
  // eg. group.get('name')
58
56
 
@@ -281,6 +279,25 @@ function (_super) {
281
279
  // });
282
280
  }; // #region transformable
283
281
 
282
+ /**
283
+ * returns different values than getBoundingClientRect(), as the latter returns value relative to the viewport
284
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/SVGGraphicsElement/getBBox
285
+ */
286
+
287
+
288
+ DisplayObject.prototype.getBBox = function () {
289
+ var aabb = this.getBounds();
290
+
291
+ var _a = __read(aabb.getMin(), 2),
292
+ left = _a[0],
293
+ top = _a[1];
294
+
295
+ var _b = __read(aabb.getMax(), 2),
296
+ right = _b[0],
297
+ bottom = _b[1];
298
+
299
+ return new Rectangle(left, top, right - left, bottom - top);
300
+ };
284
301
 
285
302
  DisplayObject.prototype.setOrigin = function (position, y, z) {
286
303
  if (y === void 0) {
@@ -2,9 +2,7 @@ import { __assign, __extends, __rest } from "tslib";
2
2
  import { Shape } from '../types';
3
3
  import { DisplayObject } from './DisplayObject';
4
4
 
5
- var Ellipse =
6
- /** @class */
7
- function (_super) {
5
+ var Ellipse = function (_super) {
8
6
  __extends(Ellipse, _super);
9
7
 
10
8
  function Ellipse(_a) {
@@ -2,9 +2,7 @@ import { __assign, __extends, __rest } from "tslib";
2
2
  import { Shape } from '../types';
3
3
  import { DisplayObject } from './DisplayObject';
4
4
 
5
- var Group =
6
- /** @class */
7
- function (_super) {
5
+ var Group = function (_super) {
8
6
  __extends(Group, _super);
9
7
 
10
8
  function Group(_a) {
@@ -8,9 +8,7 @@ import { mat4, vec3 } from 'gl-matrix';
8
8
  * @see https://github.com/pmndrs/drei#html
9
9
  */
10
10
 
11
- var HTML =
12
- /** @class */
13
- function (_super) {
11
+ var HTML = function (_super) {
14
12
  __extends(HTML, _super);
15
13
 
16
14
  function HTML(_a) {
@@ -18,12 +16,10 @@ function (_super) {
18
16
  _a = {};
19
17
  }
20
18
 
21
- var _this = this;
22
-
23
19
  var style = _a.style,
24
20
  rest = __rest(_a, ["style"]);
25
21
 
26
- _this = _super.call(this, __assign({
22
+ var _this = _super.call(this, __assign({
27
23
  type: Shape.HTML,
28
24
  style: __assign({
29
25
  innerHTML: '',
@@ -31,6 +27,7 @@ function (_super) {
31
27
  style: ''
32
28
  }, style)
33
29
  }, rest)) || this;
30
+
34
31
  _this.cullable.enable = false;
35
32
  return _this;
36
33
  }
@@ -2,9 +2,7 @@ import { __assign, __extends, __rest } from "tslib";
2
2
  import { Shape } from '../types';
3
3
  import { DisplayObject } from './DisplayObject';
4
4
 
5
- var Image =
6
- /** @class */
7
- function (_super) {
5
+ var Image = function (_super) {
8
6
  __extends(Image, _super);
9
7
 
10
8
  function Image(_a) {
@@ -4,9 +4,7 @@ import { Shape, LineCap, LineJoin } from '../types';
4
4
  import { DisplayObject } from './DisplayObject';
5
5
  import { Point } from '../shapes';
6
6
 
7
- var Line =
8
- /** @class */
9
- function (_super) {
7
+ var Line = function (_super) {
10
8
  __extends(Line, _super);
11
9
 
12
10
  function Line(_a) {
@@ -5,9 +5,7 @@ import { Point } from '../shapes';
5
5
  import { Cubic as CubicUtil } from '@antv/g-math';
6
6
  import { isNil } from '@antv/util';
7
7
 
8
- var Path =
9
- /** @class */
10
- function (_super) {
8
+ var Path = function (_super) {
11
9
  __extends(Path, _super);
12
10
 
13
11
  function Path(_a) {
@@ -2,9 +2,7 @@ import { __assign, __extends, __rest } from "tslib";
2
2
  import { Shape } from '../types';
3
3
  import { DisplayObject } from './DisplayObject';
4
4
 
5
- var Polygon =
6
- /** @class */
7
- function (_super) {
5
+ var Polygon = function (_super) {
8
6
  __extends(Polygon, _super);
9
7
 
10
8
  function Polygon(_a) {
@@ -4,9 +4,7 @@ import { Shape, LineCap, LineJoin } from '../types';
4
4
  import { DisplayObject } from './DisplayObject';
5
5
  import { Point } from '../shapes';
6
6
 
7
- var Polyline =
8
- /** @class */
9
- function (_super) {
7
+ var Polyline = function (_super) {
10
8
  __extends(Polyline, _super);
11
9
 
12
10
  function Polyline(_a) {
@@ -2,9 +2,7 @@ import { __assign, __extends, __rest } from "tslib";
2
2
  import { Shape } from '../types';
3
3
  import { DisplayObject } from './DisplayObject';
4
4
 
5
- var Rect =
6
- /** @class */
7
- function (_super) {
5
+ var Rect = function (_super) {
8
6
  __extends(Rect, _super);
9
7
 
10
8
  function Rect(_a) {
@@ -0,0 +1 @@
1
+
File without changes
@@ -62,7 +62,30 @@ export interface ParsedTextStyleProps extends ParsedBaseStyleProps {
62
62
  dx?: ParsedElement;
63
63
  dy?: ParsedElement;
64
64
  }
65
+ /**
66
+ * <text> @see https://developer.mozilla.org/en-US/docs/Web/API/SVGTextElement
67
+ */
65
68
  export declare class Text extends DisplayObject<TextStyleProps, ParsedTextStyleProps> {
69
+ /**
70
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/SVGTextContentElement#constants
71
+ */
72
+ LENGTHADJUST_SPACING: number;
73
+ LENGTHADJUST_SPACINGANDGLYPHS: number;
74
+ LENGTHADJUST_UNKNOWN: number;
66
75
  constructor({ style, ...rest }?: DisplayObjectConfig<TextStyleProps>);
76
+ lengthAdjust: SVGAnimatedEnumeration;
77
+ textLength: SVGAnimatedLength;
78
+ getCharNumAtPosition(point?: DOMPointInit): number;
79
+ /**
80
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/SVGTextContentElement
81
+ */
82
+ getComputedTextLength(): number;
83
+ getEndPositionOfChar(charnum: number): DOMPoint;
84
+ getExtentOfChar(charnum: number): DOMRect;
85
+ getNumberOfChars(): number;
86
+ getRotationOfChar(charnum: number): number;
87
+ getStartPositionOfChar(charnum: number): DOMPoint;
88
+ getSubStringLength(charnum: number, nchars: number): number;
89
+ selectSubString(charnum: number, nchars: number): void;
67
90
  getLineBoundingRects(): import("..").Rectangle[];
68
91
  }
@@ -1,10 +1,11 @@
1
1
  import { __assign, __extends, __rest } from "tslib";
2
2
  import { Shape, LineJoin, LineCap } from '../types';
3
3
  import { DisplayObject } from './DisplayObject';
4
+ /**
5
+ * <text> @see https://developer.mozilla.org/en-US/docs/Web/API/SVGTextElement
6
+ */
4
7
 
5
- var Text =
6
- /** @class */
7
- function (_super) {
8
+ var Text = function (_super) {
8
9
  __extends(Text, _super);
9
10
 
10
11
  function Text(_a) {
@@ -15,7 +16,7 @@ function (_super) {
15
16
  var style = _a.style,
16
17
  rest = __rest(_a, ["style"]);
17
18
 
18
- return _super.call(this, __assign({
19
+ var _this = _super.call(this, __assign({
19
20
  type: Shape.TEXT,
20
21
  style: __assign({
21
22
  text: '',
@@ -48,8 +49,59 @@ function (_super) {
48
49
  dy: 0
49
50
  }, style)
50
51
  }, rest)) || this;
52
+ /**
53
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/SVGTextContentElement#constants
54
+ */
55
+
56
+
57
+ _this.LENGTHADJUST_SPACING = 1;
58
+ _this.LENGTHADJUST_SPACINGANDGLYPHS = 2;
59
+ _this.LENGTHADJUST_UNKNOWN = 0;
60
+ return _this;
51
61
  }
52
62
 
63
+ Text.prototype.getCharNumAtPosition = function (point) {
64
+ throw new Error('Method not implemented.');
65
+ };
66
+ /**
67
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/SVGTextContentElement
68
+ */
69
+
70
+
71
+ Text.prototype.getComputedTextLength = function () {
72
+ var _a;
73
+
74
+ return ((_a = this.parsedStyle.metrics) === null || _a === void 0 ? void 0 : _a.maxLineWidth) || 0;
75
+ };
76
+
77
+ Text.prototype.getEndPositionOfChar = function (charnum) {
78
+ throw new Error('Method not implemented.');
79
+ };
80
+
81
+ Text.prototype.getExtentOfChar = function (charnum) {
82
+ throw new Error('Method not implemented.');
83
+ };
84
+
85
+ Text.prototype.getNumberOfChars = function () {
86
+ throw new Error('Method not implemented.');
87
+ };
88
+
89
+ Text.prototype.getRotationOfChar = function (charnum) {
90
+ throw new Error('Method not implemented.');
91
+ };
92
+
93
+ Text.prototype.getStartPositionOfChar = function (charnum) {
94
+ throw new Error('Method not implemented.');
95
+ };
96
+
97
+ Text.prototype.getSubStringLength = function (charnum, nchars) {
98
+ throw new Error('Method not implemented.');
99
+ };
100
+
101
+ Text.prototype.selectSubString = function (charnum, nchars) {
102
+ throw new Error('Method not implemented.');
103
+ };
104
+
53
105
  Text.prototype.getLineBoundingRects = function () {
54
106
  var _a;
55
107
 
@@ -4,9 +4,7 @@ var sequenceNumber = 0;
4
4
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/Animation
5
5
  */
6
6
 
7
- var Animation =
8
- /** @class */
9
- function () {
7
+ var Animation = function () {
10
8
  function Animation(effect, timeline) {
11
9
  this.currentTimePending = false;
12
10
  /**
@@ -23,7 +21,7 @@ function () {
23
21
  this.effect = effect;
24
22
  effect.animation = this;
25
23
  this.timeline = timeline;
26
- this.id = "".concat(sequenceNumber++);
24
+ this.id = "" + sequenceNumber++;
27
25
  this._inEffect = !!this.effect.update(0);
28
26
  this._holdTime = 0;
29
27
  this._paused = false;
@@ -232,7 +230,7 @@ function () {
232
230
  get: function get() {
233
231
  var _a;
234
232
 
235
- return Number((_a = this.effect) === null || _a === void 0 ? void 0 : _a.getComputedTiming().activeDuration);
233
+ return Number((_a = this.effect) === null || _a === void 0 ? void 0 : _a.getComputedTiming().endTime);
236
234
  },
237
235
  enumerable: false,
238
236
  configurable: true
@@ -3,9 +3,7 @@ import { linear, parseEasingFunction } from '../utils/animation';
3
3
  * @see https://developer.mozilla.org/en-US/docs/Web/API/EffectTiming
4
4
  */
5
5
 
6
- var AnimationEffectTiming =
7
- /** @class */
8
- function () {
6
+ var AnimationEffectTiming = function () {
9
7
  function AnimationEffectTiming() {
10
8
  /**
11
9
  * @see https://developer.mozilla.org/en-US/docs/Web/API/EffectTiming/delay
@@ -4,9 +4,7 @@ import { FederatedEvent } from './FederatedEvent';
4
4
  * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationPlaybackEvent
5
5
  */
6
6
 
7
- var AnimationEvent =
8
- /** @class */
9
- function (_super) {
7
+ var AnimationEvent = function (_super) {
10
8
  __extends(AnimationEvent, _super);
11
9
 
12
10
  function AnimationEvent(manager, target, currentTime, timelineTime) {
@@ -8,9 +8,7 @@ export function compareAnimations(leftAnimation, rightAnimation) {
8
8
  * @see https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/web-animations-js/index.d.ts
9
9
  */
10
10
 
11
- var AnimationTimeline =
12
- /** @class */
13
- function () {
11
+ var AnimationTimeline = function () {
14
12
  function AnimationTimeline() {
15
13
  var _this = this;
16
14
  /**
@@ -6,9 +6,7 @@ import { Ellipse, Circle, Rect, Image, Line, Path, Group, Polygon, Polyline, Tex
6
6
  * @see https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry
7
7
  */
8
8
 
9
- var CustomElementRegistry =
10
- /** @class */
11
- function () {
9
+ var CustomElementRegistry = function () {
12
10
  function CustomElementRegistry() {
13
11
  this.registry = {};
14
12
  this.define(Shape.CIRCLE, Circle);
@@ -13,9 +13,7 @@ import { FederatedEvent } from './FederatedEvent';
13
13
  circle.dispatchEvent(event);
14
14
  */
15
15
 
16
- var CustomEvent =
17
- /** @class */
18
- function (_super) {
16
+ var CustomEvent = function (_super) {
19
17
  __extends(CustomEvent, _super); // eslint-disable-next-line @typescript-eslint/ban-types
20
18
 
21
19
 
@@ -1,6 +1,6 @@
1
1
  import { Node } from './Node';
2
2
  import { AnimationTimeline } from './AnimationTimeline';
3
- import { Group } from '../display-objects/Group';
3
+ import { Group } from '../display-objects';
4
4
  import type { DisplayObject } from '../display-objects/DisplayObject';
5
5
  import type { IDocument, IElement, INode, ICanvas, DisplayObjectConfig } from './interfaces';
6
6
  import type { BaseStyleProps } from '../types';
@@ -1,7 +1,7 @@
1
1
  import { __extends } from "tslib";
2
2
  import { Node } from './Node';
3
3
  import { AnimationTimeline } from './AnimationTimeline';
4
- import { Group } from '../display-objects/Group';
4
+ import { Group, Text } from '../display-objects';
5
5
  import { TextAlign } from '../types';
6
6
  /**
7
7
  * the entry of DOM tree
@@ -9,9 +9,7 @@ import { TextAlign } from '../types';
9
9
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Document
10
10
  */
11
11
 
12
- var Document =
13
- /** @class */
14
- function (_super) {
12
+ var Document = function (_super) {
15
13
  __extends(Document, _super);
16
14
 
17
15
  function Document() {
@@ -83,7 +81,7 @@ function (_super) {
83
81
 
84
82
  if (!clazz) {
85
83
  console.warn('Unsupported tagName: ', tagName);
86
- clazz = Group;
84
+ clazz = tagName === 'tspan' ? Text : Group;
87
85
  }
88
86
 
89
87
  return new clazz(options);
@@ -138,10 +138,22 @@ export declare class Element<StyleProps extends BaseStyleProps = any, ParsedStyl
138
138
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/attributes
139
139
  */
140
140
  readonly attributes: StyleProps;
141
+ /**
142
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttributeNames
143
+ */
144
+ getAttributeNames(): string[];
141
145
  /**
142
146
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute
143
147
  */
144
148
  getAttribute(name: keyof StyleProps): any;
149
+ /**
150
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttribute
151
+ */
152
+ hasAttribute(qualifiedName: string): boolean;
153
+ /**
154
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttributes
155
+ */
156
+ hasAttributes(): boolean;
145
157
  /**
146
158
  * should use removeAttribute() instead of setting the attribute value to null either directly or using setAttribute(). Many attributes will not behave as expected if you set them to null.
147
159
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute
@@ -151,4 +163,14 @@ export declare class Element<StyleProps extends BaseStyleProps = any, ParsedStyl
151
163
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute
152
164
  */
153
165
  setAttribute<Key extends keyof StyleProps>(attributeName: Key, value: StyleProps[Key], force?: boolean): void;
166
+ getAttributeNS(namespace: string, localName: string): string;
167
+ getAttributeNode(qualifiedName: string): Attr;
168
+ getAttributeNodeNS(namespace: string, localName: string): Attr;
169
+ hasAttributeNS(namespace: string, localName: string): boolean;
170
+ removeAttributeNS(namespace: string, localName: string): void;
171
+ removeAttributeNode(attr: Attr): Attr;
172
+ setAttributeNS(namespace: string, qualifiedName: string, value: string): void;
173
+ setAttributeNode(attr: Attr): Attr;
174
+ setAttributeNodeNS(attr: Attr): Attr;
175
+ toggleAttribute(qualifiedName: string, force?: boolean): boolean;
154
176
  }