@antv/g 5.0.1 → 5.0.5

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 (177) 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 +15 -5
  5. package/es/Canvas.js +10 -5
  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 +7 -8
  10. package/es/display-objects/CustomElement.js +24 -11
  11. package/es/display-objects/DisplayObject.d.ts +5 -7
  12. package/es/display-objects/DisplayObject.js +20 -12
  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 +3 -3
  27. package/es/dom/Document.js +13 -6
  28. package/es/dom/Element.d.ts +11 -12
  29. package/es/dom/Element.js +12 -8
  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 +10 -10
  34. package/es/dom/Node.js +11 -5
  35. package/es/dom/interfaces.d.ts +63 -63
  36. package/es/global-module.d.ts +4 -0
  37. package/es/global-module.js +57 -69
  38. package/es/plugins/CullingPlugin.d.ts +3 -3
  39. package/es/plugins/DirtyCheckPlugin.d.ts +1 -1
  40. package/es/plugins/EventPlugin.d.ts +2 -1
  41. package/es/plugins/FrustumCullingStrategy.d.ts +1 -2
  42. package/es/plugins/FrustumCullingStrategy.js +31 -32
  43. package/es/plugins/PrepareRendererPlugin.d.ts +1 -1
  44. package/es/plugins/PrepareRendererPlugin.js +7 -20
  45. package/es/property-handlers/aabb.js +16 -19
  46. package/es/property-handlers/anchor.d.ts +2 -1
  47. package/es/property-handlers/anchor.js +2 -2
  48. package/es/property-handlers/clipPath.js +2 -2
  49. package/es/property-handlers/color.d.ts +3 -4
  50. package/es/property-handlers/color.js +2 -2
  51. package/es/property-handlers/filter.d.ts +3 -4
  52. package/es/property-handlers/filter.js +2 -2
  53. package/es/property-handlers/interfaces.d.ts +1 -1
  54. package/es/property-handlers/lineDash.d.ts +1 -2
  55. package/es/property-handlers/lineDash.js +1 -1
  56. package/es/property-handlers/path.d.ts +2 -3
  57. package/es/property-handlers/path.js +2 -2
  58. package/es/property-handlers/points.d.ts +1 -2
  59. package/es/property-handlers/points.js +1 -1
  60. package/es/property-handlers/transform.d.ts +1 -1
  61. package/es/property-handlers/transform.js +0 -5
  62. package/es/services/ContextService.d.ts +8 -8
  63. package/es/services/EventService.d.ts +2 -2
  64. package/es/services/RenderingContext.d.ts +2 -2
  65. package/es/services/RenderingService.d.ts +23 -18
  66. package/es/services/RenderingService.js +18 -4
  67. package/es/services/SceneGraphSelector.d.ts +5 -5
  68. package/es/services/SceneGraphSelector.js +3 -2
  69. package/es/services/SceneGraphService.d.ts +36 -34
  70. package/es/services/SceneGraphService.js +33 -4
  71. package/es/services/aabb/PathUpdater.d.ts +1 -2
  72. package/es/services/aabb/PathUpdater.js +1 -1
  73. package/es/services/aabb/interfaces.d.ts +1 -1
  74. package/es/services/text/index.js +1 -1
  75. package/es/shapes/AABB.d.ts +3 -2
  76. package/es/shapes/Frustum.d.ts +1 -1
  77. package/es/shapes/Polygon.d.ts +1 -1
  78. package/es/shapes/Ray.d.ts +3 -3
  79. package/es/types.d.ts +1 -2
  80. package/es/utils/custom-easing.d.ts +3 -5
  81. package/es/utils/custom-easing.js +2 -1
  82. package/es/utils/event.d.ts +1 -1
  83. package/es/utils/interpolation.js +16 -16
  84. package/es/utils/math.d.ts +2 -1
  85. package/es/utils/math.js +1 -2
  86. package/es/utils/path.d.ts +1 -1
  87. package/es/utils/path.js +4 -7
  88. package/es/utils/raf.js +2 -1
  89. package/lib/AbstractRenderer.d.ts +7 -7
  90. package/lib/Canvas.d.ts +15 -5
  91. package/lib/Canvas.js +10 -5
  92. package/lib/camera/Camera.js +4 -5
  93. package/lib/components/Geometry.d.ts +1 -1
  94. package/lib/components/Renderable.d.ts +1 -1
  95. package/lib/display-objects/CustomElement.d.ts +7 -8
  96. package/lib/display-objects/CustomElement.js +24 -11
  97. package/lib/display-objects/DisplayObject.d.ts +5 -7
  98. package/lib/display-objects/DisplayObject.js +19 -11
  99. package/lib/display-objects/Group.d.ts +1 -1
  100. package/lib/display-objects/HTML.d.ts +1 -1
  101. package/lib/display-objects/Image.d.ts +1 -1
  102. package/lib/display-objects/Path.d.ts +1 -1
  103. package/lib/display-objects/Polygon.d.ts +1 -1
  104. package/lib/display-objects/Polyline.d.ts +1 -1
  105. package/lib/display-objects/Text.d.ts +1 -1
  106. package/lib/display-objects/Text.js +1 -1
  107. package/lib/dom/Animation.js +9 -4
  108. package/lib/dom/AnimationEffectTiming.d.ts +0 -1
  109. package/lib/dom/AnimationTimeline.js +2 -1
  110. package/lib/dom/CustomElementRegistry.d.ts +1 -1
  111. package/lib/dom/CustomEvent.js +1 -1
  112. package/lib/dom/Document.d.ts +3 -3
  113. package/lib/dom/Document.js +13 -6
  114. package/lib/dom/Element.d.ts +11 -12
  115. package/lib/dom/Element.js +12 -8
  116. package/lib/dom/EventTarget.js +1 -0
  117. package/lib/dom/FederatedEvent.d.ts +1 -1
  118. package/lib/dom/KeyframeEffect.js +1 -1
  119. package/lib/dom/Node.d.ts +10 -10
  120. package/lib/dom/Node.js +11 -5
  121. package/lib/dom/interfaces.d.ts +63 -63
  122. package/lib/global-module.d.ts +4 -0
  123. package/lib/global-module.js +57 -69
  124. package/lib/plugins/CullingPlugin.d.ts +3 -3
  125. package/lib/plugins/DirtyCheckPlugin.d.ts +1 -1
  126. package/lib/plugins/EventPlugin.d.ts +2 -1
  127. package/lib/plugins/FrustumCullingStrategy.d.ts +1 -2
  128. package/lib/plugins/FrustumCullingStrategy.js +28 -30
  129. package/lib/plugins/PrepareRendererPlugin.d.ts +1 -1
  130. package/lib/plugins/PrepareRendererPlugin.js +6 -19
  131. package/lib/property-handlers/aabb.js +15 -19
  132. package/lib/property-handlers/anchor.d.ts +2 -1
  133. package/lib/property-handlers/anchor.js +2 -2
  134. package/lib/property-handlers/clipPath.js +2 -2
  135. package/lib/property-handlers/color.d.ts +3 -4
  136. package/lib/property-handlers/color.js +2 -2
  137. package/lib/property-handlers/filter.d.ts +3 -4
  138. package/lib/property-handlers/filter.js +2 -2
  139. package/lib/property-handlers/interfaces.d.ts +1 -1
  140. package/lib/property-handlers/lineDash.d.ts +1 -2
  141. package/lib/property-handlers/lineDash.js +1 -1
  142. package/lib/property-handlers/path.d.ts +2 -3
  143. package/lib/property-handlers/path.js +2 -2
  144. package/lib/property-handlers/points.d.ts +1 -2
  145. package/lib/property-handlers/points.js +1 -1
  146. package/lib/property-handlers/transform.d.ts +1 -1
  147. package/lib/property-handlers/transform.js +0 -4
  148. package/lib/services/ContextService.d.ts +8 -8
  149. package/lib/services/EventService.d.ts +2 -2
  150. package/lib/services/RenderingContext.d.ts +2 -2
  151. package/lib/services/RenderingService.d.ts +23 -18
  152. package/lib/services/RenderingService.js +18 -4
  153. package/lib/services/SceneGraphSelector.d.ts +5 -5
  154. package/lib/services/SceneGraphSelector.js +3 -2
  155. package/lib/services/SceneGraphService.d.ts +36 -34
  156. package/lib/services/SceneGraphService.js +35 -4
  157. package/lib/services/aabb/PathUpdater.d.ts +1 -2
  158. package/lib/services/aabb/PathUpdater.js +1 -1
  159. package/lib/services/aabb/interfaces.d.ts +1 -1
  160. package/lib/services/text/index.js +1 -1
  161. package/lib/shapes/AABB.d.ts +3 -2
  162. package/lib/shapes/Frustum.d.ts +1 -1
  163. package/lib/shapes/Polygon.d.ts +1 -1
  164. package/lib/shapes/Ray.d.ts +3 -3
  165. package/lib/types.d.ts +1 -2
  166. package/lib/utils/custom-easing.d.ts +3 -5
  167. package/lib/utils/custom-easing.js +2 -1
  168. package/lib/utils/event.d.ts +1 -1
  169. package/lib/utils/interpolation.js +13 -18
  170. package/lib/utils/math.d.ts +2 -1
  171. package/lib/utils/math.js +1 -2
  172. package/lib/utils/path.d.ts +2 -2
  173. package/lib/utils/path.js +4 -7
  174. package/lib/utils/raf.js +2 -1
  175. package/package.json +6 -6
  176. package/lib/dom/__tests__/utils/easing.d.ts +0 -14
  177. package/lib/dom/__tests__/utils/keyframe.d.ts +0 -38
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.');
@@ -298,6 +298,8 @@ function (_super) {
298
298
 
299
299
 
300
300
  Element.prototype.before = function () {
301
+ var _a;
302
+
301
303
  var nodes = [];
302
304
 
303
305
  for (var _i = 0; _i < arguments.length; _i++) {
@@ -307,12 +309,13 @@ function (_super) {
307
309
  if (this.parentNode) {
308
310
  var index = this.parentNode.childNodes.indexOf(this);
309
311
 
310
- var _a = __read(nodes),
311
- first = _a[0],
312
- rest = _a.slice(1);
312
+ var _b = __read(nodes),
313
+ first = _b[0],
314
+ rest = _b.slice(1);
313
315
 
314
316
  this.parentNode.appendChild(first, index);
315
- first.after.apply(first, __spreadArray([], __read(rest), false));
317
+
318
+ (_a = first).after.apply(_a, __spreadArray([], __read(rest), false));
316
319
  }
317
320
  };
318
321
  /**
@@ -476,7 +479,8 @@ function (_super) {
476
479
  */
477
480
 
478
481
 
479
- Element.prototype.setAttribute = function (attributeName, value, force) {
482
+ Element.prototype.setAttribute = function (attributeName, value, // eslint-disable-next-line @typescript-eslint/no-unused-vars
483
+ force) {
480
484
  if (force === void 0) {
481
485
  force = false;
482
486
  }
@@ -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
@@ -28,7 +28,7 @@ export declare abstract class Node extends EventTarget implements INode {
28
28
  * Returns the children.
29
29
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Node/childNodes
30
30
  */
31
- childNodes: (IChildNode & INode)[];
31
+ childNodes: IChildNode[];
32
32
  /**
33
33
  * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/nodeType
34
34
  */
@@ -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;
@@ -70,14 +70,14 @@ export declare abstract class Node extends EventTarget implements INode {
70
70
  */
71
71
  get parent(): INode | null;
72
72
  get parentElement(): IElement | null;
73
- get nextSibling(): (IChildNode & INode) | null;
74
- get previousSibling(): (IChildNode & INode) | null;
75
- get firstChild(): (IChildNode & INode) | null;
76
- get lastChild(): (IChildNode & INode) | null;
73
+ get nextSibling(): IChildNode | null;
74
+ get previousSibling(): IChildNode | null;
75
+ get firstChild(): IChildNode | null;
76
+ get lastChild(): IChildNode | null;
77
77
  /**
78
78
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Node/cloneNode
79
79
  */
80
- abstract cloneNode(deep?: boolean): INode;
80
+ abstract cloneNode(deep?: boolean): this;
81
81
  /**
82
82
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Node/appendChild
83
83
  */
@@ -93,14 +93,14 @@ export declare abstract class Node extends EventTarget implements INode {
93
93
  /**
94
94
  * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/replaceChild
95
95
  */
96
- abstract replaceChild<T extends INode & IChildNode>(newChild: INode, oldChild: T, destroy?: boolean): T;
96
+ abstract replaceChild<T extends INode>(newChild: INode, oldChild: T, destroy?: boolean): T;
97
97
  abstract destroy(): void;
98
98
  /**
99
99
  * @deprecated
100
100
  * @alias contains
101
101
  */
102
- contain(other: INode | null): boolean;
103
- contains(other: INode | null): boolean;
102
+ contain<T extends INode>(other: T | null): boolean;
103
+ contains<T extends INode>(other: T | null): boolean;
104
104
  getAncestor(n: number): INode | null;
105
105
  forEach(callback: (o: INode) => void | boolean): void;
106
106
  }
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) {
@@ -1,12 +1,12 @@
1
- import EventEmitter from 'eventemitter3';
1
+ import type EventEmitter from 'eventemitter3';
2
2
  import type { AnimationTimeline } from './AnimationTimeline';
3
- import { BaseStyleProps, ParsedBaseStyleProps, SHAPE } from '../types';
3
+ import type { BaseStyleProps, SHAPE } from '../types';
4
4
  import type { FederatedEvent } from './FederatedEvent';
5
- import { CustomElementRegistry } from './CustomElementRegistry';
6
- import { DisplayObject } from '..';
5
+ import type { CustomElementRegistry } from './CustomElementRegistry';
6
+ import type { DisplayObject } from '..';
7
7
  import type { PointLike } from '../shapes';
8
8
  import type { Camera } from '../camera';
9
- import { ContextService } from '../services';
9
+ import type { ContextService } from '../services';
10
10
  /**
11
11
  * built-in events for element
12
12
  */
@@ -35,13 +35,13 @@ export declare enum ElementEvent {
35
35
  }
36
36
  export interface IEventTarget {
37
37
  emitter: EventEmitter;
38
- on(type: string, listener: EventListenerOrEventListenerObject | ((...args: any[]) => void), options?: boolean | AddEventListenerOptions): this;
39
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): this;
40
- off(type: string, listener: EventListenerOrEventListenerObject | ((...args: any[]) => void), options?: boolean | AddEventListenerOptions): this;
41
- removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): this;
42
- removeAllEventListeners(): void;
43
- dispatchEvent<T extends FederatedEvent>(e: T): boolean;
44
- emit(eventName: string, object: object): void;
38
+ on: (type: string, listener: EventListenerOrEventListenerObject | ((...args: any[]) => void), options?: boolean | AddEventListenerOptions) => this;
39
+ addEventListener: (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions) => this;
40
+ off: (type: string, listener: EventListenerOrEventListenerObject | ((...args: any[]) => void), options?: boolean | AddEventListenerOptions) => this;
41
+ removeEventListener: (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions) => this;
42
+ removeAllEventListeners: () => void;
43
+ dispatchEvent: <T extends FederatedEvent>(e: T) => boolean;
44
+ emit: (eventName: string, object: object) => void;
45
45
  }
46
46
  export interface INode extends IEventTarget {
47
47
  shadow: boolean;
@@ -52,11 +52,11 @@ export interface INode extends IEventTarget {
52
52
  /**
53
53
  * Returns the children.
54
54
  */
55
- readonly childNodes: (IChildNode & INode)[];
55
+ readonly childNodes: IChildNode[];
56
56
  /**
57
57
  * Returns the first child.
58
58
  */
59
- readonly firstChild: (IChildNode & INode) | null;
59
+ readonly firstChild: IChildNode | null;
60
60
  /**
61
61
  * Returns true if node is connected and false otherwise.
62
62
  */
@@ -64,11 +64,11 @@ export interface INode extends IEventTarget {
64
64
  /**
65
65
  * Returns the last child.
66
66
  */
67
- readonly lastChild: (IChildNode & INode) | null;
67
+ readonly lastChild: IChildNode | null;
68
68
  /**
69
69
  * Returns the next sibling.
70
70
  */
71
- readonly nextSibling: (IChildNode & INode) | null;
71
+ readonly nextSibling: IChildNode | null;
72
72
  /**
73
73
  * Returns a string appropriate for the type of node.
74
74
  */
@@ -93,56 +93,56 @@ export interface INode extends IEventTarget {
93
93
  /**
94
94
  * Returns the previous sibling.
95
95
  */
96
- readonly previousSibling: (IChildNode & INode) | null;
96
+ readonly previousSibling: IChildNode | null;
97
97
  textContent: string | null;
98
- appendChild<T extends INode>(newChild: T, index?: number): T;
98
+ appendChild: <T extends INode>(newChild: T, index?: number) => T;
99
99
  /**
100
100
  * Returns a copy of node. If deep is true, the copy also includes the node's descendants.
101
101
  */
102
- cloneNode(deep?: boolean): INode;
102
+ cloneNode: (deep?: boolean) => INode;
103
103
  /**
104
104
  * Returns a bitmask indicating the position of other relative to node.
105
105
  */
106
- compareDocumentPosition(other: INode): number;
106
+ compareDocumentPosition: (other: INode) => number;
107
107
  /**
108
108
  * Returns true if other is an inclusive descendant of node, and false otherwise.
109
109
  */
110
- contains(other: INode | null): boolean;
110
+ contains: (other: INode | null) => boolean;
111
111
  /**
112
112
  * Returns node's root.
113
113
  */
114
- getRootNode(options?: GetRootNodeOptions): INode;
114
+ getRootNode: (options?: GetRootNodeOptions) => INode;
115
115
  /**
116
116
  * Returns node's ancestor.
117
117
  */
118
- getAncestor(n: number): INode | null;
118
+ getAncestor: (n: number) => INode | null;
119
119
  /**
120
120
  * Traverse in sub tree.
121
121
  */
122
- forEach(callback: (o: INode) => void | boolean): void;
122
+ forEach: (callback: (o: INode) => void | boolean) => void;
123
123
  /**
124
124
  * Returns whether node has children.
125
125
  */
126
- hasChildNodes(): boolean;
127
- insertBefore<T extends INode>(newChild: T, refChild: INode | null): T;
128
- isDefaultNamespace(namespace: string | null): boolean;
126
+ hasChildNodes: () => boolean;
127
+ insertBefore: <T extends INode>(newChild: T, refChild: INode | null) => T;
128
+ isDefaultNamespace: (namespace: string | null) => boolean;
129
129
  /**
130
130
  * Returns whether node and otherNode have the same properties.
131
131
  */
132
- isEqualNode(otherNode: INode | null): boolean;
133
- isSameNode(otherNode: INode | null): boolean;
134
- lookupNamespaceURI(prefix: string | null): string | null;
135
- lookupPrefix(namespace: string | null): string | null;
132
+ isEqualNode: (otherNode: INode | null) => boolean;
133
+ isSameNode: (otherNode: INode | null) => boolean;
134
+ lookupNamespaceURI: (prefix: string | null) => string | null;
135
+ lookupPrefix: (namespace: string | null) => string | null;
136
136
  /**
137
137
  * Removes empty exclusive Text nodes and concatenates the data of remaining contiguous exclusive Text nodes into the first of their nodes.
138
138
  */
139
- normalize(): void;
140
- removeChild<T extends INode>(oldChild: T, destroy?: boolean): T;
141
- replaceChild<T extends INode & IChildNode>(newChild: INode, oldChild: T, destroy?: boolean): T;
139
+ normalize: () => void;
140
+ removeChild: <T extends INode>(oldChild: T, destroy?: boolean) => T;
141
+ replaceChild: <T extends INode>(newChild: INode, oldChild: T, destroy?: boolean) => T;
142
142
  /**
143
143
  * Destroy itself.
144
144
  */
145
- destroy(): void;
145
+ destroy: () => void;
146
146
  }
147
147
  export interface IParentNode {
148
148
  readonly childElementCount: number;
@@ -163,29 +163,29 @@ export interface IParentNode {
163
163
  *
164
164
  * Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
165
165
  */
166
- append(...nodes: INode[]): void;
166
+ append: (...nodes: INode[]) => void;
167
167
  /**
168
168
  * Inserts nodes before the first child of node, while replacing strings in nodes with equivalent Text nodes.
169
169
  *
170
170
  * Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
171
171
  */
172
- prepend(...nodes: INode[]): void;
172
+ prepend: (...nodes: INode[]) => void;
173
173
  /**
174
174
  * Returns the first element that is a descendant of node that matches selectors.
175
175
  */
176
- querySelector<E extends IElement = IElement>(selectors: string): E | null;
176
+ querySelector: <E extends IElement = IElement>(selectors: string) => E | null;
177
177
  /**
178
178
  * Returns all element descendants of node that match selectors.
179
179
  */
180
- querySelectorAll<E extends IElement = IElement>(selectors: string): E[];
180
+ querySelectorAll: <E extends IElement = IElement>(selectors: string) => E[];
181
181
  /**
182
182
  * Similar to querySelector, use custom filter instead of selectors.
183
183
  */
184
- find<E extends IElement = IElement>(filter: (node: E) => boolean): E | null;
184
+ find: <E extends IElement = IElement>(filter: (node: E) => boolean) => E | null;
185
185
  /**
186
186
  * Similar to querySelectorAll, use custom filter instead of selectors.
187
187
  */
188
- findAll<E extends IElement = IElement>(filter: (node: E) => boolean): E[];
188
+ findAll: <E extends IElement = IElement>(filter: (node: E) => boolean) => E[];
189
189
  }
190
190
  export interface IChildNode extends INode {
191
191
  /**
@@ -193,23 +193,23 @@ export interface IChildNode extends INode {
193
193
  *
194
194
  * Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
195
195
  */
196
- after(...nodes: INode[]): void;
196
+ after: (...nodes: INode[]) => void;
197
197
  /**
198
198
  * Inserts nodes just before node, while replacing strings in nodes with equivalent Text nodes.
199
199
  *
200
200
  * Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
201
201
  */
202
- before(...nodes: INode[]): void;
202
+ before: (...nodes: INode[]) => void;
203
203
  /**
204
204
  * Removes node.
205
205
  */
206
- remove(): void;
206
+ remove: () => void;
207
207
  /**
208
208
  * Replaces node with nodes, while replacing strings in nodes with equivalent Text nodes.
209
209
  *
210
210
  * Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
211
211
  */
212
- replaceWith(...nodes: INode[]): void;
212
+ replaceWith: (...nodes: INode[]) => void;
213
213
  }
214
214
  export interface DisplayObjectConfig<StyleProps> {
215
215
  /**
@@ -250,7 +250,7 @@ export interface DisplayObjectConfig<StyleProps> {
250
250
  */
251
251
  interactive?: boolean;
252
252
  }
253
- export interface IElement<StyleProps extends BaseStyleProps = any, ParsedStyleProps extends ParsedBaseStyleProps = any> extends INode, IChildNode, IParentNode {
253
+ export interface IElement<StyleProps = any, ParsedStyleProps = any> extends INode, IChildNode, IParentNode {
254
254
  /**
255
255
  * Returns the value of element's id content attribute. Can be set to change it.
256
256
  */
@@ -274,24 +274,24 @@ export interface IElement<StyleProps extends BaseStyleProps = any, ParsedStylePr
274
274
  */
275
275
  style: StyleProps;
276
276
  parsedStyle: ParsedStyleProps;
277
- getElementById<E extends IElement = IElement>(id: string): E | null;
278
- getElementsByName<E extends IElement = IElement>(name: string): E[];
279
- getElementsByClassName<E extends IElement = IElement>(className: string): E[];
280
- getElementsByTagName<E extends IElement = IElement>(tagName: string): E[];
277
+ getElementById: <E extends IElement = IElement>(id: string) => E | null;
278
+ getElementsByName: <E extends IElement = IElement>(name: string) => E[];
279
+ getElementsByClassName: <E extends IElement = IElement>(className: string) => E[];
280
+ getElementsByTagName: <E extends IElement = IElement>(tagName: string) => E[];
281
281
  scrollLeft: number;
282
282
  scrollTop: number;
283
283
  /**
284
284
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute
285
285
  */
286
- setAttribute<Key extends keyof StyleProps>(attributeName: Key, value: StyleProps[Key], force?: boolean): void;
286
+ setAttribute: <Key extends keyof StyleProps>(attributeName: Key, value: StyleProps[Key], force?: boolean) => void;
287
287
  /**
288
288
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute
289
289
  */
290
- getAttribute(attributeName: keyof StyleProps): StyleProps[keyof StyleProps] | undefined;
290
+ getAttribute: (attributeName: keyof StyleProps) => StyleProps[keyof StyleProps] | undefined;
291
291
  /**
292
292
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute
293
293
  */
294
- removeAttribute(attributeName: keyof StyleProps): void;
294
+ removeAttribute: (attributeName: keyof StyleProps) => void;
295
295
  }
296
296
  export interface IDocument extends INode, IParentNode {
297
297
  /**
@@ -307,18 +307,18 @@ export interface IDocument extends INode, IParentNode {
307
307
  /**
308
308
  * Creates an instance of the element for the specified tag.
309
309
  */
310
- createElement<T extends DisplayObject<StyleProps>, StyleProps extends BaseStyleProps>(tagName: string, options: DisplayObjectConfig<StyleProps>): T;
310
+ createElement: <T extends DisplayObject<StyleProps>, StyleProps extends BaseStyleProps>(tagName: string, options: DisplayObjectConfig<StyleProps>) => T;
311
311
  }
312
312
  export interface ICanvas extends IEventTarget {
313
313
  document: IDocument;
314
314
  customElements: CustomElementRegistry;
315
- render(): void;
316
- destroy(destroyScenegraph?: boolean): void;
317
- resize(width: number, height: number): void;
318
- getCamera(): Camera;
319
- getContextService(): ContextService<unknown>;
320
- client2Viewport(client: PointLike): PointLike;
321
- viewport2Client(viewport: PointLike): PointLike;
322
- canvas2Viewport(canvas: PointLike): PointLike;
323
- viewport2Canvas(viewport: PointLike): PointLike;
315
+ render: () => void;
316
+ destroy: (destroyScenegraph?: boolean) => void;
317
+ resize: (width: number, height: number) => void;
318
+ getCamera: () => Camera;
319
+ getContextService: () => ContextService<unknown>;
320
+ client2Viewport: (client: PointLike) => PointLike;
321
+ viewport2Client: (viewport: PointLike) => PointLike;
322
+ canvas2Viewport: (canvas: PointLike) => PointLike;
323
+ viewport2Canvas: (viewport: PointLike) => PointLike;
324
324
  }
@@ -1,2 +1,6 @@
1
+ import type { StylePropertyParser, StylePropertyMerger, StylePropertyUpdater } from './property-handlers';
1
2
  export declare const globalContainer: import("mana-syringe").Container;
3
+ export declare const stylePropertyParserFactory: Record<string, StylePropertyParser<any, any>>;
4
+ export declare const stylePropertyUpdaterFactory: Record<string, StylePropertyUpdater<any>[]>;
5
+ export declare const stylePropertyMergerFactory: Record<string, StylePropertyMerger<any, any>>;
2
6
  export declare const containerModule: import("mana-syringe").SyringeModule;
@@ -7,8 +7,14 @@ import { TextService } from './services/text';
7
7
  import { TextUpdater } from './services/aabb/TextUpdater';
8
8
  import { OffscreenCanvasCreator } from './services/text/OffscreenCanvasCreator';
9
9
  import { DefaultSceneGraphSelector, SceneGraphSelector, SceneGraphSelectorFactory } from './services/SceneGraphSelector';
10
- import { StylePropertyParser, StylePropertyMerger, StylePropertyUpdater, StylePropertyParserFactory, StylePropertyUpdaterFactory, StylePropertyMergerFactory, clampedMergeNumbers, parseNumber, mergeColors, parseColor, updateGeometry, updateLocalPosition, updateOffsetPath, updateClipPath, updateZIndex, updateOffsetDistance, updateOrigin, updateTransform, updateTransformOrigin, parseTransform, mergeTransforms, parsePath, parsePoints, mergePaths, mergeNumbers, mergeNumberLists, parseFilter, updateAnchor, parseLineDash } from './property-handlers';
10
+ import { // StylePropertyParserFactory,
11
+ // StylePropertyUpdaterFactory,
12
+ // StylePropertyMergerFactory,
13
+ clampedMergeNumbers, parseNumber, mergeColors, parseColor, updateGeometry, updateLocalPosition, updateOffsetPath, updateClipPath, updateZIndex, updateOffsetDistance, updateOrigin, updateTransform, updateTransformOrigin, parseTransform, mergeTransforms, parsePath, parsePoints, mergePaths, mergeNumbers, mergeNumberLists, parseFilter, updateAnchor, parseLineDash } from './property-handlers';
11
14
  export var globalContainer = GlobalContainer;
15
+ export var stylePropertyParserFactory = {};
16
+ export var stylePropertyUpdaterFactory = {};
17
+ export var stylePropertyMergerFactory = {};
12
18
  export var containerModule = Module(function (register) {
13
19
  decorate(injectable(), EventEmitter); // bind DisplayObject pool
14
20
 
@@ -56,83 +62,65 @@ export var containerModule = Module(function (register) {
56
62
  return cache[tagName];
57
63
  };
58
64
  }
59
- }); // bind style property handlers
60
-
61
- register({
62
- token: StylePropertyParserFactory,
63
- useFactory: function useFactory(context) {
64
- var cache = {};
65
- return function (propertyName) {
66
- if (!cache[propertyName]) {
67
- if (context.container.isBoundNamed(StylePropertyParser, propertyName)) {
68
- cache[propertyName] = context.container.getNamed(StylePropertyParser, propertyName);
69
- }
70
- }
71
-
72
- return cache[propertyName];
73
- };
74
- }
75
- });
76
- register({
77
- token: StylePropertyUpdaterFactory,
78
- useFactory: function useFactory(context) {
79
- var cache = {};
80
- return function (propertyName) {
81
- if (!cache[propertyName]) {
82
- if (context.container.isBoundNamed(StylePropertyUpdater, propertyName)) {
83
- cache[propertyName] = context.container.getAllNamed(StylePropertyUpdater, propertyName);
84
- }
85
- }
86
-
87
- return cache[propertyName];
88
- };
89
- }
90
- });
91
- register({
92
- token: StylePropertyMergerFactory,
93
- useFactory: function useFactory(context) {
94
- var cache = {};
95
- return function (propertyName) {
96
- if (!cache[propertyName]) {
97
- if (context.container.isBoundNamed(StylePropertyMerger, propertyName)) {
98
- cache[propertyName] = context.container.getNamed(StylePropertyMerger, propertyName);
99
- }
100
- }
101
-
102
- return cache[propertyName];
103
- };
104
- }
105
- });
65
+ }); // // bind style property handlers
66
+ // register({
67
+ // token: StylePropertyParserFactory,
68
+ // useFactory: (context) => {
69
+ // const cache = {};
70
+ // return (propertyName: string) => {
71
+ // if (!cache[propertyName]) {
72
+ // if (context.container.isBoundNamed(StylePropertyParser, propertyName)) {
73
+ // cache[propertyName] = context.container.getNamed(StylePropertyParser, propertyName);
74
+ // }
75
+ // }
76
+ // return cache[propertyName];
77
+ // };
78
+ // },
79
+ // });
80
+ // register({
81
+ // token: StylePropertyUpdaterFactory,
82
+ // useFactory: (context) => {
83
+ // const cache = {};
84
+ // return (propertyName: string) => {
85
+ // if (!cache[propertyName]) {
86
+ // if (context.container.isBoundNamed(StylePropertyUpdater, propertyName)) {
87
+ // cache[propertyName] = context.container.getAllNamed(StylePropertyUpdater, propertyName);
88
+ // }
89
+ // }
90
+ // return cache[propertyName];
91
+ // };
92
+ // },
93
+ // });
94
+ // register({
95
+ // token: StylePropertyMergerFactory,
96
+ // useFactory: (context) => {
97
+ // const cache = {};
98
+ // return (propertyName: string) => {
99
+ // if (!cache[propertyName]) {
100
+ // if (context.container.isBoundNamed(StylePropertyMerger, propertyName)) {
101
+ // cache[propertyName] = context.container.getNamed(StylePropertyMerger, propertyName);
102
+ // }
103
+ // }
104
+ // return cache[propertyName];
105
+ // };
106
+ // },
107
+ // });
106
108
 
107
109
  function addPropertyHandler(property, parser, merger, updater) {
108
110
  if (parser) {
109
- register({
110
- token: {
111
- token: StylePropertyParser,
112
- named: property
113
- },
114
- useValue: parser
115
- });
111
+ stylePropertyParserFactory[property] = parser; // register({ token: { token: StylePropertyParser, named: property }, useValue: parser });
116
112
  }
117
113
 
118
114
  if (merger) {
119
- register({
120
- token: {
121
- token: StylePropertyMerger,
122
- named: property
123
- },
124
- useValue: merger
125
- });
115
+ stylePropertyMergerFactory[property] = merger; // register({ token: { token: StylePropertyMerger, named: property }, useValue: merger });
126
116
  }
127
117
 
128
118
  if (updater) {
129
- register({
130
- token: {
131
- token: StylePropertyUpdater,
132
- named: property
133
- },
134
- useValue: updater
135
- });
119
+ if (!stylePropertyUpdaterFactory[property]) {
120
+ stylePropertyUpdaterFactory[property] = [];
121
+ }
122
+
123
+ stylePropertyUpdaterFactory[property].push(updater); // register({ token: { token: StylePropertyUpdater, named: property }, useValue: updater });
136
124
  }
137
125
  }
138
126
 
@@ -1,9 +1,9 @@
1
1
  import { Syringe } from 'mana-syringe';
2
- import { DisplayObject } from '../display-objects/DisplayObject';
3
- import { RenderingService, RenderingPlugin } from '../services/RenderingService';
2
+ import type { DisplayObject } from '../display-objects/DisplayObject';
3
+ import type { RenderingService, RenderingPlugin } from '../services/RenderingService';
4
4
  export declare const CullingStrategyContribution: Syringe.DefinedToken;
5
5
  export interface CullingStrategyContribution {
6
- isVisible(object: DisplayObject): boolean;
6
+ isVisible: (object: DisplayObject) => boolean;
7
7
  }
8
8
  /**
9
9
  * apply following rules:
@@ -1,4 +1,4 @@
1
- import { RenderingService, RenderingPlugin } from '../services/RenderingService';
1
+ import type { RenderingService, RenderingPlugin } from '../services/RenderingService';
2
2
  /**
3
3
  * Filter dirty renderables and calculate the "dirty rectangle" which will be clear when frame began
4
4
  */
@@ -1,4 +1,5 @@
1
- import { RenderingPlugin, RenderingService } from '../services';
1
+ import type { RenderingPlugin } from '../services';
2
+ import { RenderingService } from '../services';
2
3
  /**
3
4
  * support mouse & touch events
4
5
  * @see https://github.com/pixijs/pixi.js/blob/dev/packages/interaction/README.md