@visactor/vrender-core 1.1.0-alpha.15 → 1.1.0-alpha.17

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 (120) hide show
  1. package/cjs/common/diff.js +2 -1
  2. package/cjs/common/event-transformer.js +1 -2
  3. package/cjs/common/rect-utils.js +1 -1
  4. package/cjs/common/render-area.js +1 -1
  5. package/cjs/common/render-command-list.js +1 -1
  6. package/cjs/common/render-curve.js +1 -1
  7. package/cjs/common/render-utils.js +1 -1
  8. package/cjs/common/seg-context.js +2 -1
  9. package/cjs/common/simplify.js +1 -1
  10. package/cjs/common/sort.js +1 -1
  11. package/cjs/common/split-path.js +1 -1
  12. package/cjs/common/store.js +1 -1
  13. package/cjs/common/text.js +1 -1
  14. package/cjs/common/utils.js +1 -1
  15. package/cjs/core/camera.js +1 -1
  16. package/cjs/core/constants.js +1 -1
  17. package/cjs/core/core-modules.js +1 -1
  18. package/cjs/core/global-module.js +0 -2
  19. package/cjs/core/global.js +1 -1
  20. package/cjs/core/graphic-utils.js +1 -1
  21. package/cjs/core/index.js +1 -1
  22. package/cjs/core/layer-service.js +1 -2
  23. package/cjs/core/layer.js +1 -1
  24. package/cjs/core/light.js +1 -1
  25. package/cjs/core/stage.d.ts +4 -1
  26. package/cjs/core/stage.js +24 -12
  27. package/cjs/core/stage.js.map +1 -1
  28. package/cjs/core/window.js +1 -1
  29. package/cjs/graphic/graphic-service/graphic-service.d.ts +4 -0
  30. package/cjs/graphic/graphic-service/graphic-service.js +6 -5
  31. package/cjs/graphic/graphic-service/graphic-service.js.map +1 -1
  32. package/cjs/graphic/graphic.d.ts +41 -8
  33. package/cjs/graphic/graphic.js +383 -146
  34. package/cjs/graphic/graphic.js.map +1 -1
  35. package/cjs/graphic/group.d.ts +5 -1
  36. package/cjs/graphic/group.js +37 -18
  37. package/cjs/graphic/group.js.map +1 -1
  38. package/cjs/graphic/state/shared-state-refresh.js +3 -3
  39. package/cjs/graphic/state/shared-state-refresh.js.map +1 -1
  40. package/cjs/graphic/state/shared-state-scope.js +1 -1
  41. package/cjs/graphic/state/shared-state-scope.js.map +1 -1
  42. package/cjs/graphic/state/state-engine.js +2 -2
  43. package/cjs/graphic/state/state-engine.js.map +1 -1
  44. package/cjs/graphic/state/state-perf-monitor.d.ts +1 -0
  45. package/cjs/graphic/state/state-perf-monitor.js +9 -2
  46. package/cjs/graphic/state/state-perf-monitor.js.map +1 -1
  47. package/cjs/graphic/state/state-style-resolver.d.ts +0 -9
  48. package/cjs/graphic/state/state-style-resolver.js +0 -23
  49. package/cjs/graphic/state/state-style-resolver.js.map +1 -1
  50. package/cjs/interface/graphic.d.ts +2 -0
  51. package/cjs/interface/graphic.js.map +1 -1
  52. package/cjs/interface/node-tree.js.map +1 -1
  53. package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.d.ts +4 -1
  54. package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js +20 -10
  55. package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
  56. package/cjs/plugins/builtin-plugin/flex-layout-plugin.js +3 -2
  57. package/cjs/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
  58. package/cjs/render/contributions/render/base-render.js +8 -7
  59. package/cjs/render/contributions/render/base-render.js.map +1 -1
  60. package/dist/index.es.js +806 -263
  61. package/es/common/diff.js +2 -1
  62. package/es/common/event-transformer.js +1 -2
  63. package/es/common/rect-utils.js +1 -1
  64. package/es/common/render-area.js +1 -1
  65. package/es/common/render-command-list.js +1 -1
  66. package/es/common/render-curve.js +1 -1
  67. package/es/common/render-utils.js +1 -1
  68. package/es/common/seg-context.js +2 -1
  69. package/es/common/simplify.js +1 -1
  70. package/es/common/sort.js +1 -1
  71. package/es/common/split-path.js +1 -1
  72. package/es/common/store.js +1 -1
  73. package/es/common/text.js +1 -1
  74. package/es/common/utils.js +1 -1
  75. package/es/core/camera.js +1 -1
  76. package/es/core/constants.js +1 -1
  77. package/es/core/core-modules.js +1 -1
  78. package/es/core/global-module.js +0 -2
  79. package/es/core/global.js +1 -1
  80. package/es/core/graphic-utils.js +1 -1
  81. package/es/core/index.js +1 -1
  82. package/es/core/layer-service.js +1 -2
  83. package/es/core/layer.js +1 -1
  84. package/es/core/light.js +1 -1
  85. package/es/core/stage.d.ts +4 -1
  86. package/es/core/stage.js +22 -11
  87. package/es/core/stage.js.map +1 -1
  88. package/es/core/window.js +1 -1
  89. package/es/graphic/graphic-service/graphic-service.d.ts +4 -0
  90. package/es/graphic/graphic-service/graphic-service.js +6 -5
  91. package/es/graphic/graphic-service/graphic-service.js.map +1 -1
  92. package/es/graphic/graphic.d.ts +41 -8
  93. package/es/graphic/graphic.js +379 -139
  94. package/es/graphic/graphic.js.map +1 -1
  95. package/es/graphic/group.d.ts +5 -1
  96. package/es/graphic/group.js +36 -18
  97. package/es/graphic/group.js.map +1 -1
  98. package/es/graphic/state/shared-state-refresh.js +4 -4
  99. package/es/graphic/state/shared-state-refresh.js.map +1 -1
  100. package/es/graphic/state/shared-state-scope.js +2 -2
  101. package/es/graphic/state/shared-state-scope.js.map +1 -1
  102. package/es/graphic/state/state-engine.js +3 -3
  103. package/es/graphic/state/state-engine.js.map +1 -1
  104. package/es/graphic/state/state-perf-monitor.d.ts +1 -0
  105. package/es/graphic/state/state-perf-monitor.js +7 -0
  106. package/es/graphic/state/state-perf-monitor.js.map +1 -1
  107. package/es/graphic/state/state-style-resolver.d.ts +0 -9
  108. package/es/graphic/state/state-style-resolver.js +0 -23
  109. package/es/graphic/state/state-style-resolver.js.map +1 -1
  110. package/es/interface/graphic.d.ts +2 -0
  111. package/es/interface/graphic.js.map +1 -1
  112. package/es/interface/node-tree.js.map +1 -1
  113. package/es/plugins/builtin-plugin/dirty-bounds-plugin.d.ts +4 -1
  114. package/es/plugins/builtin-plugin/dirty-bounds-plugin.js +20 -10
  115. package/es/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
  116. package/es/plugins/builtin-plugin/flex-layout-plugin.js +3 -2
  117. package/es/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
  118. package/es/render/contributions/render/base-render.js +8 -6
  119. package/es/render/contributions/render/base-render.js.map +1 -1
  120. package/package.json +3 -3
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { EventEmitter, Logger, isBoolean, isObject, isFunction, isString, has, isUndefined, tau, halfPi as halfPi$1, AABBBounds, degreeToRadian, PointService, Point, abs, max, min, atan2, epsilon, Matrix, pi2, isArray, cos, sin, pi, pointAt, isNumber as isNumber$1, sqrt, isPointInLine, Color, DEFAULT_COLORS, LRU, isEqual, OBBBounds, isNil, normalTransform, isValidUrl, isBase64, lowerCamelCaseToMiddle, isValid, getContextFont, rotatePoint, transformBoundsWithMatrix, clampAngleByRadian, asin, isNumberClose, TextMeasure, Bounds, getRectIntersect, isRectIntersect, arrayEqual, acos, getIntersectPoint, merge, calculateAnchorOfBounds, styleStringToObject } from '@visactor/vutils';
1
+ import { EventEmitter, Logger, isBoolean, isObject, isFunction, isString, has, isUndefined, tau, halfPi as halfPi$1, AABBBounds, degreeToRadian, PointService, Point, abs, max, min, atan2, epsilon, Matrix, pi2, isArray, cos, sin, pi, pointAt, isNumber as isNumber$1, sqrt, isPointInLine, Color, DEFAULT_COLORS, LRU, OBBBounds, isEqual, isNil, normalTransform, isValidUrl, isBase64, lowerCamelCaseToMiddle, isValid, getContextFont, rotatePoint, transformBoundsWithMatrix, clampAngleByRadian, asin, isNumberClose, TextMeasure, Bounds, getRectIntersect, isRectIntersect, arrayEqual, acos, getIntersectPoint, merge, calculateAnchorOfBounds, styleStringToObject } from '@visactor/vutils';
2
2
 
