@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.esm.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
  */
@@ -6371,7 +6371,7 @@ var DefaultStyleValueRegistry = /*#__PURE__*/function () {
6371
6371
  // clipPath
6372
6372
  var oldClipPath = object.parsedStyle.clipPath;
6373
6373
  var oldOffsetPath = object.parsedStyle.offsetPath;
6374
- Object.assign(object.parsedStyle, attributes);
6374
+ assignParsedStyle(object, attributes);
6375
6375
  var needUpdateGeometry = !!options.forceUpdateGeometry;
6376
6376
  if (!needUpdateGeometry) {
6377
6377
  for (var i in attributes) {
@@ -6632,6 +6632,18 @@ var DefaultStyleValueRegistry = /*#__PURE__*/function () {
6632
6632
  }
6633
6633
  }]);
6634
6634
  }();
6635
+ function assignParsedStyle(object, attributes) {
6636
+ if (!runtime.enableMassiveParsedStyleAssignOptimization) {
6637
+ Object.assign(object.parsedStyle, attributes);
6638
+ return;
6639
+ }
6640
+ var list = object.constructor.PARSED_STYLE_LIST;
6641
+ for (var key in attributes) {
6642
+ if (list.has(key)) {
6643
+ object.parsedStyle[key] = attributes[key];
6644
+ }
6645
+ }
6646
+ }
6635
6647
 
6636
6648
  var CSSPropertyAngle = /*#__PURE__*/function () {
6637
6649
  function CSSPropertyAngle() {
@@ -9659,7 +9671,6 @@ var EventService = /*#__PURE__*/function () {
9659
9671
  key: "notifyListeners",
9660
9672
  value: function notifyListeners(e, type) {
9661
9673
  // hack EventEmitter, stops if the `propagationImmediatelyStopped` flag is set
9662
- // @ts-ignore
9663
9674
  var emitter = e.currentTarget.emitter;
9664
9675
  // @ts-ignore
9665
9676
  var listeners = emitter._events[type];
@@ -11603,7 +11614,7 @@ var runtime = {};
11603
11614
  var geometryUpdaterFactory = function (_ref) {
11604
11615
  var rectUpdater = new RectUpdater();
11605
11616
  var polylineUpdater = new PolylineUpdater();
11606
- 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);
11617
+ 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);
11607
11618
  }();
11608
11619
  var CSSPropertySyntaxFactory = function (_ref2) {
11609
11620
  var color = new CSSPropertyColor();
@@ -12137,6 +12148,9 @@ var Element = /*#__PURE__*/function (_Node) {
12137
12148
  }, {
12138
12149
  key: "destroy",
12139
12150
  value: function destroy() {
12151
+ // fix https://github.com/antvis/G/issues/1813
12152
+ this.destroyChildren();
12153
+
12140
12154
  // destroy itself before remove
12141
12155
  this.dispatchEvent(destroyEvent);
12142
12156
 
@@ -12357,9 +12371,6 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
12357
12371
 
12358
12372
  // assign name, id to config
12359
12373
  // eg. group.get('name')
12360
- /**
12361
- * contains style props in constructor's params, eg. fill, stroke...
12362
- */
12363
12374
  _this.isCustomElement = false;
12364
12375
  _this.isMutationObserved = false;
12365
12376
  /**
@@ -13155,6 +13166,7 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
13155
13166
  // #endregion deprecated
13156
13167
  }]);
13157
13168
  }(Element);
13169
+ 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']);
13158
13170
 
13159
13171
  var Circle = /*#__PURE__*/function (_DisplayObject) {
13160
13172
  function Circle() {
@@ -13167,6 +13179,7 @@ var Circle = /*#__PURE__*/function (_DisplayObject) {
13167
13179
  _inherits(Circle, _DisplayObject);
13168
13180
  return _createClass(Circle);
13169
13181
  }(DisplayObject);
13182
+ Circle.PARSED_STYLE_LIST = new Set([].concat(_toConsumableArray(DisplayObject.PARSED_STYLE_LIST), ['cx', 'cy', 'cz', 'r', 'isBillboard', 'isSizeAttenuation']));
13170
13183
 
13171
13184
  var _excluded$6 = ["style"];
13172
13185
  /**
@@ -13185,9 +13198,6 @@ var CustomElement = /*#__PURE__*/function (_DisplayObject) {
13185
13198
  _this = _callSuper(this, CustomElement, [_objectSpread({
13186
13199
  style: style
13187
13200
  }, rest)]);
13188
- // static get observedAttributes(): string[] {
13189
- // return [];
13190
- // }
13191
13201
  _this.isCustomElement = true;
13192
13202
  return _this;
13193
13203
  }
@@ -13210,6 +13220,7 @@ var Ellipse = /*#__PURE__*/function (_DisplayObject) {
13210
13220
  _inherits(Ellipse, _DisplayObject);
13211
13221
  return _createClass(Ellipse);
13212
13222
  }(DisplayObject);
13223
+ Ellipse.PARSED_STYLE_LIST = new Set([].concat(_toConsumableArray(DisplayObject.PARSED_STYLE_LIST), ['cx', 'cy', 'cz', 'rx', 'ry', 'isBillboard', 'isSizeAttenuation']));
13213
13224
 
13214
13225
  /**
13215
13226
  * 节点片段,用于包裹多个节点并批量操作
@@ -13252,6 +13263,7 @@ var Group = /*#__PURE__*/function (_DisplayObject) {
13252
13263
  _inherits(Group, _DisplayObject);
13253
13264
  return _createClass(Group);
13254
13265
  }(DisplayObject);
13266
+ Group.PARSED_STYLE_LIST = new Set([].concat(_toConsumableArray(DisplayObject.PARSED_STYLE_LIST), ['width', 'height']));
13255
13267
 
13256
13268
  var _excluded$5 = ["style"];
13257
13269
  /**
@@ -13338,6 +13350,7 @@ var HTML = /*#__PURE__*/function (_DisplayObject) {
13338
13350
  }
13339
13351
  }]);
13340
13352
  }(DisplayObject);
13353
+ HTML.PARSED_STYLE_LIST = new Set([].concat(_toConsumableArray(DisplayObject.PARSED_STYLE_LIST), ['x', 'y', '$el', 'innerHTML', 'width', 'height']));
13341
13354
 
13342
13355
  var Image = /*#__PURE__*/function (_DisplayObject) {
13343
13356
  function Image() {
@@ -13350,6 +13363,7 @@ var Image = /*#__PURE__*/function (_DisplayObject) {
13350
13363
  _inherits(Image, _DisplayObject);
13351
13364
  return _createClass(Image);
13352
13365
  }(DisplayObject);
13366
+ Image.PARSED_STYLE_LIST = new Set([].concat(_toConsumableArray(DisplayObject.PARSED_STYLE_LIST), ['x', 'y', 'z', 'src', 'width', 'height', 'isBillboard', 'billboardRotation', 'isSizeAttenuation', 'keepAspectRatio']));
13353
13367
 
13354
13368
  var _excluded$4 = ["style"];
13355
13369
  /**
@@ -13505,6 +13519,7 @@ var Line = /*#__PURE__*/function (_DisplayObject) {
13505
13519
  }
13506
13520
  }]);
13507
13521
  }(DisplayObject);
13522
+ Line.PARSED_STYLE_LIST = new Set([].concat(_toConsumableArray(DisplayObject.PARSED_STYLE_LIST), ['x1', 'y1', 'x2', 'y2', 'z1', 'z2', 'isBillboard', 'isSizeAttenuation', 'markerStart', 'markerEnd', 'markerStartOffset', 'markerEndOffset']));
13508
13523
 
13509
13524
  var _excluded$3 = ["style"];
13510
13525
  var Path = /*#__PURE__*/function (_DisplayObject) {
@@ -13743,6 +13758,7 @@ var Path = /*#__PURE__*/function (_DisplayObject) {
13743
13758
  }
13744
13759
  }]);
