@antv/g-lite 1.3.0-next.10 → 1.3.0-next.12

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.
@@ -237,16 +237,6 @@ export declare class DisplayObject<StyleProps extends BaseStyleProps = any, Pars
237
237
  * @deprecated
238
238
  */
239
239
  add<T extends IChildNode>(child: T, index?: number): T;
240
- /**
241
- * Use `this.style.clipPath` instead.
242
- * @deprecated
243
- */
244
- setClip(clipPath: DisplayObject | null): void;
245
- /**
246
- * Use `this.style.clipPath` instead.
247
- * @deprecated
248
- */
249
- getClip: () => any;
250
240
  /**
251
241
  * @deprecated
252
242
  */
@@ -21,5 +21,5 @@ export interface ParsedGroupStyleProps extends ParsedBaseStyleProps {
21
21
  </g>
22
22
  */
23
23
  export declare class Group extends DisplayObject {
24
- constructor({ style, ...rest }?: DisplayObjectConfig<GroupStyleProps>);
24
+ constructor(options?: DisplayObjectConfig<GroupStyleProps>);
25
25
  }
@@ -40,5 +40,5 @@ export interface ParsedImageStyleProps extends ParsedBaseStyleProps {
40
40
  keepAspectRatio?: boolean;
41
41
  }
42
42
  export declare class Image extends DisplayObject<ImageStyleProps, ParsedImageStyleProps> {
43
- constructor({ style, ...rest }?: DisplayObjectConfig<ImageStyleProps>);
43
+ constructor(options?: DisplayObjectConfig<ImageStyleProps>);
44
44
  }
@@ -23,5 +23,5 @@ export interface ParsedRectStyleProps extends ParsedBaseStyleProps {
23
23
  radius?: [number, number, number, number];
24
24
  }
25
25
  export declare class Rect extends DisplayObject<RectStyleProps, ParsedRectStyleProps> {
26
- constructor({ style, ...rest }?: DisplayObjectConfig<RectStyleProps>);
26
+ constructor(options?: DisplayObjectConfig<RectStyleProps>);
27
27
  }
@@ -31,4 +31,10 @@ export interface GlobalRuntime {
31
31
  * circle.style.r = 100;
32
32
  */
33
33
  enableStyleSyntax: boolean;
34
+ /**
35
+ * Enable using dash-cased attribute.
36
+ * @example
37
+ * circle.setAttribute('stroke-width', '2');
38
+ */
39
+ enableAttributeDashCased: boolean;
34
40
  }
package/dist/index.esm.js CHANGED
@@ -6544,7 +6544,7 @@ var BUILT_IN_PROPERTIES = [
6544
6544
  d: '0',
6545
6545
  },
6546
6546
  ];
6547
- var GEOMETRY_ATTRIBUTE_NAMES = BUILT_IN_PROPERTIES.filter(function (n) { return !!n.l; }).map(function (n) { return n.n; });
6547
+ BUILT_IN_PROPERTIES.filter(function (n) { return !!n.l; }).map(function (n) { return n.n; });
6548
6548
  var propertyMetadataCache = {};
6549
6549
  var unresolvedProperties = new WeakMap();
6550
6550
  // const uniqueAttributeSet = new Set<string>();
@@ -6601,20 +6601,20 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
6601
6601
  }; }
6602
6602
  if (!this.runtime.enableCSSParsing) {
6603
6603
  Object.assign(object.attributes, attributes);
6604
- var attributeNames_1 = Object.keys(attributes);
6604
+ var attributeNames = Object.keys(attributes);
6605
6605
  // clipPath
6606
6606
  var oldClipPath = object.parsedStyle.clipPath;
6607
6607
  var oldOffsetPath = object.parsedStyle.offsetPath;
6608
6608
  object.parsedStyle = Object.assign(object.parsedStyle, attributes);
6609
- var needUpdateGeometry_1 = !!options.forceUpdateGeometry;
6610
- if (!needUpdateGeometry_1) {
6611
- for (var i = 0; i < GEOMETRY_ATTRIBUTE_NAMES.length; i++) {
6612
- if (GEOMETRY_ATTRIBUTE_NAMES[i] in attributes) {
6613
- needUpdateGeometry_1 = true;
6614
- break;
6615
- }
6616
- }
6617
- }
6609
+ var needUpdateGeometry = !!options.forceUpdateGeometry;
6610
+ // if (!needUpdateGeometry) {
6611
+ // for (let i = 0; i < GEOMETRY_ATTRIBUTE_NAMES.length; i++) {
6612
+ // if (GEOMETRY_ATTRIBUTE_NAMES[i] in attributes) {
6613
+ // needUpdateGeometry = true;
6614
+ // break;
6615
+ // }
6616
+ // }
6617
+ // }
6618
6618
  if (attributes.fill) {
6619
6619
  object.parsedStyle.fill = parseColor(attributes.fill);
6620
6620
  }
@@ -6697,97 +6697,98 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
6697
6697
  attributes.markerMid, null, null);
