@antv/g-lite 2.2.1 → 2.2.3
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.esm.js +53 -31
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +53 -31
- package/dist/index.js.map +1 -1
- package/dist/index.umd.min.js +5 -5
- package/dist/index.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/types/css/StyleValueRegistry.d.ts +1 -1
- package/types/css/StyleValueRegistry.d.ts.map +1 -1
- package/types/display-objects/Circle.d.ts +1 -0
- package/types/display-objects/Circle.d.ts.map +1 -1
- package/types/display-objects/CustomElement.d.ts.map +1 -1
- package/types/display-objects/DisplayObject.d.ts +1 -0
- package/types/display-objects/DisplayObject.d.ts.map +1 -1
- package/types/display-objects/Ellipse.d.ts +1 -0
- package/types/display-objects/Ellipse.d.ts.map +1 -1
- package/types/display-objects/Group.d.ts +1 -0
- package/types/display-objects/Group.d.ts.map +1 -1
- package/types/display-objects/HTML.d.ts +1 -0
- package/types/display-objects/HTML.d.ts.map +1 -1
- package/types/display-objects/Image.d.ts +1 -0
- package/types/display-objects/Image.d.ts.map +1 -1
- package/types/display-objects/Line.d.ts +1 -0
- package/types/display-objects/Line.d.ts.map +1 -1
- package/types/display-objects/Path.d.ts +1 -0
- package/types/display-objects/Path.d.ts.map +1 -1
- package/types/display-objects/Polygon.d.ts +1 -0
- package/types/display-objects/Polygon.d.ts.map +1 -1
- package/types/display-objects/Polyline.d.ts +1 -0
- package/types/display-objects/Polyline.d.ts.map +1 -1
- package/types/display-objects/Rect.d.ts +1 -0
- package/types/display-objects/Rect.d.ts.map +1 -1
- package/types/display-objects/Text.d.ts +1 -0
- package/types/display-objects/Text.d.ts.map +1 -1
- package/types/global-runtime.d.ts +5 -0
- package/types/global-runtime.d.ts.map +1 -1
- package/types/services/TextService.d.ts +0 -1
- package/types/services/TextService.d.ts.map +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @antv/g-lite
|
|
3
3
|
* @description A core module for rendering engine implements DOM API.
|
|
4
|
-
* @version 2.2.
|
|
5
|
-
* @date 11/
|
|
4
|
+
* @version 2.2.3
|
|
5
|
+
* @date 11/14/2024, 8:16:02 AM
|
|
6
6
|
* @author AntVis
|
|
7
7
|
* @docs https://g.antv.antgroup.com/
|
|
8
8
|
*/
|
|
@@ -6392,7 +6392,7 @@ var DefaultStyleValueRegistry = /*#__PURE__*/function () {
|
|
|
6392
6392
|
// clipPath
|
|
6393
6393
|
var oldClipPath = object.parsedStyle.clipPath;
|
|
6394
6394
|
var oldOffsetPath = object.parsedStyle.offsetPath;
|
|
6395
|
-
|
|
6395
|
+
assignParsedStyle(object, attributes);
|
|
6396
6396
|
var needUpdateGeometry = !!options.forceUpdateGeometry;
|
|
6397
6397
|
if (!needUpdateGeometry) {
|
|
6398
6398
|
for (var i in attributes) {
|
|
@@ -6653,6 +6653,18 @@ var DefaultStyleValueRegistry = /*#__PURE__*/function () {
|
|
|
6653
6653
|
}
|
|
6654
6654
|
}]);
|
|
6655
6655
|
}();
|
|
6656
|
+
function assignParsedStyle(object, attributes) {
|
|
6657
|
+
if (!runtime.enableMassiveParsedStyleAssignOptimization) {
|
|
6658
|
+
Object.assign(object.parsedStyle, attributes);
|
|
6659
|
+
return;
|
|
6660
|
+
}
|
|
6661
|
+
var list = object.constructor.PARSED_STYLE_LIST;
|
|
6662
|
+
for (var key in attributes) {
|
|
6663
|
+
if (list.has(key)) {
|
|
6664
|
+
object.parsedStyle[key] = attributes[key];
|
|
6665
|
+
}
|
|
6666
|
+
}
|
|
6667
|
+
}
|
|
6656
6668
|
|
|
6657
6669
|
var CSSPropertyAngle = /*#__PURE__*/function () {
|
|
6658
6670
|
function CSSPropertyAngle() {
|
|
@@ -11456,9 +11468,6 @@ var TextService = /*#__PURE__*/function () {
|
|
|
11456
11468
|
};
|
|
11457
11469
|
}
|
|
11458
11470
|
}
|
|
11459
|
-
}, {
|
|
11460
|
-
key: "setGraphemeOnPath",
|
|
11461
|
-
value: function setGraphemeOnPath() {}
|
|
11462
11471
|
}, {
|
|
11463
11472
|
key: "wordWrap",
|
|
11464
11473
|
value: function wordWrap(text, parsedStyle, offscreenCanvas) {
|
|
@@ -11488,6 +11497,27 @@ var TextService = /*#__PURE__*/function () {
|
|
|
11488
11497
|
var ellipsisWidth = Array.from(ellipsis).reduce(function (prev, cur) {
|
|
11489
11498
|
return prev + calcWidth(cur);
|
|
11490
11499
|
}, 0);
|
|
11500
|
+
function appendEllipsis(lineIndex) {
|
|
11501
|
+
// If there is not enough space to display the string itself, it is clipped.
|
|
11502
|
+
// @see https://developer.mozilla.org/en-US/docs/Web/CSS/text-overflow#values
|
|
11503
|
+
if (ellipsisWidth <= 0 || ellipsisWidth > maxWidth) {
|
|
11504
|
+
return;
|
|
11505
|
+
}
|
|
11506
|
+
|
|
11507
|
+
// Backspace from line's end.
|
|
11508
|
+
var currentLineLength = lines[lineIndex].length;
|
|
11509
|
+
var lastLineWidth = 0;
|
|
11510
|
+
var lastLineIndex = currentLineLength;
|
|
11511
|
+
for (var i = 0; i < currentLineLength; i++) {
|
|
11512
|
+
var width = calcWidth(lines[lineIndex][i]);
|
|
11513
|
+
if (lastLineWidth + width + ellipsisWidth > maxWidth) {
|
|
11514
|
+
lastLineIndex = i;
|
|
11515
|
+
break;
|
|
11516
|
+
}
|
|
11517
|
+
lastLineWidth += width;
|
|
11518
|
+
}
|
|
11519
|
+
lines[lineIndex] = (lines[lineIndex] || '').slice(0, lastLineIndex) + ellipsis;
|
|
11520
|
+
}
|
|
11491
11521
|
var chars = Array.from(text);
|
|
11492
11522
|
for (var i = 0; i < chars.length; i++) {
|
|
11493
11523
|
var _char3 = chars[i];
|
|
@@ -11500,6 +11530,9 @@ var TextService = /*#__PURE__*/function () {
|
|
|
11500
11530
|
// exceed maxLines, break immediately
|
|
11501
11531
|
if (currentIndex >= maxLines) {
|
|
11502
11532
|
parsedStyle.isOverflowing = true;
|
|
11533
|
+
if (i < chars.length - 1) {
|
|
11534
|
+
appendEllipsis(currentIndex - 1);
|
|
11535
|
+
}
|
|
11503
11536
|
break;
|
|
11504
11537
|
}
|
|
11505
11538
|
currentWidth = 0;
|
|
@@ -11509,24 +11542,7 @@ var TextService = /*#__PURE__*/function () {
|
|
|
11509
11542
|
if (currentWidth > 0 && currentWidth + charWidth > maxWidth) {
|
|
11510
11543
|
if (currentIndex + 1 >= maxLines) {
|
|
11511
11544
|
parsedStyle.isOverflowing = true;
|
|
11512
|
-
|
|
11513
|
-
// If there is not enough space to display the string itself, it is clipped.
|
|
11514
|
-
// @see https://developer.mozilla.org/en-US/docs/Web/CSS/text-overflow#values
|
|
11515
|
-
if (ellipsisWidth > 0 && ellipsisWidth <= maxWidth) {
|
|
11516
|
-
// Backspace from line's end.
|
|
11517
|
-
var currentLineLength = lines[currentIndex].length;
|
|
11518
|
-
var lastLineWidth = 0;
|
|
11519
|
-
var lastLineIndex = currentLineLength;
|
|
11520
|
-
for (var _i2 = 0; _i2 < currentLineLength; _i2++) {
|
|
11521
|
-
var width = calcWidth(lines[currentIndex][_i2]);
|
|
11522
|
-
if (lastLineWidth + width + ellipsisWidth > maxWidth) {
|
|
11523
|
-
lastLineIndex = _i2;
|
|
11524
|
-
break;
|
|
11525
|
-
}
|
|
11526
|
-
lastLineWidth += width;
|
|
11527
|
-
}
|
|
11528
|
-
lines[currentIndex] = (lines[currentIndex] || '').slice(0, lastLineIndex) + ellipsis;
|
|
11529
|
-
}
|
|
11545
|
+
appendEllipsis(currentIndex);
|
|
11530
11546
|
break;
|
|
11531
11547
|
}
|
|
11532
11548
|
currentIndex++;
|
|
@@ -11623,7 +11639,7 @@ var runtime = {};
|
|
|
11623
11639
|
var geometryUpdaterFactory = function (_ref) {
|
|
11624
11640
|
var rectUpdater = new RectUpdater();
|
|
11625
11641
|
var polylineUpdater = new PolylineUpdater();
|
|
11626
|
-
return _ref = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_ref, Shape.CIRCLE, new CircleUpdater()), Shape.ELLIPSE, new EllipseUpdater()), Shape.RECT, rectUpdater), Shape.IMAGE, rectUpdater), Shape.GROUP, new GroupUpdater()), Shape.LINE, new LineUpdater()), Shape.TEXT, new TextUpdater(runtime)), Shape.POLYLINE, polylineUpdater), Shape.POLYGON, polylineUpdater), Shape.PATH, new PathUpdater()),
|
|
11642
|
+
return _ref = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_ref, Shape.FRAGMENT, null), Shape.CIRCLE, new CircleUpdater()), Shape.ELLIPSE, new EllipseUpdater()), Shape.RECT, rectUpdater), Shape.IMAGE, rectUpdater), Shape.GROUP, new GroupUpdater()), Shape.LINE, new LineUpdater()), Shape.TEXT, new TextUpdater(runtime)), Shape.POLYLINE, polylineUpdater), Shape.POLYGON, polylineUpdater), _defineProperty(_defineProperty(_defineProperty(_ref, Shape.PATH, new PathUpdater()), Shape.HTML, new HTMLUpdater()), Shape.MESH, null);
|
|
11627
11643
|
}();
|
|
11628
11644
|
var CSSPropertySyntaxFactory = function (_ref2) {
|
|
11629
11645
|
var color = new CSSPropertyColor();
|
|
@@ -12380,9 +12396,6 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
12380
12396
|
|
|
12381
12397
|
// assign name, id to config
|
|
12382
12398
|
// eg. group.get('name')
|
|
12383
|
-
/**
|
|
12384
|
-
* contains style props in constructor's params, eg. fill, stroke...
|
|
12385
|
-
*/
|
|
12386
12399
|
_this.isCustomElement = false;
|
|
12387
12400
|
_this.isMutationObserved = false;
|
|
12388
12401
|
/**
|
|
@@ -13178,6 +13191,7 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
13178
13191
|
// #endregion deprecated
|
|
13179
13192
|
}]);
|
|
13180
13193
|
}(Element);
|
|
13194
|
+
DisplayObject.PARSED_STYLE_LIST = new Set(['class', 'className', 'clipPath', 'cursor', 'display', 'draggable', 'droppable', 'fill', 'fillOpacity', 'fillRule', 'filter', 'increasedLineWidthForHitTesting', 'lineCap', 'lineDash', 'lineDashOffset', 'lineJoin', 'lineWidth', 'miterLimit', 'hitArea', 'offsetDistance', 'offsetPath', 'offsetX', 'offsetY', 'opacity', 'pointerEvents', 'shadowColor', 'shadowType', 'shadowBlur', 'shadowOffsetX', 'shadowOffsetY', 'stroke', 'strokeOpacity', 'strokeWidth', 'strokeLinecap', 'strokeLineJoin', 'strokeDasharray', 'strokeDashoffset', 'transform', 'transformOrigin', 'textTransform', 'visibility', 'zIndex']);
|
|
13181
13195
|
|
|
13182
13196
|
var Circle = /*#__PURE__*/function (_DisplayObject) {
|
|
13183
13197
|
function Circle() {
|
|
@@ -13190,6 +13204,7 @@ var Circle = /*#__PURE__*/function (_DisplayObject) {
|
|
|
13190
13204
|
_inherits(Circle, _DisplayObject);
|
|
13191
13205
|
return _createClass(Circle);
|
|
13192
13206
|
}(DisplayObject);
|
|
13207
|
+
Circle.PARSED_STYLE_LIST = new Set([].concat(_toConsumableArray(DisplayObject.PARSED_STYLE_LIST), ['cx', 'cy', 'cz', 'r', 'isBillboard', 'isSizeAttenuation']));
|
|
13193
13208
|
|
|
13194
13209
|
var _excluded$6 = ["style"];
|
|
13195
13210
|
/**
|
|
@@ -13208,9 +13223,6 @@ var CustomElement = /*#__PURE__*/function (_DisplayObject) {
|
|
|
13208
13223
|
_this = _callSuper(this, CustomElement, [_objectSpread({
|
|
13209
13224
|
style: style
|
|
13210
13225
|
}, rest)]);
|
|
13211
|
-
// static get observedAttributes(): string[] {
|
|
13212
|
-
// return [];
|
|
13213
|
-
// }
|
|
13214
13226
|
_this.isCustomElement = true;
|
|
13215
13227
|
return _this;
|
|
13216
13228
|
}
|
|
@@ -13233,6 +13245,7 @@ var Ellipse = /*#__PURE__*/function (_DisplayObject) {
|
|
|
13233
13245
|
_inherits(Ellipse, _DisplayObject);
|
|
13234
13246
|
return _createClass(Ellipse);
|
|
13235
13247
|
}(DisplayObject);
|
|
13248
|
+
Ellipse.PARSED_STYLE_LIST = new Set([].concat(_toConsumableArray(DisplayObject.PARSED_STYLE_LIST), ['cx', 'cy', 'cz', 'rx', 'ry', 'isBillboard', 'isSizeAttenuation']));
|
|
13236
13249
|
|
|
13237
13250
|
/**
|
|
13238
13251
|
* 节点片段,用于包裹多个节点并批量操作
|
|
@@ -13275,6 +13288,7 @@ var Group = /*#__PURE__*/function (_DisplayObject) {
|
|
|
13275
13288
|
_inherits(Group, _DisplayObject);
|
|
13276
13289
|
return _createClass(Group);
|
|
13277
13290
|
}(DisplayObject);
|
|
13291
|
+
Group.PARSED_STYLE_LIST = new Set([].concat(_toConsumableArray(DisplayObject.PARSED_STYLE_LIST), ['width', 'height']));
|
|
13278
13292
|
|
|
13279
13293
|
var _excluded$5 = ["style"];
|
|
13280
13294
|
/**
|
|
@@ -13361,6 +13375,7 @@ var HTML = /*#__PURE__*/function (_DisplayObject) {
|
|
|
13361
13375
|
}
|
|
13362
13376
|
}]);
|
|
13363
13377
|
}(DisplayObject);
|
|
13378
|
+
HTML.PARSED_STYLE_LIST = new Set([].concat(_toConsumableArray(DisplayObject.PARSED_STYLE_LIST), ['x', 'y', '$el', 'innerHTML', 'width', 'height']));
|
|
13364
13379
|
|
|
13365
13380
|
var Image = /*#__PURE__*/function (_DisplayObject) {
|
|
13366
13381
|
function Image() {
|
|
@@ -13373,6 +13388,7 @@ var Image = /*#__PURE__*/function (_DisplayObject) {
|
|
|
13373
13388
|
_inherits(Image, _DisplayObject);
|
|
13374
13389
|
return _createClass(Image);
|
|
13375
13390
|
}(DisplayObject);
|
|
13391
|
+
Image.PARSED_STYLE_LIST = new Set([].concat(_toConsumableArray(DisplayObject.PARSED_STYLE_LIST), ['x', 'y', 'z', 'src', 'width', 'height', 'isBillboard', 'billboardRotation', 'isSizeAttenuation', 'keepAspectRatio']));
|
|
13376
13392
|
|
|
13377
13393
|
var _excluded$4 = ["style"];
|
|
13378
13394
|
/**
|
|
@@ -13528,6 +13544,7 @@ var Line = /*#__PURE__*/function (_DisplayObject) {
|
|
|
13528
13544
|
}
|
|
13529
13545
|
}]);
|
|
13530
13546
|
}(DisplayObject);
|
|
13547
|
+
Line.PARSED_STYLE_LIST = new Set([].concat(_toConsumableArray(DisplayObject.PARSED_STYLE_LIST), ['x1', 'y1', 'x2', 'y2', 'z1', 'z2', 'isBillboard', 'isSizeAttenuation', 'markerStart', 'markerEnd', 'markerStartOffset', 'markerEndOffset']));
|
|
13531
13548
|
|
|
13532
13549
|
var _excluded$3 = ["style"];
|
|
13533
13550
|
var Path = /*#__PURE__*/function (_DisplayObject) {
|
|
@@ -13766,6 +13783,7 @@ var Path = /*#__PURE__*/function (_DisplayObject) {
|
|
|
13766
13783
|
}
|
|
13767
13784
|
}]);
|
|
13768
13785
|
}(DisplayObject);
|
|
13786
|
+
Path.PARSED_STYLE_LIST = new Set([].concat(_toConsumableArray(DisplayObject.PARSED_STYLE_LIST), ['d', 'markerStart', 'markerMid', 'markerEnd', 'markerStartOffset', 'markerEndOffset', 'isBillboard', 'isSizeAttenuation']));
|
|
13769
13787
|
|
|
13770
13788
|
var _excluded$2 = ["style"];
|
|
13771
13789
|
var Polygon = /*#__PURE__*/function (_DisplayObject) {
|
|
@@ -13927,6 +13945,7 @@ var Polygon = /*#__PURE__*/function (_DisplayObject) {
|
|
|
13927
13945
|
}
|
|
13928
13946
|
}]);
|
|
13929
13947
|
}(DisplayObject);
|
|
13948
|
+
Polygon.PARSED_STYLE_LIST = new Set([].concat(_toConsumableArray(DisplayObject.PARSED_STYLE_LIST), ['points', 'markerStart', 'markerMid', 'markerEnd', 'markerStartOffset', 'markerEndOffset', 'isClosed', 'isBillboard', 'isSizeAttenuation']));
|
|
13930
13949
|
|
|
13931
13950
|
var _excluded$1 = ["style"];
|
|
13932
13951
|
/**
|
|
@@ -14024,6 +14043,7 @@ var Polyline = /*#__PURE__*/function (_Polygon) {
|
|
|
14024
14043
|
}
|
|
14025
14044
|
}]);
|
|
14026
14045
|
}(Polygon);
|
|
14046
|
+
Polyline.PARSED_STYLE_LIST = new Set([].concat(_toConsumableArray(Polygon.PARSED_STYLE_LIST), ['points', 'markerStart', 'markerMid', 'markerEnd', 'markerStartOffset', 'markerEndOffset', 'isBillboard']));
|
|
14027
14047
|
|
|
14028
14048
|
var Rect = /*#__PURE__*/function (_DisplayObject) {
|
|
14029
14049
|
function Rect() {
|
|
@@ -14036,6 +14056,7 @@ var Rect = /*#__PURE__*/function (_DisplayObject) {
|
|
|
14036
14056
|
_inherits(Rect, _DisplayObject);
|
|
14037
14057
|
return _createClass(Rect);
|
|
14038
14058
|
}(DisplayObject);
|
|
14059
|
+
Rect.PARSED_STYLE_LIST = new Set([].concat(_toConsumableArray(DisplayObject.PARSED_STYLE_LIST), ['x', 'y', 'z', 'width', 'height', 'isBillboard', 'isSizeAttenuation', 'radius']));
|
|
14039
14060
|
|
|
14040
14061
|
var _excluded = ["style"];
|
|
14041
14062
|
/**
|
|
@@ -14088,6 +14109,7 @@ var Text = /*#__PURE__*/function (_DisplayObject) {
|
|
|
14088
14109
|
}
|
|
14089
14110
|
}]);
|
|
14090
14111
|
}(DisplayObject);
|
|
14112
|
+
Text.PARSED_STYLE_LIST = new Set([].concat(_toConsumableArray(DisplayObject.PARSED_STYLE_LIST), ['x', 'y', 'z', 'isBillboard', 'billboardRotation', 'isSizeAttenuation', 'text', 'textAlign', 'textBaseline', 'fontStyle', 'fontSize', 'fontFamily', 'fontWeight', 'fontVariant', 'lineHeight', 'letterSpacing', 'leading', 'wordWrap', 'wordWrapWidth', 'maxLines', 'textOverflow', 'isOverflowing', 'textPath', 'textDecorationLine', 'textDecorationColor', 'textDecorationStyle', 'textPathSide', 'textPathStartOffset', 'metrics', 'dx', 'dy']));
|
|
14091
14113
|
|
|
14092
14114
|
/**
|
|
14093
14115
|
* canvas.customElements
|