@antv/g-lite 1.3.0-next.0 → 1.3.0-next.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/dist/display-objects/CustomElement.d.ts +0 -2
- package/dist/display-objects/Group.d.ts +0 -4
- package/dist/dom/Element.d.ts +1 -1
- package/dist/index.esm.js +18 -53
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +18 -53
- package/dist/index.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/types.d.ts +1 -8
- package/dist/utils/path.d.ts +0 -1
- package/package.json +1 -1
|
@@ -2,8 +2,6 @@ import type { DisplayObjectConfig } from '../dom';
|
|
|
2
2
|
import type { BaseStyleProps } from '../types';
|
|
3
3
|
import { DisplayObject } from './DisplayObject';
|
|
4
4
|
export interface BaseCustomElementStyleProps extends BaseStyleProps {
|
|
5
|
-
x?: number | string;
|
|
6
|
-
y?: number | string;
|
|
7
5
|
}
|
|
8
6
|
/**
|
|
9
7
|
* shadow root
|
|
@@ -3,14 +3,10 @@ import type { DisplayObjectConfig } from '../dom';
|
|
|
3
3
|
import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
|
|
4
4
|
import { DisplayObject } from './DisplayObject';
|
|
5
5
|
export interface GroupStyleProps extends BaseStyleProps {
|
|
6
|
-
x?: number | string;
|
|
7
|
-
y?: number | string;
|
|
8
6
|
width?: number | string;
|
|
9
7
|
height?: number | string;
|
|
10
8
|
}
|
|
11
9
|
export interface ParsedGroupStyleProps extends ParsedBaseStyleProps {
|
|
12
|
-
x: CSSUnitValue;
|
|
13
|
-
y: CSSUnitValue;
|
|
14
10
|
width?: CSSUnitValue;
|
|
15
11
|
height?: CSSUnitValue;
|
|
16
12
|
}
|
package/dist/dom/Element.d.ts
CHANGED
|
@@ -192,7 +192,7 @@ export declare class Element<StyleProps extends BaseStyleProps = any, ParsedStyl
|
|
|
192
192
|
/**
|
|
193
193
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute
|
|
194
194
|
*/
|
|
195
|
-
setAttribute<Key extends keyof StyleProps>(attributeName: Key, value: StyleProps[Key], force?: boolean): void;
|
|
195
|
+
setAttribute<Key extends keyof StyleProps>(attributeName: Key, value: StyleProps[Key], force?: boolean, memoize?: boolean): void;
|
|
196
196
|
getAttributeNS(namespace: string, localName: string): string;
|
|
197
197
|
getAttributeNode(qualifiedName: string): Attr;
|
|
198
198
|
getAttributeNodeNS(namespace: string, localName: string): Attr;
|
package/dist/index.esm.js
CHANGED
|
@@ -4901,7 +4901,6 @@ function rectToCommands(width, height, x, y, radius) {
|
|
|
4901
4901
|
/**
|
|
4902
4902
|
* convert object to path, should account for:
|
|
4903
4903
|
* * transform & origin
|
|
4904
|
-
* * anchor
|
|
4905
4904
|
* * lineWidth
|
|
4906
4905
|
*/
|
|
4907
4906
|
function convertToPath(object, transform) {
|
|
@@ -6240,34 +6239,24 @@ var BUILT_IN_PROPERTIES = [
|
|
|
6240
6239
|
l: true,
|
|
6241
6240
|
syntax: PropertySyntax.TRANSFORM_ORIGIN,
|
|
6242
6241
|
},
|
|
6243
|
-
{
|
|
6244
|
-
n: 'anchor',
|
|
6245
|
-
p: 99,
|
|
6246
|
-
d: function (nodeName) {
|
|
6247
|
-
// if (nodeName === Shape.CIRCLE || nodeName === Shape.ELLIPSE) {
|
|
6248
|
-
// return '0.5 0.5';
|
|
6249
|
-
// }
|
|
6250
|
-
return '0 0';
|
|
6251
|
-
},
|
|
6252
|
-
l: true,
|
|
6253
|
-
syntax: PropertySyntax.LENGTH_PERCENTAGE_12,
|
|
6254
|
-
},
|
|
6255
|
-
// <circle> & <ellipse>
|
|
6256
6242
|
{
|
|
6257
6243
|
n: 'cx',
|
|
6258
6244
|
int: true,
|
|
6245
|
+
l: true,
|
|
6259
6246
|
d: '0',
|
|
6260
6247
|
syntax: PropertySyntax.COORDINATE,
|
|
6261
6248
|
},
|
|
6262
6249
|
{
|
|
6263
6250
|
n: 'cy',
|
|
6264
6251
|
int: true,
|
|
6252
|
+
l: true,
|
|
6265
6253
|
d: '0',
|
|
6266
6254
|
syntax: PropertySyntax.COORDINATE,
|
|
6267
6255
|
},
|
|
6268
6256
|
{
|
|
6269
6257
|
n: 'cz',
|
|
6270
6258
|
int: true,
|
|
6259
|
+
l: true,
|
|
6271
6260
|
d: '0',
|
|
6272
6261
|
syntax: PropertySyntax.COORDINATE,
|
|
6273
6262
|
},
|
|
@@ -6297,6 +6286,7 @@ var BUILT_IN_PROPERTIES = [
|
|
|
6297
6286
|
// x in local space
|
|
6298
6287
|
n: 'x',
|
|
6299
6288
|
int: true,
|
|
6289
|
+
l: true,
|
|
6300
6290
|
d: '0',
|
|
6301
6291
|
syntax: PropertySyntax.COORDINATE,
|
|
6302
6292
|
},
|
|
@@ -6304,6 +6294,7 @@ var BUILT_IN_PROPERTIES = [
|
|
|
6304
6294
|
// y in local space
|
|
6305
6295
|
n: 'y',
|
|
6306
6296
|
int: true,
|
|
6297
|
+
l: true,
|
|
6307
6298
|
d: '0',
|
|
6308
6299
|
syntax: PropertySyntax.COORDINATE,
|
|
6309
6300
|
},
|
|
@@ -6311,6 +6302,7 @@ var BUILT_IN_PROPERTIES = [
|
|
|
6311
6302
|
// z in local space
|
|
6312
6303
|
n: 'z',
|
|
6313
6304
|
int: true,
|
|
6305
|
+
l: true,
|
|
6314
6306
|
d: '0',
|
|
6315
6307
|
syntax: PropertySyntax.COORDINATE,
|
|
6316
6308
|
},
|
|
@@ -6674,11 +6666,6 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6674
6666
|
if (attributes.offsetPath) {
|
|
6675
6667
|
this.runtime.CSSPropertySyntaxFactory['<defined-path>'].calculator('offsetPath', oldOffsetPath, attributes.offsetPath, object, this.runtime);
|
|
6676
6668
|
}
|
|
6677
|
-
if (attributes.anchor) {
|
|
6678
|
-
object.parsedStyle.anchor = parseDimensionArrayFormat(
|
|
6679
|
-
// @ts-ignorex
|
|
6680
|
-
attributes.anchor, 2);
|
|
6681
|
-
}
|
|
6682
6669
|
if (attributes.transform) {
|
|
6683
6670
|
object.parsedStyle.transform = parseTransform(attributes.transform);
|
|
6684
6671
|
}
|
|
@@ -6713,14 +6700,6 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6713
6700
|
if (!isNil(attributes.zIndex)) {
|
|
6714
6701
|
this.runtime.CSSPropertySyntaxFactory['<z-index>'].postProcessor(object, attributeNames_1);
|
|
6715
6702
|
}
|
|
6716
|
-
// @ts-ignore
|
|
6717
|
-
if (attributes.path) {
|
|
6718
|
-
this.runtime.CSSPropertySyntaxFactory['<path>'].postProcessor(object, attributeNames_1);
|
|
6719
|
-
}
|
|
6720
|
-
// @ts-ignore
|
|
6721
|
-
if (attributes.points) {
|
|
6722
|
-
this.runtime.CSSPropertySyntaxFactory['<list-of-points>'].postProcessor(object, attributeNames_1);
|
|
6723
|
-
}
|
|
6724
6703
|
if (!isNil(attributes.offsetDistance)) {
|
|
6725
6704
|
this.runtime.CSSPropertySyntaxFactory['<offset-distance>'].postProcessor(object, attributeNames_1);
|
|
6726
6705
|
}
|
|
@@ -6755,7 +6734,6 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6755
6734
|
// points 50
|
|
6756
6735
|
// text 50
|
|
6757
6736
|
// textTransform 51
|
|
6758
|
-
// anchor 99
|
|
6759
6737
|
// transform 100
|
|
6760
6738
|
// transformOrigin 100
|
|
6761
6739
|
if (usedAttributes === null || usedAttributes === void 0 ? void 0 : usedAttributes.length) {
|
|
@@ -6767,7 +6745,6 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6767
6745
|
// 'points',
|
|
6768
6746
|
// 'text',
|
|
6769
6747
|
// 'textTransform',
|
|
6770
|
-
// 'anchor',
|
|
6771
6748
|
// 'transform',
|
|
6772
6749
|
// 'transformOrigin',
|
|
6773
6750
|
// ].forEach((name) => {
|
|
@@ -6988,7 +6965,7 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6988
6965
|
geometry_1.renderBounds = new AABB();
|
|
6989
6966
|
}
|
|
6990
6967
|
var parsedStyle = object.parsedStyle;
|
|
6991
|
-
var _a = geometryUpdater.update(parsedStyle, object),
|
|
6968
|
+
var _a = geometryUpdater.update(parsedStyle, object), _b = _a.cx, cx = _b === void 0 ? 0 : _b, _c = _a.cy, cy = _c === void 0 ? 0 : _c, _d = _a.cz, cz = _d === void 0 ? 0 : _d, _e = _a.hwidth, hwidth = _e === void 0 ? 0 : _e, _f = _a.hheight, hheight = _f === void 0 ? 0 : _f, _g = _a.hdepth, hdepth = _g === void 0 ? 0 : _g;
|
|
6992
6969
|
// init with content box
|
|
6993
6970
|
var halfExtents = [
|
|
6994
6971
|
Math.abs(hwidth),
|
|
@@ -7002,18 +6979,11 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
7002
6979
|
// depth / 2,
|
|
7003
6980
|
// );
|
|
7004
6981
|
// anchor is center by default, don't account for lineWidth here
|
|
7005
|
-
var
|
|
6982
|
+
var _h = parsedStyle, stroke = _h.stroke, lineWidth = _h.lineWidth,
|
|
7006
6983
|
// lineCap,
|
|
7007
6984
|
// lineJoin,
|
|
7008
6985
|
// miterLimit,
|
|
7009
|
-
increasedLineWidthForHitTesting =
|
|
7010
|
-
// let anchor = parsedStyle.anchor;
|
|
7011
|
-
// <Text> use textAlign & textBaseline instead of anchor
|
|
7012
|
-
// if (nodeName === Shape.TEXT) {
|
|
7013
|
-
// delete parsedStyle.anchor;
|
|
7014
|
-
// } else if (nodeName === Shape.MESH) {
|
|
7015
|
-
// parsedStyle.anchor[2] = 0.5;
|
|
7016
|
-
// }
|
|
6986
|
+
increasedLineWidthForHitTesting = _h.increasedLineWidthForHitTesting, shadowType = _h.shadowType, shadowColor = _h.shadowColor, _j = _h.filter, filter = _j === void 0 ? [] : _j, transformOrigin = _h.transformOrigin;
|
|
7017
6987
|
var center = [cx, cy, cz];
|
|
7018
6988
|
// update geometry's AABB
|
|
7019
6989
|
geometry_1.contentBounds.update(center, halfExtents);
|
|
@@ -7047,8 +7017,8 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
7047
7017
|
geometry_1.renderBounds.update(center, halfExtents);
|
|
7048
7018
|
// account for shadow, only support constant value now
|
|
7049
7019
|
if (shadowColor && shadowType && shadowType !== 'inner') {
|
|
7050
|
-
var
|
|
7051
|
-
var
|
|
7020
|
+
var _k = geometry_1.renderBounds, min = _k.min, max = _k.max;
|
|
7021
|
+
var _l = parsedStyle, shadowBlur = _l.shadowBlur, shadowOffsetX = _l.shadowOffsetX, shadowOffsetY = _l.shadowOffsetY;
|
|
7052
7022
|
var shadowBlurInPixels = shadowBlur || 0;
|
|
7053
7023
|
var shadowOffsetXInPixels = shadowOffsetX || 0;
|
|
7054
7024
|
var shadowOffsetYInPixels = shadowOffsetY || 0;
|
|
@@ -8033,7 +8003,7 @@ var CircleUpdater = /** @class */ (function () {
|
|
|
8033
8003
|
function CircleUpdater() {
|
|
8034
8004
|
}
|
|
8035
8005
|
CircleUpdater.prototype.update = function (parsedStyle, object) {
|
|
8036
|
-
var
|
|
8006
|
+
var _a = parsedStyle.cx, cx = _a === void 0 ? 0 : _a, _b = parsedStyle.cy, cy = _b === void 0 ? 0 : _b, _c = parsedStyle.r, r = _c === void 0 ? 0 : _c;
|
|
8037
8007
|
return {
|
|
8038
8008
|
cx: cx,
|
|
8039
8009
|
cy: cy,
|
|
@@ -8048,7 +8018,7 @@ var EllipseUpdater = /** @class */ (function () {
|
|
|
8048
8018
|
function EllipseUpdater() {
|
|
8049
8019
|
}
|
|
8050
8020
|
EllipseUpdater.prototype.update = function (parsedStyle, object) {
|
|
8051
|
-
var
|
|
8021
|
+
var _a = parsedStyle.cx, cx = _a === void 0 ? 0 : _a, _b = parsedStyle.cy, cy = _b === void 0 ? 0 : _b, _c = parsedStyle.rx, rx = _c === void 0 ? 0 : _c, _d = parsedStyle.ry, ry = _d === void 0 ? 0 : _d;
|
|
8052
8022
|
return {
|
|
8053
8023
|
cx: cx,
|
|
8054
8024
|
cy: cy,
|
|
@@ -8136,7 +8106,7 @@ var RectUpdater = /** @class */ (function () {
|
|
|
8136
8106
|
function RectUpdater() {
|
|
8137
8107
|
}
|
|
8138
8108
|
RectUpdater.prototype.update = function (parsedStyle, object) {
|
|
8139
|
-
var
|
|
8109
|
+
var _a = parsedStyle.x, x = _a === void 0 ? 0 : _a, _b = parsedStyle.y, y = _b === void 0 ? 0 : _b, img = parsedStyle.img, _c = parsedStyle.width, width = _c === void 0 ? 0 : _c, _d = parsedStyle.height, height = _d === void 0 ? 0 : _d;
|
|
8140
8110
|
var contentWidth = width;
|
|
8141
8111
|
var contentHeight = height;
|
|
8142
8112
|
// resize with HTMLImageElement's size
|
|
@@ -8177,7 +8147,7 @@ var TextUpdater = /** @class */ (function () {
|
|
|
8177
8147
|
};
|
|
8178
8148
|
TextUpdater.prototype.update = function (parsedStyle, object) {
|
|
8179
8149
|
var _a, _b;
|
|
8180
|
-
var text = parsedStyle.text, textAlign = parsedStyle.textAlign, lineWidth = parsedStyle.lineWidth, textBaseline = parsedStyle.textBaseline, dx = parsedStyle.dx, dy = parsedStyle.dy,
|
|
8150
|
+
var text = parsedStyle.text, textAlign = parsedStyle.textAlign, lineWidth = parsedStyle.lineWidth, textBaseline = parsedStyle.textBaseline, dx = parsedStyle.dx, dy = parsedStyle.dy, _c = parsedStyle.x, x = _c === void 0 ? 0 : _c, _d = parsedStyle.y, y = _d === void 0 ? 0 : _d;
|
|
8181
8151
|
if (!this.isReadyToMeasure(parsedStyle, object)) {
|
|
8182
8152
|
parsedStyle.metrics = {
|
|
8183
8153
|
font: '',
|
|
@@ -11657,7 +11627,6 @@ var Element = /** @class */ (function (_super) {
|
|
|
11657
11627
|
_this.style = {};
|
|
11658
11628
|
_this.computedStyle = runtime.enableCSSParsing
|
|
11659
11629
|
? {
|
|
11660
|
-
anchor: unsetKeywordValue,
|
|
11661
11630
|
opacity: unsetKeywordValue,
|
|
11662
11631
|
fillOpacity: unsetKeywordValue,
|
|
11663
11632
|
strokeOpacity: unsetKeywordValue,
|
|
@@ -12123,7 +12092,7 @@ var Element = /** @class */ (function (_super) {
|
|
|
12123
12092
|
/**
|
|
12124
12093
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute
|
|
12125
12094
|
*/
|
|
12126
|
-
Element.prototype.setAttribute = function (attributeName, value, force) {
|
|
12095
|
+
Element.prototype.setAttribute = function (attributeName, value, force, memoize) {
|
|
12127
12096
|
this.attributes[attributeName] = value;
|
|
12128
12097
|
};
|
|
12129
12098
|
Element.prototype.getAttributeNS = function (namespace, localName) {
|
|
@@ -12164,7 +12133,6 @@ function isDisplayObject(value) {
|
|
|
12164
12133
|
}
|
|
12165
12134
|
var mutationEvent = new MutationEvent(ElementEvent.ATTR_MODIFIED, null, null, null, null, MutationEvent.MODIFICATION, null, null);
|
|
12166
12135
|
var DEFAULT_STYLE_PROPS = {
|
|
12167
|
-
anchor: '',
|
|
12168
12136
|
opacity: '',
|
|
12169
12137
|
fillOpacity: '',
|
|
12170
12138
|
strokeOpacity: '',
|
|
@@ -12191,7 +12159,6 @@ var DEFAULT_STYLE_PROPS = {
|
|
|
12191
12159
|
shadowType: '',
|
|
12192
12160
|
};
|
|
12193
12161
|
var DEFAULT_PARSED_STYLE_PROPS = {
|
|
12194
|
-
anchor: [0, 0],
|
|
12195
12162
|
fill: noneColor,
|
|
12196
12163
|
stroke: noneColor,
|
|
12197
12164
|
transform: [],
|
|
@@ -13048,7 +13015,6 @@ var Circle = /** @class */ (function (_super) {
|
|
|
13048
13015
|
var style = _a.style, rest = __rest(_a, ["style"]);
|
|
13049
13016
|
return _super.call(this, __assign({ type: Shape.CIRCLE, style: runtime.enableCSSParsing
|
|
13050
13017
|
? __assign({ cx: '', cy: '', r: '' }, style) : __assign({}, style), initialParsedStyle: {
|
|
13051
|
-
// anchor: [0.5, 0.5],
|
|
13052
13018
|
transformOrigin: runtime.enableCSSParsing
|
|
13053
13019
|
? null
|
|
13054
13020
|
: [PECENTAGE_50, PECENTAGE_50],
|
|
@@ -13069,7 +13035,7 @@ var CustomElement = /** @class */ (function (_super) {
|
|
|
13069
13035
|
var _this = this;
|
|
13070
13036
|
var style = _a.style, rest = __rest(_a, ["style"]);
|
|
13071
13037
|
_this = _super.call(this, __assign({ style: runtime.enableCSSParsing
|
|
13072
|
-
? __assign({
|
|
13038
|
+
? __assign({}, style) : __assign({}, style) }, rest)) || this;
|
|
13073
13039
|
// static get observedAttributes(): string[] {
|
|
13074
13040
|
// return [];
|
|
13075
13041
|
// }
|
|
@@ -13086,7 +13052,6 @@ var Ellipse = /** @class */ (function (_super) {
|
|
|
13086
13052
|
var style = _a.style, rest = __rest(_a, ["style"]);
|
|
13087
13053
|
return _super.call(this, __assign({ type: Shape.ELLIPSE, style: runtime.enableCSSParsing
|
|
13088
13054
|
? __assign({ cx: '', cy: '', rx: '', ry: '' }, style) : __assign({}, style), initialParsedStyle: {
|
|
13089
|
-
// anchor: [0.5, 0.5],
|
|
13090
13055
|
transformOrigin: runtime.enableCSSParsing
|
|
13091
13056
|
? null
|
|
13092
13057
|
: [PECENTAGE_50, PECENTAGE_50],
|
|
@@ -13111,7 +13076,7 @@ var Group = /** @class */ (function (_super) {
|
|
|
13111
13076
|
if (_a === void 0) { _a = {}; }
|
|
13112
13077
|
var style = _a.style, rest = __rest(_a, ["style"]);
|
|
13113
13078
|
return _super.call(this, __assign({ type: Shape.GROUP, style: runtime.enableCSSParsing
|
|
13114
|
-
? __assign({
|
|
13079
|
+
? __assign({ width: '', height: '' }, style) : __assign({}, style) }, rest)) || this;
|
|
13115
13080
|
}
|
|
13116
13081
|
return Group;
|
|
13117
13082
|
}(DisplayObject));
|