@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
@@ -11,9 +11,10 @@ var _types = require("../types");
11
11
 
12
12
  var _DisplayObject = require("./DisplayObject");
13
13
 
14
- var Text =
15
- /** @class */
16
- function (_super) {
14
+ /**
15
+ * <text> @see https://developer.mozilla.org/en-US/docs/Web/API/SVGTextElement
16
+ */
17
+ var Text = function (_super) {
17
18
  (0, _tslib.__extends)(Text, _super);
18
19
 
19
20
  function Text(_a) {
@@ -23,7 +24,8 @@ function (_super) {
23
24
 
24
25
  var style = _a.style,
25
26
  rest = (0, _tslib.__rest)(_a, ["style"]);
26
- return _super.call(this, (0, _tslib.__assign)({
27
+
28
+ var _this = _super.call(this, (0, _tslib.__assign)({
27
29
  type: _types.Shape.TEXT,
28
30
  style: (0, _tslib.__assign)({
29
31
  text: '',
@@ -56,8 +58,59 @@ function (_super) {
56
58
  dy: 0
57
59
  }, style)
58
60
  }, rest)) || this;
61
+ /**
62
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/SVGTextContentElement#constants
63
+ */
64
+
65
+
66
+ _this.LENGTHADJUST_SPACING = 1;
67
+ _this.LENGTHADJUST_SPACINGANDGLYPHS = 2;
68
+ _this.LENGTHADJUST_UNKNOWN = 0;
69
+ return _this;
59
70
  }
60
71
 
72
+ Text.prototype.getCharNumAtPosition = function (point) {
73
+ throw new Error('Method not implemented.');
74
+ };
75
+ /**
76
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/SVGTextContentElement
77
+ */
78
+
79
+
80
+ Text.prototype.getComputedTextLength = function () {
81
+ var _a;
82
+
83
+ return ((_a = this.parsedStyle.metrics) === null || _a === void 0 ? void 0 : _a.maxLineWidth) || 0;
84
+ };
85
+
86
+ Text.prototype.getEndPositionOfChar = function (charnum) {
87
+ throw new Error('Method not implemented.');
88
+ };
89
+
90
+ Text.prototype.getExtentOfChar = function (charnum) {
91
+ throw new Error('Method not implemented.');
92
+ };
93
+
94
+ Text.prototype.getNumberOfChars = function () {
95
+ throw new Error('Method not implemented.');
96
+ };
97
+
98
+ Text.prototype.getRotationOfChar = function (charnum) {
99
+ throw new Error('Method not implemented.');
100
+ };
101
+
102
+ Text.prototype.getStartPositionOfChar = function (charnum) {
103
+ throw new Error('Method not implemented.');
104
+ };
105
+
106
+ Text.prototype.getSubStringLength = function (charnum, nchars) {
107
+ throw new Error('Method not implemented.');
108
+ };
109
+
110
+ Text.prototype.selectSubString = function (charnum, nchars) {
111
+ throw new Error('Method not implemented.');
112
+ };
113
+
61
114
  Text.prototype.getLineBoundingRects = function () {
62
115
  var _a;
63
116
 
@@ -12,9 +12,7 @@ var sequenceNumber = 0;
12
12
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/Animation
13
13
  */
14
14
 
15
- var Animation =
16
- /** @class */
17
- function () {
15
+ var Animation = function () {
18
16
  function Animation(effect, timeline) {
19
17
  this.currentTimePending = false;
20
18
  /**
@@ -31,7 +29,7 @@ function () {
31
29
  this.effect = effect;
32
30
  effect.animation = this;
33
31
  this.timeline = timeline;
34
- this.id = "".concat(sequenceNumber++);
32
+ this.id = "" + sequenceNumber++;
35
33
  this._inEffect = !!this.effect.update(0);
36
34
  this._holdTime = 0;
37
35
  this._paused = false;
@@ -240,7 +238,7 @@ function () {
240
238
  get: function get() {
241
239
  var _a;
242
240
 
243
- return Number((_a = this.effect) === null || _a === void 0 ? void 0 : _a.getComputedTiming().activeDuration);
241
+ return Number((_a = this.effect) === null || _a === void 0 ? void 0 : _a.getComputedTiming().endTime);
244
242
  },
245
243
  enumerable: false,
246
244
  configurable: true
@@ -10,9 +10,7 @@ var _animation = require("../utils/animation");
10
10
  /**
11
11
  * @see https://developer.mozilla.org/en-US/docs/Web/API/EffectTiming
12
12
  */
13
- var AnimationEffectTiming =
14
- /** @class */
15
- function () {
13
+ var AnimationEffectTiming = function () {
16
14
  function AnimationEffectTiming() {
17
15
  /**
18
16
  * @see https://developer.mozilla.org/en-US/docs/Web/API/EffectTiming/delay
@@ -12,9 +12,7 @@ var _FederatedEvent = require("./FederatedEvent");
12
12
  /**
13
13
  * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationPlaybackEvent
14
14
  */
15
- var AnimationEvent =
16
- /** @class */
17
- function (_super) {
15
+ var AnimationEvent = function (_super) {
18
16
  (0, _tslib.__extends)(AnimationEvent, _super);
19
17
 
20
18
  function AnimationEvent(manager, target, currentTime, timelineTime) {
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.AnimationTimeline = void 0;
7
6
  exports.compareAnimations = compareAnimations;
7
+ exports.AnimationTimeline = void 0;
8
8
 
9
9
  var _tslib = require("tslib");
10
10
 
@@ -20,9 +20,7 @@ function compareAnimations(leftAnimation, rightAnimation) {
20
20
  */
21
21
 
22
22
 
23
- var AnimationTimeline =
24
- /** @class */
25
- function () {
23
+ var AnimationTimeline = function () {
26
24
  function AnimationTimeline() {
27
25
  var _this = this;
28
26
  /**
@@ -14,9 +14,7 @@ var _displayObjects = require("../display-objects");
14
14
  *
15
15
  * @see https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry
16
16
  */
17
- var CustomElementRegistry =
18
- /** @class */
19
- function () {
17
+ var CustomElementRegistry = function () {
20
18
  function CustomElementRegistry() {
21
19
  this.registry = {};
22
20
  this.define(_types.Shape.CIRCLE, _displayObjects.Circle);
@@ -21,9 +21,7 @@ var _FederatedEvent = require("./FederatedEvent");
21
21
 
22
22
  circle.dispatchEvent(event);
23
23
  */
24
- var CustomEvent =
25
- /** @class */
26
- function (_super) {
24
+ var CustomEvent = function (_super) {
27
25
  (0, _tslib.__extends)(CustomEvent, _super); // eslint-disable-next-line @typescript-eslint/ban-types
28
26
 
29
27
  function CustomEvent(eventName, object) {
@@ -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';
@@ -11,7 +11,7 @@ var _Node = require("./Node");
11
11
 
12
12
  var _AnimationTimeline = require("./AnimationTimeline");
13
13
 
14
- var _Group = require("../display-objects/Group");
14
+ var _displayObjects = require("../display-objects");
15
15
 
16
16
  var _types = require("../types");
17
17
 
@@ -20,9 +20,7 @@ var _types = require("../types");
20
20
  * Document -> Node -> EventTarget
21
21
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Document
22
22
  */
23
- var Document =
24
- /** @class */
25
- function (_super) {
23
+ var Document = function (_super) {
26
24
  (0, _tslib.__extends)(Document, _super);
27
25
 
28
26
  function Document() {
@@ -39,7 +37,7 @@ function (_super) {
39
37
 
40
38
  _this.timeline = new _AnimationTimeline.AnimationTimeline(); // like <html> in DOM tree
41
39
 
42
- _this.documentElement = new _Group.Group({
40
+ _this.documentElement = new _displayObjects.Group({
43
41
  id: 'g-root',
44
42
  style: {
45
43
  textAlign: _types.TextAlign.START,
@@ -94,7 +92,7 @@ function (_super) {
94
92
 
95
93
  if (!clazz) {
96
94
  console.warn('Unsupported tagName: ', tagName);
97
- clazz = _Group.Group;
95
+ clazz = tagName === 'tspan' ? _displayObjects.Text : _displayObjects.Group;
98
96
  }
99
97
 
100
98
  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
  }
@@ -31,9 +31,7 @@ var entityCounter = 0;
31
31
  * * Animation
32
32
  */
33
33
 
34
- var Element =
35
- /** @class */
36
- function (_super) {
34
+ var Element = function (_super) {
37
35
  (0, _tslib.__extends)(Element, _super);
38
36
 
39
37
  function Element() {
@@ -256,15 +254,15 @@ function (_super) {
256
254
  };
257
255
 
258
256
  Element.prototype.getElementById = function (id) {
259
- return this.sceneGraphService.querySelector("#".concat(id), this);
257
+ return this.sceneGraphService.querySelector("#" + id, this);
260
258
  };
261
259
 
262
260
  Element.prototype.getElementsByName = function (name) {
263
- return this.sceneGraphService.querySelectorAll("[name=\"".concat(name, "\"]"), this);
261
+ return this.sceneGraphService.querySelectorAll("[name=\"" + name + "\"]", this);
264
262
  };
265
263
 
266
264
  Element.prototype.getElementsByClassName = function (className) {
267
- return this.sceneGraphService.querySelectorAll(".".concat(className), this);
265
+ return this.sceneGraphService.querySelectorAll("." + className, this);
268
266
  };
269
267
 
270
268
  Element.prototype.getElementsByTagName = function (tagName) {
@@ -495,6 +493,14 @@ function (_super) {
495
493
  Element.prototype.getClientRects = function () {
496
494
  return [this.getBoundingClientRect()];
497
495
  };
496
+ /**
497
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttributeNames
498
+ */
499
+
500
+
501
+ Element.prototype.getAttributeNames = function () {
502
+ return Object.keys(this.attributes);
503
+ };
498
504
  /**
499
505
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute
500
506
  */
@@ -508,6 +514,22 @@ function (_super) {
508
514
 
509
515
  return (0, _util.isNil)(value) ? null : value;
510
516
  };
517
+ /**
518
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttribute
519
+ */
520
+
521
+
522
+ Element.prototype.hasAttribute = function (qualifiedName) {
523
+ return this.getAttributeNames().includes(qualifiedName);
524
+ };
525
+ /**
526
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttributes
527
+ */
528
+
529
+
530
+ Element.prototype.hasAttributes = function () {
531
+ return !!this.getAttributeNames().length;
532
+ };
511
533
  /**
512
534
  * 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.
513
535
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute
@@ -531,6 +553,46 @@ function (_super) {
531
553
  this.attributes[attributeName] = value;
532
554
  };
533
555
 
556
+ Element.prototype.getAttributeNS = function (namespace, localName) {
557
+ throw new Error('Method not implemented.');
558
+ };
559
+
560
+ Element.prototype.getAttributeNode = function (qualifiedName) {
561
+ throw new Error('Method not implemented.');
562
+ };
563
+
564
+ Element.prototype.getAttributeNodeNS = function (namespace, localName) {
565
+ throw new Error('Method not implemented.');
566
+ };
567
+
568
+ Element.prototype.hasAttributeNS = function (namespace, localName) {
569
+ throw new Error('Method not implemented.');
570
+ };
571
+
572
+ Element.prototype.removeAttributeNS = function (namespace, localName) {
573
+ throw new Error('Method not implemented.');
574
+ };
575
+
576
+ Element.prototype.removeAttributeNode = function (attr) {
577
+ throw new Error('Method not implemented.');
578
+ };
579
+
580
+ Element.prototype.setAttributeNS = function (namespace, qualifiedName, value) {
581
+ throw new Error('Method not implemented.');
582
+ };
583
+
584
+ Element.prototype.setAttributeNode = function (attr) {
585
+ throw new Error('Method not implemented.');
586
+ };
587
+
588
+ Element.prototype.setAttributeNodeNS = function (attr) {
589
+ throw new Error('Method not implemented.');
590
+ };
591
+
592
+ Element.prototype.toggleAttribute = function (qualifiedName, force) {
593
+ throw new Error('Method not implemented.');
594
+ };
595
+
534
596
  return Element;
535
597
  }(_Node.Node);
536
598
 
@@ -24,9 +24,7 @@ var DELEGATION_SPLITTER = ':';
24
24
 
25
25
  exports.DELEGATION_SPLITTER = DELEGATION_SPLITTER;
26
26
 
27
- var EventTarget =
28
- /** @class */
29
- function () {
27
+ var EventTarget = function () {
30
28
  function EventTarget() {
31
29
  /**
32
30
  * event emitter
@@ -68,7 +66,7 @@ function () {
68
66
  useDelegatedName = true;
69
67
  }
70
68
 
71
- type = capture ? "".concat(type, "capture") : type;
69
+ type = capture ? type + "capture" : type;
72
70
  listener = (0, _util.isFunction)(listener) ? listener : listener.handleEvent; // compatible with G 3.0
73
71
 
74
72
  if (useDelegatedName) {
@@ -124,7 +122,7 @@ function () {
124
122
  EventTarget.prototype.removeEventListener = function (type, listener, options) {
125
123
  var capture = (0, _util.isBoolean)(options) && options || (0, _util.isObject)(options) && options.capture;
126
124
  var context = (0, _util.isFunction)(listener) ? undefined : listener;
127
- type = capture ? "".concat(type, "capture") : type;
125
+ type = capture ? type + "capture" : type;
128
126
  listener = (0, _util.isFunction)(listener) ? listener : listener === null || listener === void 0 ? void 0 : listener.handleEvent;
129
127
  this.emitter.off(type, listener, context);
130
128
  return this;
@@ -1,6 +1,6 @@
1
1
  import { Point } from '../shapes/Point';
2
2
  import type { EventService } from '../services';
3
- import type { IEventTarget } from './interfaces';
3
+ import type { IEventTarget, ICanvas } from './interfaces';
4
4
  /**
5
5
  * An DOM-compatible synthetic event implementation that is "forwarded" on behalf of an original
6
6
  * FederatedEvent or native {@link https://dom.spec.whatwg.org/#event Event}.
@@ -127,13 +127,16 @@ export declare class FederatedEvent<N extends Event = Event, T = any> {
127
127
  * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Event/stopPropagation
128
128
  */
129
129
  stopPropagation(): void;
130
+ /**
131
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/view
132
+ */
133
+ view: ICanvas;
130
134
  /**
131
135
  * added for compatibility with DOM Event,
132
136
  * deprecated props and methods
133
137
  */
134
138
  initEvent(): void;
135
139
  initUIEvent(): void;
136
- view: WindowProxy;
137
140
  which: number;
138
141
  returnValue: boolean;
139
142
  srcElement: IEventTarget;
@@ -11,9 +11,7 @@ var _Point = require("../shapes/Point");
11
11
  * An DOM-compatible synthetic event implementation that is "forwarded" on behalf of an original
12
12
  * FederatedEvent or native {@link https://dom.spec.whatwg.org/#event Event}.
13
13
  */
14
- var FederatedEvent =
15
- /** @class */
16
- function () {
14
+ var FederatedEvent = function () {
17
15
  /**
18
16
  * The event boundary which manages this event. Propagation can only occur
19
17
  * within the boundary's jurisdiction.
@@ -11,9 +11,7 @@ var _FederatedEvent = require("./FederatedEvent");
11
11
 
12
12
  var _Point = require("../shapes/Point");
13
13
 
14
- var FederatedMouseEvent =
15
- /** @class */
16
- function (_super) {
14
+ var FederatedMouseEvent = function (_super) {
17
15
  (0, _tslib.__extends)(FederatedMouseEvent, _super);
18
16
 
19
17
  function FederatedMouseEvent() {
@@ -9,9 +9,7 @@ var _tslib = require("tslib");
9
9
 
10
10
  var _FederatedMouseEvent = require("./FederatedMouseEvent");
11
11
 
12
- var FederatedPointerEvent =
13
- /** @class */
14
- function (_super) {
12
+ var FederatedPointerEvent = function (_super) {
15
13
  (0, _tslib.__extends)(FederatedPointerEvent, _super);
16
14
 
17
15
  function FederatedPointerEvent() {
@@ -9,9 +9,7 @@ var _tslib = require("tslib");
9
9
 
10
10
  var _FederatedMouseEvent = require("./FederatedMouseEvent");
11
11
 
12
- var FederatedWheelEvent =
13
- /** @class */
14
- function (_super) {
12
+ var FederatedWheelEvent = function (_super) {
15
13
  (0, _tslib.__extends)(FederatedWheelEvent, _super);
16
14
 
17
15
  function FederatedWheelEvent() {
@@ -3,10 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.KeyframeEffect = void 0;
7
6
  exports.makeTiming = makeTiming;
8
7
  exports.normalizeTimingInput = normalizeTimingInput;
9
8
  exports.numericTimingToObject = numericTimingToObject;
9
+ exports.KeyframeEffect = void 0;
10
10
 
11
11
  var _animation = require("../utils/animation");
12
12
 
@@ -92,9 +92,7 @@ function numericTimingToObject(timingInput) {
92
92
  */
93
93
 
94
94
 
95
- var KeyframeEffect =
96
- /** @class */
97
- function () {
95
+ var KeyframeEffect = function () {
98
96
  function KeyframeEffect(target, effectInput, timingInput) {
99
97
  var _this = this;
100
98
 
@@ -102,7 +102,7 @@ function normalizeKeyframes(effectInput, timing) {
102
102
  // TODO: Support add & accumulate in KeyframeEffect.composite
103
103
  // @see https://developer.mozilla.org/en-US/docs/Web/API/KeyframeEffect/composite
104
104
  if (['replace', 'add', 'accumulate', 'auto'].indexOf(memberValue) === -1) {
105
- throw new Error("".concat(memberValue, " compositing is not supported"));
105
+ throw new Error(memberValue + " compositing is not supported");
106
106
  }
107
107
  } else if (member === 'easing') {// TODO: Validate animation-timing-function
108
108
  // @see https://developer.mozilla.org/en-US/docs/Web/CSS/animation-timing-function
@@ -9,9 +9,7 @@ var _tslib = require("tslib");
9
9
 
10
10
  var _FederatedEvent = require("./FederatedEvent");
11
11
 
12
- var MutationEvent =
13
- /** @class */
14
- function (_super) {
12
+ var MutationEvent = function (_super) {
15
13
  (0, _tslib.__extends)(MutationEvent, _super);
16
14
 
17
15
  function MutationEvent(typeArg, relatedNode, prevValue, newValue, attrName, attrChange, prevParsedValue, newParsedValue) {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.Registration = exports.MutationObserver = void 0;
6
+ exports.MutationObserver = exports.Registration = void 0;
7
7
 
8
8
  require("setimmediate");
9
9
 
@@ -16,9 +16,7 @@ var _MutationRecord = require("./MutationRecord");
16
16
  var uidCounter = 0;
17
17
  var registrationsTable = new WeakMap();
18
18
 
19
- var Registration =
20
- /** @class */
21
- function () {
19
+ var Registration = function () {
22
20
  function Registration(observer, target, options) {
23
21
  this.observer = observer;
24
22
  this.target = target;
@@ -208,9 +206,7 @@ exports.Registration = Registration;
208
206
  * @see https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver
209
207
  * @see https://github.com/googlearchive/MutationObservers/blob/master/MutationObserver.js
210
208
  */
211
- var MutationObserver =
212
- /** @class */
213
- function () {
209
+ var MutationObserver = function () {
214
210
  function MutationObserver(callback) {
215
211
  this.callback = callback;
216
212
  this.nodes = [];
@@ -220,10 +216,7 @@ function () {
220
216
 
221
217
  MutationObserver.prototype.observe = function (target, options) {
222
218
  // 1.1
223
- if (!options.childList && !options.attributes && !options.characterData || // 1.2
224
- options.attributeOldValue && !options.attributes || // 1.3
225
- options.attributeFilter && options.attributeFilter.length && !options.attributes || // 1.4
226
- options.characterDataOldValue && !options.characterData) {
219
+ if (!options.childList && !options.attributes && !options.characterData || options.attributeOldValue && !options.attributes || options.attributeFilter && options.attributeFilter.length && !options.attributes || options.characterDataOldValue && !options.characterData) {
227
220
  throw new SyntaxError();
228
221
  }
229
222
 
@@ -5,9 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.MutationRecord = void 0;
7
7
 
8
- var MutationRecord =
9
- /** @class */
10
- function () {
8
+ var MutationRecord = function () {
11
9
  function MutationRecord(type, target) {
12
10
  this.type = type;
13
11
  this.target = target;
package/lib/dom/Node.js CHANGED
@@ -16,9 +16,7 @@ var _EventTarget = require("./EventTarget");
16
16
  /**
17
17
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Node
18
18
  */
19
- var Node =
20
- /** @class */
21
- function (_super) {
19
+ var Node = function (_super) {
22
20
  (0, _tslib.__extends)(Node, _super);
23
21
 
24
22
  function Node() {
@@ -127,7 +125,7 @@ function (_super) {
127
125
 
128
126
  if (this.nodeName === _.Shape.TEXT) {
129
127
  // @ts-ignore
130
- this.style.text = "".concat(content);
128
+ this.style.text = "" + content;
131
129
  } else {// this.appendChild(
132
130
  // new Text({
133
131
  // style: {
@@ -3,10 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.INHERIT_PROPERTIES = void 0;
7
- exports.addPropertiesHandler = addPropertiesHandler;
8
6
  exports.addPropertyHandler = addPropertyHandler;
9
- exports.stylePropertyUpdaterFactory = exports.stylePropertyParserFactory = exports.stylePropertyMergerFactory = exports.globalContainer = exports.containerModule = void 0;
7
+ exports.addPropertiesHandler = addPropertiesHandler;
8
+ exports.containerModule = exports.stylePropertyMergerFactory = exports.stylePropertyUpdaterFactory = exports.stylePropertyParserFactory = exports.INHERIT_PROPERTIES = exports.globalContainer = void 0;
10
9
 
11
10
  var _manaSyringe = require("mana-syringe");
12
11
 
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.CullingStrategyContribution = exports.CullingPlugin = void 0;
6
+ exports.CullingPlugin = exports.CullingStrategyContribution = void 0;
7
7
 
8
8
  var _tslib = require("tslib");
9
9
 
@@ -21,9 +21,7 @@ var CullingStrategyContribution = _manaSyringe.Syringe.defineToken('CullingStrat
21
21
 
22
22
  exports.CullingStrategyContribution = CullingStrategyContribution;
23
23
 
24
- var CullingPlugin =
25
- /** @class */
26
- function () {
24
+ var CullingPlugin = function () {
27
25
  function CullingPlugin() {}
28
26
 
29
27
  CullingPlugin_1 = CullingPlugin;
@@ -18,9 +18,7 @@ var _RenderingContext = require("../services/RenderingContext");
18
18
  /**
19
19
  * Filter dirty renderables and calculate the "dirty rectangle" which will be clear when frame began
20
20
  */
21
- var DirtyCheckPlugin =
22
- /** @class */
23
- function () {
21
+ var DirtyCheckPlugin = function () {
24
22
  function DirtyCheckPlugin() {}
25
23
 
26
24
  DirtyCheckPlugin_1 = DirtyCheckPlugin;