@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
@@ -1,19 +1,19 @@
1
- import { Syringe } from 'mana-syringe';
2
- import { RendererConfig } from './types';
1
+ import type { Syringe } from 'mana-syringe';
2
+ import type { RendererConfig } from './types';
3
3
  export interface RendererPlugin {
4
- init(container: Syringe.Container): void;
5
- destroy(container: Syringe.Container): void;
4
+ init: (container: Syringe.Container) => void;
5
+ destroy: (container: Syringe.Container) => void;
6
6
  }
7
7
  export interface IRenderer {
8
- getConfig(): RendererConfig;
8
+ getConfig: () => RendererConfig;
9
9
  /**
10
10
  * register plugin at runtime
11
11
  */
12
- registerPlugin(plugin: RendererPlugin): void;
12
+ registerPlugin: (plugin: RendererPlugin) => void;
13
13
  /**
14
14
  * return all registered plugins
15
15
  */
16
- getPlugins(): RendererPlugin[];
16
+ getPlugins: () => RendererPlugin[];
17
17
  }
18
18
  export declare class AbstractRenderer implements IRenderer {
19
19
  private plugins;
package/es/Canvas.d.ts CHANGED
@@ -5,7 +5,7 @@ import { RenderingService } from './services/RenderingService';
5
5
  import { RenderingContext } from './services/RenderingContext';
6
6
  import { EventService } from './services/EventService';
7
7
  import { Camera } from './camera';
8
- import { AbstractRenderer } from './AbstractRenderer';
8
+ import type { AbstractRenderer } from './AbstractRenderer';
9
9
  import type { PointLike } from './shapes';
10
10
  import { Document, EventTarget } from './dom';
11
11
  import type { IElement, INode, ICanvas } from './dom/interfaces';
package/es/Canvas.js CHANGED
@@ -291,7 +291,7 @@ function (_super) {
291
291
  if (renderable) {
292
292
  renderable.renderBoundsDirty = true;
293
293
  renderable.boundsDirty = true;
294
- renderable.dirty = true; // element.emit(ElementEvent.BOUNDS_CHANGED, {});
294
+ renderable.dirty = true;
295
295
  }
296
296
  }); // keep current scenegraph unchanged, just trigger mounted event
297
297
 
