@antv/g-lite 2.2.0 → 2.2.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.
Files changed (41) hide show
  1. package/dist/index.esm.js +31 -11
  2. package/dist/index.esm.js.map +1 -1
  3. package/dist/index.js +31 -11
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.umd.min.js +5 -5
  6. package/dist/index.umd.min.js.map +1 -1
  7. package/package.json +1 -1
  8. package/types/css/StyleValueRegistry.d.ts +1 -1
  9. package/types/css/StyleValueRegistry.d.ts.map +1 -1
  10. package/types/css/properties/CSSPropertyClipPath.d.ts +1 -1
  11. package/types/css/properties/CSSPropertyMarker.d.ts +1 -1
  12. package/types/display-objects/Circle.d.ts +1 -0
  13. package/types/display-objects/Circle.d.ts.map +1 -1
  14. package/types/display-objects/CustomElement.d.ts.map +1 -1
  15. package/types/display-objects/DisplayObject.d.ts +2 -1
  16. package/types/display-objects/DisplayObject.d.ts.map +1 -1
  17. package/types/display-objects/Ellipse.d.ts +1 -0
  18. package/types/display-objects/Ellipse.d.ts.map +1 -1
  19. package/types/display-objects/Group.d.ts +1 -0
  20. package/types/display-objects/Group.d.ts.map +1 -1
  21. package/types/display-objects/HTML.d.ts +1 -0
  22. package/types/display-objects/HTML.d.ts.map +1 -1
  23. package/types/display-objects/Image.d.ts +1 -0
  24. package/types/display-objects/Image.d.ts.map +1 -1
  25. package/types/display-objects/Line.d.ts +1 -0
  26. package/types/display-objects/Line.d.ts.map +1 -1
  27. package/types/display-objects/Path.d.ts +1 -0
  28. package/types/display-objects/Path.d.ts.map +1 -1
  29. package/types/display-objects/Polygon.d.ts +1 -0
  30. package/types/display-objects/Polygon.d.ts.map +1 -1
  31. package/types/display-objects/Polyline.d.ts +1 -0
  32. package/types/display-objects/Polyline.d.ts.map +1 -1
  33. package/types/display-objects/Rect.d.ts +1 -0
  34. package/types/display-objects/Rect.d.ts.map +1 -1
  35. package/types/display-objects/Text.d.ts +1 -0
  36. package/types/display-objects/Text.d.ts.map +1 -1
  37. package/types/dom/Element.d.ts.map +1 -1
  38. package/types/global-runtime.d.ts +5 -0
  39. package/types/global-runtime.d.ts.map +1 -1
  40. package/types/services/EventService.d.ts.map +1 -1
  41. package/types/services/RenderingService.d.ts +5 -5
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.0
5
- * @date 11/4/2024, 9:35:22 AM
4
+ * @version 2.2.2
5
+ * @date 11/7/2024, 7:43:00 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
- Object.assign(object.parsedStyle, attributes);
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() {
@@ -9680,7 +9692,6 @@ var EventService = /*#__PURE__*/function () {
9680
9692
  key: "notifyListeners",
9681
9693
  value: function notifyListeners(e, type) {
9682
9694
  // hack EventEmitter, stops if the `propagationImmediatelyStopped` flag is set
9683
- // @ts-ignore
9684
9695
  var emitter = e.currentTarget.emitter;
9685
9696
  // @ts-ignore
9686
9697
  var listeners = emitter._events[type];
@@ -11624,7 +11635,7 @@ var runtime = {};
11624
11635
  var geometryUpdaterFactory = function (_ref) {
11625
11636
  var rectUpdater = new RectUpdater();
11626
11637
  var polylineUpdater = new PolylineUpdater();
11627
- 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()), _defineProperty(_defineProperty(_ref, Shape.HTML, new HTMLUpdater()), Shape.MESH, null);
11638
+ 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);
11628
11639
  }();
11629
11640
  var CSSPropertySyntaxFactory = function (_ref2) {
11630
11641
  var color = new CSSPropertyColor();
@@ -12158,6 +12169,9 @@ var Element = /*#__PURE__*/function (_Node) {
12158
12169
  }, {
12159
12170
  key: "destroy",
12160
12171
  value: function destroy() {
12172
+ // fix https://github.com/antvis/G/issues/1813
12173
+ this.destroyChildren();
12174
+
12161
12175
  // destroy itself before remove
12162
12176
  this.dispatchEvent(destroyEvent);
12163
12177
 
@@ -12378,9 +12392,6 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
12378
12392
 
12379
12393
  // assign name, id to config
12380
12394
  // eg. group.get('name')
12381
- /**
12382
- * contains style props in constructor's params, eg. fill, stroke...
12383
- */
12384
12395
  _this.isCustomElement = false;
12385
12396
  _this.isMutationObserved = false;
12386
12397
  /**
@@ -13176,6 +13187,7 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
13176
13187
  // #endregion deprecated
13177
13188
  }]);
13178
13189
  }(Element);
13190
+ 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']);
13179
13191
 
13180
13192
  var Circle = /*#__PURE__*/function (_DisplayObject) {
13181
13193
  function Circle() {
@@ -13188,6 +13200,7 @@ var Circle = /*#__PURE__*/function (_DisplayObject) {
13188
13200
  _inherits(Circle, _DisplayObject);
13189
13201
  return _createClass(Circle);
13190
13202
  }(DisplayObject);
13203
+ Circle.PARSED_STYLE_LIST = new Set([].concat(_toConsumableArray(DisplayObject.PARSED_STYLE_LIST), ['cx', 'cy', 'cz', 'r', 'isBillboard', 'isSizeAttenuation']));
13191
13204
 
13192
13205
  var _excluded$6 = ["style"];
13193
13206
  /**
@@ -13206,9 +13219,6 @@ var CustomElement = /*#__PURE__*/function (_DisplayObject) {
13206
13219
  _this = _callSuper(this, CustomElement, [_objectSpread({
13207
13220
  style: style
13208
13221
  }, rest)]);
13209
- // static get observedAttributes(): string[] {
13210
- // return [];
13211
- // }
13212
13222
  _this.isCustomElement = true;
13213
13223
  return _this;
13214
13224
  }
@@ -13231,6 +13241,7 @@ var Ellipse = /*#__PURE__*/function (_DisplayObject) {
13231
13241
  _inherits(Ellipse, _DisplayObject);
13232
13242
  return _createClass(Ellipse);
13233
13243
  }(DisplayObject);
13244
+ Ellipse.PARSED_STYLE_LIST = new Set([].concat(_toConsumableArray(DisplayObject.PARSED_STYLE_LIST), ['cx', 'cy', 'cz', 'rx', 'ry', 'isBillboard', 'isSizeAttenuation']));
13234
13245
 
13235
13246
  /**
13236
13247
  * 节点片段,用于包裹多个节点并批量操作
@@ -13273,6 +13284,7 @@ var Group = /*#__PURE__*/function (_DisplayObject) {
13273
13284
  _inherits(Group, _DisplayObject);
13274
13285
  return _createClass(Group);
13275
13286
  }(DisplayObject);
13287
+ Group.PARSED_STYLE_LIST = new Set([].concat(_toConsumableArray(DisplayObject.PARSED_STYLE_LIST), ['width', 'height']));
13276
13288
 
13277
13289
  var _excluded$5 = ["style"];
13278
13290
  /**
@@ -13359,6 +13371,7 @@ var HTML = /*#__PURE__*/function (_DisplayObject) {
13359
13371
  }
13360
13372
  }]);
13361
13373
  }(DisplayObject);
13374
+ HTML.PARSED_STYLE_LIST = new Set([].concat(_toConsumableArray(DisplayObject.PARSED_STYLE_LIST), ['x', 'y', '$el', 'innerHTML', 'width', 'height']));
13362
13375
 
13363
13376
  var Image = /*#__PURE__*/function (_DisplayObject) {
13364
13377
  function Image() {
@@ -13371,6 +13384,7 @@ var Image = /*#__PURE__*/function (_DisplayObject) {
13371
13384
  _inherits(Image, _DisplayObject);
13372
13385
  return _createClass(Image);
13373
13386
  }(DisplayObject);
13387
+ Image.PARSED_STYLE_LIST = new Set([].concat(_toConsumableArray(DisplayObject.PARSED_STYLE_LIST), ['x', 'y', 'z', 'src', 'width', 'height', 'isBillboard', 'billboardRotation', 'isSizeAttenuation', 'keepAspectRatio']));
13374
13388
 
13375
13389
  var _excluded$4 = ["style"];
13376
13390
  /**
@@ -13526,6 +13540,7 @@ var Line = /*#__PURE__*/function (_DisplayObject) {
13526
13540
  }
13527
13541
  }]);
13528
13542
  }(DisplayObject);
