@antv/g 5.5.0 → 5.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/css/StyleValueRegistry.d.ts +1 -0
  2. package/dist/css/StyleValueRegistry.d.ts.map +1 -1
  3. package/dist/css/cssom/CSSNumericValue.d.ts +1 -1
  4. package/dist/css/cssom/CSSStyleValue.d.ts +2 -2
  5. package/dist/css/cssom/CSSStyleValue.d.ts.map +1 -1
  6. package/dist/css/layout/LayoutObject.d.ts +2 -2
  7. package/dist/css/layout/LayoutObject.d.ts.map +1 -1
  8. package/dist/css/parser/dimension.d.ts +1 -0
  9. package/dist/css/parser/dimension.d.ts.map +1 -1
  10. package/dist/css/parser/path.d.ts.map +1 -1
  11. package/dist/css/properties/CSSPropertyClipPath.d.ts +1 -0
  12. package/dist/css/properties/CSSPropertyClipPath.d.ts.map +1 -1
  13. package/dist/css/properties/CSSPropertyFilter.d.ts +1 -0
  14. package/dist/css/properties/CSSPropertyFilter.d.ts.map +1 -1
  15. package/dist/css/properties/CSSPropertyLengthOrPercentage.d.ts.map +1 -1
  16. package/dist/css/properties/CSSPropertyNumber.d.ts +8 -0
  17. package/dist/css/properties/CSSPropertyNumber.d.ts.map +1 -0
  18. package/dist/css/properties/index.d.ts +1 -0
  19. package/dist/css/properties/index.d.ts.map +1 -1
  20. package/dist/display-objects/DisplayObject.d.ts +1 -0
  21. package/dist/display-objects/DisplayObject.d.ts.map +1 -1
  22. package/dist/display-objects/Line.d.ts.map +1 -1
  23. package/dist/display-objects/Path.d.ts +1 -1
  24. package/dist/display-objects/Path.d.ts.map +1 -1
  25. package/dist/display-objects/Polyline.d.ts.map +1 -1
  26. package/dist/dom/interfaces.d.ts +1 -0
  27. package/dist/dom/interfaces.d.ts.map +1 -1
  28. package/dist/global-module.d.ts.map +1 -1
  29. package/dist/index.esm.js +225 -106
  30. package/dist/index.js +224 -106
  31. package/dist/index.umd.js +224 -106
  32. package/dist/index.umd.min.js +2 -2
  33. package/dist/plugins/DirtyCheckPlugin.d.ts +0 -1
  34. package/dist/plugins/DirtyCheckPlugin.d.ts.map +1 -1
  35. package/dist/plugins/PrepareRendererPlugin.d.ts +1 -0
  36. package/dist/plugins/PrepareRendererPlugin.d.ts.map +1 -1
  37. package/dist/services/RenderingService.d.ts +13 -1
  38. package/dist/services/RenderingService.d.ts.map +1 -1
  39. package/dist/services/SceneGraphSelector.d.ts.map +1 -1
  40. package/dist/services/SceneGraphService.d.ts +6 -1
  41. package/dist/services/SceneGraphService.d.ts.map +1 -1
  42. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -5169,8 +5169,8 @@ var CSSStyleValue = /*#__PURE__*/function () {
5169
5169
  return exports.UnitType.kPixels;
5170
5170
 
5171
5171
  case exports.UnitCategory.kUPercent:
5172
- return exports.UnitType.kUnknown;
5173
- // Cannot convert between numbers and percent.
5172
+ return exports.UnitType.kPercentage;
5173
+ // return UnitType.kUnknown; // Cannot convert between numbers and percent.
5174
5174
 
5175
5175
  case exports.UnitCategory.kUTime:
5176
5176
  return exports.UnitType.kSeconds;
@@ -8010,6 +8010,10 @@ function parserPercentage(css) {
8010
8010
  */
8011
8011
 
8012
8012
  function parseLengthOrPercentage(css) {
8013
+ if (isNumber(css)) {
8014
+ return new CSSUnitValue(css, 'px');
8015
+ }
8016
+
8013
8017
  return parseDimension(new RegExp('px|%|em|rem', 'g'), css);
8014
8018
  }
8015
8019
  function parseAngle(css) {
@@ -8021,6 +8025,7 @@ function parseAngle(css) {
8021
8025
  * @example
8022
8026
  * 10px + 20px = 30px
8023
8027
  * 10deg + 10rad
8028
+ * 10% + 20% = 30%
8024
8029
  */
8025
8030
 
8026
8031
  function mergeDimensions(left, right, target, nonNegative, index) {
@@ -8030,23 +8035,29 @@ function mergeDimensions(left, right, target, nonNegative, index) {
8030
8035
 
8031
8036
  var unit = '';
8032
8037
  var leftValue = left.value || 0;
8033
- var rightValue = right.value || 0; // const canonicalUnit = CSSUnitValue.toCanonicalUnit(left.unit);
8034
- // const leftCanonicalUnitValue = left.convertTo(canonicalUnit);
8035
- // const rightCanonicalUnitValue = right.convertTo(canonicalUnit);
8036
- // format '%' to 'px'
8037
-
8038
- if (CSSUnitValue.isLength(left.unit) || CSSUnitValue.isLength(right.unit)) {
8039
- leftValue = convertPercentUnit(left, index, target);
8040
- rightValue = convertPercentUnit(right, index, target);
8041
- unit = 'px';
8042
- } // format 'rad' 'turn' to 'deg'
8043
-
8038
+ var rightValue = right.value || 0;
8039
+ var canonicalUnit = CSSUnitValue.toCanonicalUnit(left.unit);
8040
+ var leftCanonicalUnitValue = left.convertTo(canonicalUnit);
8041
+ var rightCanonicalUnitValue = right.convertTo(canonicalUnit);
8042
+
8043
+ if (leftCanonicalUnitValue && rightCanonicalUnitValue) {
8044
+ leftValue = leftCanonicalUnitValue.value;
8045
+ rightValue = rightCanonicalUnitValue.value;
8046
+ unit = CSSUnitValue.unitTypeToString(left.unit);
8047
+ } else {
8048
+ // format '%' to 'px'
8049
+ if (CSSUnitValue.isLength(left.unit) || CSSUnitValue.isLength(right.unit)) {
8050
+ leftValue = convertPercentUnit(left, index, target);
8051
+ rightValue = convertPercentUnit(right, index, target);
8052
+ unit = 'px';
8053
+ }
8054
+ } // // format 'rad' 'turn' to 'deg'
8055
+ // if (CSSUnitValue.isAngle(left.unit) || CSSUnitValue.isAngle(right.unit)) {
8056
+ // leftValue = convertAngleUnit(left);
8057
+ // rightValue = convertAngleUnit(right);
8058
+ // unit = 'deg';
8059
+ // }
8044
8060
 
8045
- if (CSSUnitValue.isAngle(left.unit) || CSSUnitValue.isAngle(right.unit)) {
8046
- leftValue = convertAngleUnit(left);
8047
- rightValue = convertAngleUnit(right);
8048
- unit = 'deg';
8049
- }
8050
8061
 
8051
8062
  return [leftValue, rightValue, function (value) {
8052
8063
  if (nonNegative) {
@@ -8180,6 +8191,10 @@ var memoizedParsePath = memoize(function (path) {
8180
8191
  var absolutePath;
8181
8192
 
8182
8193
  try {
8194
+ if (Array.isArray(path) && path.length === 0) {
8195
+ throw new Error();
8196
+ }
8197
+
8183
8198
  absolutePath = util.normalizePath(path);
8184
8199
  } catch (e) {
8185
8200
  absolutePath = util.normalizePath('');
@@ -8217,7 +8232,7 @@ var memoizedParsePath = memoize(function (path) {
8217
8232
  curve: curve,
8218
8233
  totalLength: length,
8219
8234
  zCommandIndexes: zCommandIndexes,
8220
- rect: new Rectangle(x, y, width, height)
8235
+ rect: new Rectangle(Number.isFinite(x) ? x : 0, Number.isFinite(y) ? y : 0, Number.isFinite(width) ? width : 0, Number.isFinite(height) ? height : 0)
8221
8236
  };
8222
8237
  }, function (path) {
8223
8238
  return isString(path) ? path : util.path2String(path);
@@ -11353,7 +11368,8 @@ var DEFAULT_STYLE_PROPS = {
11353
11368
  textAlign: '',
11354
11369
  textBaseline: '',
11355
11370
  textTransform: '',
11356
- zIndex: ''
11371
+ zIndex: '',
11372
+ filter: ''
11357
11373
  };
11358
11374
  /**
11359
11375
  * prototype chains: DisplayObject -> Element -> Node -> EventTarget
@@ -11396,6 +11412,7 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
11396
11412
  _this.styleValueRegistry = manaSyringe.GlobalContainer.get(StyleValueRegistry);
11397
11413
  _this.isCustomElement = false;
11398
11414
  _this.activeAnimations = [];
11415
+ _this.mutationEvent = new MutationEvent(exports.ElementEvent.ATTR_MODIFIED, _assertThisInitialized(_this), null, null, null, MutationEvent.MODIFICATION, null, null);
11399
11416
  _this.config = config; // compatible with G 3.0
11400
11417
 
11401
11418
  _this.config.interactive = (_this$config$capture = _this.config.capture) !== null && _this$config$capture !== void 0 ? _this$config$capture : _this.config.interactive; // init scene graph node
@@ -11542,7 +11559,8 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
11542
11559
 
11543
11560
  if (this.parsedStyle.clipPathTargets && this.parsedStyle.clipPathTargets.length) {
11544
11561
  this.parsedStyle.clipPathTargets.forEach(function (target) {
11545
- dirtifyToRoot(target);
11562
+ _this2.sceneGraphService.dirtifyToRoot(target);
11563
+
11546
11564
  target.dispatchEvent(new MutationEvent(exports.ElementEvent.ATTR_MODIFIED, target, _this2, _this2, 'clipPath', MutationEvent.MODIFICATION, _this2, _this2));
11547
11565
 
11548
11566
  if (target.isCustomElement && target.isConnected) {
@@ -11554,8 +11572,15 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
11554
11572
  } // redraw at next frame
11555
11573
 
11556
11574
 
11557
- renderable.dirty = true;
11558
- this.dispatchEvent(new MutationEvent(exports.ElementEvent.ATTR_MODIFIED, this, oldValue, value, name, MutationEvent.MODIFICATION, oldParsedValue, this.parsedStyle[name]));
11575
+ renderable.dirty = true; // trigger later
11576
+ // this.sceneGraphService.pendingEvents.push([ElementEvent.ATTR_MODIFIED, { affectChildren }]);
11577
+
11578
+ this.mutationEvent.prevValue = oldValue;
11579
+ this.mutationEvent.newValue = value;
11580
+ this.mutationEvent.attrName = name;
11581
+ this.mutationEvent.prevParsedValue = oldParsedValue;
11582
+ this.mutationEvent.newParsedValue = this.parsedStyle[name];
11583
+ this.dispatchEvent(this.mutationEvent);
11559
11584
 
11560
11585
  if (this.isCustomElement && this.isConnected) {
11561
11586
  if (this.attributeChangedCallback) {
@@ -12395,9 +12420,17 @@ var Line = /*#__PURE__*/function (_DisplayObject) {
12395
12420
  x1 = _this$parsedStyle.x1,
12396
12421
  y1 = _this$parsedStyle.y1,
12397
12422
  x2 = _this$parsedStyle.x2,
12398
- y2 = _this$parsedStyle.y2;
12399
- var point = gMath.Line.pointAt(x1.value, y1.value, x2.value, y2.value, ratio);
12400
- return new Point(point.x, point.y);
12423
+ y2 = _this$parsedStyle.y2,
12424
+ defX = _this$parsedStyle.defX,
12425
+ defY = _this$parsedStyle.defY;
12426
+
12427
+ var _LineUtil$pointAt = gMath.Line.pointAt(x1.value, y1.value, x2.value, y2.value, ratio),
12428
+ x = _LineUtil$pointAt.x,
12429
+ y = _LineUtil$pointAt.y;
12430
+
12431
+ var transformed = glMatrix.vec3.transformMat4(glMatrix.vec3.create(), glMatrix.vec3.fromValues(x - defX, y - defY, 0), this.getLocalTransform()); // apply local transformation
12432
+
12433
+ return new Point(transformed[0], transformed[1]);
12401
12434
  };
12402
12435
 
12403
12436
  _proto.getTotalLength = function getTotalLength() {
@@ -12442,7 +12475,10 @@ var Path = /*#__PURE__*/function (_DisplayObject) {
12442
12475
  ;
12443
12476
 
12444
12477
  _proto.getPoint = function getPoint(ratio) {
12445
- var _this$parsedStyle$pat = this.parsedStyle.path,
12478
+ var _this$parsedStyle = this.parsedStyle,
12479
+ defX = _this$parsedStyle.defX,
12480
+ defY = _this$parsedStyle.defY,
12481
+ _this$parsedStyle$pat = _this$parsedStyle.path,
12446
12482
  totalLength = _this$parsedStyle$pat.totalLength,
12447
12483
  absolutePath = _this$parsedStyle$pat.absolutePath;
12448
12484
 
@@ -12450,7 +12486,9 @@ var Path = /*#__PURE__*/function (_DisplayObject) {
12450
12486
  x = _getPointAtLength.x,
12451
12487
  y = _getPointAtLength.y;
12452
12488
 
12453
- return new Point(x, y);
12489
+ var transformed = glMatrix.vec3.transformMat4(glMatrix.vec3.create(), glMatrix.vec3.fromValues(x - defX, y - defY, 0), this.getLocalTransform()); // apply local transformation
12490
+
12491
+ return new Point(transformed[0], transformed[1]);
12454
12492
  }
12455
12493
  /**
12456
12494
  * Get start tangent vector
@@ -12555,7 +12593,10 @@ var Polyline = /*#__PURE__*/function (_DisplayObject) {
12555
12593
  };
12556
12594
 
12557
12595
  _proto.getPoint = function getPoint(ratio) {
12558
- var _this$parsedStyle$poi = this.parsedStyle.points,
12596
+ var _this$parsedStyle = this.parsedStyle,
12597
+ defX = _this$parsedStyle.defX,
12598
+ defY = _this$parsedStyle.defY,
12599
+ _this$parsedStyle$poi = _this$parsedStyle.points,
12559
12600
  points = _this$parsedStyle$poi.points,
12560
12601
  segments = _this$parsedStyle$poi.segments;
12561
12602
  var subt = 0;
@@ -12571,7 +12612,9 @@ var Polyline = /*#__PURE__*/function (_DisplayObject) {
12571
12612
  x = _LineUtil$pointAt.x,
12572
12613
  y = _LineUtil$pointAt.y;
12573
12614
 
12574
- return new Point(x, y);
12615
+ var transformed = glMatrix.vec3.transformMat4(glMatrix.vec3.create(), glMatrix.vec3.fromValues(x - defX, y - defY, 0), this.getLocalTransform()); // apply local transformation
12616
+
12617
+ return new Point(transformed[0], transformed[1]);
12575
12618
  };
12576
12619
 
12577
12620
  _proto.getStartTangent = function getStartTangent() {
@@ -14228,7 +14271,7 @@ exports.DefaultSceneGraphSelector = /*#__PURE__*/function () {
14228
14271
  if (query.startsWith('.')) {
14229
14272
  return root.find(function (node) {
14230
14273
  // return !node.shadow && node.id === query.substring(1);
14231
- return node.className === _this.getIdOrClassname(query);
14274
+ return ((node === null || node === void 0 ? void 0 : node.classList) || []).indexOf(_this.getIdOrClassname(query)) > -1;
14232
14275
  });
14233
14276
  } else if (query.startsWith('#')) {
14234
14277
  // getElementById('id')
@@ -14265,7 +14308,7 @@ exports.DefaultSceneGraphSelector = /*#__PURE__*/function () {
14265
14308
  // getElementsByClassName('className');
14266
14309
  // should not include itself
14267
14310
  return root.findAll(function (node) {
14268
- return root !== node && node.className === _this2.getIdOrClassname(query);
14311
+ return root !== node && ((node === null || node === void 0 ? void 0 : node.classList) || []).indexOf(_this2.getIdOrClassname(query)) > -1;
14269
14312
  });
14270
14313
  } else if (query.startsWith('#')) {
14271
14314
  return root.findAll(function (node) {
@@ -14371,29 +14414,6 @@ function sortByZIndex(o1, o2) {
14371
14414
 
14372
14415
  return zIndex1 - zIndex2;
14373
14416
  }
14374
- function dirtifyToRoot(element, affectChildren) {
14375
- if (affectChildren === void 0) {
14376
- affectChildren = false;
14377
- }
14378
-
14379
- var p = element;
14380
-
14381
- while (p) {
14382
- var renderable = p.renderable;
14383
-
14384
- if (renderable) {
14385
- renderable.renderBoundsDirty = true;
14386
- renderable.boundsDirty = true;
14387
- renderable.dirty = true;
14388
- }
14389
-
14390
- p = p.parentNode;
14391
- }
14392
-
14393
- element.dispatchEvent(new CustomEvent(exports.ElementEvent.BOUNDS_CHANGED, {
14394
- affectChildren: affectChildren
14395
- }));
14396
- }
14397
14417
  var SceneGraphService = manaSyringe.Syringe.defineToken('SceneGraphService');
14398
14418
  /**
14399
14419
  * update transform in scene graph
@@ -14406,6 +14426,8 @@ exports.DefaultSceneGraphService = /*#__PURE__*/function () {
14406
14426
  var _this = this;
14407
14427
 
14408
14428
  this.sceneGraphSelectorFactory = void 0;
14429
+ this.pendingEvents = [];
14430
+ this.boundsChangedEvent = new CustomEvent(exports.ElementEvent.BOUNDS_CHANGED);
14409
14431
 
14410
14432
  this.rotate = function () {
14411
14433
  var parentInvertRotation = glMatrix.quat.create();
@@ -14839,7 +14861,63 @@ exports.DefaultSceneGraphService = /*#__PURE__*/function () {
14839
14861
  }
14840
14862
 
14841
14863
  this.dirtifyWorldInternal(element, transform);
14842
- dirtifyToRoot(element, true);
14864
+ this.dirtifyToRoot(element, true);
14865
+ };
14866
+
14867
+ _proto.triggerPendingEvents = function triggerPendingEvents() {
14868
+ var _this2 = this;
14869
+
14870
+ var set = new Set();
14871
+
14872
+ var trigger = function trigger(element, detail) {
14873
+ if (!set.has(element.entity)) {
14874
+ _this2.boundsChangedEvent.detail = detail;
14875
+ element.dispatchEvent(_this2.boundsChangedEvent);
14876
+ set.add(element.entity);
14877
+ }
14878
+ };
14879
+
14880
+ this.pendingEvents.forEach(function (_ref) {
14881
+ var element = _ref[0],
14882
+ detail = _ref[1];
14883
+
14884
+ if (detail.affectChildren) {
14885
+ element.forEach(function (e) {
14886
+ trigger(e, detail);
14887
+ });
14888
+ } else {
14889
+ trigger(element, detail);
14890
+ }
14891
+ });
14892
+ this.pendingEvents = [];
14893
+ };
14894
+
14895
+ _proto.dirtifyToRoot = function dirtifyToRoot(element, affectChildren) {
14896
+ if (affectChildren === void 0) {
14897
+ affectChildren = false;
14898
+ }
14899
+
14900
+ var p = element; // only need to re-render itself
14901
+
14902
+ if (p.renderable) {
14903
+ p.renderable.dirty = true;
14904
+ }
14905
+
14906
+ while (p) {
14907
+ var renderable = p.renderable;
14908
+
14909
+ if (renderable) {
14910
+ renderable.renderBoundsDirty = true;
14911
+ renderable.boundsDirty = true;
14912
+ }
14913
+
14914
+ p = p.parentNode;
14915
+ } // reuse the same custom event
14916
+
14917
+
14918
+ this.pendingEvents.push([element, {
14919
+ affectChildren: affectChildren
14920
+ }]);
14843
14921
  };
14844
14922
 
14845
14923
  _proto.getPosition = function getPosition(element) {
@@ -14975,7 +15053,7 @@ exports.DefaultSceneGraphService = /*#__PURE__*/function () {
14975
15053
  ;
14976
15054
 
14977
15055
  _proto.getBounds = function getBounds(element, render) {
14978
- var _this2 = this;
15056
+ var _this3 = this;
14979
15057
 
14980
15058
  if (render === void 0) {
14981
15059
  render = false;
@@ -14996,7 +15074,7 @@ exports.DefaultSceneGraphService = /*#__PURE__*/function () {
14996
15074
 
14997
15075
  var children = element.childNodes;
14998
15076
  children.forEach(function (child) {
14999
- var childBounds = _this2.getBounds(child, render);
15077
+ var childBounds = _this3.getBounds(child, render);
15000
15078
 
15001
15079
  if (childBounds) {
15002
15080
  if (!aabb) {
@@ -15008,7 +15086,7 @@ exports.DefaultSceneGraphService = /*#__PURE__*/function () {
15008
15086
  }
15009
15087
  }); // account for clip path
15010
15088
 
15011
- var clipPath = element.style.clipPath;
15089
+ var clipPath = element.parsedStyle.clipPath;
15012
15090
 
15013
15091
  if (clipPath) {
15014
15092
  var clipPathBounds = this.getTransformedGeometryBounds(clipPath, true);
@@ -15099,7 +15177,7 @@ exports.DefaultSceneGraphService = /*#__PURE__*/function () {
15099
15177
  };
15100
15178
 
15101
15179
  _proto.dirtifyWorldInternal = function dirtifyWorldInternal(element, transform) {
15102
- var _this3 = this;
15180
+ var _this4 = this;
15103
15181
 
15104
15182
  if (!transform.dirtyFlag) {
15105
15183
  transform.dirtyFlag = true;
@@ -15108,7 +15186,7 @@ exports.DefaultSceneGraphService = /*#__PURE__*/function () {
15108
15186
  var childTransform = child.transformable;
15109
15187
 
15110
15188
  if (!childTransform.dirtyFlag) {
15111
- _this3.dirtifyWorldInternal(child, childTransform);
15189
+ _this4.dirtifyWorldInternal(child, childTransform);
15112
15190
  }
15113
15191
  });
15114
15192
  var renderable = element.renderable;
@@ -15118,8 +15196,6 @@ exports.DefaultSceneGraphService = /*#__PURE__*/function () {
15118
15196
  renderable.boundsDirty = true;
15119
15197
  renderable.dirty = true;
15120
15198
  }
15121
-
15122
- element.dispatchEvent(new MutationEvent(exports.ElementEvent.ATTR_MODIFIED, element, null, null, 'modelMatrix', MutationEvent.MODIFICATION, null, null));
15123
15199
  }
15124
15200
  };
15125
15201
 
@@ -16357,6 +16433,7 @@ var RenderingPluginContribution = manaSyringe.Syringe.defineToken('RenderingPlug
16357
16433
  exports.RenderingService = /*#__PURE__*/function () {
16358
16434
  function RenderingService() {
16359
16435
  this.renderingPluginProvider = void 0;
16436
+ this.canvasConfig = void 0;
16360
16437
  this.renderingContext = void 0;
16361
16438
  this.sceneGraphService = void 0;
16362
16439
  this.styleValueRegistry = void 0;
@@ -16374,6 +16451,7 @@ exports.RenderingService = /*#__PURE__*/function () {
16374
16451
  rendered: 0
16375
16452
  };
16376
16453
  this.zIndexCounter = 0;
16454
+ this.renderOrderChangedEvent = new CustomEvent(exports.ElementEvent.RENDER_ORDER_CHANGED);
16377
16455
  this.hooks = {
16378
16456
  /**
16379
16457
  * called before any frame rendered
@@ -16470,6 +16548,21 @@ exports.RenderingService = /*#__PURE__*/function () {
16470
16548
 
16471
16549
  _proto.getStats = function getStats() {
16472
16550
  return this.stats;
16551
+ }
16552
+ /**
16553
+ * Meet the following conditions:
16554
+ * * disable DirtyRectangleRendering
16555
+ * * camera changed
16556
+ */
16557
+ ;
16558
+
16559
+ _proto.disableDirtyRectangleRendering = function disableDirtyRectangleRendering() {
16560
+ var renderer = this.canvasConfig.renderer;
16561
+
16562
+ var _renderer$getConfig = renderer.getConfig(),
16563
+ enableDirtyRectangleRendering = _renderer$getConfig.enableDirtyRectangleRendering;
16564
+
16565
+ return !enableDirtyRectangleRendering || this.renderingContext.renderReasons.has(exports.RenderReason.CAMERA_CHANGED);
16473
16566
  };
16474
16567
 
16475
16568
  _proto.render = function render(canvasConfig) {
@@ -16479,6 +16572,7 @@ exports.RenderingService = /*#__PURE__*/function () {
16479
16572
  this.stats.rendered = 0;
16480
16573
  this.zIndexCounter = 0;
16481
16574
  this.sceneGraphService.syncHierarchy(this.renderingContext.root);
16575
+ this.sceneGraphService.triggerPendingEvents();
16482
16576
 
16483
16577
  if (this.renderingContext.renderReasons.size && this.inited) {
16484
16578
  this.renderDisplayObject(this.renderingContext.root, canvasConfig);
@@ -16544,9 +16638,10 @@ exports.RenderingService = /*#__PURE__*/function () {
16544
16638
 
16545
16639
  if (renderOrderChanged) {
16546
16640
  displayObject.forEach(function (child) {
16547
- child.dispatchEvent(new CustomEvent(exports.ElementEvent.RENDER_ORDER_CHANGED, {
16641
+ _this3.renderOrderChangedEvent.detail = {
16548
16642
  renderOrder: child.sortable.renderOrder
16549
- }));
16643
+ };
16644
+ child.dispatchEvent(_this3.renderOrderChangedEvent);
16550
16645
  });
16551
16646
  }
16552
16647
  };
@@ -16566,6 +16661,8 @@ exports.RenderingService = /*#__PURE__*/function () {
16566
16661
 
16567
16662
  tslib.__decorate([manaSyringe.contrib(RenderingPluginContribution), tslib.__metadata("design:type", Object)], exports.RenderingService.prototype, "renderingPluginProvider", void 0);
16568
16663
 
16664
+ tslib.__decorate([manaSyringe.inject(CanvasConfig), tslib.__metadata("design:type", Object)], exports.RenderingService.prototype, "canvasConfig", void 0);
16665
+
16569
16666
  tslib.__decorate([manaSyringe.inject(RenderingContext), tslib.__metadata("design:type", Object)], exports.RenderingService.prototype, "renderingContext", void 0);
16570
16667
 
16571
16668
  tslib.__decorate([manaSyringe.inject(SceneGraphService), tslib.__metadata("design:type", Object)], exports.RenderingService.prototype, "sceneGraphService", void 0);
@@ -18559,7 +18656,9 @@ exports.PathUpdater = tslib.__decorate([manaSyringe.singleton({
18559
18656
  */
18560
18657
 
18561
18658
  exports.CSSPropertyClipPath = /*#__PURE__*/function () {
18562
- function CSSPropertyClipPath() {}
18659
+ function CSSPropertyClipPath() {
18660
+ this.sceneGraphService = void 0;
18661
+ }
18563
18662
 
18564
18663
  var _proto = CSSPropertyClipPath.prototype;
18565
18664
 
@@ -18583,13 +18682,15 @@ exports.CSSPropertyClipPath = /*#__PURE__*/function () {
18583
18682
  newClipPath.parsedStyle.clipPathTargets.push(object);
18584
18683
  }
18585
18684
 
18586
- dirtifyToRoot(object);
18685
+ this.sceneGraphService.dirtifyToRoot(object);
18587
18686
  return newClipPath;
18588
18687
  };
18589
18688
 
18590
18689
  return CSSPropertyClipPath;
18591
18690
  }();
18592
18691
 
18692
+ tslib.__decorate([manaSyringe.inject(SceneGraphService), tslib.__metadata("design:type", Object)], exports.CSSPropertyClipPath.prototype, "sceneGraphService", void 0);
18693
+
18593
18694
  exports.CSSPropertyClipPath = tslib.__decorate([manaSyringe.singleton({
18594
18695
  token: {
18595
18696
  token: CSSProperty,
@@ -18627,9 +18728,24 @@ exports.CSSPropertyColor = tslib.__decorate([manaSyringe.singleton({
18627
18728
  }]
18628
18729
  })], exports.CSSPropertyColor);
18629
18730
 
18630
- exports.CSSPropertyFilter = function CSSPropertyFilter() {
18631
- this.parser = parseFilter;
18632
- };
18731
+ exports.CSSPropertyFilter = /*#__PURE__*/function () {
18732
+ function CSSPropertyFilter() {
18733
+ this.parser = parseFilter;
18734
+ }
18735
+
18736
+ var _proto = CSSPropertyFilter.prototype;
18737
+
18738
+ _proto.calculator = function calculator(name, oldParsed, parsed) {
18739
+ // unset or none
18740
+ if (parsed instanceof CSSKeywordValue) {
18741
+ return [];
18742
+ }
18743
+
18744
+ return parsed;
18745
+ };
18746
+
18747
+ return CSSPropertyFilter;
18748
+ }();
18633
18749
 
18634
18750
  exports.CSSPropertyFilter = tslib.__decorate([manaSyringe.singleton({
18635
18751
  token: {
@@ -18669,21 +18785,6 @@ exports.CSSPropertyLengthOrPercentage = /*#__PURE__*/function () {
18669
18785
  _proto.calculator = function calculator(name, oldParsed, computed, object, registry) {
18670
18786
  if (CSSUnitValue.isRelativeUnit(computed.unit)) {
18671
18787
  if (computed.unit === exports.UnitType.kPercentage) {
18672
- // try to resolve according to parent's geometry bounds
18673
- // if (object.parentElement) {
18674
- // // registry.registerParentGeometryBoundsChangedHandler(object, name);
18675
- // return this.calculateUsedValueWithParentBounds(object, name);
18676
- // } else {
18677
- // registry.addUnresolveProperty(object, name);
18678
- // // defer calculation after mounted
18679
- // // object.addEventListener(
18680
- // // ElementEvent.MOUNTED,
18681
- // // () => {
18682
- // // registry.registerParentGeometryBoundsChangedHandler(object, name);
18683
- // // },
18684
- // // { once: true },
18685
- // // );
18686
- // }
18687
18788
  return new CSSUnitValue(0, 'px');
18688
18789
  } else if (computed.unit === exports.UnitType.kEms) {
18689
18790
  if (object.parentNode) {
@@ -18717,10 +18818,13 @@ exports.CSSPropertyLengthOrPercentage = /*#__PURE__*/function () {
18717
18818
  }();
18718
18819
 
18719
18820
  exports.CSSPropertyLengthOrPercentage = tslib.__decorate([manaSyringe.singleton({
18720
- token: {
18821
+ token: [{
18721
18822
  token: CSSProperty,
18722
18823
  named: exports.PropertySyntax.LENGTH_PERCENTAGE
18723
- }
18824
+ }, {
18825
+ token: CSSProperty,
18826
+ named: exports.PropertySyntax.LENGTH
18827
+ }]
18724
18828
  })], exports.CSSPropertyLengthOrPercentage);
18725
18829
 
18726
18830
  /**
@@ -18889,6 +18993,18 @@ exports.CSSPropertyLocalPosition = tslib.__decorate([manaSyringe.singleton({
18889
18993
  }
18890
18994
  })], exports.CSSPropertyLocalPosition);
18891
18995
 
18996
+ exports.CSSPropertyNumber = function CSSPropertyNumber() {
18997
+ this.mixer = mergeNumbers;
18998
+ this.parser = parseNumber;
18999
+ };
19000
+
19001
+ exports.CSSPropertyNumber = tslib.__decorate([manaSyringe.singleton({
19002
+ token: {
19003
+ token: CSSProperty,
19004
+ named: exports.PropertySyntax.NUMBER
19005
+ }
19006
+ })], exports.CSSPropertyNumber);
19007
+
18892
19008
  exports.CSSPropertyOffsetDistance = /*#__PURE__*/function () {
18893
19009
  function CSSPropertyOffsetDistance() {
18894
19010
  this.parser = parseNumber;
@@ -19419,16 +19535,19 @@ var BUILT_IN_PROPERTIES = [{
19419
19535
  name: 'shadowOffsetX',
19420
19536
  interpolable: true,
19421
19537
  layoutDependent: true,
19538
+ defaultValue: '0',
19422
19539
  syntax: exports.PropertySyntax.LENGTH_PERCENTAGE
19423
19540
  }, {
19424
19541
  name: 'shadowOffsetY',
19425
19542
  interpolable: true,
19426
19543
  layoutDependent: true,
19544
+ defaultValue: '0',
19427
19545
  syntax: exports.PropertySyntax.LENGTH_PERCENTAGE
19428
19546
  }, {
19429
19547
  name: 'shadowBlur',
19430
19548
  interpolable: true,
19431
19549
  layoutDependent: true,
19550
+ defaultValue: '0',
19432
19551
  syntax: exports.PropertySyntax.SHADOW_BLUR
19433
19552
  }, {
19434
19553
  /**
@@ -19522,6 +19641,8 @@ var BUILT_IN_PROPERTIES = [{
19522
19641
  name: 'filter',
19523
19642
  independent: true,
19524
19643
  layoutDependent: true,
19644
+ keywords: ['none'],
19645
+ defaultValue: 'none',
19525
19646
  syntax: exports.PropertySyntax.FILTER
19526
19647
  }, {
19527
19648
  name: 'clipPath',
@@ -19775,6 +19896,7 @@ exports.DefaultStyleValueRegistry = /*#__PURE__*/function () {
19775
19896
  this.cache = {};
19776
19897
  this.unresolvedProperties = {};
19777
19898
  this.propertySyntaxFactory = void 0;
19899
+ this.sceneGraphService = void 0;
19778
19900
  this.cascadeProperties = {};
19779
19901
  }
19780
19902
 
@@ -20220,9 +20342,8 @@ exports.DefaultStyleValueRegistry = /*#__PURE__*/function () {
20220
20342
  var usedOriginYValue = (flipX ? -1 : 1) * convertPercentUnit(transformOrigin[1], 1, object);
20221
20343
  usedOriginXValue = usedOriginXValue - (flipY ? -1 : 1) * (anchor && anchor[0].value || 0) * geometry.contentBounds.halfExtents[0] * 2;
20222
20344
  usedOriginYValue = usedOriginYValue - (flipX ? -1 : 1) * (anchor && anchor[1].value || 0) * geometry.contentBounds.halfExtents[1] * 2;
20223
- object.setOrigin(usedOriginXValue, usedOriginYValue); // object.dispatchEvent(new CustomEvent(ElementEvent.GEOMETRY_BOUNDS_CHANGED));
20224
-
20225
- dirtifyToRoot(object);
20345
+ object.setOrigin(usedOriginXValue, usedOriginYValue);
20346
+ this.sceneGraphService.dirtifyToRoot(object);
20226
20347
  }
20227
20348
  };
20228
20349
 
@@ -20241,6 +20362,8 @@ exports.DefaultStyleValueRegistry = /*#__PURE__*/function () {
20241
20362
 
20242
20363
  tslib.__decorate([manaSyringe.inject(CSSPropertySyntaxFactory), tslib.__metadata("design:type", Function)], exports.DefaultStyleValueRegistry.prototype, "propertySyntaxFactory", void 0);
20243
20364
 
20365
+ tslib.__decorate([manaSyringe.inject(SceneGraphService), tslib.__metadata("design:type", Object)], exports.DefaultStyleValueRegistry.prototype, "sceneGraphService", void 0);
20366
+
20244
20367
  tslib.__decorate([manaSyringe.postConstruct(), tslib.__metadata("design:type", Function), tslib.__metadata("design:paramtypes", []), tslib.__metadata("design:returntype", void 0)], exports.DefaultStyleValueRegistry.prototype, "init", null);
20245
20368
 
20246
20369
  exports.DefaultStyleValueRegistry = tslib.__decorate([manaSyringe.singleton({
@@ -20290,6 +20413,7 @@ var containerModule = manaSyringe.Module(function (register) {
20290
20413
  }
20291
20414
  }); // bind CSS property handlers
20292
20415
 
20416
+ register(exports.CSSPropertyNumber);
20293
20417
  register(exports.CSSPropertyAngle);
20294
20418
  register(exports.CSSPropertyClipPath);
20295
20419
  register(exports.CSSPropertyColor);
@@ -20553,22 +20677,15 @@ var DirtyCheckPlugin_1;
20553
20677
  */
20554
20678
 
20555
20679
  var DirtyCheckPlugin = DirtyCheckPlugin_1 = (_class$2 = /*#__PURE__*/function () {
20556
- function DirtyCheckPlugin() {
20557
- this.renderingContext = void 0;
20558
- }
20680
+ function DirtyCheckPlugin() {}
20559
20681
 
20560
20682
  var _proto = DirtyCheckPlugin.prototype;
20561
20683
 
20562
20684
  _proto.apply = function apply(renderingService) {
20563
- var _this = this;
20564
-
20565
20685
  renderingService.hooks.dirtycheck.tap(DirtyCheckPlugin_1.tag, function (object) {
20566
20686
  if (object) {
20567
20687
  var renderable = object.renderable;
20568
-
20569
- var isCameraDirty = _this.renderingContext.renderReasons.has(exports.RenderReason.CAMERA_CHANGED);
20570
-
20571
- var isDirty = renderable.dirty || isCameraDirty;
20688
+ var isDirty = renderable.dirty || renderingService.disableDirtyRectangleRendering();
20572
20689
 
20573
20690
  if (isDirty) {
20574
20691
  return object;
@@ -20583,9 +20700,6 @@ var DirtyCheckPlugin = DirtyCheckPlugin_1 = (_class$2 = /*#__PURE__*/function ()
20583
20700
 
20584
20701
  return DirtyCheckPlugin;
20585
20702
  }(), _class$2.tag = 'DirtyCheck', _class$2);
20586
-
20587
- tslib.__decorate([manaSyringe.inject(RenderingContext), tslib.__metadata("design:type", Object)], DirtyCheckPlugin.prototype, "renderingContext", void 0);
20588
-
20589
20703
  DirtyCheckPlugin = DirtyCheckPlugin_1 = tslib.__decorate([manaSyringe.singleton({
20590
20704
  contrib: RenderingPluginContribution
20591
20705
  })], DirtyCheckPlugin);
@@ -21010,6 +21124,7 @@ var PrepareRendererPlugin = PrepareRendererPlugin_1 = (_class$4 = /*#__PURE__*/f
21010
21124
  function PrepareRendererPlugin() {
21011
21125
  this.renderingContext = void 0;
21012
21126
  this.styleValueRegistry = void 0;
21127
+ this.sceneGraphService = void 0;
21013
21128
  this.rBush = void 0;
21014
21129
  this.toSync = new Set();
21015
21130
  }
@@ -21056,7 +21171,8 @@ var PrepareRendererPlugin = PrepareRendererPlugin_1 = (_class$4 = /*#__PURE__*/f
21056
21171
 
21057
21172
  _this2.styleValueRegistry.recalc(object);
21058
21173
 
21059
- dirtifyToRoot(object);
21174
+ _this2.sceneGraphService.dirtifyToRoot(object);
21175
+
21060
21176
  renderingService.dirtify();
21061
21177
  };
21062
21178
 
@@ -21070,7 +21186,8 @@ var PrepareRendererPlugin = PrepareRendererPlugin_1 = (_class$4 = /*#__PURE__*/f
21070
21186
  _this2.toSync.delete(object);
21071
21187
  }
21072
21188
 
21073
- dirtifyToRoot(e.target);
21189
+ _this2.sceneGraphService.dirtifyToRoot(e.target);
21190
+
21074
21191
  renderingService.dirtify();
21075
21192
  };
21076
21193
 
@@ -21160,6 +21277,8 @@ tslib.__decorate([manaSyringe.inject(RenderingContext), tslib.__metadata("design
21160
21277
 
21161
21278
  tslib.__decorate([manaSyringe.inject(StyleValueRegistry), tslib.__metadata("design:type", Object)], PrepareRendererPlugin.prototype, "styleValueRegistry", void 0);
21162
21279
 
21280
+ tslib.__decorate([manaSyringe.inject(SceneGraphService), tslib.__metadata("design:type", Object)], PrepareRendererPlugin.prototype, "sceneGraphService", void 0);
21281
+
21163
21282
  tslib.__decorate([manaSyringe.inject(RBushRoot), tslib.__metadata("design:type", RBush__default['default'])], PrepareRendererPlugin.prototype, "rBush", void 0);
21164
21283
 
21165
21284
  PrepareRendererPlugin = PrepareRendererPlugin_1 = tslib.__decorate([manaSyringe.singleton({
@@ -21781,7 +21900,7 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
21781
21900
  }
21782
21901
  });
21783
21902
  } else {
21784
- console.warn("[g]: You are trying to call `canvas.appendChild` before canvas' initialization finished. You can either await `canvas.ready` or listen to `CanvasEvent.READY` manually.", 'appended child: ', parent);
21903
+ console.warn("[g]: You are trying to call `canvas.appendChild` before canvas' initialization finished. You can either await `canvas.ready` or listen to `CanvasEvent.READY` manually.", 'appended child: ', parent.nodeName);
21785
21904
  }
21786
21905
  };
21787
21906
 
@@ -21995,7 +22114,6 @@ exports.createVec3 = createVec3;
21995
22114
  exports.decompose = decompose;
21996
22115
  exports.deg2rad = deg2rad;
21997
22116
  exports.deg2turn = deg2turn;
21998
- exports.dirtifyToRoot = dirtifyToRoot;
21999
22117
  exports.equalSet = equalSet;
22000
22118
  exports.extractPolygons = extractPolygons;
22001
22119
  exports.formatAttribute = formatAttribute;