3
3
  /******************************************************************************
4
4
  Copyright (c) Microsoft Corporation.
@@ -9485,6 +9485,17 @@ function getStageStatePerfMonitor(stage) {
9485
9485
  }
9486
9486
  return stage[STAGE_PERF_MONITOR];
9487
9487
  }
9488
+ function getActiveStageStatePerfMonitor(stage) {
9489
+ var _a;
9490
+ if (!stage) {
9491
+ return undefined;
9492
+ }
9493
+ const current = getStageStatePerfMonitor(stage);
9494
+ if (current) {
9495
+ return current;
9496
+ }
9497
+ return ((_a = stage.statePerfConfig) === null || _a === void 0 ? void 0 : _a.enabled) === true ? ensureStageStatePerfMonitor(stage) : undefined;
9498
+ }
9488
9499
 
9489
9500
  function isPlainObject$1(value) {
9490
9501
  return value != null && typeof value === 'object' && !Array.isArray(value);
@@ -9640,7 +9651,7 @@ class StateEngine {
9640
9651
  this.resolverPatchCache.clear();
9641
9652
  this.resolverCacheKey = '';
9642
9653
  this.resolverCacheValid = false;
9643
- (_b = getStageStatePerfMonitor((_a = this.graphic) === null || _a === void 0 ? void 0 : _a.stage)) === null || _b === void 0 ? void 0 : _b.recordResolver('invalidations');
9654
+ (_b = getActiveStageStatePerfMonitor((_a = this.graphic) === null || _a === void 0 ? void 0 : _a.stage)) === null || _b === void 0 ? void 0 : _b.recordResolver('invalidations');
9644
9655
  }
9645
9656
  hasState(stateName) {
9646
9657
  if (!this._activeStates.length) {
@@ -9730,7 +9741,7 @@ class StateEngine {
9730
9741
  }
9731
9742
  recomputePatch(effectiveStates) {
9732
9743
  var _a;
9733
- const perfMonitor = getStageStatePerfMonitor((_a = this.graphic) === null || _a === void 0 ? void 0 : _a.stage);
9744
+ const perfMonitor = getActiveStageStatePerfMonitor((_a = this.graphic) === null || _a === void 0 ? void 0 : _a.stage);
9734
9745
  const patchStart = perfMonitor ? performance.now() : 0;
9735
9746
  let resolverCost = 0;
9736
9747
  const cacheKey = effectiveStates.join(',');
@@ -10133,62 +10144,6 @@ class StateStyleResolver {
10133
10144
  });
10134
10145
  return resolvedAttrs;
10135
10146
  }
10136
- resolveWithCompiled(normalAttrs, compiledDefinitions, stateProxy, effectiveStates, resolvedPatch) {
10137
- var _a, _b;
10138
- const mergeMode = (_a = this.options.mergeMode) !== null && _a !== void 0 ? _a : 'shallow';
10139
- const resolvedAttrs = (_b = cloneValue(resolvedPatch)) !== null && _b !== void 0 ? _b : {};
10140
- effectiveStates.forEach(stateName => {
10141
- const proxyPatch = stateProxy === null || stateProxy === void 0 ? void 0 : stateProxy(stateName, effectiveStates);
10142
- if (proxyPatch == null) {
10143
- return;
10144
- }
10145
- Object.keys(proxyPatch).forEach(key => {
10146
- const nextValue = proxyPatch[key];
10147
- const hasCompiledDefinition = compiledDefinitions.has(stateName);
10148
- if (mergeMode === 'deep' &&
10149
- isPlainObject(nextValue) &&
10150
- (isPlainObject(resolvedAttrs[key]) ||
10151
- (!hasCompiledDefinition && isPlainObject(normalAttrs[key])))) {
10152
- const baseValue = isPlainObject(resolvedAttrs[key])
10153
- ? resolvedAttrs[key]
10154
- : isPlainObject(normalAttrs[key])
10155
- ? normalAttrs[key]
10156
- : {};
10157
- resolvedAttrs[key] = deepMerge(baseValue, nextValue);
10158
- return;
10159
- }
10160
- resolvedAttrs[key] = cloneValue(nextValue);
10161
- });
10162
- });
10163
- return resolvedAttrs;
10164
- }
10165
- computeNormalAttrsBackup(normalAttrs, targetAttrs, finalAttribute) {
10166
- const nextNormalAttrs = {};
10167
- const nextTargetAttrs = Object.assign({}, targetAttrs);
10168
- for (const key in targetAttrs) {
10169
- if (!Object.prototype.hasOwnProperty.call(targetAttrs, key)) {
10170
- continue;
10171
- }
10172
- if (normalAttrs && key in normalAttrs) {
10173
- nextNormalAttrs[key] = cloneValue(normalAttrs[key]);
10174
- }
10175
- else {
10176
- nextNormalAttrs[key] = cloneValue(finalAttribute[key]);
10177
- }
10178
- }
10179
- if (normalAttrs) {
10180
- for (const key in normalAttrs) {
10181
- if (!Object.prototype.hasOwnProperty.call(normalAttrs, key) || key in targetAttrs) {
10182
- continue;
10183
- }
10184
- nextTargetAttrs[key] = cloneValue(normalAttrs[key]);
10185
- }
10186
- }
10187
- return {
10188
- attrs: nextTargetAttrs,
10189
- normalAttrs: nextNormalAttrs
10190
- };
10191
- }
10192
10147
  }
10193
10148
 
10194
10149
  function hasOwnKeys(value) {
@@ -10396,7 +10351,7 @@ function ensureSharedStateScopeFresh(scope) {
10396
10351
  if (!scope) {
10397
10352
  return undefined;
10398
10353
  }
10399
- (_a = getStageStatePerfMonitor(scope.ownerStage)) === null || _a === void 0 ? void 0 : _a.recordRefresh('ensureFreshCalls');
10354
+ (_a = getActiveStageStatePerfMonitor(scope.ownerStage)) === null || _a === void 0 ? void 0 : _a.recordRefresh('ensureFreshCalls');
10400
10355
  if (scope.parentScope) {
10401
10356
  ensureSharedStateScopeFresh(scope.parentScope);
10402
10357
  }
@@ -10420,7 +10375,7 @@ function scheduleStageSharedStateRefresh(stage) {
10420
10375
  if (!stage || stage.releaseStatus === 'released') {
10421
10376
  return;
10422
10377
  }
10423
- (_a = getStageStatePerfMonitor(stage)) === null || _a === void 0 ? void 0 : _a.recordRefresh('renderScheduled');
10378
+ (_a = getActiveStageStatePerfMonitor(stage)) === null || _a === void 0 ? void 0 : _a.recordRefresh('renderScheduled');
10424
10379
  stage.renderNextFrame();
10425
10380
  }
10426
10381
  function enqueueGraphicSharedStateRefresh(stage, graphic) {
@@ -10431,7 +10386,7 @@ function enqueueGraphicSharedStateRefresh(stage, graphic) {
10431
10386
  const pending = (_a = stage._pendingSharedStateRefreshGraphics) !== null && _a !== void 0 ? _a : (stage._pendingSharedStateRefreshGraphics = new Set());
10432
10387
  if (!pending.has(graphic)) {
10433
10388
  pending.add(graphic);
10434
- const perfMonitor = getStageStatePerfMonitor(stage);
10389
+ const perfMonitor = getActiveStageStatePerfMonitor(stage);
10435
10390
  perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordRefresh('queuedGraphics');
10436
10391
  perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordAllocation('refreshQueuePushes');
10437
10392
  }
@@ -10454,7 +10409,7 @@ function flushStageSharedStateRefresh(stage) {
10454
10409
  if (!pending || !pending.size) {
10455
10410
  return;
10456
10411
  }
10457
- const perfMonitor = getStageStatePerfMonitor(stage);
10412
+ const perfMonitor = getActiveStageStatePerfMonitor(stage);
10458
10413
  const start = perfMonitor ? performance.now() : 0;
10459
10414
  const graphics = Array.from(pending.values());
10460
10415
  pending.clear();
@@ -10518,9 +10473,24 @@ const builtinTextureTypes = new Set([
10518
10473
  'grid',
10519
10474
  'wave'
10520
10475
  ]);
10476
+ const FULL_STATE_DEFINITION_KEYS = new Set([
10477
+ 'name',
10478
+ 'patch',
10479
+ 'priority',
10480
+ 'exclude',
10481
+ 'suppress',
10482
+ 'resolver',
10483
+ 'declaredAffectedKeys'
10484
+ ]);
10521
10485
  const point = new Point();
10486
+ const EMPTY_STATE_NAMES = [];
10487
+ const BROAD_UPDATE_CATEGORY = UpdateCategory.PAINT |
10488
+ UpdateCategory.SHAPE |
10489
+ UpdateCategory.BOUNDS |
10490
+ UpdateCategory.TRANSFORM |
10491
+ UpdateCategory.LAYOUT;
10522
10492
  function isPlainObjectValue(value) {
10523
- return typeof value === 'object' && value != null && !isArray(value);
10493
+ return typeof value === 'object' && value != null && !Array.isArray(value);
10524
10494
  }
10525
10495
  function cloneAttributeValue(value) {
10526
10496
  if (!isPlainObjectValue(value)) {
@@ -10534,18 +10504,6 @@ function cloneAttributeValue(value) {
10534
10504
  });
10535
10505
  return clone;
10536
10506
  }
10537
- function cloneSimpleAttributeRecord(value) {
10538
- if (!isPlainObjectValue(value)) {
10539
- return value;
10540
- }
10541
- return Object.assign({}, value);
10542
- }
10543
- function shouldUseSimpleAttributeFastPath(value) {
10544
- if (!isPlainObjectValue(value)) {
10545
- return false;
10546
- }
10547
- return !Object.keys(value).some(key => isPlainObjectValue(value[key]));
10548
- }
10549
10507
  function cloneAttributeSurface(value) {
10550
10508
  if (!isPlainObjectValue(value)) {
10551
10509
  return value;
@@ -10558,6 +10516,15 @@ function cloneAttributeSurface(value) {
10558
10516
  });
10559
10517
  return clone;
10560
10518
  }
10519
+ function areAttributeValuesEqual(left, right) {
10520
+ if (left === right) {
10521
+ return true;
10522
+ }
10523
+ if (!isPlainObjectValue(left) && !isPlainObjectValue(right) && !Array.isArray(left) && !Array.isArray(right)) {
10524
+ return false;
10525
+ }
10526
+ return isEqual(left, right);
10527
+ }
10561
10528
  function deepMergeAttributeValue(base, value) {
10562
10529
  var _a;
10563
10530
  const result = (_a = cloneAttributeValue(base)) !== null && _a !== void 0 ? _a : {};
@@ -10625,24 +10592,29 @@ class Graphic extends Node {
10625
10592
  get globalTransMatrix() {
10626
10593
  return this.tryUpdateGlobalTransMatrix(true);
10627
10594
  }
10595
+ get baseAttributes() {
10596
+ var _a;
10597
+ return (_a = this._baseAttributes) !== null && _a !== void 0 ? _a : this.attribute;
10598
+ }
10599
+ set baseAttributes(value) {
10600
+ if (value === this.attribute) {
10601
+ this._baseAttributes = undefined;
10602
+ return;
10603
+ }
10604
+ this._baseAttributes = value;
10605
+ }
10628
10606
  constructor(params = {}) {
10629
10607
  var _a;
10630
10608
  super();
10631
- this.resolverEpoch = 0;
10632
10609
  this._AABBBounds = new AABBBounds();
10633
10610
  this._updateTag = UpdateTag.INIT;
10634
- const useSimpleAttributeFastPath = shouldUseSimpleAttributeFastPath(params);
10635
- const initialBaseAttributes = (useSimpleAttributeFastPath ? cloneSimpleAttributeRecord(params) : cloneAttributeValue(params));
10636
- this.baseAttributes = initialBaseAttributes;
10637
- this.attribute = (useSimpleAttributeFastPath
10638
- ? cloneSimpleAttributeRecord(initialBaseAttributes)
10639
- : cloneAttributeSurface(initialBaseAttributes));
10611
+ this.attribute = params;
10640
10612
  this.valid = this.isValid();
10641
10613
  this.updateAABBBoundsStamp = 0;
10642
10614
  if (params.background) {
10643
10615
  this.loadImage((_a = params.background.background) !== null && _a !== void 0 ? _a : params.background, true);
10644
10616
  }
10645
- if (isExternalTexture(params.texture)) {
10617
+ if (params.texture && isExternalTexture(params.texture)) {
10646
10618
  this.loadImage(params.texture, false);
10647
10619
  }
10648
10620
  if (params.shadowGraphic) {
@@ -10652,8 +10624,11 @@ class Graphic extends Node {
10652
10624
  get normalAttrs() {
10653
10625
  return this.baseAttributes;
10654
10626
  }
10655
- set normalAttrs(value) {
10656
- this._deprecatedNormalAttrsView = value !== null && value !== void 0 ? value : undefined;
10627
+ set normalAttrs(_value) {
10628
+ }
10629
+ getBaseAttributesStorage() {
10630
+ var _a;
10631
+ return (_a = this._baseAttributes) !== null && _a !== void 0 ? _a : this.attribute;
10657
10632
  }
10658
10633
  getGraphicService() {
10659
10634
  var _a, _b;
@@ -10712,13 +10687,31 @@ class Graphic extends Node {
10712
10687
  }
10713
10688
  return true;
10714
10689
  }
10715
- syncSharedStateActiveRegistrations() {
10690
+ syncSharedStateScopeBindingOnTreeChange(markDirty = true) {
10716
10691
  var _a, _b;
10717
- const nextScopes = ((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) && this.boundSharedStateScope
10718
- ? new Set(collectSharedStateScopeChain(this.boundSharedStateScope))
10719
- : new Set();
10720
- const previousScopes = (_b = this.registeredActiveScopes) !== null && _b !== void 0 ? _b : new Set();
10721
- previousScopes.forEach(scope => {
10692
+ if (!((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) &&
10693
+ !this.boundSharedStateScope &&
10694
+ !((_b = this.registeredActiveScopes) === null || _b === void 0 ? void 0 : _b.size) &&
10695
+ !this.sharedStateDirty) {
10696
+ return false;
10697
+ }
10698
+ return this.syncSharedStateScopeBindingFromTree(markDirty);
10699
+ }
10700
+ syncSharedStateActiveRegistrations() {
10701
+ var _a;
10702
+ const previousScopes = this.registeredActiveScopes;
10703
+ if (!((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) || !this.boundSharedStateScope) {
10704
+ if (previousScopes === null || previousScopes === void 0 ? void 0 : previousScopes.size) {
10705
+ previousScopes.forEach(scope => {
10706
+ scope.subtreeActiveDescendants.delete(this);
10707
+ });
10708
+ previousScopes.clear();
10709
+ }
10710
+ this.registeredActiveScopes = undefined;
10711
+ return;
10712
+ }
10713
+ const nextScopes = new Set(collectSharedStateScopeChain(this.boundSharedStateScope));
10714
+ previousScopes === null || previousScopes === void 0 ? void 0 : previousScopes.forEach(scope => {
10722
10715
  if (!nextScopes.has(scope)) {
10723
10716
  scope.subtreeActiveDescendants.delete(this);
10724
10717
  }
@@ -10748,7 +10741,7 @@ class Graphic extends Node {
10748
10741
  this.setStage(stage, layer);
10749
10742
  return;
10750
10743
  }
10751
- this.syncSharedStateScopeBindingFromTree();
10744
+ this.syncSharedStateScopeBindingOnTreeChange();
10752
10745
  }
10753
10746
  refreshSharedStateBeforeRender() {
10754
10747
  var _a;
@@ -10763,7 +10756,7 @@ class Graphic extends Node {
10763
10756
  this.recomputeCurrentStatePatch();
10764
10757
  this.stopStateAnimates();
10765
10758
  this._restoreAttributeFromStaticTruth({ type: AttributeUpdateType.STATE });
10766
- this._emitCustomEvent('afterStateUpdate', { type: AttributeUpdateType.STATE });
10759
+ this.emitStateUpdateEvent();
10767
10760
  this.sharedStateDirty = false;
10768
10761
  }
10769
10762
  getLocalStatesVersion() {
@@ -10861,7 +10854,7 @@ class Graphic extends Node {
10861
10854
  ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
10862
10855
  this.currentStates = transition.states;
10863
10856
  this.effectiveStates = [...effectiveStates];
10864
- this.resolvedStatePatch = Object.assign({}, resolvedStateAttrs);
10857
+ this.resolvedStatePatch = resolvedStateAttrs;
10865
10858
  this.syncSharedStateActiveRegistrations();
10866
10859
  }
10867
10860
  buildStaticAttributeSnapshot() {
@@ -10927,7 +10920,7 @@ class Graphic extends Node {
10927
10920
  return;
10928
10921
  }
10929
10922
  const nextValue = snapshot[key];
10930
- if (isEqual(previousValue, nextValue)) {
10923
+ if (areAttributeValuesEqual(previousValue, nextValue)) {
10931
10924
  return;
10932
10925
  }
10933
10926
  delta.set(key, { prev: previousValue, next: nextValue });
@@ -10936,9 +10929,13 @@ class Graphic extends Node {
10936
10929
  return delta;
10937
10930
  }
10938
10931
  _syncAttribute() {
10932
+ if (this.attribute === this.baseAttributes && this.resolvedStatePatch) {
10933
+ this.detachAttributeFromBaseAttributes();
10934
+ }
10939
10935
  const snapshot = this.buildStaticAttributeSnapshot();
10940
10936
  const delta = this.syncObjectToSnapshot(this.attribute, snapshot);
10941
10937
  this.valid = this.isValid();
10938
+ this.attributeMayContainTransientAttrs = false;
10942
10939
  return delta;
10943
10940
  }
10944
10941
  _syncFinalAttributeFromStaticTruth() {
@@ -10949,7 +10946,20 @@ class Graphic extends Node {
10949
10946
  const snapshot = this.buildStaticAttributeSnapshot();
10950
10947
  this.syncObjectToSnapshot(target, snapshot);
10951
10948
  }
10952
- submitUpdateByDelta(delta, forceUpdateTag = false) {
10949
+ mergeAttributeDeltaCategory(category, key, prev, next) {
10950
+ var _a;
10951
+ let nextCategory = key === 'stroke' || key === 'shadowBlur'
10952
+ ? classifyAttributeDelta(key, prev, next)
10953
+ : (_a = ATTRIBUTE_CATEGORY[key]) !== null && _a !== void 0 ? _a : UpdateCategory.PAINT;
10954
+ if (nextCategory & UpdateCategory.PICK) {
10955
+ nextCategory |= UpdateCategory.BOUNDS;
10956
+ }
10957
+ if (nextCategory === UpdateCategory.PAINT && this.needUpdateTag(key)) {
10958
+ nextCategory = UpdateCategory.SHAPE | UpdateCategory.BOUNDS;
10959
+ }
10960
+ return category | nextCategory;
10961
+ }
10962
+ submitUpdateByCategory(category, forceUpdateTag = false) {
10953
10963
  var _a;
10954
10964
  if (forceUpdateTag) {
10955
10965
  this.addUpdateShapeAndBoundsTag();
@@ -10957,19 +10967,15 @@ class Graphic extends Node {
10957
10967
  this.addUpdateLayoutTag();
10958
10968
  return;
10959
10969
  }
10960
- let category = UpdateCategory.NONE;
10961
- delta.forEach((entry, key) => {
10962
- let nextCategory = classifyAttributeDelta(key, entry.prev, entry.next);
10963
- if (nextCategory & UpdateCategory.PICK) {
10964
- nextCategory |= UpdateCategory.BOUNDS;
10965
- }
10966
- if (nextCategory === UpdateCategory.PAINT && this.needUpdateTag(key)) {
10967
- nextCategory = UpdateCategory.SHAPE | UpdateCategory.BOUNDS;
10968
- }
10969
- category |= nextCategory;
10970
- });
10971
10970
  if (category !== UpdateCategory.NONE) {
10972
- (_a = getStageStatePerfMonitor(this.stage)) === null || _a === void 0 ? void 0 : _a.recordCategory(category);
10971
+ const stage = this.stage;
10972
+ if (stage) {
10973
+ (_a = getActiveStageStatePerfMonitor(stage)) === null || _a === void 0 ? void 0 : _a.recordCategory(category);
10974
+ }
10975
+ }
10976
+ if ((category & BROAD_UPDATE_CATEGORY) === BROAD_UPDATE_CATEGORY) {
10977
+ this.addBroadUpdateTag();
10978
+ return;
10973
10979
  }
10974
10980
  if (category & UpdateCategory.SHAPE) {
10975
10981
  this.addUpdateShapeAndBoundsTag();
@@ -10987,36 +10993,147 @@ class Graphic extends Node {
10987
10993
  this.addUpdateLayoutTag();
10988
10994
  }
10989
10995
  }
10996
+ submitUpdateByDelta(delta, forceUpdateTag = false) {
10997
+ let category = UpdateCategory.NONE;
10998
+ delta.forEach((entry, key) => {
10999
+ category = this.mergeAttributeDeltaCategory(category, key, entry.prev, entry.next);
11000
+ });
11001
+ this.submitUpdateByCategory(category, forceUpdateTag);
11002
+ }
11003
+ submitTouchedKeyUpdate(keys, forceUpdateTag = false) {
11004
+ this.submitTouchedUpdate(forceUpdateTag || this.needUpdateTags(keys));
11005
+ }
11006
+ submitTouchedUpdate(needsShapeAndBounds) {
11007
+ if (!this.updateShapeAndBoundsTagSetted() && needsShapeAndBounds) {
11008
+ this.addUpdateShapeAndBoundsTag();
11009
+ }
11010
+ else {
11011
+ this.addUpdateBoundTag();
11012
+ }
11013
+ this.addUpdatePositionTag();
11014
+ this.addUpdateLayoutTag();
11015
+ }
10990
11016
  commitBaseAttributeMutation(forceUpdateTag = false, context) {
10991
- var _a, _b;
11017
+ var _a, _b, _c;
10992
11018
  if ((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) {
10993
- this.resolverEpoch += 1;
10994
- (_b = this.stateEngine) === null || _b === void 0 ? void 0 : _b.invalidateResolverCache();
11019
+ this.resolverEpoch = ((_b = this.resolverEpoch) !== null && _b !== void 0 ? _b : 0) + 1;
11020
+ (_c = this.stateEngine) === null || _c === void 0 ? void 0 : _c.invalidateResolverCache();
10995
11021
  this.recomputeCurrentStatePatch();
10996
11022
  }
10997
11023
  const delta = this._syncAttribute();
10998
11024
  this.submitUpdateByDelta(delta, forceUpdateTag);
10999
11025
  this.onAttributeUpdate(context);
11000
11026
  }
11027
+ canCommitBaseAttributesByTouchedKeys() {
11028
+ var _a, _b;
11029
+ if (((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) || this.resolvedStatePatch || this.attributeMayContainTransientAttrs) {
11030
+ return false;
11031
+ }
11032
+ if (!((_b = this.animates) === null || _b === void 0 ? void 0 : _b.size) && !this._animationStateManager) {
11033
+ return true;
11034
+ }
11035
+ return !this.hasAnyTrackedAnimate();
11036
+ }
11037
+ detachAttributeFromBaseAttributes() {
11038
+ if (this.attribute === this.baseAttributes) {
11039
+ this._baseAttributes = this.attribute;
11040
+ this.attribute = cloneAttributeSurface(this.attribute);
11041
+ }
11042
+ }
11043
+ commitInternalBaseAttributes(params, context) {
11044
+ if (!params || !Object.keys(params).length) {
11045
+ return;
11046
+ }
11047
+ if (this.canCommitBaseAttributesByTouchedKeys()) {
11048
+ this.commitBaseAttributesByTouchedKeys(params, false, context);
11049
+ return;
11050
+ }
11051
+ this.detachAttributeFromBaseAttributes();
11052
+ this.applyBaseAttributes(params);
11053
+ this.commitBaseAttributeMutation(false, context);
11054
+ }
11055
+ commitBaseAttributesByTouchedKeys(params, forceUpdateTag = false, context) {
11056
+ const source = params;
11057
+ const baseAttributes = this.getBaseAttributesStorage();
11058
+ let hasKeys = false;
11059
+ let needsShapeAndBounds = forceUpdateTag;
11060
+ for (const key in source) {
11061
+ if (!Object.prototype.hasOwnProperty.call(source, key)) {
11062
+ continue;
11063
+ }
11064
+ hasKeys = true;
11065
+ baseAttributes[key] = source[key];
11066
+ if (!needsShapeAndBounds && this.needUpdateTag(key)) {
11067
+ needsShapeAndBounds = true;
11068
+ }
11069
+ }
11070
+ if (!hasKeys) {
11071
+ return;
11072
+ }
11073
+ this.attribute = baseAttributes;
11074
+ this._baseAttributes = undefined;
11075
+ this.valid = this.isValid();
11076
+ this.attributeMayContainTransientAttrs = false;
11077
+ this.submitTouchedUpdate(needsShapeAndBounds);
11078
+ this.onAttributeUpdate(context);
11079
+ }
11080
+ commitBaseAttributeBySingleKey(key, value, forceUpdateTag = false, context) {
11081
+ this.getBaseAttributesStorage()[key] = value;
11082
+ this.attribute = this.getBaseAttributesStorage();
11083
+ this._baseAttributes = undefined;
11084
+ this.valid = this.isValid();
11085
+ this.attributeMayContainTransientAttrs = false;
11086
+ this.submitTouchedUpdate(forceUpdateTag || this.needUpdateTag(key));
11087
+ this.onAttributeUpdate(context);
11088
+ }
11001
11089
  applyBaseAttributes(params) {
11002
11090
  const keys = Object.keys(params);
11003
11091
  for (let i = 0; i < keys.length; i++) {
11004
11092
  const key = keys[i];
11005
- this.baseAttributes[key] = cloneAttributeValue(params[key]);
11093
+ this.getBaseAttributesStorage()[key] = params[key];
11094
+ }
11095
+ }
11096
+ applyAnimationTransientAttributes(params, forceUpdateTag = false, context) {
11097
+ const source = params;
11098
+ let target;
11099
+ let needsShapeAndBounds = forceUpdateTag;
11100
+ for (const key in source) {
11101
+ if (!Object.prototype.hasOwnProperty.call(source, key)) {
11102
+ continue;
11103
+ }
11104
+ if (!target) {
11105
+ this.detachAttributeFromBaseAttributes();
11106
+ target = this.attribute;
11107
+ }
11108
+ target[key] = source[key];
11109
+ if (!needsShapeAndBounds && this.needUpdateTag(key)) {
11110
+ needsShapeAndBounds = true;
11111
+ }
11006
11112
  }
11113
+ if (!target) {
11114
+ return;
11115
+ }
11116
+ this.attributeMayContainTransientAttrs = true;
11117
+ this.valid = this.isValid();
11118
+ this.submitTouchedUpdate(needsShapeAndBounds);
11119
+ this.onAttributeUpdate(context);
11007
11120
  }
11008
11121
  applyTransientAttributes(params, forceUpdateTag = false, context) {
11122
+ this.detachAttributeFromBaseAttributes();
11009
11123
  const delta = new Map();
11010
11124
  const keys = Object.keys(params);
11011
11125
  for (let i = 0; i < keys.length; i++) {
11012
11126
  const key = keys[i];
11013
11127
  const previousValue = this.attribute[key];
11014
11128
  const nextValue = params[key];
11015
- if (isEqual(previousValue, nextValue)) {
11129
+ if (areAttributeValuesEqual(previousValue, nextValue)) {
11016
11130
  continue;
11017
11131
  }
11018
11132
  delta.set(key, { prev: previousValue, next: nextValue });
11019
- this.attribute[key] = cloneAttributeValue(nextValue);
11133
+ this.attribute[key] = nextValue;
11134
+ }
11135
+ if (delta.size) {
11136
+ this.attributeMayContainTransientAttrs = true;
11020
11137
  }
11021
11138
  this.valid = this.isValid();
11022
11139
  this.submitUpdateByDelta(delta, forceUpdateTag);
@@ -11028,6 +11145,87 @@ class Graphic extends Node {
11028
11145
  this.submitUpdateByDelta(delta);
11029
11146
  this.onAttributeUpdate(context);
11030
11147
  }
11148
+ collectStatePatchDeltaKeys(previousPatch, nextPatch) {
11149
+ const keys = previousPatch ? Object.keys(previousPatch) : [];
11150
+ if (!nextPatch) {
11151
+ return keys;
11152
+ }
11153
+ for (const key in nextPatch) {
11154
+ if (Object.prototype.hasOwnProperty.call(nextPatch, key) &&
11155
+ !Object.prototype.hasOwnProperty.call(previousPatch !== null && previousPatch !== void 0 ? previousPatch : {}, key)) {
11156
+ keys.push(key);
11157
+ }
11158
+ }
11159
+ return keys;
11160
+ }
11161
+ getStaticTruthValueForStateKey(key, nextPatch) {
11162
+ var _a;
11163
+ const baseAttributes = ((_a = this.baseAttributes) !== null && _a !== void 0 ? _a : {});
11164
+ const patch = nextPatch;
11165
+ if (patch && Object.prototype.hasOwnProperty.call(patch, key)) {
11166
+ const patchValue = patch[key];
11167
+ const baseValue = baseAttributes[key];
11168
+ if (this.stateMergeMode === 'deep' && isPlainObjectValue(baseValue) && isPlainObjectValue(patchValue)) {
11169
+ return {
11170
+ hasValue: true,
11171
+ value: deepMergeAttributeValue(baseValue, patchValue)
11172
+ };
11173
+ }
11174
+ return {
11175
+ hasValue: true,
11176
+ value: patchValue
11177
+ };
11178
+ }
11179
+ if (Object.prototype.hasOwnProperty.call(baseAttributes, key)) {
11180
+ return {
11181
+ hasValue: true,
11182
+ value: baseAttributes[key]
11183
+ };
11184
+ }
11185
+ return {
11186
+ hasValue: false,
11187
+ value: undefined
11188
+ };
11189
+ }
11190
+ syncStatePatchDeltaToTarget(target, keys, nextPatch, collectCategory = false) {
11191
+ let category = UpdateCategory.NONE;
11192
+ for (let i = 0; i < keys.length; i++) {
11193
+ const key = keys[i];
11194
+ const previousValue = target[key];
11195
+ const next = this.getStaticTruthValueForStateKey(key, nextPatch);
11196
+ if (!next.hasValue) {
11197
+ if (Object.prototype.hasOwnProperty.call(target, key)) {
11198
+ delete target[key];
11199
+ if (collectCategory) {
11200
+ category = this.mergeAttributeDeltaCategory(category, key, previousValue, undefined);
11201
+ }
11202
+ }
11203
+ continue;
11204
+ }
11205
+ if (areAttributeValuesEqual(previousValue, next.value)) {
11206
+ continue;
11207
+ }
11208
+ const nextValue = cloneAttributeValue(next.value);
11209
+ target[key] = nextValue;
11210
+ if (collectCategory) {
11211
+ category = this.mergeAttributeDeltaCategory(category, key, previousValue, nextValue);
11212
+ }
11213
+ }
11214
+ return category;
11215
+ }
11216
+ restoreAttributeFromStatePatchDelta(previousPatch, nextPatch, context) {
11217
+ this.detachAttributeFromBaseAttributes();
11218
+ const keys = this.collectStatePatchDeltaKeys(previousPatch, nextPatch);
11219
+ const finalAttribute = this.finalAttribute;
11220
+ if (finalAttribute) {
11221
+ this.syncStatePatchDeltaToTarget(finalAttribute, keys, nextPatch, false);
11222
+ }
11223
+ const category = this.syncStatePatchDeltaToTarget(this.attribute, keys, nextPatch, true);
11224
+ this.valid = this.isValid();
11225
+ this.attributeMayContainTransientAttrs = false;
11226
+ this.submitUpdateByCategory(category);
11227
+ this.onAttributeUpdate(context);
11228
+ }
11031
11229
  setMode(mode) {
11032
11230
  mode === '3d' ? this.set3dMode() : this.set2dMode();
11033
11231
  }
@@ -11052,6 +11250,7 @@ class Graphic extends Node {
11052
11250
  return point;
11053
11251
  }
11054
11252
  onAnimateBind(animate) {
11253
+ this.detachAttributeFromBaseAttributes();
11055
11254
  this._emitCustomEvent('animate-bind', animate);
11056
11255
  }
11057
11256
  visitTrackedAnimates(cb) {
@@ -11074,8 +11273,33 @@ class Graphic extends Node {
11074
11273
  }
11075
11274
  return !!((_a = this.animates) === null || _a === void 0 ? void 0 : _a.size);
11076
11275
  }
11276
+ mayHaveTrackedAnimates() {
11277
+ var _a;
11278
+ return !!((_a = this.animates) === null || _a === void 0 ? void 0 : _a.size) || !!this._animationStateManager;
11279
+ }
11077
11280
  tryUpdateAABBBounds() {
11281
+ if (!this.shadowRoot && !(this._updateTag & UpdateTag.UPDATE_BOUNDS)) {
11282
+ return this._AABBBounds;
11283
+ }
11078
11284
  const full = this.attribute.boundsMode === 'imprecise';
11285
+ if (!this.shadowRoot) {
11286
+ const graphicService = this.getGraphicService();
11287
+ const graphicTheme = this.getGraphicTheme();
11288
+ if (!graphicService.validCheck(this.attribute, graphicTheme, this._AABBBounds, this)) {
11289
+ return this._AABBBounds;
11290
+ }
11291
+ if (!this.valid) {
11292
+ this._AABBBounds.clear();
11293
+ return this._AABBBounds;
11294
+ }
11295
+ graphicService.beforeUpdateAABBBounds(this, this.stage, true, this._AABBBounds);
11296
+ const bounds = this.doUpdateAABBBounds(full, graphicTheme);
11297
+ graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, true);
11298
+ if (this.attribute.boundsMode === 'empty') {
11299
+ bounds.clear();
11300
+ }
11301
+ return bounds;
11302
+ }
11079
11303
  if (!this.shouldUpdateAABBBounds()) {
11080
11304
  return this._AABBBounds;
11081
11305
  }
@@ -11192,13 +11416,13 @@ class Graphic extends Node {
11192
11416
  Graphic.userSymbolMap[symbolType] = _parsedPath;
11193
11417
  return _parsedPath;
11194
11418
  }
11195
- doUpdateAABBBounds(full) {
11419
+ doUpdateAABBBounds(full, graphicTheme) {
11196
11420
  this.updateAABBBoundsStamp++;
11197
- const graphicTheme = this.getGraphicTheme();
11421
+ const resolvedGraphicTheme = graphicTheme !== null && graphicTheme !== void 0 ? graphicTheme : this.getGraphicTheme();
11198
11422
  this._AABBBounds.clear();
11199
11423
  const attribute = this.attribute;
11200
- const bounds = this.updateAABBBounds(attribute, graphicTheme, this._AABBBounds, full);
11201
- const { boundsPadding = graphicTheme.boundsPadding } = attribute;
11424
+ const bounds = this.updateAABBBounds(attribute, resolvedGraphicTheme, this._AABBBounds, full);
11425
+ const { boundsPadding = resolvedGraphicTheme.boundsPadding } = attribute;
11202
11426
  const paddingArray = parsePadding(boundsPadding);
11203
11427
  if (paddingArray) {
11204
11428
  bounds.expand(paddingArray);
@@ -11413,7 +11637,7 @@ class Graphic extends Node {
11413
11637
  if (params.background) {
11414
11638
  this.loadImage(params.background, true);
11415
11639
  }
11416
- if (isExternalTexture(params.texture)) {
11640
+ if (params.texture && isExternalTexture(params.texture)) {
11417
11641
  this.loadImage(params.texture, false);
11418
11642
  }
11419
11643
  if (params.shadowGraphic) {
@@ -11422,14 +11646,25 @@ class Graphic extends Node {
11422
11646
  this._setAttributes(params, forceUpdateTag, context);
11423
11647
  }
11424
11648
  _setAttributes(params, forceUpdateTag = false, context) {
11649
+ if (this.canCommitBaseAttributesByTouchedKeys()) {
11650
+ this.commitBaseAttributesByTouchedKeys(params, forceUpdateTag, context);
11651
+ return;
11652
+ }
11653
+ this.detachAttributeFromBaseAttributes();
11425
11654
  this.applyBaseAttributes(params);
11426
11655
  this.commitBaseAttributeMutation(forceUpdateTag, context);
11427
11656
  }
11428
11657
  setAttribute(key, value, forceUpdateTag, context) {
11429
11658
  const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({ [key]: value }, this.attribute, key, context);
11430
11659
  if (!params) {
11431
- this.applyBaseAttributes({ [key]: value });
11432
- this.commitBaseAttributeMutation(!!forceUpdateTag, context);
11660
+ if (this.canCommitBaseAttributesByTouchedKeys()) {
11661
+ this.commitBaseAttributeBySingleKey(key, value, !!forceUpdateTag, context);
11662
+ }
11663
+ else {
11664
+ const nextAttrs = { [key]: value };
11665
+ this.applyBaseAttributes(nextAttrs);
11666
+ this.commitBaseAttributeMutation(!!forceUpdateTag, context);
11667
+ }
11433
11668
  }
11434
11669
  else {
11435
11670
  this._setAttributes(params, forceUpdateTag, context);
@@ -11466,16 +11701,15 @@ class Graphic extends Node {
11466
11701
  const context = { type: AttributeUpdateType.INIT };
11467
11702
  params =
11468
11703
  (this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context)) || params;
11469
- this.baseAttributes = cloneAttributeValue(params);
11470
- if (!this.attribute) {
11471
- this.attribute = {};
11472
- }
11704
+ this.attribute = params;
11705
+ this._baseAttributes = undefined;
11473
11706
  this.resolvedStatePatch = undefined;
11474
- this._syncAttribute();
11707
+ this.attributeMayContainTransientAttrs = false;
11708
+ this.valid = this.isValid();
11475
11709
  if (params.background) {
11476
11710
  this.loadImage(params.background, true);
11477
11711
  }
11478
- if (isExternalTexture(params.texture)) {
11712
+ if (params.texture && isExternalTexture(params.texture)) {
11479
11713
  this.loadImage(params.texture, false);
11480
11714
  }
11481
11715
  if (params.shadowGraphic) {
@@ -11500,18 +11734,20 @@ class Graphic extends Node {
11500
11734
  y = params.y;
11501
11735
  delete params.x;
11502
11736
  delete params.y;
11503
- this.applyBaseAttributes(params);
11504
11737
  }
11505
11738
  const attribute = this.baseAttributes;
11506
11739
  const postMatrix = attribute.postMatrix;
11740
+ const nextAttrs = (params || {});
11507
11741
  if (!postMatrix) {
11508
- attribute.x = ((_a = attribute.x) !== null && _a !== void 0 ? _a : DefaultTransform.x) + x;
11509
- attribute.y = ((_b = attribute.y) !== null && _b !== void 0 ? _b : DefaultTransform.y) + y;
11742
+ nextAttrs.x = ((_a = attribute.x) !== null && _a !== void 0 ? _a : DefaultTransform.x) + x;
11743
+ nextAttrs.y = ((_b = attribute.y) !== null && _b !== void 0 ? _b : DefaultTransform.y) + y;
11510
11744
  }
11511
11745
  else {
11512
- application.transformUtil.fromMatrix(postMatrix, postMatrix).translate(x, y);
11746
+ const nextPostMatrix = postMatrix.clone();
11747
+ application.transformUtil.fromMatrix(nextPostMatrix, nextPostMatrix).translate(x, y);
11748
+ nextAttrs.postMatrix = nextPostMatrix;
11513
11749
  }
11514
- this.commitBaseAttributeMutation(false, context);
11750
+ this.commitInternalBaseAttributes(nextAttrs, context);
11515
11751
  return this;
11516
11752
  }
11517
11753
  translateTo(x, y) {
@@ -11525,13 +11761,10 @@ class Graphic extends Node {
11525
11761
  const params = this.onBeforeAttributeUpdate &&
11526
11762
  this.onBeforeAttributeUpdate({ x, y }, this.attribute, tempConstantXYKey, context);
11527
11763
  if (params) {
11528
- this.applyBaseAttributes(params);
11529
- this.commitBaseAttributeMutation(false, context);
11764
+ this.commitInternalBaseAttributes(params, context);
11530
11765
  return this;
11531
11766
  }
11532
- attribute.x = x;
11533
- attribute.y = y;
11534
- this.commitBaseAttributeMutation(false, context);
11767
+ this.commitInternalBaseAttributes({ x, y }, context);
11535
11768
  return this;
11536
11769
  }
11537
11770
  scale(scaleX, scaleY, scaleCenter) {
@@ -11549,22 +11782,25 @@ class Graphic extends Node {
11549
11782
  scaleY = params.scaleY;
11550
11783
  delete params.scaleX;
11551
11784
  delete params.scaleY;
11552
- this.applyBaseAttributes(params);
11553
11785
  }
11554
11786
  const attribute = this.baseAttributes;
11787
+ const nextAttrs = (params || {});
11555
11788
  if (!scaleCenter) {
11556
- attribute.scaleX = ((_a = attribute.scaleX) !== null && _a !== void 0 ? _a : DefaultTransform.scaleX) * scaleX;
11557
- attribute.scaleY = ((_b = attribute.scaleY) !== null && _b !== void 0 ? _b : DefaultTransform.scaleY) * scaleY;
11789
+ nextAttrs.scaleX = ((_a = attribute.scaleX) !== null && _a !== void 0 ? _a : DefaultTransform.scaleX) * scaleX;
11790
+ nextAttrs.scaleY = ((_b = attribute.scaleY) !== null && _b !== void 0 ? _b : DefaultTransform.scaleY) * scaleY;
11558
11791
  }
11559
11792
  else {
11560
- let { postMatrix } = this.attribute;
11793
+ let { postMatrix } = this.baseAttributes;
11561
11794
  if (!postMatrix) {
11562
11795
  postMatrix = new Matrix();
11563
- attribute.postMatrix = postMatrix;
11796
+ }
11797
+ else {
11798
+ postMatrix = postMatrix.clone();
11564
11799
  }
11565
11800
  application.transformUtil.fromMatrix(postMatrix, postMatrix).scale(scaleX, scaleY, scaleCenter);
11801
+ nextAttrs.postMatrix = postMatrix;
11566
11802
  }
11567
- this.commitBaseAttributeMutation(false, context);
11803
+ this.commitInternalBaseAttributes(nextAttrs, context);
11568
11804
  return this;
11569
11805
  }
11570
11806
  scaleTo(scaleX, scaleY) {
@@ -11578,13 +11814,10 @@ class Graphic extends Node {
11578
11814
  const params = this.onBeforeAttributeUpdate &&
11579
11815
  this.onBeforeAttributeUpdate({ scaleX, scaleY }, this.attribute, tempConstantScaleXYKey, context);
11580
11816
  if (params) {
11581
- this.applyBaseAttributes(params);
11582
- this.commitBaseAttributeMutation(false, context);
11817
+ this.commitInternalBaseAttributes(params, context);
11583
11818
  return this;
11584
11819
  }
11585
- attribute.scaleX = scaleX;
11586
- attribute.scaleY = scaleY;
11587
- this.commitBaseAttributeMutation(false, context);
11820
+ this.commitInternalBaseAttributes({ scaleX, scaleY }, context);
11588
11821
  return this;
11589
11822
  }
11590
11823
  rotate(angle, rotateCenter) {
@@ -11597,21 +11830,24 @@ class Graphic extends Node {
11597
11830
  this.onBeforeAttributeUpdate({ angle, rotateCenter }, this.attribute, tempConstantAngleKey, context);
11598
11831
  if (params) {
11599
11832
  delete params.angle;
11600
- this.applyBaseAttributes(params);
11601
11833
  }
11602
11834
  const attribute = this.baseAttributes;
11835
+ const nextAttrs = (params || {});
11603
11836
  if (!rotateCenter) {
11604
- attribute.angle = ((_a = attribute.angle) !== null && _a !== void 0 ? _a : DefaultTransform.angle) + angle;
11837
+ nextAttrs.angle = ((_a = attribute.angle) !== null && _a !== void 0 ? _a : DefaultTransform.angle) + angle;
11605
11838
  }
11606
11839
  else {
11607
11840
  let { postMatrix } = this.baseAttributes;
11608
11841
  if (!postMatrix) {
11609
11842
  postMatrix = new Matrix();
11610
- this.baseAttributes.postMatrix = postMatrix;
11843
+ }
11844
+ else {
11845
+ postMatrix = postMatrix.clone();
11611
11846
  }
11612
11847
  application.transformUtil.fromMatrix(postMatrix, postMatrix).rotate(angle, rotateCenter);
11848
+ nextAttrs.postMatrix = postMatrix;
11613
11849
  }
11614
- this.commitBaseAttributeMutation(false, context);
11850
+ this.commitInternalBaseAttributes(nextAttrs, context);
11615
11851
  return this;
11616
11852
  }
11617
11853
  rotateTo(angle) {
@@ -11625,12 +11861,10 @@ class Graphic extends Node {
11625
11861
  const params = this.onBeforeAttributeUpdate &&
11626
11862
  this.onBeforeAttributeUpdate(angle, this.attribute, tempConstantAngleKey, context);
11627
11863
  if (params) {
11628
- this.applyBaseAttributes(params);
11629
- this.commitBaseAttributeMutation(false, context);
11864
+ this.commitInternalBaseAttributes(params, context);
11630
11865
  return this;
11631
11866
  }
11632
- attribute.angle = angle;
11633
- this.commitBaseAttributeMutation(false, context);
11867
+ this.commitInternalBaseAttributes({ angle }, context);
11634
11868
  return this;
11635
11869
  }
11636
11870
  skewTo(b, c) {
@@ -11702,6 +11936,97 @@ class Graphic extends Node {
11702
11936
  stateEngine: this.stateEngine
11703
11937
  });
11704
11938
  }
11939
+ resolveSimpleLocalStateTransition(states, previousStates) {
11940
+ var _a;
11941
+ if (!this.states ||
11942
+ this.stateProxy ||
11943
+ this.stateSort ||
11944
+ this.stateMergeMode === 'deep' ||
11945
+ this.parent ||
11946
+ ((_a = this.stage) === null || _a === void 0 ? void 0 : _a.rootSharedStateScope) ||
11947
+ this.boundSharedStateScope) {
11948
+ return null;
11949
+ }
11950
+ if (states.length === 1) {
11951
+ const stateName = states[0];
11952
+ const hasDefinition = Object.prototype.hasOwnProperty.call(this.states, stateName);
11953
+ const nextStates = [stateName];
11954
+ const changed = !this.sameStateNames(previousStates, nextStates);
11955
+ const resolvedStateAttrs = {};
11956
+ if (hasDefinition) {
11957
+ const attrs = this.states[stateName];
11958
+ if (attrs != null) {
11959
+ if (!isPlainObjectValue(attrs)) {
11960
+ return null;
11961
+ }
11962
+ const keys = Object.keys(attrs);
11963
+ for (let keyIndex = 0; keyIndex < keys.length; keyIndex++) {
11964
+ const key = keys[keyIndex];
11965
+ if (FULL_STATE_DEFINITION_KEYS.has(key)) {
11966
+ return null;
11967
+ }
11968
+ const attrValue = attrs[key];
11969
+ resolvedStateAttrs[key] = isPlainObjectValue(attrValue)
11970
+ ? cloneAttributeValue(attrValue)
11971
+ : attrValue;
11972
+ }
11973
+ }
11974
+ }
11975
+ return {
11976
+ changed,
11977
+ states: nextStates,
11978
+ effectiveStates: nextStates,
11979
+ resolvedStateAttrs
11980
+ };
11981
+ }
11982
+ const uniqueStates = Array.from(new Set(states));
11983
+ const withDefinition = [];
11984
+ const withoutDefinition = [];
11985
+ for (let i = 0; i < uniqueStates.length; i++) {
11986
+ const stateName = uniqueStates[i];
11987
+ if (Object.prototype.hasOwnProperty.call(this.states, stateName)) {
11988
+ withDefinition.push(stateName);
11989
+ }
11990
+ else {
11991
+ withoutDefinition.push(stateName);
11992
+ }
11993
+ }
11994
+ withDefinition.sort((left, right) => left.localeCompare(right));
11995
+ const nextStates = withDefinition.concat(withoutDefinition);
11996
+ const changed = !this.sameStateNames(previousStates, nextStates);
11997
+ const resolvedStateAttrs = {};
11998
+ for (let i = 0; i < nextStates.length; i++) {
11999
+ const stateName = nextStates[i];
12000
+ const hasDefinition = Object.prototype.hasOwnProperty.call(this.states, stateName);
12001
+ if (!hasDefinition) {
12002
+ continue;
12003
+ }
12004
+ const attrs = this.states[stateName];
12005
+ if (attrs == null) {
12006
+ continue;
12007
+ }
12008
+ if (!isPlainObjectValue(attrs)) {
12009
+ return null;
12010
+ }
12011
+ const keys = Object.keys(attrs);
12012
+ for (let keyIndex = 0; keyIndex < keys.length; keyIndex++) {
12013
+ const key = keys[keyIndex];
12014
+ if (FULL_STATE_DEFINITION_KEYS.has(key)) {
12015
+ return null;
12016
+ }
12017
+ const attrValue = attrs[key];
12018
+ resolvedStateAttrs[key] = isPlainObjectValue(attrValue)
12019
+ ? cloneAttributeValue(attrValue)
12020
+ : attrValue;
12021
+ }
12022
+ }
12023
+ return {
12024
+ changed,
12025
+ states: nextStates,
12026
+ effectiveStates: nextStates,
12027
+ resolvedStateAttrs
12028
+ };
12029
+ }
11705
12030
  resolveStateAnimateConfig(animateConfig) {
11706
12031
  var _a, _b, _c;
11707
12032
  return (_c = (_a = animateConfig !== null && animateConfig !== void 0 ? animateConfig : this.stateAnimateConfig) !== null && _a !== void 0 ? _a : (_b = this.context) === null || _b === void 0 ? void 0 : _b.stateAnimateConfig) !== null && _c !== void 0 ? _c : DefaultStateAnimateConfig;
@@ -11727,8 +12052,7 @@ class Graphic extends Node {
11727
12052
  });
11728
12053
  this.getStateTransitionOrchestrator().applyTransition(this, plan, hasAnimation, transitionOptions);
11729
12054
  }
11730
- updateNormalAttrs(stateAttrs) {
11731
- this._deprecatedNormalAttrsView = cloneAttributeValue(this.baseAttributes);
12055
+ updateNormalAttrs(_stateAttrs) {
11732
12056
  }
11733
12057
  getStateTransitionDefaultAttribute(key, targetAttrs) {
11734
12058
  return this.getDefaultAttribute(key);
@@ -11742,6 +12066,9 @@ class Graphic extends Node {
11742
12066
  stopAnimationState.call(this, 'state', type);
11743
12067
  return;
11744
12068
  }
12069
+ if (!this.mayHaveTrackedAnimates()) {
12070
+ return;
12071
+ }
11745
12072
  const stateAnimates = [];
11746
12073
  this.visitTrackedAnimates(animate => {
11747
12074
  if (animate.stateNames) {
@@ -11760,10 +12087,8 @@ class Graphic extends Node {
11760
12087
  }
11761
12088
  clearStates(hasAnimation) {
11762
12089
  var _a, _b, _c;
11763
- const previousStates = this.currentStates ? this.currentStates.slice() : [];
11764
- const previousResolvedStatePatch = this.resolvedStatePatch
11765
- ? cloneAttributeValue(this.resolvedStatePatch)
11766
- : undefined;
12090
+ const previousStates = (_a = this.currentStates) !== null && _a !== void 0 ? _a : EMPTY_STATE_NAMES;
12091
+ const previousResolvedStatePatch = this.resolvedStatePatch;
11767
12092
  const transition = this.createStateModel().clearStates();
11768
12093
  if (!transition.changed && previousStates.length === 0) {
11769
12094
  this.currentStates = [];
@@ -11773,7 +12098,9 @@ class Graphic extends Node {
11773
12098
  this.clearSharedStateActiveRegistrations();
11774
12099
  return;
11775
12100
  }
11776
- const resolvedStateAttrs = cloneAttributeValue(((_a = this.baseAttributes) !== null && _a !== void 0 ? _a : {}));
12101
+ const resolvedStateAttrs = hasAnimation || this.hasCustomEvent('beforeStateUpdate')
12102
+ ? cloneAttributeValue(((_b = this.baseAttributes) !== null && _b !== void 0 ? _b : {}))
12103
+ : ((_c = this.baseAttributes) !== null && _c !== void 0 ? _c : {});
11777
12104
  if (transition.changed &&
11778
12105
  !this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, true)) {
11779
12106
  return;
@@ -11783,19 +12110,29 @@ class Graphic extends Node {
11783
12110
  this.resolvedStatePatch = undefined;
11784
12111
  this.sharedStateDirty = false;
11785
12112
  this.clearSharedStateActiveRegistrations();
11786
- (_b = getStageStatePerfMonitor(this.stage)) === null || _b === void 0 ? void 0 : _b.incrementCounter('stateCommits');
11787
- (_c = getStageStatePerfMonitor(this.stage)) === null || _c === void 0 ? void 0 : _c.recordEvent('state-commit', {
11788
- graphicId: this._uid,
11789
- targetStates: []
11790
- });
12113
+ if (this.stage) {
12114
+ const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
12115
+ perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.incrementCounter('stateCommits');
12116
+ perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordEvent('state-commit', {
12117
+ graphicId: this._uid,
12118
+ targetStates: []
12119
+ });
12120
+ }
11791
12121
  if (hasAnimation) {
11792
12122
  this._syncFinalAttributeFromStaticTruth();
11793
12123
  this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, true, undefined, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch));
11794
12124
  }
11795
12125
  else {
11796
12126
  this.stopStateAnimates();
11797
- this._restoreAttributeFromStaticTruth({ type: AttributeUpdateType.STATE });
11798
- this._emitCustomEvent('afterStateUpdate', { type: AttributeUpdateType.STATE });
12127
+ if (this.attributeMayContainTransientAttrs) {
12128
+ this._restoreAttributeFromStaticTruth({ type: AttributeUpdateType.STATE });
12129
+ }
12130
+ else {
12131
+ this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, undefined, {
12132
+ type: AttributeUpdateType.STATE
12133
+ });
12134
+ }
12135
+ this.emitStateUpdateEvent();
11799
12136
  }
11800
12137
  }
11801
12138
  removeState(stateName, hasAnimation) {
@@ -11817,67 +12154,109 @@ class Graphic extends Node {
11817
12154
  }
11818
12155
  this.useStates(transition.states, hasAnimation);
11819
12156
  }
12157
+ setStates(states, hasAnimation) {
12158
+ var _a, _b, _c;
12159
+ const nextStates = (states === null || states === void 0 ? void 0 : states.length) ? states : EMPTY_STATE_NAMES;
12160
+ const hasCurrentState = !!((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) ||
12161
+ !!((_b = this.effectiveStates) === null || _b === void 0 ? void 0 : _b.length) ||
12162
+ !!this.resolvedStatePatch ||
12163
+ !!((_c = this.registeredActiveScopes) === null || _c === void 0 ? void 0 : _c.size);
12164
+ if (!nextStates.length) {
12165
+ if (!hasCurrentState && !this.sharedStateDirty) {
12166
+ return;
12167
+ }
12168
+ this.clearStates(hasAnimation);
12169
+ return;
12170
+ }
12171
+ if (this.sameStateNames(this.currentStates, nextStates)) {
12172
+ if (this.sharedStateDirty) {
12173
+ this.refreshSharedStateBeforeRender();
12174
+ }
12175
+ return;
12176
+ }
12177
+ this.useStates(nextStates, hasAnimation);
12178
+ }
11820
12179
  useStates(states, hasAnimation) {
11821
- var _a, _b, _c, _d, _e;
12180
+ var _a, _b, _c, _d;
11822
12181
  if (!states.length) {
11823
12182
  this.clearStates(hasAnimation);
11824
12183
  return;
11825
12184
  }
11826
- const previousStates = this.currentStates ? this.currentStates.slice() : [];
11827
- const previousResolvedStatePatch = this.resolvedStatePatch
11828
- ? cloneAttributeValue(this.resolvedStatePatch)
11829
- : undefined;
11830
- const stateResolveBaseAttrs = ((_a = this.baseAttributes) !== null && _a !== void 0 ? _a : this.attribute);
11831
- const stateModel = this.createStateModel();
11832
- (_b = this.stateEngine) === null || _b === void 0 ? void 0 : _b.setResolveContext(this, stateResolveBaseAttrs);
11833
- const transition = stateModel.useStates(states);
11834
- if (!transition.changed && this.sameStateNames(previousStates, transition.states)) {
11835
- return;
12185
+ const previousStates = (_a = this.currentStates) !== null && _a !== void 0 ? _a : EMPTY_STATE_NAMES;
12186
+ const previousResolvedStatePatch = this.resolvedStatePatch;
12187
+ let transition = this.resolveSimpleLocalStateTransition(states, previousStates);
12188
+ const isSimpleLocalTransition = !!transition;
12189
+ let resolvedStateAttrs;
12190
+ if (transition) {
12191
+ if (!transition.changed) {
12192
+ return;
12193
+ }
12194
+ resolvedStateAttrs = transition.resolvedStateAttrs;
11836
12195
  }
11837
- const effectiveStates = (_c = transition.effectiveStates) !== null && _c !== void 0 ? _c : transition.states;
11838
- const resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions
11839
- ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
12196
+ else {
12197
+ const stateResolveBaseAttrs = ((_b = this.baseAttributes) !== null && _b !== void 0 ? _b : this.attribute);
12198
+ const stateModel = this.createStateModel();
12199
+ (_c = this.stateEngine) === null || _c === void 0 ? void 0 : _c.setResolveContext(this, stateResolveBaseAttrs);
12200
+ transition = stateModel.useStates(states);
12201
+ if (!transition.changed && this.sameStateNames(previousStates, transition.states)) {
12202
+ return;
12203
+ }
12204
+ resolvedStateAttrs =
12205
+ this.stateEngine && this.compiledStateDefinitions
12206
+ ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
12207
+ }
12208
+ const effectiveStates = (_d = transition.effectiveStates) !== null && _d !== void 0 ? _d : transition.states;
11840
12209
  if (!this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, false)) {
11841
12210
  return;
11842
12211
  }
11843
12212
  this.currentStates = transition.states;
11844
- this.effectiveStates = [...effectiveStates];
11845
- this.resolvedStatePatch = Object.assign({}, resolvedStateAttrs);
12213
+ this.effectiveStates = isSimpleLocalTransition ? effectiveStates : [...effectiveStates];
12214
+ this.resolvedStatePatch = resolvedStateAttrs;
11846
12215
  this.sharedStateDirty = false;
11847
12216
  this.syncSharedStateActiveRegistrations();
11848
- (_d = getStageStatePerfMonitor(this.stage)) === null || _d === void 0 ? void 0 : _d.incrementCounter('stateCommits');
11849
- (_e = getStageStatePerfMonitor(this.stage)) === null || _e === void 0 ? void 0 : _e.recordEvent('state-commit', {
11850
- graphicId: this._uid,
11851
- targetStates: [...transition.states]
11852
- });
12217
+ if (this.stage) {
12218
+ const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
12219
+ perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.incrementCounter('stateCommits');
12220
+ perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordEvent('state-commit', {
12221
+ graphicId: this._uid,
12222
+ targetStates: [...transition.states]
12223
+ });
12224
+ }
11853
12225
  if (hasAnimation) {
11854
12226
  this._syncFinalAttributeFromStaticTruth();
11855
12227
  this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, false, undefined, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch));
11856
12228
  }
11857
12229
  else {
11858
12230
  this.stopStateAnimates();
11859
- this._restoreAttributeFromStaticTruth({ type: AttributeUpdateType.STATE });
11860
- this._emitCustomEvent('afterStateUpdate', { type: AttributeUpdateType.STATE });
12231
+ if (this.attributeMayContainTransientAttrs) {
12232
+ this._restoreAttributeFromStaticTruth({ type: AttributeUpdateType.STATE });
12233
+ }
12234
+ else {
12235
+ this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
12236
+ type: AttributeUpdateType.STATE
12237
+ });
12238
+ }
12239
+ this.emitStateUpdateEvent();
11861
12240
  }
11862
12241
  }
11863
12242
  invalidateResolver() {
11864
- var _a, _b;
12243
+ var _a, _b, _c;
11865
12244
  if (!this.stateEngine || !((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) || !this.compiledStateDefinitions) {
11866
12245
  return;
11867
12246
  }
11868
12247
  const stateResolveBaseAttrs = ((_b = this.baseAttributes) !== null && _b !== void 0 ? _b : this.attribute);
11869
12248
  this.stateEngine.setResolveContext(this, stateResolveBaseAttrs);
11870
- this.resolverEpoch += 1;
12249
+ this.resolverEpoch = ((_c = this.resolverEpoch) !== null && _c !== void 0 ? _c : 0) + 1;
11871
12250
  this.stateEngine.invalidateResolverCache();
11872
12251
  const transition = this.stateEngine.applyStates(this.currentStates);
11873
12252
  const resolvedStateAttrs = Object.assign({}, this.stateEngine.resolvedPatch);
11874
12253
  this.effectiveStates = [...transition.effectiveStates];
11875
- this.resolvedStatePatch = Object.assign({}, resolvedStateAttrs);
12254
+ this.resolvedStatePatch = resolvedStateAttrs;
11876
12255
  this.sharedStateDirty = false;
11877
12256
  this.syncSharedStateActiveRegistrations();
11878
12257
  this.stopStateAnimates();
11879
12258
  this._restoreAttributeFromStaticTruth({ type: AttributeUpdateType.STATE });
11880
- this._emitCustomEvent('afterStateUpdate', { type: AttributeUpdateType.STATE });
12259
+ this.emitStateUpdateEvent();
11881
12260
  }
11882
12261
  sameStateNames(left, right) {
11883
12262
  const normalizedLeft = left !== null && left !== void 0 ? left : [];
@@ -11916,6 +12295,20 @@ class Graphic extends Node {
11916
12295
  this.glyphHost.addUpdateBoundTag();
11917
12296
  }
11918
12297
  }
12298
+ addBroadUpdateTag() {
12299
+ this.shadowRoot && this.shadowRoot.addUpdateGlobalPositionTag();
12300
+ this._updateTag |=
12301
+ UpdateTag.UPDATE_SHAPE_AND_BOUNDS |
12302
+ UpdateTag.UPDATE_PAINT |
12303
+ UpdateTag.UPDATE_GLOBAL_LOCAL_MATRIX |
12304
+ UpdateTag.UPDATE_LAYOUT;
12305
+ if (this.parent) {
12306
+ this.parent.addChildUpdateBoundTag();
12307
+ }
12308
+ if (this.glyphHost) {
12309
+ this.glyphHost.addUpdateBoundTag();
12310
+ }
12311
+ }
11919
12312
  updateShapeAndBoundsTagSetted() {
11920
12313
  return (this._updateTag & UpdateTag.UPDATE_SHAPE_AND_BOUNDS) === UpdateTag.UPDATE_SHAPE_AND_BOUNDS;
11921
12314
  }
@@ -12020,17 +12413,22 @@ class Graphic extends Node {
12020
12413
  }
12021
12414
  }
12022
12415
  setStage(stage, layer) {
12023
- var _a, _b, _c, _d, _e, _f, _g, _h;
12416
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
12024
12417
  const graphicService = (_c = (_a = stage === null || stage === void 0 ? void 0 : stage.graphicService) !== null && _a !== void 0 ? _a : (_b = this.stage) === null || _b === void 0 ? void 0 : _b.graphicService) !== null && _c !== void 0 ? _c : application.graphicService;
12025
12418
  const previousStage = this.stage;
12026
12419
  if (this.stage !== stage || this.layer !== layer) {
12027
12420
  this.stage = stage;
12028
12421
  this.layer = layer;
12029
- this.syncSharedStateScopeBindingFromTree(!!((_d = this.currentStates) === null || _d === void 0 ? void 0 : _d.length));
12422
+ if (((_d = this.currentStates) === null || _d === void 0 ? void 0 : _d.length) ||
12423
+ this.boundSharedStateScope ||
12424
+ ((_e = this.registeredActiveScopes) === null || _e === void 0 ? void 0 : _e.size) ||
12425
+ this.sharedStateDirty) {
12426
+ this.syncSharedStateScopeBindingOnTreeChange(true);
12427
+ }
12030
12428
  this.setStageToShadowRoot(stage, layer);
12031
- if (this.hasAnyTrackedAnimate()) {
12032
- const previousTimeline = (_e = previousStage === null || previousStage === void 0 ? void 0 : previousStage.getTimeline) === null || _e === void 0 ? void 0 : _e.call(previousStage);
12033
- const nextTimeline = (_f = stage === null || stage === void 0 ? void 0 : stage.getTimeline) === null || _f === void 0 ? void 0 : _f.call(stage);
12429
+ if (this.mayHaveTrackedAnimates() && this.hasAnyTrackedAnimate()) {
12430
+ const previousTimeline = (_f = previousStage === null || previousStage === void 0 ? void 0 : previousStage.getTimeline) === null || _f === void 0 ? void 0 : _f.call(previousStage);
12431
+ const nextTimeline = (_g = stage === null || stage === void 0 ? void 0 : stage.getTimeline) === null || _g === void 0 ? void 0 : _g.call(stage);
12034
12432
  const detachedStageAnimates = [];
12035
12433
  this.visitTrackedAnimates(a => {
12036
12434
  const boundToPreviousStage = !!previousTimeline && a.timeline === previousTimeline;
@@ -12068,10 +12466,38 @@ class Graphic extends Node {
12068
12466
  }
12069
12467
  }
12070
12468
  this._onSetStage && this._onSetStage(this, stage, layer);
12071
- (_g = graphicService === null || graphicService === void 0 ? void 0 : graphicService.onSetStage) === null || _g === void 0 ? void 0 : _g.call(graphicService, this, stage);
12469
+ (_h = graphicService === null || graphicService === void 0 ? void 0 : graphicService.onSetStage) === null || _h === void 0 ? void 0 : _h.call(graphicService, this, stage);
12072
12470
  return;
12073
12471
  }
12074
- this.syncSharedStateScopeBindingFromTree(!!((_h = this.currentStates) === null || _h === void 0 ? void 0 : _h.length));
12472
+ if (((_j = this.currentStates) === null || _j === void 0 ? void 0 : _j.length) ||
12473
+ this.boundSharedStateScope ||
12474
+ ((_k = this.registeredActiveScopes) === null || _k === void 0 ? void 0 : _k.size) ||
12475
+ this.sharedStateDirty) {
12476
+ this.syncSharedStateScopeBindingOnTreeChange(true);
12477
+ }
12478
+ }
12479
+ detachStageForRelease() {
12480
+ var _a, _b, _c;
12481
+ if ((_a = this.registeredActiveScopes) === null || _a === void 0 ? void 0 : _a.size) {
12482
+ this.clearSharedStateActiveRegistrations();
12483
+ }
12484
+ if (this.mayHaveTrackedAnimates() || this.shadowRoot) {
12485
+ this.stopAnimates();
12486
+ }
12487
+ this.boundSharedStateScope = undefined;
12488
+ this.boundSharedStateRevision = undefined;
12489
+ this.localFallbackCompiledDefinitions = undefined;
12490
+ this.compiledStateDefinitions = undefined;
12491
+ this.compiledStateDefinitionsCacheKey = undefined;
12492
+ this.stateEngine = undefined;
12493
+ this.stateEngineCompiledDefinitions = undefined;
12494
+ this.stateEngineStateProxyModeKey = undefined;
12495
+ this.sharedStateDirty = false;
12496
+ this.stage = null;
12497
+ this.layer = null;
12498
+ if (this.shadowRoot) {
12499
+ (_c = (_b = this.shadowRoot).detachStageForRelease) === null || _c === void 0 ? void 0 : _c.call(_b);
12500
+ }
12075
12501
  }
12076
12502
  setStageToShadowRoot(stage, layer) {
12077
12503
  if (this.shadowRoot) {
@@ -12207,6 +12633,9 @@ class Graphic extends Node {
12207
12633
  cb && cb();
12208
12634
  }
12209
12635
  _stopAnimates() {
12636
+ if (!this.mayHaveTrackedAnimates()) {
12637
+ return;
12638
+ }
12210
12639
  const animates = [];
12211
12640
  this.visitTrackedAnimates(animate => {
12212
12641
  animates.push(animate);
@@ -12227,17 +12656,24 @@ class Graphic extends Node {
12227
12656
  }
12228
12657
  }
12229
12658
  release() {
12230
- var _a, _b, _c;
12659
+ var _a, _b, _c, _d;
12231
12660
  this.releaseStatus = 'released';
12232
- this.clearSharedStateActiveRegistrations();
12233
- this.stopAnimates();
12234
- const graphicService = (_b = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.graphicService) !== null && _b !== void 0 ? _b : application.graphicService;
12235
- (_c = graphicService === null || graphicService === void 0 ? void 0 : graphicService.onRelease) === null || _c === void 0 ? void 0 : _c.call(graphicService, this);
12661
+ if ((_a = this.registeredActiveScopes) === null || _a === void 0 ? void 0 : _a.size) {
12662
+ this.clearSharedStateActiveRegistrations();
12663
+ }
12664
+ if (this.mayHaveTrackedAnimates() || this.shadowRoot) {
12665
+ this.stopAnimates();
12666
+ }
12667
+ const graphicService = (_c = (_b = this.stage) === null || _b === void 0 ? void 0 : _b.graphicService) !== null && _c !== void 0 ? _c : application.graphicService;
12668
+ (_d = graphicService === null || graphicService === void 0 ? void 0 : graphicService.onRelease) === null || _d === void 0 ? void 0 : _d.call(graphicService, this);
12236
12669
  super.release();
12237
12670
  }
12671
+ hasCustomEvent(type) {
12672
+ return !!this._events && type in this._events;
12673
+ }
12238
12674
  _dispatchCustomEvent(type, context) {
12239
12675
  var _a, _b;
12240
- if (this._events && type in this._events) {
12676
+ if (this.hasCustomEvent(type)) {
12241
12677
  const changeEvent = new CustomEvent(type, context);
12242
12678
  changeEvent.bubbles = false;
12243
12679
  const manager = (_b = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventSystem) === null || _b === void 0 ? void 0 : _b.manager;
@@ -12250,6 +12686,9 @@ class Graphic extends Node {
12250
12686
  return true;
12251
12687
  }
12252
12688
  beforeStateUpdate(attrs, prevStates, nextStates, hasAnimation, isClear) {
12689
+ if (!this.hasCustomEvent('beforeStateUpdate')) {
12690
+ return true;
12691
+ }
12253
12692
  return this._dispatchCustomEvent('beforeStateUpdate', {
12254
12693
  type: AttributeUpdateType.STATE,
12255
12694
  attrs: Object.assign({}, attrs),
@@ -12259,6 +12698,11 @@ class Graphic extends Node {
12259
12698
  isClear: !!isClear
12260
12699
  });
12261
12700
  }
12701
+ emitStateUpdateEvent() {
12702
+ if (this.hasCustomEvent('afterStateUpdate')) {
12703
+ this._emitCustomEvent('afterStateUpdate', { type: AttributeUpdateType.STATE });
12704
+ }
12705
+ }
12262
12706
  _emitCustomEvent(type, context) {
12263
12707
  this._dispatchCustomEvent(type, context);
12264
12708
  }
@@ -16509,6 +16953,7 @@ class Group extends Graphic {
16509
16953
  this.type = 'group';
16510
16954
  this.parent = null;
16511
16955
  this.isContainer = true;
16956
+ this._hasSharedStateDefinitions = false;
16512
16957
  this.numberType = GROUP_NUMBER_TYPE;
16513
16958
  this._childUpdateTag = UpdateTag.UPDATE_BOUNDS;
16514
16959
  }
@@ -16519,12 +16964,17 @@ class Group extends Graphic {
16519
16964
  if (this._sharedStateDefinitions === value) {
16520
16965
  return;
16521
16966
  }
16967
+ const previousScope = this.sharedStateScope;
16522
16968
  this._sharedStateDefinitions = value;
16969
+ this._hasSharedStateDefinitions = !!value && Object.keys(value).length > 0;
16523
16970
  this.ensureSharedStateScopeBound();
16524
16971
  if (this.sharedStateScope) {
16525
16972
  setSharedStateScopeLocalDefinitions(this.sharedStateScope, value);
16526
16973
  markScopeActiveDescendantsDirty(this.sharedStateScope, this.stage);
16527
16974
  }
16975
+ if (previousScope !== this.sharedStateScope) {
16976
+ this.notifyChildrenSharedStateTreeChanged();
16977
+ }
16528
16978
  }
16529
16979
  setMode(mode) {
16530
16980
  mode === '3d' ? this.set3dMode() : this.set2dMode();
@@ -16715,8 +17165,16 @@ class Group extends Graphic {
16715
17165
  insertInto(newNode, idx) {
16716
17166
  return this._updateChildToStage(super.insertInto(newNode, idx));
16717
17167
  }
16718
- removeChild(child) {
17168
+ removeChild(child, highPerformance = false) {
17169
+ var _a;
16719
17170
  const data = super.removeChild(child);
17171
+ if (!data) {
17172
+ return data;
17173
+ }
17174
+ if (highPerformance) {
17175
+ (_a = child.detachStageForRelease) === null || _a === void 0 ? void 0 : _a.call(child);
17176
+ return data;
17177
+ }
16720
17178
  this.getGraphicService().onRemove(child);
16721
17179
  child.setStage(null, null);
16722
17180
  this.addUpdateBoundTag();
@@ -16739,29 +17197,43 @@ class Group extends Graphic {
16739
17197
  setStage(stage, layer) {
16740
17198
  var _a, _b, _c, _d, _e, _f;
16741
17199
  const graphicService = (_c = (_a = stage === null || stage === void 0 ? void 0 : stage.graphicService) !== null && _a !== void 0 ? _a : (_b = this.stage) === null || _b === void 0 ? void 0 : _b.graphicService) !== null && _c !== void 0 ? _c : application.graphicService;
17200
+ const needsSharedStateTreeSync = this._hasSharedStateDefinitions ||
17201
+ this.sharedStateScope ||
17202
+ ((_d = this.currentStates) === null || _d === void 0 ? void 0 : _d.length) ||
17203
+ this.boundSharedStateScope ||
17204
+ ((_e = this.registeredActiveScopes) === null || _e === void 0 ? void 0 : _e.size) ||
17205
+ this.sharedStateDirty;
16742
17206
  if (this.stage !== stage) {
16743
17207
  this.stage = stage;
16744
17208
  this.layer = layer;
16745
- this.ensureSharedStateScopeBound();
16746
- this.syncSharedStateScopeBindingFromTree(!!((_d = this.currentStates) === null || _d === void 0 ? void 0 : _d.length));
17209
+ if (needsSharedStateTreeSync) {
17210
+ this.ensureSharedStateScopeBound();
17211
+ this.syncSharedStateScopeBindingOnTreeChange(true);
17212
+ }
16747
17213
  this.setStageToShadowRoot(stage, layer);
16748
17214
  this._onSetStage && this._onSetStage(this, stage, layer);
16749
- (_e = graphicService === null || graphicService === void 0 ? void 0 : graphicService.onSetStage) === null || _e === void 0 ? void 0 : _e.call(graphicService, this, stage);
17215
+ (_f = graphicService === null || graphicService === void 0 ? void 0 : graphicService.onSetStage) === null || _f === void 0 ? void 0 : _f.call(graphicService, this, stage);
16750
17216
  this.forEachChildren(item => {
16751
17217
  item.setStage(stage, this.layer);
16752
17218
  });
16753
17219
  return;
16754
17220
  }
16755
- if (this.layer !== layer) {
17221
+ const layerChanged = this.layer !== layer;
17222
+ if (layerChanged) {
16756
17223
  this.layer = layer;
16757
17224
  }
16758
- this.ensureSharedStateScopeBound();
16759
- this.syncSharedStateScopeBindingFromTree(!!((_f = this.currentStates) === null || _f === void 0 ? void 0 : _f.length));
16760
- this.forEachChildren(item => {
16761
- if (item.onParentSharedStateTreeChanged) {
16762
- item.onParentSharedStateTreeChanged(stage, this.layer);
16763
- }
16764
- });
17225
+ if (needsSharedStateTreeSync) {
17226
+ this.ensureSharedStateScopeBound();
17227
+ this.syncSharedStateScopeBindingOnTreeChange(true);
17228
+ this.notifyChildrenSharedStateTreeChanged();
17229
+ }
17230
+ else if (layerChanged) {
17231
+ this.forEachChildren(item => {
17232
+ if (item.onParentSharedStateTreeChanged) {
17233
+ item.onParentSharedStateTreeChanged(stage, this.layer);
17234
+ }
17235
+ });
17236
+ }
16765
17237
  }
16766
17238
  addUpdatePositionTag() {
16767
17239
  super.addUpdatePositionTag();
@@ -16828,8 +17300,20 @@ class Group extends Graphic {
16828
17300
  }
16829
17301
  super.release();
16830
17302
  }
17303
+ detachStageForRelease() {
17304
+ super.detachStageForRelease();
17305
+ this.sharedStateScope = undefined;
17306
+ this.forEachChildren((item) => {
17307
+ var _a;
17308
+ (_a = item.detachStageForRelease) === null || _a === void 0 ? void 0 : _a.call(item);
17309
+ });
17310
+ }
16831
17311
  ensureSharedStateScopeBound() {
16832
17312
  var _a, _b, _c;
17313
+ if (!this.hasSharedStateDefinitions()) {
17314
+ this.sharedStateScope = undefined;
17315
+ return;
17316
+ }
16833
17317
  const parentScope = (_b = (_a = this.parent) === null || _a === void 0 ? void 0 : _a.sharedStateScope) !== null && _b !== void 0 ? _b : (_c = this.stage) === null || _c === void 0 ? void 0 : _c.rootSharedStateScope;
16834
17318
  if (!this.sharedStateScope) {
16835
17319
  this.sharedStateScope = createGroupSharedStateScope(this, parentScope, this._sharedStateDefinitions);
@@ -16842,18 +17326,25 @@ class Group extends Graphic {
16842
17326
  setSharedStateScopeLocalDefinitions(this.sharedStateScope, this._sharedStateDefinitions);
16843
17327
  }
16844
17328
  }
17329
+ hasSharedStateDefinitions() {
17330
+ return this._hasSharedStateDefinitions;
17331
+ }
17332
+ notifyChildrenSharedStateTreeChanged() {
17333
+ this.forEachChildren(item => {
17334
+ if (item.onParentSharedStateTreeChanged) {
17335
+ item.onParentSharedStateTreeChanged(this.stage, this.layer);
17336
+ }
17337
+ });
17338
+ }
16845
17339
  onParentSharedStateTreeChanged(stage, layer) {
17340
+ var _a;
16846
17341
  if (this.stage !== stage || this.layer !== layer) {
16847
17342
  this.setStage(stage, layer);
16848
17343
  return;
16849
17344
  }
16850
17345
  this.ensureSharedStateScopeBound();
16851
- this.syncSharedStateScopeBindingFromTree();
16852
- this.forEachChildren(item => {
16853
- if (item.onParentSharedStateTreeChanged) {
16854
- item.onParentSharedStateTreeChanged(stage, this.layer);
16855
- }
16856
- });
17346
+ this.syncSharedStateScopeBindingOnTreeChange(!!((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length));
17347
+ this.notifyChildrenSharedStateTreeChanged();
16857
17348
  }
16858
17349
  }
16859
17350
  Group.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
@@ -17295,6 +17786,10 @@ class DefaultGraphicService {
17295
17786
  };
17296
17787
  this.tempAABBBounds1 = new AABBBounds();
17297
17788
  this.tempAABBBounds2 = new AABBBounds();
17789
+ this.tempAABBBoundsResult = {
17790
+ tb1: this.tempAABBBounds1,
17791
+ tb2: this.tempAABBBounds2
17792
+ };
17298
17793
  }
17299
17794
  onAttributeUpdate(graphic) {
17300
17795
  if (this.hooks.onAttributeUpdate.taps.length) {
@@ -17425,7 +17920,7 @@ class DefaultGraphicService {
17425
17920
  const tb2 = this.tempAABBBounds2;
17426
17921
  tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2);
17427
17922
  tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2);
17428
- return { tb1, tb2 };
17923
+ return this.tempAABBBoundsResult;
17429
17924
  }
17430
17925
  }
17431
17926
 
@@ -19328,6 +19823,7 @@ class DirtyBoundsPlugin {
19328
19823
  this.activeEvent = 'onRegister';
19329
19824
  this._uid = Generator.GenAutoIncrementId();
19330
19825
  this.key = this.name + this._uid;
19826
+ this.dirtyBoundsHooksRegistered = false;
19331
19827
  this.handlePaintOnlyUpdate = (graphic) => {
19332
19828
  var _a, _b, _c, _d;
19333
19829
  const stage = this.pluginService.stage;
@@ -19369,16 +19865,16 @@ class DirtyBoundsPlugin {
19369
19865
  }
19370
19866
  return (_b = owner._globalAABBBounds) !== null && _b !== void 0 ? _b : owner.globalAABBBounds;
19371
19867
  }
19372
- activate(context) {
19373
- this.pluginService = context;
19374
- context.stage.hooks.afterRender.tap(this.key, stage => {
19375
- if (!(stage && stage === this.pluginService.stage)) {
19376
- return;
19377
- }
19378
- stage.dirtyBounds.clear();
19379
- });
19380
- const stage = this.pluginService.stage;
19381
- if (!stage) {
19868
+ getRemoveDirtyBounds(graphic) {
19869
+ var _a;
19870
+ const owner = ((_a = graphic.glyphHost) !== null && _a !== void 0 ? _a : graphic);
19871
+ const cachedBounds = owner._globalAABBBounds;
19872
+ if (cachedBounds && typeof cachedBounds.empty === 'function' && !cachedBounds.empty()) {
19873
+ return cachedBounds;
19874
+ }
19875
+ }
19876
+ registerDirtyBoundsHooks(stage) {
19877
+ if (this.dirtyBoundsHooksRegistered) {
19382
19878
  return;
19383
19879
  }
19384
19880
  stage.graphicService.hooks.onAttributeUpdate.tap(this.key, this.handlePaintOnlyUpdate);
@@ -19419,10 +19915,29 @@ class DirtyBoundsPlugin {
19419
19915
  if (!(stage && stage === this.pluginService.stage && stage.renderCount)) {
19420
19916
  return;
19421
19917
  }
19422
- if (stage) {
19423
- stage.dirty(graphic.globalAABBBounds);
19918
+ const bounds = this.getRemoveDirtyBounds(graphic);
19919
+ if (bounds && !bounds.empty()) {
19920
+ stage.dirty(bounds);
19921
+ }
19922
+ });
19923
+ this.dirtyBoundsHooksRegistered = true;
19924
+ }
19925
+ activate(context) {
19926
+ this.pluginService = context;
19927
+ context.stage.hooks.afterRender.tap(this.key, stage => {
19928
+ if (!(stage && stage === this.pluginService.stage)) {
19929
+ return;
19424
19930
  }
19931
+ stage.dirtyBounds.clear();
19932
+ this.registerDirtyBoundsHooks(stage);
19425
19933
  });
19934
+ const stage = this.pluginService.stage;
19935
+ if (!stage) {
19936
+ return;
19937
+ }
19938
+ if (stage.renderCount) {
19939
+ this.registerDirtyBoundsHooks(stage);
19940
+ }
19426
19941
  }
19427
19942
  deactivate(context) {
19428
19943
  const stage = this.pluginService.stage;
@@ -19432,6 +19947,7 @@ class DirtyBoundsPlugin {
19432
19947
  stage.graphicService.hooks.onAttributeUpdate.taps = stage.graphicService.hooks.onAttributeUpdate.taps.filter(item => {
19433
19948
  return item.name !== this.key;
19434
19949
  });
19950
+ this.dirtyBoundsHooksRegistered = false;
19435
19951
  stage.graphicService.hooks.beforeUpdateAABBBounds.taps =
19436
19952
  stage.graphicService.hooks.beforeUpdateAABBBounds.taps.filter(item => {
19437
19953
  return item.name !== this.key;
@@ -19956,7 +20472,7 @@ class Stage extends Group {
19956
20472
  this._ticker.on('tick', this.afterTickCb);
19957
20473
  }
19958
20474
  constructor(params = {}, deps = {}) {
19959
- var _a, _b, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
20475
+ var _a, _b, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
19960
20476
  super({});
19961
20477
  this.tickedBeforeRender = true;
19962
20478
  this._onVisibleChange = (visible) => {
@@ -19978,7 +20494,10 @@ class Stage extends Group {
19978
20494
  }
19979
20495
  };
19980
20496
  this.beforeRender = (stage) => {
19981
- flushStageSharedStateRefresh(this);
20497
+ const pendingSharedRefresh = this._pendingSharedStateRefreshGraphics;
20498
+ if (pendingSharedRefresh === null || pendingSharedRefresh === void 0 ? void 0 : pendingSharedRefresh.size) {
20499
+ flushStageSharedStateRefresh(this);
20500
+ }
19982
20501
  this._beforeRenderList.forEach(cb => cb(stage));
19983
20502
  };
19984
20503
  this.afterClearScreen = (drawParams) => {
@@ -20044,16 +20563,19 @@ class Stage extends Group {
20044
20563
  this.appendChild(this.layerService.createLayer(this, { main: true }));
20045
20564
  this.nextFrameRenderLayerSet = new Set();
20046
20565
  this.willNextFrameRender = false;
20047
- ensureStageStatePerfMonitor(this);
20048
- this._stateBatchScheduler = new StateBatchScheduler(this, ensureStageStatePerfMonitor(this));
20049
- this.rootSharedStateScope = createRootSharedStateScope(this, (_x = this.theme) === null || _x === void 0 ? void 0 : _x.stateDefinitions);
20050
20566
  this.theme.onStateDefinitionsChange = () => {
20051
20567
  var _a;
20052
- if (!this.rootSharedStateScope) {
20568
+ const definitions = (_a = this.theme) === null || _a === void 0 ? void 0 : _a.stateDefinitions;
20569
+ if (!definitions || !Object.keys(definitions).length) {
20570
+ if (this.rootSharedStateScope) {
20571
+ setRootSharedStateScopeThemeDefinitions(this.rootSharedStateScope, definitions);
20572
+ markScopeActiveDescendantsDirty(this.rootSharedStateScope, this);
20573
+ }
20053
20574
  return;
20054
20575
  }
20055
- setRootSharedStateScopeThemeDefinitions(this.rootSharedStateScope, (_a = this.theme) === null || _a === void 0 ? void 0 : _a.stateDefinitions);
20056
- markScopeActiveDescendantsDirty(this.rootSharedStateScope, this);
20576
+ const rootScope = this.ensureRootSharedStateScope(definitions);
20577
+ setRootSharedStateScopeThemeDefinitions(rootScope, definitions);
20578
+ markScopeActiveDescendantsDirty(rootScope, this);
20057
20579
  };
20058
20580
  this.renderStyle = params.renderStyle;
20059
20581
  if (params.autoRender) {
@@ -20095,7 +20617,7 @@ class Stage extends Group {
20095
20617
  this.setAttributes({ background: this._background });
20096
20618
  }
20097
20619
  this.initAnimate(params);
20098
- this.rafId = (_y = params.rafId) !== null && _y !== void 0 ? _y : Math.floor(Math.random() * 6);
20620
+ this.rafId = (_x = params.rafId) !== null && _x !== void 0 ? _x : Math.floor(Math.random() * 6);
20099
20621
  }
20100
20622
  initAnimate(params) {
20101
20623
  var _a;
@@ -20475,8 +20997,22 @@ class Stage extends Group {
20475
20997
  });
20476
20998
  }
20477
20999
  }
21000
+ ensureRootSharedStateScope(themeStateDefinitions) {
21001
+ if (!this.rootSharedStateScope) {
21002
+ this.rootSharedStateScope = createRootSharedStateScope(this, themeStateDefinitions);
21003
+ return this.rootSharedStateScope;
21004
+ }
21005
+ this.rootSharedStateScope.ownerStage = this;
21006
+ return this.rootSharedStateScope;
21007
+ }
21008
+ getStateBatchScheduler() {
21009
+ if (!this._stateBatchScheduler) {
21010
+ this._stateBatchScheduler = new StateBatchScheduler(this, ensureStageStatePerfMonitor(this));
21011
+ }
21012
+ return this._stateBatchScheduler;
21013
+ }
20478
21014
  scheduleStateBatch(graphics, targetStates) {
20479
- this._stateBatchScheduler.schedule(graphics, targetStates);
21015
+ this.getStateBatchScheduler().schedule(graphics, targetStates);
20480
21016
  }
20481
21017
  getStatePerfSnapshot() {
20482
21018
  return ensureStageStatePerfMonitor(this).getSnapshot();
@@ -24066,23 +24602,27 @@ function createStage(params) {
24066
24602
  const result = { x: 0, y: 0, z: 0, lastModelMatrix: null };
24067
24603
  class BaseRender {
24068
24604
  init(contributions) {
24069
- if (contributions) {
24070
- this._renderContribitions = contributions.getContributions();
24071
- }
24072
- if (!this._renderContribitions) {
24073
- this._renderContribitions = [];
24074
- }
24075
24605
  if (!this.builtinContributions) {
24076
24606
  this.builtinContributions = [];
24077
24607
  }
24078
- this.builtinContributions.push(defaultBaseClipRenderBeforeContribution);
24079
- this.builtinContributions.push(defaultBaseClipRenderAfterContribution);
24080
- this.builtinContributions.forEach(item => this._renderContribitions.push(item));
24608
+ this._renderContribitions = contributions ? contributions.getContributions().slice() : [];
24609
+ const addContribution = (item) => {
24610
+ if (!this._renderContribitions.includes(item)) {
24611
+ this._renderContribitions.push(item);
24612
+ }
24613
+ };
24614
+ this.builtinContributions.forEach(addContribution);
24615
+ addContribution(defaultBaseClipRenderBeforeContribution);
24616
+ addContribution(defaultBaseClipRenderAfterContribution);
24081
24617
  if (this._renderContribitions.length) {
24082
24618
  this._renderContribitions.sort((a, b) => b.order - a.order);
24083
24619
  this._beforeRenderContribitions = this._renderContribitions.filter(c => c.time === BaseRenderContributionTime.beforeFillStroke);
24084
24620
  this._afterRenderContribitions = this._renderContribitions.filter(c => c.time === BaseRenderContributionTime.afterFillStroke);
24085
24621
  }
24622
+ else {
24623
+ this._beforeRenderContribitions = [];
24624
+ this._afterRenderContribitions = [];
24625
+ }
24086
24626
  }
24087
24627
  reInit() {
24088
24628
  this.init(this.graphicRenderContributions);
@@ -31120,7 +31660,10 @@ class FlexLayoutPlugin {
31120
31660
  this.tryLayout(graphic, false);
31121
31661
  }
31122
31662
  });
31123
- stage.graphicService.hooks.onSetStage.tap(this.key, graphic => {
31663
+ stage.graphicService.hooks.onSetStage.tap(this.key, (graphic, nextStage) => {
31664
+ if (!(nextStage && nextStage === this.pluginService.stage)) {
31665
+ return;
31666
+ }
31124
31667
  if (graphic.glyphHost) {
31125
31668
  graphic = graphic.glyphHost;
31126
31669
  }
@@ -31155,4 +31698,4 @@ const registerFlexLayoutPlugin = () => {
31155
31698
  Factory.registerPlugin('FlexLayoutPlugin', FlexLayoutPlugin);
31156
31699
  };
31157
31700
 
31158
- export { ARC3D_NUMBER_TYPE, ARC_NUMBER_TYPE, AREA_NUMBER_TYPE, AbstractGraphicRender, AnimateMode, AnimateStatus, AnimateStepType, AppContext, Application, Arc, Arc3d, Arc3dRender, ArcRender, ArcRenderContribution, Area, AreaRender, AreaRenderContribution, AttributeUpdateType, AutoEnablePlugins, BaseCanvas, BaseEnvContribution, BaseRender, BaseRenderContributionTime, BaseWindowHandlerContribution, Basis, BeforeRenderConstribution, BoundsContext, BoundsPicker, BrowserEntry, CIRCLE_NUMBER_TYPE, Canvas3DDrawItemInterceptor, Canvas3DPickItemInterceptor, CanvasFactory, CanvasTextLayout, Circle, CircleRender, CircleRenderContribution, ColorInterpolate, ColorStore, ColorType, CommonDrawItemInterceptorContribution, CommonRenderContribution, Context2dFactory, ContributionProvider, ContributionRegistry, ContributionStore, CubicBezierCurve, CurveContext, CurveTypeEnum, CustomEvent, CustomPath2D, CustomSymbolClass, DEFAULT_TEXT_FONT_FAMILY, DebugDrawItemInterceptorContribution, DefaultArcAllocate, DefaultArcAttribute, DefaultArcRenderContribution, DefaultAreaAllocate, DefaultAreaAttribute, DefaultAreaTextureRenderContribution, DefaultAttribute, DefaultBaseBackgroundRenderContribution, DefaultBaseClipRenderAfterContribution, DefaultBaseClipRenderBeforeContribution, DefaultBaseInteractiveRenderContribution, DefaultBaseTextureRenderContribution, DefaultCanvasAllocate, DefaultCanvasArcRender, DefaultCanvasAreaRender, DefaultCanvasCircleRender, DefaultCanvasGroupRender, DefaultCanvasImageRender, DefaultCanvasLineRender, DefaultCanvasPathRender, DefaultCanvasPolygonRender, DefaultCanvasRectRender, DefaultCanvasSymbolRender, DefaultCanvasTextRender, DefaultCircleAllocate, DefaultCircleAttribute, DefaultCircleRenderContribution, DefaultConnectAttribute, DefaultDebugAttribute, DefaultFillStyle, DefaultGlobal, DefaultGlobalPickerService, DefaultGlyphAttribute, DefaultGraphicAllocate, DefaultGraphicMemoryManager, DefaultGraphicService, DefaultGraphicUtil, DefaultGroupAttribute, DefaultGroupBackgroundRenderContribution, DefaultImageAttribute, DefaultImageRenderContribution, DefaultLayerService, DefaultLayout, DefaultLineAllocate, DefaultLineAttribute, DefaultMat4Allocate, DefaultMatrixAllocate, DefaultPathAllocate, DefaultPathAttribute, DefaultPickService, DefaultPickStyle, DefaultPolygonAttribute, DefaultRect3dAttribute, DefaultRectAllocate, DefaultRectAttribute, DefaultRectRenderContribution, DefaultRenderService, DefaultRichTextAttribute, DefaultRichTextIconAttribute, DefaultStarAttribute, DefaultStrokeStyle, DefaultStyle, DefaultSymbolAllocate, DefaultSymbolAttribute, DefaultSymbolClipRangeStrokeRenderContribution, DefaultSymbolRenderContribution, DefaultTextAllocate, DefaultTextAttribute, DefaultTextMeasureContribution, DefaultTextStyle, DefaultTransform, DefaultTransformUtil, DefaultWindow, Direction, DirectionalLight, DrawContribution, DrawItemInterceptor, DynamicLayerHandlerContribution, Edge, EditModule, EmptyContext2d, EnvContribution, EventManager, EventSystem, EventTarget, FORMAT_ALL_TEXT_COMMAND, FORMAT_ELEMENT_COMMAND, FORMAT_TEXT_COMMAND, Factory, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, FlexLayoutPlugin, GLYPH_NUMBER_TYPE, GRAPHIC_UPDATE_TAG_KEY, GROUP_NUMBER_TYPE, Generator, GlobalPickerService, Glyph, GlyphRender, GradientParser, Graphic, GraphicCreator$1 as GraphicCreator, GraphicFactory, GraphicPicker, GraphicRender, GraphicService, GraphicUtil, Group, GroupRender, GroupRenderContribution, GroupUpdateAABBBoundsMode, HtmlAttributePlugin, IContainPointMode, IMAGE_NUMBER_TYPE, Image, ImageRender, ImageRenderContribution, IncrementalDrawContribution, InteractiveDrawItemInterceptorContribution, InteractivePickItemInterceptorContribution, InteractiveSubRenderContribution, LINE_NUMBER_TYPE, Layer, LayerFactory, LayerService, Line$1 as Line, LineRender, Linear, LinearClosed, Mat4Allocate, MatrixAllocate, MeasureModeEnum, MiniappEntry, MonotoneX, MonotoneY, NOWORK_ANIMATE_ATTR, Node, NodeEntry, OrthoCamera, PATH_NUMBER_TYPE, POLYGON_NUMBER_TYPE, PURE_STYLE_KEY, PYRAMID3D_NUMBER_TYPE, Path, PathRender, PathRenderContribution, PerformanceRAF, PickItemInterceptor, PickServiceInterceptor, PickerRegistry, PickerService, PluginRegistry, PluginService, Polygon, PolygonRender, PolygonRenderContribution, Pyramid3d, Pyramid3dRender, RECT3D_NUMBER_TYPE, RECT_NUMBER_TYPE, RICHTEXT_NUMBER_TYPE, RafBasedSTO, ReactAttributePlugin, Rect, Rect3DRender, Rect3d, RectRender, RectRenderContribution, ReflectSegContext, RenderSelector, RenderService, RendererRegistry, ResourceLoader, RichText, RichTextEditPlugin, RichTextRender, STAR_NUMBER_TYPE, STATUS$1 as STATUS, SVG_ATTRIBUTE_MAP, SVG_ATTRIBUTE_MAP_KEYS, SVG_PARSE_ATTRIBUTE_MAP, SVG_PARSE_ATTRIBUTE_MAP_KEYS, SYMBOL_NUMBER_TYPE, SegContext, ShadowPickServiceInterceptorContribution, ShadowRoot, ShadowRootDrawItemInterceptorContribution, ShadowRootPickItemInterceptorContribution, SplitRectAfterRenderContribution, SplitRectBeforeRenderContribution, Stage, StageFactory, Star, StarRender, StarRenderContribution, StateDefinitionCompiler, StateEngine, StaticLayerHandlerContribution, Step, StepClosed, Symbol$1 as Symbol, SymbolRender, SymbolRenderContribution, TEXT_NUMBER_TYPE, Text, TextDirection, TextMeasureContribution, TextRender, TextRenderContribution, Theme, TransformUtil, UpdateTag, VGlobal, VWindow, ViewTransform3dPlugin, VirtualLayerHandlerContribution, WILDCARD, WindowHandlerContribution, WrapText, XMLParser, _calculateLineHeight, _interpolateColor, addArcToBezierPath, addAttributeToPrototype, alignBezierCurves, alignSubpath, application, applyTransformOnBezierCurves, arc3dModule, arcModule, areaModule, bezier, bezierCurversToPath, binarySplitPolygon, bindArc3dRenderModule, bindArcRenderModule, bindAreaRenderModule, bindCircleRenderModule, bindContributionProvider, bindContributionProviderNoSingletonScope, bindGlyphRenderModule, bindImageRenderModule, bindLineRenderModule, bindPathRenderModule, bindPolygonRenderModule, bindPyramid3dRenderModule, bindRect3dRenderModule, bindRectRenderModule, bindRichtextRenderModule, bindStarRenderModule, bindSymbolRenderModule, bindTextRenderModule, boundStroke, builtInSymbolStrMap, builtinSymbols, builtinSymbolsMap, calcLineCache, calculateArcCornerRadius, calculateLineHeight, canvasAllocate, centroidOfSubpath, circleBounds, circleModule, clock, colorEqual, colorStringInterpolationToStr, configureRuntimeApplicationForApp, container, cornerTangents, createBrowserApp as createApp, createArc, createArc3d, createArea, createBrowserApp, createCanvasEventTransformer, createCircle, createColor, createConicalGradient, createContributionProvider, createEventTransformer, createGlyph, createGraphic, createGroup, createImage, createLine, createMat4, createMiniappApp, createNodeApp, createPath, createPolygon, createPyramid3d, createRect, createRect3d, createRectPath, createRichText, createShadowRoot, createStage, createStar, createSymbol, createText, createWrapText, cubicCalc, cubicLength, cubicPointAt, cubicSubdivide, defaultArcAllocate, defaultArcBackgroundRenderContribution, defaultArcRenderContribution, defaultArcTextureRenderContribution, defaultAreaAllocate, defaultBaseBackgroundRenderContribution, defaultBaseClipRenderAfterContribution, defaultBaseClipRenderBeforeContribution, defaultBaseTextureRenderContribution, defaultCircleAllocate, defaultCircleBackgroundRenderContribution, defaultCircleRenderContribution, defaultCircleTextureRenderContribution, defaultGraphicMemoryManager, defaultGroupBackgroundRenderContribution, defaultImageBackgroundRenderContribution, defaultImageRenderContribution, defaultLineAllocate, defaultPathAllocate, defaultRectAllocate, defaultRectBackgroundRenderContribution, defaultRectRenderContribution, defaultRectTextureRenderContribution, defaultStarBackgroundRenderContribution, defaultStarTextureRenderContribution, defaultSymbolAllocate, defaultSymbolBackgroundRenderContribution, defaultSymbolClipRangeStrokeRenderContribution, defaultSymbolRenderContribution, defaultSymbolTextureRenderContribution, defaultTextAllocate, diff, divideCubic, drawArc, drawArcPath$1 as drawArcPath, drawAreaSegments, drawBackgroundImage, drawImageWithLayout, drawIncrementalAreaSegments, drawIncrementalSegments, drawSegments, enumCommandMap, fillVisible, findBestMorphingRotation, findConfigIndexByCursorIdx, findCursorIdxByConfigIndex, findNextGraphic, flatten_simplify, foreach, foreachAsync, genBasisSegments, genBasisTypeSegments, genLinearClosedSegments, genLinearClosedTypeSegments, genLinearSegments, genLinearTypeSegments, genMonotoneXSegments, genMonotoneXTypeSegments, genMonotoneYSegments, genMonotoneYTypeSegments, genNumberType, genStepClosedSegments, genStepSegments, genStepTypeSegments, getAttributeFromDefaultAttrList, getBackgroundImage, getConicGradientAt, getCurrentEnv, getDefaultCharacterConfig, getExtraModelMatrix, getLegacyBindingContext, getModelMatrix, getRichTextBounds, getRuntimeInstallerBindingContext, getRuntimeInstallerGlobal, getScaledStroke, getTextBounds, getTheme, getThemeFromGroup, globalTheme, glyphModule, graphicCreator, graphicService, graphicUtil, identityMat4, imageModule, incrementalAddTo, installRuntimeDrawContributionsToApp, installRuntimeGraphicRenderersToApp, installRuntimePickersToApp, interpolateColor, interpolateGradientConicalColor, interpolateGradientLinearColor, interpolateGradientRadialColor, interpolatePureColorArray, interpolatePureColorArrayToStr, intersect, isBrowserEnv, isNoRepeatSizingMode, isNodeEnv, isSvg, isXML, layerService, lineModule, lookAt, mapToCanvasPointForCanvas, mat3Tomat4, mat4Allocate, matrixAllocate, multiplyMat4Mat3, multiplyMat4Mat4, newThemeObj, ortho, parsePadding, parseStroke, parseSvgPath, pathModule, pathToBezierCurves, point$3 as point, pointEqual, pointInterpolation, pointInterpolationHighPerformance, pointsEqual, pointsInterpolation, polygonModule, preLoadAllModule, pyramid3dModule, quadCalc, quadLength, quadPointAt, rafBasedSto, rect3dModule, rectFillVisible, rectModule, rectStrokeVisible, recursiveCallBinarySplit, refreshRuntimeInstallerContributions, registerArc3dGraphic, registerArcGraphic, registerAreaGraphic, registerCircleGraphic, registerDirectionalLight, registerFlexLayoutPlugin, registerGlobalEventTransformer, registerGlyphGraphic, registerGraphic, registerGroupGraphic, registerHtmlAttributePlugin, registerImageGraphic, registerLineGraphic, registerOrthoCamera, registerPathGraphic, registerPolygonGraphic, registerPyramid3dGraphic, registerReactAttributePlugin, registerRect3dGraphic, registerRectGraphic, registerRichtextGraphic, registerShadowRootGraphic, registerStarGraphic, registerSymbolGraphic, registerTextGraphic, registerViewTransform3dPlugin, registerWindowEventTransformer, registerWrapTextGraphic, renderCommandList, resolveBackgroundDrawMode, resolveBackgroundParamsByImageSizing, resolveBackgroundPosition, resolveBackgroundSizing, resolveContainerBinding, resolveImageMode, resolveImageRepeatMode, resolveRenderableImageSize, rewriteProto, richtextModule, rotateX, rotateY, rotateZ, runFill, runStroke, scaleMat4, segments, shouldClipImageByLayout, shouldUseMat4, shouldUseSimpleAttributeFastPath, snapLength, splitArc, splitArea, splitCircle, splitLine, splitPath, splitPolygon, splitRect, splitToGrids, starModule, strCommandMap, strokeVisible, symbolModule, textAttributesToStyle, textDrawOffsetX, textDrawOffsetY, textLayoutOffsetY, textModule, transformMat4, transformPointForCanvas, transformUtil, translate, verticalLayout, vglobal, waitForAllSubLayers, wrapCanvas, wrapContext, xul };
31701
+ export { ARC3D_NUMBER_TYPE, ARC_NUMBER_TYPE, AREA_NUMBER_TYPE, AbstractGraphicRender, AnimateMode, AnimateStatus, AnimateStepType, AppContext, Application, Arc, Arc3d, Arc3dRender, ArcRender, ArcRenderContribution, Area, AreaRender, AreaRenderContribution, AttributeUpdateType, AutoEnablePlugins, BaseCanvas, BaseEnvContribution, BaseRender, BaseRenderContributionTime, BaseWindowHandlerContribution, Basis, BeforeRenderConstribution, BoundsContext, BoundsPicker, BrowserEntry, CIRCLE_NUMBER_TYPE, Canvas3DDrawItemInterceptor, Canvas3DPickItemInterceptor, CanvasFactory, CanvasTextLayout, Circle, CircleRender, CircleRenderContribution, ColorInterpolate, ColorStore, ColorType, CommonDrawItemInterceptorContribution, CommonRenderContribution, Context2dFactory, ContributionProvider, ContributionRegistry, ContributionStore, CubicBezierCurve, CurveContext, CurveTypeEnum, CustomEvent, CustomPath2D, CustomSymbolClass, DEFAULT_TEXT_FONT_FAMILY, DebugDrawItemInterceptorContribution, DefaultArcAllocate, DefaultArcAttribute, DefaultArcRenderContribution, DefaultAreaAllocate, DefaultAreaAttribute, DefaultAreaTextureRenderContribution, DefaultAttribute, DefaultBaseBackgroundRenderContribution, DefaultBaseClipRenderAfterContribution, DefaultBaseClipRenderBeforeContribution, DefaultBaseInteractiveRenderContribution, DefaultBaseTextureRenderContribution, DefaultCanvasAllocate, DefaultCanvasArcRender, DefaultCanvasAreaRender, DefaultCanvasCircleRender, DefaultCanvasGroupRender, DefaultCanvasImageRender, DefaultCanvasLineRender, DefaultCanvasPathRender, DefaultCanvasPolygonRender, DefaultCanvasRectRender, DefaultCanvasSymbolRender, DefaultCanvasTextRender, DefaultCircleAllocate, DefaultCircleAttribute, DefaultCircleRenderContribution, DefaultConnectAttribute, DefaultDebugAttribute, DefaultFillStyle, DefaultGlobal, DefaultGlobalPickerService, DefaultGlyphAttribute, DefaultGraphicAllocate, DefaultGraphicMemoryManager, DefaultGraphicService, DefaultGraphicUtil, DefaultGroupAttribute, DefaultGroupBackgroundRenderContribution, DefaultImageAttribute, DefaultImageRenderContribution, DefaultLayerService, DefaultLayout, DefaultLineAllocate, DefaultLineAttribute, DefaultMat4Allocate, DefaultMatrixAllocate, DefaultPathAllocate, DefaultPathAttribute, DefaultPickService, DefaultPickStyle, DefaultPolygonAttribute, DefaultRect3dAttribute, DefaultRectAllocate, DefaultRectAttribute, DefaultRectRenderContribution, DefaultRenderService, DefaultRichTextAttribute, DefaultRichTextIconAttribute, DefaultStarAttribute, DefaultStrokeStyle, DefaultStyle, DefaultSymbolAllocate, DefaultSymbolAttribute, DefaultSymbolClipRangeStrokeRenderContribution, DefaultSymbolRenderContribution, DefaultTextAllocate, DefaultTextAttribute, DefaultTextMeasureContribution, DefaultTextStyle, DefaultTransform, DefaultTransformUtil, DefaultWindow, Direction, DirectionalLight, DrawContribution, DrawItemInterceptor, DynamicLayerHandlerContribution, Edge, EditModule, EmptyContext2d, EnvContribution, EventManager, EventSystem, EventTarget, FORMAT_ALL_TEXT_COMMAND, FORMAT_ELEMENT_COMMAND, FORMAT_TEXT_COMMAND, Factory, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, FlexLayoutPlugin, GLYPH_NUMBER_TYPE, GRAPHIC_UPDATE_TAG_KEY, GROUP_NUMBER_TYPE, Generator, GlobalPickerService, Glyph, GlyphRender, GradientParser, Graphic, GraphicCreator$1 as GraphicCreator, GraphicFactory, GraphicPicker, GraphicRender, GraphicService, GraphicUtil, Group, GroupRender, GroupRenderContribution, GroupUpdateAABBBoundsMode, HtmlAttributePlugin, IContainPointMode, IMAGE_NUMBER_TYPE, Image, ImageRender, ImageRenderContribution, IncrementalDrawContribution, InteractiveDrawItemInterceptorContribution, InteractivePickItemInterceptorContribution, InteractiveSubRenderContribution, LINE_NUMBER_TYPE, Layer, LayerFactory, LayerService, Line$1 as Line, LineRender, Linear, LinearClosed, Mat4Allocate, MatrixAllocate, MeasureModeEnum, MiniappEntry, MonotoneX, MonotoneY, NOWORK_ANIMATE_ATTR, Node, NodeEntry, OrthoCamera, PATH_NUMBER_TYPE, POLYGON_NUMBER_TYPE, PURE_STYLE_KEY, PYRAMID3D_NUMBER_TYPE, Path, PathRender, PathRenderContribution, PerformanceRAF, PickItemInterceptor, PickServiceInterceptor, PickerRegistry, PickerService, PluginRegistry, PluginService, Polygon, PolygonRender, PolygonRenderContribution, Pyramid3d, Pyramid3dRender, RECT3D_NUMBER_TYPE, RECT_NUMBER_TYPE, RICHTEXT_NUMBER_TYPE, RafBasedSTO, ReactAttributePlugin, Rect, Rect3DRender, Rect3d, RectRender, RectRenderContribution, ReflectSegContext, RenderSelector, RenderService, RendererRegistry, ResourceLoader, RichText, RichTextEditPlugin, RichTextRender, STAR_NUMBER_TYPE, STATUS$1 as STATUS, SVG_ATTRIBUTE_MAP, SVG_ATTRIBUTE_MAP_KEYS, SVG_PARSE_ATTRIBUTE_MAP, SVG_PARSE_ATTRIBUTE_MAP_KEYS, SYMBOL_NUMBER_TYPE, SegContext, ShadowPickServiceInterceptorContribution, ShadowRoot, ShadowRootDrawItemInterceptorContribution, ShadowRootPickItemInterceptorContribution, SplitRectAfterRenderContribution, SplitRectBeforeRenderContribution, Stage, StageFactory, Star, StarRender, StarRenderContribution, StateDefinitionCompiler, StateEngine, StaticLayerHandlerContribution, Step, StepClosed, Symbol$1 as Symbol, SymbolRender, SymbolRenderContribution, TEXT_NUMBER_TYPE, Text, TextDirection, TextMeasureContribution, TextRender, TextRenderContribution, Theme, TransformUtil, UpdateTag, VGlobal, VWindow, ViewTransform3dPlugin, VirtualLayerHandlerContribution, WILDCARD, WindowHandlerContribution, WrapText, XMLParser, _calculateLineHeight, _interpolateColor, addArcToBezierPath, addAttributeToPrototype, alignBezierCurves, alignSubpath, application, applyTransformOnBezierCurves, arc3dModule, arcModule, areaModule, bezier, bezierCurversToPath, binarySplitPolygon, bindArc3dRenderModule, bindArcRenderModule, bindAreaRenderModule, bindCircleRenderModule, bindContributionProvider, bindContributionProviderNoSingletonScope, bindGlyphRenderModule, bindImageRenderModule, bindLineRenderModule, bindPathRenderModule, bindPolygonRenderModule, bindPyramid3dRenderModule, bindRect3dRenderModule, bindRectRenderModule, bindRichtextRenderModule, bindStarRenderModule, bindSymbolRenderModule, bindTextRenderModule, boundStroke, builtInSymbolStrMap, builtinSymbols, builtinSymbolsMap, calcLineCache, calculateArcCornerRadius, calculateLineHeight, canvasAllocate, centroidOfSubpath, circleBounds, circleModule, clock, colorEqual, colorStringInterpolationToStr, configureRuntimeApplicationForApp, container, cornerTangents, createBrowserApp as createApp, createArc, createArc3d, createArea, createBrowserApp, createCanvasEventTransformer, createCircle, createColor, createConicalGradient, createContributionProvider, createEventTransformer, createGlyph, createGraphic, createGroup, createImage, createLine, createMat4, createMiniappApp, createNodeApp, createPath, createPolygon, createPyramid3d, createRect, createRect3d, createRectPath, createRichText, createShadowRoot, createStage, createStar, createSymbol, createText, createWrapText, cubicCalc, cubicLength, cubicPointAt, cubicSubdivide, defaultArcAllocate, defaultArcBackgroundRenderContribution, defaultArcRenderContribution, defaultArcTextureRenderContribution, defaultAreaAllocate, defaultBaseBackgroundRenderContribution, defaultBaseClipRenderAfterContribution, defaultBaseClipRenderBeforeContribution, defaultBaseTextureRenderContribution, defaultCircleAllocate, defaultCircleBackgroundRenderContribution, defaultCircleRenderContribution, defaultCircleTextureRenderContribution, defaultGraphicMemoryManager, defaultGroupBackgroundRenderContribution, defaultImageBackgroundRenderContribution, defaultImageRenderContribution, defaultLineAllocate, defaultPathAllocate, defaultRectAllocate, defaultRectBackgroundRenderContribution, defaultRectRenderContribution, defaultRectTextureRenderContribution, defaultStarBackgroundRenderContribution, defaultStarTextureRenderContribution, defaultSymbolAllocate, defaultSymbolBackgroundRenderContribution, defaultSymbolClipRangeStrokeRenderContribution, defaultSymbolRenderContribution, defaultSymbolTextureRenderContribution, defaultTextAllocate, diff, divideCubic, drawArc, drawArcPath$1 as drawArcPath, drawAreaSegments, drawBackgroundImage, drawImageWithLayout, drawIncrementalAreaSegments, drawIncrementalSegments, drawSegments, enumCommandMap, fillVisible, findBestMorphingRotation, findConfigIndexByCursorIdx, findCursorIdxByConfigIndex, findNextGraphic, flatten_simplify, foreach, foreachAsync, genBasisSegments, genBasisTypeSegments, genLinearClosedSegments, genLinearClosedTypeSegments, genLinearSegments, genLinearTypeSegments, genMonotoneXSegments, genMonotoneXTypeSegments, genMonotoneYSegments, genMonotoneYTypeSegments, genNumberType, genStepClosedSegments, genStepSegments, genStepTypeSegments, getAttributeFromDefaultAttrList, getBackgroundImage, getConicGradientAt, getCurrentEnv, getDefaultCharacterConfig, getExtraModelMatrix, getLegacyBindingContext, getModelMatrix, getRichTextBounds, getRuntimeInstallerBindingContext, getRuntimeInstallerGlobal, getScaledStroke, getTextBounds, getTheme, getThemeFromGroup, globalTheme, glyphModule, graphicCreator, graphicService, graphicUtil, identityMat4, imageModule, incrementalAddTo, installRuntimeDrawContributionsToApp, installRuntimeGraphicRenderersToApp, installRuntimePickersToApp, interpolateColor, interpolateGradientConicalColor, interpolateGradientLinearColor, interpolateGradientRadialColor, interpolatePureColorArray, interpolatePureColorArrayToStr, intersect, isBrowserEnv, isNoRepeatSizingMode, isNodeEnv, isSvg, isXML, layerService, lineModule, lookAt, mapToCanvasPointForCanvas, mat3Tomat4, mat4Allocate, matrixAllocate, multiplyMat4Mat3, multiplyMat4Mat4, newThemeObj, ortho, parsePadding, parseStroke, parseSvgPath, pathModule, pathToBezierCurves, point$3 as point, pointEqual, pointInterpolation, pointInterpolationHighPerformance, pointsEqual, pointsInterpolation, polygonModule, preLoadAllModule, pyramid3dModule, quadCalc, quadLength, quadPointAt, rafBasedSto, rect3dModule, rectFillVisible, rectModule, rectStrokeVisible, recursiveCallBinarySplit, refreshRuntimeInstallerContributions, registerArc3dGraphic, registerArcGraphic, registerAreaGraphic, registerCircleGraphic, registerDirectionalLight, registerFlexLayoutPlugin, registerGlobalEventTransformer, registerGlyphGraphic, registerGraphic, registerGroupGraphic, registerHtmlAttributePlugin, registerImageGraphic, registerLineGraphic, registerOrthoCamera, registerPathGraphic, registerPolygonGraphic, registerPyramid3dGraphic, registerReactAttributePlugin, registerRect3dGraphic, registerRectGraphic, registerRichtextGraphic, registerShadowRootGraphic, registerStarGraphic, registerSymbolGraphic, registerTextGraphic, registerViewTransform3dPlugin, registerWindowEventTransformer, registerWrapTextGraphic, renderCommandList, resolveBackgroundDrawMode, resolveBackgroundParamsByImageSizing, resolveBackgroundPosition, resolveBackgroundSizing, resolveContainerBinding, resolveImageMode, resolveImageRepeatMode, resolveRenderableImageSize, rewriteProto, richtextModule, rotateX, rotateY, rotateZ, runFill, runStroke, scaleMat4, segments, shouldClipImageByLayout, shouldUseMat4, snapLength, splitArc, splitArea, splitCircle, splitLine, splitPath, splitPolygon, splitRect, splitToGrids, starModule, strCommandMap, strokeVisible, symbolModule, textAttributesToStyle, textDrawOffsetX, textDrawOffsetY, textLayoutOffsetY, textModule, transformMat4, transformPointForCanvas, transformUtil, translate, verticalLayout, vglobal, waitForAllSubLayers, wrapCanvas, wrapContext, xul };