6698
6698
  }
6699
6699
  if (!isNil(attributes.zIndex)) {
6700
- this.runtime.CSSPropertySyntaxFactory['<z-index>'].postProcessor(object, attributeNames_1);
6700
+ this.runtime.CSSPropertySyntaxFactory['<z-index>'].postProcessor(object, attributeNames);
6701
6701
  }
6702
6702
  if (!isNil(attributes.offsetDistance)) {
6703
- this.runtime.CSSPropertySyntaxFactory['<offset-distance>'].postProcessor(object, attributeNames_1);
6703
+ this.runtime.CSSPropertySyntaxFactory['<offset-distance>'].postProcessor(object, attributeNames);
6704
6704
  }
6705
6705
  if (attributes.transform) {
6706
- this.runtime.CSSPropertySyntaxFactory['<transform>'].postProcessor(object, attributeNames_1);
6706
+ this.runtime.CSSPropertySyntaxFactory['<transform>'].postProcessor(object, attributeNames);
6707
6707
  }
6708
- if (needUpdateGeometry_1) {
6708
+ if (needUpdateGeometry) {
6709
6709
  object.geometry.dirty = true;
6710
6710
  // FIXME setOrigin may have already dirtified to root.
6711
- this.runtime.sceneGraphService.dirtifyToRoot(object);
6711
+ // this.runtime.sceneGraphService.dirtifyToRoot(object);
6712
6712
  }
6713
- return;
6714
6713
  }
