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

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 CHANGED
@@ -3165,7 +3165,7 @@ var getOrCreateUnitValue = function (value, unitOrName) {
3165
3165
  if (unitOrName === void 0) { unitOrName = UnitType.kNumber; }
3166
3166
  return new CSSUnitValue(value, unitOrName);
3167
3167
  };
3168
- var PECENTAGE_50 = new CSSUnitValue(50, '%');
3168
+ new CSSUnitValue(50, '%');
3169
3169
 
3170
3170
  /**
3171
3171
  * @see https://doc.babylonjs.com/how_to/optimizing_your_scene#changing-mesh-culling-strategy
@@ -4107,19 +4107,17 @@ function parseDimensionArray(string) {
4107
4107
  // },
4108
4108
  // ];
4109
4109
  // }
4110
- function convertPercentUnit(valueWithUnit, vec3Index, target) {
4111
- if (valueWithUnit.value === 0) {
4112
- return 0;
4113
- }
4110
+ function convertPercentUnit(valueWithUnit, vec3Index, target, useMin) {
4111
+ if (useMin === void 0) { useMin = false; }
4114
4112
  if (valueWithUnit.unit === UnitType.kPixels) {
4115
4113
  return Number(valueWithUnit.value);
4116
4114
  }
4117
4115
  else if (valueWithUnit.unit === UnitType.kPercentage && target) {
4118
4116
  var bounds = target.nodeName === Shape.GROUP
4119
4117
  ? target.getLocalBounds()
4120
- : // : target.getGeometryBounds();
4121
- target.geometry.contentBounds;
4122
- return (valueWithUnit.value / 100) * bounds.halfExtents[vec3Index] * 2;
4118
+ : target.getGeometryBounds();
4119
+ return ((useMin ? bounds.min[vec3Index] : 0) +
4120
+ (valueWithUnit.value / 100) * bounds.halfExtents[vec3Index] * 2);
4123
4121
  }
4124
4122
  return 0;
4125
4123
  }
@@ -4901,7 +4899,6 @@ function rectToCommands(width, height, x, y, radius) {
4901
4899
  /**
4902
4900
  * convert object to path, should account for:
4903
4901
  * * transform & origin
4904
- * * anchor
4905
4902
  * * lineWidth
4906
4903
  */
