@antv/g 5.0.15 → 5.0.18

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 (236) hide show
  1. package/dist/index.umd.min.js +18 -2
  2. package/es/Canvas.d.ts +7 -1
  3. package/es/Canvas.js +9 -10
  4. package/es/camera/Camera.d.ts +3 -2
  5. package/es/camera/Camera.js +16 -8
  6. package/es/canvas-module.js +4 -2
  7. package/es/components/Transform.d.ts +0 -1
  8. package/es/components/Transform.js +0 -1
  9. package/es/display-objects/Circle.d.ts +1 -1
  10. package/es/display-objects/Circle.js +8 -3
  11. package/es/display-objects/CustomElement.d.ts +3 -2
  12. package/es/display-objects/CustomElement.js +9 -6
  13. package/es/display-objects/DisplayObject.d.ts +9 -3
  14. package/es/display-objects/DisplayObject.js +97 -50
  15. package/es/display-objects/Ellipse.d.ts +1 -1
  16. package/es/display-objects/Ellipse.js +8 -3
  17. package/es/display-objects/Group.d.ts +18 -2
  18. package/es/display-objects/Group.js +11 -9
  19. package/es/display-objects/HTML.d.ts +1 -1
  20. package/es/display-objects/HTML.js +9 -4
  21. package/es/display-objects/Image.d.ts +5 -3
  22. package/es/display-objects/Image.js +8 -3
  23. package/es/display-objects/Line.d.ts +1 -1
  24. package/es/display-objects/Line.js +12 -4
  25. package/es/display-objects/Path.d.ts +3 -2
  26. package/es/display-objects/Path.js +10 -5
  27. package/es/display-objects/Polygon.d.ts +1 -1
  28. package/es/display-objects/Polygon.js +9 -3
  29. package/es/display-objects/Polyline.d.ts +1 -1
  30. package/es/display-objects/Polyline.js +10 -5
  31. package/es/display-objects/Rect.d.ts +1 -1
  32. package/es/display-objects/Rect.js +8 -3
  33. package/es/display-objects/Text.d.ts +32 -4
  34. package/es/display-objects/Text.js +70 -10
  35. package/es/dom/Animation.js +2 -2
  36. package/es/dom/AnimationTimeline.js +1 -2
  37. package/es/dom/CustomElementRegistry.js +12 -12
  38. package/es/dom/Document.d.ts +2 -1
  39. package/es/dom/Document.js +22 -2
  40. package/es/dom/Element.d.ts +38 -5
  41. package/es/dom/Element.js +115 -16
  42. package/es/dom/EventTarget.d.ts +2 -2
  43. package/es/dom/EventTarget.js +4 -3
  44. package/es/dom/FederatedEvent.d.ts +4 -1
  45. package/es/dom/KeyframeList.js +1 -1
  46. package/es/dom/MutationEvent.d.ts +15 -0
  47. package/es/dom/MutationEvent.js +29 -0
  48. package/es/dom/MutationObserver.d.ts +36 -0
  49. package/es/dom/MutationObserver.js +413 -0
  50. package/es/dom/MutationRecord.d.ts +14 -0
  51. package/es/dom/MutationRecord.js +31 -0
  52. package/es/dom/Node.d.ts +35 -3
  53. package/es/dom/Node.js +184 -17
  54. package/es/dom/index.d.ts +3 -0
  55. package/es/dom/index.js +3 -0
  56. package/es/dom/interfaces.d.ts +39 -8
  57. package/es/dom/interfaces.js +23 -5
  58. package/es/global-module.d.ts +1 -0
  59. package/es/global-module.js +11 -13
  60. package/es/index.d.ts +1 -0
  61. package/es/index.js +1 -0
  62. package/es/plugins/CullingPlugin.d.ts +0 -2
  63. package/es/plugins/CullingPlugin.js +3 -24
  64. package/es/plugins/DirtyCheckPlugin.js +2 -2
  65. package/es/plugins/EventPlugin.d.ts +1 -0
  66. package/es/plugins/EventPlugin.js +15 -5
  67. package/es/plugins/FrustumCullingStrategy.d.ts +1 -0
  68. package/es/plugins/FrustumCullingStrategy.js +41 -33
  69. package/es/plugins/PrepareRendererPlugin.js +21 -5
  70. package/es/property-handlers/aabb.js +19 -20
  71. package/es/property-handlers/color.js +5 -2
  72. package/es/property-handlers/dimension.d.ts +15 -3
  73. package/es/property-handlers/dimension.js +50 -9
  74. package/es/property-handlers/index.d.ts +3 -0
  75. package/es/property-handlers/index.js +4 -1
  76. package/es/property-handlers/inherit.d.ts +6 -0
  77. package/es/property-handlers/inherit.js +25 -0
  78. package/es/property-handlers/interfaces.d.ts +2 -2
  79. package/es/property-handlers/lineDash.d.ts +6 -1
  80. package/es/property-handlers/lineDash.js +23 -4
  81. package/es/property-handlers/offsetDistance.js +2 -2
  82. package/es/property-handlers/text.d.ts +2 -0
  83. package/es/property-handlers/text.js +3 -0
  84. package/es/property-handlers/textTransform.d.ts +6 -0
  85. package/es/property-handlers/textTransform.js +19 -0
  86. package/es/services/EventService.js +11 -7
  87. package/es/services/RenderingContext.d.ts +5 -8
  88. package/es/services/RenderingContext.js +6 -7
  89. package/es/services/RenderingService.d.ts +12 -2
  90. package/es/services/RenderingService.js +23 -12
  91. package/es/services/SceneGraphSelector.d.ts +3 -2
  92. package/es/services/SceneGraphSelector.js +8 -4
  93. package/es/services/SceneGraphService.d.ts +0 -7
  94. package/es/services/SceneGraphService.js +17 -87
  95. package/es/services/aabb/CircleUpdater.js +3 -3
  96. package/es/services/aabb/EllipseUpdater.js +2 -2
  97. package/es/services/aabb/LineUpdater.js +2 -2
  98. package/es/services/aabb/PathUpdater.js +2 -2
  99. package/es/services/aabb/PolylineUpdater.js +3 -3
  100. package/es/services/aabb/RectUpdater.js +4 -4
  101. package/es/services/aabb/TextUpdater.js +31 -10
  102. package/es/services/text/index.js +19 -21
  103. package/es/shapes/AABB.js +5 -0
  104. package/es/types.d.ts +48 -24
  105. package/es/types.js +50 -31
  106. package/es/utils/animation.js +1 -1
  107. package/es/utils/custom-easing.js +1 -1
  108. package/es/utils/event.js +7 -4
  109. package/es/utils/index.d.ts +2 -0
  110. package/es/utils/index.js +3 -1
  111. package/es/utils/interpolation.d.ts +1 -0
  112. package/es/utils/interpolation.js +41 -8
  113. package/es/utils/path.js +11 -11
  114. package/es/utils/raf.d.ts +1 -1
  115. package/es/utils/raf.js +0 -2
  116. package/es/utils/string.d.ts +1 -0
  117. package/es/utils/string.js +9 -0
  118. package/es/utils/text.js +3 -3
  119. package/lib/Canvas.d.ts +7 -1
  120. package/lib/Canvas.js +7 -8
  121. package/lib/camera/Camera.d.ts +3 -2
  122. package/lib/camera/Camera.js +20 -10
  123. package/lib/canvas-module.js +3 -1
  124. package/lib/components/Transform.d.ts +0 -1
  125. package/lib/components/Transform.js +0 -1
  126. package/lib/display-objects/Circle.d.ts +1 -1
  127. package/lib/display-objects/Circle.js +7 -2
  128. package/lib/display-objects/CustomElement.d.ts +3 -2
  129. package/lib/display-objects/CustomElement.js +9 -6
  130. package/lib/display-objects/DisplayObject.d.ts +9 -3
  131. package/lib/display-objects/DisplayObject.js +97 -47
  132. package/lib/display-objects/Ellipse.d.ts +1 -1
  133. package/lib/display-objects/Ellipse.js +7 -2
  134. package/lib/display-objects/Group.d.ts +18 -2
  135. package/lib/display-objects/Group.js +10 -9
  136. package/lib/display-objects/HTML.d.ts +1 -1
  137. package/lib/display-objects/HTML.js +8 -4
  138. package/lib/display-objects/Image.d.ts +5 -3
  139. package/lib/display-objects/Image.js +7 -2
  140. package/lib/display-objects/Line.d.ts +1 -1
  141. package/lib/display-objects/Line.js +11 -3
  142. package/lib/display-objects/Path.d.ts +3 -2
  143. package/lib/display-objects/Path.js +9 -4
  144. package/lib/display-objects/Polygon.d.ts +1 -1
  145. package/lib/display-objects/Polygon.js +8 -2
  146. package/lib/display-objects/Polyline.d.ts +1 -1
  147. package/lib/display-objects/Polyline.js +9 -4
  148. package/lib/display-objects/Rect.d.ts +1 -1
  149. package/lib/display-objects/Rect.js +7 -2
  150. package/lib/display-objects/Text.d.ts +32 -4
  151. package/lib/display-objects/Text.js +69 -9
  152. package/lib/dom/Animation.js +2 -2
  153. package/lib/dom/AnimationTimeline.js +1 -2
  154. package/lib/dom/CustomElementRegistry.js +11 -11
  155. package/lib/dom/Document.d.ts +2 -1
  156. package/lib/dom/Document.js +24 -3
  157. package/lib/dom/Element.d.ts +38 -5
  158. package/lib/dom/Element.js +117 -16
  159. package/lib/dom/EventTarget.d.ts +2 -2
  160. package/lib/dom/EventTarget.js +4 -3
  161. package/lib/dom/FederatedEvent.d.ts +4 -1
  162. package/lib/dom/KeyframeList.js +1 -1
  163. package/lib/dom/MutationEvent.d.ts +15 -0
  164. package/lib/dom/MutationEvent.js +37 -0
  165. package/lib/dom/MutationObserver.d.ts +36 -0
  166. package/lib/dom/MutationObserver.js +424 -0
  167. package/lib/dom/MutationRecord.d.ts +14 -0
  168. package/lib/dom/MutationRecord.js +38 -0
  169. package/lib/dom/Node.d.ts +35 -3
  170. package/lib/dom/Node.js +185 -16
  171. package/lib/dom/index.d.ts +3 -0
  172. package/lib/dom/index.js +39 -0
  173. package/lib/dom/interfaces.d.ts +39 -8
  174. package/lib/dom/interfaces.js +23 -5
  175. package/lib/global-module.d.ts +1 -0
  176. package/lib/global-module.js +12 -8
  177. package/lib/index.d.ts +1 -0
  178. package/lib/index.js +3 -1
  179. package/lib/plugins/CullingPlugin.d.ts +0 -2
  180. package/lib/plugins/CullingPlugin.js +2 -23
  181. package/lib/plugins/DirtyCheckPlugin.js +1 -1
  182. package/lib/plugins/EventPlugin.d.ts +1 -0
  183. package/lib/plugins/EventPlugin.js +13 -5
  184. package/lib/plugins/FrustumCullingStrategy.d.ts +1 -0
  185. package/lib/plugins/FrustumCullingStrategy.js +42 -33
  186. package/lib/plugins/PrepareRendererPlugin.js +24 -4
  187. package/lib/property-handlers/aabb.js +18 -19
  188. package/lib/property-handlers/color.js +6 -3
  189. package/lib/property-handlers/dimension.d.ts +15 -3
  190. package/lib/property-handlers/dimension.js +50 -8
  191. package/lib/property-handlers/index.d.ts +3 -0
  192. package/lib/property-handlers/index.js +39 -0
  193. package/lib/property-handlers/inherit.d.ts +6 -0
  194. package/lib/property-handlers/inherit.js +34 -0
  195. package/lib/property-handlers/interfaces.d.ts +2 -2
  196. package/lib/property-handlers/lineDash.d.ts +6 -1
  197. package/lib/property-handlers/lineDash.js +25 -4
  198. package/lib/property-handlers/offsetDistance.js +1 -1
  199. package/lib/property-handlers/text.d.ts +2 -0
  200. package/lib/property-handlers/text.js +10 -0
  201. package/lib/property-handlers/textTransform.d.ts +6 -0
  202. package/lib/property-handlers/textTransform.js +27 -0
  203. package/lib/services/EventService.js +11 -7
  204. package/lib/services/RenderingContext.d.ts +5 -8
  205. package/lib/services/RenderingContext.js +8 -9
  206. package/lib/services/RenderingService.d.ts +12 -2
  207. package/lib/services/RenderingService.js +23 -11
  208. package/lib/services/SceneGraphSelector.d.ts +3 -2
  209. package/lib/services/SceneGraphSelector.js +10 -3
  210. package/lib/services/SceneGraphService.d.ts +0 -7
  211. package/lib/services/SceneGraphService.js +18 -91
  212. package/lib/services/aabb/CircleUpdater.js +2 -2
  213. package/lib/services/aabb/EllipseUpdater.js +1 -1
  214. package/lib/services/aabb/LineUpdater.js +1 -1
  215. package/lib/services/aabb/PathUpdater.js +1 -1
  216. package/lib/services/aabb/PolylineUpdater.js +2 -2
  217. package/lib/services/aabb/RectUpdater.js +3 -3
  218. package/lib/services/aabb/TextUpdater.js +30 -9
  219. package/lib/services/text/index.js +19 -21
  220. package/lib/shapes/AABB.js +5 -0
  221. package/lib/types.d.ts +48 -24
  222. package/lib/types.js +56 -35
  223. package/lib/utils/animation.js +1 -1
  224. package/lib/utils/custom-easing.js +1 -1
  225. package/lib/utils/event.js +7 -4
  226. package/lib/utils/index.d.ts +2 -0
  227. package/lib/utils/index.js +26 -0
  228. package/lib/utils/interpolation.d.ts +1 -0
  229. package/lib/utils/interpolation.js +43 -7
  230. package/lib/utils/path.js +10 -10
  231. package/lib/utils/raf.d.ts +1 -1
  232. package/lib/utils/raf.js +0 -2
  233. package/lib/utils/string.d.ts +1 -0
  234. package/lib/utils/string.js +16 -0
  235. package/lib/utils/text.js +3 -3
  236. package/package.json +5 -3
