@antv/g 1.0.0-alpha.27 → 1.0.0-alpha.28

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 (151) hide show
  1. package/dist/index.umd.js +4238 -0
  2. package/lib/index.js +222 -0
  3. package/package.json +11 -10
  4. package/dist/AbstractRenderer.d.ts +0 -26
  5. package/dist/Canvas.d.ts +0 -96
  6. package/dist/DisplayObjectPool.d.ts +0 -7
  7. package/dist/__tests__/canvas.spec.d.ts +0 -1
  8. package/dist/__tests__/custom-element.spec.d.ts +0 -3
  9. package/dist/__tests__/event.spec.d.ts +0 -1
  10. package/dist/camera/Camera.d.ts +0 -279
  11. package/dist/camera/Landmark.d.ts +0 -28
  12. package/dist/camera/__tests__/camera.spec.d.ts +0 -1
  13. package/dist/camera/__tests__/landmark.spec.d.ts +0 -1
  14. package/dist/camera/index.d.ts +0 -2
  15. package/dist/canvas-module.d.ts +0 -3
  16. package/dist/components/Cullable.d.ts +0 -15
  17. package/dist/components/Geometry.d.ts +0 -13
  18. package/dist/components/Renderable.d.ts +0 -25
  19. package/dist/components/Sortable.d.ts +0 -17
  20. package/dist/components/Transform.d.ts +0 -28
  21. package/dist/components/index.d.ts +0 -5
  22. package/dist/display-objects/Circle.d.ts +0 -12
  23. package/dist/display-objects/CustomElement.d.ts +0 -25
  24. package/dist/display-objects/DisplayObject.d.ts +0 -258
  25. package/dist/display-objects/Ellipse.d.ts +0 -14
  26. package/dist/display-objects/Group.d.ts +0 -6
  27. package/dist/display-objects/HTML.d.ts +0 -36
  28. package/dist/display-objects/Image.d.ts +0 -16
  29. package/dist/display-objects/Line.d.ts +0 -23
  30. package/dist/display-objects/Path.d.ts +0 -47
  31. package/dist/display-objects/Polygon.d.ts +0 -12
  32. package/dist/display-objects/Polyline.d.ts +0 -21
  33. package/dist/display-objects/Rect.d.ts +0 -16
  34. package/dist/display-objects/Text.d.ts +0 -65
  35. package/dist/display-objects/__tests__/circle.spec.d.ts +0 -1
  36. package/dist/display-objects/__tests__/display-object.bounds.spec.d.ts +0 -1
  37. package/dist/display-objects/__tests__/display-object.node.spec.d.ts +0 -1
  38. package/dist/display-objects/__tests__/display-object.transformable.spec.d.ts +0 -1
  39. package/dist/display-objects/__tests__/display-object.visible.spec.d.ts +0 -1
  40. package/dist/display-objects/__tests__/ellipse.spec.d.ts +0 -1
  41. package/dist/display-objects/__tests__/line.spec.d.ts +0 -1
  42. package/dist/display-objects/__tests__/path.spec.d.ts +0 -1
  43. package/dist/display-objects/__tests__/polygon.spec.d.ts +0 -1
  44. package/dist/display-objects/__tests__/polyline.spec.d.ts +0 -1
  45. package/dist/display-objects/__tests__/text.spec.d.ts +0 -1
  46. package/dist/display-objects/index.d.ts +0 -13
  47. package/dist/dom/Animation.d.ts +0 -132
  48. package/dist/dom/AnimationEffectTiming.d.ts +0 -59
  49. package/dist/dom/AnimationEvent.d.ts +0 -11
  50. package/dist/dom/AnimationTimeline.d.ts +0 -37
  51. package/dist/dom/CustomElementRegistry.d.ts +0 -15
  52. package/dist/dom/CustomEvent.d.ts +0 -16
  53. package/dist/dom/Document.d.ts +0 -59
  54. package/dist/dom/Element.d.ts +0 -143
  55. package/dist/dom/EventTarget.d.ts +0 -47
  56. package/dist/dom/FederatedEvent.d.ts +0 -146
  57. package/dist/dom/FederatedMouseEvent.d.ts +0 -52
  58. package/dist/dom/FederatedPointerEvent.d.ts +0 -69
  59. package/dist/dom/FederatedWheelEvent.d.ts +0 -20
  60. package/dist/dom/KeyframeEffect.d.ts +0 -48
  61. package/dist/dom/KeyframeList.d.ts +0 -2
  62. package/dist/dom/Node.d.ts +0 -106
  63. package/dist/dom/__tests__/animation.computed-timing.spec.d.ts +0 -1
  64. package/dist/dom/__tests__/animation.keyframe-effect.spec.d.ts +0 -1
  65. package/dist/dom/__tests__/animation.timeline.spec.d.ts +0 -1
  66. package/dist/dom/__tests__/document.spec.d.ts +0 -1
  67. package/dist/dom/__tests__/element.spec.d.ts +0 -1
  68. package/dist/dom/__tests__/event.spec.d.ts +0 -1
  69. package/dist/dom/__tests__/utils/easing.d.ts +0 -14
  70. package/dist/dom/__tests__/utils/keyframe.d.ts +0 -38
  71. package/dist/dom/index.d.ts +0 -17
  72. package/dist/dom/interfaces.d.ts +0 -327
  73. package/dist/global-module.d.ts +0 -1
  74. package/dist/index.d.ts +0 -15
  75. package/dist/index.esm.js +0 -13165
  76. package/dist/index.js +0 -13659
  77. package/dist/plugins/CullingPlugin.d.ts +0 -19
  78. package/dist/plugins/DirtyCheckPlugin.d.ts +0 -10
  79. package/dist/plugins/EventPlugin.d.ts +0 -26
  80. package/dist/plugins/FrustumCullingStrategy.d.ts +0 -21
  81. package/dist/plugins/PrepareRendererPlugin.d.ts +0 -6
  82. package/dist/property-handlers/__tests__/color.spec.d.ts +0 -1
  83. package/dist/property-handlers/__tests__/dimension.spec.d.ts +0 -1
  84. package/dist/property-handlers/__tests__/filter.spec.d.ts +0 -1
  85. package/dist/property-handlers/__tests__/transform.spec.d.ts +0 -1
  86. package/dist/property-handlers/aabb.d.ts +0 -2
  87. package/dist/property-handlers/anchor.d.ts +0 -3
  88. package/dist/property-handlers/clipPath.d.ts +0 -19
  89. package/dist/property-handlers/color.d.ts +0 -32
  90. package/dist/property-handlers/dimension.d.ts +0 -18
  91. package/dist/property-handlers/filter.d.ts +0 -9
  92. package/dist/property-handlers/index.d.ts +0 -17
  93. package/dist/property-handlers/interfaces.d.ts +0 -20
  94. package/dist/property-handlers/localPosition.d.ts +0 -2
  95. package/dist/property-handlers/numeric.d.ts +0 -5
  96. package/dist/property-handlers/offsetDistance.d.ts +0 -5
  97. package/dist/property-handlers/offsetPath.d.ts +0 -5
  98. package/dist/property-handlers/origin.d.ts +0 -11
  99. package/dist/property-handlers/path.d.ts +0 -5
  100. package/dist/property-handlers/points.d.ts +0 -6
  101. package/dist/property-handlers/transform.d.ts +0 -45
  102. package/dist/property-handlers/zIndex.d.ts +0 -2
  103. package/dist/services/ContextService.d.ts +0 -12
  104. package/dist/services/EventService.d.ts +0 -64
  105. package/dist/services/RenderingContext.d.ts +0 -28
  106. package/dist/services/RenderingService.d.ts +0 -51
  107. package/dist/services/SceneGraphSelector.d.ts +0 -20
  108. package/dist/services/SceneGraphService.d.ts +0 -146
  109. package/dist/services/aabb/CircleUpdater.d.ts +0 -10
  110. package/dist/services/aabb/EllipseUpdater.d.ts +0 -10
  111. package/dist/services/aabb/LineUpdater.d.ts +0 -10
  112. package/dist/services/aabb/PathUpdater.d.ts +0 -11
  113. package/dist/services/aabb/PolylineUpdater.d.ts +0 -10
  114. package/dist/services/aabb/RectUpdater.d.ts +0 -10
  115. package/dist/services/aabb/TextUpdater.d.ts +0 -13
  116. package/dist/services/aabb/index.d.ts +0 -8
  117. package/dist/services/aabb/interfaces.d.ts +0 -16
  118. package/dist/services/index.d.ts +0 -10
  119. package/dist/services/text/OffscreenCanvasCreator.d.ts +0 -6
  120. package/dist/services/text/index.d.ts +0 -35
  121. package/dist/shapes/AABB.d.ts +0 -33
  122. package/dist/shapes/BoundingSphere.d.ts +0 -8
  123. package/dist/shapes/Frustum.d.ts +0 -16
  124. package/dist/shapes/Plane.d.ts +0 -14
  125. package/dist/shapes/Point.d.ts +0 -11
  126. package/dist/shapes/Polygon.d.ts +0 -9
  127. package/dist/shapes/Ray.d.ts +0 -24
  128. package/dist/shapes/Rect.d.ts +0 -12
  129. package/dist/shapes/Rectangle.d.ts +0 -12
  130. package/dist/shapes/__tests__/aabb.spec.d.ts +0 -1
  131. package/dist/shapes/__tests__/boundingSphere.spec.d.ts +0 -1
  132. package/dist/shapes/__tests__/frustum.spec.d.ts +0 -1
  133. package/dist/shapes/__tests__/plane.spec.d.ts +0 -1
  134. package/dist/shapes/__tests__/ray.spec.d.ts +0 -1
  135. package/dist/shapes/index.d.ts +0 -8
  136. package/dist/types.d.ts +0 -219
  137. package/dist/utils/__tests__/event.spec.d.ts +0 -1
  138. package/dist/utils/__tests__/path.spec.d.ts +0 -1
  139. package/dist/utils/__tests__/raf.spec.d.ts +0 -1
  140. package/dist/utils/__tests__/text.spec.d.ts +0 -1
  141. package/dist/utils/animation.d.ts +0 -15
  142. package/dist/utils/bezier-easing.d.ts +0 -20
  143. package/dist/utils/canvas.d.ts +0 -5
  144. package/dist/utils/custom-easing.d.ts +0 -75
  145. package/dist/utils/event.d.ts +0 -11
  146. package/dist/utils/index.d.ts +0 -5
  147. package/dist/utils/interpolation.d.ts +0 -3
  148. package/dist/utils/math.d.ts +0 -22
  149. package/dist/utils/path.d.ts +0 -15
  150. package/dist/utils/raf.d.ts +0 -3
  151. package/dist/utils/text.d.ts +0 -2
