@antv/g 5.0.1 → 5.0.2

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 (173) hide show
  1. package/LICENSE +21 -0
  2. package/dist/index.umd.js +2 -2
  3. package/es/AbstractRenderer.d.ts +7 -7
  4. package/es/Canvas.d.ts +1 -1
  5. package/es/Canvas.js +1 -1
  6. package/es/camera/Camera.js +3 -5
  7. package/es/components/Geometry.d.ts +1 -1
  8. package/es/components/Renderable.d.ts +1 -1
  9. package/es/display-objects/CustomElement.d.ts +3 -3
  10. package/es/display-objects/CustomElement.js +4 -1
  11. package/es/display-objects/DisplayObject.d.ts +4 -3
  12. package/es/display-objects/DisplayObject.js +4 -3
  13. package/es/display-objects/Group.d.ts +1 -1
  14. package/es/display-objects/HTML.d.ts +1 -1
  15. package/es/display-objects/Image.d.ts +1 -1
  16. package/es/display-objects/Path.d.ts +1 -1
  17. package/es/display-objects/Polygon.d.ts +1 -1
  18. package/es/display-objects/Polyline.d.ts +1 -1
  19. package/es/display-objects/Text.d.ts +1 -1
  20. package/es/display-objects/Text.js +1 -1
  21. package/es/dom/Animation.js +9 -4
  22. package/es/dom/AnimationEffectTiming.d.ts +0 -1
  23. package/es/dom/AnimationTimeline.js +2 -1
  24. package/es/dom/CustomElementRegistry.d.ts +1 -1
  25. package/es/dom/CustomEvent.js +2 -1
  26. package/es/dom/Document.d.ts +2 -2
  27. package/es/dom/Document.js +13 -6
  28. package/es/dom/Element.d.ts +3 -4
  29. package/es/dom/Element.js +5 -4
  30. package/es/dom/EventTarget.js +1 -0
  31. package/es/dom/FederatedEvent.d.ts +1 -1
  32. package/es/dom/KeyframeEffect.js +1 -1
  33. package/es/dom/Node.d.ts +1 -1
  34. package/es/dom/Node.js +11 -5
  35. package/es/dom/interfaces.d.ts +57 -57
  36. package/es/plugins/CullingPlugin.d.ts +3 -3
  37. package/es/plugins/DirtyCheckPlugin.d.ts +1 -1
  38. package/es/plugins/EventPlugin.d.ts +2 -1
  39. package/es/plugins/FrustumCullingStrategy.d.ts +1 -2
  40. package/es/plugins/FrustumCullingStrategy.js +29 -32
  41. package/es/plugins/PrepareRendererPlugin.d.ts +1 -1
  42. package/es/plugins/PrepareRendererPlugin.js +7 -20
  43. package/es/property-handlers/aabb.js +16 -19
  44. package/es/property-handlers/anchor.d.ts +2 -1
  45. package/es/property-handlers/anchor.js +2 -2
  46. package/es/property-handlers/clipPath.js +2 -2
  47. package/es/property-handlers/color.d.ts +3 -4
  48. package/es/property-handlers/color.js +2 -2
  49. package/es/property-handlers/filter.d.ts +3 -4
  50. package/es/property-handlers/filter.js +2 -2
  51. package/es/property-handlers/interfaces.d.ts +1 -1
  52. package/es/property-handlers/lineDash.d.ts +1 -2
  53. package/es/property-handlers/lineDash.js +1 -1
  54. package/es/property-handlers/path.d.ts +2 -3
  55. package/es/property-handlers/path.js +2 -2
  56. package/es/property-handlers/points.d.ts +1 -2
  57. package/es/property-handlers/points.js +1 -1
  58. package/es/property-handlers/transform.d.ts +1 -1
  59. package/es/property-handlers/transform.js +0 -5
  60. package/es/services/ContextService.d.ts +8 -8
  61. package/es/services/EventService.d.ts +2 -2
  62. package/es/services/RenderingContext.d.ts +2 -2
  63. package/es/services/RenderingService.d.ts +18 -18
  64. package/es/services/RenderingService.js +3 -3
  65. package/es/services/SceneGraphSelector.d.ts +5 -5
  66. package/es/services/SceneGraphSelector.js +3 -2
  67. package/es/services/SceneGraphService.d.ts +36 -34
  68. package/es/services/SceneGraphService.js +33 -4
  69. package/es/services/aabb/PathUpdater.d.ts +1 -2
  70. package/es/services/aabb/PathUpdater.js +1 -1
  71. package/es/services/aabb/interfaces.d.ts +1 -1
  72. package/es/services/text/index.js +1 -1
  73. package/es/shapes/AABB.d.ts +3 -2
  74. package/es/shapes/Frustum.d.ts +1 -1
  75. package/es/shapes/Polygon.d.ts +1 -1
  76. package/es/shapes/Ray.d.ts +3 -3
  77. package/es/types.d.ts +1 -1
  78. package/es/utils/custom-easing.d.ts +3 -5
  79. package/es/utils/custom-easing.js +2 -1
  80. package/es/utils/event.d.ts +1 -1
  81. package/es/utils/interpolation.js +6 -9
  82. package/es/utils/math.d.ts +2 -1
  83. package/es/utils/math.js +1 -2
  84. package/es/utils/path.d.ts +1 -1
  85. package/es/utils/path.js +4 -7
  86. package/es/utils/raf.js +2 -1
  87. package/lib/AbstractRenderer.d.ts +7 -7
  88. package/lib/Canvas.d.ts +1 -1
  89. package/lib/Canvas.js +1 -1
  90. package/lib/camera/Camera.js +4 -5
  91. package/lib/components/Geometry.d.ts +1 -1
  92. package/lib/components/Renderable.d.ts +1 -1
  93. package/lib/display-objects/CustomElement.d.ts +3 -3
  94. package/lib/display-objects/CustomElement.js +4 -1
  95. package/lib/display-objects/DisplayObject.d.ts +4 -3
  96. package/lib/display-objects/DisplayObject.js +6 -3
  97. package/lib/display-objects/Group.d.ts +1 -1
  98. package/lib/display-objects/HTML.d.ts +1 -1
  99. package/lib/display-objects/Image.d.ts +1 -1
  100. package/lib/display-objects/Path.d.ts +1 -1
  101. package/lib/display-objects/Polygon.d.ts +1 -1
  102. package/lib/display-objects/Polyline.d.ts +1 -1
  103. package/lib/display-objects/Text.d.ts +1 -1
  104. package/lib/display-objects/Text.js +1 -1
  105. package/lib/dom/Animation.js +9 -4
  106. package/lib/dom/AnimationEffectTiming.d.ts +0 -1
  107. package/lib/dom/AnimationTimeline.js +2 -1
  108. package/lib/dom/CustomElementRegistry.d.ts +1 -1
  109. package/lib/dom/CustomEvent.js +1 -1
  110. package/lib/dom/Document.d.ts +2 -2
  111. package/lib/dom/Document.js +13 -6
  112. package/lib/dom/Element.d.ts +3 -4
  113. package/lib/dom/Element.js +5 -4
  114. package/lib/dom/EventTarget.js +1 -0
  115. package/lib/dom/FederatedEvent.d.ts +1 -1
  116. package/lib/dom/KeyframeEffect.js +1 -1
  117. package/lib/dom/Node.d.ts +1 -1
  118. package/lib/dom/Node.js +11 -5
  119. package/lib/dom/interfaces.d.ts +57 -57
  120. package/lib/plugins/CullingPlugin.d.ts +3 -3
  121. package/lib/plugins/DirtyCheckPlugin.d.ts +1 -1
  122. package/lib/plugins/EventPlugin.d.ts +2 -1
  123. package/lib/plugins/FrustumCullingStrategy.d.ts +1 -2
  124. package/lib/plugins/FrustumCullingStrategy.js +26 -30
  125. package/lib/plugins/PrepareRendererPlugin.d.ts +1 -1
  126. package/lib/plugins/PrepareRendererPlugin.js +6 -19
  127. package/lib/property-handlers/aabb.js +15 -19
  128. package/lib/property-handlers/anchor.d.ts +2 -1
  129. package/lib/property-handlers/anchor.js +2 -2
  130. package/lib/property-handlers/clipPath.js +2 -2
  131. package/lib/property-handlers/color.d.ts +3 -4
  132. package/lib/property-handlers/color.js +2 -2
  133. package/lib/property-handlers/filter.d.ts +3 -4
  134. package/lib/property-handlers/filter.js +2 -2
  135. package/lib/property-handlers/interfaces.d.ts +1 -1
  136. package/lib/property-handlers/lineDash.d.ts +1 -2
  137. package/lib/property-handlers/lineDash.js +1 -1
  138. package/lib/property-handlers/path.d.ts +2 -3
  139. package/lib/property-handlers/path.js +2 -2
  140. package/lib/property-handlers/points.d.ts +1 -2
  141. package/lib/property-handlers/points.js +1 -1
  142. package/lib/property-handlers/transform.d.ts +1 -1
  143. package/lib/property-handlers/transform.js +0 -4
  144. package/lib/services/ContextService.d.ts +8 -8
  145. package/lib/services/EventService.d.ts +2 -2
  146. package/lib/services/RenderingContext.d.ts +2 -2
  147. package/lib/services/RenderingService.d.ts +18 -18
  148. package/lib/services/RenderingService.js +3 -3
  149. package/lib/services/SceneGraphSelector.d.ts +5 -5
  150. package/lib/services/SceneGraphSelector.js +3 -2
  151. package/lib/services/SceneGraphService.d.ts +36 -34
  152. package/lib/services/SceneGraphService.js +35 -4
  153. package/lib/services/aabb/PathUpdater.d.ts +1 -2
  154. package/lib/services/aabb/PathUpdater.js +1 -1
  155. package/lib/services/aabb/interfaces.d.ts +1 -1
  156. package/lib/services/text/index.js +1 -1
  157. package/lib/shapes/AABB.d.ts +3 -2
  158. package/lib/shapes/Frustum.d.ts +1 -1
  159. package/lib/shapes/Polygon.d.ts +1 -1
  160. package/lib/shapes/Ray.d.ts +3 -3
  161. package/lib/types.d.ts +1 -1
  162. package/lib/utils/custom-easing.d.ts +3 -5
  163. package/lib/utils/custom-easing.js +2 -1
  164. package/lib/utils/event.d.ts +1 -1
  165. package/lib/utils/interpolation.js +6 -9
  166. package/lib/utils/math.d.ts +2 -1
  167. package/lib/utils/math.js +1 -2
  168. package/lib/utils/path.d.ts +2 -2
  169. package/lib/utils/path.js +4 -7
  170. package/lib/utils/raf.js +2 -1
  171. package/package.json +6 -6
  172. package/lib/dom/__tests__/utils/easing.d.ts +0 -14
  173. package/lib/dom/__tests__/utils/keyframe.d.ts +0 -38