@@ -19,6 +19,10 @@ var _interfaces = require("./interfaces");
19
19
 
20
20
  var _globalModule = require("../global-module");
21
21
 
22
+ var _utils = require("../utils");
23
+
24
+ var _ = require("..");
25
+
22
26
  var entityCounter = 0;
23
27
  /**
24
28
  * Has following capabilities:
@@ -42,8 +46,20 @@ function (_super) {
42
46
  _this.transformable = new _components.Transform();
43
47
  _this.sortable = new _components.Sortable();
44
48
  _this.geometry = new _components.Geometry();
49
+ /**
50
+ * https://developer.mozilla.org/zh-CN/docs/Web/API/Element/namespaceURI
51
+ */
52
+
53
+ _this.namespaceURI = 'g';
45
54
  _this.scrollLeft = 0;
46
55
  _this.scrollTop = 0;
56
+ /**
57
+ * We don't support border now
58
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/clientTop
59
+ */
60
+
61
+ _this.clientTop = 0;
62
+ _this.clientLeft = 0;
47
63
  /**
48
64
  * is destroyed or not
49
65
  */
@@ -68,12 +84,28 @@ function (_super) {
68
84
  return !!target.getAttribute;
69
85
  };
70
86
 
87
+ Object.defineProperty(Element.prototype, "className", {
88
+ /**
89
+ * used in `getElementsByClassName`
90
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByClassName
91
+ */
92
+ get: function get() {
93
+ return this.getAttribute('class') || '';
94
+ },
95
+ set: function set(className) {
96
+ this.setAttribute('class', className);
97
+ },
98
+ enumerable: false,
99
+ configurable: true
100
+ });
71
101
  Object.defineProperty(Element.prototype, "classList", {
72
102
  /**
73
103
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/classList
74
104
  */
75
105
  get: function get() {
76
- return this.className.split(' ');
106
+ return this.className.split(' ').filter(function (c) {
107
+ return c !== '';
108
+ });
77
109
  },
78
110
  enumerable: false,
79
111
  configurable: true
@@ -153,11 +185,12 @@ function (_super) {
153
185
  this.sceneGraphService.attach(child, this, index);
154
186
  this.emit(_interfaces.ElementEvent.CHILD_INSERTED, {
155
187
  child: child
156
- });
157
- child.emit(_interfaces.ElementEvent.INSERTED, {
158
- parent: this,
159
- index: index
160
- });
188
+ }); // child.emit(ElementEvent.INSERTED, {
189
+ // parent: this,
190
+ // index,
191
+ // });
192
+
193
+ child.dispatchEvent(new _.MutationEvent(_interfaces.ElementEvent.INSERTED, this, '', '', '', 0, '', ''));
161
194
  return child;
162
195
  };
