@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/lib/camera/Camera.js
CHANGED
|
@@ -894,17 +894,16 @@ function (_super) {
|
|
|
894
894
|
|
|
895
895
|
|
|
896
896
|
Camera.prototype.computeMatrix = function () {
|
|
897
|
-
|
|
898
|
-
var rotY; // 使用四元数描述 3D 旋转
|
|
897
|
+
// 使用四元数描述 3D 旋转
|
|
899
898
|
// @see https://xiaoiver.github.io/coding/2018/12/28/Camera-%E8%AE%BE%E8%AE%A1-%E4%B8%80.html
|
|
900
|
-
|
|
901
899
|
var rotZ = _glMatrix.quat.setAxisAngle(_glMatrix.quat.create(), [0, 0, 1], this.roll * DEG_2_RAD);
|
|
902
900
|
|
|
903
901
|
_glMatrix.mat4.identity(this.matrix); // only consider HCS for EXPLORING and ORBITING cameras
|
|
904
902
|
|
|
905
903
|
|
|
906
|
-
rotX = _glMatrix.quat.setAxisAngle(_glMatrix.quat.create(), [1, 0, 0], (this.rotateWorld && this.type !== CAMERA_TYPE.TRACKING || this.type === CAMERA_TYPE.TRACKING ? 1 : -1) * this.elevation * DEG_2_RAD);
|
|
907
|
-
|
|
904
|
+
var rotX = _glMatrix.quat.setAxisAngle(_glMatrix.quat.create(), [1, 0, 0], (this.rotateWorld && this.type !== CAMERA_TYPE.TRACKING || this.type === CAMERA_TYPE.TRACKING ? 1 : -1) * this.elevation * DEG_2_RAD);
|
|
905
|
+
|
|
906
|
+
var rotY = _glMatrix.quat.setAxisAngle(_glMatrix.quat.create(), [0, 1, 0], (this.rotateWorld && this.type !== CAMERA_TYPE.TRACKING || this.type === CAMERA_TYPE.TRACKING ? 1 : -1) * this.azimuth * DEG_2_RAD);
|
|
908
907
|
|
|
909
908
|
var rotQ = _glMatrix.quat.multiply(_glMatrix.quat.create(), rotY, rotX);
|
|
910
909
|
|
|
@@ -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
|
|
@@ -58,7 +58,10 @@ function (_super) {
|
|
|
58
58
|
attributeName = _a.attributeName,
|
|
59
59
|
oldValue = _a.oldValue,
|
|
60
60
|
newValue = _a.newValue;
|
|
61
|
-
|
|
61
|
+
|
|
62
|
+
if (_this.attributeChangedCallback) {
|
|
63
|
+
_this.attributeChangedCallback(attributeName, oldValue, newValue);
|
|
64
|
+
}
|
|
62
65
|
}; // this.addEventListener(ElementEvent.CHILD_INSERTED, this.handleChildInserted);
|
|
63
66
|
// this.addEventListener(ElementEvent.CHILD_REMOVED, this.handleChildRemoved);
|
|
64
67
|
|
|
@@ -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
|
*
|
|
@@ -27,6 +27,8 @@ var _propertyHandlers = require("../property-handlers");
|
|
|
27
27
|
|
|
28
28
|
var _globalModule = require("../global-module");
|
|
29
29
|
|
|
30
|
+
var _services = require("../services");
|
|
31
|
+
|
|
30
32
|
var DEFAULT_STYLE_PROPS = {
|
|
31
33
|
anchor: [0, 0, 0],
|
|
32
34
|
origin: [0, 0, 0],
|
|
@@ -61,7 +63,7 @@ function (_super) {
|
|
|
61
63
|
function DisplayObject(config) {
|
|
62
64
|
var _a, _b, _c;
|
|
63
65
|
|
|
64
|
-
var _this = _super.call(this
|
|
66
|
+
var _this = _super.call(this) || this;
|
|
65
67
|
/**
|
|
66
68
|
* push to active animations after calling `animate()`
|
|
67
69
|
*/
|
|
@@ -242,7 +244,7 @@ function (_super) {
|
|
|
242
244
|
|
|
243
245
|
if (this.attributes.clipPathTargets && this.attributes.clipPathTargets.length) {
|
|
244
246
|
this.attributes.clipPathTargets.forEach(function (target) {
|
|
245
|
-
|
|
247
|
+
(0, _services.dirtifyToRoot)(target);
|
|
246
248
|
target.emit(_interfaces.ElementEvent.ATTRIBUTE_CHANGED, {
|
|
247
249
|
attributeName: 'clipPath',
|
|
248
250
|
oldValue: _this,
|
|
@@ -815,7 +817,8 @@ function (_super) {
|
|
|
815
817
|
sx = _b[0],
|
|
816
818
|
sy = _b[1];
|
|
817
819
|
|
|
818
|
-
var rotation = _glMatrix.mat4.getRotation(_glMatrix.quat.create(), transform);
|
|
820
|
+
var rotation = _glMatrix.mat4.getRotation(_glMatrix.quat.create(), transform); // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
821
|
+
|
|
819
822
|
|
|
820
823
|
var _c = (0, _tslib.__read)((0, _utils.getEuler)(_glMatrix.vec3.create(), rotation), 3),
|
|
821
824
|
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';
|
|
@@ -60,7 +60,7 @@ function (_super) {
|
|
|
60
60
|
Text.prototype.getLineBoundingRects = function () {
|
|
61
61
|
var _a;
|
|
62
62
|
|
|
63
|
-
return (_a = this.parsedStyle.metrics) === null || _a === void 0 ? void 0 : _a.lineMetrics;
|
|
63
|
+
return ((_a = this.parsedStyle.metrics) === null || _a === void 0 ? void 0 : _a.lineMetrics) || [];
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
return Text;
|
package/lib/dom/Animation.js
CHANGED
|
@@ -427,15 +427,18 @@ function () {
|
|
|
427
427
|
|
|
428
428
|
Animation.prototype.persist = function () {
|
|
429
429
|
throw new Error('Method not implemented.');
|
|
430
|
-
};
|
|
430
|
+
}; // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
431
|
+
|
|
431
432
|
|
|
432
433
|
Animation.prototype.addEventListener = function (type, listener, options) {
|
|
433
434
|
throw new Error('Method not implemented.');
|
|
434
|
-
};
|
|
435
|
+
}; // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
436
|
+
|
|
435
437
|
|
|
436
438
|
Animation.prototype.removeEventListener = function (type, listener, options) {
|
|
437
439
|
throw new Error('Method not implemented.');
|
|
438
|
-
};
|
|
440
|
+
}; // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
441
|
+
|
|
439
442
|
|
|
440
443
|
Animation.prototype.dispatchEvent = function (event) {
|
|
441
444
|
throw new Error('Method not implemented.');
|
|
@@ -484,7 +487,9 @@ function () {
|
|
|
484
487
|
if (this.onfinish) {
|
|
485
488
|
var event_1 = new _AnimationEvent.AnimationEvent(null, this, this.currentTime, baseTime);
|
|
486
489
|
setTimeout(function () {
|
|
487
|
-
|
|
490
|
+
if (_this.onfinish) {
|
|
491
|
+
_this.onfinish(event_1);
|
|
492
|
+
}
|
|
488
493
|
});
|
|
489
494
|
}
|
|
490
495
|
|
package/lib/dom/CustomEvent.js
CHANGED
|
@@ -24,7 +24,7 @@ var _FederatedEvent = require("./FederatedEvent");
|
|
|
24
24
|
var CustomEvent =
|
|
25
25
|
/** @class */
|
|
26
26
|
function (_super) {
|
|
27
|
-
(0, _tslib.__extends)(CustomEvent, _super);
|
|
27
|
+
(0, _tslib.__extends)(CustomEvent, _super); // eslint-disable-next-line @typescript-eslint/ban-types
|
|
28
28
|
|
|
29
29
|
function CustomEvent(eventName, object) {
|
|
30
30
|
var _this = _super.call(this, null) || this;
|
package/lib/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/lib/dom/Document.js
CHANGED
|
@@ -81,7 +81,8 @@ function (_super) {
|
|
|
81
81
|
Document.prototype.createElement = function (tagName, options) {
|
|
82
82
|
var clazz = this.defaultView.customElements.get(tagName);
|
|
83
83
|
return new clazz(options);
|
|
84
|
-
};
|
|
84
|
+
}; // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
85
|
+
|
|
85
86
|
|
|
86
87
|
Document.prototype.cloneNode = function (deep) {
|
|
87
88
|
throw new Error('Method not implemented.');
|
|
@@ -97,23 +98,28 @@ function (_super) {
|
|
|
97
98
|
/**
|
|
98
99
|
* eg. Uncaught DOMException: Failed to execute 'appendChild' on 'Node': Only one element on document allowed.
|
|
99
100
|
*/
|
|
101
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
100
102
|
|
|
101
103
|
|
|
102
104
|
Document.prototype.appendChild = function (newChild, index) {
|
|
103
105
|
throw new Error('Use document.documentElement instead.');
|
|
104
|
-
};
|
|
106
|
+
}; // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
107
|
+
|
|
105
108
|
|
|
106
109
|
Document.prototype.insertBefore = function (newChild, refChild) {
|
|
107
110
|
throw new Error('Use document.documentElement instead.');
|
|
108
|
-
};
|
|
111
|
+
}; // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
112
|
+
|
|
109
113
|
|
|
110
114
|
Document.prototype.removeChild = function (oldChild, destroy) {
|
|
111
115
|
throw new Error('Use document.documentElement instead.');
|
|
112
|
-
};
|
|
116
|
+
}; // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
117
|
+
|
|
113
118
|
|
|
114
119
|
Document.prototype.replaceChild = function (newChild, oldChild, destroy) {
|
|
115
120
|
throw new Error('Use document.documentElement instead.');
|
|
116
|
-
};
|
|
121
|
+
}; // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
122
|
+
|
|
117
123
|
|
|
118
124
|
Document.prototype.append = function () {
|
|
119
125
|
var nodes = [];
|
|
@@ -123,7 +129,8 @@ function (_super) {
|
|
|
123
129
|
}
|
|
124
130
|
|
|
125
131
|
throw new Error('Use document.documentElement instead.');
|
|
126
|
-
};
|
|
132
|
+
}; // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
133
|
+
|
|
127
134
|
|
|
128
135
|
Document.prototype.prepend = function () {
|
|
129
136
|
var nodes = [];
|
package/lib/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/lib/dom/Element.js
CHANGED
|
@@ -32,8 +32,8 @@ var Element =
|
|
|
32
32
|
function (_super) {
|
|
33
33
|
(0, _tslib.__extends)(Element, _super);
|
|
34
34
|
|
|
35
|
-
function Element(
|
|
36
|
-
var _this = _super.
|
|
35
|
+
function Element() {
|
|
36
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
37
37
|
|
|
38
38
|
_this.sceneGraphService = _globalModule.globalContainer.get(_SceneGraphService.SceneGraphService);
|
|
39
39
|
_this.entity = entityCounter++;
|
|
@@ -143,7 +143,7 @@ function (_super) {
|
|
|
143
143
|
},
|
|
144
144
|
enumerable: false,
|
|
145
145
|
configurable: true
|
|
146
|
-
});
|
|
146
|
+
}); // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
147
147
|
|
|
148
148
|
Element.prototype.cloneNode = function (deep) {
|
|
149
149
|
throw new Error('Method not implemented.');
|
|
@@ -490,7 +490,8 @@ function (_super) {
|
|
|
490
490
|
*/
|
|
491
491
|
|
|
492
492
|
|
|
493
|
-
Element.prototype.setAttribute = function (attributeName, value,
|
|
493
|
+
Element.prototype.setAttribute = function (attributeName, value, // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
494
|
+
force) {
|
|
494
495
|
if (force === void 0) {
|
|
495
496
|
force = false;
|
|
496
497
|
}
|
package/lib/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/lib/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/lib/dom/Node.js
CHANGED
|
@@ -84,7 +84,8 @@ function (_super) {
|
|
|
84
84
|
*/
|
|
85
85
|
|
|
86
86
|
|
|
87
|
-
Node.prototype.getRootNode = function (
|
|
87
|
+
Node.prototype.getRootNode = function () {
|
|
88
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
88
89
|
var temp = this;
|
|
89
90
|
|
|
90
91
|
while (temp.parentNode) {
|
|
@@ -96,19 +97,23 @@ function (_super) {
|
|
|
96
97
|
|
|
97
98
|
Node.prototype.hasChildNodes = function () {
|
|
98
99
|
return this.childNodes.length > 0;
|
|
99
|
-
};
|
|
100
|
+
}; // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
101
|
+
|
|
100
102
|
|
|
101
103
|
Node.prototype.isDefaultNamespace = function (namespace) {
|
|
102
104
|
throw new Error('Method not implemented.');
|
|
103
|
-
};
|
|
105
|
+
}; // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
106
|
+
|
|
104
107
|
|
|
105
108
|
Node.prototype.compareDocumentPosition = function (other) {
|
|
106
109
|
throw new Error('Method not implemented.');
|
|
107
|
-
};
|
|
110
|
+
}; // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
111
|
+
|
|
108
112
|
|
|
109
113
|
Node.prototype.lookupNamespaceURI = function (prefix) {
|
|
110
114
|
throw new Error('Method not implemented.');
|
|
111
|
-
};
|
|
115
|
+
}; // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
116
|
+
|
|
112
117
|
|
|
113
118
|
Node.prototype.lookupPrefix = function (namespace) {
|
|
114
119
|
throw new Error('Method not implemented.');
|
|
@@ -198,6 +203,7 @@ function (_super) {
|
|
|
198
203
|
};
|
|
199
204
|
|
|
200
205
|
Node.prototype.getAncestor = function (n) {
|
|
206
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
201
207
|
var temp = this;
|
|
202
208
|
|
|
203
209
|
while (n > 0 && temp) {
|