@antv/g-lite 1.0.70 → 1.1.0-alpha.1

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 (292) hide show
  1. package/dist/AbstractRenderer.d.ts +49 -50
  2. package/dist/Canvas.d.ts +149 -150
  3. package/dist/camera/Camera.d.ts +279 -280
  4. package/dist/camera/Landmark.d.ts +23 -24
  5. package/dist/camera/index.d.ts +3 -4
  6. package/dist/camera/interfaces.d.ts +194 -195
  7. package/dist/components/Cullable.d.ts +12 -13
  8. package/dist/components/Geometry.d.ts +11 -12
  9. package/dist/components/RBushNode.d.ts +11 -12
  10. package/dist/components/Renderable.d.ts +27 -28
  11. package/dist/components/Sortable.d.ts +25 -26
  12. package/dist/components/Transform.d.ts +31 -32
  13. package/dist/components/index.d.ts +6 -7
  14. package/dist/css/CSS.d.ts +87 -88
  15. package/dist/css/CSSProperty.d.ts +43 -44
  16. package/dist/css/CSSStyleValuePool.d.ts +19 -20
  17. package/dist/css/StyleValueRegistry.d.ts +54 -53
  18. package/dist/css/cssom/CSSColorValue.d.ts +23 -24
  19. package/dist/css/cssom/CSSGradientValue.d.ts +31 -32
  20. package/dist/css/cssom/CSSKeywordValue.d.ts +15 -16
  21. package/dist/css/cssom/CSSMathOperator.d.ts +11 -12
  22. package/dist/css/cssom/CSSNumericSumValue.d.ts +7 -8
  23. package/dist/css/cssom/CSSNumericValue.d.ts +28 -29
  24. package/dist/css/cssom/CSSRGB.d.ts +25 -26
  25. package/dist/css/cssom/CSSStyleValue.d.ts +45 -46
  26. package/dist/css/cssom/index.d.ts +16 -17
  27. package/dist/css/cssom/types.d.ts +38 -39
  28. package/dist/css/index.d.ts +11 -12
  29. package/dist/css/interfaces.d.ts +136 -137
  30. package/dist/css/parser/color.d.ts +22 -23
  31. package/dist/css/parser/dimension.d.ts +46 -47
  32. package/dist/css/parser/filter.d.ts +7 -8
  33. package/dist/css/parser/gradient.d.ts +4 -5
  34. package/dist/css/parser/index.d.ts +15 -16
  35. package/dist/css/parser/numeric.d.ts +24 -25
  36. package/dist/css/parser/path.d.ts +5 -6
  37. package/dist/css/parser/points.d.ts +23 -24
  38. package/dist/css/parser/transform-origin.d.ts +8 -9
  39. package/dist/css/parser/transform.d.ts +15 -16
  40. package/dist/css/parser/types.d.ts +2 -3
  41. package/dist/css/properties/CSSPropertyAngle.d.ts +13 -14
  42. package/dist/css/properties/CSSPropertyClipPath.d.ts +9 -9
  43. package/dist/css/properties/CSSPropertyColor.d.ts +18 -19
  44. package/dist/css/properties/CSSPropertyFilter.d.ts +7 -8
  45. package/dist/css/properties/CSSPropertyLengthOrPercentage.d.ts +20 -21
  46. package/dist/css/properties/CSSPropertyLengthOrPercentage12.d.ts +16 -17
  47. package/dist/css/properties/CSSPropertyLengthOrPercentage14.d.ts +26 -27
  48. package/dist/css/properties/CSSPropertyLocalPosition.d.ts +13 -14
  49. package/dist/css/properties/CSSPropertyMarker.d.ts +5 -6
  50. package/dist/css/properties/CSSPropertyNumber.d.ts +12 -13
  51. package/dist/css/properties/CSSPropertyOffsetDistance.d.ts +13 -14
  52. package/dist/css/properties/CSSPropertyOpacity.d.ts +14 -15
  53. package/dist/css/properties/CSSPropertyPath.d.ts +27 -28
  54. package/dist/css/properties/CSSPropertyPoints.d.ts +19 -20
  55. package/dist/css/properties/CSSPropertyShadowBlur.d.ts +4 -5
  56. package/dist/css/properties/CSSPropertyText.d.ts +7 -8
  57. package/dist/css/properties/CSSPropertyTextTransform.d.ts +11 -12
  58. package/dist/css/properties/CSSPropertyTransform.d.ts +42 -43
  59. package/dist/css/properties/CSSPropertyTransformOrigin.d.ts +13 -14
  60. package/dist/css/properties/CSSPropertyZIndex.d.ts +11 -12
  61. package/dist/css/properties/index.d.ts +20 -21
  62. package/dist/display-objects/Circle.d.ts +20 -21
  63. package/dist/display-objects/CustomElement.d.ts +24 -25
  64. package/dist/display-objects/DisplayObject.d.ts +273 -274
  65. package/dist/display-objects/Ellipse.d.ts +22 -23
  66. package/dist/display-objects/Group.d.ts +29 -30
  67. package/dist/display-objects/HTML.d.ts +41 -42
  68. package/dist/display-objects/Image.d.ts +26 -27
  69. package/dist/display-objects/Line.d.ts +60 -61
  70. package/dist/display-objects/Path.d.ts +123 -134
  71. package/dist/display-objects/Polygon.d.ts +49 -50
  72. package/dist/display-objects/Polyline.d.ts +48 -49
  73. package/dist/display-objects/Rect.d.ts +27 -28
  74. package/dist/display-objects/Text.d.ts +180 -181
  75. package/dist/display-objects/constants.d.ts +12 -0
  76. package/dist/display-objects/index.d.ts +13 -14
  77. package/dist/dom/CustomElementRegistry.d.ts +15 -16
  78. package/dist/dom/CustomEvent.d.ts +15 -16
  79. package/dist/dom/Document.d.ts +77 -78
  80. package/dist/dom/Element.d.ts +206 -208
  81. package/dist/dom/EventTarget.d.ts +40 -41
  82. package/dist/dom/FederatedEvent.d.ts +147 -148
  83. package/dist/dom/FederatedMouseEvent.d.ts +52 -53
  84. package/dist/dom/FederatedPointerEvent.d.ts +87 -88
  85. package/dist/dom/FederatedWheelEvent.d.ts +18 -22
  86. package/dist/dom/MutationEvent.d.ts +15 -16
  87. package/dist/dom/Node.d.ts +138 -139
  88. package/dist/dom/index.d.ts +12 -13
  89. package/dist/dom/interfaces.d.ts +440 -441
  90. package/dist/global-runtime.d.ts +35 -36
  91. package/dist/index.d.ts +15 -15
  92. package/dist/index.esm.js +15091 -14804
  93. package/dist/index.esm.js.map +1 -0
  94. package/dist/index.js +15168 -14857
  95. package/dist/index.js.map +1 -0
  96. package/dist/index.umd.min.js +2 -1
  97. package/dist/index.umd.min.js.map +1 -0
  98. package/dist/plugins/CullingPlugin.d.ts +17 -18
  99. package/dist/plugins/DirtyCheckPlugin.d.ts +8 -9
  100. package/dist/plugins/EventPlugin.d.ts +26 -27
  101. package/dist/plugins/FrustumCullingStrategy.d.ts +21 -22
  102. package/dist/plugins/PrepareRendererPlugin.d.ts +11 -12
  103. package/dist/services/ContextService.d.ts +28 -29
  104. package/dist/services/EventService.d.ts +82 -83
  105. package/dist/services/OffscreenCanvasCreator.d.ts +15 -16
  106. package/dist/services/RenderingContext.d.ts +26 -27
  107. package/dist/services/RenderingService.d.ts +112 -113
  108. package/dist/services/SceneGraphSelector.d.ts +23 -24
  109. package/dist/services/SceneGraphService.d.ts +127 -128
  110. package/dist/services/TextService.d.ts +47 -48
  111. package/dist/services/aabb/CircleUpdater.d.ts +8 -9
  112. package/dist/services/aabb/EllipseUpdater.d.ts +8 -9
  113. package/dist/services/aabb/LineUpdater.d.ts +8 -9
  114. package/dist/services/aabb/PathUpdater.d.ts +8 -9
  115. package/dist/services/aabb/PolylineUpdater.d.ts +8 -9
  116. package/dist/services/aabb/RectUpdater.d.ts +8 -9
  117. package/dist/services/aabb/TextUpdater.d.ts +23 -24
  118. package/dist/services/aabb/index.d.ts +8 -9
  119. package/dist/services/aabb/interfaces.d.ts +12 -13
  120. package/dist/services/index.d.ts +11 -12
  121. package/dist/services/interfaces.d.ts +48 -49
  122. package/dist/shapes/AABB.d.ts +33 -34
  123. package/dist/shapes/Frustum.d.ts +16 -17
  124. package/dist/shapes/Plane.d.ts +14 -15
  125. package/dist/shapes/Point.d.ts +11 -12
  126. package/dist/shapes/Rectangle.d.ts +12 -13
  127. package/dist/shapes/index.d.ts +5 -6
  128. package/dist/types.d.ts +327 -328
  129. package/dist/utils/assert.d.ts +12 -13
  130. package/dist/utils/canvas.d.ts +6 -7
  131. package/dist/utils/dom.d.ts +11 -11
  132. package/dist/utils/error.d.ts +3 -4
  133. package/dist/utils/event.d.ts +35 -36
  134. package/dist/utils/gradient.d.ts +106 -107
  135. package/dist/utils/index.d.ts +15 -15
  136. package/dist/utils/math.d.ts +36 -40
  137. package/dist/utils/memoize.d.ts +7 -8
  138. package/dist/utils/path.d.ts +24 -29
  139. package/dist/utils/pointer-events.d.ts +2 -3
  140. package/dist/utils/raf.d.ts +14 -15
  141. package/dist/utils/string.d.ts +5 -6
  142. package/dist/utils/tapable/AsyncParallelHook.d.ts +6 -7
  143. package/dist/utils/tapable/AsyncSeriesWaterfallHook.d.ts +6 -7
  144. package/dist/utils/tapable/Hook.d.ts +1 -2
  145. package/dist/utils/tapable/SyncHook.d.ts +6 -7
  146. package/dist/utils/tapable/SyncWaterfallHook.d.ts +6 -7
  147. package/dist/utils/tapable/index.d.ts +4 -5
  148. package/dist/utils/text.d.ts +2 -3
  149. package/dist/utils/transform-mat4.d.ts +4 -0
  150. package/package.json +18 -10
  151. package/dist/AbstractRenderer.d.ts.map +0 -1
  152. package/dist/Canvas.d.ts.map +0 -1
  153. package/dist/camera/Camera.d.ts.map +0 -1
  154. package/dist/camera/Landmark.d.ts.map +0 -1
  155. package/dist/camera/index.d.ts.map +0 -1
  156. package/dist/camera/interfaces.d.ts.map +0 -1
  157. package/dist/components/Cullable.d.ts.map +0 -1
  158. package/dist/components/Geometry.d.ts.map +0 -1
  159. package/dist/components/RBushNode.d.ts.map +0 -1
  160. package/dist/components/Renderable.d.ts.map +0 -1
  161. package/dist/components/Sortable.d.ts.map +0 -1
  162. package/dist/components/Transform.d.ts.map +0 -1
  163. package/dist/components/index.d.ts.map +0 -1
  164. package/dist/css/CSS.d.ts.map +0 -1
  165. package/dist/css/CSSProperty.d.ts.map +0 -1
  166. package/dist/css/CSSStyleValuePool.d.ts.map +0 -1
  167. package/dist/css/StyleValueRegistry.d.ts.map +0 -1
  168. package/dist/css/cssom/CSSColorValue.d.ts.map +0 -1
  169. package/dist/css/cssom/CSSGradientValue.d.ts.map +0 -1
  170. package/dist/css/cssom/CSSKeywordValue.d.ts.map +0 -1
  171. package/dist/css/cssom/CSSMathOperator.d.ts.map +0 -1
  172. package/dist/css/cssom/CSSNumericSumValue.d.ts.map +0 -1
  173. package/dist/css/cssom/CSSNumericValue.d.ts.map +0 -1
  174. package/dist/css/cssom/CSSRGB.d.ts.map +0 -1
  175. package/dist/css/cssom/CSSStyleValue.d.ts.map +0 -1
  176. package/dist/css/cssom/index.d.ts.map +0 -1
  177. package/dist/css/cssom/types.d.ts.map +0 -1
  178. package/dist/css/index.d.ts.map +0 -1
  179. package/dist/css/interfaces.d.ts.map +0 -1
  180. package/dist/css/parser/color.d.ts.map +0 -1
  181. package/dist/css/parser/dimension.d.ts.map +0 -1
  182. package/dist/css/parser/filter.d.ts.map +0 -1
  183. package/dist/css/parser/gradient.d.ts.map +0 -1
  184. package/dist/css/parser/index.d.ts.map +0 -1
  185. package/dist/css/parser/numeric.d.ts.map +0 -1
  186. package/dist/css/parser/path.d.ts.map +0 -1
  187. package/dist/css/parser/points.d.ts.map +0 -1
  188. package/dist/css/parser/transform-origin.d.ts.map +0 -1
  189. package/dist/css/parser/transform.d.ts.map +0 -1
  190. package/dist/css/parser/types.d.ts.map +0 -1
  191. package/dist/css/properties/CSSPropertyAngle.d.ts.map +0 -1
  192. package/dist/css/properties/CSSPropertyClipPath.d.ts.map +0 -1
  193. package/dist/css/properties/CSSPropertyColor.d.ts.map +0 -1
  194. package/dist/css/properties/CSSPropertyFilter.d.ts.map +0 -1
  195. package/dist/css/properties/CSSPropertyLengthOrPercentage.d.ts.map +0 -1
  196. package/dist/css/properties/CSSPropertyLengthOrPercentage12.d.ts.map +0 -1
  197. package/dist/css/properties/CSSPropertyLengthOrPercentage14.d.ts.map +0 -1
  198. package/dist/css/properties/CSSPropertyLocalPosition.d.ts.map +0 -1
  199. package/dist/css/properties/CSSPropertyMarker.d.ts.map +0 -1
  200. package/dist/css/properties/CSSPropertyNumber.d.ts.map +0 -1
  201. package/dist/css/properties/CSSPropertyOffsetDistance.d.ts.map +0 -1
  202. package/dist/css/properties/CSSPropertyOpacity.d.ts.map +0 -1
  203. package/dist/css/properties/CSSPropertyPath.d.ts.map +0 -1
  204. package/dist/css/properties/CSSPropertyPoints.d.ts.map +0 -1
  205. package/dist/css/properties/CSSPropertyShadowBlur.d.ts.map +0 -1
  206. package/dist/css/properties/CSSPropertyText.d.ts.map +0 -1
  207. package/dist/css/properties/CSSPropertyTextTransform.d.ts.map +0 -1
  208. package/dist/css/properties/CSSPropertyTransform.d.ts.map +0 -1
  209. package/dist/css/properties/CSSPropertyTransformOrigin.d.ts.map +0 -1
  210. package/dist/css/properties/CSSPropertyZIndex.d.ts.map +0 -1
  211. package/dist/css/properties/index.d.ts.map +0 -1
  212. package/dist/display-objects/Circle.d.ts.map +0 -1
  213. package/dist/display-objects/CustomElement.d.ts.map +0 -1
  214. package/dist/display-objects/DisplayObject.d.ts.map +0 -1
  215. package/dist/display-objects/Ellipse.d.ts.map +0 -1
  216. package/dist/display-objects/Group.d.ts.map +0 -1
  217. package/dist/display-objects/HTML.d.ts.map +0 -1
  218. package/dist/display-objects/Image.d.ts.map +0 -1
  219. package/dist/display-objects/Line.d.ts.map +0 -1
  220. package/dist/display-objects/Path.d.ts.map +0 -1
  221. package/dist/display-objects/Polygon.d.ts.map +0 -1
  222. package/dist/display-objects/Polyline.d.ts.map +0 -1
  223. package/dist/display-objects/Rect.d.ts.map +0 -1
  224. package/dist/display-objects/Text.d.ts.map +0 -1
  225. package/dist/display-objects/index.d.ts.map +0 -1
  226. package/dist/dom/CustomElementRegistry.d.ts.map +0 -1
  227. package/dist/dom/CustomEvent.d.ts.map +0 -1
  228. package/dist/dom/Document.d.ts.map +0 -1
  229. package/dist/dom/Element.d.ts.map +0 -1
  230. package/dist/dom/EventTarget.d.ts.map +0 -1
  231. package/dist/dom/FederatedEvent.d.ts.map +0 -1
  232. package/dist/dom/FederatedMouseEvent.d.ts.map +0 -1
  233. package/dist/dom/FederatedPointerEvent.d.ts.map +0 -1
  234. package/dist/dom/FederatedWheelEvent.d.ts.map +0 -1
  235. package/dist/dom/MutationEvent.d.ts.map +0 -1
  236. package/dist/dom/Node.d.ts.map +0 -1
  237. package/dist/dom/index.d.ts.map +0 -1
  238. package/dist/dom/interfaces.d.ts.map +0 -1
  239. package/dist/global-runtime.d.ts.map +0 -1
  240. package/dist/index.d.ts.map +0 -1
  241. package/dist/index.umd.js +0 -22112
  242. package/dist/plugins/CullingPlugin.d.ts.map +0 -1
  243. package/dist/plugins/DirtyCheckPlugin.d.ts.map +0 -1
  244. package/dist/plugins/EventPlugin.d.ts.map +0 -1
  245. package/dist/plugins/FrustumCullingStrategy.d.ts.map +0 -1
  246. package/dist/plugins/PrepareRendererPlugin.d.ts.map +0 -1
  247. package/dist/services/ContextService.d.ts.map +0 -1
  248. package/dist/services/EventService.d.ts.map +0 -1
  249. package/dist/services/OffscreenCanvasCreator.d.ts.map +0 -1
  250. package/dist/services/RenderingContext.d.ts.map +0 -1
  251. package/dist/services/RenderingService.d.ts.map +0 -1
  252. package/dist/services/SceneGraphSelector.d.ts.map +0 -1
  253. package/dist/services/SceneGraphService.d.ts.map +0 -1
  254. package/dist/services/TextService.d.ts.map +0 -1
  255. package/dist/services/aabb/CircleUpdater.d.ts.map +0 -1
  256. package/dist/services/aabb/EllipseUpdater.d.ts.map +0 -1
  257. package/dist/services/aabb/LineUpdater.d.ts.map +0 -1
  258. package/dist/services/aabb/PathUpdater.d.ts.map +0 -1
  259. package/dist/services/aabb/PolylineUpdater.d.ts.map +0 -1
  260. package/dist/services/aabb/RectUpdater.d.ts.map +0 -1
  261. package/dist/services/aabb/TextUpdater.d.ts.map +0 -1
  262. package/dist/services/aabb/index.d.ts.map +0 -1
  263. package/dist/services/aabb/interfaces.d.ts.map +0 -1
  264. package/dist/services/index.d.ts.map +0 -1
  265. package/dist/services/interfaces.d.ts.map +0 -1
  266. package/dist/shapes/AABB.d.ts.map +0 -1
  267. package/dist/shapes/Frustum.d.ts.map +0 -1
  268. package/dist/shapes/Plane.d.ts.map +0 -1
  269. package/dist/shapes/Point.d.ts.map +0 -1
  270. package/dist/shapes/Rectangle.d.ts.map +0 -1
  271. package/dist/shapes/index.d.ts.map +0 -1
  272. package/dist/types.d.ts.map +0 -1
  273. package/dist/utils/assert.d.ts.map +0 -1
  274. package/dist/utils/canvas.d.ts.map +0 -1
  275. package/dist/utils/dom.d.ts.map +0 -1
  276. package/dist/utils/error.d.ts.map +0 -1
  277. package/dist/utils/event.d.ts.map +0 -1
  278. package/dist/utils/gradient.d.ts.map +0 -1
  279. package/dist/utils/index.d.ts.map +0 -1
  280. package/dist/utils/math.d.ts.map +0 -1
  281. package/dist/utils/memoize.d.ts.map +0 -1
  282. package/dist/utils/path.d.ts.map +0 -1
  283. package/dist/utils/pointer-events.d.ts.map +0 -1
  284. package/dist/utils/raf.d.ts.map +0 -1
  285. package/dist/utils/string.d.ts.map +0 -1
  286. package/dist/utils/tapable/AsyncParallelHook.d.ts.map +0 -1
  287. package/dist/utils/tapable/AsyncSeriesWaterfallHook.d.ts.map +0 -1
  288. package/dist/utils/tapable/Hook.d.ts.map +0 -1
  289. package/dist/utils/tapable/SyncHook.d.ts.map +0 -1
  290. package/dist/utils/tapable/SyncWaterfallHook.d.ts.map +0 -1
  291. package/dist/utils/tapable/index.d.ts.map +0 -1
  292. package/dist/utils/text.d.ts.map +0 -1