163
196
 
@@ -180,14 +213,15 @@ function (_super) {
180
213
  };
181
214
 
182
215
  Element.prototype.removeChild = function (child, destroy) {
216
+ // should emit on itself before detach
217
+ // child.emit(ElementEvent.REMOVED, {
218
+ // parent: this,
219
+ // });
183
220
  if (destroy === void 0) {
184
221
  destroy = true;
185
- } // should emit on itself before detach
186
-
222
+ }
187
223
 
188
- child.emit(_interfaces.ElementEvent.REMOVED, {
189
- parent: this
190
- }); // emit destroy event
224
+ child.dispatchEvent(new _.MutationEvent(_interfaces.ElementEvent.REMOVED, this, '', '', '', 0, '', '')); // emit destroy event
191
225
 
192
226
  if (destroy) {
193
227
  child.emit(_interfaces.ElementEvent.DESTROY, {});
@@ -231,15 +265,15 @@ function (_super) {
231
265
  };
232
266
 
233
267
  Element.prototype.getElementById = function (id) {
234
- return this.sceneGraphService.querySelector("#" + id, this);
268
+ return this.sceneGraphService.querySelector("#".concat(id), this);
235
269
  };
236
270
 
237
271
  Element.prototype.getElementsByName = function (name) {
238
- return this.sceneGraphService.querySelectorAll("[name=\"" + name + "\"]", this);
272
+ return this.sceneGraphService.querySelectorAll("[name=\"".concat(name, "\"]"), this);
239
273
  };
240
274
 
241
275
  Element.prototype.getElementsByClassName = function (className) {
242
- return this.sceneGraphService.querySelectorAll("." + className, this);
276
+ return this.sceneGraphService.querySelectorAll(".".concat(className), this);
243
277
  };
244
278
 
245
279
  Element.prototype.getElementsByTagName = function (tagName) {
@@ -470,15 +504,42 @@ function (_super) {
470
504
  Element.prototype.getClientRects = function () {
471
505
  return [this.getBoundingClientRect()];
472
506
  };
507
+ /**
508
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttributeNames
509
+ */
510
+
511
+
512
+ Element.prototype.getAttributeNames = function () {
513
+ return Object.keys(this.attributes);
514
+ };
473
515
  /**
474
516
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute
475
517
  */
476
518
 
477
519
 
478
- Element.prototype.getAttribute = function (attributeName) {
520
+ Element.prototype.getAttribute = function (name) {
521
+ var _a = (0, _tslib.__read)((0, _utils.formatAttribute)(name, ''), 1),
522
+ attributeName = _a[0];
523
+
479
524
  var value = this.attributes[attributeName]; // if the given attribute does not exist, the value returned will either be null or ""
480
525
 
481
- return (0, _util.isNil)(value) ? undefined : value;
526
+ return (0, _util.isNil)(value) ? null : value;
527
+ };
528
+ /**
529
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttribute
530
+ */
531
+
532
+
533
+ Element.prototype.hasAttribute = function (qualifiedName) {
534
+ return this.getAttributeNames().includes(qualifiedName);
535
+ };
536
+ /**
537
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttributes
538
+ */
539
+
540
+
541
+ Element.prototype.hasAttributes = function () {
542
+ return !!this.getAttributeNames().length;
482
543
  };
483
544
  /**
484
545
  * 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.
@@ -503,6 +564,46 @@ function (_super) {
503
564
  this.attributes[attributeName] = value;
504
565
  };
505
566
 
567
+ Element.prototype.getAttributeNS = function (namespace, localName) {
568
+ throw new Error('Method not implemented.');
569
+ };
570
+
571
+ Element.prototype.getAttributeNode = function (qualifiedName) {
572
+ throw new Error('Method not implemented.');
573
+ };
574
+
575
+ Element.prototype.getAttributeNodeNS = function (namespace, localName) {
576
+ throw new Error('Method not implemented.');
577
+ };
578
+
579
+ Element.prototype.hasAttributeNS = function (namespace, localName) {
580
+ throw new Error('Method not implemented.');
581
+ };
582
+
583
+ Element.prototype.removeAttributeNS = function (namespace, localName) {
584
+ throw new Error('Method not implemented.');
585
+ };
586
+
587
+ Element.prototype.removeAttributeNode = function (attr) {
588
+ throw new Error('Method not implemented.');
589
+ };
590
+
591
+ Element.prototype.setAttributeNS = function (namespace, qualifiedName, value) {
592
+ throw new Error('Method not implemented.');
593
+ };
594
+
595
+ Element.prototype.setAttributeNode = function (attr) {
596
+ throw new Error('Method not implemented.');
597
+ };
598
+
599
+ Element.prototype.setAttributeNodeNS = function (attr) {
600
+ throw new Error('Method not implemented.');
601
+ };
602
+
603
+ Element.prototype.toggleAttribute = function (qualifiedName, force) {
604
+ throw new Error('Method not implemented.');
605
+ };
606
+
506
607
  return Element;
507
608
  }(_Node.Node);
508
609
 
@@ -20,14 +20,14 @@ export declare class EventTarget implements IEventTarget {
20
20
  * support `capture` & `once` in options
21
21
  * @see https://developer.mozilla.org/zh-CN/docs/Web/API/EventTarget/addEventListener
22
22
  */
23
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): this;
23
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject | ((...args: any[]) => void), options?: boolean | AddEventListenerOptions): this;
24
24
  /**
25
25
  * @deprecated
26
26
  * @alias removeEventListener
27
27
  */
28
28
  off(type: string, listener: EventListenerOrEventListenerObject | ((...args: any[]) => void), options?: boolean | AddEventListenerOptions): this;
29
29
  removeAllEventListeners(): void;
30
- removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): this;
30
+ removeEventListener(type: string, listener?: EventListenerOrEventListenerObject | ((...args: any[]) => void), options?: boolean | AddEventListenerOptions): this;
31
31
  /**
32
32
  * @deprecated
33
33
  * @alias dispatchEvent
@@ -68,7 +68,7 @@ function () {
68
68
  useDelegatedName = true;
69
69
  }
70
70
 
71
- type = capture ? type + "capture" : type;
71
+ type = capture ? "".concat(type, "capture") : type;
72
72
  listener = (0, _util.isFunction)(listener) ? listener : listener.handleEvent; // compatible with G 3.0
73
73
 
74
74
  if (useDelegatedName) {
@@ -85,7 +85,8 @@ function () {
85
85
 
86
86
  if (((_a = args[0].target) === null || _a === void 0 ? void 0 : _a.name) !== delegatedName) {
87
87
  return;
88
- }
88
+ } // @ts-ignore
89
+
89
90
 
90
91
  originListener_1.apply(void 0, (0, _tslib.__spreadArray)([], (0, _tslib.__read)(args), false));
91
92
  };
@@ -123,7 +124,7 @@ function () {
123
124
  EventTarget.prototype.removeEventListener = function (type, listener, options) {
124
125
  var capture = (0, _util.isBoolean)(options) && options || (0, _util.isObject)(options) && options.capture;
125
126
  var context = (0, _util.isFunction)(listener) ? undefined : listener;
126
- type = capture ? type + "capture" : type;
127
+ type = capture ? "".concat(type, "capture") : type;
127
128
  listener = (0, _util.isFunction)(listener) ? listener : listener === null || listener === void 0 ? void 0 : listener.handleEvent;
128
129
  this.emitter.off(type, listener, context);
129
130
  return this;
@@ -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: any;
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;
@@ -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(memberValue + " compositing is not supported");
105
+ throw new Error("".concat(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
@@ -0,0 +1,15 @@
1
+ import type { ElementEvent, IElement } from '..';
2
+ import { FederatedEvent } from './FederatedEvent';
3
+ export declare class MutationEvent extends FederatedEvent {
4
+ relatedNode: IElement;
5
+ prevValue: any;
6
+ newValue: any;
7
+ attrName: string;
8
+ attrChange: number;
9
+ prevParsedValue: any;
10
+ newParsedValue: any;
11
+ static readonly ADDITION: number;
12
+ static readonly MODIFICATION: number;
13
+ static readonly REMOVAL: number;
14
+ constructor(typeArg: ElementEvent, relatedNode: IElement, prevValue: any, newValue: any, attrName: string, attrChange: number, prevParsedValue: any, newParsedValue: any);
15
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.MutationEvent = void 0;
7
+
8
+ var _tslib = require("tslib");
9
+
10
+ var _FederatedEvent = require("./FederatedEvent");
11
+
12
+ var MutationEvent =
13
+ /** @class */
14
+ function (_super) {
15
+ (0, _tslib.__extends)(MutationEvent, _super);
16
+
17
+ function MutationEvent(typeArg, relatedNode, prevValue, newValue, attrName, attrChange, prevParsedValue, newParsedValue) {
18
+ var _this = _super.call(this, null) || this;
19
+
20
+ _this.relatedNode = relatedNode;
21
+ _this.prevValue = prevValue;
22
+ _this.newValue = newValue;
23
+ _this.attrName = attrName;
24
+ _this.attrChange = attrChange;
25
+ _this.prevParsedValue = prevParsedValue;
26
+ _this.newParsedValue = newParsedValue;
27
+ _this.type = typeArg;
28
+ return _this;
29
+ }
30
+
31
+ MutationEvent.ADDITION = 2;
32
+ MutationEvent.MODIFICATION = 1;
33
+ MutationEvent.REMOVAL = 3;
34
+ return MutationEvent;
35
+ }(_FederatedEvent.FederatedEvent);
36
+
37
+ exports.MutationEvent = MutationEvent;
@@ -0,0 +1,36 @@
1
+ import 'setimmediate';
2
+ import type { IElement, DisplayObject } from '..';
3
+ import { MutationEvent } from './MutationEvent';
4
+ import { MutationRecord } from './MutationRecord';
5
+ export declare class Registration {
6
+ observer: MutationObserver;
7
+ target: IElement;
8
+ options?: MutationObserverInit;
9
+ private transientObservedNodes;
10
+ constructor(observer: MutationObserver, target: IElement, options?: MutationObserverInit);
11
+ enqueue(record: MutationRecord): void;
12
+ addListeners(): void;
13
+ private addListeners_;
14
+ removeListeners(): void;
15
+ removeListeners_(node: IElement): void;
16
+ /**
17
+ * Adds a transient observer on node. The transient observer gets removed
18
+ * next time we deliver the change records.
19
+ */
20
+ removeTransientObservers(): void;
21
+ handleEvent(e: MutationEvent): void;
22
+ }
23
+ /**
24
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver
25
+ * @see https://github.com/googlearchive/MutationObservers/blob/master/MutationObserver.js
26
+ */
27
+ export declare class MutationObserver {
28
+ callback: MutationCallback;
29
+ nodes: IElement[];
30
+ records: MutationRecord[];
31
+ uid: number;
32
+ constructor(callback: MutationCallback);
33
+ observe(target: DisplayObject, options?: MutationObserverInit): void;
34
+ disconnect(): void;
35
+ takeRecords(): MutationRecord[];
36
+ }