@antv/g 5.0.3 → 5.0.4
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/dist/index.umd.js +1 -1
- package/es/display-objects/DisplayObject.d.ts +2 -2
- package/es/dom/Element.d.ts +10 -10
- package/es/dom/Element.js +7 -4
- package/es/dom/Node.d.ts +7 -7
- package/es/dom/interfaces.d.ts +16 -16
- package/es/types.d.ts +0 -1
- package/lib/display-objects/DisplayObject.d.ts +2 -2
- package/lib/dom/Element.d.ts +10 -10
- package/lib/dom/Element.js +7 -4
- package/lib/dom/Node.d.ts +7 -7
- package/lib/dom/interfaces.d.ts +16 -16
- package/lib/types.d.ts +0 -1
- package/package.json +3 -3
|
@@ -2,7 +2,7 @@ import type { mat3, vec2 } from 'gl-matrix';
|
|
|
2
2
|
import { mat4, quat, vec3 } from 'gl-matrix';
|
|
3
3
|
import type { Animation } from '../dom/Animation';
|
|
4
4
|
import { Element } from '../dom/Element';
|
|
5
|
-
import type { DisplayObjectConfig,
|
|
5
|
+
import type { DisplayObjectConfig, IChildNode } from '../dom/interfaces';
|
|
6
6
|
import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
|
|
7
7
|
import type { StylePropertyParser, StylePropertyUpdater } from '../property-handlers';
|
|
8
8
|
/**
|
|
@@ -193,7 +193,7 @@ export declare class DisplayObject<StyleProps extends BaseStyleProps = any, Pars
|
|
|
193
193
|
* compatible with G 3.0
|
|
194
194
|
* @deprecated
|
|
195
195
|
*/
|
|
196
|
-
add<T extends
|
|
196
|
+
add<T extends IChildNode>(child: T, index?: number): T;
|
|
197
197
|
/**
|
|
198
198
|
* @alias style.clipPath
|
|
199
199
|
* @deprecated
|
package/es/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,
|
|
6
|
+
import type { IEventTarget, IElement, INode } from './interfaces';
|
|
7
7
|
/**
|
|
8
8
|
* Has following capabilities:
|
|
9
9
|
* * Node insert/remove, eg. appendChild, removeChild, remove...
|
|
@@ -51,9 +51,9 @@ export declare class Element<StyleProps extends BaseStyleProps = any, ParsedStyl
|
|
|
51
51
|
get previousSibling(): IElement | null;
|
|
52
52
|
cloneNode(deep?: boolean): this;
|
|
53
53
|
appendChild<T extends INode>(child: T, index?: number): T;
|
|
54
|
-
insertBefore<T extends
|
|
55
|
-
replaceChild<
|
|
56
|
-
removeChild<T extends
|
|
54
|
+
insertBefore<T extends INode>(newChild: T, refChild: INode | null): T;
|
|
55
|
+
replaceChild<T extends INode>(newChild: INode, oldChild: T, destroy?: boolean): T;
|
|
56
|
+
removeChild<T extends INode>(child: T, destroy?: boolean): T;
|
|
57
57
|
removeChildren(destroy?: boolean): void;
|
|
58
58
|
/**
|
|
59
59
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
|
|
@@ -73,27 +73,27 @@ export declare class Element<StyleProps extends BaseStyleProps = any, ParsedStyl
|
|
|
73
73
|
/**
|
|
74
74
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/after
|
|
75
75
|
*/
|
|
76
|
-
after(...nodes:
|
|
76
|
+
after(...nodes: INode[]): void;
|
|
77
77
|
/**
|
|
78
78
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/before
|
|
79
79
|
*/
|
|
80
|
-
before(...nodes:
|
|
80
|
+
before(...nodes: INode[]): void;
|
|
81
81
|
/**
|
|
82
82
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/replaceWith
|
|
83
83
|
*/
|
|
84
|
-
replaceWith(...nodes:
|
|
84
|
+
replaceWith(...nodes: INode[]): void;
|
|
85
85
|
/**
|
|
86
86
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/append
|
|
87
87
|
*/
|
|
88
|
-
append(...nodes:
|
|
88
|
+
append(...nodes: INode[]): void;
|
|
89
89
|
/**
|
|
90
90
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/prepend
|
|
91
91
|
*/
|
|
92
|
-
prepend(...nodes:
|
|
92
|
+
prepend(...nodes: INode[]): void;
|
|
93
93
|
/**
|
|
94
94
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/replaceChildren
|
|
95
95
|
*/
|
|
96
|
-
replaceChildren(...nodes:
|
|
96
|
+
replaceChildren(...nodes: INode[]): void;
|
|
97
97
|
/**
|
|
98
98
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/remove
|
|
99
99
|
*/
|
package/es/dom/Element.js
CHANGED
|
@@ -298,6 +298,8 @@ function (_super) {
|
|
|
298
298
|
|
|
299
299
|
|
|
300
300
|
Element.prototype.before = function () {
|
|
301
|
+
var _a;
|
|
302
|
+
|
|
301
303
|
var nodes = [];
|
|
302
304
|
|
|
303
305
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -307,12 +309,13 @@ function (_super) {
|
|
|
307
309
|
if (this.parentNode) {
|
|
308
310
|
var index = this.parentNode.childNodes.indexOf(this);
|
|
309
311
|
|
|
310
|
-
var
|
|
311
|
-
first =
|
|
312
|
-
rest =
|
|
312
|
+
var _b = __read(nodes),
|
|
313
|
+
first = _b[0],
|
|
314
|
+
rest = _b.slice(1);
|
|
313
315
|
|
|
314
316
|
this.parentNode.appendChild(first, index);
|
|
315
|
-
|
|
317
|
+
|
|
318
|
+
(_a = first).after.apply(_a, __spreadArray([], __read(rest), false));
|
|
316
319
|
}
|
|
317
320
|
};
|
|
318
321
|
/**
|
package/es/dom/Node.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export declare abstract class Node extends EventTarget implements INode {
|
|
|
28
28
|
* Returns the children.
|
|
29
29
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Node/childNodes
|
|
30
30
|
*/
|
|
31
|
-
childNodes:
|
|
31
|
+
childNodes: IChildNode[];
|
|
32
32
|
/**
|
|
33
33
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/nodeType
|
|
34
34
|
*/
|
|
@@ -81,26 +81,26 @@ export declare abstract class Node extends EventTarget implements INode {
|
|
|
81
81
|
/**
|
|
82
82
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Node/appendChild
|
|
83
83
|
*/
|
|
84
|
-
abstract appendChild<T extends
|
|
84
|
+
abstract appendChild<T extends INode>(newChild: T, index?: number): T;
|
|
85
85
|
/**
|
|
86
86
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Node/insertBefore
|
|
87
87
|
*/
|
|
88
|
-
abstract insertBefore<T extends
|
|
88
|
+
abstract insertBefore<T extends INode>(newChild: T, refChild: INode | null): T;
|
|
89
89
|
/**
|
|
90
90
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Node/removeChild
|
|
91
91
|
*/
|
|
92
|
-
abstract removeChild<T extends
|
|
92
|
+
abstract removeChild<T extends INode>(child: T, destroy?: boolean): T;
|
|
93
93
|
/**
|
|
94
94
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/replaceChild
|
|
95
95
|
*/
|
|
96
|
-
abstract replaceChild<
|
|
96
|
+
abstract replaceChild<T extends INode>(newChild: INode, oldChild: T, destroy?: boolean): T;
|
|
97
97
|
abstract destroy(): void;
|
|
98
98
|
/**
|
|
99
99
|
* @deprecated
|
|
100
100
|
* @alias contains
|
|
101
101
|
*/
|
|
102
|
-
contain<T extends
|
|
103
|
-
contains<T extends
|
|
102
|
+
contain<T extends INode>(other: T | null): boolean;
|
|
103
|
+
contains<T extends INode>(other: T | null): boolean;
|
|
104
104
|
getAncestor(n: number): INode | null;
|
|
105
105
|
forEach(callback: (o: INode) => void | boolean): void;
|
|
106
106
|
}
|
package/es/dom/interfaces.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type EventEmitter from 'eventemitter3';
|
|
2
2
|
import type { AnimationTimeline } from './AnimationTimeline';
|
|
3
|
-
import type { BaseStyleProps,
|
|
3
|
+
import type { BaseStyleProps, SHAPE } from '../types';
|
|
4
4
|
import type { FederatedEvent } from './FederatedEvent';
|
|
5
5
|
import type { CustomElementRegistry } from './CustomElementRegistry';
|
|
6
6
|
import type { DisplayObject } from '..';
|
|
@@ -52,11 +52,11 @@ export interface INode extends IEventTarget {
|
|
|
52
52
|
/**
|
|
53
53
|
* Returns the children.
|
|
54
54
|
*/
|
|
55
|
-
readonly childNodes:
|
|
55
|
+
readonly childNodes: IChildNode[];
|
|
56
56
|
/**
|
|
57
57
|
* Returns the first child.
|
|
58
58
|
*/
|
|
59
|
-
readonly firstChild:
|
|
59
|
+
readonly firstChild: IChildNode | null;
|
|
60
60
|
/**
|
|
61
61
|
* Returns true if node is connected and false otherwise.
|
|
62
62
|
*/
|
|
@@ -64,11 +64,11 @@ export interface INode extends IEventTarget {
|
|
|
64
64
|
/**
|
|
65
65
|
* Returns the last child.
|
|
66
66
|
*/
|
|
67
|
-
readonly lastChild:
|
|
67
|
+
readonly lastChild: IChildNode | null;
|
|
68
68
|
/**
|
|
69
69
|
* Returns the next sibling.
|
|
70
70
|
*/
|
|
71
|
-
readonly nextSibling:
|
|
71
|
+
readonly nextSibling: IChildNode | null;
|
|
72
72
|
/**
|
|
73
73
|
* Returns a string appropriate for the type of node.
|
|
74
74
|
*/
|
|
@@ -93,13 +93,13 @@ export interface INode extends IEventTarget {
|
|
|
93
93
|
/**
|
|
94
94
|
* Returns the previous sibling.
|
|
95
95
|
*/
|
|
96
|
-
readonly previousSibling:
|
|
96
|
+
readonly previousSibling: IChildNode | null;
|
|
97
97
|
textContent: string | null;
|
|
98
|
-
appendChild: <T extends
|
|
98
|
+
appendChild: <T extends INode>(newChild: T, index?: number) => T;
|
|
99
99
|
/**
|
|
100
100
|
* Returns a copy of node. If deep is true, the copy also includes the node's descendants.
|
|
101
101
|
*/
|
|
102
|
-
cloneNode: (deep?: boolean) =>
|
|
102
|
+
cloneNode: (deep?: boolean) => INode;
|
|
103
103
|
/**
|
|
104
104
|
* Returns a bitmask indicating the position of other relative to node.
|
|
105
105
|
*/
|
|
@@ -107,7 +107,7 @@ export interface INode extends IEventTarget {
|
|
|
107
107
|
/**
|
|
108
108
|
* Returns true if other is an inclusive descendant of node, and false otherwise.
|
|
109
109
|
*/
|
|
110
|
-
contains:
|
|
110
|
+
contains: (other: INode | null) => boolean;
|
|
111
111
|
/**
|
|
112
112
|
* Returns node's root.
|
|
113
113
|
*/
|
|
@@ -124,7 +124,7 @@ export interface INode extends IEventTarget {
|
|
|
124
124
|
* Returns whether node has children.
|
|
125
125
|
*/
|
|
126
126
|
hasChildNodes: () => boolean;
|
|
127
|
-
insertBefore: <T extends
|
|
127
|
+
insertBefore: <T extends INode>(newChild: T, refChild: INode | null) => T;
|
|
128
128
|
isDefaultNamespace: (namespace: string | null) => boolean;
|
|
129
129
|
/**
|
|
130
130
|
* Returns whether node and otherNode have the same properties.
|
|
@@ -137,8 +137,8 @@ export interface INode extends IEventTarget {
|
|
|
137
137
|
* Removes empty exclusive Text nodes and concatenates the data of remaining contiguous exclusive Text nodes into the first of their nodes.
|
|
138
138
|
*/
|
|
139
139
|
normalize: () => void;
|
|
140
|
-
removeChild: <T extends
|
|
141
|
-
replaceChild: <T extends
|
|
140
|
+
removeChild: <T extends INode>(oldChild: T, destroy?: boolean) => T;
|
|
141
|
+
replaceChild: <T extends INode>(newChild: INode, oldChild: T, destroy?: boolean) => T;
|
|
142
142
|
/**
|
|
143
143
|
* Destroy itself.
|
|
144
144
|
*/
|
|
@@ -193,13 +193,13 @@ export interface IChildNode extends INode {
|
|
|
193
193
|
*
|
|
194
194
|
* Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
|
|
195
195
|
*/
|
|
196
|
-
after: (...nodes:
|
|
196
|
+
after: (...nodes: INode[]) => void;
|
|
197
197
|
/**
|
|
198
198
|
* Inserts nodes just before node, while replacing strings in nodes with equivalent Text nodes.
|
|
199
199
|
*
|
|
200
200
|
* Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
|
|
201
201
|
*/
|
|
202
|
-
before: (...nodes:
|
|
202
|
+
before: (...nodes: INode[]) => void;
|
|
203
203
|
/**
|
|
204
204
|
* Removes node.
|
|
205
205
|
*/
|
|
@@ -209,7 +209,7 @@ export interface IChildNode extends INode {
|
|
|
209
209
|
*
|
|
210
210
|
* Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
|
|
211
211
|
*/
|
|
212
|
-
replaceWith: (...nodes:
|
|
212
|
+
replaceWith: (...nodes: INode[]) => void;
|
|
213
213
|
}
|
|
214
214
|
export interface DisplayObjectConfig<StyleProps> {
|
|
215
215
|
/**
|
|
@@ -250,7 +250,7 @@ export interface DisplayObjectConfig<StyleProps> {
|
|
|
250
250
|
*/
|
|
251
251
|
interactive?: boolean;
|
|
252
252
|
}
|
|
253
|
-
export interface IElement<StyleProps
|
|
253
|
+
export interface IElement<StyleProps = any, ParsedStyleProps = any> extends INode, IChildNode, IParentNode {
|
|
254
254
|
/**
|
|
255
255
|
* Returns the value of element's id content attribute. Can be set to change it.
|
|
256
256
|
*/
|
package/es/types.d.ts
CHANGED
|
@@ -192,7 +192,6 @@ export interface CanvasConfig {
|
|
|
192
192
|
cursor?: Cursor;
|
|
193
193
|
[key: string]: any;
|
|
194
194
|
}
|
|
195
|
-
export declare type ChangeType = 'changeSize' | 'add' | 'sort' | 'clear' | 'attr' | 'show' | 'hide' | 'zIndex' | 'remove' | 'matrix' | 'clip';
|
|
196
195
|
declare type A = ['a' | 'A', number, number, number, number, number, number, number];
|
|
197
196
|
declare type C = ['c' | 'C', number, number, number, number, number, number];
|
|
198
197
|
declare type O = ['o' | 'O', number, number];
|
|
@@ -2,7 +2,7 @@ import type { mat3, vec2 } from 'gl-matrix';
|
|
|
2
2
|
import { mat4, quat, vec3 } from 'gl-matrix';
|
|
3
3
|
import type { Animation } from '../dom/Animation';
|
|
4
4
|
import { Element } from '../dom/Element';
|
|
5
|
-
import type { DisplayObjectConfig,
|
|
5
|
+
import type { DisplayObjectConfig, IChildNode } from '../dom/interfaces';
|
|
6
6
|
import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
|
|
7
7
|
import type { StylePropertyParser, StylePropertyUpdater } from '../property-handlers';
|
|
8
8
|
/**
|
|
@@ -193,7 +193,7 @@ export declare class DisplayObject<StyleProps extends BaseStyleProps = any, Pars
|
|
|
193
193
|
* compatible with G 3.0
|
|
194
194
|
* @deprecated
|
|
195
195
|
*/
|
|
196
|
-
add<T extends
|
|
196
|
+
add<T extends IChildNode>(child: T, index?: number): T;
|
|
197
197
|
/**
|
|
198
198
|
* @alias style.clipPath
|
|
199
199
|
* @deprecated
|
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,
|
|
6
|
+
import type { IEventTarget, IElement, INode } from './interfaces';
|
|
7
7
|
/**
|
|
8
8
|
* Has following capabilities:
|
|
9
9
|
* * Node insert/remove, eg. appendChild, removeChild, remove...
|
|
@@ -51,9 +51,9 @@ export declare class Element<StyleProps extends BaseStyleProps = any, ParsedStyl
|
|
|
51
51
|
get previousSibling(): IElement | null;
|
|
52
52
|
cloneNode(deep?: boolean): this;
|
|
53
53
|
appendChild<T extends INode>(child: T, index?: number): T;
|
|
54
|
-
insertBefore<T extends
|
|
55
|
-
replaceChild<
|
|
56
|
-
removeChild<T extends
|
|
54
|
+
insertBefore<T extends INode>(newChild: T, refChild: INode | null): T;
|
|
55
|
+
replaceChild<T extends INode>(newChild: INode, oldChild: T, destroy?: boolean): T;
|
|
56
|
+
removeChild<T extends INode>(child: T, destroy?: boolean): T;
|
|
57
57
|
removeChildren(destroy?: boolean): void;
|
|
58
58
|
/**
|
|
59
59
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
|
|
@@ -73,27 +73,27 @@ export declare class Element<StyleProps extends BaseStyleProps = any, ParsedStyl
|
|
|
73
73
|
/**
|
|
74
74
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/after
|
|
75
75
|
*/
|
|
76
|
-
after(...nodes:
|
|
76
|
+
after(...nodes: INode[]): void;
|
|
77
77
|
/**
|
|
78
78
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/before
|
|
79
79
|
*/
|
|
80
|
-
before(...nodes:
|
|
80
|
+
before(...nodes: INode[]): void;
|
|
81
81
|
/**
|
|
82
82
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/replaceWith
|
|
83
83
|
*/
|
|
84
|
-
replaceWith(...nodes:
|
|
84
|
+
replaceWith(...nodes: INode[]): void;
|
|
85
85
|
/**
|
|
86
86
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/append
|
|
87
87
|
*/
|
|
88
|
-
append(...nodes:
|
|
88
|
+
append(...nodes: INode[]): void;
|
|
89
89
|
/**
|
|
90
90
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/prepend
|
|
91
91
|
*/
|
|
92
|
-
prepend(...nodes:
|
|
92
|
+
prepend(...nodes: INode[]): void;
|
|
93
93
|
/**
|
|
94
94
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/replaceChildren
|
|
95
95
|
*/
|
|
96
|
-
replaceChildren(...nodes:
|
|
96
|
+
replaceChildren(...nodes: INode[]): void;
|
|
97
97
|
/**
|
|
98
98
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/remove
|
|
99
99
|
*/
|
package/lib/dom/Element.js
CHANGED
|
@@ -312,6 +312,8 @@ function (_super) {
|
|
|
312
312
|
|
|
313
313
|
|
|
314
314
|
Element.prototype.before = function () {
|
|
315
|
+
var _a;
|
|
316
|
+
|
|
315
317
|
var nodes = [];
|
|
316
318
|
|
|
317
319
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -321,12 +323,13 @@ function (_super) {
|
|
|
321
323
|
if (this.parentNode) {
|
|
322
324
|
var index = this.parentNode.childNodes.indexOf(this);
|
|
323
325
|
|
|
324
|
-
var
|
|
325
|
-
first =
|
|
326
|
-
rest =
|
|
326
|
+
var _b = (0, _tslib.__read)(nodes),
|
|
327
|
+
first = _b[0],
|
|
328
|
+
rest = _b.slice(1);
|
|
327
329
|
|
|
328
330
|
this.parentNode.appendChild(first, index);
|
|
329
|
-
|
|
331
|
+
|
|
332
|
+
(_a = first).after.apply(_a, (0, _tslib.__spreadArray)([], (0, _tslib.__read)(rest), false));
|
|
330
333
|
}
|
|
331
334
|
};
|
|
332
335
|
/**
|
package/lib/dom/Node.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export declare abstract class Node extends EventTarget implements INode {
|
|
|
28
28
|
* Returns the children.
|
|
29
29
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Node/childNodes
|
|
30
30
|
*/
|
|
31
|
-
childNodes:
|
|
31
|
+
childNodes: IChildNode[];
|
|
32
32
|
/**
|
|
33
33
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/nodeType
|
|
34
34
|
*/
|
|
@@ -81,26 +81,26 @@ export declare abstract class Node extends EventTarget implements INode {
|
|
|
81
81
|
/**
|
|
82
82
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Node/appendChild
|
|
83
83
|
*/
|
|
84
|
-
abstract appendChild<T extends
|
|
84
|
+
abstract appendChild<T extends INode>(newChild: T, index?: number): T;
|
|
85
85
|
/**
|
|
86
86
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Node/insertBefore
|
|
87
87
|
*/
|
|
88
|
-
abstract insertBefore<T extends
|
|
88
|
+
abstract insertBefore<T extends INode>(newChild: T, refChild: INode | null): T;
|
|
89
89
|
/**
|
|
90
90
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Node/removeChild
|
|
91
91
|
*/
|
|
92
|
-
abstract removeChild<T extends
|
|
92
|
+
abstract removeChild<T extends INode>(child: T, destroy?: boolean): T;
|
|
93
93
|
/**
|
|
94
94
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/replaceChild
|
|
95
95
|
*/
|
|
96
|
-
abstract replaceChild<
|
|
96
|
+
abstract replaceChild<T extends INode>(newChild: INode, oldChild: T, destroy?: boolean): T;
|
|
97
97
|
abstract destroy(): void;
|
|
98
98
|
/**
|
|
99
99
|
* @deprecated
|
|
100
100
|
* @alias contains
|
|
101
101
|
*/
|
|
102
|
-
contain<T extends
|
|
103
|
-
contains<T extends
|
|
102
|
+
contain<T extends INode>(other: T | null): boolean;
|
|
103
|
+
contains<T extends INode>(other: T | null): boolean;
|
|
104
104
|
getAncestor(n: number): INode | null;
|
|
105
105
|
forEach(callback: (o: INode) => void | boolean): void;
|
|
106
106
|
}
|
package/lib/dom/interfaces.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type EventEmitter from 'eventemitter3';
|
|
2
2
|
import type { AnimationTimeline } from './AnimationTimeline';
|
|
3
|
-
import type { BaseStyleProps,
|
|
3
|
+
import type { BaseStyleProps, SHAPE } from '../types';
|
|
4
4
|
import type { FederatedEvent } from './FederatedEvent';
|
|
5
5
|
import type { CustomElementRegistry } from './CustomElementRegistry';
|
|
6
6
|
import type { DisplayObject } from '..';
|
|
@@ -52,11 +52,11 @@ export interface INode extends IEventTarget {
|
|
|
52
52
|
/**
|
|
53
53
|
* Returns the children.
|
|
54
54
|
*/
|
|
55
|
-
readonly childNodes:
|
|
55
|
+
readonly childNodes: IChildNode[];
|
|
56
56
|
/**
|
|
57
57
|
* Returns the first child.
|
|
58
58
|
*/
|
|
59
|
-
readonly firstChild:
|
|
59
|
+
readonly firstChild: IChildNode | null;
|
|
60
60
|
/**
|
|
61
61
|
* Returns true if node is connected and false otherwise.
|
|
62
62
|
*/
|
|
@@ -64,11 +64,11 @@ export interface INode extends IEventTarget {
|
|
|
64
64
|
/**
|
|
65
65
|
* Returns the last child.
|
|
66
66
|
*/
|
|
67
|
-
readonly lastChild:
|
|
67
|
+
readonly lastChild: IChildNode | null;
|
|
68
68
|
/**
|
|
69
69
|
* Returns the next sibling.
|
|
70
70
|
*/
|
|
71
|
-
readonly nextSibling:
|
|
71
|
+
readonly nextSibling: IChildNode | null;
|
|
72
72
|
/**
|
|
73
73
|
* Returns a string appropriate for the type of node.
|
|
74
74
|
*/
|
|
@@ -93,13 +93,13 @@ export interface INode extends IEventTarget {
|
|
|
93
93
|
/**
|
|
94
94
|
* Returns the previous sibling.
|
|
95
95
|
*/
|
|
96
|
-
readonly previousSibling:
|
|
96
|
+
readonly previousSibling: IChildNode | null;
|
|
97
97
|
textContent: string | null;
|
|
98
|
-
appendChild: <T extends
|
|
98
|
+
appendChild: <T extends INode>(newChild: T, index?: number) => T;
|
|
99
99
|
/**
|
|
100
100
|
* Returns a copy of node. If deep is true, the copy also includes the node's descendants.
|
|
101
101
|
*/
|
|
102
|
-
cloneNode: (deep?: boolean) =>
|
|
102
|
+
cloneNode: (deep?: boolean) => INode;
|
|
103
103
|
/**
|
|
104
104
|
* Returns a bitmask indicating the position of other relative to node.
|
|
105
105
|
*/
|
|
@@ -107,7 +107,7 @@ export interface INode extends IEventTarget {
|
|
|
107
107
|
/**
|
|
108
108
|
* Returns true if other is an inclusive descendant of node, and false otherwise.
|
|
109
109
|
*/
|
|
110
|
-
contains:
|
|
110
|
+
contains: (other: INode | null) => boolean;
|
|
111
111
|
/**
|
|
112
112
|
* Returns node's root.
|
|
113
113
|
*/
|
|
@@ -124,7 +124,7 @@ export interface INode extends IEventTarget {
|
|
|
124
124
|
* Returns whether node has children.
|
|
125
125
|
*/
|
|
126
126
|
hasChildNodes: () => boolean;
|
|
127
|
-
insertBefore: <T extends
|
|
127
|
+
insertBefore: <T extends INode>(newChild: T, refChild: INode | null) => T;
|
|
128
128
|
isDefaultNamespace: (namespace: string | null) => boolean;
|
|
129
129
|
/**
|
|
130
130
|
* Returns whether node and otherNode have the same properties.
|
|
@@ -137,8 +137,8 @@ export interface INode extends IEventTarget {
|
|
|
137
137
|
* Removes empty exclusive Text nodes and concatenates the data of remaining contiguous exclusive Text nodes into the first of their nodes.
|
|
138
138
|
*/
|
|
139
139
|
normalize: () => void;
|
|
140
|
-
removeChild: <T extends
|
|
141
|
-
replaceChild: <T extends
|
|
140
|
+
removeChild: <T extends INode>(oldChild: T, destroy?: boolean) => T;
|
|
141
|
+
replaceChild: <T extends INode>(newChild: INode, oldChild: T, destroy?: boolean) => T;
|
|
142
142
|
/**
|
|
143
143
|
* Destroy itself.
|
|
144
144
|
*/
|
|
@@ -193,13 +193,13 @@ export interface IChildNode extends INode {
|
|
|
193
193
|
*
|
|
194
194
|
* Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
|
|
195
195
|
*/
|
|
196
|
-
after: (...nodes:
|
|
196
|
+
after: (...nodes: INode[]) => void;
|
|
197
197
|
/**
|
|
198
198
|
* Inserts nodes just before node, while replacing strings in nodes with equivalent Text nodes.
|
|
199
199
|
*
|
|
200
200
|
* Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
|
|
201
201
|
*/
|
|
202
|
-
before: (...nodes:
|
|
202
|
+
before: (...nodes: INode[]) => void;
|
|
203
203
|
/**
|
|
204
204
|
* Removes node.
|
|
205
205
|
*/
|
|
@@ -209,7 +209,7 @@ export interface IChildNode extends INode {
|
|
|
209
209
|
*
|
|
210
210
|
* Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
|
|
211
211
|
*/
|
|
212
|
-
replaceWith: (...nodes:
|
|
212
|
+
replaceWith: (...nodes: INode[]) => void;
|
|
213
213
|
}
|
|
214
214
|
export interface DisplayObjectConfig<StyleProps> {
|
|
215
215
|
/**
|
|
@@ -250,7 +250,7 @@ export interface DisplayObjectConfig<StyleProps> {
|
|
|
250
250
|
*/
|
|
251
251
|
interactive?: boolean;
|
|
252
252
|
}
|
|
253
|
-
export interface IElement<StyleProps
|
|
253
|
+
export interface IElement<StyleProps = any, ParsedStyleProps = any> extends INode, IChildNode, IParentNode {
|
|
254
254
|
/**
|
|
255
255
|
* Returns the value of element's id content attribute. Can be set to change it.
|
|
256
256
|
*/
|
package/lib/types.d.ts
CHANGED
|
@@ -192,7 +192,6 @@ export interface CanvasConfig {
|
|
|
192
192
|
cursor?: Cursor;
|
|
193
193
|
[key: string]: any;
|
|
194
194
|
}
|
|
195
|
-
export declare type ChangeType = 'changeSize' | 'add' | 'sort' | 'clear' | 'attr' | 'show' | 'hide' | 'zIndex' | 'remove' | 'matrix' | 'clip';
|
|
196
195
|
declare type A = ['a' | 'A', number, number, number, number, number, number, number];
|
|
197
196
|
declare type C = ['c' | 'C', number, number, number, number, number, number];
|
|
198
197
|
declare type O = ['o' | 'O', number, number];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/g",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.4",
|
|
4
4
|
"description": "A core module including ECS and DI container.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"homepage": "https://github.com/antvis/g#readme",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@antv/g-math": "^1.0.
|
|
40
|
+
"@antv/g-math": "^1.0.4",
|
|
41
41
|
"@antv/path-util": "^2.0.14",
|
|
42
42
|
"@antv/util": "^2.0.13",
|
|
43
43
|
"d3-color": "^1.4.0",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"scripts": {
|
|
51
51
|
"umd": "webpack"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "d88ec3ea3dc2bc52d23debd2070b43dddbd57fea"
|
|
54
54
|
}
|