13543
+ Line.PARSED_STYLE_LIST = new Set([].concat(_toConsumableArray(DisplayObject.PARSED_STYLE_LIST), ['x1', 'y1', 'x2', 'y2', 'z1', 'z2', 'isBillboard', 'isSizeAttenuation', 'markerStart', 'markerEnd', 'markerStartOffset', 'markerEndOffset']));
13529
13544
 
13530
13545
  var _excluded$3 = ["style"];
13531
13546
  var Path = /*#__PURE__*/function (_DisplayObject) {
@@ -13764,6 +13779,7 @@ var Path = /*#__PURE__*/function (_DisplayObject) {
13764
13779
  }
13765
13780
  }]);
13766
13781
  }(DisplayObject);
13782
+ Path.PARSED_STYLE_LIST = new Set([].concat(_toConsumableArray(DisplayObject.PARSED_STYLE_LIST), ['d', 'markerStart', 'markerMid', 'markerEnd', 'markerStartOffset', 'markerEndOffset', 'isBillboard', 'isSizeAttenuation']));
13767
13783
 
13768
13784
  var _excluded$2 = ["style"];
13769
13785
  var Polygon = /*#__PURE__*/function (_DisplayObject) {
@@ -13925,6 +13941,7 @@ var Polygon = /*#__PURE__*/function (_DisplayObject) {
13925
13941
  }
13926
13942
  }]);