@@ -842,15 +842,13 @@ function (_super) {
842
842
 
843
843
 
844
844
  Camera.prototype.computeMatrix = function () {
845
- var rotX;
846
- var rotY; // 使用四元数描述 3D 旋转
845
+ // 使用四元数描述 3D 旋转
847
846
  // @see https://xiaoiver.github.io/coding/2018/12/28/Camera-%E8%AE%BE%E8%AE%A1-%E4%B8%80.html
848
-
849
847
  var rotZ = quat.setAxisAngle(quat.create(), [0, 0, 1], this.roll * DEG_2_RAD);
850
848
  mat4.identity(this.matrix); // only consider HCS for EXPLORING and ORBITING cameras
851
849
 
852
- rotX = quat.setAxisAngle(quat.create(), [1, 0, 0], (this.rotateWorld && this.type !== CAMERA_TYPE.TRACKING || this.type === CAMERA_TYPE.TRACKING ? 1 : -1) * this.elevation * DEG_2_RAD);
853
- rotY = quat.setAxisAngle(quat.create(), [0, 1, 0], (this.rotateWorld && this.type !== CAMERA_TYPE.TRACKING || this.type === CAMERA_TYPE.TRACKING ? 1 : -1) * this.azimuth * DEG_2_RAD);
850
+ var rotX = quat.setAxisAngle(quat.create(), [1, 0, 0], (this.rotateWorld && this.type !== CAMERA_TYPE.TRACKING || this.type === CAMERA_TYPE.TRACKING ? 1 : -1) * this.elevation * DEG_2_RAD);
851
+ var rotY = quat.setAxisAngle(quat.create(), [0, 1, 0], (this.rotateWorld && this.type !== CAMERA_TYPE.TRACKING || this.type === CAMERA_TYPE.TRACKING ? 1 : -1) * this.azimuth * DEG_2_RAD);
854
852
  var rotQ = quat.multiply(quat.create(), rotY, rotX);
855
853
  rotQ = quat.multiply(quat.create(), rotQ, rotZ);
856
854
  var rotMatrix = mat4.fromQuat(mat4.create(), rotQ);
@@ -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
@@ -50,7 +50,10 @@ function (_super) {
50
50
  attributeName = _a.attributeName,
51
51
  oldValue = _a.oldValue,
52
52
  newValue = _a.newValue;
53
- _this.attributeChangedCallback && _this.attributeChangedCallback(attributeName, oldValue, newValue);
53
+
54
+ if (_this.attributeChangedCallback) {
55
+ _this.attributeChangedCallback(attributeName, oldValue, newValue);
56
+ }
54
57
  }; // this.addEventListener(ElementEvent.CHILD_INSERTED, this.handleChildInserted);
55
58
  // this.addEventListener(ElementEvent.CHILD_REMOVED, this.handleChildRemoved);
56
59
 
@@ -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
  *
@@ -9,6 +9,7 @@ import { SHAPE } from '../types';
9
9
  import { createVec3, fromRotationTranslationScale, getEuler, rad2deg } from '../utils';
10
10
  import { StylePropertyParserFactory, StylePropertyUpdaterFactory } from '../property-handlers';
11
11
  import { globalContainer } from '../global-module';
12
+ import { dirtifyToRoot } from '../services';
12
13
  var DEFAULT_STYLE_PROPS = {
13
14
  anchor: [0, 0, 0],
14
15
  origin: [0, 0, 0],
@@ -43,7 +44,7 @@ function (_super) {
43
44
  function DisplayObject(config) {
44
45
  var _a, _b, _c;
45
46
 
46
- var _this = _super.call(this, config) || this;
47
+ var _this = _super.call(this) || this;
47
48
  /**
48
49
  * push to active animations after calling `animate()`
49
50
  */
@@ -222,7 +223,7 @@ function (_super) {
222
223
 
223
224
  if (this.attributes.clipPathTargets && this.attributes.clipPathTargets.length) {
224
225
  this.attributes.clipPathTargets.forEach(function (target) {
225
- target.emit(ElementEvent.BOUNDS_CHANGED, {});
226
+ dirtifyToRoot(target);
226
227
  target.emit(ElementEvent.ATTRIBUTE_CHANGED, {
227
228
  attributeName: 'clipPath',
228
229
  oldValue: _this,
@@ -795,7 +796,7 @@ function (_super) {
795
796
  sx = _b[0],
796
797
  sy = _b[1];
797
798
 
798
- var rotation = mat4.getRotation(quat.create(), transform);
799
+ var rotation = mat4.getRotation(quat.create(), transform); // eslint-disable-next-line @typescript-eslint/no-unused-vars
799
800
 
800
801
  var _c = __read(getEuler(vec3.create(), rotation), 3),
801
802
  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';
@@ -52,7 +52,7 @@ function (_super) {
52
52
  Text.prototype.getLineBoundingRects = function () {
53
53
  var _a;
54
54
 
55
- return (_a = this.parsedStyle.metrics) === null || _a === void 0 ? void 0 : _a.lineMetrics;
55
+ return ((_a = this.parsedStyle.metrics) === null || _a === void 0 ? void 0 : _a.lineMetrics) || [];
56
56
  };
57
57
 
58
58
  return Text;
@@ -419,15 +419,18 @@ function () {
419
419
 
420
420
  Animation.prototype.persist = function () {
421
421
  throw new Error('Method not implemented.');
422
- };
422
+ }; // eslint-disable-next-line @typescript-eslint/no-unused-vars
423
+
423
424
 
424
425
  Animation.prototype.addEventListener = function (type, listener, options) {
425
426
  throw new Error('Method not implemented.');
426
- };
427
+ }; // eslint-disable-next-line @typescript-eslint/no-unused-vars
428
+
427
429
 
428
430
  Animation.prototype.removeEventListener = function (type, listener, options) {
429
431
  throw new Error('Method not implemented.');
430
- };
432
+ }; // eslint-disable-next-line @typescript-eslint/no-unused-vars
433
+
431
434
 
432
435
  Animation.prototype.dispatchEvent = function (event) {
433
436
  throw new Error('Method not implemented.');
@@ -476,7 +479,9 @@ function () {
476
479
  if (this.onfinish) {
477
480
  var event_1 = new AnimationEvent(null, this, this.currentTime, baseTime);
478
481
  setTimeout(function () {
479
- _this.onfinish && _this.onfinish(event_1);
482
+ if (_this.onfinish) {
483
+ _this.onfinish(event_1);
484
+ }
480
485
  });
481
486
  }
482
487
 
@@ -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
  }
@@ -153,7 +153,8 @@ function () {
153
153
 
154
154
  this.rafCallbacks.push([id, f]);
155
155
  return id;
156
- };
156
+ }; // eslint-disable-next-line @typescript-eslint/ban-types
157
+
157
158
 
158
159
  AnimationTimeline.prototype.requestAnimationFrame = function (f) {
159
160
  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
  *
@@ -16,7 +16,8 @@ import { FederatedEvent } from './FederatedEvent';
16
16
  var CustomEvent =
17
17
  /** @class */
18
18
  function (_super) {
19
- __extends(CustomEvent, _super);
19
+ __extends(CustomEvent, _super); // eslint-disable-next-line @typescript-eslint/ban-types
20
+
20
21
 
21
22
  function CustomEvent(eventName, object) {
22
23
  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
@@ -71,7 +71,8 @@ function (_super) {
71
71
  Document.prototype.createElement = function (tagName, options) {
72
72
  var clazz = this.defaultView.customElements.get(tagName);
73
73
  return new clazz(options);
74
- };
74
+ }; // eslint-disable-next-line @typescript-eslint/no-unused-vars
75
+
75
76
 
76
77
  Document.prototype.cloneNode = function (deep) {
77
78
  throw new Error('Method not implemented.');
@@ -87,23 +88,28 @@ function (_super) {
87
88
  /**
88
89
  * eg. Uncaught DOMException: Failed to execute 'appendChild' on 'Node': Only one element on document allowed.
89
90
  */
91
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
90
92
 
91
93
 
92
94
  Document.prototype.appendChild = function (newChild, index) {
93
95
  throw new Error('Use document.documentElement instead.');
94
- };
96
+ }; // eslint-disable-next-line @typescript-eslint/no-unused-vars
97
+
95
98
 
96
99
  Document.prototype.insertBefore = function (newChild, refChild) {
97
100
  throw new Error('Use document.documentElement instead.');
98
- };
101
+ }; // eslint-disable-next-line @typescript-eslint/no-unused-vars
102
+
99
103
 
100
104
  Document.prototype.removeChild = function (oldChild, destroy) {
101
105
  throw new Error('Use document.documentElement instead.');
102
- };
106
+ }; // eslint-disable-next-line @typescript-eslint/no-unused-vars
107
+
103
108
 
104
109
  Document.prototype.replaceChild = function (newChild, oldChild, destroy) {
105
110
  throw new Error('Use document.documentElement instead.');
106
- };
111
+ }; // eslint-disable-next-line @typescript-eslint/no-unused-vars
112
+
107
113
 
108
114
  Document.prototype.append = function () {
109
115
  var nodes = [];
@@ -113,7 +119,8 @@ function (_super) {
113
119
  }
114
120
 
115
121
  throw new Error('Use document.documentElement instead.');
116
- };
122
+ }; // eslint-disable-next-line @typescript-eslint/no-unused-vars
123
+
117
124
 
118
125
  Document.prototype.prepend = function () {
119
126
  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
package/es/dom/Element.js CHANGED
@@ -18,8 +18,8 @@ var Element =
18
18
  function (_super) {
19
19
  __extends(Element, _super);
20
20
 
21
- function Element(config) {
22
- var _this = _super.call(this) || this;
21
+ function Element() {
22
+ var _this = _super !== null && _super.apply(this, arguments) || this;
23
23
 
24
24
  _this.sceneGraphService = globalContainer.get(SceneGraphService);
25
25
  _this.entity = entityCounter++;
@@ -129,7 +129,7 @@ function (_super) {
129
129
  },
130
130
  enumerable: false,
131
131
  configurable: true
132
- });
132
+ }); // eslint-disable-next-line @typescript-eslint/no-unused-vars
133
133
 
134
134
  Element.prototype.cloneNode = function (deep) {
135
135
  throw new Error('Method not implemented.');
@@ -476,7 +476,8 @@ function (_super) {
476
476
  */
477
477
 
478
478
 
479
- Element.prototype.setAttribute = function (attributeName, value, force) {
479
+ Element.prototype.setAttribute = function (attributeName, value, // eslint-disable-next-line @typescript-eslint/no-unused-vars
480
+ force) {
480
481
  if (force === void 0) {
481
482
  force = false;
482
483
  }
@@ -118,6 +118,7 @@ function () {
118
118
  * @deprecated
119
119
  * @alias dispatchEvent
120
120
  */
121
+ // eslint-disable-next-line @typescript-eslint/ban-types
121
122
 
122
123
 
123
124
  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}.
@@ -113,7 +113,7 @@ function () {
113
113
 
114
114
  return target[prop];
115
115
  },
116
- set: function set(_, prop, value) {
116
+ set: function set() {
117
117
  return true;
118
118
  }
119
119
  });
package/es/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/es/dom/Node.js CHANGED
@@ -76,7 +76,8 @@ function (_super) {
76
76
  */
77
77
 
78
78
 
79
- Node.prototype.getRootNode = function (options) {
79
+ Node.prototype.getRootNode = function () {
80
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
80
81
  var temp = this;
81
82
 
82
83
  while (temp.parentNode) {
@@ -88,19 +89,23 @@ function (_super) {
88
89
 
89
90
  Node.prototype.hasChildNodes = function () {
90
91
  return this.childNodes.length > 0;
91
- };
92
+ }; // eslint-disable-next-line @typescript-eslint/no-unused-vars
93
+
92
94
 
93
95
  Node.prototype.isDefaultNamespace = function (namespace) {
94
96
  throw new Error('Method not implemented.');
95
- };
97
+ }; // eslint-disable-next-line @typescript-eslint/no-unused-vars
98
+
96
99
 
97
100
  Node.prototype.compareDocumentPosition = function (other) {
98
101
  throw new Error('Method not implemented.');
99
- };
102
+ }; // eslint-disable-next-line @typescript-eslint/no-unused-vars
103
+
100
104
 
101
105
  Node.prototype.lookupNamespaceURI = function (prefix) {
102
106
  throw new Error('Method not implemented.');
103
- };
107
+ }; // eslint-disable-next-line @typescript-eslint/no-unused-vars
108
+
104
109
 
105
110
  Node.prototype.lookupPrefix = function (namespace) {
106
111
  throw new Error('Method not implemented.');
@@ -190,6 +195,7 @@ function (_super) {
190
195
  };
191
196
 
192
197
  Node.prototype.getAncestor = function (n) {
198
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
193
199
  var temp = this;
194
200
 
195
201
  while (n > 0 && temp) {