@antv/g-lite 1.3.0-next.0 → 1.3.0-next.1
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
package/dist/index.js
CHANGED
|
@@ -4922,7 +4922,6 @@ function rectToCommands(width, height, x, y, radius) {
|
|
|
4922
4922
|
/**
|
|
4923
4923
|
* convert object to path, should account for:
|
|
4924
4924
|
* * transform & origin
|
|
4925
|
-
* * anchor
|
|
4926
4925
|
* * lineWidth
|
|
4927
4926
|
*/
|
|
4928
4927
|
function convertToPath(object, transform) {
|
|
@@ -6261,34 +6260,24 @@ var BUILT_IN_PROPERTIES = [
|
|
|
6261
6260
|
l: true,
|
|
6262
6261
|
syntax: exports.PropertySyntax.TRANSFORM_ORIGIN,
|
|
6263
6262
|
},
|
|
6264
|
-
{
|
|
6265
|
-
n: 'anchor',
|
|
6266
|
-
p: 99,
|
|
6267
|
-
d: function (nodeName) {
|
|
6268
|
-
// if (nodeName === Shape.CIRCLE || nodeName === Shape.ELLIPSE) {
|
|
6269
|
-
// return '0.5 0.5';
|
|
6270
|
-
// }
|
|
6271
|
-
return '0 0';
|
|
6272
|
-
},
|
|
6273
|
-
l: true,
|
|
6274
|
-
syntax: exports.PropertySyntax.LENGTH_PERCENTAGE_12,
|
|
6275
|
-
},
|
|
6276
|
-
// <circle> & <ellipse>
|
|
6277
6263
|
{
|
|
6278
6264
|
n: 'cx',
|
|
6279
6265
|
int: true,
|
|
6266
|
+
l: true,
|
|
6280
6267
|
d: '0',
|
|
6281
6268
|
syntax: exports.PropertySyntax.COORDINATE,
|
|
6282
6269
|
},
|
|
6283
6270
|
{
|
|
6284
6271
|
n: 'cy',
|
|
6285
6272
|
int: true,
|
|
6273
|
+
l: true,
|
|
6286
6274
|
d: '0',
|
|
6287
6275
|
syntax: exports.PropertySyntax.COORDINATE,
|
|
6288
6276
|
},
|
|
6289
6277
|
{
|
|
6290
6278
|
n: 'cz',
|
|
6291
6279
|
int: true,
|
|
6280
|
+
l: true,
|
|
6292
6281
|
d: '0',
|
|
6293
6282
|
syntax: exports.PropertySyntax.COORDINATE,
|
|
6294
6283
|
},
|
|
@@ -6318,6 +6307,7 @@ var BUILT_IN_PROPERTIES = [
|
|
|
6318
6307
|
// x in local space
|
|
6319
6308
|
n: 'x',
|
|
6320
6309
|
int: true,
|
|
6310
|
+
l: true,
|
|
6321
6311
|
d: '0',
|
|
6322
6312
|
syntax: exports.PropertySyntax.COORDINATE,
|
|
6323
6313
|
},
|
|
@@ -6325,6 +6315,7 @@ var BUILT_IN_PROPERTIES = [
|
|
|
6325
6315
|
// y in local space
|
|
6326
6316
|
n: 'y',
|
|
6327
6317
|
int: true,
|
|
6318
|
+
l: true,
|
|
6328
6319
|
d: '0',
|
|
6329
6320
|
syntax: exports.PropertySyntax.COORDINATE,
|
|
6330
6321
|
},
|
|
@@ -6332,6 +6323,7 @@ var BUILT_IN_PROPERTIES = [
|
|
|
6332
6323
|
// z in local space
|
|
6333
6324
|
n: 'z',
|
|
6334
6325
|
int: true,
|
|
6326
|
+
l: true,
|
|
6335
6327
|
d: '0',
|
|
6336
6328
|
syntax: exports.PropertySyntax.COORDINATE,
|
|
6337
6329
|
},
|
|
@@ -6695,11 +6687,6 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6695
6687
|
if (attributes.offsetPath) {
|
|
6696
6688
|
this.runtime.CSSPropertySyntaxFactory['<defined-path>'].calculator('offsetPath', oldOffsetPath, attributes.offsetPath, object, this.runtime);
|
|
6697
6689
|
}
|
|
6698
|
-
if (attributes.anchor) {
|
|
6699
|
-
object.parsedStyle.anchor = parseDimensionArrayFormat(
|
|
6700
|
-
// @ts-ignorex
|
|
6701
|
-
attributes.anchor, 2);
|
|
6702
|
-
}
|
|
6703
6690
|
if (attributes.transform) {
|
|
6704
6691
|
object.parsedStyle.transform = parseTransform(attributes.transform);
|
|
6705
6692
|
}
|
|
@@ -6734,14 +6721,6 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6734
6721
|
if (!util.isNil(attributes.zIndex)) {
|
|
6735
6722
|
this.runtime.CSSPropertySyntaxFactory['<z-index>'].postProcessor(object, attributeNames_1);
|
|
6736
6723
|
}
|
|
6737
|
-
// @ts-ignore
|
|
6738
|
-
if (attributes.path) {
|
|
6739
|
-
this.runtime.CSSPropertySyntaxFactory['<path>'].postProcessor(object, attributeNames_1);
|
|
6740
|
-
}
|
|
6741
|
-
// @ts-ignore
|
|
6742
|
-
if (attributes.points) {
|
|
6743
|
-
this.runtime.CSSPropertySyntaxFactory['<list-of-points>'].postProcessor(object, attributeNames_1);
|
|
6744
|
-
}
|
|
6745
6724
|
if (!util.isNil(attributes.offsetDistance)) {
|
|
6746
6725
|
this.runtime.CSSPropertySyntaxFactory['<offset-distance>'].postProcessor(object, attributeNames_1);
|
|
6747
6726
|
}
|
|
@@ -6776,7 +6755,6 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6776
6755
|
// points 50
|
|
6777
6756
|
// text 50
|
|
6778
6757
|
// textTransform 51
|
|
6779
|
-
// anchor 99
|
|
6780
6758
|
// transform 100
|
|
6781
6759
|
// transformOrigin 100
|
|
6782
6760
|
if (usedAttributes === null || usedAttributes === void 0 ? void 0 : usedAttributes.length) {
|
|
@@ -6788,7 +6766,6 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6788
6766
|
// 'points',
|
|
6789
6767
|
// 'text',
|
|
6790
6768
|
// 'textTransform',
|
|
6791
|
-
// 'anchor',
|
|
6792
6769
|
// 'transform',
|
|
6793
6770
|
// 'transformOrigin',
|
|
6794
6771
|
// ].forEach((name) => {
|
|
@@ -7009,7 +6986,7 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
7009
6986
|
geometry_1.renderBounds = new AABB();
|
|
7010
6987
|
}
|
|
7011
6988
|
var parsedStyle = object.parsedStyle;
|
|
7012
|
-
var _a = geometryUpdater.update(parsedStyle, object),
|
|
6989
|
+
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;
|
|
7013
6990
|
// init with content box
|
|
7014
6991
|
var halfExtents = [
|
|
7015
6992
|
Math.abs(hwidth),
|
|
@@ -7023,18 +7000,11 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
7023
7000
|
// depth / 2,
|
|
7024
7001
|
// );
|
|
7025
7002
|
// anchor is center by default, don't account for lineWidth here
|
|
7026
|
-
var
|
|
7003
|
+
var _h = parsedStyle, stroke = _h.stroke, lineWidth = _h.lineWidth,
|
|
7027
7004
|
// lineCap,
|
|
7028
7005
|
// lineJoin,
|
|
7029
7006
|
// miterLimit,
|
|
7030
|
-
increasedLineWidthForHitTesting =
|
|
7031
|
-
// let anchor = parsedStyle.anchor;
|
|
7032
|
-
// <Text> use textAlign & textBaseline instead of anchor
|
|
7033
|
-
// if (nodeName === Shape.TEXT) {
|
|
7034
|
-
// delete parsedStyle.anchor;
|
|
7035
|
-
// } else if (nodeName === Shape.MESH) {
|
|
7036
|
-
// parsedStyle.anchor[2] = 0.5;
|
|
7037
|
-
// }
|
|
7007
|
+
increasedLineWidthForHitTesting = _h.increasedLineWidthForHitTesting, shadowType = _h.shadowType, shadowColor = _h.shadowColor, _j = _h.filter, filter = _j === void 0 ? [] : _j, transformOrigin = _h.transformOrigin;
|
|
7038
7008
|
var center = [cx, cy, cz];
|
|
7039
7009
|
// update geometry's AABB
|
|
7040
7010
|
geometry_1.contentBounds.update(center, halfExtents);
|
|
@@ -7068,8 +7038,8 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
7068
7038
|
geometry_1.renderBounds.update(center, halfExtents);
|
|
7069
7039
|
// account for shadow, only support constant value now
|
|
7070
7040
|
if (shadowColor && shadowType && shadowType !== 'inner') {
|
|
7071
|
-
var
|
|
7072
|
-
var
|
|
7041
|
+
var _k = geometry_1.renderBounds, min = _k.min, max = _k.max;
|
|
7042
|
+
var _l = parsedStyle, shadowBlur = _l.shadowBlur, shadowOffsetX = _l.shadowOffsetX, shadowOffsetY = _l.shadowOffsetY;
|
|
7073
7043
|
var shadowBlurInPixels = shadowBlur || 0;
|
|
7074
7044
|
var shadowOffsetXInPixels = shadowOffsetX || 0;
|
|
7075
7045
|
var shadowOffsetYInPixels = shadowOffsetY || 0;
|
|
@@ -8054,7 +8024,7 @@ var CircleUpdater = /** @class */ (function () {
|
|
|
8054
8024
|
function CircleUpdater() {
|
|
8055
8025
|
}
|
|
8056
8026
|
CircleUpdater.prototype.update = function (parsedStyle, object) {
|
|
8057
|
-
var
|
|
8027
|
+
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;
|
|
8058
8028
|
return {
|
|
8059
8029
|
cx: cx,
|
|
8060
8030
|
cy: cy,
|
|
@@ -8069,7 +8039,7 @@ var EllipseUpdater = /** @class */ (function () {
|
|
|
8069
8039
|
function EllipseUpdater() {
|
|
8070
8040
|
}
|
|
8071
8041
|
EllipseUpdater.prototype.update = function (parsedStyle, object) {
|
|
8072
|
-
var
|
|
8042
|
+
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;
|
|
8073
8043
|
return {
|
|
8074
8044
|
cx: cx,
|
|
8075
8045
|
cy: cy,
|
|
@@ -8157,7 +8127,7 @@ var RectUpdater = /** @class */ (function () {
|
|
|
8157
8127
|
function RectUpdater() {
|
|
8158
8128
|
}
|
|
8159
8129
|
RectUpdater.prototype.update = function (parsedStyle, object) {
|
|
8160
|
-
var
|
|
8130
|
+
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;
|
|
8161
8131
|
var contentWidth = width;
|
|
8162
8132
|
var contentHeight = height;
|
|
8163
8133
|
// resize with HTMLImageElement's size
|
|
@@ -8198,7 +8168,7 @@ var TextUpdater = /** @class */ (function () {
|
|
|
8198
8168
|
};
|
|
8199
8169
|
TextUpdater.prototype.update = function (parsedStyle, object) {
|
|
8200
8170
|
var _a, _b;
|
|
8201
|
-
var text = parsedStyle.text, textAlign = parsedStyle.textAlign, lineWidth = parsedStyle.lineWidth, textBaseline = parsedStyle.textBaseline, dx = parsedStyle.dx, dy = parsedStyle.dy,
|
|
8171
|
+
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;
|
|
8202
8172
|
if (!this.isReadyToMeasure(parsedStyle, object)) {
|
|
8203
8173
|
parsedStyle.metrics = {
|
|
8204
8174
|
font: '',
|
|
@@ -11678,7 +11648,6 @@ var Element = /** @class */ (function (_super) {
|
|
|
11678
11648
|
_this.style = {};
|
|
11679
11649
|
_this.computedStyle = runtime.enableCSSParsing
|
|
11680
11650
|
? {
|
|
11681
|
-
anchor: unsetKeywordValue,
|
|
11682
11651
|
opacity: unsetKeywordValue,
|
|
11683
11652
|
fillOpacity: unsetKeywordValue,
|
|
11684
11653
|
strokeOpacity: unsetKeywordValue,
|
|
@@ -12144,7 +12113,7 @@ var Element = /** @class */ (function (_super) {
|
|
|
12144
12113
|
/**
|
|
12145
12114
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute
|
|
12146
12115
|
*/
|
|
12147
|
-
Element.prototype.setAttribute = function (attributeName, value, force) {
|
|
12116
|
+
Element.prototype.setAttribute = function (attributeName, value, force, memoize) {
|
|
12148
12117
|
this.attributes[attributeName] = value;
|
|
12149
12118
|
};
|
|
12150
12119
|
Element.prototype.getAttributeNS = function (namespace, localName) {
|
|
@@ -12185,7 +12154,6 @@ function isDisplayObject(value) {
|
|
|
12185
12154
|
}
|
|
12186
12155
|
var mutationEvent = new MutationEvent(exports.ElementEvent.ATTR_MODIFIED, null, null, null, null, MutationEvent.MODIFICATION, null, null);
|
|
12187
12156
|
var DEFAULT_STYLE_PROPS = {
|
|
12188
|
-
anchor: '',
|
|
12189
12157
|
opacity: '',
|
|
12190
12158
|
fillOpacity: '',
|
|
12191
12159
|
strokeOpacity: '',
|
|
@@ -12212,7 +12180,6 @@ var DEFAULT_STYLE_PROPS = {
|
|
|
12212
12180
|
shadowType: '',
|
|
12213
12181
|
};
|
|
12214
12182
|
var DEFAULT_PARSED_STYLE_PROPS = {
|
|
12215
|
-
anchor: [0, 0],
|
|
12216
12183
|
fill: noneColor,
|
|
12217
12184
|
stroke: noneColor,
|
|
12218
12185
|
transform: [],
|
|
@@ -13069,7 +13036,6 @@ var Circle = /** @class */ (function (_super) {
|
|
|
13069
13036
|
var style = _a.style, rest = tslib.__rest(_a, ["style"]);
|
|
13070
13037
|
return _super.call(this, tslib.__assign({ type: exports.Shape.CIRCLE, style: runtime.enableCSSParsing
|
|
13071
13038
|
? tslib.__assign({ cx: '', cy: '', r: '' }, style) : tslib.__assign({}, style), initialParsedStyle: {
|
|
13072
|
-
// anchor: [0.5, 0.5],
|
|
13073
13039
|
transformOrigin: runtime.enableCSSParsing
|
|
13074
13040
|
? null
|
|
13075
13041
|
: [PECENTAGE_50, PECENTAGE_50],
|
|
@@ -13090,7 +13056,7 @@ var CustomElement = /** @class */ (function (_super) {
|
|
|
13090
13056
|
var _this = this;
|
|
13091
13057
|
var style = _a.style, rest = tslib.__rest(_a, ["style"]);
|
|
13092
13058
|
_this = _super.call(this, tslib.__assign({ style: runtime.enableCSSParsing
|
|
13093
|
-
? tslib.__assign({
|
|
13059
|
+
? tslib.__assign({}, style) : tslib.__assign({}, style) }, rest)) || this;
|
|
13094
13060
|
// static get observedAttributes(): string[] {
|
|
13095
13061
|
// return [];
|
|
13096
13062
|
// }
|
|
@@ -13107,7 +13073,6 @@ var Ellipse = /** @class */ (function (_super) {
|
|
|
13107
13073
|
var style = _a.style, rest = tslib.__rest(_a, ["style"]);
|
|
13108
13074
|
return _super.call(this, tslib.__assign({ type: exports.Shape.ELLIPSE, style: runtime.enableCSSParsing
|
|
13109
13075
|
? tslib.__assign({ cx: '', cy: '', rx: '', ry: '' }, style) : tslib.__assign({}, style), initialParsedStyle: {
|
|
13110
|
-
// anchor: [0.5, 0.5],
|
|
13111
13076
|
transformOrigin: runtime.enableCSSParsing
|
|
13112
13077
|
? null
|
|
13113
13078
|
: [PECENTAGE_50, PECENTAGE_50],
|
|
@@ -13132,7 +13097,7 @@ var Group = /** @class */ (function (_super) {
|
|
|
13132
13097
|
if (_a === void 0) { _a = {}; }
|
|
13133
13098
|
var style = _a.style, rest = tslib.__rest(_a, ["style"]);
|
|
13134
13099
|
return _super.call(this, tslib.__assign({ type: exports.Shape.GROUP, style: runtime.enableCSSParsing
|
|
13135
|
-
? tslib.__assign({
|
|
13100
|
+
? tslib.__assign({ width: '', height: '' }, style) : tslib.__assign({}, style) }, rest)) || this;
|
|
13136
13101
|
}
|
|
13137
13102
|
return Group;
|
|
13138
13103
|
}(DisplayObject));
|