@antv/g 5.0.1 → 5.0.2
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/LICENSE +21 -0
- package/dist/index.umd.js +2 -2
- package/es/AbstractRenderer.d.ts +7 -7
- package/es/Canvas.d.ts +1 -1
- package/es/Canvas.js +1 -1
- package/es/camera/Camera.js +3 -5
- package/es/components/Geometry.d.ts +1 -1
- package/es/components/Renderable.d.ts +1 -1
- package/es/display-objects/CustomElement.d.ts +3 -3
- package/es/display-objects/CustomElement.js +4 -1
- package/es/display-objects/DisplayObject.d.ts +4 -3
- package/es/display-objects/DisplayObject.js +4 -3
- package/es/display-objects/Group.d.ts +1 -1
- package/es/display-objects/HTML.d.ts +1 -1
- package/es/display-objects/Image.d.ts +1 -1
- package/es/display-objects/Path.d.ts +1 -1
- package/es/display-objects/Polygon.d.ts +1 -1
- package/es/display-objects/Polyline.d.ts +1 -1
- package/es/display-objects/Text.d.ts +1 -1
- package/es/display-objects/Text.js +1 -1
- package/es/dom/Animation.js +9 -4
- package/es/dom/AnimationEffectTiming.d.ts +0 -1
- package/es/dom/AnimationTimeline.js +2 -1
- package/es/dom/CustomElementRegistry.d.ts +1 -1
- package/es/dom/CustomEvent.js +2 -1
- package/es/dom/Document.d.ts +2 -2
- package/es/dom/Document.js +13 -6
- package/es/dom/Element.d.ts +3 -4
- package/es/dom/Element.js +5 -4
- package/es/dom/EventTarget.js +1 -0
- package/es/dom/FederatedEvent.d.ts +1 -1
- package/es/dom/KeyframeEffect.js +1 -1
- package/es/dom/Node.d.ts +1 -1
- package/es/dom/Node.js +11 -5
- package/es/dom/interfaces.d.ts +57 -57
- package/es/plugins/CullingPlugin.d.ts +3 -3
- package/es/plugins/DirtyCheckPlugin.d.ts +1 -1
- package/es/plugins/EventPlugin.d.ts +2 -1
- package/es/plugins/FrustumCullingStrategy.d.ts +1 -2
- package/es/plugins/FrustumCullingStrategy.js +29 -32
- package/es/plugins/PrepareRendererPlugin.d.ts +1 -1
- package/es/plugins/PrepareRendererPlugin.js +7 -20
- package/es/property-handlers/aabb.js +16 -19
- package/es/property-handlers/anchor.d.ts +2 -1
- package/es/property-handlers/anchor.js +2 -2
- package/es/property-handlers/clipPath.js +2 -2
- package/es/property-handlers/color.d.ts +3 -4
- package/es/property-handlers/color.js +2 -2
- package/es/property-handlers/filter.d.ts +3 -4
- package/es/property-handlers/filter.js +2 -2
- package/es/property-handlers/interfaces.d.ts +1 -1
- package/es/property-handlers/lineDash.d.ts +1 -2
- package/es/property-handlers/lineDash.js +1 -1
- package/es/property-handlers/path.d.ts +2 -3
- package/es/property-handlers/path.js +2 -2
- package/es/property-handlers/points.d.ts +1 -2
- package/es/property-handlers/points.js +1 -1
- package/es/property-handlers/transform.d.ts +1 -1
- package/es/property-handlers/transform.js +0 -5
- package/es/services/ContextService.d.ts +8 -8
- package/es/services/EventService.d.ts +2 -2
- package/es/services/RenderingContext.d.ts +2 -2
- package/es/services/RenderingService.d.ts +18 -18
- package/es/services/RenderingService.js +3 -3
- package/es/services/SceneGraphSelector.d.ts +5 -5
- package/es/services/SceneGraphSelector.js +3 -2
- package/es/services/SceneGraphService.d.ts +36 -34
- package/es/services/SceneGraphService.js +33 -4
- package/es/services/aabb/PathUpdater.d.ts +1 -2
- package/es/services/aabb/PathUpdater.js +1 -1
- package/es/services/aabb/interfaces.d.ts +1 -1
- package/es/services/text/index.js +1 -1
- package/es/shapes/AABB.d.ts +3 -2
- package/es/shapes/Frustum.d.ts +1 -1
- package/es/shapes/Polygon.d.ts +1 -1
- package/es/shapes/Ray.d.ts +3 -3
- package/es/types.d.ts +1 -1
- package/es/utils/custom-easing.d.ts +3 -5
- package/es/utils/custom-easing.js +2 -1
- package/es/utils/event.d.ts +1 -1
- package/es/utils/interpolation.js +6 -9
- package/es/utils/math.d.ts +2 -1
- package/es/utils/math.js +1 -2
- package/es/utils/path.d.ts +1 -1
- package/es/utils/path.js +4 -7
- package/es/utils/raf.js +2 -1
- package/lib/AbstractRenderer.d.ts +7 -7
- package/lib/Canvas.d.ts +1 -1
- package/lib/Canvas.js +1 -1
- package/lib/camera/Camera.js +4 -5
- package/lib/components/Geometry.d.ts +1 -1
- package/lib/components/Renderable.d.ts +1 -1
- package/lib/display-objects/CustomElement.d.ts +3 -3
- package/lib/display-objects/CustomElement.js +4 -1
- package/lib/display-objects/DisplayObject.d.ts +4 -3
- package/lib/display-objects/DisplayObject.js +6 -3
- package/lib/display-objects/Group.d.ts +1 -1
- package/lib/display-objects/HTML.d.ts +1 -1
- package/lib/display-objects/Image.d.ts +1 -1
- package/lib/display-objects/Path.d.ts +1 -1
- package/lib/display-objects/Polygon.d.ts +1 -1
- package/lib/display-objects/Polyline.d.ts +1 -1
- package/lib/display-objects/Text.d.ts +1 -1
- package/lib/display-objects/Text.js +1 -1
- package/lib/dom/Animation.js +9 -4
- package/lib/dom/AnimationEffectTiming.d.ts +0 -1
- package/lib/dom/AnimationTimeline.js +2 -1
- package/lib/dom/CustomElementRegistry.d.ts +1 -1
- package/lib/dom/CustomEvent.js +1 -1
- package/lib/dom/Document.d.ts +2 -2
- package/lib/dom/Document.js +13 -6
- package/lib/dom/Element.d.ts +3 -4
- package/lib/dom/Element.js +5 -4
- package/lib/dom/EventTarget.js +1 -0
- package/lib/dom/FederatedEvent.d.ts +1 -1
- package/lib/dom/KeyframeEffect.js +1 -1
- package/lib/dom/Node.d.ts +1 -1
- package/lib/dom/Node.js +11 -5
- package/lib/dom/interfaces.d.ts +57 -57
- package/lib/plugins/CullingPlugin.d.ts +3 -3
- package/lib/plugins/DirtyCheckPlugin.d.ts +1 -1
- package/lib/plugins/EventPlugin.d.ts +2 -1
- package/lib/plugins/FrustumCullingStrategy.d.ts +1 -2
- package/lib/plugins/FrustumCullingStrategy.js +26 -30
- package/lib/plugins/PrepareRendererPlugin.d.ts +1 -1
- package/lib/plugins/PrepareRendererPlugin.js +6 -19
- package/lib/property-handlers/aabb.js +15 -19
- package/lib/property-handlers/anchor.d.ts +2 -1
- package/lib/property-handlers/anchor.js +2 -2
- package/lib/property-handlers/clipPath.js +2 -2
- package/lib/property-handlers/color.d.ts +3 -4
- package/lib/property-handlers/color.js +2 -2
- package/lib/property-handlers/filter.d.ts +3 -4
- package/lib/property-handlers/filter.js +2 -2
- package/lib/property-handlers/interfaces.d.ts +1 -1
- package/lib/property-handlers/lineDash.d.ts +1 -2
- package/lib/property-handlers/lineDash.js +1 -1
- package/lib/property-handlers/path.d.ts +2 -3
- package/lib/property-handlers/path.js +2 -2
- package/lib/property-handlers/points.d.ts +1 -2
- package/lib/property-handlers/points.js +1 -1
- package/lib/property-handlers/transform.d.ts +1 -1
- package/lib/property-handlers/transform.js +0 -4
- package/lib/services/ContextService.d.ts +8 -8
- package/lib/services/EventService.d.ts +2 -2
- package/lib/services/RenderingContext.d.ts +2 -2
- package/lib/services/RenderingService.d.ts +18 -18
- package/lib/services/RenderingService.js +3 -3
- package/lib/services/SceneGraphSelector.d.ts +5 -5
- package/lib/services/SceneGraphSelector.js +3 -2
- package/lib/services/SceneGraphService.d.ts +36 -34
- package/lib/services/SceneGraphService.js +35 -4
- package/lib/services/aabb/PathUpdater.d.ts +1 -2
- package/lib/services/aabb/PathUpdater.js +1 -1
- package/lib/services/aabb/interfaces.d.ts +1 -1
- package/lib/services/text/index.js +1 -1
- package/lib/shapes/AABB.d.ts +3 -2
- package/lib/shapes/Frustum.d.ts +1 -1
- package/lib/shapes/Polygon.d.ts +1 -1
- package/lib/shapes/Ray.d.ts +3 -3
- package/lib/types.d.ts +1 -1
- package/lib/utils/custom-easing.d.ts +3 -5
- package/lib/utils/custom-easing.js +2 -1
- package/lib/utils/event.d.ts +1 -1
- package/lib/utils/interpolation.js +6 -9
- package/lib/utils/math.d.ts +2 -1
- package/lib/utils/math.js +1 -2
- package/lib/utils/path.d.ts +2 -2
- package/lib/utils/path.js +4 -7
- package/lib/utils/raf.js +2 -1
- package/package.json +6 -6
- package/lib/dom/__tests__/utils/easing.d.ts +0 -14
- package/lib/dom/__tests__/utils/keyframe.d.ts +0 -38
package/es/AbstractRenderer.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { Syringe } from 'mana-syringe';
|
|
2
|
-
import { RendererConfig } from './types';
|
|
1
|
+
import type { Syringe } from 'mana-syringe';
|
|
2
|
+
import type { RendererConfig } from './types';
|
|
3
3
|
export interface RendererPlugin {
|
|
4
|
-
init(container: Syringe.Container)
|
|
5
|
-
destroy(container: Syringe.Container)
|
|
4
|
+
init: (container: Syringe.Container) => void;
|
|
5
|
+
destroy: (container: Syringe.Container) => void;
|
|
6
6
|
}
|
|
7
7
|
export interface IRenderer {
|
|
8
|
-
getConfig()
|
|
8
|
+
getConfig: () => RendererConfig;
|
|
9
9
|
/**
|
|
10
10
|
* register plugin at runtime
|
|
11
11
|
*/
|
|
12
|
-
registerPlugin(plugin: RendererPlugin)
|
|
12
|
+
registerPlugin: (plugin: RendererPlugin) => void;
|
|
13
13
|
/**
|
|
14
14
|
* return all registered plugins
|
|
15
15
|
*/
|
|
16
|
-
getPlugins()
|
|
16
|
+
getPlugins: () => RendererPlugin[];
|
|
17
17
|
}
|
|
18
18
|
export declare class AbstractRenderer implements IRenderer {
|
|
19
19
|
private plugins;
|
package/es/Canvas.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { RenderingService } from './services/RenderingService';
|
|
|
5
5
|
import { RenderingContext } from './services/RenderingContext';
|
|
6
6
|
import { EventService } from './services/EventService';
|
|
7
7
|
import { Camera } from './camera';
|
|
8
|
-
import { AbstractRenderer } from './AbstractRenderer';
|
|
8
|
+
import type { AbstractRenderer } from './AbstractRenderer';
|
|
9
9
|
import type { PointLike } from './shapes';
|
|
10
10
|
import { Document, EventTarget } from './dom';
|
|
11
11
|
import type { IElement, INode, ICanvas } from './dom/interfaces';
|
package/es/Canvas.js
CHANGED
|
@@ -291,7 +291,7 @@ function (_super) {
|
|
|
291
291
|
if (renderable) {
|
|
292
292
|
renderable.renderBoundsDirty = true;
|
|
293
293
|
renderable.boundsDirty = true;
|
|
294
|
-
renderable.dirty = true;
|
|
294
|
+
renderable.dirty = true;
|
|
295
295
|
}
|
|
296
296
|
}); // keep current scenegraph unchanged, just trigger mounted event
|
|
297
297
|
|
package/es/camera/Camera.js
CHANGED
|
@@ -842,15 +842,13 @@ function (_super) {
|
|
|
842
842
|
|
|
843
843
|
|
|
844
844
|
Camera.prototype.computeMatrix = function () {
|
|
845
|
-
|
|
846
|
-
var rotY; // 使用四元数描述 3D 旋转
|
|
845
|
+
// 使用四元数描述 3D 旋转
|
|
847
846
|
// @see https://xiaoiver.github.io/coding/2018/12/28/Camera-%E8%AE%BE%E8%AE%A1-%E4%B8%80.html
|
|
848
|
-
|
|
849
847
|
var rotZ = quat.setAxisAngle(quat.create(), [0, 0, 1], this.roll * DEG_2_RAD);
|
|
850
848
|
mat4.identity(this.matrix); // only consider HCS for EXPLORING and ORBITING cameras
|
|
851
849
|
|
|
852
|
-
rotX = quat.setAxisAngle(quat.create(), [1, 0, 0], (this.rotateWorld && this.type !== CAMERA_TYPE.TRACKING || this.type === CAMERA_TYPE.TRACKING ? 1 : -1) * this.elevation * DEG_2_RAD);
|
|
853
|
-
rotY = quat.setAxisAngle(quat.create(), [0, 1, 0], (this.rotateWorld && this.type !== CAMERA_TYPE.TRACKING || this.type === CAMERA_TYPE.TRACKING ? 1 : -1) * this.azimuth * DEG_2_RAD);
|
|
850
|
+
var rotX = quat.setAxisAngle(quat.create(), [1, 0, 0], (this.rotateWorld && this.type !== CAMERA_TYPE.TRACKING || this.type === CAMERA_TYPE.TRACKING ? 1 : -1) * this.elevation * DEG_2_RAD);
|
|
851
|
+
var rotY = quat.setAxisAngle(quat.create(), [0, 1, 0], (this.rotateWorld && this.type !== CAMERA_TYPE.TRACKING || this.type === CAMERA_TYPE.TRACKING ? 1 : -1) * this.azimuth * DEG_2_RAD);
|
|
854
852
|
var rotQ = quat.multiply(quat.create(), rotY, rotX);
|
|
855
853
|
rotQ = quat.multiply(quat.create(), rotQ, rotZ);
|
|
856
854
|
var rotMatrix = mat4.fromQuat(mat4.create(), rotQ);
|
|
@@ -4,12 +4,12 @@ export interface CustomElement<CustomElementStyleProps> {
|
|
|
4
4
|
/**
|
|
5
5
|
* fired after element insert into DOM tree
|
|
6
6
|
*/
|
|
7
|
-
connectedCallback
|
|
7
|
+
connectedCallback?: () => void;
|
|
8
8
|
/**
|
|
9
9
|
* fired before element removed from DOM tree
|
|
10
10
|
*/
|
|
11
|
-
disconnectedCallback
|
|
12
|
-
attributeChangedCallback
|
|
11
|
+
disconnectedCallback?: () => void;
|
|
12
|
+
attributeChangedCallback?: <Key extends keyof CustomElementStyleProps>(name: Key, oldValue: CustomElementStyleProps[Key], newValue: CustomElementStyleProps[Key]) => void;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* shadow root
|
|
@@ -50,7 +50,10 @@ function (_super) {
|
|
|
50
50
|
attributeName = _a.attributeName,
|
|
51
51
|
oldValue = _a.oldValue,
|
|
52
52
|
newValue = _a.newValue;
|
|
53
|
-
|
|
53
|
+
|
|
54
|
+
if (_this.attributeChangedCallback) {
|
|
55
|
+
_this.attributeChangedCallback(attributeName, oldValue, newValue);
|
|
56
|
+
}
|
|
54
57
|
}; // this.addEventListener(ElementEvent.CHILD_INSERTED, this.handleChildInserted);
|
|
55
58
|
// this.addEventListener(ElementEvent.CHILD_REMOVED, this.handleChildRemoved);
|
|
56
59
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { mat3,
|
|
2
|
-
import {
|
|
1
|
+
import type { mat3, vec2 } from 'gl-matrix';
|
|
2
|
+
import { mat4, quat, vec3 } from 'gl-matrix';
|
|
3
|
+
import type { Animation } from '../dom/Animation';
|
|
3
4
|
import { Element } from '../dom/Element';
|
|
4
5
|
import type { DisplayObjectConfig, INode } from '../dom/interfaces';
|
|
5
6
|
import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
|
|
6
|
-
import { StylePropertyParser, StylePropertyUpdater } from '../property-handlers';
|
|
7
|
+
import type { StylePropertyParser, StylePropertyUpdater } from '../property-handlers';
|
|
7
8
|
/**
|
|
8
9
|
* prototype chains: DisplayObject -> Element -> Node -> EventTarget
|
|
9
10
|
*
|
|
@@ -9,6 +9,7 @@ import { SHAPE } from '../types';
|
|
|
9
9
|
import { createVec3, fromRotationTranslationScale, getEuler, rad2deg } from '../utils';
|
|
10
10
|
import { StylePropertyParserFactory, StylePropertyUpdaterFactory } from '../property-handlers';
|
|
11
11
|
import { globalContainer } from '../global-module';
|
|
12
|
+
import { dirtifyToRoot } from '../services';
|
|
12
13
|
var DEFAULT_STYLE_PROPS = {
|
|
13
14
|
anchor: [0, 0, 0],
|
|
14
15
|
origin: [0, 0, 0],
|
|
@@ -43,7 +44,7 @@ function (_super) {
|
|
|
43
44
|
function DisplayObject(config) {
|
|
44
45
|
var _a, _b, _c;
|
|
45
46
|
|
|
46
|
-
var _this = _super.call(this
|
|
47
|
+
var _this = _super.call(this) || this;
|
|
47
48
|
/**
|
|
48
49
|
* push to active animations after calling `animate()`
|
|
49
50
|
*/
|
|
@@ -222,7 +223,7 @@ function (_super) {
|
|
|
222
223
|
|
|
223
224
|
if (this.attributes.clipPathTargets && this.attributes.clipPathTargets.length) {
|
|
224
225
|
this.attributes.clipPathTargets.forEach(function (target) {
|
|
225
|
-
target
|
|
226
|
+
dirtifyToRoot(target);
|
|
226
227
|
target.emit(ElementEvent.ATTRIBUTE_CHANGED, {
|
|
227
228
|
attributeName: 'clipPath',
|
|
228
229
|
oldValue: _this,
|
|
@@ -795,7 +796,7 @@ function (_super) {
|
|
|
795
796
|
sx = _b[0],
|
|
796
797
|
sy = _b[1];
|
|
797
798
|
|
|
798
|
-
var rotation = mat4.getRotation(quat.create(), transform);
|
|
799
|
+
var rotation = mat4.getRotation(quat.create(), transform); // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
799
800
|
|
|
800
801
|
var _c = __read(getEuler(vec3.create(), rotation), 3),
|
|
801
802
|
eux = _c[0],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BaseStyleProps } from '../types';
|
|
2
2
|
import { DisplayObject } from './DisplayObject';
|
|
3
|
-
import { DisplayObjectConfig } from '../dom';
|
|
3
|
+
import type { DisplayObjectConfig } from '../dom';
|
|
4
4
|
export declare class Group extends DisplayObject {
|
|
5
5
|
constructor(config?: DisplayObjectConfig<BaseStyleProps>);
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
|
|
2
2
|
import { DisplayObject } from './DisplayObject';
|
|
3
|
-
import { DisplayObjectConfig } from '../dom';
|
|
3
|
+
import type { DisplayObjectConfig } from '../dom';
|
|
4
4
|
import { AABB } from '../shapes';
|
|
5
5
|
export interface HTMLStyleProps extends BaseStyleProps {
|
|
6
6
|
innerHTML: string | HTMLElement;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
|
|
2
2
|
import { DisplayObject } from './DisplayObject';
|
|
3
|
-
import { DisplayObjectConfig } from '../dom';
|
|
3
|
+
import type { DisplayObjectConfig } from '../dom';
|
|
4
4
|
export interface ImageStyleProps extends BaseStyleProps {
|
|
5
5
|
img: string | HTMLImageElement;
|
|
6
6
|
width?: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BaseStyleProps, PathCommand } from '../types';
|
|
2
2
|
import { DisplayObject } from './DisplayObject';
|
|
3
|
-
import { DisplayObjectConfig } from '../dom';
|
|
3
|
+
import type { DisplayObjectConfig } from '../dom';
|
|
4
4
|
import { Point } from '../shapes';
|
|
5
5
|
import type { Rect } from '../shapes/Rect';
|
|
6
6
|
export interface PathStyleProps extends BaseStyleProps {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BaseStyleProps } from '../types';
|
|
2
2
|
import { DisplayObject } from './DisplayObject';
|
|
3
|
-
import { DisplayObjectConfig } from '../dom';
|
|
3
|
+
import type { DisplayObjectConfig } from '../dom';
|
|
4
4
|
import type { ParsedPolylineStyleProps } from './Polyline';
|
|
5
5
|
export interface PolygonStyleProps extends BaseStyleProps {
|
|
6
6
|
points: [number, number][];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BaseStyleProps } from '../types';
|
|
2
2
|
import { DisplayObject } from './DisplayObject';
|
|
3
|
-
import { DisplayObjectConfig } from '../dom';
|
|
3
|
+
import type { DisplayObjectConfig } from '../dom';
|
|
4
4
|
import { Point } from '../shapes';
|
|
5
5
|
export interface PolylineStyleProps extends BaseStyleProps {
|
|
6
6
|
points: [number, number][];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TextMetrics } from '../services/text';
|
|
1
|
+
import type { TextMetrics } from '../services/text';
|
|
2
2
|
import type { DisplayObjectConfig } from '../dom/interfaces';
|
|
3
3
|
import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
|
|
4
4
|
import { DisplayObject } from './DisplayObject';
|
|
@@ -52,7 +52,7 @@ function (_super) {
|
|
|
52
52
|
Text.prototype.getLineBoundingRects = function () {
|
|
53
53
|
var _a;
|
|
54
54
|
|
|
55
|
-
return (_a = this.parsedStyle.metrics) === null || _a === void 0 ? void 0 : _a.lineMetrics;
|
|
55
|
+
return ((_a = this.parsedStyle.metrics) === null || _a === void 0 ? void 0 : _a.lineMetrics) || [];
|
|
56
56
|
};
|
|
57
57
|
|
|
58
58
|
return Text;
|
package/es/dom/Animation.js
CHANGED
|
@@ -419,15 +419,18 @@ function () {
|
|
|
419
419
|
|
|
420
420
|
Animation.prototype.persist = function () {
|
|
421
421
|
throw new Error('Method not implemented.');
|
|
422
|
-
};
|
|
422
|
+
}; // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
423
|
+
|
|
423
424
|
|
|
424
425
|
Animation.prototype.addEventListener = function (type, listener, options) {
|
|
425
426
|
throw new Error('Method not implemented.');
|
|
426
|
-
};
|
|
427
|
+
}; // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
428
|
+
|
|
427
429
|
|
|
428
430
|
Animation.prototype.removeEventListener = function (type, listener, options) {
|
|
429
431
|
throw new Error('Method not implemented.');
|
|
430
|
-
};
|
|
432
|
+
}; // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
433
|
+
|
|
431
434
|
|
|
432
435
|
Animation.prototype.dispatchEvent = function (event) {
|
|
433
436
|
throw new Error('Method not implemented.');
|
|
@@ -476,7 +479,9 @@ function () {
|
|
|
476
479
|
if (this.onfinish) {
|
|
477
480
|
var event_1 = new AnimationEvent(null, this, this.currentTime, baseTime);
|
|
478
481
|
setTimeout(function () {
|
|
479
|
-
|
|
482
|
+
if (_this.onfinish) {
|
|
483
|
+
_this.onfinish(event_1);
|
|
484
|
+
}
|
|
480
485
|
});
|
|
481
486
|
}
|
|
482
487
|
|
package/es/dom/CustomEvent.js
CHANGED
|
@@ -16,7 +16,8 @@ import { FederatedEvent } from './FederatedEvent';
|
|
|
16
16
|
var CustomEvent =
|
|
17
17
|
/** @class */
|
|
18
18
|
function (_super) {
|
|
19
|
-
__extends(CustomEvent, _super);
|
|
19
|
+
__extends(CustomEvent, _super); // eslint-disable-next-line @typescript-eslint/ban-types
|
|
20
|
+
|
|
20
21
|
|
|
21
22
|
function CustomEvent(eventName, object) {
|
|
22
23
|
var _this = _super.call(this, null) || this;
|
package/es/dom/Document.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Node } from './Node';
|
|
2
2
|
import { AnimationTimeline } from './AnimationTimeline';
|
|
3
3
|
import { Group } from '../display-objects/Group';
|
|
4
|
-
import { DisplayObject } from '../display-objects/DisplayObject';
|
|
4
|
+
import type { DisplayObject } from '../display-objects/DisplayObject';
|
|
5
5
|
import type { IDocument, IElement, INode, ICanvas, DisplayObjectConfig } from './interfaces';
|
|
6
|
-
import { BaseStyleProps } from '../types';
|
|
6
|
+
import type { BaseStyleProps } from '../types';
|
|
7
7
|
/**
|
|
8
8
|
* the entry of DOM tree
|
|
9
9
|
* Document -> Node -> EventTarget
|
package/es/dom/Document.js
CHANGED
|
@@ -71,7 +71,8 @@ function (_super) {
|
|
|
71
71
|
Document.prototype.createElement = function (tagName, options) {
|
|
72
72
|
var clazz = this.defaultView.customElements.get(tagName);
|
|
73
73
|
return new clazz(options);
|
|
74
|
-
};
|
|
74
|
+
}; // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
75
|
+
|
|
75
76
|
|
|
76
77
|
Document.prototype.cloneNode = function (deep) {
|
|
77
78
|
throw new Error('Method not implemented.');
|
|
@@ -87,23 +88,28 @@ function (_super) {
|
|
|
87
88
|
/**
|
|
88
89
|
* eg. Uncaught DOMException: Failed to execute 'appendChild' on 'Node': Only one element on document allowed.
|
|
89
90
|
*/
|
|
91
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
90
92
|
|
|
91
93
|
|
|
92
94
|
Document.prototype.appendChild = function (newChild, index) {
|
|
93
95
|
throw new Error('Use document.documentElement instead.');
|
|
94
|
-
};
|
|
96
|
+
}; // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
97
|
+
|
|
95
98
|
|
|
96
99
|
Document.prototype.insertBefore = function (newChild, refChild) {
|
|
97
100
|
throw new Error('Use document.documentElement instead.');
|
|
98
|
-
};
|
|
101
|
+
}; // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
102
|
+
|
|
99
103
|
|
|
100
104
|
Document.prototype.removeChild = function (oldChild, destroy) {
|
|
101
105
|
throw new Error('Use document.documentElement instead.');
|
|
102
|
-
};
|
|
106
|
+
}; // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
107
|
+
|
|
103
108
|
|
|
104
109
|
Document.prototype.replaceChild = function (newChild, oldChild, destroy) {
|
|
105
110
|
throw new Error('Use document.documentElement instead.');
|
|
106
|
-
};
|
|
111
|
+
}; // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
112
|
+
|
|
107
113
|
|
|
108
114
|
Document.prototype.append = function () {
|
|
109
115
|
var nodes = [];
|
|
@@ -113,7 +119,8 @@ function (_super) {
|
|
|
113
119
|
}
|
|
114
120
|
|
|
115
121
|
throw new Error('Use document.documentElement instead.');
|
|
116
|
-
};
|
|
122
|
+
}; // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
123
|
+
|
|
117
124
|
|
|
118
125
|
Document.prototype.prepend = function () {
|
|
119
126
|
var nodes = [];
|
package/es/dom/Element.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { SceneGraphService } from '../services/SceneGraphService';
|
|
2
2
|
import { Cullable, Geometry, Renderable, Transform, Sortable } from '../components';
|
|
3
|
-
import { BaseStyleProps, ParsedBaseStyleProps } from '../types';
|
|
3
|
+
import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
|
|
4
4
|
import { Node } from './Node';
|
|
5
|
-
import { AABB, Rectangle } from '../shapes';
|
|
6
|
-
import type {
|
|
5
|
+
import type { AABB, Rectangle } from '../shapes';
|
|
6
|
+
import type { IEventTarget, IChildNode, IElement, INode } from './interfaces';
|
|
7
7
|
/**
|
|
8
8
|
* Has following capabilities:
|
|
9
9
|
* * Node insert/remove, eg. appendChild, removeChild, remove...
|
|
@@ -19,7 +19,6 @@ export declare class Element<StyleProps extends BaseStyleProps = any, ParsedStyl
|
|
|
19
19
|
transformable: Transform;
|
|
20
20
|
sortable: Sortable;
|
|
21
21
|
geometry: Geometry;
|
|
22
|
-
constructor(config: DisplayObjectConfig<StyleProps>);
|
|
23
22
|
/**
|
|
24
23
|
* used with `getElementById()`
|
|
25
24
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/id
|
package/es/dom/Element.js
CHANGED
|
@@ -18,8 +18,8 @@ var Element =
|
|
|
18
18
|
function (_super) {
|
|
19
19
|
__extends(Element, _super);
|
|
20
20
|
|
|
21
|
-
function Element(
|
|
22
|
-
var _this = _super.
|
|
21
|
+
function Element() {
|
|
22
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
23
23
|
|
|
24
24
|
_this.sceneGraphService = globalContainer.get(SceneGraphService);
|
|
25
25
|
_this.entity = entityCounter++;
|
|
@@ -129,7 +129,7 @@ function (_super) {
|
|
|
129
129
|
},
|
|
130
130
|
enumerable: false,
|
|
131
131
|
configurable: true
|
|
132
|
-
});
|
|
132
|
+
}); // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
133
133
|
|
|
134
134
|
Element.prototype.cloneNode = function (deep) {
|
|
135
135
|
throw new Error('Method not implemented.');
|
|
@@ -476,7 +476,8 @@ function (_super) {
|
|
|
476
476
|
*/
|
|
477
477
|
|
|
478
478
|
|
|
479
|
-
Element.prototype.setAttribute = function (attributeName, value,
|
|
479
|
+
Element.prototype.setAttribute = function (attributeName, value, // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
480
|
+
force) {
|
|
480
481
|
if (force === void 0) {
|
|
481
482
|
force = false;
|
|
482
483
|
}
|
package/es/dom/EventTarget.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Point } from '../shapes/Point';
|
|
2
2
|
import type { EventService } from '../services';
|
|
3
|
-
import { IEventTarget } from './interfaces';
|
|
3
|
+
import type { IEventTarget } from './interfaces';
|
|
4
4
|
/**
|
|
5
5
|
* An DOM-compatible synthetic event implementation that is "forwarded" on behalf of an original
|
|
6
6
|
* FederatedEvent or native {@link https://dom.spec.whatwg.org/#event Event}.
|
package/es/dom/KeyframeEffect.js
CHANGED
package/es/dom/Node.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export declare abstract class Node extends EventTarget implements INode {
|
|
|
48
48
|
/**
|
|
49
49
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/getRootNode
|
|
50
50
|
*/
|
|
51
|
-
getRootNode(
|
|
51
|
+
getRootNode(): INode;
|
|
52
52
|
hasChildNodes(): boolean;
|
|
53
53
|
isDefaultNamespace(namespace: string | null): boolean;
|
|
54
54
|
compareDocumentPosition(other: INode): number;
|
package/es/dom/Node.js
CHANGED
|
@@ -76,7 +76,8 @@ function (_super) {
|
|
|
76
76
|
*/
|
|
77
77
|
|
|
78
78
|
|
|
79
|
-
Node.prototype.getRootNode = function (
|
|
79
|
+
Node.prototype.getRootNode = function () {
|
|
80
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
80
81
|
var temp = this;
|
|
81
82
|
|
|
82
83
|
while (temp.parentNode) {
|
|
@@ -88,19 +89,23 @@ function (_super) {
|
|
|
88
89
|
|
|
89
90
|
Node.prototype.hasChildNodes = function () {
|
|
90
91
|
return this.childNodes.length > 0;
|
|
91
|
-
};
|
|
92
|
+
}; // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
93
|
+
|
|
92
94
|
|
|
93
95
|
Node.prototype.isDefaultNamespace = function (namespace) {
|
|
94
96
|
throw new Error('Method not implemented.');
|
|
95
|
-
};
|
|
97
|
+
}; // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
98
|
+
|
|
96
99
|
|
|
97
100
|
Node.prototype.compareDocumentPosition = function (other) {
|
|
98
101
|
throw new Error('Method not implemented.');
|
|
99
|
-
};
|
|
102
|
+
}; // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
103
|
+
|
|
100
104
|
|
|
101
105
|
Node.prototype.lookupNamespaceURI = function (prefix) {
|
|
102
106
|
throw new Error('Method not implemented.');
|
|
103
|
-
};
|
|
107
|
+
}; // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
108
|
+
|
|
104
109
|
|
|
105
110
|
Node.prototype.lookupPrefix = function (namespace) {
|
|
106
111
|
throw new Error('Method not implemented.');
|
|
@@ -190,6 +195,7 @@ function (_super) {
|
|
|
190
195
|
};
|
|
191
196
|
|
|
192
197
|
Node.prototype.getAncestor = function (n) {
|
|
198
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
193
199
|
var temp = this;
|
|
194
200
|
|
|
195
201
|
while (n > 0 && temp) {
|