@visactor/vrender-core 1.1.0-alpha.16 → 1.1.0-alpha.18

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 (70) hide show
  1. package/cjs/core/stage.d.ts +4 -1
  2. package/cjs/core/stage.js +23 -11
  3. package/cjs/core/stage.js.map +1 -1
  4. package/cjs/graphic/graphic-service/graphic-service.d.ts +4 -0
  5. package/cjs/graphic/graphic-service/graphic-service.js +6 -5
  6. package/cjs/graphic/graphic-service/graphic-service.js.map +1 -1
  7. package/cjs/graphic/graphic.d.ts +61 -9
  8. package/cjs/graphic/graphic.js +433 -146
  9. package/cjs/graphic/graphic.js.map +1 -1
  10. package/cjs/graphic/group.d.ts +5 -1
  11. package/cjs/graphic/group.js +37 -18
  12. package/cjs/graphic/group.js.map +1 -1
  13. package/cjs/graphic/state/shared-state-refresh.js +4 -3
  14. package/cjs/graphic/state/shared-state-refresh.js.map +1 -1
  15. package/cjs/graphic/state/shared-state-scope.js +1 -1
  16. package/cjs/graphic/state/shared-state-scope.js.map +1 -1
  17. package/cjs/graphic/state/state-engine.js +2 -2
  18. package/cjs/graphic/state/state-engine.js.map +1 -1
  19. package/cjs/graphic/state/state-perf-monitor.d.ts +1 -0
  20. package/cjs/graphic/state/state-perf-monitor.js +9 -2
  21. package/cjs/graphic/state/state-perf-monitor.js.map +1 -1
  22. package/cjs/graphic/state/state-style-resolver.d.ts +0 -9
  23. package/cjs/graphic/state/state-style-resolver.js +0 -23
  24. package/cjs/graphic/state/state-style-resolver.js.map +1 -1
  25. package/cjs/interface/graphic.d.ts +9 -0
  26. package/cjs/interface/graphic.js.map +1 -1
  27. package/cjs/interface/node-tree.js.map +1 -1
  28. package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.d.ts +4 -1
  29. package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js +20 -10
  30. package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
  31. package/cjs/plugins/builtin-plugin/flex-layout-plugin.js +3 -2
  32. package/cjs/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
  33. package/cjs/render/contributions/render/base-render.js +8 -7
  34. package/cjs/render/contributions/render/base-render.js.map +1 -1
  35. package/dist/index.es.js +895 -261
  36. package/es/core/stage.d.ts +4 -1
  37. package/es/core/stage.js +21 -10
  38. package/es/core/stage.js.map +1 -1
  39. package/es/graphic/graphic-service/graphic-service.d.ts +4 -0
  40. package/es/graphic/graphic-service/graphic-service.js +6 -5
  41. package/es/graphic/graphic-service/graphic-service.js.map +1 -1
  42. package/es/graphic/graphic.d.ts +61 -9
  43. package/es/graphic/graphic.js +429 -139
  44. package/es/graphic/graphic.js.map +1 -1
  45. package/es/graphic/group.d.ts +5 -1
  46. package/es/graphic/group.js +36 -18
  47. package/es/graphic/group.js.map +1 -1
  48. package/es/graphic/state/shared-state-refresh.js +5 -4
  49. package/es/graphic/state/shared-state-refresh.js.map +1 -1
  50. package/es/graphic/state/shared-state-scope.js +2 -2
  51. package/es/graphic/state/shared-state-scope.js.map +1 -1
  52. package/es/graphic/state/state-engine.js +3 -3
  53. package/es/graphic/state/state-engine.js.map +1 -1
  54. package/es/graphic/state/state-perf-monitor.d.ts +1 -0
  55. package/es/graphic/state/state-perf-monitor.js +7 -0
  56. package/es/graphic/state/state-perf-monitor.js.map +1 -1
  57. package/es/graphic/state/state-style-resolver.d.ts +0 -9
  58. package/es/graphic/state/state-style-resolver.js +0 -23
  59. package/es/graphic/state/state-style-resolver.js.map +1 -1
  60. package/es/interface/graphic.d.ts +9 -0
  61. package/es/interface/graphic.js.map +1 -1
  62. package/es/interface/node-tree.js.map +1 -1
  63. package/es/plugins/builtin-plugin/dirty-bounds-plugin.d.ts +4 -1
  64. package/es/plugins/builtin-plugin/dirty-bounds-plugin.js +20 -10
  65. package/es/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
  66. package/es/plugins/builtin-plugin/flex-layout-plugin.js +3 -2
  67. package/es/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
  68. package/es/render/contributions/render/base-render.js +8 -6
  69. package/es/render/contributions/render/base-render.js.map +1 -1
  70. 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();
