@antv/g 1.0.0-alpha.20 → 1.0.0-alpha.24
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.
- package/es/Canvas.d.ts +40 -18
- package/es/Canvas.js +121 -65
- package/es/DisplayObjectPool.d.ts +2 -1
- package/es/DisplayObjectPool.js +4 -0
- package/{lib → es/camera}/Camera.d.ts +6 -3
- package/es/{Camera.js → camera/Camera.js} +22 -16
- package/es/{Landmark.d.ts → camera/Landmark.d.ts} +2 -2
- package/es/{Landmark.js → camera/Landmark.js} +1 -1
- package/es/camera/index.d.ts +2 -0
- package/es/camera/index.js +2 -0
- package/es/components/Cullable.js +1 -1
- package/es/components/Geometry.d.ts +8 -1
- package/es/components/Renderable.d.ts +9 -8
- package/es/components/Renderable.js +2 -6
- package/es/components/Sortable.d.ts +6 -2
- package/es/display-objects/Circle.d.ts +2 -3
- package/es/display-objects/Circle.js +2 -5
- package/es/{CustomElement.d.ts → display-objects/CustomElement.d.ts} +1 -1
- package/es/{CustomElement.js → display-objects/CustomElement.js} +22 -12
- package/{lib → es/display-objects}/DisplayObject.d.ts +136 -141
- package/es/{DisplayObject.js → display-objects/DisplayObject.js} +408 -292
- package/es/display-objects/Ellipse.d.ts +2 -3
- package/es/display-objects/Ellipse.js +2 -5
- package/es/display-objects/Group.d.ts +2 -1
- package/es/display-objects/Group.js +13 -5
- package/es/display-objects/HTML.d.ts +2 -2
- package/es/display-objects/HTML.js +4 -7
- package/es/display-objects/Image.d.ts +2 -2
- package/es/display-objects/Image.js +2 -6
- package/es/display-objects/Line.d.ts +2 -2
- package/es/display-objects/Line.js +8 -8
- package/es/display-objects/Path.d.ts +3 -2
- package/es/display-objects/Path.js +8 -8
- package/es/display-objects/Polygon.d.ts +2 -2
- package/es/display-objects/Polygon.js +2 -6
- package/es/display-objects/Polyline.d.ts +2 -2
- package/es/display-objects/Polyline.js +8 -8
- package/es/display-objects/Rect.d.ts +2 -2
- package/es/display-objects/Rect.js +2 -6
- package/es/display-objects/Text.d.ts +2 -3
- package/es/display-objects/Text.js +8 -7
- package/es/display-objects/index.d.ts +2 -0
- package/es/display-objects/index.js +2 -0
- package/es/{Animation.d.ts → dom/Animation.d.ts} +3 -3
- package/es/{Animation.js → dom/Animation.js} +2 -3
- package/{lib → es/dom}/AnimationEffectTiming.d.ts +2 -0
- package/es/{AnimationEffectTiming.js → dom/AnimationEffectTiming.js} +3 -2
- package/es/{AnimationEvent.d.ts → dom/AnimationEvent.d.ts} +3 -2
- package/es/{AnimationEvent.js → dom/AnimationEvent.js} +1 -1
- package/es/{Timeline.d.ts → dom/AnimationTimeline.d.ts} +1 -1
- package/es/{Timeline.js → dom/AnimationTimeline.js} +1 -1
- package/es/dom/CustomElementRegistry.d.ts +15 -0
- package/es/dom/CustomElementRegistry.js +40 -0
- package/{lib → es/dom}/CustomEvent.d.ts +1 -1
- package/es/{CustomEvent.js → dom/CustomEvent.js} +1 -1
- package/es/dom/Document.d.ts +36 -17
- package/es/dom/Document.js +98 -14
- package/es/dom/Element.d.ts +71 -92
- package/es/dom/Element.js +179 -195
- package/es/dom/EventTarget.d.ts +11 -6
- package/es/dom/EventTarget.js +12 -4
- package/es/dom/FederatedEvent.d.ts +15 -7
- package/es/dom/FederatedEvent.js +33 -0
- package/es/dom/FederatedMouseEvent.d.ts +1 -1
- package/es/{KeyframeEffect.d.ts → dom/KeyframeEffect.d.ts} +16 -5
- package/es/{KeyframeEffect.js → dom/KeyframeEffect.js} +50 -4
- package/es/{KeyframeList.d.ts → dom/KeyframeList.d.ts} +1 -1
- package/es/{KeyframeList.js → dom/KeyframeList.js} +0 -0
- package/es/dom/Node.d.ts +38 -23
- package/es/dom/Node.js +37 -33
- package/es/dom/index.d.ts +15 -2
- package/es/dom/index.js +16 -3
- package/es/dom/interfaces.d.ts +301 -0
- package/es/dom/interfaces.js +1 -0
- package/es/global-module.d.ts +0 -2
- package/es/global-module.js +31 -29
- package/es/index.d.ts +7 -14
- package/es/index.js +8 -15
- package/es/plugins/CullingPlugin.d.ts +2 -2
- package/es/plugins/CullingPlugin.js +13 -16
- package/es/plugins/DirtyCheckPlugin.d.ts +1 -1
- package/es/plugins/DirtyCheckPlugin.js +8 -7
- package/es/plugins/EventPlugin.js +52 -31
- package/es/plugins/FrustumCullingStrategy.d.ts +1 -1
- package/es/plugins/FrustumCullingStrategy.js +5 -4
- package/es/plugins/PrepareRendererPlugin.d.ts +0 -1
- package/es/plugins/PrepareRendererPlugin.js +42 -38
- package/es/property-handlers/aabb.d.ts +2 -3
- package/es/property-handlers/aabb.js +29 -21
- package/es/property-handlers/anchor.d.ts +3 -0
- package/es/property-handlers/anchor.js +21 -0
- package/es/property-handlers/clipPath.d.ts +1 -1
- package/es/property-handlers/clipPath.js +3 -4
- package/es/property-handlers/color.d.ts +1 -1
- package/es/property-handlers/dimension.d.ts +1 -1
- package/es/property-handlers/dimension.js +6 -9
- package/es/property-handlers/filter.d.ts +1 -1
- package/es/property-handlers/index.d.ts +5 -4
- package/es/property-handlers/index.js +1 -0
- package/es/property-handlers/localPosition.d.ts +1 -1
- package/es/property-handlers/localPosition.js +1 -6
- package/es/property-handlers/offsetDistance.d.ts +1 -1
- package/es/property-handlers/offsetPath.d.ts +1 -1
- package/es/property-handlers/origin.d.ts +1 -1
- package/es/property-handlers/origin.js +9 -2
- package/es/property-handlers/path.d.ts +2 -2
- package/es/property-handlers/path.js +8 -4
- package/es/property-handlers/points.d.ts +1 -1
- package/es/property-handlers/transform.d.ts +1 -1
- package/es/property-handlers/zIndex.d.ts +1 -1
- package/es/services/ContextService.d.ts +3 -2
- package/es/services/EventService.d.ts +18 -13
- package/es/services/EventService.js +604 -384
- package/es/services/RenderingContext.d.ts +1 -1
- package/es/services/RenderingService.d.ts +23 -29
- package/es/services/RenderingService.js +63 -54
- package/es/services/SceneGraphSelector.d.ts +7 -7
- package/es/services/SceneGraphSelector.js +10 -6
- package/es/services/SceneGraphService.d.ts +73 -78
- package/es/services/SceneGraphService.js +165 -78
- package/es/services/aabb/PathUpdater.d.ts +1 -1
- package/es/services/aabb/RectUpdater.d.ts +2 -2
- package/es/services/aabb/interfaces.d.ts +1 -1
- package/es/shapes/Point.d.ts +4 -0
- package/es/shapes/Polygon.d.ts +9 -0
- package/es/shapes/Polygon.js +62 -0
- package/es/shapes/index.d.ts +1 -0
- package/es/shapes/index.js +2 -1
- package/es/types.d.ts +18 -6
- package/es/utils/animation.d.ts +1 -2
- package/es/utils/animation.js +5 -10
- package/es/utils/canvas.d.ts +1 -1
- package/es/utils/custom-easing.d.ts +3 -2
- package/es/utils/custom-easing.js +12 -6
- package/es/utils/event.js +1 -1
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +2 -1
- package/es/utils/interpolation.d.ts +3 -4
- package/es/utils/interpolation.js +0 -16
- package/es/utils/path.d.ts +2 -2
- package/lib/Canvas.d.ts +40 -18
- package/lib/Canvas.js +131 -74
- package/lib/DisplayObjectPool.d.ts +2 -1
- package/lib/DisplayObjectPool.js +4 -0
- package/{es → lib/camera}/Camera.d.ts +6 -3
- package/lib/{Camera.js → camera/Camera.js} +25 -20
- package/lib/{Landmark.d.ts → camera/Landmark.d.ts} +2 -2
- package/lib/{Landmark.js → camera/Landmark.js} +2 -3
- package/lib/camera/index.d.ts +2 -0
- package/lib/camera/index.js +31 -0
- package/lib/components/Cullable.js +1 -1
- package/lib/components/Geometry.d.ts +8 -1
- package/lib/components/Renderable.d.ts +9 -8
- package/lib/components/Renderable.js +2 -6
- package/lib/components/Sortable.d.ts +6 -2
- package/lib/display-objects/Circle.d.ts +2 -3
- package/lib/display-objects/Circle.js +3 -6
- package/lib/{CustomElement.d.ts → display-objects/CustomElement.d.ts} +1 -1
- package/lib/{CustomElement.js → display-objects/CustomElement.js} +22 -12
- package/{es → lib/display-objects}/DisplayObject.d.ts +136 -141
- package/lib/{DisplayObject.js → display-objects/DisplayObject.js} +418 -299
- package/lib/display-objects/Ellipse.d.ts +2 -3
- package/lib/display-objects/Ellipse.js +3 -6
- package/lib/display-objects/Group.d.ts +2 -1
- package/lib/display-objects/Group.js +12 -4
- package/lib/display-objects/HTML.d.ts +2 -2
- package/lib/display-objects/HTML.js +4 -7
- package/lib/display-objects/Image.d.ts +2 -2
- package/lib/display-objects/Image.js +2 -6
- package/lib/display-objects/Line.d.ts +2 -2
- package/lib/display-objects/Line.js +8 -8
- package/lib/display-objects/Path.d.ts +3 -2
- package/lib/display-objects/Path.js +8 -8
- package/lib/display-objects/Polygon.d.ts +2 -2
- package/lib/display-objects/Polygon.js +2 -6
- package/lib/display-objects/Polyline.d.ts +2 -2
- package/lib/display-objects/Polyline.js +8 -8
- package/lib/display-objects/Rect.d.ts +2 -2
- package/lib/display-objects/Rect.js +2 -6
- package/lib/display-objects/Text.d.ts +2 -3
- package/lib/display-objects/Text.js +9 -8
- package/lib/display-objects/index.d.ts +2 -0
- package/lib/display-objects/index.js +26 -0
- package/lib/{Animation.d.ts → dom/Animation.d.ts} +3 -3
- package/lib/{Animation.js → dom/Animation.js} +2 -3
- package/{es → lib/dom}/AnimationEffectTiming.d.ts +2 -0
- package/lib/{AnimationEffectTiming.js → dom/AnimationEffectTiming.js} +3 -3
- package/lib/{AnimationEvent.d.ts → dom/AnimationEvent.d.ts} +3 -2
- package/lib/{AnimationEvent.js → dom/AnimationEvent.js} +1 -1
- package/lib/{Timeline.d.ts → dom/AnimationTimeline.d.ts} +1 -1
- package/lib/{Timeline.js → dom/AnimationTimeline.js} +1 -1
- package/lib/dom/CustomElementRegistry.d.ts +15 -0
- package/lib/dom/CustomElementRegistry.js +48 -0
- package/{es → lib/dom}/CustomEvent.d.ts +1 -1
- package/lib/{CustomEvent.js → dom/CustomEvent.js} +1 -1
- package/lib/dom/Document.d.ts +36 -17
- package/lib/dom/Document.js +99 -15
- package/lib/dom/Element.d.ts +71 -92
- package/lib/dom/Element.js +180 -198
- package/lib/dom/EventTarget.d.ts +11 -6
- package/lib/dom/EventTarget.js +20 -10
- package/lib/dom/FederatedEvent.d.ts +15 -7
- package/lib/dom/FederatedEvent.js +33 -0
- package/lib/dom/FederatedMouseEvent.d.ts +1 -1
- package/lib/{KeyframeEffect.d.ts → dom/KeyframeEffect.d.ts} +16 -5
- package/lib/{KeyframeEffect.js → dom/KeyframeEffect.js} +50 -4
- package/lib/{KeyframeList.d.ts → dom/KeyframeList.d.ts} +1 -1
- package/lib/{KeyframeList.js → dom/KeyframeList.js} +0 -0
- package/lib/dom/Node.d.ts +38 -23
- package/lib/dom/Node.js +37 -33
- package/lib/dom/index.d.ts +15 -2
- package/lib/dom/index.js +177 -8
- package/lib/dom/interfaces.d.ts +301 -0
- package/lib/dom/interfaces.js +5 -0
- package/lib/global-module.d.ts +0 -2
- package/lib/global-module.js +30 -30
- package/lib/index.d.ts +7 -14
- package/lib/index.js +44 -135
- package/lib/plugins/CullingPlugin.d.ts +2 -2
- package/lib/plugins/CullingPlugin.js +14 -16
- package/lib/plugins/DirtyCheckPlugin.d.ts +1 -1
- package/lib/plugins/DirtyCheckPlugin.js +9 -7
- package/lib/plugins/EventPlugin.js +52 -30
- package/lib/plugins/FrustumCullingStrategy.d.ts +1 -1
- package/lib/plugins/FrustumCullingStrategy.js +5 -4
- package/lib/plugins/PrepareRendererPlugin.d.ts +0 -1
- package/lib/plugins/PrepareRendererPlugin.js +41 -37
- package/lib/property-handlers/aabb.d.ts +2 -3
- package/lib/property-handlers/aabb.js +28 -22
- package/lib/property-handlers/anchor.d.ts +3 -0
- package/lib/property-handlers/anchor.js +34 -0
- package/lib/property-handlers/clipPath.d.ts +1 -1
- package/lib/property-handlers/clipPath.js +3 -4
- package/lib/property-handlers/color.d.ts +1 -1
- package/lib/property-handlers/dimension.d.ts +1 -1
- package/lib/property-handlers/dimension.js +6 -9
- package/lib/property-handlers/filter.d.ts +1 -1
- package/lib/property-handlers/index.d.ts +5 -4
- package/lib/property-handlers/index.js +14 -0
- package/lib/property-handlers/localPosition.d.ts +1 -1
- package/lib/property-handlers/localPosition.js +1 -7
- package/lib/property-handlers/offsetDistance.d.ts +1 -1
- package/lib/property-handlers/offsetPath.d.ts +1 -1
- package/lib/property-handlers/origin.d.ts +1 -1
- package/lib/property-handlers/origin.js +10 -2
- package/lib/property-handlers/path.d.ts +2 -2
- package/lib/property-handlers/path.js +8 -4
- package/lib/property-handlers/points.d.ts +1 -1
- package/lib/property-handlers/transform.d.ts +1 -1
- package/lib/property-handlers/zIndex.d.ts +1 -1
- package/lib/services/ContextService.d.ts +3 -2
- package/lib/services/EventService.d.ts +18 -13
- package/lib/services/EventService.js +616 -385
- package/lib/services/RenderingContext.d.ts +1 -1
- package/lib/services/RenderingService.d.ts +23 -29
- package/lib/services/RenderingService.js +66 -56
- package/lib/services/SceneGraphSelector.d.ts +7 -7
- package/lib/services/SceneGraphSelector.js +10 -6
- package/lib/services/SceneGraphService.d.ts +73 -78
- package/lib/services/SceneGraphService.js +166 -79
- package/lib/services/aabb/PathUpdater.d.ts +1 -1
- package/lib/services/aabb/RectUpdater.d.ts +2 -2
- package/lib/services/aabb/interfaces.d.ts +1 -1
- package/lib/shapes/Point.d.ts +4 -0
- package/lib/shapes/Polygon.d.ts +9 -0
- package/lib/shapes/Polygon.js +69 -0
- package/lib/shapes/index.d.ts +1 -0
- package/lib/shapes/index.js +13 -0
- package/lib/types.d.ts +18 -6
- package/lib/utils/animation.d.ts +1 -2
- package/lib/utils/animation.js +8 -16
- package/lib/utils/canvas.d.ts +1 -1
- package/lib/utils/custom-easing.d.ts +3 -2
- package/lib/utils/custom-easing.js +16 -8
- package/lib/utils/event.js +1 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +13 -0
- package/lib/utils/interpolation.d.ts +3 -4
- package/lib/utils/interpolation.js +0 -17
- package/lib/utils/path.d.ts +2 -2
- package/package.json +6 -6
- package/es/Batch.d.ts +0 -25
- package/es/Batch.js +0 -82
- package/es/shapes-type.d.ts +0 -175
- package/es/shapes-type.js +0 -18
- package/es/utils/matrix-decompose.d.ts +0 -3
- package/es/utils/matrix-decompose.js +0 -404
- package/lib/Batch.d.ts +0 -25
- package/lib/Batch.js +0 -91
- package/lib/shapes-type.d.ts +0 -175
- package/lib/shapes-type.js +0 -41
- package/lib/utils/matrix-decompose.d.ts +0 -3
- package/lib/utils/matrix-decompose.js +0 -414
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Point } from '../shapes/Point';
|
|
2
2
|
import type { EventService } from '../services';
|
|
3
|
-
import {
|
|
3
|
+
import { 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}.
|
|
@@ -28,7 +28,7 @@ export declare class FederatedEvent<N extends Event = Event, T = any> {
|
|
|
28
28
|
* can be used to implement event delegation
|
|
29
29
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Event/target
|
|
30
30
|
*/
|
|
31
|
-
target:
|
|
31
|
+
target: IEventTarget | null;
|
|
32
32
|
/**
|
|
33
33
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Event/bubbles
|
|
34
34
|
*/
|
|
@@ -42,7 +42,7 @@ export declare class FederatedEvent<N extends Event = Event, T = any> {
|
|
|
42
42
|
*/
|
|
43
43
|
readonly cancelable = false;
|
|
44
44
|
/** the event target when listeners binded */
|
|
45
|
-
currentTarget:
|
|
45
|
+
currentTarget: IEventTarget | null;
|
|
46
46
|
/** Flags whether the default response of the user agent was prevent through this event. */
|
|
47
47
|
defaultPrevented: boolean;
|
|
48
48
|
/**
|
|
@@ -89,12 +89,20 @@ export declare class FederatedEvent<N extends Event = Event, T = any> {
|
|
|
89
89
|
canvas: Point;
|
|
90
90
|
get x(): number;
|
|
91
91
|
get y(): number;
|
|
92
|
+
get canvasX(): number;
|
|
93
|
+
get canvasY(): number;
|
|
94
|
+
/**
|
|
95
|
+
* relative to Viewport, account for Camera
|
|
96
|
+
*/
|
|
97
|
+
viewport: Point;
|
|
98
|
+
get viewportX(): number;
|
|
99
|
+
get viewportY(): number;
|
|
92
100
|
/**
|
|
93
101
|
* The event boundary which manages this event. Propagation can only occur
|
|
94
102
|
* within the boundary's jurisdiction.
|
|
95
103
|
*/
|
|
96
104
|
constructor(manager: EventService | null);
|
|
97
|
-
path:
|
|
105
|
+
path: IEventTarget[];
|
|
98
106
|
/**
|
|
99
107
|
* The propagation path for this event
|
|
100
108
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Event/composedPath
|
|
@@ -102,11 +110,11 @@ export declare class FederatedEvent<N extends Event = Event, T = any> {
|
|
|
102
110
|
* So composedPath()[0] represents the original target.
|
|
103
111
|
* @see https://polymer-library.polymer-project.org/3.0/docs/devguide/events#retargeting
|
|
104
112
|
*/
|
|
105
|
-
composedPath():
|
|
113
|
+
composedPath(): IEventTarget[];
|
|
106
114
|
/**
|
|
107
115
|
* @deprecated
|
|
108
116
|
*/
|
|
109
|
-
get propagationPath():
|
|
117
|
+
get propagationPath(): IEventTarget[];
|
|
110
118
|
/**
|
|
111
119
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Event/preventDefault
|
|
112
120
|
*/
|
|
@@ -128,7 +136,7 @@ export declare class FederatedEvent<N extends Event = Event, T = any> {
|
|
|
128
136
|
view: WindowProxy;
|
|
129
137
|
which: number;
|
|
130
138
|
returnValue: boolean;
|
|
131
|
-
srcElement:
|
|
139
|
+
srcElement: IEventTarget;
|
|
132
140
|
readonly composed = false;
|
|
133
141
|
isTrusted: boolean;
|
|
134
142
|
NONE: number;
|
|
@@ -65,6 +65,11 @@ var FederatedEvent = function () {
|
|
|
65
65
|
*/
|
|
66
66
|
|
|
67
67
|
this.canvas = new _Point.Point();
|
|
68
|
+
/**
|
|
69
|
+
* relative to Viewport, account for Camera
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
this.viewport = new _Point.Point();
|
|
68
73
|
this.composed = false;
|
|
69
74
|
this.NONE = 0;
|
|
70
75
|
this.CAPTURING_PHASE = 1;
|
|
@@ -135,6 +140,34 @@ var FederatedEvent = function () {
|
|
|
135
140
|
enumerable: false,
|
|
136
141
|
configurable: true
|
|
137
142
|
});
|
|
143
|
+
Object.defineProperty(FederatedEvent.prototype, "canvasX", {
|
|
144
|
+
get: function get() {
|
|
145
|
+
return this.canvas.x;
|
|
146
|
+
},
|
|
147
|
+
enumerable: false,
|
|
148
|
+
configurable: true
|
|
149
|
+
});
|
|
150
|
+
Object.defineProperty(FederatedEvent.prototype, "canvasY", {
|
|
151
|
+
get: function get() {
|
|
152
|
+
return this.canvas.y;
|
|
153
|
+
},
|
|
154
|
+
enumerable: false,
|
|
155
|
+
configurable: true
|
|
156
|
+
});
|
|
157
|
+
Object.defineProperty(FederatedEvent.prototype, "viewportX", {
|
|
158
|
+
get: function get() {
|
|
159
|
+
return this.viewport.x;
|
|
160
|
+
},
|
|
161
|
+
enumerable: false,
|
|
162
|
+
configurable: true
|
|
163
|
+
});
|
|
164
|
+
Object.defineProperty(FederatedEvent.prototype, "viewportY", {
|
|
165
|
+
get: function get() {
|
|
166
|
+
return this.viewport.y;
|
|
167
|
+
},
|
|
168
|
+
enumerable: false,
|
|
169
|
+
configurable: true
|
|
170
|
+
});
|
|
138
171
|
/**
|
|
139
172
|
* The propagation path for this event
|
|
140
173
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Event/composedPath
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DisplayObject } from '../DisplayObject';
|
|
1
|
+
import type { DisplayObject } from '../display-objects/DisplayObject';
|
|
2
2
|
import { FederatedEvent } from './FederatedEvent';
|
|
3
3
|
import { Point } from '../shapes/Point';
|
|
4
4
|
export declare class FederatedMouseEvent extends FederatedEvent<MouseEvent | PointerEvent | TouchEvent> implements MouseEvent {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { IElement } from '../dom/interfaces';
|
|
2
|
+
import type { AnimationEffectTiming } from './AnimationEffectTiming';
|
|
3
|
+
import type { Animation } from './Animation';
|
|
3
4
|
/**
|
|
4
5
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/KeyframeEffect
|
|
5
6
|
* @example
|
|
@@ -17,18 +18,28 @@ export declare class KeyframeEffect {
|
|
|
17
18
|
composite: CompositeOperation;
|
|
18
19
|
iterationComposite: IterationCompositeOperation;
|
|
19
20
|
pseudoElement: string | null;
|
|
20
|
-
target:
|
|
21
|
+
target: IElement | null;
|
|
21
22
|
animation: Animation | null;
|
|
22
|
-
|
|
23
|
+
timing: AnimationEffectTiming;
|
|
24
|
+
private computedTiming;
|
|
23
25
|
normalizedKeyframes: ComputedKeyframe[];
|
|
24
26
|
private timeFraction;
|
|
25
27
|
private interpolations;
|
|
26
|
-
constructor(target:
|
|
28
|
+
constructor(target: IElement | null, effectInput: Keyframe[] | PropertyIndexedKeyframes | null, timingInput?: KeyframeEffectOptions | number);
|
|
27
29
|
applyInterpolations(): void;
|
|
28
30
|
update(localTime: number | null): boolean;
|
|
29
31
|
getKeyframes(): ComputedKeyframe[];
|
|
30
32
|
setKeyframes(keyframes: Keyframe[] | PropertyIndexedKeyframes | null): void;
|
|
33
|
+
/**
|
|
34
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEffect/getComputedTiming
|
|
35
|
+
*/
|
|
31
36
|
getComputedTiming(): ComputedEffectTiming;
|
|
37
|
+
/**
|
|
38
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEffect/getTiming
|
|
39
|
+
*/
|
|
32
40
|
getTiming(): EffectTiming;
|
|
41
|
+
/**
|
|
42
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEffect/updateTiming
|
|
43
|
+
*/
|
|
33
44
|
updateTiming(timing?: OptionalEffectTiming): void;
|
|
34
45
|
}
|
|
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.KeyframeEffect = void 0;
|
|
7
7
|
|
|
8
|
-
var _animation = require("
|
|
8
|
+
var _animation = require("../utils/animation");
|
|
9
9
|
|
|
10
10
|
var _KeyframeList = require("./KeyframeList");
|
|
11
11
|
|
|
12
|
-
var _interpolation = require("
|
|
12
|
+
var _interpolation = require("../utils/interpolation");
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/KeyframeEffect
|
|
@@ -26,6 +26,8 @@ var _interpolation = require("./utils/interpolation");
|
|
|
26
26
|
*/
|
|
27
27
|
var KeyframeEffect = function () {
|
|
28
28
|
function KeyframeEffect(target, effectInput, timingInput) {
|
|
29
|
+
var _this = this;
|
|
30
|
+
|
|
29
31
|
this.composite = 'replace';
|
|
30
32
|
this.iterationComposite = 'replace';
|
|
31
33
|
this.target = target;
|
|
@@ -35,6 +37,34 @@ var KeyframeEffect = function () {
|
|
|
35
37
|
this.timing.endTime = Math.max(0, this.timing.delay + this.timing.activeDuration + this.timing.endDelay);
|
|
36
38
|
this.normalizedKeyframes = (0, _KeyframeList.normalizeKeyframes)(effectInput, this.timing);
|
|
37
39
|
this.interpolations = (0, _interpolation.convertEffectInput)(this.normalizedKeyframes, this.timing, this.target);
|
|
40
|
+
this.computedTiming = new Proxy(this.timing, {
|
|
41
|
+
get: function get(target, prop) {
|
|
42
|
+
if (prop === 'duration') {
|
|
43
|
+
return target.duration === 'auto' ? 0 : target.duration;
|
|
44
|
+
} else if (prop === 'fill') {
|
|
45
|
+
return target.fill === 'auto' ? 'none' : target.fill;
|
|
46
|
+
} else if (prop === 'localTime') {
|
|
47
|
+
return _this.animation && _this.animation.currentTime || null;
|
|
48
|
+
} else if (prop === 'currentIteration') {
|
|
49
|
+
if (!_this.animation || _this.animation.playState !== 'running') {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return target.currentIteration || 0;
|
|
54
|
+
} else if (prop === 'progress') {
|
|
55
|
+
if (!_this.animation || _this.animation.playState !== 'running') {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return target.progress || 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return target[prop];
|
|
63
|
+
},
|
|
64
|
+
set: function set(_, prop, value) {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
38
68
|
}
|
|
39
69
|
|
|
40
70
|
KeyframeEffect.prototype.applyInterpolations = function () {
|
|
@@ -57,17 +87,33 @@ var KeyframeEffect = function () {
|
|
|
57
87
|
KeyframeEffect.prototype.setKeyframes = function (keyframes) {
|
|
58
88
|
this.normalizedKeyframes = (0, _KeyframeList.normalizeKeyframes)(keyframes);
|
|
59
89
|
};
|
|
90
|
+
/**
|
|
91
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEffect/getComputedTiming
|
|
92
|
+
*/
|
|
93
|
+
|
|
60
94
|
|
|
61
95
|
KeyframeEffect.prototype.getComputedTiming = function () {
|
|
62
|
-
return this.
|
|
96
|
+
return this.computedTiming;
|
|
63
97
|
};
|
|
98
|
+
/**
|
|
99
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEffect/getTiming
|
|
100
|
+
*/
|
|
101
|
+
|
|
64
102
|
|
|
65
103
|
KeyframeEffect.prototype.getTiming = function () {
|
|
66
104
|
return this.timing;
|
|
67
105
|
};
|
|
106
|
+
/**
|
|
107
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEffect/updateTiming
|
|
108
|
+
*/
|
|
109
|
+
|
|
68
110
|
|
|
69
111
|
KeyframeEffect.prototype.updateTiming = function (timing) {
|
|
70
|
-
|
|
112
|
+
var _this = this;
|
|
113
|
+
|
|
114
|
+
Object.keys(timing || {}).forEach(function (name) {
|
|
115
|
+
_this.timing = timing[name];
|
|
116
|
+
});
|
|
71
117
|
};
|
|
72
118
|
|
|
73
119
|
return KeyframeEffect;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { AnimationEffectTiming } from './AnimationEffectTiming';
|
|
1
|
+
import type { AnimationEffectTiming } from './AnimationEffectTiming';
|
|
2
2
|
export declare function normalizeKeyframes(effectInput: Keyframe[] | PropertyIndexedKeyframes | null, timing?: AnimationEffectTiming): ComputedKeyframe[];
|
|
File without changes
|
package/lib/dom/Node.d.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { EventTarget } from './EventTarget';
|
|
2
|
-
import {
|
|
2
|
+
import type { IEventTarget, IElement, INode, IChildNode, IParentNode, IDocument } from './interfaces';
|
|
3
3
|
/**
|
|
4
4
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Node
|
|
5
5
|
*/
|
|
6
|
-
export declare abstract class Node extends EventTarget {
|
|
6
|
+
export declare abstract class Node extends EventTarget implements INode {
|
|
7
|
+
static isNode(target: IEventTarget | INode): target is INode;
|
|
8
|
+
shadow: boolean;
|
|
7
9
|
/**
|
|
8
10
|
* points to canvas.document
|
|
9
11
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Node/ownerDocument
|
|
10
12
|
*/
|
|
11
|
-
ownerDocument:
|
|
13
|
+
ownerDocument: IDocument | null;
|
|
12
14
|
/**
|
|
13
15
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/isConnected
|
|
14
16
|
* @example
|
|
@@ -18,14 +20,15 @@ export declare abstract class Node extends EventTarget {
|
|
|
18
20
|
*/
|
|
19
21
|
isConnected: boolean;
|
|
20
22
|
/**
|
|
21
|
-
*
|
|
23
|
+
* Returns node's node document's document base URL.
|
|
22
24
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node
|
|
23
25
|
*/
|
|
24
26
|
readonly baseURI: string;
|
|
25
27
|
/**
|
|
28
|
+
* Returns the children.
|
|
26
29
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Node/childNodes
|
|
27
30
|
*/
|
|
28
|
-
childNodes:
|
|
31
|
+
childNodes: (IChildNode & INode)[];
|
|
29
32
|
/**
|
|
30
33
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/nodeType
|
|
31
34
|
*/
|
|
@@ -45,47 +48,59 @@ export declare abstract class Node extends EventTarget {
|
|
|
45
48
|
/**
|
|
46
49
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/getRootNode
|
|
47
50
|
*/
|
|
48
|
-
getRootNode(options?: GetRootNodeOptions):
|
|
51
|
+
getRootNode(options?: GetRootNodeOptions): INode;
|
|
49
52
|
hasChildNodes(): boolean;
|
|
50
53
|
isDefaultNamespace(namespace: string | null): boolean;
|
|
54
|
+
compareDocumentPosition(other: INode): number;
|
|
55
|
+
lookupNamespaceURI(prefix: string | null): string | null;
|
|
56
|
+
lookupPrefix(namespace: string | null): string | null;
|
|
57
|
+
normalize(): void;
|
|
51
58
|
/**
|
|
52
59
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/isEqualNode
|
|
53
60
|
*/
|
|
54
|
-
isEqualNode(otherNode:
|
|
55
|
-
isSameNode(otherNode:
|
|
61
|
+
isEqualNode(otherNode: INode | null): boolean;
|
|
62
|
+
isSameNode(otherNode: INode | null): boolean;
|
|
56
63
|
/**
|
|
57
64
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/ParentNode
|
|
58
65
|
*/
|
|
59
|
-
parentNode:
|
|
66
|
+
parentNode: (INode & IParentNode) | null;
|
|
60
67
|
/**
|
|
61
68
|
* @deprecated
|
|
62
69
|
* @alias parentNode
|
|
63
70
|
*/
|
|
64
|
-
get parent():
|
|
65
|
-
get parentElement():
|
|
66
|
-
get nextSibling():
|
|
67
|
-
get previousSibling():
|
|
68
|
-
get firstChild():
|
|
69
|
-
get lastChild():
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
get parent(): INode | null;
|
|
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;
|
|
77
|
+
/**
|
|
78
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Node/cloneNode
|
|
79
|
+
*/
|
|
80
|
+
abstract cloneNode(deep?: boolean): INode;
|
|
81
|
+
/**
|
|
82
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Node/appendChild
|
|
83
|
+
*/
|
|
84
|
+
abstract appendChild<T extends INode>(newChild: T, index?: number): T;
|
|
72
85
|
/**
|
|
73
86
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Node/insertBefore
|
|
74
87
|
*/
|
|
75
|
-
abstract insertBefore(
|
|
88
|
+
abstract insertBefore<T extends INode>(newChild: T, refChild: INode | null): T;
|
|
76
89
|
/**
|
|
77
90
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Node/removeChild
|
|
78
91
|
*/
|
|
79
|
-
abstract removeChild(child:
|
|
92
|
+
abstract removeChild<T extends INode>(child: T, destroy?: boolean): T;
|
|
80
93
|
/**
|
|
81
94
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/replaceChild
|
|
82
95
|
*/
|
|
83
|
-
replaceChild(newChild:
|
|
96
|
+
abstract replaceChild<T extends INode & IChildNode>(newChild: INode, oldChild: T, destroy?: boolean): T;
|
|
97
|
+
abstract destroy(): void;
|
|
84
98
|
/**
|
|
85
99
|
* @deprecated
|
|
86
100
|
* @alias contains
|
|
87
101
|
*/
|
|
88
|
-
contain(
|
|
89
|
-
contains(
|
|
90
|
-
getAncestor(n: number):
|
|
102
|
+
contain(other: INode | null): boolean;
|
|
103
|
+
contains(other: INode | null): boolean;
|
|
104
|
+
getAncestor(n: number): INode | null;
|
|
105
|
+
forEach(callback: (o: INode) => void | boolean): void;
|
|
91
106
|
}
|
package/lib/dom/Node.js
CHANGED
|
@@ -17,12 +17,13 @@ var Node = function (_super) {
|
|
|
17
17
|
|
|
18
18
|
function Node() {
|
|
19
19
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
20
|
+
|
|
21
|
+
_this.shadow = false;
|
|
20
22
|
/**
|
|
21
23
|
* points to canvas.document
|
|
22
24
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Node/ownerDocument
|
|
23
25
|
*/
|
|
24
26
|
|
|
25
|
-
|
|
26
27
|
_this.ownerDocument = null;
|
|
27
28
|
/**
|
|
28
29
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/isConnected
|
|
@@ -34,12 +35,13 @@ var Node = function (_super) {
|
|
|
34
35
|
|
|
35
36
|
_this.isConnected = false;
|
|
36
37
|
/**
|
|
37
|
-
*
|
|
38
|
+
* Returns node's node document's document base URL.
|
|
38
39
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node
|
|
39
40
|
*/
|
|
40
41
|
|
|
41
42
|
_this.baseURI = '';
|
|
42
43
|
/**
|
|
44
|
+
* Returns the children.
|
|
43
45
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Node/childNodes
|
|
44
46
|
*/
|
|
45
47
|
|
|
@@ -71,6 +73,10 @@ var Node = function (_super) {
|
|
|
71
73
|
_this.parentNode = null;
|
|
72
74
|
return _this;
|
|
73
75
|
}
|
|
76
|
+
|
|
77
|
+
Node.isNode = function (target) {
|
|
78
|
+
return !!target.childNodes;
|
|
79
|
+
};
|
|
74
80
|
/**
|
|
75
81
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/getRootNode
|
|
76
82
|
*/
|
|
@@ -93,6 +99,22 @@ var Node = function (_super) {
|
|
|
93
99
|
Node.prototype.isDefaultNamespace = function (namespace) {
|
|
94
100
|
throw new Error('Method not implemented.');
|
|
95
101
|
};
|
|
102
|
+
|
|
103
|
+
Node.prototype.compareDocumentPosition = function (other) {
|
|
104
|
+
throw new Error('Method not implemented.');
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
Node.prototype.lookupNamespaceURI = function (prefix) {
|
|
108
|
+
throw new Error('Method not implemented.');
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
Node.prototype.lookupPrefix = function (namespace) {
|
|
112
|
+
throw new Error('Method not implemented.');
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
Node.prototype.normalize = function () {
|
|
116
|
+
throw new Error('Method not implemented.');
|
|
117
|
+
};
|
|
96
118
|
/**
|
|
97
119
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/isEqualNode
|
|
98
120
|
*/
|
|
@@ -119,18 +141,13 @@ var Node = function (_super) {
|
|
|
119
141
|
});
|
|
120
142
|
Object.defineProperty(Node.prototype, "parentElement", {
|
|
121
143
|
get: function get() {
|
|
122
|
-
return
|
|
144
|
+
return null;
|
|
123
145
|
},
|
|
124
146
|
enumerable: false,
|
|
125
147
|
configurable: true
|
|
126
148
|
});
|
|
127
149
|
Object.defineProperty(Node.prototype, "nextSibling", {
|
|
128
150
|
get: function get() {
|
|
129
|
-
if (this.parentNode) {
|
|
130
|
-
var index = this.parentNode.childNodes.indexOf(this);
|
|
131
|
-
return this.parentNode.childNodes[index + 1] || null;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
151
|
return null;
|
|
135
152
|
},
|
|
136
153
|
enumerable: false,
|
|
@@ -138,11 +155,6 @@ var Node = function (_super) {
|
|
|
138
155
|
});
|
|
139
156
|
Object.defineProperty(Node.prototype, "previousSibling", {
|
|
140
157
|
get: function get() {
|
|
141
|
-
if (this.parentNode) {
|
|
142
|
-
var index = this.parentNode.childNodes.indexOf(this);
|
|
143
|
-
return this.parentNode.childNodes[index - 1] || null;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
158
|
return null;
|
|
147
159
|
},
|
|
148
160
|
enumerable: false,
|
|
@@ -162,34 +174,18 @@ var Node = function (_super) {
|
|
|
162
174
|
enumerable: false,
|
|
163
175
|
configurable: true
|
|
164
176
|
});
|
|
165
|
-
|
|
166
|
-
Node.prototype.cloneNode = function () {
|
|
167
|
-
throw new Error('Method not implemented.');
|
|
168
|
-
};
|
|
169
|
-
/**
|
|
170
|
-
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/replaceChild
|
|
171
|
-
*/
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
Node.prototype.replaceChild = function (newChild, oldChild, destroy) {
|
|
175
|
-
var index = this.childNodes.indexOf(oldChild);
|
|
176
|
-
this.removeChild(oldChild, destroy);
|
|
177
|
-
this.appendChild(newChild, index);
|
|
178
|
-
return newChild;
|
|
179
|
-
};
|
|
180
177
|
/**
|
|
181
178
|
* @deprecated
|
|
182
179
|
* @alias contains
|
|
183
180
|
*/
|
|
184
181
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
return this.contains(group);
|
|
182
|
+
Node.prototype.contain = function (other) {
|
|
183
|
+
return this.contains(other);
|
|
188
184
|
};
|
|
189
185
|
|
|
190
|
-
Node.prototype.contains = function (
|
|
186
|
+
Node.prototype.contains = function (other) {
|
|
191
187
|
// the node itself, one of its direct children
|
|
192
|
-
var tmp =
|
|
188
|
+
var tmp = other; // @see https://developer.mozilla.org/en-US/docs/Web/API/Node/contains
|
|
193
189
|
|
|
194
190
|
while (tmp && this !== tmp) {
|
|
195
191
|
tmp = tmp.parentNode;
|
|
@@ -209,6 +205,14 @@ var Node = function (_super) {
|
|
|
209
205
|
return temp;
|
|
210
206
|
};
|
|
211
207
|
|
|
208
|
+
Node.prototype.forEach = function (callback) {
|
|
209
|
+
if (!callback(this)) {
|
|
210
|
+
this.childNodes.forEach(function (child) {
|
|
211
|
+
child.forEach(callback);
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
|
|
212
216
|
return Node;
|
|
213
217
|
}(_EventTarget.EventTarget);
|
|
214
218
|
|
package/lib/dom/index.d.ts
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './Node';
|
|
1
|
+
export * from './interfaces';
|
|
3
2
|
export * from './EventTarget';
|
|
3
|
+
export * from './Node';
|
|
4
|
+
export * from './Element';
|
|
4
5
|
export * from './Document';
|
|
6
|
+
export * from './FederatedEvent';
|
|
7
|
+
export * from './FederatedMouseEvent';
|
|
8
|
+
export * from './FederatedPointerEvent';
|
|
9
|
+
export * from './FederatedWheelEvent';
|
|
10
|
+
export * from './Animation';
|
|
11
|
+
export * from './AnimationEvent';
|
|
12
|
+
export * from './AnimationEffectTiming';
|
|
13
|
+
export * from './CustomEvent';
|
|
14
|
+
export * from './KeyframeEffect';
|
|
15
|
+
export * from './KeyframeList';
|
|
16
|
+
export * from './AnimationTimeline';
|
|
17
|
+
export * from './CustomElementRegistry';
|