4907
4904
  function convertToPath(object, transform) {
@@ -5959,7 +5956,7 @@ function convertKeyword2Percent(keyword) {
5959
5956
  return '50%';
5960
5957
  }
5961
5958
  else if (keyword === 'left' || keyword === 'top') {
5962
- return '0';
5959
+ return '0%';
5963
5960
  }
5964
5961
  else if (keyword === 'right' || keyword === 'bottom') {
5965
5962
  return '100%';
@@ -6227,47 +6224,38 @@ var BUILT_IN_PROPERTIES = [
6227
6224
  {
6228
6225
  n: 'transformOrigin',
6229
6226
  p: 100,
6230
- // int: true,
6231
- d: function (nodeName) {
6232
- if (nodeName === Shape.CIRCLE || nodeName === Shape.ELLIPSE) {
6233
- return 'center';
6234
- }
6235
- if (nodeName === Shape.TEXT) {
6236
- return 'text-anchor';
6237
- }
6238
- return 'left top';
6239
- },
6227
+ d: '0 0',
6228
+ // // int: true,
6229
+ // d: (nodeName: string) => {
6230
+ // if (nodeName === Shape.CIRCLE || nodeName === Shape.ELLIPSE) {
6231
+ // return 'center';
6232
+ // }
6233
+ // if (nodeName === Shape.TEXT) {
6234
+ // return 'text-anchor';
6235
+ // }
6236
+ // return 'left top';
6237
+ // },
6240
6238
  l: true,
6241
6239
  syntax: PropertySyntax.TRANSFORM_ORIGIN,
6242
6240
  },
6243
- {
6244
- n: 'anchor',
6245
- p: 99,
6246
- d: function (nodeName) {
6247
- // if (nodeName === Shape.CIRCLE || nodeName === Shape.ELLIPSE) {
6248
- // return '0.5 0.5';
6249
- // }
6250
- return '0 0';
6251
- },
6252
- l: true,
6253
- syntax: PropertySyntax.LENGTH_PERCENTAGE_12,
6254
- },
6255
- // <circle> & <ellipse>
6256
6241
  {
6257
6242
  n: 'cx',
6258
6243
  int: true,
6244
+ l: true,
6259
6245
  d: '0',
6260
6246
  syntax: PropertySyntax.COORDINATE,
6261
6247
  },
6262
6248
  {
6263
6249
  n: 'cy',
6264
6250
  int: true,
6251
+ l: true,
6265
6252
  d: '0',
6266
6253
  syntax: PropertySyntax.COORDINATE,
6267
6254
  },
6268
6255
  {
6269
6256
  n: 'cz',
6270
6257
  int: true,
6258
+ l: true,
6271
6259
  d: '0',
6272
6260
  syntax: PropertySyntax.COORDINATE,
6273
6261
  },
@@ -6297,6 +6285,7 @@ var BUILT_IN_PROPERTIES = [
6297
6285
  // x in local space
6298
6286
  n: 'x',
6299
6287
  int: true,
6288
+ l: true,
6300
6289
  d: '0',
6301
6290
  syntax: PropertySyntax.COORDINATE,
6302
6291
  },
@@ -6304,6 +6293,7 @@ var BUILT_IN_PROPERTIES = [
6304
6293
  // y in local space
6305
6294
  n: 'y',
6306
6295
  int: true,
6296
+ l: true,
6307
6297
  d: '0',
6308
6298
  syntax: PropertySyntax.COORDINATE,
6309
6299
  },
@@ -6311,6 +6301,7 @@ var BUILT_IN_PROPERTIES = [
6311
6301
  // z in local space
6312
6302
  n: 'z',
6313
6303
  int: true,
6304
+ l: true,
6314
6305
  d: '0',
6315
6306
  syntax: PropertySyntax.COORDINATE,
6316
6307
  },
@@ -6674,11 +6665,6 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
6674
6665
  if (attributes.offsetPath) {
6675
6666
  this.runtime.CSSPropertySyntaxFactory['<defined-path>'].calculator('offsetPath', oldOffsetPath, attributes.offsetPath, object, this.runtime);
6676
6667
  }
6677
- if (attributes.anchor) {
6678
- object.parsedStyle.anchor = parseDimensionArrayFormat(
6679
- // @ts-ignorex
6680
- attributes.anchor, 2);
6681
- }
6682
6668
  if (attributes.transform) {
6683
6669
  object.parsedStyle.transform = parseTransform(attributes.transform);
6684
6670
  }
@@ -6713,14 +6699,6 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
6713
6699
  if (!isNil(attributes.zIndex)) {
6714
6700
  this.runtime.CSSPropertySyntaxFactory['<z-index>'].postProcessor(object, attributeNames_1);
6715
6701
  }
6716
- // @ts-ignore
6717
- if (attributes.path) {
6718
- this.runtime.CSSPropertySyntaxFactory['<path>'].postProcessor(object, attributeNames_1);
6719
- }
6720
- // @ts-ignore
6721
- if (attributes.points) {
6722
- this.runtime.CSSPropertySyntaxFactory['<list-of-points>'].postProcessor(object, attributeNames_1);
6723
- }
6724
6702
  if (!isNil(attributes.offsetDistance)) {
6725
6703
  this.runtime.CSSPropertySyntaxFactory['<offset-distance>'].postProcessor(object, attributeNames_1);
6726
6704
  }
@@ -6728,7 +6706,9 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
6728
6706
  this.runtime.CSSPropertySyntaxFactory['<transform>'].postProcessor(object, attributeNames_1);
6729
6707
  }
6730
6708
  if (needUpdateGeometry_1) {
6731
- this.updateGeometry(object);
6709
+ object.geometry.dirty = true;
6710
+ // FIXME setOrigin may have already dirtified to root.
6711
+ this.runtime.sceneGraphService.dirtifyToRoot(object);
6732
6712
  }
6733
6713
  return;
6734
6714
  }
@@ -6755,7 +6735,6 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
6755
6735
  // points 50
6756
6736
  // text 50
6757
6737
  // textTransform 51
6758
- // anchor 99
6759
6738
  // transform 100
6760
6739
  // transformOrigin 100
6761
6740
  if (usedAttributes === null || usedAttributes === void 0 ? void 0 : usedAttributes.length) {
@@ -6767,7 +6746,6 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
6767
6746
  // 'points',
6768
6747
  // 'text',
6769
6748
  // 'textTransform',
6770
- // 'anchor',
6771
6749
  // 'transform',
6772
6750
  // 'transformOrigin',
6773
6751
  // ].forEach((name) => {
@@ -6789,9 +6767,9 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
6789
6767
  // }
6790
6768
  // update geometry
6791
6769
  if (needUpdateGeometry) {
6792
- // object.geometry.dirty = true;
6793
- // runtime.sceneGraphService.dirtifyToRoot(object);
6794
- this.updateGeometry(object);
6770
+ object.geometry.dirty = true;
6771
+ // FIXME setOrigin may have already dirtified to root.
6772
+ this.runtime.sceneGraphService.dirtifyToRoot(object);
6795
6773
  }
6796
6774
  attributeNames.forEach(function (name) {
6797
6775
  if (name in object.parsedStyle) {
@@ -6988,7 +6966,7 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
6988
6966
  geometry_1.renderBounds = new AABB();
6989
6967
  }
6990
6968
  var parsedStyle = object.parsedStyle;
6991
- var _a = geometryUpdater.update(parsedStyle, object), cx = _a.cx, cy = _a.cy, _b = _a.cz, cz = _b === void 0 ? 0 : _b, hwidth = _a.hwidth, hheight = _a.hheight, _c = _a.hdepth, hdepth = _c === void 0 ? 0 : _c;
6969
+ 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;
6992
6970
  // init with content box
6993
6971
  var halfExtents = [
6994
6972
  Math.abs(hwidth),
@@ -7002,18 +6980,11 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
7002
6980
  // depth / 2,
7003
6981
  // );
7004
6982
  // anchor is center by default, don't account for lineWidth here
7005
- var _d = parsedStyle, stroke = _d.stroke, lineWidth = _d.lineWidth,
6983
+ var _h = parsedStyle, stroke = _h.stroke, lineWidth = _h.lineWidth,
7006
6984
  // lineCap,
7007
6985
  // lineJoin,
7008
6986
  // miterLimit,
7009
- increasedLineWidthForHitTesting = _d.increasedLineWidthForHitTesting, shadowType = _d.shadowType, shadowColor = _d.shadowColor, _e = _d.filter, filter = _e === void 0 ? [] : _e, transformOrigin = _d.transformOrigin;
7010
- // let anchor = parsedStyle.anchor;
7011
- // <Text> use textAlign & textBaseline instead of anchor
7012
- // if (nodeName === Shape.TEXT) {
7013
- // delete parsedStyle.anchor;
7014
- // } else if (nodeName === Shape.MESH) {
7015
- // parsedStyle.anchor[2] = 0.5;
7016
- // }
6987
+ increasedLineWidthForHitTesting = _h.increasedLineWidthForHitTesting, shadowType = _h.shadowType, shadowColor = _h.shadowColor, _j = _h.filter, filter = _j === void 0 ? [] : _j, transformOrigin = _h.transformOrigin;
7017
6988
  var center = [cx, cy, cz];
7018
6989
  // update geometry's AABB
7019
6990
  geometry_1.contentBounds.update(center, halfExtents);
@@ -7047,8 +7018,8 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
7047
7018
  geometry_1.renderBounds.update(center, halfExtents);
7048
7019
  // account for shadow, only support constant value now
7049
7020
  if (shadowColor && shadowType && shadowType !== 'inner') {
7050
- var _f = geometry_1.renderBounds, min = _f.min, max = _f.max;
7051
- var _g = parsedStyle, shadowBlur = _g.shadowBlur, shadowOffsetX = _g.shadowOffsetX, shadowOffsetY = _g.shadowOffsetY;
7021
+ var _k = geometry_1.renderBounds, min = _k.min, max = _k.max;
7022
+ var _l = parsedStyle, shadowBlur = _l.shadowBlur, shadowOffsetX = _l.shadowOffsetX, shadowOffsetY = _l.shadowOffsetY;
7052
7023
  var shadowBlurInPixels = shadowBlur || 0;
7053
7024
  var shadowOffsetXInPixels = shadowOffsetX || 0;
7054
7025
  var shadowOffsetYInPixels = shadowOffsetY || 0;
@@ -7085,25 +7056,22 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
7085
7056
  geometry_1.renderBounds.setMinMax(min, max);
7086
7057
  }
7087
7058
  });
7088
- // if (nodeName === Shape.RECT) {
7089
- // account for negative width / height of Rect
7059
+ object.geometry.dirty = false;
7090
7060
  // @see https://github.com/antvis/g/issues/957
7091
7061
  var flipY = hwidth < 0;
7092
7062
  var flipX = hheight < 0;
7093
- // } else {
7094
- // }
7095
7063
  // set transform origin
7096
7064
  var usedOriginXValue = (flipY ? -1 : 1) *
7097
7065
  (transformOrigin
7098
- ? convertPercentUnit(transformOrigin[0], 0, object)
7066
+ ? convertPercentUnit(transformOrigin[0], 0, object, true)
7099
7067
  : 0);
7100
7068
  var usedOriginYValue = (flipX ? -1 : 1) *
7101
7069
  (transformOrigin
7102
- ? convertPercentUnit(transformOrigin[1], 1, object)
7070
+ ? convertPercentUnit(transformOrigin[1], 1, object, true)
7103
7071
  : 0);
7104
- object.setOrigin(cx - hwidth + usedOriginXValue, cy - hheight + usedOriginYValue);
7105
- // FIXME setOrigin may have already dirtified to root.
7106
- this.runtime.sceneGraphService.dirtifyToRoot(object);
7072
+ if (usedOriginXValue || usedOriginYValue) {
7073
+ object.setOrigin(usedOriginXValue, usedOriginYValue);
7074
+ }
7107
7075
  }
7108
7076
  };
7109
7077
  DefaultStyleValueRegistry.prototype.isPropertyInheritable = function (name) {
@@ -7840,92 +7808,121 @@ function toFontString(attributes) {
7840
7808
  return "".concat(fontStyle, " ").concat(fontVariant, " ").concat(fontWeight, " ").concat(fontSizeString, " ").concat(fontFamilies.join(','));
7841
7809
  }
7842
7810
 
7843
- var tmpMat4 = mat4.create();
7811
+ function createSkewMatrix(skewMatrix, skewX, skewY) {
7812
+ // Create an identity matrix
7813
+ mat4.identity(skewMatrix);
7814
+ // Apply skew to the matrix
7815
+ skewMatrix[4] = Math.tan(skewX); // Skew Y axis in X direction
7816
+ skewMatrix[1] = Math.tan(skewY); // Skew X axis in Y direction
7817
+ return skewMatrix;
7818
+ }
7819
+ var tmpMat1 = mat4.create();
7820
+ var tmpMat2 = mat4.create();
7844
7821
  function parsedTransformToMat4(transform, object) {
7845
- // reset transform
7846
- object.resetLocalTransform();
7847
- transform.forEach(function (parsed) {
7848
- var t = parsed.t, d = parsed.d;
7849
- if (t === 'scale') {
7850
- // scale(1) scale(1, 1)
7851
- var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1, 1];
7852
- object.scaleLocal(newScale[0], newScale[1], 1);
7853
- }
7854
- else if (t === 'scalex') {
7855
- var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1];
7856
- object.scaleLocal(newScale[0], 1, 1);
7857
- }
7858
- else if (t === 'scaley') {
7859
- var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1];
7860
- object.scaleLocal(1, newScale[0], 1);
7861
- }
7862
- else if (t === 'scalez') {
7863
- var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1];
7864
- object.scaleLocal(1, 1, newScale[0]);
7865
- }
7866
- else if (t === 'scale3d') {
7867
- var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1, 1, 1];
7868
- object.scaleLocal(newScale[0], newScale[1], newScale[2]);
7869
- }
7870
- else if (t === 'translate') {
7871
- var newTranslation = d || [Opx, Opx];
7872
- object.translateLocal(newTranslation[0].value, newTranslation[1].value, 0);
7873
- }
7874
- else if (t === 'translatex') {
7875
- var newTranslation = d || [Opx];
7876
- object.translateLocal(newTranslation[0].value, 0, 0);
7877
- }
7878
- else if (t === 'translatey') {
7879
- var newTranslation = d || [Opx];
7880
- object.translateLocal(0, newTranslation[0].value, 0);
7881
- }
7882
- else if (t === 'translatez') {
7883
- var newTranslation = d || [Opx];
7884
- object.translateLocal(0, 0, newTranslation[0].value);
7885
- }
7886
- else if (t === 'translate3d') {
7887
- var newTranslation = d || [Opx, Opx, Opx];
7888
- object.translateLocal(newTranslation[0].value, newTranslation[1].value, newTranslation[2].value);
7889
- }
7890
- else if (t === 'rotate') {
7891
- var newAngles = d || [Odeg];
7892
- object.rotateLocal(0, 0, convertAngleUnit(newAngles[0]));
7893
- }
7894
- else if (t === 'rotatex') {
7895
- var newAngles = d || [Odeg];
7896
- object.rotateLocal(convertAngleUnit(newAngles[0]), 0, 0);
7897
- }
7898
- else if (t === 'rotatey') {
7899
- var newAngles = d || [Odeg];
7900
- object.rotateLocal(0, convertAngleUnit(newAngles[0]), 0);
7901
- }
7902
- else if (t === 'rotatez') {
7903
- var newAngles = d || [Odeg];
7904
- object.rotateLocal(0, 0, convertAngleUnit(newAngles[0]));
7905
- }
7906
- else if (t === 'rotate3d') ;
7907
- else if (t === 'skew') {
7908
- var newSkew = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [0, 0];
7909
- object.setLocalSkew(deg2rad(newSkew[0]), deg2rad(newSkew[1]));
7910
- }
7911
- else if (t === 'skewx') {
7912
- var newSkew = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [0];
7913
- object.setLocalSkew(deg2rad(newSkew[0]), object.getLocalSkew()[1]);
7914
- }
7915
- else if (t === 'skewy') {
7916
- var newSkew = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [0];
7917
- object.setLocalSkew(object.getLocalSkew()[0], deg2rad(newSkew[0]));
7918
- }
7919
- else if (t === 'matrix') {
7920
- var _a = __read(d.map(function (s) { return s.value; }), 6), a = _a[0], b = _a[1], c = _a[2], dd = _a[3], tx = _a[4], ty = _a[5];
7921
- object.setLocalTransform(mat4.set(tmpMat4, a, b, 0, 0, c, dd, 0, 0, 0, 0, 1, 0, tx, ty, 0, 1));
7922
- }
7923
- else if (t === 'matrix3d') {
7924
- // @ts-ignore
7925
- mat4.set.apply(mat4, __spreadArray([tmpMat4], __read(d.map(function (s) { return s.value; })), false));
7926
- object.setLocalTransform(tmpMat4);
7927
- }
7928
- });
7822
+ if (transform.length) {
7823
+ var m_1 = mat4.identity(tmpMat1);
7824
+ transform.forEach(function (parsed) {
7825
+ var t = parsed.t, d = parsed.d;
7826
+ if (t === 'scale') {
7827
+ // scale(1) scale(1, 1)
7828
+ var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1, 1];
7829
+ mat4.fromScaling(tmpMat2, [newScale[0], newScale[1], 1]);
7830
+ }
7831
+ else if (t === 'scalex') {
7832
+ var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1];
7833
+ mat4.fromScaling(tmpMat2, [newScale[0], 1, 1]);
7834
+ }
7835
+ else if (t === 'scaley') {
7836
+ var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1];
7837
+ mat4.fromScaling(tmpMat2, [1, newScale[0], 1]);
7838
+ }
7839
+ else if (t === 'scalez') {
7840
+ var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1];
7841
+ mat4.fromScaling(tmpMat2, [1, 1, newScale[0]]);
7842
+ }
7843
+ else if (t === 'scale3d') {
7844
+ var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1, 1, 1];
7845
+ mat4.fromScaling(tmpMat2, [newScale[0], newScale[1], newScale[2]]);
7846
+ }
7847
+ else if (t === 'translate') {
7848
+ var newTranslation = d || [Opx, Opx];
7849
+ mat4.fromTranslation(tmpMat2, [
7850
+ newTranslation[0].value,
7851
+ newTranslation[1].value,
7852
+ 0,
7853
+ ]);
7854
+ }
7855
+ else if (t === 'translatex') {
7856
+ var newTranslation = d || [Opx];
7857
+ mat4.fromTranslation(tmpMat2, [newTranslation[0].value, 0, 0]);
7858
+ }
7859
+ else if (t === 'translatey') {
7860
+ var newTranslation = d || [Opx];
7861
+ mat4.fromTranslation(tmpMat2, [0, newTranslation[0].value, 0]);
7862
+ }
7863
+ else if (t === 'translatez') {
7864
+ var newTranslation = d || [Opx];
7865
+ mat4.fromTranslation(tmpMat2, [0, 0, newTranslation[0].value]);
7866
+ }
7867
+ else if (t === 'translate3d') {
7868
+ var newTranslation = d || [Opx, Opx, Opx];
7869
+ mat4.fromTranslation(tmpMat2, [
7870
+ newTranslation[0].value,
7871
+ newTranslation[1].value,
7872
+ newTranslation[2].value,
7873
+ ]);
7874
+ }
7875
+ else if (t === 'rotate') {
7876
+ var newAngles = d || [Odeg];
7877
+ mat4.fromZRotation(tmpMat2, deg2rad(convertAngleUnit(newAngles[0])));
7878
+ }
7879
+ else if (t === 'rotatex') {
7880
+ var newAngles = d || [Odeg];
7881
+ mat4.fromXRotation(tmpMat2, deg2rad(convertAngleUnit(newAngles[0])));
7882
+ }
7883
+ else if (t === 'rotatey') {
7884
+ var newAngles = d || [Odeg];
7885
+ mat4.fromYRotation(tmpMat2, deg2rad(convertAngleUnit(newAngles[0])));
7886
+ }
7887
+ else if (t === 'rotatez') {
7888
+ var newAngles = d || [Odeg];
7889
+ mat4.fromZRotation(tmpMat2, deg2rad(convertAngleUnit(newAngles[0])));
7890
+ }
7891
+ else if (t === 'rotate3d') {
7892
+ var newAngles = d || [Opx, Opx, Opx, Odeg];
7893
+ mat4.fromRotation(tmpMat2, deg2rad(convertAngleUnit(newAngles[3])), [
7894
+ newAngles[0].value,
7895
+ newAngles[1].value,
7896
+ newAngles[2].value,
7897
+ ]);
7898
+ }
7899
+ else if (t === 'skew') {
7900
+ var newSkew = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [0, 0];
7901
+ createSkewMatrix(tmpMat2, deg2rad(newSkew[0]), deg2rad(newSkew[1]));
7902
+ }
7903
+ else if (t === 'skewx') {
7904
+ var newSkew = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [0];
7905
+ createSkewMatrix(tmpMat2, deg2rad(newSkew[0]), 0);
7906
+ }
7907
+ else if (t === 'skewy') {
7908
+ var newSkew = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [0];
7909
+ createSkewMatrix(tmpMat2, 0, deg2rad(newSkew[0]));
7910
+ }
7911
+ else if (t === 'matrix') {
7912
+ var _a = __read(d.map(function (s) { return s.value; }), 6), a = _a[0], b = _a[1], c = _a[2], dd = _a[3], tx = _a[4], ty = _a[5];
7913
+ mat4.set(tmpMat2, a, b, 0, 0, c, dd, 0, 0, 0, 0, 1, 0, tx, ty, 0, 1);
7914
+ }
7915
+ else if (t === 'matrix3d') {
7916
+ // @ts-ignore
7917
+ mat4.set.apply(mat4, __spreadArray([tmpMat2], __read(d.map(function (s) { return s.value; })), false));
7918
+ }
7919
+ mat4.mul(m_1, m_1, tmpMat2);
7920
+ });
7921
+ object.setLocalTransform(m_1);
7922
+ }
7923
+ else {
7924
+ object.resetLocalTransform();
7925
+ }
7929
7926
  return object.getLocalTransform();