@@ -1,65 +0,0 @@
1
- import { TextMetrics } from '../services/text';
2
- import type { DisplayObjectConfig } from '../dom/interfaces';
3
- import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
4
- import { DisplayObject } from './DisplayObject';
5
- export interface TextStyleProps extends BaseStyleProps {
6
- text: string;
7
- /** 设置文本内容的当前对齐方式 */
8
- textAlign?: 'start' | 'center' | 'end' | 'left' | 'right';
9
- /** 设置在绘制文本时使用的当前文本基线 */
10
- textBaseline?: 'top' | 'hanging' | 'middle' | 'alphabetic' | 'ideographic' | 'bottom';
11
- /** 字体样式 */
12
- fontStyle?: 'normal' | 'italic' | 'oblique';
13
- /** 文本字体大小 */
14
- fontSize?: number;
15
- /** 文本字体 */
16
- fontFamily?: string;
17
- /** 文本粗细 */
18
- fontWeight?: 'normal' | 'bold' | 'bolder' | 'lighter' | number;
19
- /** 字体变体 */
20
- fontVariant?: 'normal' | 'small-caps' | string;
21
- /** 文本行高 */
22
- lineHeight?: number;
23
- letterSpacing?: number;
24
- miterLimit?: number;
25
- padding?: number;
26
- whiteSpace?: 'pre';
27
- leading?: number;
28
- wordWrap?: boolean;
29
- wordWrapWidth?: number;
30
- dropShadow?: boolean;
31
- dropShadowDistance?: number;
32
- }
33
- export interface ParsedTextStyleProps extends ParsedBaseStyleProps {
34
- text: string;
35
- /** 设置文本内容的当前对齐方式 */
36
- textAlign?: 'start' | 'center' | 'end' | 'left' | 'right';
37
- /** 设置在绘制文本时使用的当前文本基线 */
38
- textBaseline?: 'top' | 'hanging' | 'middle' | 'alphabetic' | 'ideographic' | 'bottom';
39
- /** 字体样式 */
40
- fontStyle?: 'normal' | 'italic' | 'oblique';
41
- /** 文本字体大小 */
42
- fontSize?: number;
43
- /** 文本字体 */
44
- fontFamily?: string;
45
- /** 文本粗细 */
46
- fontWeight?: 'normal' | 'bold' | 'bolder' | 'lighter' | number;
47
- /** 字体变体 */
48
- fontVariant?: 'normal' | 'small-caps' | string;
49
- /** 文本行高 */
50
- lineHeight?: number;
51
- letterSpacing?: number;
52
- miterLimit?: number;
53
- padding?: number;
54
- whiteSpace?: 'pre';
55
- leading?: number;
56
- wordWrap?: boolean;
57
- wordWrapWidth?: number;
58
- dropShadow?: boolean;
59
- dropShadowDistance?: number;
60
- metrics?: TextMetrics;
61
- }
62
- export declare class Text extends DisplayObject<TextStyleProps, ParsedTextStyleProps> {
63
- constructor({ style, ...rest }: DisplayObjectConfig<TextStyleProps>);
64
- getLineBoundingRects(): import("..").Rectangle[];
65
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- import 'reflect-metadata';
@@ -1 +0,0 @@
1
- import 'reflect-metadata';
@@ -1 +0,0 @@
1
- import 'reflect-metadata';
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,13 +0,0 @@
1
- export * from './DisplayObject';
2
- export * from './CustomElement';
3
- export * from './Circle';
4
- export * from './Ellipse';
5
- export * from './Group';
6
- export * from './Image';
7
- export * from './Line';
8
- export * from './Path';
9
- export * from './Polygon';
10
- export * from './Polyline';
11
- export * from './Rect';
12
- export * from './Text';
13
- export * from './HTML';
@@ -1,132 +0,0 @@
1
- import type { KeyframeEffect } from './KeyframeEffect';
2
- import type { AnimationTimeline } from './AnimationTimeline';
3
- /**
4
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/Animation
5
- */
6
- export declare class Animation {
7
- /**
8
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/effect
9
- */
10
- effect: KeyframeEffect;
11
- /**
12
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/timeline
13
- */
14
- timeline: AnimationTimeline;
15
- /**
16
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/id
17
- */
18
- id: string;
19
- /**
20
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/pending
21
- */
22
- get pending(): boolean;
23
- private currentTimePending;
24
- /**
25
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/playState
26
- */
27
- private _idle;
28
- private _paused;
29
- private _finishedFlag;
30
- get playState(): AnimationPlayState;
31
- /**
32
- * record previos state
33
- */
34
- private oldPlayState;
35
- private _holdTime;
36
- private readyPromise;
37
- private finishedPromise;
38
- private resolveReadyPromise;
39
- private rejectReadyPromise;
40
- private resolveFinishedPromise;
41
- private rejectFinishedPromise;
42
- /**
43
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/ready
44
- * @example
45
- animation.pause();
46
- animation.ready.then(function() {
47
- // Displays 'running'
48
- alert(animation.playState);
49
- });
50
- animation.play();
51
- */
52
- get ready(): Promise<any>;
53
- /**
54
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/finished
55
- * @example
56
- Promise.all(
57
- elem.getAnimations().map(
58
- function(animation) {
59
- return animation.finished
60
- }
61
- )
62
- ).then(
63
- function() {
64
- return elem.remove();
65
- }
66
- );
67
- */
68
- get finished(): Promise<any>;
69
- /**
70
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/onfinish
71
- */
72
- onfinish: ((this: Animation, ev: AnimationPlaybackEvent) => any) | null;
73
- /**
74
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/oncancel
75
- */
76
- oncancel: ((this: Animation, ev: AnimationPlaybackEvent) => any) | null;
77
- /**
78
- * get called after each frame when running
79
- */
80
- onframe: ((this: Animation, ev: AnimationPlaybackEvent) => any) | null;
81
- /**
82
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/currentTime
83
- */
84
- get currentTime(): number | null;
85
- private _currentTime;
86
- set currentTime(newTime: number | null);
87
- /**
88
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/startTime
89
- */
90
- private _startTime;
91
- get startTime(): number | null;
92
- set startTime(newTime: number | null);
93
- private _playbackRate;
94
- get playbackRate(): number;
95
- set playbackRate(value: number);
96
- get _isFinished(): boolean;
97
- get totalDuration(): number;
98
- _inEffect: boolean;
99
- _inTimeline: boolean;
100
- get _needsTick(): boolean;
101
- constructor(effect: KeyframeEffect, timeline: AnimationTimeline);
102
- /**
103
- * state machine,
104
- * resolve/reject ready/finished Promise according to current state
105
- */
106
- updatePromises(): Promise<any>;
107
- play(): void;
108
- pause(): void;
109
- finish(): void;
110
- cancel(): void;
111
- reverse(): void;
112
- /**
113
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/updatePlaybackRate
114
- */
115
- updatePlaybackRate(playbackRate: number): void;
116
- targetAnimations(): Animation[];
117
- markTarget(): void;
118
- unmarkTarget(): void;
119
- tick(timelineTime: number, isAnimationFrame: boolean): void;
120
- private rewind;
121
- persist(): void;
122
- addEventListener<K extends keyof AnimationEventMap>(type: K, listener: (this: Animation, ev: AnimationEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
123
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
124
- removeEventListener<K extends keyof AnimationEventMap>(type: K, listener: (this: Animation, ev: AnimationEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
125
- removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
126
- dispatchEvent(event: Event): boolean;
127
- onremove: ((this: Animation, ev: Event) => any) | null;
128
- commitStyles(): void;
129
- private ensureAlive;
130
- private tickCurrentTime;
131
- private fireEvents;
132
- }
@@ -1,59 +0,0 @@
1
- import type { KeyframeEffect } from './KeyframeEffect';
2
- /**
3
- * @see https://developer.mozilla.org/en-US/docs/Web/API/EffectTiming
4
- */
5
- export declare class AnimationEffectTiming implements EffectTiming {
6
- /**
7
- * @see https://developer.mozilla.org/en-US/docs/Web/API/EffectTiming/delay
8
- */
9
- delay: number;
10
- /**
11
- * @see https://developer.mozilla.org/en-US/docs/Web/API/EffectTiming/direction
12
- */
13
- direction: PlaybackDirection;
14
- /**
15
- * @see https://developer.mozilla.org/en-US/docs/Web/API/EffectTiming/duration
16
- */
17
- duration: number | 'auto';
18
- /**
19
- * @see https://developer.mozilla.org/en-US/docs/Web/API/EffectTiming/easing
20
- */
21
- private _easing;
22
- easingFunction: (x: number) => number;
23
- get easing(): string;
24
- set easing(value: string);
25
- /**
26
- * @see https://developer.mozilla.org/en-US/docs/Web/API/EffectTiming/endDelay
27
- */
28
- endDelay: number;
29
- /**
30
- * @see https://developer.mozilla.org/en-US/docs/Web/API/EffectTiming/fill
31
- */
32
- fill: FillMode;
33
- /**
34
- * @see https://developer.mozilla.org/en-US/docs/Web/API/EffectTiming/iterationStart
35
- */
36
- iterationStart: number;
37
- /**
38
- * @see https://developer.mozilla.org/en-US/docs/Web/API/EffectTiming/iterations
39
- */
40
- iterations: number;
41
- /**
42
- * @deprecated
43
- */
44
- playbackRate: number;
45
- /**
46
- * ref to effect
47
- */
48
- effect: KeyframeEffect;
49
- composite: string;
50
- /**
51
- * ComputedEffectTiming
52
- * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEffect/getComputedTiming
53
- */
54
- activeDuration: number;
55
- endTime: number;
56
- currentIteration: number | null;
57
- progress: number | null;
58
- constructor();
59
- }
@@ -1,11 +0,0 @@
1
- import { FederatedEvent } from './FederatedEvent';
2
- import type { EventService } from '../services';
3
- import type { Animation } from './Animation';
4
- /**
5
- * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationPlaybackEvent
6
- */
7
- export declare class AnimationEvent extends FederatedEvent implements AnimationPlaybackEvent {
8
- currentTime: number | null;
9
- timelineTime: number;
10
- constructor(manager: EventService | null, target: Animation, currentTime: number | null, timelineTime: number);
11
- }
@@ -1,37 +0,0 @@
1
- import { Animation } from './Animation';
2
- import type { KeyframeEffect } from './KeyframeEffect';
3
- export declare function compareAnimations(leftAnimation: Animation, rightAnimation: Animation): number;
4
- /**
5
- * @see https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/web-animations-js/index.d.ts
6
- */
7
- export declare class AnimationTimeline implements AnimationTimeline {
8
- /**
9
- * all active animations
10
- */
11
- animations: Animation[];
12
- private ticking;
13
- private timelineTicking;
14
- private hasRestartedThisFrame;
15
- animationsWithPromises: Animation[];
16
- private inTick;
17
- private pendingEffects;
18
- currentTime: number | null;
19
- private rafId;
20
- private rafCallbacks;
21
- private frameId;
22
- getAnimations(): Animation[];
23
- isTicking(): boolean;
24
- play(effect: KeyframeEffect): Animation;
25
- applyDirtiedAnimation(animation: Animation): void;
26
- restart(): boolean;
27
- destroy(): void;
28
- applyPendingEffects(): void;
29
- private updateAnimationsPromises;
30
- private discardAnimations;
31
- private restartWebAnimationsNextTick;
32
- private webAnimationsNextTick;
33
- private processRafCallbacks;
34
- private rAF;
35
- private requestAnimationFrame;
36
- tick(t: number, isAnimationFrame: boolean, updatingAnimations: Animation[]): Animation[][];
37
- }
@@ -1,15 +0,0 @@
1
- import { DisplayObject } from '../display-objects';
2
- /**
3
- * canvas.customElements
4
- *
5
- * @see https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry
6
- */
7
- export declare class CustomElementRegistry {
8
- private registry;
9
- constructor();
10
- define<T extends DisplayObject>(name: string, constructor: new (...args: any[]) => T): void;
11
- /**
12
- * @see https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/get
13
- */
14
- get<T extends DisplayObject>(name: string): new (...args: any[]) => T;
15
- }
@@ -1,16 +0,0 @@
1
- import { FederatedEvent } from './FederatedEvent';
2
- /**
3
- * @see https://developer.mozilla.org/en-US/docs/Web/Events/Creating_and_triggering_events
4
- *
5
- * @example
6
- const event = new CustomEvent('build', { detail: { prop1: 'xx' } });
7
- circle.addEventListener('build', (e) => {
8
- e.target; // circle
9
- e.detail; // { prop1: 'xx' }
10
- });
11
-
12
- circle.dispatchEvent(event);
13
- */
14
- export declare class CustomEvent extends FederatedEvent {
15
- constructor(eventName: string, object?: object);
16
- }
@@ -1,59 +0,0 @@
1
- import { Node } from './Node';
2
- import { AnimationTimeline } from './AnimationTimeline';
3
- import { Group } from '../display-objects/Group';
4
- import { DisplayObject } from '../display-objects/DisplayObject';
5
- import type { IDocument, IElement, INode, ICanvas, DisplayObjectConfig } from './interfaces';
6
- import { BaseStyleProps } from '../types';
7
- /**
8
- * the entry of DOM tree
9
- * Document -> Node -> EventTarget
10
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Document
11
- */
12
- export declare class Document extends Node implements IDocument {
13
- constructor();
14
- get children(): IElement[];
15
- get childElementCount(): number;
16
- get firstElementChild(): IElement | null;
17
- get lastElementChild(): IElement | null;
18
- /**
19
- * only document has defaultView, points to canvas,
20
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/defaultView
21
- */
22
- defaultView: ICanvas | null;
23
- /**
24
- * the root element of document, eg. <html>
25
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/documentElement
26
- */
27
- readonly documentElement: Group;
28
- /**
29
- * document.timeline in WAAPI
30
- */
31
- readonly timeline: AnimationTimeline;
32
- readonly ownerDocument: any;
33
- /**
34
- * @example const circle = document.createElement('circle', { style: { r: 10 } });
35
- */
36
- createElement<T extends DisplayObject<StyleProps>, StyleProps extends BaseStyleProps>(tagName: string, options: DisplayObjectConfig<StyleProps>): T;
37
- cloneNode(deep?: boolean): INode;
38
- destroy(): void;
39
- /**
40
- * eg. Uncaught DOMException: Failed to execute 'appendChild' on 'Node': Only one element on document allowed.
41
- */
42
- appendChild<T extends INode>(newChild: T, index?: number): T;
43
- insertBefore<T extends INode>(newChild: T, refChild: INode | null): T;
44
- removeChild<T extends INode>(oldChild: T, destroy?: boolean): T;
45
- replaceChild<T extends INode>(newChild: INode, oldChild: T, destroy?: boolean): T;
46
- append(...nodes: INode[]): void;
47
- prepend(...nodes: INode[]): void;
48
- /**
49
- * Execute query on documentElement.
50
- */
51
- getElementById<E extends IElement = IElement>(id: string): E | null;
52
- getElementsByName<E extends IElement = IElement>(name: string): E[];
53
- getElementsByTagName<E extends IElement = IElement>(tagName: string): E[];
54
- getElementsByClassName<E extends IElement = IElement>(className: string): E[];
55
- querySelector<E extends IElement = IElement>(selectors: string): E | null;
56
- querySelectorAll<E extends IElement = IElement>(selectors: string): E[];
57
- find<E extends IElement = IElement>(filter: (node: E) => boolean): E | null;
58
- findAll<E extends IElement = IElement>(filter: (node: E) => boolean): E[];
59
- }
@@ -1,143 +0,0 @@
1
- import { SceneGraphService } from '../services/SceneGraphService';
2
- import { BaseStyleProps, ParsedBaseStyleProps } from '../types';
3
- import { Node } from './Node';
4
- import { AABB, Rectangle } from '../shapes';
5
- import type { DisplayObjectConfig, IEventTarget, IChildNode, IElement, INode } from './interfaces';
6
- /**
7
- * Has following capabilities:
8
- * * Node insert/remove, eg. appendChild, removeChild, remove...
9
- * * Query eg. querySelector getElementById...
10
- * * Animation
11
- */
12
- export declare class Element<StyleProps extends BaseStyleProps = any, ParsedStyleProps extends ParsedBaseStyleProps = any> extends Node implements IElement<StyleProps, ParsedStyleProps> {
13
- static isElement(target: IEventTarget | INode | IElement): target is IElement;
14
- sceneGraphService: SceneGraphService;
15
- constructor(config: DisplayObjectConfig<StyleProps>);
16
- /**
17
- * used with `getElementById()`
18
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/id
19
- */
20
- id: string;
21
- /**
22
- * used in `getElementsByClassName`
23
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByClassName
24
- */
25
- className: string;
26
- /**
27
- * used in `getElementsByName`
28
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByName
29
- */
30
- name: string;
31
- /**
32
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/classList
33
- */
34
- get classList(): string[];
35
- interactive: boolean;
36
- scrollLeft: number;
37
- scrollTop: number;
38
- get tagName(): string;
39
- get children(): IElement[];
40
- get childElementCount(): number;
41
- get firstElementChild(): IElement | null;
42
- get lastElementChild(): IElement | null;
43
- get parentElement(): IElement | null;
44
- get nextSibling(): IElement | null;
45
- get previousSibling(): IElement | null;
46
- cloneNode(deep?: boolean): this;
47
- appendChild<T extends INode>(child: T, index?: number): T;
48
- insertBefore<T extends INode>(newChild: T, refChild: IElement | null): T;
49
- replaceChild<T extends INode & IChildNode>(newChild: INode, oldChild: T, destroy?: boolean): T;
50
- removeChild<T extends INode>(child: T, destroy?: boolean): T;
51
- removeChildren(destroy?: boolean): void;
52
- /**
53
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
54
- */
55
- matches(selector: string): boolean;
56
- getElementById<E extends IElement = IElement>(id: string): E | null;
57
- getElementsByName<E extends IElement = IElement>(name: string): E[];
58
- getElementsByClassName<E extends IElement = IElement>(className: string): E[];
59
- getElementsByTagName<E extends IElement = IElement>(tagName: string): E[];
60
- querySelector<E extends IElement = IElement>(selectors: string): E | null;
61
- querySelectorAll<E extends IElement = IElement>(selectors: string): E[];
62
- /**
63
- * search in scene group, but should not include itself
64
- */
65
- find<E extends IElement = IElement>(filter: (node: E) => boolean): E | null;
66
- findAll<E extends IElement = IElement>(filter: (node: E) => boolean): E[];
67
- /**
68
- * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/after
69
- */
70
- after(...nodes: IElement[]): void;
71
- /**
72
- * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/before
73
- */
74
- before(...nodes: IElement[]): void;
75
- /**
76
- * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/replaceWith
77
- */
78
- replaceWith(...nodes: IElement[]): void;
79
- /**
80
- * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/append
81
- */
82
- append(...nodes: IElement[]): void;
83
- /**
84
- * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/prepend
85
- */
86
- prepend(...nodes: IElement[]): void;
87
- /**
88
- * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/replaceChildren
89
- */
90
- replaceChildren(...nodes: IElement[]): void;
91
- /**
92
- * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/remove
93
- */
94
- remove(destroy?: boolean): this;
95
- /**
96
- * is destroyed or not
97
- */
98
- destroyed: boolean;
99
- destroy(): void;
100
- getGeometryBounds(): AABB | null;
101
- getRenderBounds(): AABB | null;
102
- /**
103
- * get bounds in world space, account for children
104
- */
105
- getBounds(): AABB | null;
106
- /**
107
- * get bounds in local space, account for children
108
- */
109
- getLocalBounds(): AABB | null;
110
- /**
111
- * account for context's bounds in client space,
112
- * but not accounting for children
113
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect
114
- */
115
- getBoundingClientRect(): Rectangle;
116
- /**
117
- * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/getClientRects
118
- */
119
- getClientRects(): Rectangle[];
120
- /**
121
- * compatible with `style`
122
- * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style
123
- */
124
- style: StyleProps;
125
- parsedStyle: ParsedStyleProps;
126
- /**
127
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/attributes
128
- */
129
- attributes: StyleProps;
130
- /**
131
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute
132
- */
133
- getAttribute(attributeName: keyof StyleProps): StyleProps[keyof StyleProps];
134
- /**
135
- * should use removeAttribute() instead of setting the attribute value to null either directly or using setAttribute(). Many attributes will not behave as expected if you set them to null.
136
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute
137
- */
138
- removeAttribute(attributeName: keyof StyleProps): void;
139
- /**
140
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute
141
- */
142
- setAttribute<Key extends keyof StyleProps>(attributeName: Key, value: StyleProps[Key], force?: boolean): void;
143
- }
@@ -1,47 +0,0 @@
1
- import { Entity } from '@antv/g-ecs';
2
- import { FederatedEvent } from './FederatedEvent';
3
- import type { IEventTarget } from './interfaces';
4
- export declare const DELEGATION_SPLITTER = ":";
5
- /**
6
- * Objects that can receive events and may have listeners for them.
7
- * eg. Element, Canvas, DisplayObject
8
- * @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget
9
- */
10
- export declare class EventTarget implements IEventTarget {
11
- /**
12
- * event emitter
13
- */
14
- emitter: import("eventemitter3")<string | symbol, any>;
15
- entity: Entity;
16
- constructor();
17
- /**
18
- * @deprecated
19
- */
20
- getEntity(): Entity;
21
- /**
22
- * @deprecated
23
- * @alias addEventListener
24
- */
25
- on(type: string, listener: EventListenerOrEventListenerObject | ((...args: any[]) => void), options?: boolean | AddEventListenerOptions): this;
26
- /**
27
- * support `capture` & `once` in options
28
- * @see https://developer.mozilla.org/zh-CN/docs/Web/API/EventTarget/addEventListener
29
- */
30
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): this;
31
- /**
32
- * @deprecated
33
- * @alias removeEventListener
34
- */
35
- off(type: string, listener: EventListenerOrEventListenerObject | ((...args: any[]) => void), options?: boolean | AddEventListenerOptions): this;
36
- removeAllEventListeners(): void;
37
- removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): this;
38
- /**
39
- * @deprecated
40
- * @alias dispatchEvent
41
- */
42
- emit(eventName: string, object: object): void;
43
- /**
44
- * @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/dispatchEvent
45
- */
46
- dispatchEvent<T extends FederatedEvent>(e: T): boolean;
47
- }