13745
13760
  }(DisplayObject);
13761
+ Path.PARSED_STYLE_LIST = new Set([].concat(_toConsumableArray(DisplayObject.PARSED_STYLE_LIST), ['d', 'markerStart', 'markerMid', 'markerEnd', 'markerStartOffset', 'markerEndOffset', 'isBillboard', 'isSizeAttenuation']));
13746
13762
 
13747
13763
  var _excluded$2 = ["style"];
13748
13764
  var Polygon = /*#__PURE__*/function (_DisplayObject) {
@@ -13904,6 +13920,7 @@ var Polygon = /*#__PURE__*/function (_DisplayObject) {
13904
13920
  }
13905
13921
  }]);
13906
13922
  }(DisplayObject);
13923
+ Polygon.PARSED_STYLE_LIST = new Set([].concat(_toConsumableArray(DisplayObject.PARSED_STYLE_LIST), ['points', 'markerStart', 'markerMid', 'markerEnd', 'markerStartOffset', 'markerEndOffset', 'isClosed', 'isBillboard', 'isSizeAttenuation']));
13907
13924
 
13908
13925
  var _excluded$1 = ["style"];
13909
13926
  /**
@@ -14001,6 +14018,7 @@ var Polyline = /*#__PURE__*/function (_Polygon) {
14001
14018
  }
14002
14019
  }]);
14003
14020
  }(Polygon);
14021
+ Polyline.PARSED_STYLE_LIST = new Set([].concat(_toConsumableArray(Polygon.PARSED_STYLE_LIST), ['points', 'markerStart', 'markerMid', 'markerEnd', 'markerStartOffset', 'markerEndOffset', 'isBillboard']));
14004
14022
 
14005
14023
  var Rect = /*#__PURE__*/function (_DisplayObject) {
14006
14024
  function Rect() {
@@ -14013,6 +14031,7 @@ var Rect = /*#__PURE__*/function (_DisplayObject) {
14013
14031
  _inherits(Rect, _DisplayObject);
14014
14032
  return _createClass(Rect);
14015
14033
  }(DisplayObject);
14034
+ Rect.PARSED_STYLE_LIST = new Set([].concat(_toConsumableArray(DisplayObject.PARSED_STYLE_LIST), ['x', 'y', 'z', 'width', 'height', 'isBillboard', 'isSizeAttenuation', 'radius']));
14016
14035
 
14017
14036
  var _excluded = ["style"];
14018
14037
  /**
@@ -14065,6 +14084,7 @@ var Text = /*#__PURE__*/function (_DisplayObject) {
14065
14084
  }
14066
14085
  }]);
14067
14086
  }(DisplayObject);
14087
+ 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']));
14068
14088
 
14069
14089
  /**
14070
14090
  * canvas.customElements