7930
7927
  }
7931
7928
 
@@ -7989,17 +7986,18 @@ var CSSPropertyTransformOrigin = /** @class */ (function () {
7989
7986
  function CSSPropertyTransformOrigin() {
7990
7987
  this.parser = parseTransformOrigin;
7991
7988
  this.parserUnmemoize = parseTransformOriginUnmemoize;
7992
- // calculator(
7993
- // name: string,
7994
- // oldParsed: [CSSUnitValue, CSSUnitValue],
7995
- // parsed: [CSSUnitValue, CSSUnitValue],
7996
- // object: DisplayObject,
7997
- // ): [number, number] {
7998
- // console.log(object, parsed);
7999
- // return [parsed[0].value, parsed[1].value];
8000
- // // return [convertPercentUnit(parsed[0], 0, object), convertPercentUnit(parsed[1], 1, object)];
8001
- // }
8002
7989
  }
7990
+ CSSPropertyTransformOrigin.prototype.postProcessor = function (object) {
7991
+ var transformOrigin = object.parsedStyle.transformOrigin;
7992
+ if (transformOrigin[0].unit === UnitType.kPixels &&
7993
+ transformOrigin[1].unit === UnitType.kPixels) {
7994
+ object.setOrigin(transformOrigin[0].value, transformOrigin[1].value);
7995
+ }
7996
+ else {
7997
+ // Relative to geometry bounds, calculate later.
7998
+ object.getGeometryBounds();
7999
+ }
8000
+ };
8003
8001
  return CSSPropertyTransformOrigin;
8004
8002
  }());