13927
13943
  }(DisplayObject);
13944
+ Polygon.PARSED_STYLE_LIST = new Set([].concat(_toConsumableArray(DisplayObject.PARSED_STYLE_LIST), ['points', 'markerStart', 'markerMid', 'markerEnd', 'markerStartOffset', 'markerEndOffset', 'isClosed', 'isBillboard', 'isSizeAttenuation']));
13928
13945
 
13929
13946
  var _excluded$1 = ["style"];
13930
13947
  /**
@@ -14022,6 +14039,7 @@ var Polyline = /*#__PURE__*/function (_Polygon) {
14022
14039
  }
14023
14040
  }]);
14024
14041
  }(Polygon);
14042
+ Polyline.PARSED_STYLE_LIST = new Set([].concat(_toConsumableArray(Polygon.PARSED_STYLE_LIST), ['points', 'markerStart', 'markerMid', 'markerEnd', 'markerStartOffset', 'markerEndOffset', 'isBillboard']));
14025
14043
 
14026
14044
  var Rect = /*#__PURE__*/function (_DisplayObject) {
14027
14045
  function Rect() {
@@ -14034,6 +14052,7 @@ var Rect = /*#__PURE__*/function (_DisplayObject) {
14034
14052
  _inherits(Rect, _DisplayObject);
14035
14053
  return _createClass(Rect);
14036
14054
  }(DisplayObject);
14055
+ Rect.PARSED_STYLE_LIST = new Set([].concat(_toConsumableArray(DisplayObject.PARSED_STYLE_LIST), ['x', 'y', 'z', 'width', 'height', 'isBillboard', 'isSizeAttenuation', 'radius']));
14037
14056
 
14038
14057
  var _excluded = ["style"];
14039
14058
  /**
@@ -14086,6 +14105,7 @@ var Text = /*#__PURE__*/function (_DisplayObject) {
14086
14105
  }
14087
14106
  }]);
14088
14107
  }(DisplayObject);
14108
+ 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']));
14089
14109
 
14090
14110
  /**
14091
14111
  * canvas.customElements