@@ -1,441 +1,440 @@
1
- import type RBush from 'rbush';
2
- import type { GlobalRuntime } from '..';
3
- import type { ICamera } from '../camera';
4
- import type { RBushNodeAABB } from '../components';
5
- import type { DisplayObject } from '../display-objects';
6
- import type { ContextService, EventService, RenderingContext, RenderingPlugin, RenderingService } from '../services';
7
- import type { AABB, PointLike, Rectangle } from '../shapes';
8
- import type { BaseStyleProps, CanvasConfig, InteractivePointerEvent, Shape, TypeEasingFunction } from '../types';
9
- import type { CustomElementRegistry } from './CustomElementRegistry';
10
- import type { FederatedEvent } from './FederatedEvent';
11
- /**
12
- * built-in events for element
13
- * @see https://developer.mozilla.org/en-US/docs/Web/API/MutationEvent
14
- *
15
- * TODO: use MutationObserver instead
16
- * @see https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver
17
- */
18
- export declare enum ElementEvent {
19
- REPARENT = "reparent",
20
- DESTROY = "destroy",
21
- /**
22
- * @see https://www.w3.org/TR/DOM-Level-3-Events/#event-type-DOMAttrModified
23
- */
24
- ATTR_MODIFIED = "DOMAttrModified",
25
- /**
26
- * it has been inserted
27
- * @see https://www.w3.org/TR/DOM-Level-3-Events/#event-type-DOMNodeInserted
28
- */
29
- INSERTED = "DOMNodeInserted",
30
- /**
31
- * it is being removed
32
- * @see https://www.w3.org/TR/DOM-Level-3-Events/#event-type-DOMNodeRemoved
33
- */
34
- REMOVED = "removed",
35
- /**
36
- * @see https://www.w3.org/TR/DOM-Level-3-Events/#domnodeinsertedintodocument
37
- */
38
- MOUNTED = "DOMNodeInsertedIntoDocument",
39
- /**
40
- * @see https://www.w3.org/TR/DOM-Level-3-Events/#domnoderemovedfromdocument
41
- */
42
- UNMOUNTED = "DOMNodeRemovedFromDocument",
43
- BOUNDS_CHANGED = "bounds-changed",
44
- CULLED = "culled"
45
- }
46
- export interface IEventTarget {
47
- addEventListener: (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions) => void;
48
- removeEventListener: (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions) => void;
49
- dispatchEvent: <T extends FederatedEvent>(e: T, skipPropagate?: boolean) => boolean;
50
- }
51
- export interface INode extends IEventTarget {
52
- shadow: boolean;
53
- /**
54
- * Returns node's node document's document base URL.
55
- */
56
- readonly baseURI: string;
57
- /**
58
- * Returns the children.
59
- */
60
- readonly childNodes: IChildNode[];
61
- /**
62
- * Returns the first child.
63
- */
64
- readonly firstChild: IChildNode | null;
65
- /**
66
- * Returns true if node is connected and false otherwise.
67
- */
68
- isConnected: boolean;
69
- /**
70
- * Returns the last child.
71
- */
72
- readonly lastChild: IChildNode | null;
73
- /**
74
- * Returns the next sibling.
75
- */
76
- readonly nextSibling: IChildNode | null;
77
- /**
78
- * Returns a string appropriate for the type of node.
79
- */
80
- readonly nodeName: string;
81
- /**
82
- * Returns the type of node.
83
- */
84
- readonly nodeType: number;
85
- nodeValue: string | null;
86
- /**
87
- * Returns the node document. Returns null for documents.
88
- */
89
- ownerDocument: IDocument | null;
90
- /**
91
- * Returns the parent element.
92
- */
93
- readonly parentElement: IElement | null;
94
- /**
95
- * Returns the parent.
96
- */
97
- parentNode: (INode & IParentNode) | null;
98
- /**
99
- * Returns the previous sibling.
100
- */
101
- readonly previousSibling: IChildNode | null;
102
- textContent: string | null;
103
- appendChild: <T extends INode>(newChild: T, index?: number) => T;
104
- /**
105
- * Returns a copy of node. If deep is true, the copy also includes the node's descendants.
106
- */
107
- cloneNode: (deep?: boolean) => INode;
108
- /**
109
- * Returns a bitmask indicating the position of other relative to node.
110
- */
111
- compareDocumentPosition: (other: INode) => number;
112
- /**
113
- * Returns true if other is an inclusive descendant of node, and false otherwise.
114
- */
115
- contains: (other: INode | null) => boolean;
116
- /**
117
- * Returns node's root.
118
- */
119
- getRootNode: (options?: GetRootNodeOptions) => INode;
120
- /**
121
- * Returns node's ancestor.
122
- */
123
- getAncestor: (n: number) => INode | null;
124
- /**
125
- * Traverse in sub tree.
126
- */
127
- forEach: (callback: (o: INode) => void | boolean, assigned?: boolean) => void;
128
- /**
129
- * Returns whether node has children.
130
- */
131
- hasChildNodes: () => boolean;
132
- insertBefore: <T extends INode>(newChild: T, refChild: INode | null) => T;
133
- isDefaultNamespace: (namespace: string | null) => boolean;
134
- /**
135
- * Returns whether node and otherNode have the same properties.
136
- */
137
- isEqualNode: (otherNode: INode | null) => boolean;
138
- isSameNode: (otherNode: INode | null) => boolean;
139
- lookupNamespaceURI: (prefix: string | null) => string | null;
140
- lookupPrefix: (namespace: string | null) => string | null;
141
- /**
142
- * Removes empty exclusive Text nodes and concatenates the data of remaining contiguous exclusive Text nodes into the first of their nodes.
143
- */
144
- normalize: () => void;
145
- removeChild: <T extends INode>(oldChild: T) => T;
146
- replaceChild: <T extends INode>(newChild: INode, oldChild: T) => T;
147
- /**
148
- * Destroy itself.
149
- */
150
- destroy: () => void;
151
- }
152
- export interface IParentNode {
153
- readonly childElementCount: number;
154
- /**
155
- * Returns the child elements.
156
- */
157
- readonly children: IElement[];
158
- /**
159
- * Returns the first child that is an element, and null otherwise.
160
- */
161
- readonly firstElementChild: IElement | null;
162
- /**
163
- * Returns the last child that is an element, and null otherwise.
164
- */
165
- readonly lastElementChild: IElement | null;
166
- /**
167
- * Inserts nodes after the last child of node, while replacing strings in nodes with equivalent Text nodes.
168
- *
169
- * Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
170
- */
171
- append: (...nodes: INode[]) => void;
172
- /**
173
- * Inserts nodes before the first child of node, while replacing strings in nodes with equivalent Text nodes.
174
- *
175
- * Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
176
- */
177
- prepend: (...nodes: INode[]) => void;
178
- /**
179
- * Returns the first element that is a descendant of node that matches selectors.
180
- */
181
- querySelector: <E extends IElement = IElement>(selectors: string) => E | null;
182
- /**
183
- * Returns all element descendants of node that match selectors.
184
- */
185
- querySelectorAll: <E extends IElement = IElement>(selectors: string) => E[];
186
- /**
187
- * Similar to querySelector, use custom filter instead of selectors.
188
- */
189
- find: <E extends IElement = IElement>(filter: (node: E) => boolean) => E | null;
190
- /**
191
- * Similar to querySelectorAll, use custom filter instead of selectors.
192
- */
193
- findAll: <E extends IElement = IElement>(filter: (node: E) => boolean) => E[];
194
- }
195
- export interface IChildNode extends INode {
196
- /**
197
- * Inserts nodes just after node, while replacing strings in nodes with equivalent Text nodes.
198
- *
199
- * Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
200
- */
201
- after: (...nodes: INode[]) => void;
202
- /**
203
- * Inserts nodes just before node, while replacing strings in nodes with equivalent Text nodes.
204
- *
205
- * Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
206
- */
207
- before: (...nodes: INode[]) => void;
208
- /**
209
- * Removes node.
210
- */
211
- remove: () => void;
212
- /**
213
- * Replaces node with nodes, while replacing strings in nodes with equivalent Text nodes.
214
- *
215
- * Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
216
- */
217
- replaceWith: (...nodes: INode[]) => void;
218
- }
219
- export interface DisplayObjectConfig<StyleProps> {
220
- /**
221
- * element's identifier, must be unique in a document.
222
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/id
223
- */
224
- id?: string;
225
- name?: string;
226
- /**
227
- * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/className
228
- */
229
- class?: string;
230
- className?: string;
231
- /**
232
- * all styles properties, not read-only
233
- * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style
234
- */
235
- style?: StyleProps;
236
- initialParsedStyle?: any;
237
- /**
238
- * compatible with G 3.0
239
- * @alias style
240
- * @deprecated
241
- */
242
- attrs?: StyleProps;
243
- type?: Shape | string;
244
- /**
245
- * @deprecated use `style.zIndex` instead
246
- */
247
- zIndex?: number;
248
- /**
249
- * @deprecated use `style.visibility = 'visible'` instead
250
- */
251
- visible?: boolean;
252
- /**
253
- * compatible with G 3.0
254
- * @alias interactive
255
- * @deprecated
256
- */
257
- capture?: boolean;
258
- /**
259
- * enable interaction events for the DisplayObject
260
- * @deprecated use `style.pointerEvents = 'auto'` instead
261
- */
262
- interactive?: boolean;
263
- }
264
- export interface IElement<StyleProps = any, ParsedStyleProps = any> extends INode, IChildNode, IParentNode {
265
- /**
266
- * Returns the value of element's id content attribute. Can be set to change it.
267
- */
268
- id: string;
269
- /**
270
- * Returns the qualified name.
271
- */
272
- tagName: string;
273
- name: string;
274
- /**
275
- * Returns the value of element's class content attribute. Can be set to change it.
276
- */
277
- className: string;
278
- classList: string[];
279
- /**
280
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/attributes
281
- */
282
- attributes: StyleProps;
283
- /**
284
- * compatible with `style`
285
- * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style
286
- */
287
- style: StyleProps & ICSSStyleDeclaration<StyleProps>;
288
- parsedStyle: ParsedStyleProps;
289
- getElementById: <E extends IElement = IElement>(id: string) => E | null;
290
- getElementsByName: <E extends IElement = IElement>(name: string) => E[];
291
- getElementsByClassName: <E extends IElement = IElement>(className: string) => E[];
292
- getElementsByTagName: <E extends IElement = IElement>(tagName: string) => E[];
293
- scrollLeft: number;
294
- scrollTop: number;
295
- clientLeft: number;
296
- clientTop: number;
297
- getGeometryBounds(): AABB;
298
- getRenderBounds(): AABB;
299
- getBounds(): AABB;
300
- getLocalBounds(): AABB;
301
- getBoundingClientRect(): Rectangle;
302
- getClientRects(): Rectangle[];
303
- /**
304
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute
305
- */
306
- setAttribute: <Key extends keyof StyleProps>(attributeName: Key, value: StyleProps[Key], force?: boolean) => void;
307
- /**
308
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute
309
- */
310
- getAttribute: (attributeName: keyof StyleProps) => StyleProps[keyof StyleProps] | undefined;
311
- /**
312
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute
313
- */
314
- removeAttribute: (attributeName: keyof StyleProps) => void;
315
- hasAttribute: (qualifiedName: string) => boolean;
316
- }
317
- export interface IAnimationTimeline {
318
- currentTime: number | null;
319
- destroy: () => void;
320
- play: (target: IElement, keyframes: Keyframe[] | PropertyIndexedKeyframes | null, options?: number | KeyframeAnimationOptions | undefined) => IAnimation;
321
- restart: () => boolean;
322
- getAnimations: () => IAnimation[];
323
- }
324
- export interface IAnimation {
325
- effect: IKeyframeEffect;
326
- timeline: IAnimationTimeline;
327
- id: string;
328
- pending: boolean;
329
- playState: AnimationPlayState;
330
- ready: Promise<this>;
331
- finished: Promise<this>;
332
- onfinish: ((this: this, ev: AnimationPlaybackEvent) => any) | null;
333
- oncancel: ((this: this, ev: AnimationPlaybackEvent) => any) | null;
334
- onframe: ((this: this, ev: AnimationPlaybackEvent) => any) | null;
335
- currentTime: number;
336
- startTime: number;
337
- playbackRate: number;
338
- totalDuration: number;
339
- play: () => void;
340
- pause: () => void;
341
- finish: () => void;
342
- cancel: () => void;
343
- reverse: () => void;
344
- updatePlaybackRate: (playbackRate: number) => void;
345
- tick: (timelineTime: number, isAnimationFrame: boolean) => void;
346
- }
347
- export interface IAnimationEffectTiming extends EffectTiming {
348
- easingFunction: TypeEasingFunction;
349
- }
350
- export interface IKeyframeEffect {
351
- composite: CompositeOperation;
352
- iterationComposite: IterationCompositeOperation;
353
- target: IElement | null;
354
- animation: IAnimation | null;
355
- timing: IAnimationEffectTiming;
356
- normalizedKeyframes: ComputedKeyframe[];
357
- applyInterpolations: () => void;
358
- update: (localTime: number | null) => boolean;
359
- getKeyframes: () => ComputedKeyframe[];
360
- setKeyframes: (keyframes: Keyframe[] | PropertyIndexedKeyframes | null) => void;
361
- getComputedTiming: () => ComputedEffectTiming;
362
- getTiming: () => EffectTiming;
363
- updateTiming: (timing?: OptionalEffectTiming) => void;
364
- }
365
- export interface IDocument extends INode, IParentNode {
366
- /**
367
- * Returns the Window object of the active document.
368
- */
369
- readonly defaultView: ICanvas | null;
370
- /**
371
- * Gets a reference to the root node of the document.
372
- */
373
- readonly documentElement: IElement;
374
- readonly ownerDocument: null;
375
- readonly timeline: IAnimationTimeline;
376
- /**
377
- * Creates an instance of the element for the specified tag.
378
- */
379
- createElement: <T extends DisplayObject<StyleProps>, StyleProps extends BaseStyleProps>(tagName: string, options: DisplayObjectConfig<StyleProps>) => T;
380
- elementFromPoint: (x: number, y: number) => Promise<DisplayObject>;
381
- elementsFromPoint: (x: number, y: number) => Promise<DisplayObject[]>;
382
- elementsFromBBox: (minX: number, minY: number, maxX: number, maxY: number) => DisplayObject[];
383
- }
384
- /**
385
- * @see https://developer.mozilla.org/zh-CN/docs/Web/API/CSSStyleDeclaration
386
- */
387
- export interface ICSSStyleDeclaration<StyleProps> {
388
- setProperty: <Key extends keyof StyleProps>(propertyName: Key, value: StyleProps[Key], priority?: string) => void;
389
- getPropertyValue: (propertyName: keyof StyleProps) => StyleProps[keyof StyleProps] | undefined;
390
- removeProperty: (propertyName: keyof StyleProps) => void;
391
- item: (index: number) => string;
392
- }
393
- export interface CanvasContext {
394
- config: Partial<CanvasConfig>;
395
- camera: ICamera;
396
- /**
397
- * ContextServiceContribution
398
- */
399
- ContextService: new (context: GlobalRuntime & CanvasContext) => ContextService<unknown>;
400
- contextService: ContextService<unknown>;
401
- renderingService: RenderingService;
402
- eventService: EventService;
403
- rBushRoot: RBush<RBushNodeAABB>;
404
- renderingContext: RenderingContext;
405
- renderingPlugins: RenderingPlugin[];
406
- }
407
- export interface ICanvas extends IEventTarget {
408
- document: IDocument;
409
- customElements: CustomElementRegistry;
410
- devicePixelRatio: number;
411
- requestAnimationFrame: (callback: FrameRequestCallback) => number;
412
- cancelAnimationFrame: (handle: number) => void;
413
- supportsTouchEvents: boolean;
414
- supportsPointerEvents: boolean;
415
- isTouchEvent: (event: InteractivePointerEvent) => event is TouchEvent;
416
- isMouseEvent: (event: InteractivePointerEvent) => event is MouseEvent;
417
- render: () => void;
418
- destroy: (destroyScenegraph?: boolean) => void;
419
- resize: (width: number, height: number) => void;
420
- context: CanvasContext;
421
- mountChildren: (parent: INode) => void;
422
- unmountChildren: (parent: INode) => void;
423
- getConfig: () => Partial<CanvasConfig>;
424
- getCamera: () => ICamera;
425
- getContextService: () => ContextService<unknown>;
426
- getRenderingService: () => RenderingService;
427
- getEventService: () => EventService;
428
- client2Viewport: (client: PointLike) => PointLike;
429
- viewport2Client: (viewport: PointLike) => PointLike;
430
- canvas2Viewport: (canvas: PointLike) => PointLike;
431
- viewport2Canvas: (viewport: PointLike) => PointLike;
432
- }
433
- interface EventListener {
434
- (evt: FederatedEvent): void;
435
- }
436
- interface EventListenerObject {
437
- handleEvent(object: FederatedEvent): void;
438
- }
439
- export type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
440
- export {};
441
- //# sourceMappingURL=interfaces.d.ts.map
1
+ import type RBush from 'rbush';
2
+ import type { GlobalRuntime } from '..';
3
+ import type { ICamera } from '../camera';
4
+ import type { RBushNodeAABB } from '../components';
5
+ import type { DisplayObject } from '../display-objects';
6
+ import type { ContextService, EventService, RenderingContext, RenderingPlugin, RenderingService } from '../services';
7
+ import type { AABB, PointLike, Rectangle } from '../shapes';
8
+ import type { BaseStyleProps, CanvasConfig, InteractivePointerEvent, Shape, TypeEasingFunction } from '../types';
9
+ import type { CustomElementRegistry } from './CustomElementRegistry';
10
+ import type { FederatedEvent } from './FederatedEvent';
11
+ /**
12
+ * built-in events for element
13
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/MutationEvent
14
+ *
15
+ * TODO: use MutationObserver instead
16
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver
17
+ */
18
+ export declare enum ElementEvent {
19
+ REPARENT = "reparent",
20
+ DESTROY = "destroy",
21
+ /**
22
+ * @see https://www.w3.org/TR/DOM-Level-3-Events/#event-type-DOMAttrModified
23
+ */
24
+ ATTR_MODIFIED = "DOMAttrModified",
25
+ /**
26
+ * it has been inserted
27
+ * @see https://www.w3.org/TR/DOM-Level-3-Events/#event-type-DOMNodeInserted
28
+ */
29
+ INSERTED = "DOMNodeInserted",
30
+ /**
31
+ * it is being removed
32
+ * @see https://www.w3.org/TR/DOM-Level-3-Events/#event-type-DOMNodeRemoved
33
+ */
34
+ REMOVED = "removed",
35
+ /**
36
+ * @see https://www.w3.org/TR/DOM-Level-3-Events/#domnodeinsertedintodocument
37
+ */
38
+ MOUNTED = "DOMNodeInsertedIntoDocument",
39
+ /**
40
+ * @see https://www.w3.org/TR/DOM-Level-3-Events/#domnoderemovedfromdocument
41
+ */
42
+ UNMOUNTED = "DOMNodeRemovedFromDocument",
43
+ BOUNDS_CHANGED = "bounds-changed",
44
+ CULLED = "culled"
45
+ }
46
+ export interface IEventTarget {
47
+ addEventListener: (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions) => void;
48
+ removeEventListener: (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions) => void;
49
+ dispatchEvent: <T extends FederatedEvent>(e: T, skipPropagate?: boolean) => boolean;
50
+ }
51
+ export interface INode extends IEventTarget {
52
+ shadow: boolean;
53
+ /**
54
+ * Returns node's node document's document base URL.
55
+ */
56
+ readonly baseURI: string;
57
+ /**
58
+ * Returns the children.
59
+ */
60
+ readonly childNodes: IChildNode[];
61
+ /**
62
+ * Returns the first child.
63
+ */
64
+ readonly firstChild: IChildNode | null;
65
+ /**
66
+ * Returns true if node is connected and false otherwise.
67
+ */
68
+ isConnected: boolean;
69
+ /**
70
+ * Returns the last child.
71
+ */
72
+ readonly lastChild: IChildNode | null;
73
+ /**
74
+ * Returns the next sibling.
75
+ */
76
+ readonly nextSibling: IChildNode | null;
77
+ /**
78
+ * Returns a string appropriate for the type of node.
79
+ */
80
+ readonly nodeName: string;
81
+ /**
82
+ * Returns the type of node.
83
+ */
84
+ readonly nodeType: number;
85
+ nodeValue: string | null;
86
+ /**
87
+ * Returns the node document. Returns null for documents.
88
+ */
89
+ ownerDocument: IDocument | null;
90
+ /**
91
+ * Returns the parent element.
92
+ */
93
+ readonly parentElement: IElement | null;
94
+ /**
95
+ * Returns the parent.
96
+ */
97
+ parentNode: (INode & IParentNode) | null;
98
+ /**
99
+ * Returns the previous sibling.
100
+ */
101
+ readonly previousSibling: IChildNode | null;
102
+ textContent: string | null;
103
+ appendChild: <T extends INode>(newChild: T, index?: number) => T;
104
+ /**
105
+ * Returns a copy of node. If deep is true, the copy also includes the node's descendants.
106
+ */
107
+ cloneNode: (deep?: boolean) => INode;
108
+ /**
109
+ * Returns a bitmask indicating the position of other relative to node.
110
+ */
111
+ compareDocumentPosition: (other: INode) => number;
112
+ /**
113
+ * Returns true if other is an inclusive descendant of node, and false otherwise.
114
+ */
115
+ contains: (other: INode | null) => boolean;
116
+ /**
117
+ * Returns node's root.
118
+ */
119
+ getRootNode: (options?: GetRootNodeOptions) => INode;
120
+ /**
121
+ * Returns node's ancestor.
122
+ */
123
+ getAncestor: (n: number) => INode | null;
124
+ /**
125
+ * Traverse in sub tree.
126
+ */
127
+ forEach: (callback: (o: INode) => void | boolean, assigned?: boolean) => void;
128
+ /**
129
+ * Returns whether node has children.
130
+ */
131
+ hasChildNodes: () => boolean;
132
+ insertBefore: <T extends INode>(newChild: T, refChild: INode | null) => T;
133
+ isDefaultNamespace: (namespace: string | null) => boolean;
134
+ /**
135
+ * Returns whether node and otherNode have the same properties.
136
+ */
137
+ isEqualNode: (otherNode: INode | null) => boolean;
138
+ isSameNode: (otherNode: INode | null) => boolean;
139
+ lookupNamespaceURI: (prefix: string | null) => string | null;
140
+ lookupPrefix: (namespace: string | null) => string | null;
141
+ /**
142
+ * Removes empty exclusive Text nodes and concatenates the data of remaining contiguous exclusive Text nodes into the first of their nodes.
143
+ */
144
+ normalize: () => void;
145
+ removeChild: <T extends INode>(oldChild: T) => T;
146
+ replaceChild: <T extends INode>(newChild: INode, oldChild: T) => T;
147
+ /**
148
+ * Destroy itself.
149
+ */
150
+ destroy: () => void;
151
+ }
152
+ export interface IParentNode {
153
+ readonly childElementCount: number;
154
+ /**
155
+ * Returns the child elements.
156
+ */
157
+ readonly children: IElement[];
158
+ /**
159
+ * Returns the first child that is an element, and null otherwise.
160
+ */
161
+ readonly firstElementChild: IElement | null;
162
+ /**
163
+ * Returns the last child that is an element, and null otherwise.
164
+ */
165
+ readonly lastElementChild: IElement | null;
166
+ /**
167
+ * Inserts nodes after the last child of node, while replacing strings in nodes with equivalent Text nodes.
168
+ *
169
+ * Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
170
+ */
171
+ append: (...nodes: INode[]) => void;
172
+ /**
173
+ * Inserts nodes before the first child of node, while replacing strings in nodes with equivalent Text nodes.
174
+ *
175
+ * Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
176
+ */
177
+ prepend: (...nodes: INode[]) => void;
178
+ /**
179
+ * Returns the first element that is a descendant of node that matches selectors.
180
+ */
181
+ querySelector: <E extends IElement = IElement>(selectors: string) => E | null;
182
+ /**
183
+ * Returns all element descendants of node that match selectors.
184
+ */
185
+ querySelectorAll: <E extends IElement = IElement>(selectors: string) => E[];
186
+ /**
187
+ * Similar to querySelector, use custom filter instead of selectors.
188
+ */
189
+ find: <E extends IElement = IElement>(filter: (node: E) => boolean) => E | null;
190
+ /**
191
+ * Similar to querySelectorAll, use custom filter instead of selectors.
192
+ */
193
+ findAll: <E extends IElement = IElement>(filter: (node: E) => boolean) => E[];
194
+ }
195
+ export interface IChildNode extends INode {
196
+ /**
197
+ * Inserts nodes just after node, while replacing strings in nodes with equivalent Text nodes.
198
+ *
199
+ * Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
200
+ */
201
+ after: (...nodes: INode[]) => void;
202
+ /**
203
+ * Inserts nodes just before node, while replacing strings in nodes with equivalent Text nodes.
204
+ *
205
+ * Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
206
+ */
207
+ before: (...nodes: INode[]) => void;
208
+ /**
209
+ * Removes node.
210
+ */
211
+ remove: () => void;
212
+ /**
213
+ * Replaces node with nodes, while replacing strings in nodes with equivalent Text nodes.
214
+ *
215
+ * Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
216
+ */
217
+ replaceWith: (...nodes: INode[]) => void;
218
+ }
219
+ export interface DisplayObjectConfig<StyleProps> {
220
+ /**
221
+ * element's identifier, must be unique in a document.
222
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/id
223
+ */
224
+ id?: string;
225
+ name?: string;
226
+ /**
227
+ * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/className
228
+ */
229
+ class?: string;
230
+ className?: string;
231
+ /**
232
+ * all styles properties, not read-only
233
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style
234
+ */
235
+ style?: StyleProps;
236
+ initialParsedStyle?: any;
237
+ /**
238
+ * compatible with G 3.0
239
+ * @alias style
240
+ * @deprecated
241
+ */
242
+ attrs?: StyleProps;
243
+ type?: Shape | string;
244
+ /**
245
+ * @deprecated use `style.zIndex` instead
246
+ */
247
+ zIndex?: number;
248
+ /**
249
+ * @deprecated use `style.visibility = 'visible'` instead
250
+ */
251
+ visible?: boolean;
252
+ /**
253
+ * compatible with G 3.0
254
+ * @alias interactive
255
+ * @deprecated
256
+ */
257
+ capture?: boolean;
258
+ /**
259
+ * enable interaction events for the DisplayObject
260
+ * @deprecated use `style.pointerEvents = 'auto'` instead
261
+ */
262
+ interactive?: boolean;
263
+ }
264
+ export interface IElement<StyleProps = any, ParsedStyleProps = any> extends INode, IChildNode, IParentNode {
265
+ /**
266
+ * Returns the value of element's id content attribute. Can be set to change it.
267
+ */
268
+ id: string;
269
+ /**
270
+ * Returns the qualified name.
271
+ */
272
+ tagName: string;
273
+ name: string;
274
+ /**
275
+ * Returns the value of element's class content attribute. Can be set to change it.
276
+ */
277
+ className: string;
278
+ classList: string[];
279
+ /**
280
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/attributes
281
+ */
282
+ attributes: StyleProps;
283
+ /**
284
+ * compatible with `style`
285
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style
286
+ */
287
+ style: StyleProps & ICSSStyleDeclaration<StyleProps>;
288
+ parsedStyle: ParsedStyleProps;
289
+ getElementById: <E extends IElement = IElement>(id: string) => E | null;
290
+ getElementsByName: <E extends IElement = IElement>(name: string) => E[];
291
+ getElementsByClassName: <E extends IElement = IElement>(className: string) => E[];
292
+ getElementsByTagName: <E extends IElement = IElement>(tagName: string) => E[];
293
+ scrollLeft: number;
294
+ scrollTop: number;
295
+ clientLeft: number;
296
+ clientTop: number;
297
+ getGeometryBounds(): AABB;
298
+ getRenderBounds(): AABB;
299
+ getBounds(): AABB;
300
+ getLocalBounds(): AABB;
301
+ getBoundingClientRect(): Rectangle;
302
+ getClientRects(): Rectangle[];
303
+ /**
304
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute
305
+ */
306
+ setAttribute: <Key extends keyof StyleProps>(attributeName: Key, value: StyleProps[Key], force?: boolean) => void;
307
+ /**
308
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute
309
+ */
310
+ getAttribute: (attributeName: keyof StyleProps) => StyleProps[keyof StyleProps] | undefined;
311
+ /**
312
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute
313
+ */
314
+ removeAttribute: (attributeName: keyof StyleProps) => void;
315
+ hasAttribute: (qualifiedName: string) => boolean;
316
+ }
317
+ export interface IAnimationTimeline {
318
+ currentTime: number | null;
319
+ destroy: () => void;
320
+ play: (target: IElement, keyframes: Keyframe[] | PropertyIndexedKeyframes | null, options?: number | KeyframeAnimationOptions | undefined) => IAnimation;
321
+ restart: () => boolean;
322
+ getAnimations: () => IAnimation[];
323
+ }
324
+ export interface IAnimation {
325
+ effect: IKeyframeEffect;
326
+ timeline: IAnimationTimeline;
327
+ id: string;
328
+ pending: boolean;
329
+ playState: AnimationPlayState;
330
+ ready: Promise<this>;
331
+ finished: Promise<this>;
332
+ onfinish: ((this: this, ev: AnimationPlaybackEvent) => any) | null;
333
+ oncancel: ((this: this, ev: AnimationPlaybackEvent) => any) | null;
334
+ onframe: ((this: this, ev: AnimationPlaybackEvent) => any) | null;
335
+ currentTime: number;
336
+ startTime: number;
337
+ playbackRate: number;
338
+ totalDuration: number;
339
+ play: () => void;
340
+ pause: () => void;
341
+ finish: () => void;
342
+ cancel: () => void;
343
+ reverse: () => void;
344
+ updatePlaybackRate: (playbackRate: number) => void;
345
+ tick: (timelineTime: number, isAnimationFrame: boolean) => void;
346
+ }
347
+ export interface IAnimationEffectTiming extends EffectTiming {
348
+ easingFunction: TypeEasingFunction;
349
+ }
350
+ export interface IKeyframeEffect {
351
+ composite: CompositeOperation;
352
+ iterationComposite: IterationCompositeOperation;
353
+ target: IElement | null;
354
+ animation: IAnimation | null;
355
+ timing: IAnimationEffectTiming;
356
+ normalizedKeyframes: ComputedKeyframe[];
357
+ applyInterpolations: () => void;
358
+ update: (localTime: number | null) => boolean;
359
+ getKeyframes: () => ComputedKeyframe[];
360
+ setKeyframes: (keyframes: Keyframe[] | PropertyIndexedKeyframes | null) => void;
361
+ getComputedTiming: () => ComputedEffectTiming;
362
+ getTiming: () => EffectTiming;
363
+ updateTiming: (timing?: OptionalEffectTiming) => void;
364
+ }
365
+ export interface IDocument extends INode, IParentNode {
366
+ /**
367
+ * Returns the Window object of the active document.
368
+ */
369
+ readonly defaultView: ICanvas | null;
370
+ /**
371
+ * Gets a reference to the root node of the document.
372
+ */
373
+ readonly documentElement: IElement;
374
+ readonly ownerDocument: null;
375
+ readonly timeline: IAnimationTimeline;
376
+ /**
377
+ * Creates an instance of the element for the specified tag.
378
+ */
379
+ createElement: <T extends DisplayObject<StyleProps>, StyleProps extends BaseStyleProps>(tagName: string, options: DisplayObjectConfig<StyleProps>) => T;
380
+ elementFromPoint: (x: number, y: number) => Promise<DisplayObject>;
381
+ elementsFromPoint: (x: number, y: number) => Promise<DisplayObject[]>;
382
+ elementsFromBBox: (minX: number, minY: number, maxX: number, maxY: number) => DisplayObject[];
383
+ }
384
+ /**
385
+ * @see https://developer.mozilla.org/zh-CN/docs/Web/API/CSSStyleDeclaration
386
+ */
387
+ export interface ICSSStyleDeclaration<StyleProps> {
388
+ setProperty: <Key extends keyof StyleProps>(propertyName: Key, value: StyleProps[Key], priority?: string) => void;
389
+ getPropertyValue: (propertyName: keyof StyleProps) => StyleProps[keyof StyleProps] | undefined;
390
+ removeProperty: (propertyName: keyof StyleProps) => void;
391
+ item: (index: number) => string;
392
+ }
393
+ export interface CanvasContext {
394
+ config: Partial<CanvasConfig>;
395
+ camera: ICamera;
396
+ /**
397
+ * ContextServiceContribution
398
+ */
399
+ ContextService: new (context: GlobalRuntime & CanvasContext) => ContextService<unknown>;
400
+ contextService: ContextService<unknown>;
401
+ renderingService: RenderingService;
402
+ eventService: EventService;
403
+ rBushRoot: RBush<RBushNodeAABB>;
404
+ renderingContext: RenderingContext;
405
+ renderingPlugins: RenderingPlugin[];
406
+ }
407
+ export interface ICanvas extends IEventTarget {
408
+ document: IDocument;
409
+ customElements: CustomElementRegistry;
410
+ devicePixelRatio: number;
411
+ requestAnimationFrame: (callback: FrameRequestCallback) => number;
412
+ cancelAnimationFrame: (handle: number) => void;
413
+ supportsTouchEvents: boolean;
414
+ supportsPointerEvents: boolean;
415
+ isTouchEvent: (event: InteractivePointerEvent) => event is TouchEvent;
416
+ isMouseEvent: (event: InteractivePointerEvent) => event is MouseEvent;
417
+ render: () => void;
418
+ destroy: (destroyScenegraph?: boolean) => void;
419
+ resize: (width: number, height: number) => void;
420
+ context: CanvasContext;
421
+ mountChildren: (parent: INode) => void;
422
+ unmountChildren: (parent: INode) => void;
423
+ getConfig: () => Partial<CanvasConfig>;
424
+ getCamera: () => ICamera;
425
+ getContextService: () => ContextService<unknown>;
426
+ getRenderingService: () => RenderingService;
427
+ getEventService: () => EventService;
428
+ client2Viewport: (client: PointLike) => PointLike;
429
+ viewport2Client: (viewport: PointLike) => PointLike;
430
+ canvas2Viewport: (canvas: PointLike) => PointLike;
431
+ viewport2Canvas: (viewport: PointLike) => PointLike;
432
+ }
433
+ interface EventListener {
434
+ (evt: FederatedEvent): void;
435
+ }
436
+ interface EventListenerObject {
437
+ handleEvent(object: FederatedEvent): void;
438
+ }
439
+ export type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
440
+ export {};