@@ -10466,6 +10421,9 @@ function flushStageSharedStateRefresh(stage) {
10466
10421
  if (graphic.stage !== stage) {
10467
10422
  return;
10468
10423
  }
10424
+ if (!graphic.sharedStateDirty) {
10425
+ return;
10426
+ }
10469
10427
  const refresh = graphic.refreshSharedStateBeforeRender;
10470
10428
  if (typeof refresh === 'function') {
10471
10429
  refresh.call(graphic);
@@ -10518,9 +10476,24 @@ const builtinTextureTypes = new Set([
10518
10476
  'grid',
10519
10477
  'wave'
10520
10478
  ]);
10479
+ const FULL_STATE_DEFINITION_KEYS = new Set([
10480
+ 'name',
10481
+ 'patch',
10482
+ 'priority',
10483
+ 'exclude',
10484
+ 'suppress',
10485
+ 'resolver',
10486
+ 'declaredAffectedKeys'
10487
+ ]);
10521
10488
  const point = new Point();
10489
+ const EMPTY_STATE_NAMES = [];
10490
+ const BROAD_UPDATE_CATEGORY = UpdateCategory.PAINT |
10491
+ UpdateCategory.SHAPE |
10492
+ UpdateCategory.BOUNDS |
10493
+ UpdateCategory.TRANSFORM |
10494
+ UpdateCategory.LAYOUT;
10522
10495
  function isPlainObjectValue(value) {
10523
- return typeof value === 'object' && value != null && !isArray(value);
10496
+ return typeof value === 'object' && value != null && !Array.isArray(value);
10524
10497
  }
10525
10498
  function cloneAttributeValue(value) {
10526
10499
  if (!isPlainObjectValue(value)) {
@@ -10534,18 +10507,6 @@ function cloneAttributeValue(value) {
10534
10507
  });
10535
10508
  return clone;
10536
10509
  }
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
10510
  function cloneAttributeSurface(value) {
10550
10511
  if (!isPlainObjectValue(value)) {
10551
10512
  return value;
@@ -10558,6 +10519,15 @@ function cloneAttributeSurface(value) {
10558
10519
  });
10559
10520
  return clone;
10560
10521
  }
10522
+ function areAttributeValuesEqual(left, right) {
10523
+ if (left === right) {
10524
+ return true;
10525
+ }
10526
+ if (!isPlainObjectValue(left) && !isPlainObjectValue(right) && !Array.isArray(left) && !Array.isArray(right)) {
10527
+ return false;
10528
+ }
10529
+ return isEqual(left, right);
10530
+ }
10561
10531
  function deepMergeAttributeValue(base, value) {
10562
10532
  var _a;
10563
10533
  const result = (_a = cloneAttributeValue(base)) !== null && _a !== void 0 ? _a : {};
@@ -10625,24 +10595,29 @@ class Graphic extends Node {
10625
10595
  get globalTransMatrix() {
10626
10596
  return this.tryUpdateGlobalTransMatrix(true);
10627
10597
  }
10598
+ get baseAttributes() {
10599
+ var _a;
10600
+ return (_a = this._baseAttributes) !== null && _a !== void 0 ? _a : this.attribute;
10601
+ }
10602
+ set baseAttributes(value) {
10603
+ if (value === this.attribute) {
10604
+ this._baseAttributes = undefined;
10605
+ return;
10606
+ }
10607
+ this._baseAttributes = value;
10608
+ }
10628
10609
  constructor(params = {}) {
10629
10610
  var _a;
10630
10611
  super();
10631
- this.resolverEpoch = 0;
10632
10612
  this._AABBBounds = new AABBBounds();
10633
10613
  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));
10614
+ this.attribute = params;
10640
10615
  this.valid = this.isValid();
10641
10616
  this.updateAABBBoundsStamp = 0;
10642
10617
  if (params.background) {
10643
10618
  this.loadImage((_a = params.background.background) !== null && _a !== void 0 ? _a : params.background, true);
10644
10619
  }
10645
- if (isExternalTexture(params.texture)) {
10620
+ if (params.texture && isExternalTexture(params.texture)) {
10646
10621
  this.loadImage(params.texture, false);
10647
10622
  }
10648
10623
  if (params.shadowGraphic) {
@@ -10652,8 +10627,11 @@ class Graphic extends Node {
10652
10627
  get normalAttrs() {
10653
10628
  return this.baseAttributes;
10654
10629
  }
10655
- set normalAttrs(value) {
10656
- this._deprecatedNormalAttrsView = value !== null && value !== void 0 ? value : undefined;
10630
+ set normalAttrs(_value) {
10631
+ }
10632
+ getBaseAttributesStorage() {
10633
+ var _a;
10634
+ return (_a = this._baseAttributes) !== null && _a !== void 0 ? _a : this.attribute;
10657
10635
  }
10658
10636
  getGraphicService() {
10659
10637
  var _a, _b;
@@ -10712,13 +10690,31 @@ class Graphic extends Node {
10712
10690
  }
10713
10691
  return true;
10714
10692
  }
10715
- syncSharedStateActiveRegistrations() {
10693
+ syncSharedStateScopeBindingOnTreeChange(markDirty = true) {
10716
10694
  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 => {
10695
+ if (!((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) &&
10696
+ !this.boundSharedStateScope &&
10697
+ !((_b = this.registeredActiveScopes) === null || _b === void 0 ? void 0 : _b.size) &&
10698
+ !this.sharedStateDirty) {
10699
+ return false;
10700
+ }
10701
+ return this.syncSharedStateScopeBindingFromTree(markDirty);
10702
+ }
10703
+ syncSharedStateActiveRegistrations() {
10704
+ var _a;
10705
+ const previousScopes = this.registeredActiveScopes;
10706
+ if (!((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) || !this.boundSharedStateScope) {
10707
+ if (previousScopes === null || previousScopes === void 0 ? void 0 : previousScopes.size) {
10708
+ previousScopes.forEach(scope => {
10709
+ scope.subtreeActiveDescendants.delete(this);
10710
+ });
10711
+ previousScopes.clear();
10712
+ }
10713
+ this.registeredActiveScopes = undefined;
10714
+ return;
10715
+ }
10716
+ const nextScopes = new Set(collectSharedStateScopeChain(this.boundSharedStateScope));
10717
+ previousScopes === null || previousScopes === void 0 ? void 0 : previousScopes.forEach(scope => {
10722
10718
  if (!nextScopes.has(scope)) {
10723
10719
  scope.subtreeActiveDescendants.delete(this);
10724
10720
  }
@@ -10748,7 +10744,7 @@ class Graphic extends Node {
10748
10744
  this.setStage(stage, layer);
10749
10745
  return;
10750
10746
  }
10751
- this.syncSharedStateScopeBindingFromTree();
10747
+ this.syncSharedStateScopeBindingOnTreeChange();
10752
10748
  }
10753
10749
  refreshSharedStateBeforeRender() {
10754
10750
  var _a;
@@ -10763,7 +10759,7 @@ class Graphic extends Node {
10763
10759
  this.recomputeCurrentStatePatch();
10764
10760
  this.stopStateAnimates();
10765
10761
  this._restoreAttributeFromStaticTruth({ type: AttributeUpdateType.STATE });
10766
- this._emitCustomEvent('afterStateUpdate', { type: AttributeUpdateType.STATE });
10762
+ this.emitStateUpdateEvent();
10767
10763
  this.sharedStateDirty = false;
10768
10764
  }
10769
10765
  getLocalStatesVersion() {
@@ -10861,7 +10857,7 @@ class Graphic extends Node {
10861
10857
  ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
10862
10858
  this.currentStates = transition.states;
10863
10859
  this.effectiveStates = [...effectiveStates];
10864
- this.resolvedStatePatch = Object.assign({}, resolvedStateAttrs);
10860
+ this.resolvedStatePatch = resolvedStateAttrs;
10865
10861
  this.syncSharedStateActiveRegistrations();
10866
10862
  }
10867
10863
  buildStaticAttributeSnapshot() {
@@ -10927,7 +10923,7 @@ class Graphic extends Node {
10927
10923
  return;
10928
10924
  }
10929
10925
  const nextValue = snapshot[key];
10930
- if (isEqual(previousValue, nextValue)) {
10926
+ if (areAttributeValuesEqual(previousValue, nextValue)) {
10931
10927
  return;
10932
10928
  }
10933
10929
  delta.set(key, { prev: previousValue, next: nextValue });
@@ -10936,9 +10932,13 @@ class Graphic extends Node {
10936
10932
  return delta;
10937
10933
  }
10938
10934
  _syncAttribute() {
10935
+ if (this.attribute === this.baseAttributes && this.resolvedStatePatch) {
10936
+ this.detachAttributeFromBaseAttributes();
10937
+ }
10939
10938
  const snapshot = this.buildStaticAttributeSnapshot();
10940
10939
  const delta = this.syncObjectToSnapshot(this.attribute, snapshot);
10941
10940
  this.valid = this.isValid();
10941
+ this.attributeMayContainTransientAttrs = false;
10942
10942
  return delta;
10943
10943
  }
10944
10944
  _syncFinalAttributeFromStaticTruth() {
@@ -10949,7 +10949,20 @@ class Graphic extends Node {
10949
10949
  const snapshot = this.buildStaticAttributeSnapshot();
10950
10950
  this.syncObjectToSnapshot(target, snapshot);
10951
10951
  }
10952
- submitUpdateByDelta(delta, forceUpdateTag = false) {
10952
+ mergeAttributeDeltaCategory(category, key, prev, next) {
10953
+ var _a;
10954
+ let nextCategory = key === 'stroke' || key === 'shadowBlur'
10955
+ ? classifyAttributeDelta(key, prev, next)
10956
+ : (_a = ATTRIBUTE_CATEGORY[key]) !== null && _a !== void 0 ? _a : UpdateCategory.PAINT;
10957
+ if (nextCategory & UpdateCategory.PICK) {
10958
+ nextCategory |= UpdateCategory.BOUNDS;
10959
+ }
10960
+ if (nextCategory === UpdateCategory.PAINT && this.needUpdateTag(key)) {
10961
+ nextCategory = UpdateCategory.SHAPE | UpdateCategory.BOUNDS;
10962
+ }
10963
+ return category | nextCategory;
10964
+ }
10965
+ submitUpdateByCategory(category, forceUpdateTag = false) {
10953
10966
  var _a;
10954
10967
  if (forceUpdateTag) {
10955
10968
  this.addUpdateShapeAndBoundsTag();
@@ -10957,19 +10970,15 @@ class Graphic extends Node {
10957
10970
  this.addUpdateLayoutTag();
10958
10971
  return;
10959
10972
  }
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
10973
  if (category !== UpdateCategory.NONE) {
10972
- (_a = getStageStatePerfMonitor(this.stage)) === null || _a === void 0 ? void 0 : _a.recordCategory(category);
10974
+ const stage = this.stage;
10975
+ if (stage) {
10976
+ (_a = getActiveStageStatePerfMonitor(stage)) === null || _a === void 0 ? void 0 : _a.recordCategory(category);
10977
+ }
10978
+ }
10979
+ if ((category & BROAD_UPDATE_CATEGORY) === BROAD_UPDATE_CATEGORY) {
10980
+ this.addBroadUpdateTag();
10981
+ return;
10973
10982
  }
10974
10983
  if (category & UpdateCategory.SHAPE) {
10975
10984
  this.addUpdateShapeAndBoundsTag();
@@ -10987,36 +10996,147 @@ class Graphic extends Node {
10987
10996
  this.addUpdateLayoutTag();
10988
10997
  }
10989
10998
  }
10999
+ submitUpdateByDelta(delta, forceUpdateTag = false) {
11000
+ let category = UpdateCategory.NONE;
11001
+ delta.forEach((entry, key) => {
11002
+ category = this.mergeAttributeDeltaCategory(category, key, entry.prev, entry.next);
11003
+ });
11004
+ this.submitUpdateByCategory(category, forceUpdateTag);
11005
+ }
11006
+ submitTouchedKeyUpdate(keys, forceUpdateTag = false) {
11007
+ this.submitTouchedUpdate(forceUpdateTag || this.needUpdateTags(keys));
11008
+ }
11009
+ submitTouchedUpdate(needsShapeAndBounds) {
11010
+ if (!this.updateShapeAndBoundsTagSetted() && needsShapeAndBounds) {
11011
+ this.addUpdateShapeAndBoundsTag();
11012
+ }
11013
+ else {
11014
+ this.addUpdateBoundTag();
11015
+ }
11016
+ this.addUpdatePositionTag();
11017
+ this.addUpdateLayoutTag();
11018
+ }
10990
11019
  commitBaseAttributeMutation(forceUpdateTag = false, context) {
10991
- var _a, _b;
11020
+ var _a, _b, _c;
10992
11021
  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();
11022
+ this.resolverEpoch = ((_b = this.resolverEpoch) !== null && _b !== void 0 ? _b : 0) + 1;
11023
+ (_c = this.stateEngine) === null || _c === void 0 ? void 0 : _c.invalidateResolverCache();
10995
11024
  this.recomputeCurrentStatePatch();
10996
11025
  }
10997
11026
  const delta = this._syncAttribute();
10998
11027
  this.submitUpdateByDelta(delta, forceUpdateTag);
10999
11028
  this.onAttributeUpdate(context);
11000
11029
  }
11030
+ canCommitBaseAttributesByTouchedKeys() {
11031
+ var _a, _b;
11032
+ if (((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) || this.resolvedStatePatch || this.attributeMayContainTransientAttrs) {
11033
+ return false;
11034
+ }
11035
+ if (!((_b = this.animates) === null || _b === void 0 ? void 0 : _b.size) && !this._animationStateManager) {
11036
+ return true;
11037
+ }
11038
+ return !this.hasAnyTrackedAnimate();
11039
+ }
11040
+ detachAttributeFromBaseAttributes() {
11041
+ if (this.attribute === this.baseAttributes) {
11042
+ this._baseAttributes = this.attribute;
11043
+ this.attribute = cloneAttributeSurface(this.attribute);
11044
+ }
11045
+ }
11046
+ commitInternalBaseAttributes(params, context) {
11047
+ if (!params || !Object.keys(params).length) {
11048
+ return;
11049
+ }
11050
+ if (this.canCommitBaseAttributesByTouchedKeys()) {
11051
+ this.commitBaseAttributesByTouchedKeys(params, false, context);
11052
+ return;
11053
+ }
11054
+ this.detachAttributeFromBaseAttributes();
11055
+ this.applyBaseAttributes(params);
11056
+ this.commitBaseAttributeMutation(false, context);
11057
+ }
11058
+ commitBaseAttributesByTouchedKeys(params, forceUpdateTag = false, context) {
11059
+ const source = params;
11060
+ const baseAttributes = this.getBaseAttributesStorage();
11061
+ let hasKeys = false;
11062
+ let needsShapeAndBounds = forceUpdateTag;
11063
+ for (const key in source) {
11064
+ if (!Object.prototype.hasOwnProperty.call(source, key)) {
11065
+ continue;
11066
+ }
11067
+ hasKeys = true;
11068
+ baseAttributes[key] = source[key];
11069
+ if (!needsShapeAndBounds && this.needUpdateTag(key)) {
11070
+ needsShapeAndBounds = true;
11071
+ }
11072
+ }
11073
+ if (!hasKeys) {
11074
+ return;
11075
+ }
11076
+ this.attribute = baseAttributes;
11077
+ this._baseAttributes = undefined;
11078
+ this.valid = this.isValid();
11079
+ this.attributeMayContainTransientAttrs = false;
11080
+ this.submitTouchedUpdate(needsShapeAndBounds);
11081
+ this.onAttributeUpdate(context);
11082
+ }
11083
+ commitBaseAttributeBySingleKey(key, value, forceUpdateTag = false, context) {
11084
+ this.getBaseAttributesStorage()[key] = value;
11085
+ this.attribute = this.getBaseAttributesStorage();
11086
+ this._baseAttributes = undefined;
11087
+ this.valid = this.isValid();
11088
+ this.attributeMayContainTransientAttrs = false;
11089
+ this.submitTouchedUpdate(forceUpdateTag || this.needUpdateTag(key));
11090
+ this.onAttributeUpdate(context);
11091
+ }
11001
11092
  applyBaseAttributes(params) {
11002
11093
  const keys = Object.keys(params);
11003
11094
  for (let i = 0; i < keys.length; i++) {
11004
11095
  const key = keys[i];
11005
- this.baseAttributes[key] = cloneAttributeValue(params[key]);
11096
+ this.getBaseAttributesStorage()[key] = params[key];
11006
11097
  }
11007
11098
  }
11099
+ applyAnimationTransientAttributes(params, forceUpdateTag = false, context) {
11100
+ const source = params;
11101
+ let target;
11102
+ let needsShapeAndBounds = forceUpdateTag;
11103
+ for (const key in source) {
11104
+ if (!Object.prototype.hasOwnProperty.call(source, key)) {
11105
+ continue;
11106
+ }
11107
+ if (!target) {
11108
+ this.detachAttributeFromBaseAttributes();
11109
+ target = this.attribute;
11110
+ }
11111
+ target[key] = source[key];
11112
+ if (!needsShapeAndBounds && this.needUpdateTag(key)) {
11113
+ needsShapeAndBounds = true;
11114
+ }
11115
+ }
11116
+ if (!target) {
11117
+ return;
11118
+ }
11119
+ this.attributeMayContainTransientAttrs = true;
11120
+ this.valid = this.isValid();
11121
+ this.submitTouchedUpdate(needsShapeAndBounds);
11122
+ this.onAttributeUpdate(context);
11123
+ }
11008
11124
  applyTransientAttributes(params, forceUpdateTag = false, context) {
11125
+ this.detachAttributeFromBaseAttributes();
11009
11126
  const delta = new Map();
11010
11127
  const keys = Object.keys(params);
11011
11128
  for (let i = 0; i < keys.length; i++) {
11012
11129
  const key = keys[i];
11013
11130
  const previousValue = this.attribute[key];
11014
11131
  const nextValue = params[key];
11015
- if (isEqual(previousValue, nextValue)) {
11132
+ if (areAttributeValuesEqual(previousValue, nextValue)) {
11016
11133
  continue;
11017
11134
  }
11018
11135
  delta.set(key, { prev: previousValue, next: nextValue });
11019
- this.attribute[key] = cloneAttributeValue(nextValue);
11136
+ this.attribute[key] = nextValue;
11137
+ }
11138
+ if (delta.size) {
11139
+ this.attributeMayContainTransientAttrs = true;
11020
11140
  }
11021
11141
  this.valid = this.isValid();
11022
11142
  this.submitUpdateByDelta(delta, forceUpdateTag);
@@ -11028,6 +11148,87 @@ class Graphic extends Node {
11028
11148
  this.submitUpdateByDelta(delta);
11029
11149
  this.onAttributeUpdate(context);
11030
11150
  }
11151
+ collectStatePatchDeltaKeys(previousPatch, nextPatch) {
11152
+ const keys = previousPatch ? Object.keys(previousPatch) : [];
11153
+ if (!nextPatch) {
11154
+ return keys;
11155
+ }
11156
+ for (const key in nextPatch) {
11157
+ if (Object.prototype.hasOwnProperty.call(nextPatch, key) &&
11158
+ !Object.prototype.hasOwnProperty.call(previousPatch !== null && previousPatch !== void 0 ? previousPatch : {}, key)) {
11159
+ keys.push(key);
11160
+ }
11161
+ }
11162
+ return keys;
11163
+ }
11164
+ getStaticTruthValueForStateKey(key, nextPatch) {
11165
+ var _a;
11166
+ const baseAttributes = ((_a = this.baseAttributes) !== null && _a !== void 0 ? _a : {});
11167
+ const patch = nextPatch;
11168
+ if (patch && Object.prototype.hasOwnProperty.call(patch, key)) {
11169
+ const patchValue = patch[key];
11170
+ const baseValue = baseAttributes[key];
11171
+ if (this.stateMergeMode === 'deep' && isPlainObjectValue(baseValue) && isPlainObjectValue(patchValue)) {
11172
+ return {
11173
+ hasValue: true,
11174
+ value: deepMergeAttributeValue(baseValue, patchValue)
11175
+ };
11176
+ }
11177
+ return {
11178
+ hasValue: true,
11179
+ value: patchValue
11180
+ };
11181
+ }
11182
+ if (Object.prototype.hasOwnProperty.call(baseAttributes, key)) {
11183
+ return {
11184
+ hasValue: true,
11185
+ value: baseAttributes[key]
11186
+ };
11187
+ }
11188
+ return {
11189
+ hasValue: false,
11190
+ value: undefined
11191
+ };
11192
+ }
11193
+ syncStatePatchDeltaToTarget(target, keys, nextPatch, collectCategory = false) {
11194
+ let category = UpdateCategory.NONE;
11195
+ for (let i = 0; i < keys.length; i++) {
11196
+ const key = keys[i];
11197
+ const previousValue = target[key];
11198
+ const next = this.getStaticTruthValueForStateKey(key, nextPatch);
11199
+ if (!next.hasValue) {
11200
+ if (Object.prototype.hasOwnProperty.call(target, key)) {
11201
+ delete target[key];
11202
+ if (collectCategory) {
11203
+ category = this.mergeAttributeDeltaCategory(category, key, previousValue, undefined);
11204
+ }
11205
+ }
11206
+ continue;
11207
+ }
11208
+ if (areAttributeValuesEqual(previousValue, next.value)) {
11209
+ continue;
11210
+ }
11211
+ const nextValue = cloneAttributeValue(next.value);
11212
+ target[key] = nextValue;
11213
+ if (collectCategory) {
11214
+ category = this.mergeAttributeDeltaCategory(category, key, previousValue, nextValue);
11215
+ }
11216
+ }
11217
+ return category;
11218
+ }
11219
+ restoreAttributeFromStatePatchDelta(previousPatch, nextPatch, context) {
11220
+ this.detachAttributeFromBaseAttributes();
11221
+ const keys = this.collectStatePatchDeltaKeys(previousPatch, nextPatch);
11222
+ const finalAttribute = this.finalAttribute;
11223
+ if (finalAttribute) {
11224
+ this.syncStatePatchDeltaToTarget(finalAttribute, keys, nextPatch, false);
11225
+ }
11226
+ const category = this.syncStatePatchDeltaToTarget(this.attribute, keys, nextPatch, true);
11227
+ this.valid = this.isValid();
11228
+ this.attributeMayContainTransientAttrs = false;
11229
+ this.submitUpdateByCategory(category);
11230
+ this.onAttributeUpdate(context);
11231
+ }
11031
11232
  setMode(mode) {
11032
11233
  mode === '3d' ? this.set3dMode() : this.set2dMode();
11033
11234
  }
@@ -11052,6 +11253,7 @@ class Graphic extends Node {
11052
11253
  return point;
11053
11254
  }
11054
11255
  onAnimateBind(animate) {
11256
+ this.detachAttributeFromBaseAttributes();
11055
11257
  this._emitCustomEvent('animate-bind', animate);
11056
11258
  }
11057
11259
  visitTrackedAnimates(cb) {
@@ -11074,8 +11276,33 @@ class Graphic extends Node {
11074
11276
  }
11075
11277
  return !!((_a = this.animates) === null || _a === void 0 ? void 0 : _a.size);
11076
11278
  }
11279
+ mayHaveTrackedAnimates() {
11280
+ var _a;
11281
+ return !!((_a = this.animates) === null || _a === void 0 ? void 0 : _a.size) || !!this._animationStateManager;
11282
+ }
11077
11283
  tryUpdateAABBBounds() {
11284
+ if (!this.shadowRoot && !(this._updateTag & UpdateTag.UPDATE_BOUNDS)) {
11285
+ return this._AABBBounds;
11286
+ }
11078
11287
  const full = this.attribute.boundsMode === 'imprecise';
11288
+ if (!this.shadowRoot) {
11289
+ const graphicService = this.getGraphicService();
11290
+ const graphicTheme = this.getGraphicTheme();
11291
+ if (!graphicService.validCheck(this.attribute, graphicTheme, this._AABBBounds, this)) {
11292
+ return this._AABBBounds;
11293
+ }
11294
+ if (!this.valid) {
11295
+ this._AABBBounds.clear();
11296
+ return this._AABBBounds;
11297
+ }
11298
+ graphicService.beforeUpdateAABBBounds(this, this.stage, true, this._AABBBounds);
11299
+ const bounds = this.doUpdateAABBBounds(full, graphicTheme);
11300
+ graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, true);
11301
+ if (this.attribute.boundsMode === 'empty') {
11302
+ bounds.clear();
11303
+ }
11304
+ return bounds;
11305
+ }
11079
11306
  if (!this.shouldUpdateAABBBounds()) {
11080
11307
  return this._AABBBounds;
11081
11308
  }
@@ -11192,13 +11419,13 @@ class Graphic extends Node {
11192
11419
  Graphic.userSymbolMap[symbolType] = _parsedPath;
11193
11420
  return _parsedPath;
11194
11421
  }
11195
- doUpdateAABBBounds(full) {
11422
+ doUpdateAABBBounds(full, graphicTheme) {
11196
11423
  this.updateAABBBoundsStamp++;
11197
- const graphicTheme = this.getGraphicTheme();
11424
+ const resolvedGraphicTheme = graphicTheme !== null && graphicTheme !== void 0 ? graphicTheme : this.getGraphicTheme();
11198
11425
  this._AABBBounds.clear();
11199
11426
  const attribute = this.attribute;
11200
- const bounds = this.updateAABBBounds(attribute, graphicTheme, this._AABBBounds, full);
11201
- const { boundsPadding = graphicTheme.boundsPadding } = attribute;
11427
+ const bounds = this.updateAABBBounds(attribute, resolvedGraphicTheme, this._AABBBounds, full);
11428
+ const { boundsPadding = resolvedGraphicTheme.boundsPadding } = attribute;
11202
11429
  const paddingArray = parsePadding(boundsPadding);
11203
11430
  if (paddingArray) {
11204
11431
  bounds.expand(paddingArray);
@@ -11413,7 +11640,7 @@ class Graphic extends Node {
11413
11640
  if (params.background) {
11414
11641
  this.loadImage(params.background, true);
11415
11642
  }
11416
- if (isExternalTexture(params.texture)) {
11643
+ if (params.texture && isExternalTexture(params.texture)) {
11417
11644
  this.loadImage(params.texture, false);
11418
11645
  }
11419
11646
  if (params.shadowGraphic) {
@@ -11422,14 +11649,25 @@ class Graphic extends Node {
11422
11649
  this._setAttributes(params, forceUpdateTag, context);
11423
11650
  }
11424
11651
  _setAttributes(params, forceUpdateTag = false, context) {
11652
+ if (this.canCommitBaseAttributesByTouchedKeys()) {
11653
+ this.commitBaseAttributesByTouchedKeys(params, forceUpdateTag, context);
11654
+ return;
11655
+ }
11656
+ this.detachAttributeFromBaseAttributes();
11425
11657
  this.applyBaseAttributes(params);
11426
11658
  this.commitBaseAttributeMutation(forceUpdateTag, context);
11427
11659
  }
11428
11660
  setAttribute(key, value, forceUpdateTag, context) {
11429
11661
  const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({ [key]: value }, this.attribute, key, context);
11430
11662
  if (!params) {
11431
- this.applyBaseAttributes({ [key]: value });
11432
- this.commitBaseAttributeMutation(!!forceUpdateTag, context);
11663
+ if (this.canCommitBaseAttributesByTouchedKeys()) {
11664
+ this.commitBaseAttributeBySingleKey(key, value, !!forceUpdateTag, context);
11665
+ }
11666
+ else {
11667
+ const nextAttrs = { [key]: value };
11668
+ this.applyBaseAttributes(nextAttrs);
11669
+ this.commitBaseAttributeMutation(!!forceUpdateTag, context);
11670
+ }
11433
11671
  }
11434
11672
  else {
11435
11673
  this._setAttributes(params, forceUpdateTag, context);
@@ -11466,16 +11704,15 @@ class Graphic extends Node {
11466
11704
  const context = { type: AttributeUpdateType.INIT };
11467
11705
  params =
11468
11706
  (this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context)) || params;
11469
- this.baseAttributes = cloneAttributeValue(params);
11470
- if (!this.attribute) {
11471
- this.attribute = {};
11472
- }
11707
+ this.attribute = params;
11708
+ this._baseAttributes = undefined;
11473
11709
  this.resolvedStatePatch = undefined;
11474
- this._syncAttribute();
11710
+ this.attributeMayContainTransientAttrs = false;
11711
+ this.valid = this.isValid();
11475
11712
  if (params.background) {
11476
11713
  this.loadImage(params.background, true);
11477
11714
  }
11478
- if (isExternalTexture(params.texture)) {
11715
+ if (params.texture && isExternalTexture(params.texture)) {
11479
11716
  this.loadImage(params.texture, false);
11480
11717
  }
11481
11718
  if (params.shadowGraphic) {
@@ -11500,18 +11737,20 @@ class Graphic extends Node {
11500
11737
  y = params.y;
11501
11738
  delete params.x;
11502
11739
  delete params.y;
11503
- this.applyBaseAttributes(params);
11504
11740
  }
11505
11741
  const attribute = this.baseAttributes;
11506
11742
  const postMatrix = attribute.postMatrix;
11743
+ const nextAttrs = (params || {});
11507
11744
  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;
11745
+ nextAttrs.x = ((_a = attribute.x) !== null && _a !== void 0 ? _a : DefaultTransform.x) + x;
11746
+ nextAttrs.y = ((_b = attribute.y) !== null && _b !== void 0 ? _b : DefaultTransform.y) + y;
11510
11747
  }
11511
11748
  else {
11512
- application.transformUtil.fromMatrix(postMatrix, postMatrix).translate(x, y);
11749
+ const nextPostMatrix = postMatrix.clone();
11750
+ application.transformUtil.fromMatrix(nextPostMatrix, nextPostMatrix).translate(x, y);
11751
+ nextAttrs.postMatrix = nextPostMatrix;
11513
11752
  }
11514
- this.commitBaseAttributeMutation(false, context);
11753
+ this.commitInternalBaseAttributes(nextAttrs, context);
11515
11754
  return this;
11516
11755
  }
11517
11756
  translateTo(x, y) {
@@ -11525,13 +11764,10 @@ class Graphic extends Node {
11525
11764
  const params = this.onBeforeAttributeUpdate &&
11526
11765
  this.onBeforeAttributeUpdate({ x, y }, this.attribute, tempConstantXYKey, context);
11527
11766
  if (params) {
11528
- this.applyBaseAttributes(params);
11529
- this.commitBaseAttributeMutation(false, context);
11767
+ this.commitInternalBaseAttributes(params, context);
11530
11768
  return this;
11531
11769
  }
11532
- attribute.x = x;
11533
- attribute.y = y;
11534
- this.commitBaseAttributeMutation(false, context);
11770
+ this.commitInternalBaseAttributes({ x, y }, context);
11535
11771
  return this;
11536
11772
  }
11537
11773
  scale(scaleX, scaleY, scaleCenter) {
@@ -11549,22 +11785,25 @@ class Graphic extends Node {
11549
11785
  scaleY = params.scaleY;
11550
11786
  delete params.scaleX;
11551
11787
  delete params.scaleY;
11552
- this.applyBaseAttributes(params);
11553
11788
  }
11554
11789
  const attribute = this.baseAttributes;
11790
+ const nextAttrs = (params || {});
11555
11791
  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;
11792
+ nextAttrs.scaleX = ((_a = attribute.scaleX) !== null && _a !== void 0 ? _a : DefaultTransform.scaleX) * scaleX;
11793
+ nextAttrs.scaleY = ((_b = attribute.scaleY) !== null && _b !== void 0 ? _b : DefaultTransform.scaleY) * scaleY;
11558
11794
  }
11559
11795
  else {
11560
- let { postMatrix } = this.attribute;
11796
+ let { postMatrix } = this.baseAttributes;
11561
11797
  if (!postMatrix) {
11562
11798
  postMatrix = new Matrix();
11563
- attribute.postMatrix = postMatrix;
11799
+ }
11800
+ else {
11801
+ postMatrix = postMatrix.clone();
11564
11802
  }
11565
11803
  application.transformUtil.fromMatrix(postMatrix, postMatrix).scale(scaleX, scaleY, scaleCenter);
11804
+ nextAttrs.postMatrix = postMatrix;
11566
11805
  }
11567
- this.commitBaseAttributeMutation(false, context);
11806
+ this.commitInternalBaseAttributes(nextAttrs, context);
11568
11807
  return this;
11569
11808
  }
11570
11809
  scaleTo(scaleX, scaleY) {
@@ -11578,13 +11817,10 @@ class Graphic extends Node {
11578
11817
  const params = this.onBeforeAttributeUpdate &&
11579
11818
  this.onBeforeAttributeUpdate({ scaleX, scaleY }, this.attribute, tempConstantScaleXYKey, context);
11580
11819
  if (params) {
11581
- this.applyBaseAttributes(params);
11582
- this.commitBaseAttributeMutation(false, context);
11820
+ this.commitInternalBaseAttributes(params, context);
11583
11821
  return this;
11584
11822
  }
11585
- attribute.scaleX = scaleX;
11586
- attribute.scaleY = scaleY;
11587
- this.commitBaseAttributeMutation(false, context);
11823
+ this.commitInternalBaseAttributes({ scaleX, scaleY }, context);
11588
11824
  return this;
11589
11825
  }
11590
11826
  rotate(angle, rotateCenter) {
@@ -11597,21 +11833,24 @@ class Graphic extends Node {
11597
11833
  this.onBeforeAttributeUpdate({ angle, rotateCenter }, this.attribute, tempConstantAngleKey, context);
11598
11834
  if (params) {
11599
11835
  delete params.angle;
11600
- this.applyBaseAttributes(params);
11601
11836
  }
11602
11837
  const attribute = this.baseAttributes;
11838
+ const nextAttrs = (params || {});
11603
11839
  if (!rotateCenter) {
11604
- attribute.angle = ((_a = attribute.angle) !== null && _a !== void 0 ? _a : DefaultTransform.angle) + angle;
11840
+ nextAttrs.angle = ((_a = attribute.angle) !== null && _a !== void 0 ? _a : DefaultTransform.angle) + angle;
11605
11841
  }
11606
11842
  else {
11607
11843
  let { postMatrix } = this.baseAttributes;
11608
11844
  if (!postMatrix) {
11609
11845
  postMatrix = new Matrix();
11610
- this.baseAttributes.postMatrix = postMatrix;
11846
+ }
11847
+ else {
11848
+ postMatrix = postMatrix.clone();
11611
11849
  }
11612
11850
  application.transformUtil.fromMatrix(postMatrix, postMatrix).rotate(angle, rotateCenter);
11851
+ nextAttrs.postMatrix = postMatrix;
11613
11852
  }
11614
- this.commitBaseAttributeMutation(false, context);
11853
+ this.commitInternalBaseAttributes(nextAttrs, context);
11615
11854
  return this;
11616
11855
  }
11617
11856
  rotateTo(angle) {
@@ -11625,12 +11864,10 @@ class Graphic extends Node {
11625
11864
  const params = this.onBeforeAttributeUpdate &&
11626
11865
  this.onBeforeAttributeUpdate(angle, this.attribute, tempConstantAngleKey, context);
11627
11866
  if (params) {
11628
- this.applyBaseAttributes(params);
11629
- this.commitBaseAttributeMutation(false, context);
11867
+ this.commitInternalBaseAttributes(params, context);
11630
11868
  return this;
11631
11869
  }
11632
- attribute.angle = angle;
11633
- this.commitBaseAttributeMutation(false, context);
11870
+ this.commitInternalBaseAttributes({ angle }, context);
11634
11871
  return this;
11635
11872
  }
11636
11873
  skewTo(b, c) {
@@ -11702,6 +11939,198 @@ class Graphic extends Node {
11702
11939
  stateEngine: this.stateEngine
11703
11940
  });
11704
11941
  }
11942
+ resolveSimpleLocalStateTransition(states, previousStates) {
11943
+ var _a;
11944
+ if (!this.states ||
11945
+ this.stateProxy ||
11946
+ this.stateSort ||
11947
+ this.stateMergeMode === 'deep' ||
11948
+ this.parent ||
11949
+ ((_a = this.stage) === null || _a === void 0 ? void 0 : _a.rootSharedStateScope) ||
11950
+ this.boundSharedStateScope) {
11951
+ return null;
11952
+ }
11953
+ if (states.length === 1) {
11954
+ const stateName = states[0];
11955
+ const hasDefinition = Object.prototype.hasOwnProperty.call(this.states, stateName);
11956
+ const nextStates = [stateName];
11957
+ const changed = !this.sameStateNames(previousStates, nextStates);
11958
+ const resolvedStateAttrs = {};
11959
+ if (hasDefinition) {
11960
+ const attrs = this.states[stateName];
11961
+ if (attrs != null) {
11962
+ if (!isPlainObjectValue(attrs)) {
11963
+ return null;
11964
+ }
11965
+ const keys = Object.keys(attrs);
11966
+ for (let keyIndex = 0; keyIndex < keys.length; keyIndex++) {
11967
+ const key = keys[keyIndex];
11968
+ if (FULL_STATE_DEFINITION_KEYS.has(key)) {
11969
+ return null;
11970
+ }
11971
+ const attrValue = attrs[key];
11972
+ resolvedStateAttrs[key] = isPlainObjectValue(attrValue)
11973
+ ? cloneAttributeValue(attrValue)
11974
+ : attrValue;
11975
+ }
11976
+ }
11977
+ }
11978
+ return {
11979
+ changed,
11980
+ states: nextStates,
11981
+ effectiveStates: nextStates,
11982
+ resolvedStateAttrs
11983
+ };
11984
+ }
11985
+ const uniqueStates = Array.from(new Set(states));
11986
+ const withDefinition = [];
11987
+ const withoutDefinition = [];
11988
+ for (let i = 0; i < uniqueStates.length; i++) {
11989
+ const stateName = uniqueStates[i];
11990
+ if (Object.prototype.hasOwnProperty.call(this.states, stateName)) {
11991
+ withDefinition.push(stateName);
11992
+ }
11993
+ else {
11994
+ withoutDefinition.push(stateName);
11995
+ }
11996
+ }
11997
+ withDefinition.sort((left, right) => left.localeCompare(right));
11998
+ const nextStates = withDefinition.concat(withoutDefinition);
11999
+ const changed = !this.sameStateNames(previousStates, nextStates);
12000
+ const resolvedStateAttrs = {};
12001
+ for (let i = 0; i < nextStates.length; i++) {
12002
+ const stateName = nextStates[i];
12003
+ const hasDefinition = Object.prototype.hasOwnProperty.call(this.states, stateName);
12004
+ if (!hasDefinition) {
12005
+ continue;
12006
+ }
12007
+ const attrs = this.states[stateName];
12008
+ if (attrs == null) {
12009
+ continue;
12010
+ }
12011
+ if (!isPlainObjectValue(attrs)) {
12012
+ return null;
12013
+ }
12014
+ const keys = Object.keys(attrs);
12015
+ for (let keyIndex = 0; keyIndex < keys.length; keyIndex++) {
12016
+ const key = keys[keyIndex];
12017
+ if (FULL_STATE_DEFINITION_KEYS.has(key)) {
12018
+ return null;
12019
+ }
12020
+ const attrValue = attrs[key];
12021
+ resolvedStateAttrs[key] = isPlainObjectValue(attrValue)
12022
+ ? cloneAttributeValue(attrValue)
12023
+ : attrValue;
12024
+ }
12025
+ }
12026
+ return {
12027
+ changed,
12028
+ states: nextStates,
12029
+ effectiveStates: nextStates,
12030
+ resolvedStateAttrs
12031
+ };
12032
+ }
12033
+ resolveGraphicStateTransition(states, previousStates, forceResolverRefresh = false) {
12034
+ var _a, _b, _c, _d;
12035
+ let transition = this.resolveSimpleLocalStateTransition(states, previousStates);
12036
+ const isSimpleLocalTransition = !!transition;
12037
+ let resolvedStateAttrs;
12038
+ if (transition) {
12039
+ resolvedStateAttrs = transition.resolvedStateAttrs;
12040
+ }
12041
+ else {
12042
+ const stateResolveBaseAttrs = ((_a = this.baseAttributes) !== null && _a !== void 0 ? _a : this.attribute);
12043
+ const stateModel = this.createStateModel();
12044
+ (_b = this.stateEngine) === null || _b === void 0 ? void 0 : _b.setResolveContext(this, stateResolveBaseAttrs);
12045
+ if (forceResolverRefresh) {
12046
+ (_c = this.stateEngine) === null || _c === void 0 ? void 0 : _c.invalidateResolverCache();
12047
+ }
12048
+ transition = stateModel.useStates(states);
12049
+ resolvedStateAttrs =
12050
+ this.stateEngine && this.compiledStateDefinitions
12051
+ ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
12052
+ }
12053
+ const effectiveStates = (_d = transition.effectiveStates) !== null && _d !== void 0 ? _d : transition.states;
12054
+ return {
12055
+ transition,
12056
+ effectiveStates: effectiveStates,
12057
+ resolvedStateAttrs,
12058
+ isSimpleLocalTransition
12059
+ };
12060
+ }
12061
+ normalizeSetStatesOptions(options) {
12062
+ if (options && typeof options === 'object') {
12063
+ return {
12064
+ hasAnimation: options.animate,
12065
+ animateSameStatePatchChange: options.animateSameStatePatchChange === true,
12066
+ shouldRefreshSameStatePatch: true
12067
+ };
12068
+ }
12069
+ return {
12070
+ hasAnimation: typeof options === 'boolean' ? options : undefined,
12071
+ animateSameStatePatchChange: false,
12072
+ shouldRefreshSameStatePatch: false
12073
+ };
12074
+ }
12075
+ sameStatePatches(left, right) {
12076
+ const leftRecord = (left !== null && left !== void 0 ? left : {});
12077
+ const rightRecord = (right !== null && right !== void 0 ? right : {});
12078
+ const keys = new Set([...Object.keys(leftRecord), ...Object.keys(rightRecord)]);
12079
+ for (const key of keys) {
12080
+ const hasLeft = Object.prototype.hasOwnProperty.call(leftRecord, key);
12081
+ const hasRight = Object.prototype.hasOwnProperty.call(rightRecord, key);
12082
+ if (hasLeft !== hasRight) {
12083
+ return false;
12084
+ }
12085
+ if (!areAttributeValuesEqual(leftRecord[key], rightRecord[key])) {
12086
+ return false;
12087
+ }
12088
+ }
12089
+ return true;
12090
+ }
12091
+ commitSameStatePatchRefresh(states, hasAnimation, animateSameStatePatchChange = false) {
12092
+ var _a;
12093
+ const previousStates = (_a = this.currentStates) !== null && _a !== void 0 ? _a : EMPTY_STATE_NAMES;
12094
+ const previousResolvedStatePatch = this.resolvedStatePatch;
12095
+ const { transition, effectiveStates, resolvedStateAttrs, isSimpleLocalTransition } = this.resolveGraphicStateTransition(states, previousStates, true);
12096
+ const patchChanged = !this.sameStatePatches(previousResolvedStatePatch, resolvedStateAttrs);
12097
+ if (patchChanged &&
12098
+ !this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, false)) {
12099
+ return;
12100
+ }
12101
+ this.currentStates = transition.states;
12102
+ this.effectiveStates = isSimpleLocalTransition ? effectiveStates : [...effectiveStates];
12103
+ this.resolvedStatePatch = resolvedStateAttrs;
12104
+ this.sharedStateDirty = false;
12105
+ this.syncSharedStateActiveRegistrations();
12106
+ if (!patchChanged) {
12107
+ return;
12108
+ }
12109
+ if (this.stage) {
12110
+ const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
12111
+ perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.incrementCounter('stateCommits');
12112
+ perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordEvent('state-commit', {
12113
+ graphicId: this._uid,
12114
+ targetStates: [...transition.states]
12115
+ });
12116
+ }
12117
+ if (hasAnimation && animateSameStatePatchChange) {
12118
+ this._syncFinalAttributeFromStaticTruth();
12119
+ this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, false, undefined, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch));
12120
+ }
12121
+ else {
12122
+ this.stopStateAnimates();
12123
+ if (this.attributeMayContainTransientAttrs) {
12124
+ this._restoreAttributeFromStaticTruth({ type: AttributeUpdateType.STATE });
12125
+ }
12126
+ else {
12127
+ this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
12128
+ type: AttributeUpdateType.STATE
12129
+ });
12130
+ }
12131
+ this.emitStateUpdateEvent();
12132
+ }
12133
+ }
11705
12134
  resolveStateAnimateConfig(animateConfig) {
11706
12135
  var _a, _b, _c;
11707
12136
  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 +12156,7 @@ class Graphic extends Node {
11727
12156
  });
11728
12157
  this.getStateTransitionOrchestrator().applyTransition(this, plan, hasAnimation, transitionOptions);
11729
12158
  }
11730
- updateNormalAttrs(stateAttrs) {
11731
- this._deprecatedNormalAttrsView = cloneAttributeValue(this.baseAttributes);
12159
+ updateNormalAttrs(_stateAttrs) {
11732
12160
  }
11733
12161
  getStateTransitionDefaultAttribute(key, targetAttrs) {
11734
12162
  return this.getDefaultAttribute(key);
@@ -11742,6 +12170,9 @@ class Graphic extends Node {
11742
12170
  stopAnimationState.call(this, 'state', type);
11743
12171
  return;
11744
12172
  }
12173
+ if (!this.mayHaveTrackedAnimates()) {
12174
+ return;
12175
+ }
11745
12176
  const stateAnimates = [];
11746
12177
  this.visitTrackedAnimates(animate => {
11747
12178
  if (animate.stateNames) {
@@ -11760,10 +12191,8 @@ class Graphic extends Node {
11760
12191
  }
11761
12192
  clearStates(hasAnimation) {
11762
12193
  var _a, _b, _c;
11763
- const previousStates = this.currentStates ? this.currentStates.slice() : [];
11764
- const previousResolvedStatePatch = this.resolvedStatePatch
11765
- ? cloneAttributeValue(this.resolvedStatePatch)
11766
- : undefined;
12194
+ const previousStates = (_a = this.currentStates) !== null && _a !== void 0 ? _a : EMPTY_STATE_NAMES;
12195
+ const previousResolvedStatePatch = this.resolvedStatePatch;
11767
12196
  const transition = this.createStateModel().clearStates();
11768
12197
  if (!transition.changed && previousStates.length === 0) {
11769
12198
  this.currentStates = [];
@@ -11773,7 +12202,9 @@ class Graphic extends Node {
11773
12202
  this.clearSharedStateActiveRegistrations();
11774
12203
  return;
11775
12204
  }
11776
- const resolvedStateAttrs = cloneAttributeValue(((_a = this.baseAttributes) !== null && _a !== void 0 ? _a : {}));
12205
+ const resolvedStateAttrs = hasAnimation || this.hasCustomEvent('beforeStateUpdate')
12206
+ ? cloneAttributeValue(((_b = this.baseAttributes) !== null && _b !== void 0 ? _b : {}))
12207
+ : ((_c = this.baseAttributes) !== null && _c !== void 0 ? _c : {});
11777
12208
  if (transition.changed &&
11778
12209
  !this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, true)) {
11779
12210
  return;
@@ -11783,19 +12214,29 @@ class Graphic extends Node {
11783
12214
  this.resolvedStatePatch = undefined;
11784
12215
  this.sharedStateDirty = false;
11785
12216
  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
- });
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: []
12223
+ });
12224
+ }
11791
12225
  if (hasAnimation) {
11792
12226
  this._syncFinalAttributeFromStaticTruth();
11793
12227
  this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, true, undefined, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch));
11794
12228
  }
11795
12229
  else {
11796
12230
  this.stopStateAnimates();
11797
- this._restoreAttributeFromStaticTruth({ type: AttributeUpdateType.STATE });
11798
- this._emitCustomEvent('afterStateUpdate', { type: AttributeUpdateType.STATE });
12231
+ if (this.attributeMayContainTransientAttrs) {
12232
+ this._restoreAttributeFromStaticTruth({ type: AttributeUpdateType.STATE });
12233
+ }
12234
+ else {
12235
+ this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, undefined, {
12236
+ type: AttributeUpdateType.STATE
12237
+ });
12238
+ }
12239
+ this.emitStateUpdateEvent();
11799
12240
  }
11800
12241
  }
11801
12242
  removeState(stateName, hasAnimation) {
@@ -11817,67 +12258,96 @@ class Graphic extends Node {
11817
12258
  }
11818
12259
  this.useStates(transition.states, hasAnimation);
11819
12260
  }
12261
+ setStates(states, options) {
12262
+ var _a, _b, _c;
12263
+ const { hasAnimation, animateSameStatePatchChange, shouldRefreshSameStatePatch } = this.normalizeSetStatesOptions(options);
12264
+ const nextStates = (states === null || states === void 0 ? void 0 : states.length) ? states : EMPTY_STATE_NAMES;
12265
+ const hasCurrentState = !!((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) ||
12266
+ !!((_b = this.effectiveStates) === null || _b === void 0 ? void 0 : _b.length) ||
12267
+ !!this.resolvedStatePatch ||
12268
+ !!((_c = this.registeredActiveScopes) === null || _c === void 0 ? void 0 : _c.size);
12269
+ if (!nextStates.length) {
12270
+ if (!hasCurrentState && !this.sharedStateDirty) {
12271
+ return;
12272
+ }
12273
+ this.clearStates(hasAnimation);
12274
+ return;
12275
+ }
12276
+ if (this.sameStateNames(this.currentStates, nextStates)) {
12277
+ if (shouldRefreshSameStatePatch) {
12278
+ this.commitSameStatePatchRefresh(nextStates, hasAnimation, animateSameStatePatchChange);
12279
+ return;
12280
+ }
12281
+ if (this.sharedStateDirty) {
12282
+ this.refreshSharedStateBeforeRender();
12283
+ }
12284
+ return;
12285
+ }
12286
+ this.useStates(nextStates, hasAnimation);
12287
+ }
11820
12288
  useStates(states, hasAnimation) {
11821
- var _a, _b, _c, _d, _e;
12289
+ var _a;
11822
12290
  if (!states.length) {
11823
12291
  this.clearStates(hasAnimation);
11824
12292
  return;
11825
12293
  }
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);
12294
+ const previousStates = (_a = this.currentStates) !== null && _a !== void 0 ? _a : EMPTY_STATE_NAMES;
12295
+ const previousResolvedStatePatch = this.resolvedStatePatch;
12296
+ const { transition, effectiveStates, resolvedStateAttrs, isSimpleLocalTransition } = this.resolveGraphicStateTransition(states, previousStates);
11834
12297
  if (!transition.changed && this.sameStateNames(previousStates, transition.states)) {
11835
12298
  return;
11836
12299
  }
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);
11840
12300
  if (!this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, false)) {
11841
12301
  return;
11842
12302
  }
11843
12303
  this.currentStates = transition.states;
11844
- this.effectiveStates = [...effectiveStates];
11845
- this.resolvedStatePatch = Object.assign({}, resolvedStateAttrs);
12304
+ this.effectiveStates = isSimpleLocalTransition ? effectiveStates : [...effectiveStates];
12305
+ this.resolvedStatePatch = resolvedStateAttrs;
11846
12306
  this.sharedStateDirty = false;
11847
12307
  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
- });
12308
+ if (this.stage) {
12309
+ const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
12310
+ perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.incrementCounter('stateCommits');
12311
+ perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordEvent('state-commit', {
12312
+ graphicId: this._uid,
12313
+ targetStates: [...transition.states]
12314
+ });
12315
+ }
11853
12316
  if (hasAnimation) {
11854
12317
  this._syncFinalAttributeFromStaticTruth();
11855
12318
  this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, false, undefined, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch));
11856
12319
  }
11857
12320
  else {
11858
12321
  this.stopStateAnimates();
11859
- this._restoreAttributeFromStaticTruth({ type: AttributeUpdateType.STATE });
11860
- this._emitCustomEvent('afterStateUpdate', { type: AttributeUpdateType.STATE });
12322
+ if (this.attributeMayContainTransientAttrs) {
12323
+ this._restoreAttributeFromStaticTruth({ type: AttributeUpdateType.STATE });
12324
+ }
12325
+ else {
12326
+ this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
12327
+ type: AttributeUpdateType.STATE
12328
+ });
12329
+ }
12330
+ this.emitStateUpdateEvent();
11861
12331
  }
11862
12332
  }
11863
12333
  invalidateResolver() {
11864
- var _a, _b;
12334
+ var _a, _b, _c;
11865
12335
  if (!this.stateEngine || !((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) || !this.compiledStateDefinitions) {
11866
12336
  return;
11867
12337
  }
11868
12338
  const stateResolveBaseAttrs = ((_b = this.baseAttributes) !== null && _b !== void 0 ? _b : this.attribute);
11869
12339
  this.stateEngine.setResolveContext(this, stateResolveBaseAttrs);
11870
- this.resolverEpoch += 1;
12340
+ this.resolverEpoch = ((_c = this.resolverEpoch) !== null && _c !== void 0 ? _c : 0) + 1;
11871
12341
  this.stateEngine.invalidateResolverCache();
11872
12342
  const transition = this.stateEngine.applyStates(this.currentStates);
11873
12343
  const resolvedStateAttrs = Object.assign({}, this.stateEngine.resolvedPatch);
11874
12344
  this.effectiveStates = [...transition.effectiveStates];
11875
- this.resolvedStatePatch = Object.assign({}, resolvedStateAttrs);
12345
+ this.resolvedStatePatch = resolvedStateAttrs;
11876
12346
  this.sharedStateDirty = false;
11877
12347
  this.syncSharedStateActiveRegistrations();
11878
12348
  this.stopStateAnimates();
11879
12349
  this._restoreAttributeFromStaticTruth({ type: AttributeUpdateType.STATE });
11880
- this._emitCustomEvent('afterStateUpdate', { type: AttributeUpdateType.STATE });
12350
+ this.emitStateUpdateEvent();
11881
12351
  }
11882
12352
  sameStateNames(left, right) {
11883
12353
  const normalizedLeft = left !== null && left !== void 0 ? left : [];
@@ -11916,6 +12386,20 @@ class Graphic extends Node {
11916
12386
  this.glyphHost.addUpdateBoundTag();
11917
12387
  }
11918
12388
  }
12389
+ addBroadUpdateTag() {
12390
+ this.shadowRoot && this.shadowRoot.addUpdateGlobalPositionTag();
12391
+ this._updateTag |=
12392
+ UpdateTag.UPDATE_SHAPE_AND_BOUNDS |
12393
+ UpdateTag.UPDATE_PAINT |
12394
+ UpdateTag.UPDATE_GLOBAL_LOCAL_MATRIX |
12395
+ UpdateTag.UPDATE_LAYOUT;
12396
+ if (this.parent) {
12397
+ this.parent.addChildUpdateBoundTag();
12398
+ }
12399
+ if (this.glyphHost) {
12400
+ this.glyphHost.addUpdateBoundTag();
12401
+ }
12402
+ }
11919
12403
  updateShapeAndBoundsTagSetted() {
11920
12404
  return (this._updateTag & UpdateTag.UPDATE_SHAPE_AND_BOUNDS) === UpdateTag.UPDATE_SHAPE_AND_BOUNDS;
11921
12405
  }
@@ -12020,17 +12504,22 @@ class Graphic extends Node {
12020
12504
  }
12021
12505
  }
12022
12506
  setStage(stage, layer) {
12023
- var _a, _b, _c, _d, _e, _f, _g, _h;
12507
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
12024
12508
  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
12509
  const previousStage = this.stage;
12026
12510
  if (this.stage !== stage || this.layer !== layer) {
12027
12511
  this.stage = stage;
12028
12512
  this.layer = layer;
12029
- this.syncSharedStateScopeBindingFromTree(!!((_d = this.currentStates) === null || _d === void 0 ? void 0 : _d.length));
12513
+ if (((_d = this.currentStates) === null || _d === void 0 ? void 0 : _d.length) ||
12514
+ this.boundSharedStateScope ||
12515
+ ((_e = this.registeredActiveScopes) === null || _e === void 0 ? void 0 : _e.size) ||
12516
+ this.sharedStateDirty) {
12517
+ this.syncSharedStateScopeBindingOnTreeChange(true);
12518
+ }
12030
12519
  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);
12520
+ if (this.mayHaveTrackedAnimates() && this.hasAnyTrackedAnimate()) {
12521
+ const previousTimeline = (_f = previousStage === null || previousStage === void 0 ? void 0 : previousStage.getTimeline) === null || _f === void 0 ? void 0 : _f.call(previousStage);
12522
+ const nextTimeline = (_g = stage === null || stage === void 0 ? void 0 : stage.getTimeline) === null || _g === void 0 ? void 0 : _g.call(stage);
12034
12523
  const detachedStageAnimates = [];
12035
12524
  this.visitTrackedAnimates(a => {
12036
12525
  const boundToPreviousStage = !!previousTimeline && a.timeline === previousTimeline;
@@ -12068,10 +12557,38 @@ class Graphic extends Node {
12068
12557
  }
12069
12558
  }
12070
12559
  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);
12560
+ (_h = graphicService === null || graphicService === void 0 ? void 0 : graphicService.onSetStage) === null || _h === void 0 ? void 0 : _h.call(graphicService, this, stage);
12072
12561
  return;
12073
12562
  }
12074
- this.syncSharedStateScopeBindingFromTree(!!((_h = this.currentStates) === null || _h === void 0 ? void 0 : _h.length));
12563
+ if (((_j = this.currentStates) === null || _j === void 0 ? void 0 : _j.length) ||
12564
+ this.boundSharedStateScope ||
12565
+ ((_k = this.registeredActiveScopes) === null || _k === void 0 ? void 0 : _k.size) ||
12566
+ this.sharedStateDirty) {
12567
+ this.syncSharedStateScopeBindingOnTreeChange(true);
12568
+ }
12569
+ }
12570
+ detachStageForRelease() {
12571
+ var _a, _b, _c;
12572
+ if ((_a = this.registeredActiveScopes) === null || _a === void 0 ? void 0 : _a.size) {
12573
+ this.clearSharedStateActiveRegistrations();
12574
+ }
12575
+ if (this.mayHaveTrackedAnimates() || this.shadowRoot) {
12576
+ this.stopAnimates();
12577
+ }
12578
+ this.boundSharedStateScope = undefined;
12579
+ this.boundSharedStateRevision = undefined;
12580
+ this.localFallbackCompiledDefinitions = undefined;
12581
+ this.compiledStateDefinitions = undefined;
12582
+ this.compiledStateDefinitionsCacheKey = undefined;
12583
+ this.stateEngine = undefined;
12584
+ this.stateEngineCompiledDefinitions = undefined;
12585
+ this.stateEngineStateProxyModeKey = undefined;
12586
+ this.sharedStateDirty = false;
12587
+ this.stage = null;
12588
+ this.layer = null;
12589
+ if (this.shadowRoot) {
12590
+ (_c = (_b = this.shadowRoot).detachStageForRelease) === null || _c === void 0 ? void 0 : _c.call(_b);
12591
+ }
12075
12592
  }
12076
12593
  setStageToShadowRoot(stage, layer) {
12077
12594
  if (this.shadowRoot) {
@@ -12207,6 +12724,9 @@ class Graphic extends Node {
12207
12724
  cb && cb();
12208
12725
  }
12209
12726
  _stopAnimates() {
12727
+ if (!this.mayHaveTrackedAnimates()) {
12728
+ return;
12729
+ }
12210
12730
  const animates = [];
12211
12731
  this.visitTrackedAnimates(animate => {
12212
12732
  animates.push(animate);
@@ -12227,17 +12747,24 @@ class Graphic extends Node {
12227
12747
  }
12228
12748
  }
12229
12749
  release() {
12230
- var _a, _b, _c;
12750
+ var _a, _b, _c, _d;
12231
12751
  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);
12752
+ if ((_a = this.registeredActiveScopes) === null || _a === void 0 ? void 0 : _a.size) {
12753
+ this.clearSharedStateActiveRegistrations();
12754
+ }
12755
+ if (this.mayHaveTrackedAnimates() || this.shadowRoot) {
12756
+ this.stopAnimates();
12757
+ }
12758
+ const graphicService = (_c = (_b = this.stage) === null || _b === void 0 ? void 0 : _b.graphicService) !== null && _c !== void 0 ? _c : application.graphicService;
12759
+ (_d = graphicService === null || graphicService === void 0 ? void 0 : graphicService.onRelease) === null || _d === void 0 ? void 0 : _d.call(graphicService, this);
12236
12760
  super.release();
12237
12761
  }
12762
+ hasCustomEvent(type) {
12763
+ return !!this._events && type in this._events;
12764
+ }
12238
12765
  _dispatchCustomEvent(type, context) {
12239
12766
  var _a, _b;
12240
- if (this._events && type in this._events) {
12767
+ if (this.hasCustomEvent(type)) {
12241
12768
  const changeEvent = new CustomEvent(type, context);
12242
12769
  changeEvent.bubbles = false;
12243
12770
  const manager = (_b = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventSystem) === null || _b === void 0 ? void 0 : _b.manager;
@@ -12250,6 +12777,9 @@ class Graphic extends Node {
12250
12777
  return true;
12251
12778
  }
12252
12779
  beforeStateUpdate(attrs, prevStates, nextStates, hasAnimation, isClear) {
12780
+ if (!this.hasCustomEvent('beforeStateUpdate')) {
12781
+ return true;
12782
+ }
12253
12783
  return this._dispatchCustomEvent('beforeStateUpdate', {
12254
12784
  type: AttributeUpdateType.STATE,
12255
12785
  attrs: Object.assign({}, attrs),
@@ -12259,6 +12789,11 @@ class Graphic extends Node {
12259
12789
  isClear: !!isClear
12260
12790
  });
12261
12791
  }
12792
+ emitStateUpdateEvent() {
12793
+ if (this.hasCustomEvent('afterStateUpdate')) {
12794
+ this._emitCustomEvent('afterStateUpdate', { type: AttributeUpdateType.STATE });
12795
+ }
12796
+ }
12262
12797
  _emitCustomEvent(type, context) {
12263
12798
  this._dispatchCustomEvent(type, context);
12264
12799
  }
@@ -16509,6 +17044,7 @@ class Group extends Graphic {
16509
17044
  this.type = 'group';
16510
17045
  this.parent = null;
16511
17046
  this.isContainer = true;
17047
+ this._hasSharedStateDefinitions = false;
16512
17048
  this.numberType = GROUP_NUMBER_TYPE;
16513
17049
  this._childUpdateTag = UpdateTag.UPDATE_BOUNDS;
16514
17050
  }
@@ -16519,12 +17055,17 @@ class Group extends Graphic {
16519
17055
  if (this._sharedStateDefinitions === value) {
16520
17056
  return;
16521
17057
  }
17058
+ const previousScope = this.sharedStateScope;
16522
17059
  this._sharedStateDefinitions = value;
17060
+ this._hasSharedStateDefinitions = !!value && Object.keys(value).length > 0;
16523
17061
  this.ensureSharedStateScopeBound();
16524
17062
  if (this.sharedStateScope) {
16525
17063
  setSharedStateScopeLocalDefinitions(this.sharedStateScope, value);
16526
17064
  markScopeActiveDescendantsDirty(this.sharedStateScope, this.stage);
16527
17065
  }
17066
+ if (previousScope !== this.sharedStateScope) {
17067
+ this.notifyChildrenSharedStateTreeChanged();
17068
+ }
16528
17069
  }
16529
17070
  setMode(mode) {
16530
17071
  mode === '3d' ? this.set3dMode() : this.set2dMode();
@@ -16715,8 +17256,16 @@ class Group extends Graphic {
16715
17256
  insertInto(newNode, idx) {
16716
17257
  return this._updateChildToStage(super.insertInto(newNode, idx));
16717
17258
  }
16718
- removeChild(child) {
17259
+ removeChild(child, highPerformance = false) {
17260
+ var _a;
16719
17261
  const data = super.removeChild(child);
17262
+ if (!data) {
17263
+ return data;
17264
+ }
17265
+ if (highPerformance) {
17266
+ (_a = child.detachStageForRelease) === null || _a === void 0 ? void 0 : _a.call(child);
17267
+ return data;
17268
+ }
16720
17269
  this.getGraphicService().onRemove(child);
16721
17270
  child.setStage(null, null);
16722
17271
  this.addUpdateBoundTag();
@@ -16739,29 +17288,43 @@ class Group extends Graphic {
16739
17288
  setStage(stage, layer) {
16740
17289
  var _a, _b, _c, _d, _e, _f;
16741
17290
  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;
17291
+ const needsSharedStateTreeSync = this._hasSharedStateDefinitions ||
17292
+ this.sharedStateScope ||
17293
+ ((_d = this.currentStates) === null || _d === void 0 ? void 0 : _d.length) ||
17294
+ this.boundSharedStateScope ||
17295
+ ((_e = this.registeredActiveScopes) === null || _e === void 0 ? void 0 : _e.size) ||
17296
+ this.sharedStateDirty;
16742
17297
  if (this.stage !== stage) {
16743
17298
  this.stage = stage;
16744
17299
  this.layer = layer;
16745
- this.ensureSharedStateScopeBound();
16746
- this.syncSharedStateScopeBindingFromTree(!!((_d = this.currentStates) === null || _d === void 0 ? void 0 : _d.length));
17300
+ if (needsSharedStateTreeSync) {
17301
+ this.ensureSharedStateScopeBound();
17302
+ this.syncSharedStateScopeBindingOnTreeChange(true);
17303
+ }
16747
17304
  this.setStageToShadowRoot(stage, layer);
16748
17305
  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);
17306
+ (_f = graphicService === null || graphicService === void 0 ? void 0 : graphicService.onSetStage) === null || _f === void 0 ? void 0 : _f.call(graphicService, this, stage);
16750
17307
  this.forEachChildren(item => {
16751
17308
  item.setStage(stage, this.layer);
16752
17309
  });
16753
17310
  return;
16754
17311
  }
16755
- if (this.layer !== layer) {
17312
+ const layerChanged = this.layer !== layer;
17313
+ if (layerChanged) {
16756
17314
  this.layer = layer;
16757
17315
  }
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
- });
17316
+ if (needsSharedStateTreeSync) {
17317
+ this.ensureSharedStateScopeBound();
17318
+ this.syncSharedStateScopeBindingOnTreeChange(true);
17319
+ this.notifyChildrenSharedStateTreeChanged();
17320
+ }
17321
+ else if (layerChanged) {
17322
+ this.forEachChildren(item => {
17323
+ if (item.onParentSharedStateTreeChanged) {
17324
+ item.onParentSharedStateTreeChanged(stage, this.layer);
17325
+ }
17326
+ });
17327
+ }
16765
17328
  }
16766
17329
  addUpdatePositionTag() {
16767
17330
  super.addUpdatePositionTag();
@@ -16828,8 +17391,20 @@ class Group extends Graphic {
16828
17391
  }
16829
17392
  super.release();
16830
17393
  }
17394
+ detachStageForRelease() {
17395
+ super.detachStageForRelease();
17396
+ this.sharedStateScope = undefined;
17397
+ this.forEachChildren((item) => {
17398
+ var _a;
17399
+ (_a = item.detachStageForRelease) === null || _a === void 0 ? void 0 : _a.call(item);
17400
+ });
17401
+ }
16831
17402
  ensureSharedStateScopeBound() {
16832
17403
  var _a, _b, _c;
17404
+ if (!this.hasSharedStateDefinitions()) {
17405
+ this.sharedStateScope = undefined;
17406
+ return;
17407
+ }
16833
17408
  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
17409
  if (!this.sharedStateScope) {
16835
17410
  this.sharedStateScope = createGroupSharedStateScope(this, parentScope, this._sharedStateDefinitions);
@@ -16842,18 +17417,25 @@ class Group extends Graphic {
16842
17417
  setSharedStateScopeLocalDefinitions(this.sharedStateScope, this._sharedStateDefinitions);
16843
17418
  }
16844
17419
  }
17420
+ hasSharedStateDefinitions() {
17421
+ return this._hasSharedStateDefinitions;
17422
+ }
17423
+ notifyChildrenSharedStateTreeChanged() {
17424
+ this.forEachChildren(item => {
17425
+ if (item.onParentSharedStateTreeChanged) {
17426
+ item.onParentSharedStateTreeChanged(this.stage, this.layer);
17427
+ }
17428
+ });
17429
+ }
16845
17430
  onParentSharedStateTreeChanged(stage, layer) {
17431
+ var _a;
16846
17432
  if (this.stage !== stage || this.layer !== layer) {
16847
17433
  this.setStage(stage, layer);
16848
17434
  return;
16849
17435
  }
16850
17436
  this.ensureSharedStateScopeBound();
16851
- this.syncSharedStateScopeBindingFromTree();
16852
- this.forEachChildren(item => {
16853
- if (item.onParentSharedStateTreeChanged) {
16854
- item.onParentSharedStateTreeChanged(stage, this.layer);
16855
- }
16856
- });
17437
+ this.syncSharedStateScopeBindingOnTreeChange(!!((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length));
17438
+ this.notifyChildrenSharedStateTreeChanged();
16857
17439
  }
16858
17440
  }
16859
17441
  Group.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
@@ -17295,6 +17877,10 @@ class DefaultGraphicService {
17295
17877
  };
17296
17878
  this.tempAABBBounds1 = new AABBBounds();
17297
17879
  this.tempAABBBounds2 = new AABBBounds();
17880
+ this.tempAABBBoundsResult = {
17881
+ tb1: this.tempAABBBounds1,
17882
+ tb2: this.tempAABBBounds2
17883
+ };
17298
17884
  }
17299
17885
  onAttributeUpdate(graphic) {
17300
17886
  if (this.hooks.onAttributeUpdate.taps.length) {
@@ -17425,7 +18011,7 @@ class DefaultGraphicService {
17425
18011
  const tb2 = this.tempAABBBounds2;
17426
18012
  tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2);
17427
18013
  tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2);
17428
- return { tb1, tb2 };
18014
+ return this.tempAABBBoundsResult;
17429
18015
  }
17430
18016
  }
17431
18017
 
@@ -19328,6 +19914,7 @@ class DirtyBoundsPlugin {
19328
19914
  this.activeEvent = 'onRegister';
19329
19915
  this._uid = Generator.GenAutoIncrementId();
19330
19916
  this.key = this.name + this._uid;
19917
+ this.dirtyBoundsHooksRegistered = false;
19331
19918
  this.handlePaintOnlyUpdate = (graphic) => {
19332
19919
  var _a, _b, _c, _d;
19333
19920
  const stage = this.pluginService.stage;
@@ -19369,16 +19956,16 @@ class DirtyBoundsPlugin {
19369
19956
  }
19370
19957
  return (_b = owner._globalAABBBounds) !== null && _b !== void 0 ? _b : owner.globalAABBBounds;
19371
19958
  }
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) {
19959
+ getRemoveDirtyBounds(graphic) {
19960
+ var _a;
19961
+ const owner = ((_a = graphic.glyphHost) !== null && _a !== void 0 ? _a : graphic);
19962
+ const cachedBounds = owner._globalAABBBounds;
19963
+ if (cachedBounds && typeof cachedBounds.empty === 'function' && !cachedBounds.empty()) {
19964
+ return cachedBounds;
19965
+ }
19966
+ }
19967
+ registerDirtyBoundsHooks(stage) {
19968
+ if (this.dirtyBoundsHooksRegistered) {
19382
19969
  return;
19383
19970
  }
19384
19971
  stage.graphicService.hooks.onAttributeUpdate.tap(this.key, this.handlePaintOnlyUpdate);
@@ -19419,10 +20006,29 @@ class DirtyBoundsPlugin {
19419
20006
  if (!(stage && stage === this.pluginService.stage && stage.renderCount)) {
19420
20007
  return;
19421
20008
  }
19422
- if (stage) {
19423
- stage.dirty(graphic.globalAABBBounds);
20009
+ const bounds = this.getRemoveDirtyBounds(graphic);
20010
+ if (bounds && !bounds.empty()) {
20011
+ stage.dirty(bounds);
19424
20012
  }
19425
20013
  });
20014
+ this.dirtyBoundsHooksRegistered = true;
20015
+ }
20016
+ activate(context) {
20017
+ this.pluginService = context;
20018
+ context.stage.hooks.afterRender.tap(this.key, stage => {
20019
+ if (!(stage && stage === this.pluginService.stage)) {
20020
+ return;
20021
+ }
20022
+ stage.dirtyBounds.clear();
20023
+ this.registerDirtyBoundsHooks(stage);
20024
+ });
20025
+ const stage = this.pluginService.stage;
20026
+ if (!stage) {
20027
+ return;
20028
+ }
20029
+ if (stage.renderCount) {
20030
+ this.registerDirtyBoundsHooks(stage);
20031
+ }
19426
20032
  }
19427
20033
  deactivate(context) {
19428
20034
  const stage = this.pluginService.stage;
@@ -19432,6 +20038,7 @@ class DirtyBoundsPlugin {
19432
20038
  stage.graphicService.hooks.onAttributeUpdate.taps = stage.graphicService.hooks.onAttributeUpdate.taps.filter(item => {
19433
20039
  return item.name !== this.key;
19434
20040
  });
20041
+ this.dirtyBoundsHooksRegistered = false;
19435
20042
  stage.graphicService.hooks.beforeUpdateAABBBounds.taps =
19436
20043
  stage.graphicService.hooks.beforeUpdateAABBBounds.taps.filter(item => {
19437
20044
  return item.name !== this.key;
@@ -19956,7 +20563,7 @@ class Stage extends Group {
19956
20563
  this._ticker.on('tick', this.afterTickCb);
19957
20564
  }
19958
20565
  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;
20566
+ var _a, _b, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
19960
20567
  super({});
19961
20568
  this.tickedBeforeRender = true;
19962
20569
  this._onVisibleChange = (visible) => {
@@ -19978,7 +20585,10 @@ class Stage extends Group {
19978
20585
  }
19979
20586
  };
19980
20587
  this.beforeRender = (stage) => {
19981
- flushStageSharedStateRefresh(this);
20588
+ const pendingSharedRefresh = this._pendingSharedStateRefreshGraphics;
20589
+ if (pendingSharedRefresh === null || pendingSharedRefresh === void 0 ? void 0 : pendingSharedRefresh.size) {
20590
+ flushStageSharedStateRefresh(this);
20591
+ }
19982
20592
  this._beforeRenderList.forEach(cb => cb(stage));
19983
20593
  };
19984
20594
  this.afterClearScreen = (drawParams) => {
@@ -20044,16 +20654,19 @@ class Stage extends Group {
20044
20654
  this.appendChild(this.layerService.createLayer(this, { main: true }));
20045
20655
  this.nextFrameRenderLayerSet = new Set();
20046
20656
  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
20657
  this.theme.onStateDefinitionsChange = () => {
20051
20658
  var _a;
20052
- if (!this.rootSharedStateScope) {
20659
+ const definitions = (_a = this.theme) === null || _a === void 0 ? void 0 : _a.stateDefinitions;
20660
+ if (!definitions || !Object.keys(definitions).length) {
20661
+ if (this.rootSharedStateScope) {
20662
+ setRootSharedStateScopeThemeDefinitions(this.rootSharedStateScope, definitions);
20663
+ markScopeActiveDescendantsDirty(this.rootSharedStateScope, this);
20664
+ }
20053
20665
  return;
20054
20666
  }
20055
- setRootSharedStateScopeThemeDefinitions(this.rootSharedStateScope, (_a = this.theme) === null || _a === void 0 ? void 0 : _a.stateDefinitions);
20056
- markScopeActiveDescendantsDirty(this.rootSharedStateScope, this);
20667
+ const rootScope = this.ensureRootSharedStateScope(definitions);
20668
+ setRootSharedStateScopeThemeDefinitions(rootScope, definitions);
20669
+ markScopeActiveDescendantsDirty(rootScope, this);
20057
20670
  };
20058
20671
  this.renderStyle = params.renderStyle;
20059
20672
  if (params.autoRender) {
@@ -20095,7 +20708,7 @@ class Stage extends Group {
20095
20708
  this.setAttributes({ background: this._background });
20096
20709
  }
20097
20710
  this.initAnimate(params);
20098
- this.rafId = (_y = params.rafId) !== null && _y !== void 0 ? _y : Math.floor(Math.random() * 6);
20711
+ this.rafId = (_x = params.rafId) !== null && _x !== void 0 ? _x : Math.floor(Math.random() * 6);
20099
20712
  }
20100
20713
  initAnimate(params) {
20101
20714
  var _a;
@@ -20475,8 +21088,22 @@ class Stage extends Group {
20475
21088
  });
20476
21089
  }
20477
21090
  }
21091
+ ensureRootSharedStateScope(themeStateDefinitions) {
21092
+ if (!this.rootSharedStateScope) {
21093
+ this.rootSharedStateScope = createRootSharedStateScope(this, themeStateDefinitions);
21094
+ return this.rootSharedStateScope;
21095
+ }
21096
+ this.rootSharedStateScope.ownerStage = this;
21097
+ return this.rootSharedStateScope;
21098
+ }
21099
+ getStateBatchScheduler() {
21100
+ if (!this._stateBatchScheduler) {
21101
+ this._stateBatchScheduler = new StateBatchScheduler(this, ensureStageStatePerfMonitor(this));
21102
+ }
21103
+ return this._stateBatchScheduler;
21104
+ }
20478
21105
  scheduleStateBatch(graphics, targetStates) {
20479
- this._stateBatchScheduler.schedule(graphics, targetStates);
21106
+ this.getStateBatchScheduler().schedule(graphics, targetStates);
20480
21107
  }
20481
21108
  getStatePerfSnapshot() {
20482
21109
  return ensureStageStatePerfMonitor(this).getSnapshot();
@@ -24066,23 +24693,27 @@ function createStage(params) {
24066
24693
  const result = { x: 0, y: 0, z: 0, lastModelMatrix: null };
24067
24694
  class BaseRender {
24068
24695
  init(contributions) {
24069
- if (contributions) {
24070
- this._renderContribitions = contributions.getContributions();
24071
- }
24072
- if (!this._renderContribitions) {
24073
- this._renderContribitions = [];
24074
- }
24075
24696
  if (!this.builtinContributions) {
24076
24697
  this.builtinContributions = [];
24077
24698
  }
24078
- this.builtinContributions.push(defaultBaseClipRenderBeforeContribution);
24079
- this.builtinContributions.push(defaultBaseClipRenderAfterContribution);
24080
- this.builtinContributions.forEach(item => this._renderContribitions.push(item));
24699
+ this._renderContribitions = contributions ? contributions.getContributions().slice() : [];
24700
+ const addContribution = (item) => {
24701
+ if (!this._renderContribitions.includes(item)) {
24702
+ this._renderContribitions.push(item);
24703
+ }
24704
+ };
24705
+ this.builtinContributions.forEach(addContribution);
24706
+ addContribution(defaultBaseClipRenderBeforeContribution);
24707
+ addContribution(defaultBaseClipRenderAfterContribution);
24081
24708
  if (this._renderContribitions.length) {
24082
24709
  this._renderContribitions.sort((a, b) => b.order - a.order);
24083
24710
  this._beforeRenderContribitions = this._renderContribitions.filter(c => c.time === BaseRenderContributionTime.beforeFillStroke);
24084
24711
  this._afterRenderContribitions = this._renderContribitions.filter(c => c.time === BaseRenderContributionTime.afterFillStroke);
24085
24712
  }
24713
+ else {
24714
+ this._beforeRenderContribitions = [];
24715
+ this._afterRenderContribitions = [];
24716
+ }
24086
24717
  }
24087
24718
  reInit() {
24088
24719
  this.init(this.graphicRenderContributions);
@@ -31120,7 +31751,10 @@ class FlexLayoutPlugin {
31120
31751
  this.tryLayout(graphic, false);
31121
31752
  }
31122
31753
  });
31123
- stage.graphicService.hooks.onSetStage.tap(this.key, graphic => {
31754
+ stage.graphicService.hooks.onSetStage.tap(this.key, (graphic, nextStage) => {
31755
+ if (!(nextStage && nextStage === this.pluginService.stage)) {
31756
+ return;
31757
+ }
31124
31758
  if (graphic.glyphHost) {
31125
31759
  graphic = graphic.glyphHost;
31126
31760
  }
@@ -31155,4 +31789,4 @@ const registerFlexLayoutPlugin = () => {
31155
31789
  Factory.registerPlugin('FlexLayoutPlugin', FlexLayoutPlugin);
31156
31790
  };
31157
31791
 
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 };
31792
+ 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 };