6715
- var skipUpdateAttribute = options.skipUpdateAttribute, skipParse = options.skipParse, forceUpdateGeometry = options.forceUpdateGeometry, usedAttributes = options.usedAttributes, memoize = options.memoize;
6716
- var needUpdateGeometry = forceUpdateGeometry;
6717
- var attributeNames = Object.keys(attributes);
6718
- attributeNames.forEach(function (attributeName) {
6719
- var _a;
6720
- if (!skipUpdateAttribute) {
6721
- object.attributes[attributeName] = attributes[attributeName];
6722
- }
6723
- if (!needUpdateGeometry && ((_a = propertyMetadataCache[attributeName]) === null || _a === void 0 ? void 0 : _a.l)) {
6724
- needUpdateGeometry = true;
6725
- }
6726
- });
6727
- if (!skipParse) {
6728
- attributeNames.forEach(function (name) {
6729
- object.computedStyle[name] = _this.parseProperty(name, object.attributes[name], object, memoize);
6714
+ else {
6715
+ var skipUpdateAttribute_1 = options.skipUpdateAttribute, skipParse = options.skipParse, forceUpdateGeometry = options.forceUpdateGeometry, usedAttributes = options.usedAttributes, memoize_1 = options.memoize;
6716
+ var needUpdateGeometry_1 = forceUpdateGeometry;
6717
+ var attributeNames_1 = Object.keys(attributes);
6718
+ attributeNames_1.forEach(function (attributeName) {
6719
+ var _a;
6720
+ if (!skipUpdateAttribute_1) {
6721
+ object.attributes[attributeName] = attributes[attributeName];
6722
+ }
6723
+ if (!needUpdateGeometry_1 && ((_a = propertyMetadataCache[attributeName]) === null || _a === void 0 ? void 0 : _a.l)) {
6724
+ needUpdateGeometry_1 = true;
6725
+ }
6730
6726
  });
6731
- }
6732
- // let hasUnresolvedProperties = false;
6733
- // parse according to priority
6734
- // path 50
6735
- // points 50
6736
- // text 50
6737
- // textTransform 51
6738
- // transform 100
6739
- // transformOrigin 100
6740
- if (usedAttributes === null || usedAttributes === void 0 ? void 0 : usedAttributes.length) {
6741
- // uniqueAttributeSet.clear();
6742
- attributeNames = Array.from(new Set(attributeNames.concat(usedAttributes)));
6743
- }
6744
- // [
6745
- // 'path',
6746
- // 'points',
6747
- // 'text',
6748
- // 'textTransform',
6749
- // 'transform',
6750
- // 'transformOrigin',
6751
- // ].forEach((name) => {
6752
- // const index = attributeNames.indexOf(name);
6753
- // if (index > -1) {
6754
- // attributeNames.splice(index, 1);
6755
- // attributeNames.push(name);
6756
- // }
6757
- // });
6758
- attributeNames.forEach(function (name) {
6759
- // some style props maybe deleted after parsing such as `anchor` in Text
6760
- if (name in object.computedStyle) {
6761
- object.parsedStyle[name] = _this.computeProperty(name, object.computedStyle[name], object, memoize);
6727
+ if (!skipParse) {
6728
+ attributeNames_1.forEach(function (name) {
6729
+ object.computedStyle[name] = _this.parseProperty(name, object.attributes[name], object, memoize_1);
6730
+ });
6762
6731
  }
6763
- });
6764
- // if (hasUnresolvedProperties) {
6765
- // this.dirty = true;
6766
- // return;
6767
- // }
6768
- // update geometry
6769
- if (needUpdateGeometry) {
6770
- object.geometry.dirty = true;
6771
- // FIXME setOrigin may have already dirtified to root.
6772
- this.runtime.sceneGraphService.dirtifyToRoot(object);
6773
- }
6774
- attributeNames.forEach(function (name) {
6775
- if (name in object.parsedStyle) {
6776
- _this.postProcessProperty(name, object, attributeNames);
6732
+ // let hasUnresolvedProperties = false;
6733
+ // parse according to priority
6734
+ // path 50
6735
+ // points 50
6736
+ // text 50
6737
+ // textTransform 51
6738
+ // transform 100
6739
+ // transformOrigin 100
6740
+ if (usedAttributes === null || usedAttributes === void 0 ? void 0 : usedAttributes.length) {
6741
+ // uniqueAttributeSet.clear();
6742
+ attributeNames_1 = Array.from(new Set(attributeNames_1.concat(usedAttributes)));
6743
+ }
6744
+ // [
6745
+ // 'path',
6746
+ // 'points',
6747
+ // 'text',
6748
+ // 'textTransform',
6749
+ // 'transform',
6750
+ // 'transformOrigin',
6751
+ // ].forEach((name) => {
6752
+ // const index = attributeNames.indexOf(name);
6753
+ // if (index > -1) {
6754
+ // attributeNames.splice(index, 1);
6755
+ // attributeNames.push(name);
6756
+ // }
6757
+ // });
6758
+ attributeNames_1.forEach(function (name) {
6759
+ // some style props maybe deleted after parsing such as `anchor` in Text
6760
+ if (name in object.computedStyle) {
6761
+ object.parsedStyle[name] = _this.computeProperty(name, object.computedStyle[name], object, memoize_1);
6762
+ }
6763
+ });
6764
+ // if (hasUnresolvedProperties) {
6765
+ // this.dirty = true;
6766
+ // return;
6767
+ // }
6768
+ // update geometry
6769
+ if (needUpdateGeometry_1) {
6770
+ object.geometry.dirty = true;
6771
+ // FIXME setOrigin may have already dirtified to root.
6772
+ this.runtime.sceneGraphService.dirtifyToRoot(object);
6777
6773
  }
6778
- });
6779
- if (this.runtime.enableCSSParsing && object.children.length) {
6780
- attributeNames.forEach(function (name) {
6781
- if (name in object.parsedStyle && _this.isPropertyInheritable(name)) {
6782
- // update children's inheritable
6783
- object.children.forEach(function (child) {
6784
- child.internalSetAttribute(name, null, {
6785
- skipUpdateAttribute: true,
6786
- skipParse: true,
6787
- });
6788
- });
6774
+ attributeNames_1.forEach(function (name) {
6775
+ if (name in object.parsedStyle) {
6776
+ _this.postProcessProperty(name, object, attributeNames_1);
6789
6777
  }
6790
6778
  });
6779
+ if (this.runtime.enableCSSParsing && object.children.length) {
6780
+ attributeNames_1.forEach(function (name) {
6781
+ if (name in object.parsedStyle && _this.isPropertyInheritable(name)) {
6782
+ // update children's inheritable
6783
+ object.children.forEach(function (child) {
6784
+ child.internalSetAttribute(name, null, {
6785
+ skipUpdateAttribute: true,
6786
+ skipParse: true,
6787
+ });
6788
+ });
6789
+ }
6790
+ });
6791
+ }
6791
6792
  }
6792
6793
  };
6793
6794
  /**
@@ -7562,6 +7563,7 @@ var clock = typeof performance === 'object' && performance.now ? performance : D
7562
7563
  function isFillOrStrokeAffected(pointerEvents, fill, stroke) {
7563
7564
  // account for pointerEvents
7564
7565
  // @see https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events
7566
+ if (pointerEvents === void 0) { pointerEvents = 'auto'; }
7565
7567
  var hasFill = false;
7566
7568
  var hasStroke = false;
7567
7569
  var isFillOtherThanNone = !!fill && !fill.isNone;
@@ -10680,6 +10682,7 @@ var DefaultSceneGraphService = /** @class */ (function () {
10680
10682
  }
10681
10683
  };
10682
10684
  DefaultSceneGraphService.prototype.getOrigin = function (element) {
10685
+ element.getGeometryBounds();
10683
10686
  return element.transformable.origin;
10684
10687
  };
10685
10688
  /**
@@ -11619,12 +11622,13 @@ runtime.globalThis = getGlobalThis();
11619
11622
  runtime.enableCSSParsing = true;
11620
11623
  runtime.enableDataset = false;
11621
11624
  runtime.enableStyleSyntax = true;
11625
+ runtime.enableAttributeDashCased = false;
11622
11626
 
11623
11627
  var entityCounter = 0;
11624
11628
  function resetEntityCounter() {
11625
11629
  entityCounter = 0;
11626
11630
  }
11627
- var insertedEvent = new MutationEvent(ElementEvent.INSERTED, null, '', '', '', 0, '', '');
11631
+ new MutationEvent(ElementEvent.INSERTED, null, '', '', '', 0, '', '');
11628
11632
  var removedEvent = new MutationEvent(ElementEvent.REMOVED, null, '', '', '', 0, '', '');
11629
11633
  var destroyEvent = new CustomEvent(ElementEvent.DESTROY);
11630
11634
  /**
@@ -11864,8 +11868,8 @@ var Element = /** @class */ (function (_super) {
11864
11868
  if ((_a = this.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView) {
11865
11869
  this.ownerDocument.defaultView.mountChildren(child);
11866
11870
  }
11867
- insertedEvent.relatedNode = this;
11868
- child.dispatchEvent(insertedEvent);
11871
+ // insertedEvent.relatedNode = this as IElement;
11872
+ // child.dispatchEvent(insertedEvent);
11869
11873
  return child;
11870
11874
  };
11871
11875
  Element.prototype.insertBefore = function (newChild, refChild) {
@@ -12138,8 +12142,10 @@ var Element = /** @class */ (function (_super) {
12138
12142
  }
12139
12143
  var value = this.attributes[name];
12140
12144
  if (value === undefined) {
12141
- var attributeName = formatAttributeName(name);
12142
- value = this.attributes[attributeName];
12145
+ if (runtime.enableAttributeDashCased) {
12146
+ var attributeName = formatAttributeName(name);
12147
+ value = this.attributes[attributeName];
12148
+ }
12143
12149
  // if the given attribute does not exist, the value returned will either be null or ""
12144
12150
  return runtime.enableCSSParsing ? (isNil(value) ? null : value) : value;
12145
12151
  }
@@ -12209,6 +12215,9 @@ var Element = /** @class */ (function (_super) {
12209
12215
  function isDisplayObject(value) {
12210
12216
  return !!(value === null || value === void 0 ? void 0 : value.nodeName);
12211
12217
  }
12218
+ var Proxy = runtime.globalThis.Proxy
12219
+ ? runtime.globalThis.Proxy
12220
+ : function () { };
12212
12221
  var mutationEvent = new MutationEvent(ElementEvent.ATTR_MODIFIED, null, null, null, null, MutationEvent.MODIFICATION, null, null);
12213
12222
  var DEFAULT_STYLE_PROPS = {
12214
12223
  opacity: '',
@@ -12245,7 +12254,20 @@ var DEFAULT_PARSED_STYLE_PROPS = {
12245
12254
  shadowType: 'outer',
12246
12255
  miterLimit: 10,
12247
12256
  };
12248
- var DEFAULT_PARSED_STYLE_PROPS_CSS_DISABLED = __assign(__assign({}, DEFAULT_PARSED_STYLE_PROPS), { opacity: 1, fillOpacity: 1, strokeOpacity: 1, visibility: 'visible', pointerEvents: 'auto', lineWidth: 1, lineCap: 'butt', lineJoin: 'miter', increasedLineWidthForHitTesting: 0, fillRule: 'nonzero' });
12257
+ // const DEFAULT_PARSED_STYLE_PROPS_CSS_DISABLED = {
12258
+ // ...DEFAULT_PARSED_STYLE_PROPS,
12259
+ // opacity: 1,
12260
+ // fillOpacity: 1,
12261
+ // strokeOpacity: 1,
12262
+ // visibility: 'visible',
12263
+ // pointerEvents: 'auto',
12264
+ // lineWidth: 1,
12265
+ // lineCap: 'butt',
12266
+ // lineJoin: 'miter',
12267
+ // increasedLineWidthForHitTesting: 0,
12268
+ // fillRule: 'nonzero',
12269
+ // // TODO: transformOrigin
12270
+ // };
12249
12271
  var INHERITABLE_BASE_STYLE_PROPS = [
12250
12272
  'opacity',
12251
12273
  'fillOpacity',
@@ -12297,13 +12319,6 @@ var DisplayObject = /** @class */ (function (_super) {
12297
12319
  * push to active animations after calling `animate()`
12298
12320
  */
12299
12321
  _this.activeAnimations = [];
12300
- /**
12301
- * Use `this.style.clipPath` instead.
12302
- * @deprecated
12303
- */
12304
- _this.getClip = function () {
12305
- return this.style.clipPath || null;
12306
- };
12307
12322
  // assign name, id to config
12308
12323
  // eg. group.get('name')
12309
12324
  _this.config = config;
@@ -12314,18 +12329,12 @@ var DisplayObject = /** @class */ (function (_super) {
12314
12329
  _this.className = _this.config.className || _this.config.class;
12315
12330
  }
12316
12331
  _this.nodeName = _this.config.type || Shape.GROUP;
12317
- // merge parsed value
12318
- Object.assign(_this.parsedStyle, runtime.enableCSSParsing
12319
- ? DEFAULT_PARSED_STYLE_PROPS
12320
- : DEFAULT_PARSED_STYLE_PROPS_CSS_DISABLED, _this.config.initialParsedStyle);
12321
12332
  if (runtime.enableCSSParsing) {
12322
12333
  Object.assign(_this.attributes, DEFAULT_STYLE_PROPS);
12334
+ Object.assign(_this.parsedStyle, DEFAULT_PARSED_STYLE_PROPS, _this.config.initialParsedStyle);
12323
12335
  }
12324
12336
  // start to process attributes
12325
12337
  _this.initAttributes(_this.config.style);
12326
- var Proxy = runtime.globalThis.Proxy
12327
- ? runtime.globalThis.Proxy
12328
- : function () { };
12329
12338
  if (runtime.enableDataset) {
12330
12339
  _this.dataset = new Proxy({}, {
12331
12340
  get: function (target, name) {
@@ -12443,10 +12452,14 @@ var DisplayObject = /** @class */ (function (_super) {
12443
12452
  options.usedAttributes = INHERITABLE_STYLE_PROPS;
12444
12453
  }
12445
12454
  // account for FCP, process properties as less as possible
12446
- var formattedAttributes = {};
12447
- for (var name_1 in attributes) {
12448
- var attributeName = formatAttributeName(name_1);
12449
- formattedAttributes[attributeName] = attributes[name_1];
12455
+ var formattedAttributes = attributes;
12456
+ if (runtime.enableAttributeDashCased) {
12457
+ // @ts-ignore
12458
+ formattedAttributes = {};
12459
+ for (var name_1 in attributes) {
12460
+ var attributeName = formatAttributeName(name_1);
12461
+ formattedAttributes[attributeName] = attributes[name_1];
12462
+ }
12450
12463
  }
12451
12464
  runtime.styleValueRegistry.processProperties(this, formattedAttributes, options);
12452
12465
  // redraw at next frame
@@ -12455,14 +12468,16 @@ var DisplayObject = /** @class */ (function (_super) {
12455
12468
  DisplayObject.prototype.setAttribute = function (name, value, force, memoize) {
12456
12469
  if (force === void 0) { force = false; }
12457
12470
  if (memoize === void 0) { memoize = true; }
12458
- var attributeName = formatAttributeName(name);
12471
+ if (runtime.enableAttributeDashCased) {
12472
+ name = formatAttributeName(name);
12473
+ }
12459
12474
  // ignore undefined value
12460
12475
  if (isUndefined(value)) {
12461
12476
  return;
12462
12477
  }
12463
- if (force || value !== this.attributes[attributeName]) {
12464
- this.internalSetAttribute(attributeName, value, { memoize: memoize });
12465
- _super.prototype.setAttribute.call(this, attributeName, value);
12478
+ if (force || value !== this.attributes[name]) {
12479
+ this.internalSetAttribute(name, value, { memoize: memoize });
12480
+ _super.prototype.setAttribute.call(this, name, value);
12466
12481
  }
12467
12482
  };
12468
12483
  /**
@@ -12716,8 +12731,10 @@ var DisplayObject = /** @class */ (function (_super) {
12716
12731
  * shortcut for Used value of `visibility`
12717
12732
  */
12718
12733
  DisplayObject.prototype.isVisible = function () {
12719
- var _a;
12720
- return ((_a = this.parsedStyle) === null || _a === void 0 ? void 0 : _a.visibility) === 'visible';
12734
+ var _a, _b;
12735
+ return runtime.enableCSSParsing
12736
+ ? ((_a = this.parsedStyle) === null || _a === void 0 ? void 0 : _a.visibility) === 'visible'
12737
+ : ((_b = this.parsedStyle) === null || _b === void 0 ? void 0 : _b.visibility) !== 'hidden';
12721
12738
  };
12722
12739
  Object.defineProperty(DisplayObject.prototype, "interactive", {
12723
12740
  get: function () {
@@ -12909,13 +12926,6 @@ var DisplayObject = /** @class */ (function (_super) {
12909
12926
  DisplayObject.prototype.add = function (child, index) {
12910
12927
  return this.appendChild(child, index);
12911
12928
  };
12912
- /**
12913
- * Use `this.style.clipPath` instead.
12914
- * @deprecated
12915
- */
12916
- DisplayObject.prototype.setClip = function (clipPath) {
12917
- this.style.clipPath = clipPath;
12918
- };
12919
12929
  /**
12920
12930
  * @deprecated
12921
12931
  */
@@ -13016,11 +13026,11 @@ var Ellipse = /** @class */ (function (_super) {
13016
13026
  */
13017
13027
  var Group = /** @class */ (function (_super) {
13018
13028
  __extends(Group, _super);
13019
- function Group(_a) {
13020
- if (_a === void 0) { _a = {}; }
13021
- var style = _a.style, rest = __rest(_a, ["style"]);
13022
- return _super.call(this, __assign({ type: Shape.GROUP, style: runtime.enableCSSParsing
13023
- ? __assign({ width: '', height: '' }, style) : __assign({}, style) }, rest)) || this;
13029
+ function Group(options) {
13030
+ if (options === void 0) { options = {}; }
13031
+ var _this = _super.call(this, options) || this;
13032
+ _this.nodeName = Shape.GROUP;
13033
+ return _this;
13024
13034
  }
13025
13035
  return Group;
13026
13036
  }(DisplayObject));
@@ -13093,11 +13103,11 @@ var HTML = /** @class */ (function (_super) {
13093
13103
 
13094
13104
  var Image = /** @class */ (function (_super) {
13095
13105
  __extends(Image, _super);
13096
- function Image(_a) {
13097
- if (_a === void 0) { _a = {}; }
13098
- var style = _a.style, rest = __rest(_a, ["style"]);
13099
- return _super.call(this, __assign({ type: Shape.IMAGE, style: runtime.enableCSSParsing
13100
- ? __assign({ x: '', y: '', img: '', width: '', height: '' }, style) : __assign({}, style) }, rest)) || this;
13106
+ function Image(options) {
13107
+ if (options === void 0) { options = {}; }
13108
+ var _this = _super.call(this, options) || this;
13109
+ _this.nodeName = Shape.IMAGE;
13110
+ return _this;
13101
13111
  }
13102
13112
  return Image;
13103
13113
  }(DisplayObject));
@@ -13628,11 +13638,11 @@ var Polyline = /** @class */ (function (_super) {
13628
13638
 
13629
13639
  var Rect = /** @class */ (function (_super) {
13630
13640
  __extends(Rect, _super);
13631
- function Rect(_a) {
13632
- if (_a === void 0) { _a = {}; }
13633
- var style = _a.style, rest = __rest(_a, ["style"]);
13634
- return _super.call(this, __assign({ type: Shape.RECT, style: runtime.enableCSSParsing
13635
- ? __assign({ x: '', y: '', width: '', height: '', radius: '' }, style) : __assign({}, style) }, rest)) || this;
13641
+ function Rect(options) {
13642
+ if (options === void 0) { options = {}; }
13643
+ var _this = _super.call(this, options) || this;
13644
+ _this.nodeName = Shape.RECT;
13645
+ return _this;
13636
13646
  }
13637
13647
  return Rect;
13638
13648
  }(DisplayObject));
@@ -14693,9 +14703,9 @@ var PrepareRendererPlugin = /** @class */ (function () {
14693
14703
  * sync to RBush later
14694
14704
  */
14695
14705
  this.toSync = new Set();
14706
+ // private isFirstTimeRendering = true;
14707
+ this.syncing = false;
14696
14708
  }
14697
- // private isFirstTimeRendering = true;
14698
- // private syncing = false;
14699
14709
  PrepareRendererPlugin.prototype.apply = function (context) {
14700
14710
  var _this = this;
14701
14711
  var renderingService = context.renderingService, renderingContext = context.renderingContext, rBushRoot = context.rBushRoot;
@@ -14757,25 +14767,17 @@ var PrepareRendererPlugin = /** @class */ (function () {
14757
14767
  _this.toSync.clear();
14758
14768
  });
14759
14769
  renderingService.hooks.endFrame.tap(PrepareRendererPlugin.tag, function () {
14760
- // if (this.isFirstTimeRendering) {
14761
- // this.isFirstTimeRendering = false;
14762
- // this.syncing = true;
14763
- // // @see https://github.com/antvis/G/issues/1117
14764
- // setTimeout(() => {
14765
- // this.syncRTree();
14766
- // console.log('fcp...');
14767
- // });
14768
- // } else {
14769
- // console.log('next...');
14770
- _this.syncRTree();
14771
- // }
14770
+ requestIdleCallback(function () {
14771
+ _this.syncRTree();
14772
+ });
14772
14773
  });
14773
14774
  };
14774
14775
  PrepareRendererPlugin.prototype.syncRTree = function () {
14775
- // if (this.syncing) {
14776
- // return;
14777
- // }
14778
14776
  var _this = this;
14777
+ if (this.syncing || this.toSync.size === 0) {
14778
+ return;
14779
+ }
14780
+ this.syncing = true;
14779
14781
  // bounds changed, need re-inserting its children
14780
14782
  var bulk = [];
14781
14783
  Array.from(this.toSync)
@@ -14815,7 +14817,7 @@ var PrepareRendererPlugin = /** @class */ (function () {
14815
14817
  this.rBush.load(bulk);
14816
14818
  bulk.length = 0;
14817
14819
  this.toSync.clear();
14818
- // this.syncing = false;
14820
+ this.syncing = false;
14819
14821
  };
14820
14822
  PrepareRendererPlugin.tag = 'Prepare';
14821
14823
  return PrepareRendererPlugin;