8005
8003
 
@@ -8033,7 +8031,7 @@ var CircleUpdater = /** @class */ (function () {
8033
8031
  function CircleUpdater() {
8034
8032
  }
8035
8033
  CircleUpdater.prototype.update = function (parsedStyle, object) {
8036
- var cx = parsedStyle.cx, cy = parsedStyle.cy, r = parsedStyle.r;
8034
+ 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;
8037
8035
  return {
8038
8036
  cx: cx,
8039
8037
  cy: cy,
@@ -8048,7 +8046,7 @@ var EllipseUpdater = /** @class */ (function () {
8048
8046
  function EllipseUpdater() {
8049
8047
  }
8050
8048
  EllipseUpdater.prototype.update = function (parsedStyle, object) {
8051
- var cx = parsedStyle.cx, cy = parsedStyle.cy, rx = parsedStyle.rx, ry = parsedStyle.ry;
8049
+ 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;
8052
8050
  return {
8053
8051
  cx: cx,
8054
8052
  cy: cy,
@@ -8136,7 +8134,7 @@ var RectUpdater = /** @class */ (function () {
8136
8134
  function RectUpdater() {
8137
8135
  }
8138
8136
  RectUpdater.prototype.update = function (parsedStyle, object) {
8139
- var x = parsedStyle.x, y = parsedStyle.y, img = parsedStyle.img, _a = parsedStyle.width, width = _a === void 0 ? 0 : _a, _b = parsedStyle.height, height = _b === void 0 ? 0 : _b;
8137
+ 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;
8140
8138
  var contentWidth = width;
8141
8139
  var contentHeight = height;
8142
8140
  // resize with HTMLImageElement's size
@@ -8177,7 +8175,7 @@ var TextUpdater = /** @class */ (function () {
8177
8175
  };
8178
8176
  TextUpdater.prototype.update = function (parsedStyle, object) {
8179
8177
  var _a, _b;
8180
- var text = parsedStyle.text, textAlign = parsedStyle.textAlign, lineWidth = parsedStyle.lineWidth, textBaseline = parsedStyle.textBaseline, dx = parsedStyle.dx, dy = parsedStyle.dy, x = parsedStyle.x, y = parsedStyle.y;
8178
+ 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;
8181
8179
  if (!this.isReadyToMeasure(parsedStyle, object)) {
8182
8180
  parsedStyle.metrics = {
8183
8181
  font: '',
@@ -8249,6 +8247,20 @@ var TextUpdater = /** @class */ (function () {
8249
8247
  return TextUpdater;
8250
8248
  }());
8251
8249
 
8250
+ var GroupUpdater = /** @class */ (function () {
8251
+ function GroupUpdater() {
8252
+ }
8253
+ GroupUpdater.prototype.update = function (parsedStyle, object) {
8254
+ return {
8255
+ cx: 0,
8256
+ cy: 0,
8257
+ hwidth: 0,
8258
+ hheight: 0,
8259
+ };
8260
+ };
8261
+ return GroupUpdater;
8262
+ }());
8263
+
8252
8264
  function isFederatedEvent(value) {
8253
8265
  return !!value.type;
8254
8266
  }
@@ -8799,7 +8811,7 @@ var EventTarget = /** @class */ (function () {
8799
8811
  var Node = /** @class */ (function (_super) {
8800
8812
  __extends(Node, _super);
8801
8813
  function Node() {
8802
- var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
8814
+ var _this = _super.call(this) || this;
8803
8815
  _this.shadow = false;
8804
8816
  /**
8805
8817
  * points to canvas.document
@@ -10348,9 +10360,10 @@ var DefaultSceneGraphService = /** @class */ (function () {
10348
10360
  */
10349
10361
  this.rotate = (function () {
10350
10362
  var parentInvertRotation = quat$1.create();
10351
- return function (element, degrees, y, z) {
10363
+ return function (element, degrees, y, z, dirtify) {
10352
10364
  if (y === void 0) { y = 0; }
10353
10365
  if (z === void 0) { z = 0; }
10366
+ if (dirtify === void 0) { dirtify = true; }
10354
10367
  if (typeof degrees === 'number') {
10355
10368
  degrees = vec3.fromValues(degrees, y, z);
10356
10369
  }
@@ -10369,7 +10382,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
10369
10382
  quat$1.multiply(rotation, parentInvertRotation, rotation);
10370
10383
  quat$1.multiply(transform.localRotation, rotation, rot);
10371
10384
  quat$1.normalize(transform.localRotation, transform.localRotation);
10372
- _this.dirtifyLocal(element, transform);
10385
+ if (dirtify) {
10386
+ _this.dirtifyLocal(element, transform);
10387
+ }
10373
10388
  }
10374
10389
  };
10375
10390
  })();
@@ -10379,16 +10394,19 @@ var DefaultSceneGraphService = /** @class */ (function () {
10379
10394
  */
10380
10395
  this.rotateLocal = (function () {
10381
10396
  var rotation = quat$1.create();
10382
- return function (element, degrees, y, z) {
10397
+ return function (element, degrees, y, z, dirtify) {
10383
10398
  if (y === void 0) { y = 0; }
10384
10399
  if (z === void 0) { z = 0; }
10400
+ if (dirtify === void 0) { dirtify = true; }
10385
10401
  if (typeof degrees === 'number') {
10386
10402
  degrees = vec3.fromValues(degrees, y, z);
10387
10403
  }
10388
10404
  var transform = element.transformable;
10389
10405
  quat$1.fromEuler(rotation, degrees[0], degrees[1], degrees[2]);
10390
10406
  quat$1.mul(transform.localRotation, transform.localRotation, rotation);
10391
- _this.dirtifyLocal(element, transform);
10407
+ if (dirtify) {
10408
+ _this.dirtifyLocal(element, transform);
10409
+ }
10392
10410
  };
10393
10411
  })();
10394
10412
  /**
@@ -10396,9 +10414,10 @@ var DefaultSceneGraphService = /** @class */ (function () {
10396
10414
  */
10397
10415
  this.setEulerAngles = (function () {
10398
10416
  var invParentRot = quat$1.create();
10399
- return function (element, degrees, y, z) {
10417
+ return function (element, degrees, y, z, dirtify) {
10400
10418
  if (y === void 0) { y = 0; }
10401
10419
  if (z === void 0) { z = 0; }
10420
+ if (dirtify === void 0) { dirtify = true; }
10402
10421
  if (typeof degrees === 'number') {
10403
10422
  degrees = vec3.fromValues(degrees, y, z);
10404
10423
  }
@@ -10412,7 +10431,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
10412
10431
  var parentRotation = _this.getRotation(element.parentNode);
10413
10432
  quat$1.copy(invParentRot, quat$1.invert(quat$1.create(), parentRotation));
10414
10433
  quat$1.mul(transform.localRotation, transform.localRotation, invParentRot);
10415
- _this.dirtifyLocal(element, transform);
10434
+ if (dirtify) {
10435
+ _this.dirtifyLocal(element, transform);
10436
+ }
10416
10437
  }
10417
10438
  };
10418
10439
  })();
@@ -10426,9 +10447,10 @@ var DefaultSceneGraphService = /** @class */ (function () {
10426
10447
  * ```
10427
10448
  */
10428
10449
  this.translateLocal = (function () {
10429
- return function (element, translation, y, z) {
10450
+ return function (element, translation, y, z, dirtify) {
10430
10451
  if (y === void 0) { y = 0; }
10431
10452
  if (z === void 0) { z = 0; }
10453
+ if (dirtify === void 0) { dirtify = true; }
10432
10454
  if (typeof translation === 'number') {
10433
10455
  translation = vec3.fromValues(translation, y, z);
10434
10456
  }
@@ -10438,7 +10460,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
10438
10460
  }
10439
10461
  vec3.transformQuat(translation, translation, transform.localRotation);
10440
10462
  vec3.add(transform.localPosition, transform.localPosition, translation);
10441
- _this.dirtifyLocal(element, transform);
10463
+ if (dirtify) {
10464
+ _this.dirtifyLocal(element, transform);
10465
+ }
10442
10466
  };
10443
10467
  })();
10444
10468
  /**
@@ -10450,7 +10474,8 @@ var DefaultSceneGraphService = /** @class */ (function () {
10450
10474
  this.setPosition = (function () {
10451
10475
  var parentInvertMatrix = mat4.create();
10452
10476
  var tmpPosition = vec3.create();
10453
- return function (element, position) {
10477
+ return function (element, position, dirtify) {
10478
+ if (dirtify === void 0) { dirtify = true; }
10454
10479
  var transform = element.transformable;
10455
10480
  tmpPosition[0] = position[0];
10456
10481
  tmpPosition[1] = position[1];
@@ -10469,7 +10494,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
10469
10494
  mat4.invert(parentInvertMatrix, parentInvertMatrix);
10470
10495
  vec3.transformMat4(transform.localPosition, tmpPosition, parentInvertMatrix);
10471
10496
  }
10472
- _this.dirtifyLocal(element, transform);
10497
+ if (dirtify) {
10498
+ _this.dirtifyLocal(element, transform);
10499
+ }
10473
10500
  };
10474
10501
  })();
10475
10502
  /**
@@ -10477,7 +10504,8 @@ var DefaultSceneGraphService = /** @class */ (function () {
10477
10504
  */
10478
10505
  this.setLocalPosition = (function () {
10479
10506
  var tmpPosition = vec3.create();
10480
- return function (element, position) {
10507
+ return function (element, position, dirtify) {
10508
+ if (dirtify === void 0) { dirtify = true; }
10481
10509
  var transform = element.transformable;
10482
10510
  tmpPosition[0] = position[0];
10483
10511
  tmpPosition[1] = position[1];
@@ -10486,7 +10514,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
10486
10514
  return;
10487
10515
  }
10488
10516
  vec3.copy(transform.localPosition, tmpPosition);
10489
- _this.dirtifyLocal(element, transform);
10517
+ if (dirtify) {
10518
+ _this.dirtifyLocal(element, transform);
10519
+ }
10490
10520
  };
10491
10521
  })();
10492
10522
  /**
@@ -10505,9 +10535,10 @@ var DefaultSceneGraphService = /** @class */ (function () {
10505
10535
  var zeroVec3 = vec3.create();
10506
10536
  var tmpVec3 = vec3.create();
10507
10537
  var tr = vec3.create();
10508
- return function (element, translation, y, z) {
10538
+ return function (element, translation, y, z, dirtify) {
10509
10539
  if (y === void 0) { y = 0; }
10510
10540
  if (z === void 0) { z = 0; }
10541
+ if (dirtify === void 0) { dirtify = true; }
10511
10542
  if (typeof translation === 'number') {
10512
10543
  translation = vec3.set(tmpVec3, translation, y, z);
10513
10544
  }
@@ -10515,12 +10546,13 @@ var DefaultSceneGraphService = /** @class */ (function () {
10515
10546
  return;
10516
10547
  }
10517
10548
  vec3.add(tr, _this.getPosition(element), translation);
10518
- _this.setPosition(element, tr);
10549
+ _this.setPosition(element, tr, dirtify);
10519
10550
  };
10520
10551
  })();
10521
10552
  this.setRotation = function () {
10522
10553
  var parentInvertRotation = quat$1.create();
10523
- return function (element, rotation, y, z, w) {
10554
+ return function (element, rotation, y, z, w, dirtify) {
10555
+ if (dirtify === void 0) { dirtify = true; }
10524
10556
  var transform = element.transformable;
10525
10557
  if (typeof rotation === 'number') {
10526
10558
  rotation = quat$1.fromValues(rotation, y, z, w);
@@ -10535,7 +10567,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
10535
10567
  quat$1.invert(parentInvertRotation, parentInvertRotation);
10536
10568
  quat$1.multiply(transform.localRotation, parentInvertRotation, rotation);
10537
10569
  quat$1.normalize(transform.localRotation, transform.localRotation);
10538
- _this.dirtifyLocal(element, transform);
10570
+ if (dirtify) {
10571
+ _this.dirtifyLocal(element, transform);
10572
+ }
10539
10573
  }
10540
10574
  };
10541
10575
  };
@@ -10576,7 +10610,7 @@ var DefaultSceneGraphService = /** @class */ (function () {
10576
10610
  // .filter((node) => !node.shadow);
10577
10611
  };
10578
10612
  DefaultSceneGraphService.prototype.attach = function (child, parent, index) {
10579
- var _a, _b;
10613
+ var _a;
10580
10614
  var detached = false;
10581
10615
  if (child.parentNode) {
10582
10616
  detached = child.parentNode !== parent;
@@ -10592,7 +10626,7 @@ var DefaultSceneGraphService = /** @class */ (function () {
10592
10626
  // parent needs re-sort
10593
10627
  var sortable = parent.sortable;
10594
10628
  if (((_a = sortable === null || sortable === void 0 ? void 0 : sortable.sorted) === null || _a === void 0 ? void 0 : _a.length) ||
10595
- ((_b = child.style) === null || _b === void 0 ? void 0 : _b.zIndex)) {
10629
+ child.parsedStyle.zIndex) {
10596
10630
  if (sortable.dirtyChildren.indexOf(child) === -1) {
10597
10631
  sortable.dirtyChildren.push(child);
10598
10632
  }
@@ -10677,40 +10711,52 @@ var DefaultSceneGraphService = /** @class */ (function () {
10677
10711
  /**
10678
10712
  * set euler angles(degrees) in local space
10679
10713
  */
10680
- DefaultSceneGraphService.prototype.setLocalEulerAngles = function (element, degrees, y, z) {
10714
+ DefaultSceneGraphService.prototype.setLocalEulerAngles = function (element, degrees, y, z, dirtify) {
10681
10715
  if (y === void 0) { y = 0; }
10682
10716
  if (z === void 0) { z = 0; }
10717
+ if (dirtify === void 0) { dirtify = true; }
10683
10718
  if (typeof degrees === 'number') {
10684
10719
  degrees = vec3.fromValues(degrees, y, z);
10685
10720
  }
10686
10721
  var transform = element.transformable;
10687
10722
  quat$1.fromEuler(transform.localRotation, degrees[0], degrees[1], degrees[2]);
10688
- this.dirtifyLocal(element, transform);
10723
+ if (dirtify) {
10724
+ this.dirtifyLocal(element, transform);
10725
+ }
10689
10726
  };
10690
10727
  /**
10691
10728
  * scale in local space
10692
10729
  */
10693
- DefaultSceneGraphService.prototype.scaleLocal = function (element, scaling) {
10730
+ DefaultSceneGraphService.prototype.scaleLocal = function (element, scaling, dirtify) {
10731
+ if (dirtify === void 0) { dirtify = true; }
10694
10732
  var transform = element.transformable;
10695
10733
  vec3.multiply(transform.localScale, transform.localScale, vec3.fromValues(scaling[0], scaling[1], scaling[2] || 1));
10696
- this.dirtifyLocal(element, transform);
10734
+ if (dirtify) {
10735
+ this.dirtifyLocal(element, transform);
10736
+ }
10697
10737
  };
10698
- DefaultSceneGraphService.prototype.setLocalScale = function (element, scaling) {
10738
+ DefaultSceneGraphService.prototype.setLocalScale = function (element, scaling, dirtify) {
10739
+ if (dirtify === void 0) { dirtify = true; }
10699
10740
  var transform = element.transformable;
10700
10741
  var updatedScaling = vec3.fromValues(scaling[0], scaling[1], scaling[2] || transform.localScale[2]);
10701
10742
  if (vec3.equals(updatedScaling, transform.localScale)) {
10702
10743
  return;
10703
10744
  }
10704
10745
  vec3.copy(transform.localScale, updatedScaling);
10705
- this.dirtifyLocal(element, transform);
10746
+ if (dirtify) {
10747
+ this.dirtifyLocal(element, transform);
10748
+ }
10706
10749
  };
10707
- DefaultSceneGraphService.prototype.setLocalRotation = function (element, rotation, y, z, w) {
10750
+ DefaultSceneGraphService.prototype.setLocalRotation = function (element, rotation, y, z, w, dirtify) {
10751
+ if (dirtify === void 0) { dirtify = true; }
10708
10752
  if (typeof rotation === 'number') {
10709
10753
  rotation = quat$1.fromValues(rotation, y, z, w);
10710
10754
  }
10711
10755
  var transform = element.transformable;
10712
10756
  quat$1.copy(transform.localRotation, rotation);
10713
- this.dirtifyLocal(element, transform);
10757
+ if (dirtify) {
10758
+ this.dirtifyLocal(element, transform);
10759
+ }
10714
10760
  };
10715
10761
  DefaultSceneGraphService.prototype.setLocalSkew = function (element, skew, y) {
10716
10762
  if (typeof skew === 'number') {
@@ -10874,9 +10920,10 @@ var DefaultSceneGraphService = /** @class */ (function () {
10874
10920
  var t = mat4.getTranslation(vec3.create(), transform);
10875
10921
  var r = mat4.getRotation(quat$1.create(), transform);
10876
10922
  var s = mat4.getScaling(vec3.create(), transform);
10877
- this.setLocalScale(element, s);
10878
- this.setLocalPosition(element, t);
10879
- this.setLocalRotation(element, r);
10923
+ this.setLocalScale(element, s, false);
10924
+ this.setLocalPosition(element, t, false);
10925
+ this.setLocalRotation(element, r, undefined, undefined, undefined, false);
10926
+ this.dirtifyLocal(element, element.transformable);
10880
10927
  };
10881
10928
  DefaultSceneGraphService.prototype.resetLocalTransform = function (element) {
10882
10929
  this.setLocalScale(element, [1, 1, 1]);
@@ -10902,6 +10949,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
10902
10949
  DefaultSceneGraphService.prototype.getGeometryBounds = function (element, render) {
10903
10950
  if (render === void 0) { render = false; }
10904
10951
  var geometry = element.geometry;
10952
+ if (geometry.dirty) {
10953
+ runtime.styleValueRegistry.updateGeometry(element);
10954
+ }
10905
10955
  var bounds = render
10906
10956
  ? geometry.renderBounds
10907
10957
  : geometry.contentBounds || null;
@@ -11492,7 +11542,7 @@ var geometryUpdaterFactory = (function () {
11492
11542
  _a[Shape.ELLIPSE] = new EllipseUpdater(),
11493
11543
  _a[Shape.RECT] = rectUpdater,
11494
11544
  _a[Shape.IMAGE] = rectUpdater,
11495
- _a[Shape.GROUP] = rectUpdater,
11545
+ _a[Shape.GROUP] = new GroupUpdater(),
11496
11546
  _a[Shape.LINE] = new LineUpdater(),
11497
11547
  _a[Shape.TEXT] = new TextUpdater(runtime),
11498
11548
  _a[Shape.POLYLINE] = polylineUpdater,
@@ -11586,7 +11636,7 @@ var destroyEvent = new CustomEvent(ElementEvent.DESTROY);
11586
11636
  var Element = /** @class */ (function (_super) {
11587
11637
  __extends(Element, _super);
11588
11638
  function Element() {
11589
- var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
11639
+ var _this = _super.call(this) || this;
11590
11640
  /**
11591
11641
  * Unique id.
11592
11642
  */
@@ -11630,6 +11680,7 @@ var Element = /** @class */ (function (_super) {
11630
11680
  _this.geometry = {
11631
11681
  contentBounds: undefined,
11632
11682
  renderBounds: undefined,
11683
+ dirty: true,
11633
11684
  };
11634
11685
  _this.rBushNode = {
11635
11686
  aabb: undefined,
@@ -11657,7 +11708,6 @@ var Element = /** @class */ (function (_super) {
11657
11708
  _this.style = {};
11658
11709
  _this.computedStyle = runtime.enableCSSParsing
11659
11710
  ? {
11660
- anchor: unsetKeywordValue,
11661
11711
  opacity: unsetKeywordValue,
11662
11712
  fillOpacity: unsetKeywordValue,
11663
11713
  strokeOpacity: unsetKeywordValue,
@@ -11814,11 +11864,8 @@ var Element = /** @class */ (function (_super) {
11814
11864
  if ((_a = this.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView) {
11815
11865
  this.ownerDocument.defaultView.mountChildren(child);
11816
11866
  }
11817
- // @ts-ignore
11818
- if (child.isMutationObserved) {
11819
- insertedEvent.relatedNode = this;
11820
- child.dispatchEvent(insertedEvent);
11821
- }
11867
+ insertedEvent.relatedNode = this;
11868
+ child.dispatchEvent(insertedEvent);
11822
11869
  return child;
11823
11870
  };
11824
11871
  Element.prototype.insertBefore = function (newChild, refChild) {
@@ -12123,7 +12170,7 @@ var Element = /** @class */ (function (_super) {
12123
12170
  /**
12124
12171
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute
12125
12172
  */
12126
- Element.prototype.setAttribute = function (attributeName, value, force) {
12173
+ Element.prototype.setAttribute = function (attributeName, value, force, memoize) {
12127
12174
  this.attributes[attributeName] = value;
12128
12175
  };
12129
12176
  Element.prototype.getAttributeNS = function (namespace, localName) {
@@ -12164,7 +12211,6 @@ function isDisplayObject(value) {
12164
12211
  }
12165
12212
  var mutationEvent = new MutationEvent(ElementEvent.ATTR_MODIFIED, null, null, null, null, MutationEvent.MODIFICATION, null, null);
12166
12213
  var DEFAULT_STYLE_PROPS = {
12167
- anchor: '',
12168
12214
  opacity: '',
12169
12215
  fillOpacity: '',
12170
12216
  strokeOpacity: '',
@@ -12191,7 +12237,6 @@ var DEFAULT_STYLE_PROPS = {
12191
12237
  shadowType: '',
12192
12238
  };
12193
12239
  var DEFAULT_PARSED_STYLE_PROPS = {
12194
- anchor: [0, 0],
12195
12240
  fill: noneColor,
12196
12241
  stroke: noneColor,
12197
12242
  transform: [],
@@ -12262,8 +12307,6 @@ var DisplayObject = /** @class */ (function (_super) {
12262
12307
  // assign name, id to config
12263
12308
  // eg. group.get('name')
12264
12309
  _this.config = config;
12265
- // compatible with G 3.0
12266
- // this.config.interactive = this.config.capture ?? this.config.interactive;
12267
12310
  // init scene graph node
12268
12311
  _this.id = _this.config.id || '';
12269
12312
  _this.name = _this.config.name || '';
@@ -12271,23 +12314,6 @@ var DisplayObject = /** @class */ (function (_super) {
12271
12314
  _this.className = _this.config.className || _this.config.class;
12272
12315
  }
12273
12316
  _this.nodeName = _this.config.type || Shape.GROUP;
12274
- // // compatible with G 3.0
12275
- // this.config.style =
12276
- // this.config.style || this.config.attrs || ({} as StyleProps);
12277
- // // Object.assign(this.config.style, this.config.attrs);
12278
- // // this.config.style = {
12279
- // // // ...DEFAULT_STYLE_PROPS,
12280
- // // ...this.config.style,
12281
- // // ...this.config.attrs,
12282
- // // };
12283
- // if (this.config.visible != null) {
12284
- // this.config.style.visibility =
12285
- // this.config.visible === false ? 'hidden' : 'visible';
12286
- // }
12287
- // if (this.config.interactive != null) {
12288
- // this.config.style.pointerEvents =
12289
- // this.config.interactive === false ? 'none' : 'auto';
12290
- // }
12291
12317
  // merge parsed value
12292
12318
  Object.assign(_this.parsedStyle, runtime.enableCSSParsing
12293
12319
  ? DEFAULT_PARSED_STYLE_PROPS
@@ -12934,125 +12960,13 @@ var DisplayObject = /** @class */ (function (_super) {
12934
12960
  return DisplayObject;
12935
12961
  }(Element));
12936
12962
 
12937
- /**
12938
- * holds useful CSS-related methods.
12939
- * @see https://developer.mozilla.org/en-US/docs/Web/API/CSS
12940
- *
12941
- * * CSS Typed OM @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/factory_functions
12942
- * * register property @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/RegisterProperty
12943
- * * CSS Layout API
12944
- */
12945
- var CSS = {
12946
- /**
12947
- * <number>
12948
- * @see https://drafts.csswg.org/css-values-4/#number-value
12949
- */
12950
- number: function (n) {
12951
- return new CSSUnitValue(n);
12952
- },
12953
- /**
12954
- * <percentage>
12955
- * @see https://drafts.csswg.org/css-values-4/#percentage-value
12956
- */
12957
- percent: function (n) {
12958
- return new CSSUnitValue(n, '%');
12959
- },
12960
- /**
12961
- * <length>
12962
- */
12963
- px: function (n) {
12964
- return new CSSUnitValue(n, 'px');
12965
- },
12966
- /**
12967
- * <length>
12968
- */
12969
- em: function (n) {
12970
- return new CSSUnitValue(n, 'em');
12971
- },
12972
- rem: function (n) {
12973
- return new CSSUnitValue(n, 'rem');
12974
- },
12975
- /**
12976
- * <angle>
12977
- */
12978
- deg: function (n) {
12979
- return new CSSUnitValue(n, 'deg');
12980
- },
12981
- /**
12982
- * <angle>
12983
- */
12984
- grad: function (n) {
12985
- return new CSSUnitValue(n, 'grad');
12986
- },
12987
- /**
12988
- * <angle>
12989
- */
12990
- rad: function (n) {
12991
- return new CSSUnitValue(n, 'rad');
12992
- },
12993
- /**
12994
- * <angle>
12995
- */
12996
- turn: function (n) {
12997
- return new CSSUnitValue(n, 'turn');
12998
- },
12999
- /**
13000
- * <time>
13001
- */
13002
- s: function (n) {
13003
- return new CSSUnitValue(n, 's');
13004
- },
13005
- /**
13006
- * <time>
13007
- */
13008
- ms: function (n) {
13009
- return new CSSUnitValue(n, 'ms');
13010
- },
13011
- /**
13012
- * CSS Properties & Values API
13013
- *
13014
- * @see https://developer.mozilla.org/en-US/docs/Web/API/CSS_Properties_and_Values_API
13015
- * @see https://drafts.css-houdini.org/css-properties-values-api/#registering-custom-properties
13016
- * @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/RegisterProperty
13017
- */
13018
- registerProperty: function (definition) {
13019
- var name = definition.name, inherits = definition.inherits, interpolable = definition.interpolable, initialValue = definition.initialValue, syntax = definition.syntax;
13020
- runtime.styleValueRegistry.registerMetadata({
13021
- n: name,
13022
- inh: inherits,
13023
- int: interpolable,
13024
- d: initialValue,
13025
- syntax: syntax,
13026
- });
13027
- },
13028
- /**
13029
- * CSS Layout API
13030
- * register layout
13031
- *
13032
- * @see https://github.com/w3c/css-houdini-drafts/blob/main/css-layout-api/EXPLAINER.md
13033
- * @see https://developer.mozilla.org/en-US/docs/Web/Guide/Houdini#css_layout_api
13034
- */
13035
- registerLayout: function (name, clazz) {
13036
- runtime.layoutRegistry.registerLayout(name, clazz);
13037
- },
13038
- };
13039
-
13040
12963
  var Circle = /** @class */ (function (_super) {
13041
12964
  __extends(Circle, _super);
13042
- // constructor(options: DisplayObjectConfig<CircleStyleProps> = {}) {
13043
- // super(options);
13044
- // this.nodeName = Shape.CIRCLE;
13045
- // }
13046
- function Circle(_a) {
13047
- if (_a === void 0) { _a = {}; }
13048
- var style = _a.style, rest = __rest(_a, ["style"]);
13049
- return _super.call(this, __assign({ type: Shape.CIRCLE, style: runtime.enableCSSParsing
13050
- ? __assign({ cx: '', cy: '', r: '' }, style) : __assign({}, style), initialParsedStyle: {
13051
- // anchor: [0.5, 0.5],
13052
- transformOrigin: runtime.enableCSSParsing
13053
- ? null
13054
- : [PECENTAGE_50, PECENTAGE_50],
13055
- } }, rest)) || this;
12965
+ function Circle(options) {
12966
+ if (options === void 0) { options = {}; }
12967
+ var _this = _super.call(this, options) || this;
12968
+ _this.nodeName = Shape.CIRCLE;
12969
+ return _this;
13056
12970
  }
13057
12971
  return Circle;
13058
12972
  }(DisplayObject));
@@ -13069,7 +12983,7 @@ var CustomElement = /** @class */ (function (_super) {
13069
12983
  var _this = this;
13070
12984
  var style = _a.style, rest = __rest(_a, ["style"]);
13071
12985
  _this = _super.call(this, __assign({ style: runtime.enableCSSParsing
13072
- ? __assign({ x: '', y: '' }, style) : __assign({}, style) }, rest)) || this;
12986
+ ? __assign({}, style) : __assign({}, style) }, rest)) || this;
13073
12987
  // static get observedAttributes(): string[] {
13074
12988
  // return [];
13075
12989
  // }
@@ -13081,16 +12995,11 @@ var CustomElement = /** @class */ (function (_super) {
13081
12995
 
13082
12996
  var Ellipse = /** @class */ (function (_super) {
13083
12997
  __extends(Ellipse, _super);
13084
- function Ellipse(_a) {
13085
- if (_a === void 0) { _a = {}; }
13086
- var style = _a.style, rest = __rest(_a, ["style"]);
13087
- return _super.call(this, __assign({ type: Shape.ELLIPSE, style: runtime.enableCSSParsing
13088
- ? __assign({ cx: '', cy: '', rx: '', ry: '' }, style) : __assign({}, style), initialParsedStyle: {
13089
- // anchor: [0.5, 0.5],
13090
- transformOrigin: runtime.enableCSSParsing
13091
- ? null
13092
- : [PECENTAGE_50, PECENTAGE_50],
13093
- } }, rest)) || this;
12998
+ function Ellipse(options) {
12999
+ if (options === void 0) { options = {}; }
13000
+ var _this = _super.call(this, options) || this;
13001
+ _this.nodeName = Shape.ELLIPSE;
13002
+ return _this;
13094
13003
  }
13095
13004
  return Ellipse;
13096
13005
  }(DisplayObject));
@@ -13111,7 +13020,7 @@ var Group = /** @class */ (function (_super) {
13111
13020
  if (_a === void 0) { _a = {}; }
13112
13021
  var style = _a.style, rest = __rest(_a, ["style"]);
13113
13022
  return _super.call(this, __assign({ type: Shape.GROUP, style: runtime.enableCSSParsing
13114
- ? __assign({ x: '', y: '', width: '', height: '' }, style) : __assign({}, style) }, rest)) || this;
13023
+ ? __assign({ width: '', height: '' }, style) : __assign({}, style) }, rest)) || this;
13115
13024
  }
13116
13025
  return Group;
13117
13026
  }(DisplayObject));
@@ -13841,6 +13750,109 @@ var CustomElementRegistry = /** @class */ (function () {
13841
13750
  return CustomElementRegistry;
13842
13751
  }());
13843
13752
 
13753
+ /**
13754
+ * holds useful CSS-related methods.
13755
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/CSS
13756
+ *
13757
+ * * CSS Typed OM @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/factory_functions
13758
+ * * register property @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/RegisterProperty
13759
+ * * CSS Layout API
13760
+ */
13761
+ var CSS = {
13762
+ /**
13763
+ * <number>
13764
+ * @see https://drafts.csswg.org/css-values-4/#number-value
13765
+ */
13766
+ number: function (n) {
13767
+ return new CSSUnitValue(n);
13768
+ },
13769
+ /**
13770
+ * <percentage>
13771
+ * @see https://drafts.csswg.org/css-values-4/#percentage-value
13772
+ */
13773
+ percent: function (n) {
13774
+ return new CSSUnitValue(n, '%');
13775
+ },
13776
+ /**
13777
+ * <length>
13778
+ */
13779
+ px: function (n) {
13780
+ return new CSSUnitValue(n, 'px');
13781
+ },
13782
+ /**
13783
+ * <length>
13784
+ */
13785
+ em: function (n) {
13786
+ return new CSSUnitValue(n, 'em');
13787
+ },
13788
+ rem: function (n) {
13789
+ return new CSSUnitValue(n, 'rem');
13790
+ },
13791
+ /**
13792
+ * <angle>
13793
+ */
13794
+ deg: function (n) {
13795
+ return new CSSUnitValue(n, 'deg');
13796
+ },
13797
+ /**
13798
+ * <angle>
13799
+ */
13800
+ grad: function (n) {
13801
+ return new CSSUnitValue(n, 'grad');
13802
+ },
13803
+ /**
13804
+ * <angle>
13805
+ */
13806
+ rad: function (n) {
13807
+ return new CSSUnitValue(n, 'rad');
13808
+ },
13809
+ /**
13810
+ * <angle>
13811
+ */
13812
+ turn: function (n) {
13813
+ return new CSSUnitValue(n, 'turn');
13814
+ },
13815
+ /**
13816
+ * <time>
13817
+ */
13818
+ s: function (n) {
13819
+ return new CSSUnitValue(n, 's');
13820
+ },
13821
+ /**
13822
+ * <time>
13823
+ */
13824
+ ms: function (n) {
13825
+ return new CSSUnitValue(n, 'ms');
13826
+ },
13827
+ /**
13828
+ * CSS Properties & Values API
13829
+ *
13830
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/CSS_Properties_and_Values_API
13831
+ * @see https://drafts.css-houdini.org/css-properties-values-api/#registering-custom-properties
13832
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/RegisterProperty
13833
+ */
13834
+ registerProperty: function (definition) {
13835
+ var name = definition.name, inherits = definition.inherits, interpolable = definition.interpolable, initialValue = definition.initialValue, syntax = definition.syntax;
13836
+ runtime.styleValueRegistry.registerMetadata({
13837
+ n: name,
13838
+ inh: inherits,
13839
+ int: interpolable,
13840
+ d: initialValue,
13841
+ syntax: syntax,
13842
+ });
13843
+ },
13844
+ /**
13845
+ * CSS Layout API
13846
+ * register layout
13847
+ *
13848
+ * @see https://github.com/w3c/css-houdini-drafts/blob/main/css-layout-api/EXPLAINER.md
13849
+ * @see https://developer.mozilla.org/en-US/docs/Web/Guide/Houdini#css_layout_api
13850
+ */
13851
+ registerLayout: function (name, clazz) {
13852
+ runtime.layoutRegistry.registerLayout(name, clazz);
13853
+ },
13854
+ };
13855
+
13844
13856
  /**
13845
13857
  * the entry of DOM tree
13846
13858
  * Document -> Node -> EventTarget
@@ -15310,5 +15322,5 @@ var Canvas = /** @class */ (function (_super) {
15310
15322
  return Canvas;
15311
15323
  }(EventTarget));
15312
15324
 
15313
- export { AABB, AbstractRenderer, AbstractRendererPlugin, BUILT_IN_PROPERTIES, CSS, CSSGradientValue, CSSKeywordValue, CSSRGB, CSSStyleValue, CSSUnitValue, Camera, CameraEvent, CameraProjectionMode, CameraTrackingMode, CameraType, Canvas, CanvasEvent, Circle, CircleUpdater, ClipSpaceNearZ, CustomElement, CustomElementRegistry, CustomEvent, DefaultSceneGraphSelector, DefaultSceneGraphService, DisplayObject, Document, ERROR_MSG_METHOD_NOT_IMPLEMENTED, Element, ElementEvent, Ellipse, EllipseUpdater, EventService, EventTarget, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, Frustum, GradientType, Group, HTML, Image, Line, LineUpdater, Mask, MutationEvent, Node, OffscreenCanvasCreator, Path, PathUpdater, Plane, Point, Polygon, Polyline, PolylineUpdater, PropertySyntax, RBush, Rect, RectUpdater, Rectangle, RenderReason, RenderingService, Shape, SortReason, Strategy, Text, TextService, TextUpdater, UnitType, computeLinearGradient, computeRadialGradient, convertToPath, createVec3, decompose, definedProps, deg2rad, deg2turn, findClosestClipPathTarget, fromRotationTranslationScale, getAngle, getEuler, getOrCalculatePathTotalLength, grad2deg, isBrowser, isCSSGradientValue, isCSSRGB, isCanvas, isDisplayObject, isFederatedEvent, isFillOrStrokeAffected, isPattern, mergeColors, parseColor, parseLength, parsePath, parseTransform, parsedTransformToMat4, propertyMetadataCache, rad2deg, resetEntityCounter, runtime, setDOMSize, translatePathToString, turn2deg };
15325
+ export { AABB, AbstractRenderer, AbstractRendererPlugin, BUILT_IN_PROPERTIES, CSS, CSSGradientValue, CSSKeywordValue, CSSRGB, CSSStyleValue, CSSUnitValue, Camera, CameraEvent, CameraProjectionMode, CameraTrackingMode, CameraType, Canvas, CanvasEvent, Circle, CircleUpdater, ClipSpaceNearZ, CustomElement, CustomElementRegistry, CustomEvent, DefaultSceneGraphSelector, DefaultSceneGraphService, DisplayObject, Document, ERROR_MSG_METHOD_NOT_IMPLEMENTED, Element, ElementEvent, Ellipse, EllipseUpdater, EventService, EventTarget, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, Frustum, GradientType, Group, GroupUpdater, HTML, Image, Line, LineUpdater, Mask, MutationEvent, Node, OffscreenCanvasCreator, Path, PathUpdater, Plane, Point, Polygon, Polyline, PolylineUpdater, PropertySyntax, RBush, Rect, RectUpdater, Rectangle, RenderReason, RenderingService, Shape, SortReason, Strategy, Text, TextService, TextUpdater, UnitType, computeLinearGradient, computeRadialGradient, convertToPath, createVec3, decompose, definedProps, deg2rad, deg2turn, findClosestClipPathTarget, fromRotationTranslationScale, getAngle, getEuler, getOrCalculatePathTotalLength, grad2deg, isBrowser, isCSSGradientValue, isCSSRGB, isCanvas, isDisplayObject, isFederatedEvent, isFillOrStrokeAffected, isPattern, mergeColors, parseColor, parseLength, parsePath, parseTransform, parsedTransformToMat4, propertyMetadataCache, rad2deg, resetEntityCounter, runtime, setDOMSize, translatePathToString, turn2deg };
15314
15326
  //# sourceMappingURL=index.esm.js.map