@antv/g 5.0.14 → 5.0.17
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/AbstractRenderer.js +1 -3
- package/es/Canvas.d.ts +3 -0
- package/es/Canvas.js +10 -12
- package/es/DisplayObjectPool.js +1 -3
- package/es/camera/Camera.d.ts +3 -2
- package/es/camera/Camera.js +17 -11
- package/es/camera/Landmark.js +1 -3
- package/es/canvas-module.js +11 -17
- package/es/components/Cullable.js +1 -3
- package/es/components/Geometry.js +1 -3
- package/es/components/Renderable.js +1 -3
- package/es/components/Sortable.js +1 -3
- package/es/components/Transform.d.ts +0 -1
- package/es/components/Transform.js +1 -4
- package/es/display-objects/Circle.d.ts +4 -2
- package/es/display-objects/Circle.js +9 -6
- package/es/display-objects/CustomElement.d.ts +3 -2
- package/es/display-objects/CustomElement.js +10 -9
- package/es/display-objects/DisplayObject.d.ts +9 -3
- package/es/display-objects/DisplayObject.js +98 -50
- package/es/display-objects/Ellipse.d.ts +6 -3
- package/es/display-objects/Ellipse.js +9 -6
- package/es/display-objects/Group.d.ts +18 -2
- package/es/display-objects/Group.js +15 -12
- package/es/display-objects/HTML.d.ts +6 -1
- package/es/display-objects/HTML.js +8 -6
- package/es/display-objects/Image.d.ts +12 -7
- package/es/display-objects/Image.js +11 -6
- package/es/display-objects/Line.d.ts +1 -1
- package/es/display-objects/Line.js +13 -7
- package/es/display-objects/Path.d.ts +3 -2
- package/es/display-objects/Path.js +11 -8
- package/es/display-objects/Polygon.d.ts +1 -1
- package/es/display-objects/Polygon.js +10 -6
- package/es/display-objects/Polyline.d.ts +1 -1
- package/es/display-objects/Polyline.js +11 -8
- package/es/display-objects/Rect.d.ts +8 -5
- package/es/display-objects/Rect.js +10 -7
- package/es/display-objects/TSpan.d.ts +1 -0
- package/es/display-objects/TSpan.js +0 -0
- package/es/display-objects/Text.d.ts +32 -4
- package/es/display-objects/Text.js +71 -14
- package/es/dom/Animation.js +2 -4
- package/es/dom/AnimationEffectTiming.js +1 -3
- package/es/dom/AnimationEvent.js +1 -3
- package/es/dom/AnimationTimeline.js +2 -5
- package/es/dom/CustomElementRegistry.js +13 -15
- package/es/dom/CustomEvent.js +1 -3
- package/es/dom/Document.d.ts +2 -1
- package/es/dom/Document.js +23 -5
- package/es/dom/Element.d.ts +36 -9
- package/es/dom/Element.js +103 -15
- package/es/dom/EventTarget.d.ts +2 -2
- package/es/dom/EventTarget.js +3 -4
- package/es/dom/FederatedEvent.d.ts +5 -2
- package/es/dom/FederatedEvent.js +1 -3
- package/es/dom/FederatedMouseEvent.js +1 -3
- package/es/dom/FederatedPointerEvent.js +1 -3
- package/es/dom/FederatedWheelEvent.js +1 -3
- package/es/dom/KeyframeEffect.js +1 -3
- package/es/dom/MutationEvent.d.ts +15 -0
- package/es/dom/MutationEvent.js +27 -0
- package/es/dom/MutationObserver.d.ts +36 -0
- package/es/dom/MutationObserver.js +406 -0
- package/es/dom/MutationRecord.d.ts +14 -0
- package/es/dom/MutationRecord.js +29 -0
- package/es/dom/Node.d.ts +35 -3
- package/es/dom/Node.js +185 -20
- package/es/dom/index.d.ts +3 -0
- package/es/dom/index.js +3 -0
- package/es/dom/interfaces.d.ts +36 -8
- package/es/dom/interfaces.js +23 -5
- package/es/global-module.d.ts +4 -1
- package/es/global-module.js +36 -79
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/plugins/CullingPlugin.d.ts +0 -2
- package/es/plugins/CullingPlugin.js +4 -27
- package/es/plugins/DirtyCheckPlugin.js +3 -5
- package/es/plugins/EventPlugin.d.ts +2 -1
- package/es/plugins/EventPlugin.js +16 -8
- package/es/plugins/FrustumCullingStrategy.d.ts +1 -0
- package/es/plugins/FrustumCullingStrategy.js +40 -35
- package/es/plugins/PrepareRendererPlugin.js +22 -8
- package/es/property-handlers/aabb.js +22 -24
- package/es/property-handlers/anchor.js +2 -1
- package/es/property-handlers/color.js +3 -0
- package/es/property-handlers/dimension.d.ts +15 -2
- package/es/property-handlers/dimension.js +77 -8
- package/es/property-handlers/index.d.ts +3 -0
- package/es/property-handlers/index.js +4 -1
- package/es/property-handlers/inherit.d.ts +6 -0
- package/es/property-handlers/inherit.js +25 -0
- package/es/property-handlers/interfaces.d.ts +2 -2
- package/es/property-handlers/lineDash.d.ts +6 -1
- package/es/property-handlers/lineDash.js +23 -4
- package/es/property-handlers/offsetDistance.js +2 -2
- package/es/property-handlers/path.d.ts +1 -1
- package/es/property-handlers/text.d.ts +2 -0
- package/es/property-handlers/text.js +3 -0
- package/es/property-handlers/textTransform.d.ts +6 -0
- package/es/property-handlers/textTransform.js +19 -0
- package/es/services/EventService.js +2 -6
- package/es/services/RenderingContext.d.ts +5 -8
- package/es/services/RenderingContext.js +6 -7
- package/es/services/RenderingService.js +3 -11
- package/es/services/SceneGraphSelector.d.ts +3 -2
- package/es/services/SceneGraphSelector.js +9 -7
- package/es/services/SceneGraphService.d.ts +7 -14
- package/es/services/SceneGraphService.js +15 -85
- package/es/services/aabb/CircleUpdater.d.ts +2 -2
- package/es/services/aabb/CircleUpdater.js +22 -14
- package/es/services/aabb/EllipseUpdater.d.ts +2 -2
- package/es/services/aabb/EllipseUpdater.js +29 -16
- package/es/services/aabb/LineUpdater.js +3 -5
- package/es/services/aabb/PathUpdater.js +3 -5
- package/es/services/aabb/PolylineUpdater.js +4 -6
- package/es/services/aabb/RectUpdater.d.ts +2 -2
- package/es/services/aabb/RectUpdater.js +32 -21
- package/es/services/aabb/TextUpdater.js +20 -13
- package/es/services/text/OffscreenCanvasCreator.js +1 -3
- package/es/services/text/index.js +18 -22
- package/es/shapes/AABB.d.ts +1 -0
- package/es/shapes/AABB.js +9 -3
- package/es/shapes/BoundingSphere.js +1 -3
- package/es/shapes/Frustum.js +1 -3
- package/es/shapes/Plane.js +1 -3
- package/es/shapes/Point.js +1 -3
- package/es/shapes/Polygon.js +1 -3
- package/es/shapes/Ray.js +1 -3
- package/es/shapes/Rect.js +1 -3
- package/es/shapes/Rectangle.js +1 -3
- package/es/types.d.ts +48 -26
- package/es/types.js +50 -31
- package/es/utils/animation.js +1 -1
- package/es/utils/event.js +5 -3
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +2 -1
- package/es/utils/interpolation.d.ts +1 -0
- package/es/utils/interpolation.js +41 -8
- package/es/utils/path.d.ts +1 -1
- package/es/utils/path.js +13 -13
- package/es/utils/raf.d.ts +1 -1
- package/es/utils/raf.js +0 -2
- package/es/utils/string.d.ts +1 -0
- package/es/utils/string.js +9 -0
- package/es/utils/text.js +1 -1
- package/lib/AbstractRenderer.js +1 -3
- package/lib/Canvas.d.ts +3 -0
- package/lib/Canvas.js +9 -11
- package/lib/DisplayObjectPool.js +1 -3
- package/lib/camera/Camera.d.ts +3 -2
- package/lib/camera/Camera.js +21 -13
- package/lib/camera/Landmark.js +1 -3
- package/lib/canvas-module.js +10 -15
- package/lib/components/Cullable.js +2 -4
- package/lib/components/Geometry.js +1 -3
- package/lib/components/Renderable.js +1 -3
- package/lib/components/Sortable.js +1 -3
- package/lib/components/Transform.d.ts +0 -1
- package/lib/components/Transform.js +1 -4
- package/lib/display-objects/Circle.d.ts +4 -2
- package/lib/display-objects/Circle.js +8 -5
- package/lib/display-objects/CustomElement.d.ts +3 -2
- package/lib/display-objects/CustomElement.js +10 -9
- package/lib/display-objects/DisplayObject.d.ts +9 -3
- package/lib/display-objects/DisplayObject.js +98 -47
- package/lib/display-objects/Ellipse.d.ts +6 -3
- package/lib/display-objects/Ellipse.js +8 -5
- package/lib/display-objects/Group.d.ts +18 -2
- package/lib/display-objects/Group.js +14 -12
- package/lib/display-objects/HTML.d.ts +6 -1
- package/lib/display-objects/HTML.js +7 -5
- package/lib/display-objects/Image.d.ts +12 -7
- package/lib/display-objects/Image.js +10 -5
- package/lib/display-objects/Line.d.ts +1 -1
- package/lib/display-objects/Line.js +12 -6
- package/lib/display-objects/Path.d.ts +3 -2
- package/lib/display-objects/Path.js +10 -7
- package/lib/display-objects/Polygon.d.ts +1 -1
- package/lib/display-objects/Polygon.js +9 -5
- package/lib/display-objects/Polyline.d.ts +1 -1
- package/lib/display-objects/Polyline.js +10 -7
- package/lib/display-objects/Rect.d.ts +8 -5
- package/lib/display-objects/Rect.js +9 -6
- package/lib/display-objects/TSpan.d.ts +1 -0
- package/lib/display-objects/TSpan.js +1 -0
- package/lib/display-objects/Text.d.ts +32 -4
- package/lib/display-objects/Text.js +71 -13
- package/lib/dom/Animation.js +2 -4
- package/lib/dom/AnimationEffectTiming.js +1 -3
- package/lib/dom/AnimationEvent.js +1 -3
- package/lib/dom/AnimationTimeline.js +3 -6
- package/lib/dom/CustomElementRegistry.js +12 -14
- package/lib/dom/CustomEvent.js +1 -3
- package/lib/dom/Document.d.ts +2 -1
- package/lib/dom/Document.js +25 -6
- package/lib/dom/Element.d.ts +36 -9
- package/lib/dom/Element.js +105 -15
- package/lib/dom/EventTarget.d.ts +2 -2
- package/lib/dom/EventTarget.js +3 -4
- package/lib/dom/FederatedEvent.d.ts +5 -2
- package/lib/dom/FederatedEvent.js +1 -3
- package/lib/dom/FederatedMouseEvent.js +1 -3
- package/lib/dom/FederatedPointerEvent.js +1 -3
- package/lib/dom/FederatedWheelEvent.js +1 -3
- package/lib/dom/KeyframeEffect.js +2 -4
- package/lib/dom/MutationEvent.d.ts +15 -0
- package/lib/dom/MutationEvent.js +35 -0
- package/lib/dom/MutationObserver.d.ts +36 -0
- package/lib/dom/MutationObserver.js +417 -0
- package/lib/dom/MutationRecord.d.ts +14 -0
- package/lib/dom/MutationRecord.js +36 -0
- package/lib/dom/Node.d.ts +35 -3
- package/lib/dom/Node.js +186 -19
- package/lib/dom/index.d.ts +3 -0
- package/lib/dom/index.js +39 -0
- package/lib/dom/interfaces.d.ts +36 -8
- package/lib/dom/interfaces.js +23 -5
- package/lib/global-module.d.ts +4 -1
- package/lib/global-module.js +42 -76
- package/lib/index.d.ts +1 -0
- package/lib/index.js +2 -0
- package/lib/plugins/CullingPlugin.d.ts +0 -2
- package/lib/plugins/CullingPlugin.js +4 -27
- package/lib/plugins/DirtyCheckPlugin.js +2 -4
- package/lib/plugins/EventPlugin.d.ts +2 -1
- package/lib/plugins/EventPlugin.js +14 -8
- package/lib/plugins/FrustumCullingStrategy.d.ts +1 -0
- package/lib/plugins/FrustumCullingStrategy.js +41 -35
- package/lib/plugins/PrepareRendererPlugin.js +25 -7
- package/lib/property-handlers/aabb.js +21 -23
- package/lib/property-handlers/anchor.js +3 -1
- package/lib/property-handlers/color.js +5 -2
- package/lib/property-handlers/dimension.d.ts +15 -2
- package/lib/property-handlers/dimension.js +84 -12
- package/lib/property-handlers/index.d.ts +3 -0
- package/lib/property-handlers/index.js +39 -0
- package/lib/property-handlers/inherit.d.ts +6 -0
- package/lib/property-handlers/inherit.js +34 -0
- package/lib/property-handlers/interfaces.d.ts +2 -2
- package/lib/property-handlers/interfaces.js +1 -1
- package/lib/property-handlers/lineDash.d.ts +6 -1
- package/lib/property-handlers/lineDash.js +25 -4
- package/lib/property-handlers/numeric.js +3 -3
- package/lib/property-handlers/offsetDistance.js +1 -1
- package/lib/property-handlers/path.d.ts +1 -1
- package/lib/property-handlers/path.js +1 -1
- package/lib/property-handlers/text.d.ts +2 -0
- package/lib/property-handlers/text.js +10 -0
- package/lib/property-handlers/textTransform.d.ts +6 -0
- package/lib/property-handlers/textTransform.js +27 -0
- package/lib/property-handlers/transform.js +1 -1
- package/lib/services/EventService.js +2 -6
- package/lib/services/RenderingContext.d.ts +5 -8
- package/lib/services/RenderingContext.js +8 -9
- package/lib/services/RenderingService.js +2 -10
- package/lib/services/SceneGraphSelector.d.ts +3 -2
- package/lib/services/SceneGraphSelector.js +12 -7
- package/lib/services/SceneGraphService.d.ts +7 -14
- package/lib/services/SceneGraphService.js +18 -87
- package/lib/services/aabb/CircleUpdater.d.ts +2 -2
- package/lib/services/aabb/CircleUpdater.js +21 -13
- package/lib/services/aabb/EllipseUpdater.d.ts +2 -2
- package/lib/services/aabb/EllipseUpdater.js +28 -15
- package/lib/services/aabb/LineUpdater.js +2 -4
- package/lib/services/aabb/PathUpdater.js +2 -4
- package/lib/services/aabb/PolylineUpdater.js +3 -5
- package/lib/services/aabb/RectUpdater.d.ts +2 -2
- package/lib/services/aabb/RectUpdater.js +31 -20
- package/lib/services/aabb/TextUpdater.js +19 -12
- package/lib/services/aabb/index.js +10 -10
- package/lib/services/aabb/interfaces.js +1 -1
- package/lib/services/text/OffscreenCanvasCreator.js +1 -3
- package/lib/services/text/index.js +18 -22
- package/lib/shapes/AABB.d.ts +1 -0
- package/lib/shapes/AABB.js +9 -3
- package/lib/shapes/BoundingSphere.js +1 -3
- package/lib/shapes/Frustum.js +2 -4
- package/lib/shapes/Plane.js +1 -3
- package/lib/shapes/Point.js +1 -3
- package/lib/shapes/Polygon.js +1 -3
- package/lib/shapes/Ray.js +1 -3
- package/lib/shapes/Rect.js +1 -3
- package/lib/shapes/Rectangle.js +1 -3
- package/lib/types.d.ts +48 -26
- package/lib/types.js +56 -35
- package/lib/utils/animation.js +3 -4
- package/lib/utils/bezier-easing.js +1 -1
- package/lib/utils/custom-easing.js +1 -1
- package/lib/utils/event.js +7 -6
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +13 -0
- package/lib/utils/interpolation.d.ts +1 -0
- package/lib/utils/interpolation.js +43 -7
- package/lib/utils/math.js +5 -5
- package/lib/utils/path.d.ts +1 -1
- package/lib/utils/path.js +15 -15
- package/lib/utils/raf.d.ts +1 -1
- package/lib/utils/raf.js +1 -4
- package/lib/utils/string.d.ts +1 -0
- package/lib/utils/string.js +16 -0
- package/lib/utils/text.js +1 -1
- package/package.json +6 -4
- package/dist/index.umd.min.js +0 -15
package/lib/dom/Element.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Cullable, Geometry, Renderable, Transform, Sortable } from '../componen
|
|
|
3
3
|
import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
|
|
4
4
|
import { Node } from './Node';
|
|
5
5
|
import type { AABB, Rectangle } from '../shapes';
|
|
6
|
-
import type { IEventTarget, IElement, INode } from './interfaces';
|
|
6
|
+
import type { IEventTarget, IElement, INode, ICSSStyleDeclaration } from './interfaces';
|
|
7
7
|
/**
|
|
8
8
|
* Has following capabilities:
|
|
9
9
|
* * Node insert/remove, eg. appendChild, removeChild, remove...
|
|
@@ -28,12 +28,17 @@ export declare class Element<StyleProps extends BaseStyleProps = any, ParsedStyl
|
|
|
28
28
|
* used in `getElementsByClassName`
|
|
29
29
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByClassName
|
|
30
30
|
*/
|
|
31
|
-
className: string;
|
|
31
|
+
get className(): string;
|
|
32
|
+
set className(className: string);
|
|
32
33
|
/**
|
|
33
34
|
* used in `getElementsByName`
|
|
34
35
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByName
|
|
35
36
|
*/
|
|
36
37
|
name: string;
|
|
38
|
+
/**
|
|
39
|
+
* https://developer.mozilla.org/zh-CN/docs/Web/API/Element/namespaceURI
|
|
40
|
+
*/
|
|
41
|
+
namespaceURI: string;
|
|
37
42
|
/**
|
|
38
43
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/classList
|
|
39
44
|
*/
|
|
@@ -103,16 +108,16 @@ export declare class Element<StyleProps extends BaseStyleProps = any, ParsedStyl
|
|
|
103
108
|
*/
|
|
104
109
|
destroyed: boolean;
|
|
105
110
|
destroy(): void;
|
|
106
|
-
getGeometryBounds(): AABB
|
|
107
|
-
getRenderBounds(): AABB
|
|
111
|
+
getGeometryBounds(): AABB;
|
|
112
|
+
getRenderBounds(): AABB;
|
|
108
113
|
/**
|
|
109
114
|
* get bounds in world space, account for children
|
|
110
115
|
*/
|
|
111
|
-
getBounds(): AABB
|
|
116
|
+
getBounds(): AABB;
|
|
112
117
|
/**
|
|
113
118
|
* get bounds in local space, account for children
|
|
114
119
|
*/
|
|
115
|
-
getLocalBounds(): AABB
|
|
120
|
+
getLocalBounds(): AABB;
|
|
116
121
|
/**
|
|
117
122
|
* account for context's bounds in client space,
|
|
118
123
|
* but not accounting for children
|
|
@@ -127,16 +132,28 @@ export declare class Element<StyleProps extends BaseStyleProps = any, ParsedStyl
|
|
|
127
132
|
* compatible with `style`
|
|
128
133
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style
|
|
129
134
|
*/
|
|
130
|
-
style: StyleProps
|
|
135
|
+
style: StyleProps & ICSSStyleDeclaration<StyleProps>;
|
|
131
136
|
parsedStyle: ParsedStyleProps;
|
|
132
137
|
/**
|
|
133
138
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/attributes
|
|
134
139
|
*/
|
|
135
|
-
attributes: StyleProps;
|
|
140
|
+
readonly attributes: StyleProps;
|
|
141
|
+
/**
|
|
142
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttributeNames
|
|
143
|
+
*/
|
|
144
|
+
getAttributeNames(): string[];
|
|
136
145
|
/**
|
|
137
146
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute
|
|
138
147
|
*/
|
|
139
|
-
getAttribute(
|
|
148
|
+
getAttribute(name: keyof StyleProps): any;
|
|
149
|
+
/**
|
|
150
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttribute
|
|
151
|
+
*/
|
|
152
|
+
hasAttribute(qualifiedName: string): boolean;
|
|
153
|
+
/**
|
|
154
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttributes
|
|
155
|
+
*/
|
|
156
|
+
hasAttributes(): boolean;
|
|
140
157
|
/**
|
|
141
158
|
* 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.
|
|
142
159
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute
|
|
@@ -146,4 +163,14 @@ export declare class Element<StyleProps extends BaseStyleProps = any, ParsedStyl
|
|
|
146
163
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute
|
|
147
164
|
*/
|
|
148
165
|
setAttribute<Key extends keyof StyleProps>(attributeName: Key, value: StyleProps[Key], force?: boolean): void;
|
|
166
|
+
getAttributeNS(namespace: string, localName: string): string;
|
|
167
|
+
getAttributeNode(qualifiedName: string): Attr;
|
|
168
|
+
getAttributeNodeNS(namespace: string, localName: string): Attr;
|
|
169
|
+
hasAttributeNS(namespace: string, localName: string): boolean;
|
|
170
|
+
removeAttributeNS(namespace: string, localName: string): void;
|
|
171
|
+
removeAttributeNode(attr: Attr): Attr;
|
|
172
|
+
setAttributeNS(namespace: string, qualifiedName: string, value: string): void;
|
|
173
|
+
setAttributeNode(attr: Attr): Attr;
|
|
174
|
+
setAttributeNodeNS(attr: Attr): Attr;
|
|
175
|
+
toggleAttribute(qualifiedName: string, force?: boolean): boolean;
|
|
149
176
|
}
|
package/lib/dom/Element.js
CHANGED
|
@@ -19,6 +19,10 @@ var _interfaces = require("./interfaces");
|
|
|
19
19
|
|
|
20
20
|
var _globalModule = require("../global-module");
|
|
21
21
|
|
|
22
|
+
var _utils = require("../utils");
|
|
23
|
+
|
|
24
|
+
var _ = require("..");
|
|
25
|
+
|
|
22
26
|
var entityCounter = 0;
|
|
23
27
|
/**
|
|
24
28
|
* Has following capabilities:
|
|
@@ -27,9 +31,7 @@ var entityCounter = 0;
|
|
|
27
31
|
* * Animation
|
|
28
32
|
*/
|
|
29
33
|
|
|
30
|
-
var Element =
|
|
31
|
-
/** @class */
|
|
32
|
-
function (_super) {
|
|
34
|
+
var Element = function (_super) {
|
|
33
35
|
(0, _tslib.__extends)(Element, _super);
|
|
34
36
|
|
|
35
37
|
function Element() {
|
|
@@ -42,6 +44,11 @@ function (_super) {
|
|
|
42
44
|
_this.transformable = new _components.Transform();
|
|
43
45
|
_this.sortable = new _components.Sortable();
|
|
44
46
|
_this.geometry = new _components.Geometry();
|
|
47
|
+
/**
|
|
48
|
+
* https://developer.mozilla.org/zh-CN/docs/Web/API/Element/namespaceURI
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
_this.namespaceURI = 'g';
|
|
45
52
|
_this.scrollLeft = 0;
|
|
46
53
|
_this.scrollTop = 0;
|
|
47
54
|
/**
|
|
@@ -68,6 +75,20 @@ function (_super) {
|
|
|
68
75
|
return !!target.getAttribute;
|
|
69
76
|
};
|
|
70
77
|
|
|
78
|
+
Object.defineProperty(Element.prototype, "className", {
|
|
79
|
+
/**
|
|
80
|
+
* used in `getElementsByClassName`
|
|
81
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByClassName
|
|
82
|
+
*/
|
|
83
|
+
get: function get() {
|
|
84
|
+
return this.getAttribute('class') || '';
|
|
85
|
+
},
|
|
86
|
+
set: function set(className) {
|
|
87
|
+
this.setAttribute('class', className);
|
|
88
|
+
},
|
|
89
|
+
enumerable: false,
|
|
90
|
+
configurable: true
|
|
91
|
+
});
|
|
71
92
|
Object.defineProperty(Element.prototype, "classList", {
|
|
72
93
|
/**
|
|
73
94
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/classList
|
|
@@ -153,11 +174,12 @@ function (_super) {
|
|
|
153
174
|
this.sceneGraphService.attach(child, this, index);
|
|
154
175
|
this.emit(_interfaces.ElementEvent.CHILD_INSERTED, {
|
|
155
176
|
child: child
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
177
|
+
}); // child.emit(ElementEvent.INSERTED, {
|
|
178
|
+
// parent: this,
|
|
179
|
+
// index,
|
|
180
|
+
// });
|
|
181
|
+
|
|
182
|
+
child.dispatchEvent(new _.MutationEvent(_interfaces.ElementEvent.INSERTED, this, '', '', '', 0, '', ''));
|
|
161
183
|
return child;
|
|
162
184
|
};
|
|
163
185
|
|
|
@@ -180,14 +202,15 @@ function (_super) {
|
|
|
180
202
|
};
|
|
181
203
|
|
|
182
204
|
Element.prototype.removeChild = function (child, destroy) {
|
|
205
|
+
// should emit on itself before detach
|
|
206
|
+
// child.emit(ElementEvent.REMOVED, {
|
|
207
|
+
// parent: this,
|
|
208
|
+
// });
|
|
183
209
|
if (destroy === void 0) {
|
|
184
210
|
destroy = true;
|
|
185
|
-
}
|
|
186
|
-
|
|
211
|
+
}
|
|
187
212
|
|
|
188
|
-
child.
|
|
189
|
-
parent: this
|
|
190
|
-
}); // emit destroy event
|
|
213
|
+
child.dispatchEvent(new _.MutationEvent(_interfaces.ElementEvent.REMOVED, this, '', '', '', 0, '', '')); // emit destroy event
|
|
191
214
|
|
|
192
215
|
if (destroy) {
|
|
193
216
|
child.emit(_interfaces.ElementEvent.DESTROY, {});
|
|
@@ -470,15 +493,42 @@ function (_super) {
|
|
|
470
493
|
Element.prototype.getClientRects = function () {
|
|
471
494
|
return [this.getBoundingClientRect()];
|
|
472
495
|
};
|
|
496
|
+
/**
|
|
497
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttributeNames
|
|
498
|
+
*/
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
Element.prototype.getAttributeNames = function () {
|
|
502
|
+
return Object.keys(this.attributes);
|
|
503
|
+
};
|
|
473
504
|
/**
|
|
474
505
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute
|
|
475
506
|
*/
|
|
476
507
|
|
|
477
508
|
|
|
478
|
-
Element.prototype.getAttribute = function (
|
|
509
|
+
Element.prototype.getAttribute = function (name) {
|
|
510
|
+
var _a = (0, _tslib.__read)((0, _utils.formatAttribute)(name, ''), 1),
|
|
511
|
+
attributeName = _a[0];
|
|
512
|
+
|
|
479
513
|
var value = this.attributes[attributeName]; // if the given attribute does not exist, the value returned will either be null or ""
|
|
480
514
|
|
|
481
|
-
return (0, _util.isNil)(value) ?
|
|
515
|
+
return (0, _util.isNil)(value) ? null : value;
|
|
516
|
+
};
|
|
517
|
+
/**
|
|
518
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttribute
|
|
519
|
+
*/
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
Element.prototype.hasAttribute = function (qualifiedName) {
|
|
523
|
+
return this.getAttributeNames().includes(qualifiedName);
|
|
524
|
+
};
|
|
525
|
+
/**
|
|
526
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttributes
|
|
527
|
+
*/
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
Element.prototype.hasAttributes = function () {
|
|
531
|
+
return !!this.getAttributeNames().length;
|
|
482
532
|
};
|
|
483
533
|
/**
|
|
484
534
|
* 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.
|
|
@@ -503,6 +553,46 @@ function (_super) {
|
|
|
503
553
|
this.attributes[attributeName] = value;
|
|
504
554
|
};
|
|
505
555
|
|
|
556
|
+
Element.prototype.getAttributeNS = function (namespace, localName) {
|
|
557
|
+
throw new Error('Method not implemented.');
|
|
558
|
+
};
|
|
559
|
+
|
|
560
|
+
Element.prototype.getAttributeNode = function (qualifiedName) {
|
|
561
|
+
throw new Error('Method not implemented.');
|
|
562
|
+
};
|
|
563
|
+
|
|
564
|
+
Element.prototype.getAttributeNodeNS = function (namespace, localName) {
|
|
565
|
+
throw new Error('Method not implemented.');
|
|
566
|
+
};
|
|
567
|
+
|
|
568
|
+
Element.prototype.hasAttributeNS = function (namespace, localName) {
|
|
569
|
+
throw new Error('Method not implemented.');
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
Element.prototype.removeAttributeNS = function (namespace, localName) {
|
|
573
|
+
throw new Error('Method not implemented.');
|
|
574
|
+
};
|
|
575
|
+
|
|
576
|
+
Element.prototype.removeAttributeNode = function (attr) {
|
|
577
|
+
throw new Error('Method not implemented.');
|
|
578
|
+
};
|
|
579
|
+
|
|
580
|
+
Element.prototype.setAttributeNS = function (namespace, qualifiedName, value) {
|
|
581
|
+
throw new Error('Method not implemented.');
|
|
582
|
+
};
|
|
583
|
+
|
|
584
|
+
Element.prototype.setAttributeNode = function (attr) {
|
|
585
|
+
throw new Error('Method not implemented.');
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
Element.prototype.setAttributeNodeNS = function (attr) {
|
|
589
|
+
throw new Error('Method not implemented.');
|
|
590
|
+
};
|
|
591
|
+
|
|
592
|
+
Element.prototype.toggleAttribute = function (qualifiedName, force) {
|
|
593
|
+
throw new Error('Method not implemented.');
|
|
594
|
+
};
|
|
595
|
+
|
|
506
596
|
return Element;
|
|
507
597
|
}(_Node.Node);
|
|
508
598
|
|
package/lib/dom/EventTarget.d.ts
CHANGED
|
@@ -20,14 +20,14 @@ export declare class EventTarget implements IEventTarget {
|
|
|
20
20
|
* support `capture` & `once` in options
|
|
21
21
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/EventTarget/addEventListener
|
|
22
22
|
*/
|
|
23
|
-
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): this;
|
|
23
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject | ((...args: any[]) => void), options?: boolean | AddEventListenerOptions): this;
|
|
24
24
|
/**
|
|
25
25
|
* @deprecated
|
|
26
26
|
* @alias removeEventListener
|
|
27
27
|
*/
|
|
28
28
|
off(type: string, listener: EventListenerOrEventListenerObject | ((...args: any[]) => void), options?: boolean | AddEventListenerOptions): this;
|
|
29
29
|
removeAllEventListeners(): void;
|
|
30
|
-
removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): this;
|
|
30
|
+
removeEventListener(type: string, listener?: EventListenerOrEventListenerObject | ((...args: any[]) => void), options?: boolean | AddEventListenerOptions): this;
|
|
31
31
|
/**
|
|
32
32
|
* @deprecated
|
|
33
33
|
* @alias dispatchEvent
|
package/lib/dom/EventTarget.js
CHANGED
|
@@ -24,9 +24,7 @@ var DELEGATION_SPLITTER = ':';
|
|
|
24
24
|
|
|
25
25
|
exports.DELEGATION_SPLITTER = DELEGATION_SPLITTER;
|
|
26
26
|
|
|
27
|
-
var EventTarget =
|
|
28
|
-
/** @class */
|
|
29
|
-
function () {
|
|
27
|
+
var EventTarget = function () {
|
|
30
28
|
function EventTarget() {
|
|
31
29
|
/**
|
|
32
30
|
* event emitter
|
|
@@ -85,7 +83,8 @@ function () {
|
|
|
85
83
|
|
|
86
84
|
if (((_a = args[0].target) === null || _a === void 0 ? void 0 : _a.name) !== delegatedName) {
|
|
87
85
|
return;
|
|
88
|
-
}
|
|
86
|
+
} // @ts-ignore
|
|
87
|
+
|
|
89
88
|
|
|
90
89
|
originListener_1.apply(void 0, (0, _tslib.__spreadArray)([], (0, _tslib.__read)(args), false));
|
|
91
90
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Point } from '../shapes/Point';
|
|
2
2
|
import type { EventService } from '../services';
|
|
3
|
-
import type { IEventTarget } from './interfaces';
|
|
3
|
+
import type { IEventTarget, ICanvas } 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}.
|
|
@@ -127,13 +127,16 @@ export declare class FederatedEvent<N extends Event = Event, T = any> {
|
|
|
127
127
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Event/stopPropagation
|
|
128
128
|
*/
|
|
129
129
|
stopPropagation(): void;
|
|
130
|
+
/**
|
|
131
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/view
|
|
132
|
+
*/
|
|
133
|
+
view: ICanvas;
|
|
130
134
|
/**
|
|
131
135
|
* added for compatibility with DOM Event,
|
|
132
136
|
* deprecated props and methods
|
|
133
137
|
*/
|
|
134
138
|
initEvent(): void;
|
|
135
139
|
initUIEvent(): void;
|
|
136
|
-
view: WindowProxy;
|
|
137
140
|
which: number;
|
|
138
141
|
returnValue: boolean;
|
|
139
142
|
srcElement: IEventTarget;
|
|
@@ -11,9 +11,7 @@ var _Point = require("../shapes/Point");
|
|
|
11
11
|
* An DOM-compatible synthetic event implementation that is "forwarded" on behalf of an original
|
|
12
12
|
* FederatedEvent or native {@link https://dom.spec.whatwg.org/#event Event}.
|
|
13
13
|
*/
|
|
14
|
-
var FederatedEvent =
|
|
15
|
-
/** @class */
|
|
16
|
-
function () {
|
|
14
|
+
var FederatedEvent = function () {
|
|
17
15
|
/**
|
|
18
16
|
* The event boundary which manages this event. Propagation can only occur
|
|
19
17
|
* within the boundary's jurisdiction.
|
|
@@ -11,9 +11,7 @@ var _FederatedEvent = require("./FederatedEvent");
|
|
|
11
11
|
|
|
12
12
|
var _Point = require("../shapes/Point");
|
|
13
13
|
|
|
14
|
-
var FederatedMouseEvent =
|
|
15
|
-
/** @class */
|
|
16
|
-
function (_super) {
|
|
14
|
+
var FederatedMouseEvent = function (_super) {
|
|
17
15
|
(0, _tslib.__extends)(FederatedMouseEvent, _super);
|
|
18
16
|
|
|
19
17
|
function FederatedMouseEvent() {
|
|
@@ -9,9 +9,7 @@ var _tslib = require("tslib");
|
|
|
9
9
|
|
|
10
10
|
var _FederatedMouseEvent = require("./FederatedMouseEvent");
|
|
11
11
|
|
|
12
|
-
var FederatedPointerEvent =
|
|
13
|
-
/** @class */
|
|
14
|
-
function (_super) {
|
|
12
|
+
var FederatedPointerEvent = function (_super) {
|
|
15
13
|
(0, _tslib.__extends)(FederatedPointerEvent, _super);
|
|
16
14
|
|
|
17
15
|
function FederatedPointerEvent() {
|
|
@@ -9,9 +9,7 @@ var _tslib = require("tslib");
|
|
|
9
9
|
|
|
10
10
|
var _FederatedMouseEvent = require("./FederatedMouseEvent");
|
|
11
11
|
|
|
12
|
-
var FederatedWheelEvent =
|
|
13
|
-
/** @class */
|
|
14
|
-
function (_super) {
|
|
12
|
+
var FederatedWheelEvent = function (_super) {
|
|
15
13
|
(0, _tslib.__extends)(FederatedWheelEvent, _super);
|
|
16
14
|
|
|
17
15
|
function FederatedWheelEvent() {
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.KeyframeEffect = void 0;
|
|
7
6
|
exports.makeTiming = makeTiming;
|
|
8
7
|
exports.normalizeTimingInput = normalizeTimingInput;
|
|
9
8
|
exports.numericTimingToObject = numericTimingToObject;
|
|
9
|
+
exports.KeyframeEffect = void 0;
|
|
10
10
|
|
|
11
11
|
var _animation = require("../utils/animation");
|
|
12
12
|
|
|
@@ -92,9 +92,7 @@ function numericTimingToObject(timingInput) {
|
|
|
92
92
|
*/
|
|
93
93
|
|
|
94
94
|
|
|
95
|
-
var KeyframeEffect =
|
|
96
|
-
/** @class */
|
|
97
|
-
function () {
|
|
95
|
+
var KeyframeEffect = function () {
|
|
98
96
|
function KeyframeEffect(target, effectInput, timingInput) {
|
|
99
97
|
var _this = this;
|
|
100
98
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ElementEvent, IElement } from '..';
|
|
2
|
+
import { FederatedEvent } from './FederatedEvent';
|
|
3
|
+
export declare class MutationEvent extends FederatedEvent {
|
|
4
|
+
relatedNode: IElement;
|
|
5
|
+
prevValue: any;
|
|
6
|
+
newValue: any;
|
|
7
|
+
attrName: string;
|
|
8
|
+
attrChange: number;
|
|
9
|
+
prevParsedValue: any;
|
|
10
|
+
newParsedValue: any;
|
|
11
|
+
static readonly ADDITION: number;
|
|
12
|
+
static readonly MODIFICATION: number;
|
|
13
|
+
static readonly REMOVAL: number;
|
|
14
|
+
constructor(typeArg: ElementEvent, relatedNode: IElement, prevValue: any, newValue: any, attrName: string, attrChange: number, prevParsedValue: any, newParsedValue: any);
|
|
15
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.MutationEvent = void 0;
|
|
7
|
+
|
|
8
|
+
var _tslib = require("tslib");
|
|
9
|
+
|
|
10
|
+
var _FederatedEvent = require("./FederatedEvent");
|
|
11
|
+
|
|
12
|
+
var MutationEvent = function (_super) {
|
|
13
|
+
(0, _tslib.__extends)(MutationEvent, _super);
|
|
14
|
+
|
|
15
|
+
function MutationEvent(typeArg, relatedNode, prevValue, newValue, attrName, attrChange, prevParsedValue, newParsedValue) {
|
|
16
|
+
var _this = _super.call(this, null) || this;
|
|
17
|
+
|
|
18
|
+
_this.relatedNode = relatedNode;
|
|
19
|
+
_this.prevValue = prevValue;
|
|
20
|
+
_this.newValue = newValue;
|
|
21
|
+
_this.attrName = attrName;
|
|
22
|
+
_this.attrChange = attrChange;
|
|
23
|
+
_this.prevParsedValue = prevParsedValue;
|
|
24
|
+
_this.newParsedValue = newParsedValue;
|
|
25
|
+
_this.type = typeArg;
|
|
26
|
+
return _this;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
MutationEvent.ADDITION = 2;
|
|
30
|
+
MutationEvent.MODIFICATION = 1;
|
|
31
|
+
MutationEvent.REMOVAL = 3;
|
|
32
|
+
return MutationEvent;
|
|
33
|
+
}(_FederatedEvent.FederatedEvent);
|
|
34
|
+
|
|
35
|
+
exports.MutationEvent = MutationEvent;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import 'setimmediate';
|
|
2
|
+
import type { IElement, DisplayObject } from '..';
|
|
3
|
+
import { MutationEvent } from './MutationEvent';
|
|
4
|
+
import { MutationRecord } from './MutationRecord';
|
|
5
|
+
export declare class Registration {
|
|
6
|
+
observer: MutationObserver;
|
|
7
|
+
target: IElement;
|
|
8
|
+
options?: MutationObserverInit;
|
|
9
|
+
private transientObservedNodes;
|
|
10
|
+
constructor(observer: MutationObserver, target: IElement, options?: MutationObserverInit);
|
|
11
|
+
enqueue(record: MutationRecord): void;
|
|
12
|
+
addListeners(): void;
|
|
13
|
+
private addListeners_;
|
|
14
|
+
removeListeners(): void;
|
|
15
|
+
removeListeners_(node: IElement): void;
|
|
16
|
+
/**
|
|
17
|
+
* Adds a transient observer on node. The transient observer gets removed
|
|
18
|
+
* next time we deliver the change records.
|
|
19
|
+
*/
|
|
20
|
+
removeTransientObservers(): void;
|
|
21
|
+
handleEvent(e: MutationEvent): void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver
|
|
25
|
+
* @see https://github.com/googlearchive/MutationObservers/blob/master/MutationObserver.js
|
|
26
|
+
*/
|
|
27
|
+
export declare class MutationObserver {
|
|
28
|
+
callback: MutationCallback;
|
|
29
|
+
nodes: IElement[];
|
|
30
|
+
records: MutationRecord[];
|
|
31
|
+
uid: number;
|
|
32
|
+
constructor(callback: MutationCallback);
|
|
33
|
+
observe(target: DisplayObject, options?: MutationObserverInit): void;
|
|
34
|
+
disconnect(): void;
|
|
35
|
+
takeRecords(): MutationRecord[];
|
|
36
|
+
}
|