@@ -894,17 +894,16 @@ function (_super) {
894
894
 
895
895
 
896
896
  Camera.prototype.computeMatrix = function () {
897
- var rotX;
898
- var rotY; // 使用四元数描述 3D 旋转
897
+ // 使用四元数描述 3D 旋转
899
898
  // @see https://xiaoiver.github.io/coding/2018/12/28/Camera-%E8%AE%BE%E8%AE%A1-%E4%B8%80.html
900
-
901
899
  var rotZ = _glMatrix.quat.setAxisAngle(_glMatrix.quat.create(), [0, 0, 1], this.roll * DEG_2_RAD);
902
900
 
903
901
  _glMatrix.mat4.identity(this.matrix); // only consider HCS for EXPLORING and ORBITING cameras
904
902
 
905
903
 
906
- rotX = _glMatrix.quat.setAxisAngle(_glMatrix.quat.create(), [1, 0, 0], (this.rotateWorld && this.type !== CAMERA_TYPE.TRACKING || this.type === CAMERA_TYPE.TRACKING ? 1 : -1) * this.elevation * DEG_2_RAD);
907
- rotY = _glMatrix.quat.setAxisAngle(_glMatrix.quat.create(), [0, 1, 0], (this.rotateWorld && this.type !== CAMERA_TYPE.TRACKING || this.type === CAMERA_TYPE.TRACKING ? 1 : -1) * this.azimuth * DEG_2_RAD);
904
+ var rotX = _glMatrix.quat.setAxisAngle(_glMatrix.quat.create(), [1, 0, 0], (this.rotateWorld && this.type !== CAMERA_TYPE.TRACKING || this.type === CAMERA_TYPE.TRACKING ? 1 : -1) * this.elevation * DEG_2_RAD);
905
+
906
+ var rotY = _glMatrix.quat.setAxisAngle(_glMatrix.quat.create(), [0, 1, 0], (this.rotateWorld && this.type !== CAMERA_TYPE.TRACKING || this.type === CAMERA_TYPE.TRACKING ? 1 : -1) * this.azimuth * DEG_2_RAD);
908
907
 
909
908
  var rotQ = _glMatrix.quat.multiply(_glMatrix.quat.create(), rotY, rotX);
910
909
 
@@ -1,4 +1,4 @@
1
- import { AABB } from '../shapes';
1
+ import type { AABB } from '../shapes';
2
2
  export declare class Geometry {
3
3
  static tag: string;
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { AABB } from '../shapes';
1
+ import type { AABB } from '../shapes';
2
2
  export declare class Renderable {
3
3
  static tag: string;
4
4
  /**
@@ -4,12 +4,12 @@ export interface CustomElement<CustomElementStyleProps> {
4
4
  /**
5
5
  * fired after element insert into DOM tree
6
6
  */
7
- connectedCallback?(): void;
7
+ connectedCallback?: () => void;
8
8
  /**
9
9
  * fired before element removed from DOM tree
10
10
  */
11
- disconnectedCallback?(): void;
12
- attributeChangedCallback?<Key extends keyof CustomElementStyleProps>(name: Key, oldValue: CustomElementStyleProps[Key], newValue: CustomElementStyleProps[Key]): void;
11
+ disconnectedCallback?: () => void;
12
+ attributeChangedCallback?: <Key extends keyof CustomElementStyleProps>(name: Key, oldValue: CustomElementStyleProps[Key], newValue: CustomElementStyleProps[Key]) => void;
13
13
  }
14
14
  /**
15
15
  * shadow root
@@ -58,7 +58,10 @@ function (_super) {
58
58
  attributeName = _a.attributeName,
59
59
  oldValue = _a.oldValue,
60
60
  newValue = _a.newValue;
61
- _this.attributeChangedCallback && _this.attributeChangedCallback(attributeName, oldValue, newValue);
61
+
62
+ if (_this.attributeChangedCallback) {
63
+ _this.attributeChangedCallback(attributeName, oldValue, newValue);
64
+ }
62
65
  }; // this.addEventListener(ElementEvent.CHILD_INSERTED, this.handleChildInserted);
63
66
  // this.addEventListener(ElementEvent.CHILD_REMOVED, this.handleChildRemoved);
64
67
 
@@ -1,9 +1,10 @@
1
- import { mat3, mat4, quat, vec2, vec3 } from 'gl-matrix';
2
- import { Animation } from '../dom/Animation';
1
+ import type { mat3, vec2 } from 'gl-matrix';
2
+ import { mat4, quat, vec3 } from 'gl-matrix';
3
+ import type { Animation } from '../dom/Animation';
3
4
  import { Element } from '../dom/Element';
4
5
  import type { DisplayObjectConfig, INode } from '../dom/interfaces';
5
6
  import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
6
- import { StylePropertyParser, StylePropertyUpdater } from '../property-handlers';
7
+ import type { StylePropertyParser, StylePropertyUpdater } from '../property-handlers';
7
8
  /**
8
9
  * prototype chains: DisplayObject -> Element -> Node -> EventTarget
9
10
  *
@@ -27,6 +27,8 @@ var _propertyHandlers = require("../property-handlers");
27
27
 
28
28
  var _globalModule = require("../global-module");
29
29
 
30
+ var _services = require("../services");
31
+
30
32
  var DEFAULT_STYLE_PROPS = {
31
33
  anchor: [0, 0, 0],
32
34
  origin: [0, 0, 0],
@@ -61,7 +63,7 @@ function (_super) {
61
63
  function DisplayObject(config) {
62
64
  var _a, _b, _c;
63
65
 
64
- var _this = _super.call(this, config) || this;
66
+ var _this = _super.call(this) || this;
65
67
  /**
66
68
  * push to active animations after calling `animate()`
67
69
  */
@@ -242,7 +244,7 @@ function (_super) {
242
244
 
243
245
  if (this.attributes.clipPathTargets && this.attributes.clipPathTargets.length) {
244
246
  this.attributes.clipPathTargets.forEach(function (target) {
245
- target.emit(_interfaces.ElementEvent.BOUNDS_CHANGED, {});
247
+ (0, _services.dirtifyToRoot)(target);
246
248
  target.emit(_interfaces.ElementEvent.ATTRIBUTE_CHANGED, {
247
249
  attributeName: 'clipPath',
248
250
  oldValue: _this,
@@ -815,7 +817,8 @@ function (_super) {
815
817
  sx = _b[0],
816
818
  sy = _b[1];
817
819
 
818
- var rotation = _glMatrix.mat4.getRotation(_glMatrix.quat.create(), transform);
820
+ var rotation = _glMatrix.mat4.getRotation(_glMatrix.quat.create(), transform); // eslint-disable-next-line @typescript-eslint/no-unused-vars
821
+
819
822
 
820
823
  var _c = (0, _tslib.__read)((0, _utils.getEuler)(_glMatrix.vec3.create(), rotation), 3),
821
824
  eux = _c[0],
@@ -1,6 +1,6 @@
1
1
  import type { BaseStyleProps } from '../types';
2
2
  import { DisplayObject } from './DisplayObject';
3
- import { DisplayObjectConfig } from '../dom';
3
+ import type { DisplayObjectConfig } from '../dom';
4
4
  export declare class Group extends DisplayObject {
5
5
  constructor(config?: DisplayObjectConfig<BaseStyleProps>);
6
6
  }
@@ -1,6 +1,6 @@
1
1
  import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
2
2
  import { DisplayObject } from './DisplayObject';
3
- import { DisplayObjectConfig } from '../dom';
3
+ import type { DisplayObjectConfig } from '../dom';
4
4
  import { AABB } from '../shapes';
5
5
  export interface HTMLStyleProps extends BaseStyleProps {
6
6
  innerHTML: string | HTMLElement;
@@ -1,6 +1,6 @@
1
1
  import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
2
2
  import { DisplayObject } from './DisplayObject';
3
- import { DisplayObjectConfig } from '../dom';
3
+ import type { DisplayObjectConfig } from '../dom';
4
4
  export interface ImageStyleProps extends BaseStyleProps {
5
5
  img: string | HTMLImageElement;
6
6
  width?: number;
@@ -1,6 +1,6 @@
1
1
  import type { BaseStyleProps, PathCommand } from '../types';
2
2
  import { DisplayObject } from './DisplayObject';
3
- import { DisplayObjectConfig } from '../dom';
3
+ import type { DisplayObjectConfig } from '../dom';
4
4
  import { Point } from '../shapes';
5
5
  import type { Rect } from '../shapes/Rect';
6
6
  export interface PathStyleProps extends BaseStyleProps {
@@ -1,6 +1,6 @@
1
1
  import type { BaseStyleProps } from '../types';
2
2
  import { DisplayObject } from './DisplayObject';
3
- import { DisplayObjectConfig } from '../dom';
3
+ import type { DisplayObjectConfig } from '../dom';
4
4
  import type { ParsedPolylineStyleProps } from './Polyline';
5
5
  export interface PolygonStyleProps extends BaseStyleProps {
6
6
  points: [number, number][];
@@ -1,6 +1,6 @@
1
1
  import type { BaseStyleProps } from '../types';
2
2
  import { DisplayObject } from './DisplayObject';
3
- import { DisplayObjectConfig } from '../dom';
3
+ import type { DisplayObjectConfig } from '../dom';
4
4
  import { Point } from '../shapes';
5
5
  export interface PolylineStyleProps extends BaseStyleProps {
6
6
  points: [number, number][];
@@ -1,4 +1,4 @@
1
- import { TextMetrics } from '../services/text';
1
+ import type { TextMetrics } from '../services/text';
2
2
  import type { DisplayObjectConfig } from '../dom/interfaces';
3
3
  import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
4
4
  import { DisplayObject } from './DisplayObject';
@@ -60,7 +60,7 @@ function (_super) {
60
60
  Text.prototype.getLineBoundingRects = function () {
61
61
  var _a;
62
62
 
63
- return (_a = this.parsedStyle.metrics) === null || _a === void 0 ? void 0 : _a.lineMetrics;
63
+ return ((_a = this.parsedStyle.metrics) === null || _a === void 0 ? void 0 : _a.lineMetrics) || [];
64
64
  };
65
65
 
66
66
  return Text;
@@ -427,15 +427,18 @@ function () {
427
427
 
428
428
  Animation.prototype.persist = function () {
429
429
  throw new Error('Method not implemented.');
430
- };
430
+ }; // eslint-disable-next-line @typescript-eslint/no-unused-vars
431
+
431
432
 
432
433
  Animation.prototype.addEventListener = function (type, listener, options) {
433
434
  throw new Error('Method not implemented.');
434
- };
435
+ }; // eslint-disable-next-line @typescript-eslint/no-unused-vars
436
+
435
437
 
436
438
  Animation.prototype.removeEventListener = function (type, listener, options) {
437
439
  throw new Error('Method not implemented.');
438
- };
440
+ }; // eslint-disable-next-line @typescript-eslint/no-unused-vars
441
+
439
442
 
440
443
  Animation.prototype.dispatchEvent = function (event) {
441
444
  throw new Error('Method not implemented.');
@@ -484,7 +487,9 @@ function () {
484
487
  if (this.onfinish) {
485
488
  var event_1 = new _AnimationEvent.AnimationEvent(null, this, this.currentTime, baseTime);
486
489
  setTimeout(function () {
487
- _this.onfinish && _this.onfinish(event_1);
490
+ if (_this.onfinish) {
491
+ _this.onfinish(event_1);
492
+ }
488
493
  });
489
494
  }
490
495
 
@@ -55,5 +55,4 @@ export declare class AnimationEffectTiming implements EffectTiming {
55
55
  endTime: number;
56
56
  currentIteration: number | null;
57
57
  progress: number | null;
58
- constructor();
59
58
  }
@@ -165,7 +165,8 @@ function () {
165
165
 
166
166
  this.rafCallbacks.push([id, f]);
167
167
  return id;
168
- };
168
+ }; // eslint-disable-next-line @typescript-eslint/ban-types
169
+
169
170
 
170
171
  AnimationTimeline.prototype.requestAnimationFrame = function (f) {
171
172
  var _this = this;
@@ -1,4 +1,4 @@
1
- import { DisplayObject } from '../display-objects';
1
+ import type { DisplayObject } from '../display-objects';
2
2
  /**
3
3
  * canvas.customElements
4
4
  *
@@ -24,7 +24,7 @@ var _FederatedEvent = require("./FederatedEvent");
24
24
  var CustomEvent =
25
25
  /** @class */
26
26
  function (_super) {
27
- (0, _tslib.__extends)(CustomEvent, _super);
27
+ (0, _tslib.__extends)(CustomEvent, _super); // eslint-disable-next-line @typescript-eslint/ban-types
28
28
 
29
29
  function CustomEvent(eventName, object) {
30
30
  var _this = _super.call(this, null) || this;
@@ -1,9 +1,9 @@
1
1
  import { Node } from './Node';
2
2
  import { AnimationTimeline } from './AnimationTimeline';
3
3
  import { Group } from '../display-objects/Group';
4
- import { DisplayObject } from '../display-objects/DisplayObject';
4
+ import type { DisplayObject } from '../display-objects/DisplayObject';
5
5
  import type { IDocument, IElement, INode, ICanvas, DisplayObjectConfig } from './interfaces';
6
- import { BaseStyleProps } from '../types';
6
+ import type { BaseStyleProps } from '../types';
7
7
  /**
8
8
  * the entry of DOM tree
9
9
  * Document -> Node -> EventTarget
@@ -81,7 +81,8 @@ function (_super) {
81
81
  Document.prototype.createElement = function (tagName, options) {
82
82
  var clazz = this.defaultView.customElements.get(tagName);
83
83
  return new clazz(options);
84
- };
84
+ }; // eslint-disable-next-line @typescript-eslint/no-unused-vars
85
+
85
86
 
86
87
  Document.prototype.cloneNode = function (deep) {
87
88
  throw new Error('Method not implemented.');
@@ -97,23 +98,28 @@ function (_super) {
97
98
  /**
98
99
  * eg. Uncaught DOMException: Failed to execute 'appendChild' on 'Node': Only one element on document allowed.
99
100
  */
101
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
100
102
 
101
103
 
102
104
  Document.prototype.appendChild = function (newChild, index) {
103
105
  throw new Error('Use document.documentElement instead.');
104
- };
106
+ }; // eslint-disable-next-line @typescript-eslint/no-unused-vars
107
+
105
108
 
106
109
  Document.prototype.insertBefore = function (newChild, refChild) {
107
110
  throw new Error('Use document.documentElement instead.');
108
- };
111
+ }; // eslint-disable-next-line @typescript-eslint/no-unused-vars
112
+
109
113
 
110
114
  Document.prototype.removeChild = function (oldChild, destroy) {
111
115
  throw new Error('Use document.documentElement instead.');
112
- };
116
+ }; // eslint-disable-next-line @typescript-eslint/no-unused-vars
117
+
113
118
 
114
119
  Document.prototype.replaceChild = function (newChild, oldChild, destroy) {
115
120
  throw new Error('Use document.documentElement instead.');
116
- };
121
+ }; // eslint-disable-next-line @typescript-eslint/no-unused-vars
122
+
117
123
 
118
124
  Document.prototype.append = function () {
119
125
  var nodes = [];
@@ -123,7 +129,8 @@ function (_super) {
123
129
  }
124
130
 
125
131
  throw new Error('Use document.documentElement instead.');
126
- };
132
+ }; // eslint-disable-next-line @typescript-eslint/no-unused-vars
133
+
127
134
 
128
135
  Document.prototype.prepend = function () {
129
136
  var nodes = [];
@@ -1,9 +1,9 @@
1
1
  import { SceneGraphService } from '../services/SceneGraphService';
2
2
  import { Cullable, Geometry, Renderable, Transform, Sortable } from '../components';
3
- import { BaseStyleProps, ParsedBaseStyleProps } from '../types';
3
+ import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
4
4
  import { Node } from './Node';
5
- import { AABB, Rectangle } from '../shapes';
6
- import type { DisplayObjectConfig, IEventTarget, IChildNode, IElement, INode } from './interfaces';
5
+ import type { AABB, Rectangle } from '../shapes';
6
+ import type { IEventTarget, IChildNode, IElement, INode } from './interfaces';
7
7
  /**
8
8
  * Has following capabilities:
9
9
  * * Node insert/remove, eg. appendChild, removeChild, remove...
@@ -19,7 +19,6 @@ export declare class Element<StyleProps extends BaseStyleProps = any, ParsedStyl
19
19
  transformable: Transform;
20
20
  sortable: Sortable;
21
21
  geometry: Geometry;
22
- constructor(config: DisplayObjectConfig<StyleProps>);
23
22
  /**
24
23
  * used with `getElementById()`
25
24
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/id
@@ -32,8 +32,8 @@ var Element =
32
32
  function (_super) {
33
33
  (0, _tslib.__extends)(Element, _super);
34
34
 
35
- function Element(config) {
36
- var _this = _super.call(this) || this;
35
+ function Element() {
36
+ var _this = _super !== null && _super.apply(this, arguments) || this;
37
37
 
38
38
  _this.sceneGraphService = _globalModule.globalContainer.get(_SceneGraphService.SceneGraphService);
39
39
  _this.entity = entityCounter++;
@@ -143,7 +143,7 @@ function (_super) {
143
143
  },
144
144
  enumerable: false,
145
145
  configurable: true
146
- });
146
+ }); // eslint-disable-next-line @typescript-eslint/no-unused-vars
147
147
 
148
148
  Element.prototype.cloneNode = function (deep) {
149
149
  throw new Error('Method not implemented.');
@@ -490,7 +490,8 @@ function (_super) {
490
490
  */
491
491
 
492
492
 
493
- Element.prototype.setAttribute = function (attributeName, value, force) {
493
+ Element.prototype.setAttribute = function (attributeName, value, // eslint-disable-next-line @typescript-eslint/no-unused-vars
494
+ force) {
494
495
  if (force === void 0) {
495
496
  force = false;
496
497
  }
@@ -132,6 +132,7 @@ function () {
132
132
  * @deprecated
133
133
  * @alias dispatchEvent
134
134
  */
135
+ // eslint-disable-next-line @typescript-eslint/ban-types
135
136
 
136
137
 
137
138
  EventTarget.prototype.emit = function (eventName, object) {
@@ -1,6 +1,6 @@
1
1
  import { Point } from '../shapes/Point';
2
2
  import type { EventService } from '../services';
3
- import { IEventTarget } from './interfaces';
3
+ import type { IEventTarget } 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}.
@@ -131,7 +131,7 @@ function () {
131
131
 
132
132
  return target[prop];
133
133
  },
134
- set: function set(_, prop, value) {
134
+ set: function set() {
135
135
  return true;
136
136
  }
137
137
  });
package/lib/dom/Node.d.ts CHANGED
@@ -48,7 +48,7 @@ export declare abstract class Node extends EventTarget implements INode {
48
48
  /**
49
49
  * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/getRootNode
50
50
  */
51
- getRootNode(options?: GetRootNodeOptions): INode;
51
+ getRootNode(): INode;
52
52
  hasChildNodes(): boolean;
53
53
  isDefaultNamespace(namespace: string | null): boolean;
54
54
  compareDocumentPosition(other: INode): number;
package/lib/dom/Node.js CHANGED
@@ -84,7 +84,8 @@ function (_super) {
84
84
  */
85
85
 
86
86
 
87
- Node.prototype.getRootNode = function (options) {
87
+ Node.prototype.getRootNode = function () {
88
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
88
89
  var temp = this;
89
90
 
90
91
  while (temp.parentNode) {
@@ -96,19 +97,23 @@ function (_super) {
96
97
 
97
98
  Node.prototype.hasChildNodes = function () {
98
99
  return this.childNodes.length > 0;
99
- };
100
+ }; // eslint-disable-next-line @typescript-eslint/no-unused-vars
101
+
100
102
 
101
103
  Node.prototype.isDefaultNamespace = function (namespace) {
102
104
  throw new Error('Method not implemented.');
103
- };
105
+ }; // eslint-disable-next-line @typescript-eslint/no-unused-vars
106
+
104
107
 
105
108
  Node.prototype.compareDocumentPosition = function (other) {
106
109
  throw new Error('Method not implemented.');
107
- };
110
+ }; // eslint-disable-next-line @typescript-eslint/no-unused-vars
111
+
108
112
 
109
113
  Node.prototype.lookupNamespaceURI = function (prefix) {
110
114
  throw new Error('Method not implemented.');
111
- };
115
+ }; // eslint-disable-next-line @typescript-eslint/no-unused-vars
116
+
112
117
 
113
118
  Node.prototype.lookupPrefix = function (namespace) {
114
119
  throw new Error('Method not implemented.');
@@ -198,6 +203,7 @@ function (_super) {
198
203
  };
199
204
 
200
205
  Node.prototype.getAncestor = function (n) {
206
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
201
207
  var temp = this;
202
208
 
203
209
  while (n > 0 && temp) {