@visactor/vrender-core 1.1.0-alpha.2 → 1.1.0-alpha.21

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 (136) hide show
  1. package/cjs/common/diff.js +1 -2
  2. package/cjs/common/event-transformer.js +2 -1
  3. package/cjs/common/rect-utils.js +1 -1
  4. package/cjs/common/render-area.js +1 -1
  5. package/cjs/common/render-command-list.js +1 -1
  6. package/cjs/common/render-curve.js +1 -1
  7. package/cjs/common/render-utils.js +1 -1
  8. package/cjs/common/seg-context.js +1 -2
  9. package/cjs/common/simplify.js +1 -1
  10. package/cjs/common/sort.js +1 -1
  11. package/cjs/common/split-path.js +1 -1
  12. package/cjs/common/store.js +1 -1
  13. package/cjs/common/text.js +1 -1
  14. package/cjs/common/utils.js +1 -1
  15. package/cjs/core/camera.js +1 -1
  16. package/cjs/core/constants.js +1 -1
  17. package/cjs/core/core-modules.js +1 -1
  18. package/cjs/core/global-module.js +2 -0
  19. package/cjs/core/global.js +1 -1
  20. package/cjs/core/graphic-utils.js +1 -1
  21. package/cjs/core/index.js +1 -1
  22. package/cjs/core/layer-service.js +2 -1
  23. package/cjs/core/layer.js +1 -1
  24. package/cjs/core/light.js +1 -1
  25. package/cjs/core/stage.d.ts +4 -1
  26. package/cjs/core/stage.js +24 -12
  27. package/cjs/core/stage.js.map +1 -1
  28. package/cjs/core/window.js +1 -1
  29. package/cjs/graphic/graphic-service/graphic-service.d.ts +4 -0
  30. package/cjs/graphic/graphic-service/graphic-service.js +6 -5
  31. package/cjs/graphic/graphic-service/graphic-service.js.map +1 -1
  32. package/cjs/graphic/graphic.d.ts +73 -11
  33. package/cjs/graphic/graphic.js +516 -157
  34. package/cjs/graphic/graphic.js.map +1 -1
  35. package/cjs/graphic/group.d.ts +5 -1
  36. package/cjs/graphic/group.js +37 -18
  37. package/cjs/graphic/group.js.map +1 -1
  38. package/cjs/graphic/rect.d.ts +2 -0
  39. package/cjs/graphic/rect.js +44 -0
  40. package/cjs/graphic/rect.js.map +1 -1
  41. package/cjs/graphic/state/shared-state-refresh.js +4 -3
  42. package/cjs/graphic/state/shared-state-refresh.js.map +1 -1
  43. package/cjs/graphic/state/shared-state-scope.js +1 -1
  44. package/cjs/graphic/state/shared-state-scope.js.map +1 -1
  45. package/cjs/graphic/state/state-engine.js +2 -2
  46. package/cjs/graphic/state/state-engine.js.map +1 -1
  47. package/cjs/graphic/state/state-perf-monitor.d.ts +1 -0
  48. package/cjs/graphic/state/state-perf-monitor.js +9 -2
  49. package/cjs/graphic/state/state-perf-monitor.js.map +1 -1
  50. package/cjs/graphic/state/state-style-resolver.d.ts +0 -9
  51. package/cjs/graphic/state/state-style-resolver.js +0 -23
  52. package/cjs/graphic/state/state-style-resolver.js.map +1 -1
  53. package/cjs/graphic/state/state-transition-orchestrator.d.ts +5 -0
  54. package/cjs/graphic/state/state-transition-orchestrator.js +17 -5
  55. package/cjs/graphic/state/state-transition-orchestrator.js.map +1 -1
  56. package/cjs/interface/animation/animate.d.ts +1 -0
  57. package/cjs/interface/animation/animate.js.map +1 -1
  58. package/cjs/interface/graphic.d.ts +9 -0
  59. package/cjs/interface/graphic.js.map +1 -1
  60. package/cjs/interface/node-tree.js.map +1 -1
  61. package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.d.ts +4 -1
  62. package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js +20 -10
  63. package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
  64. package/cjs/plugins/builtin-plugin/flex-layout-plugin.js +3 -2
  65. package/cjs/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
  66. package/cjs/render/contributions/render/base-render.js +8 -7
  67. package/cjs/render/contributions/render/base-render.js.map +1 -1
  68. package/dist/index.es.js +1150 -279
  69. package/es/common/diff.js +1 -2
  70. package/es/common/event-transformer.js +2 -1
  71. package/es/common/rect-utils.js +1 -1
  72. package/es/common/render-area.js +1 -1
  73. package/es/common/render-command-list.js +1 -1
  74. package/es/common/render-curve.js +1 -1
  75. package/es/common/render-utils.js +1 -1
  76. package/es/common/seg-context.js +1 -2
  77. package/es/common/simplify.js +1 -1
  78. package/es/common/sort.js +1 -1
  79. package/es/common/split-path.js +1 -1
  80. package/es/common/store.js +1 -1
  81. package/es/common/text.js +1 -1
  82. package/es/common/utils.js +1 -1
  83. package/es/core/camera.js +1 -1
  84. package/es/core/constants.js +1 -1
  85. package/es/core/core-modules.js +1 -1
  86. package/es/core/global-module.js +2 -0
  87. package/es/core/global.js +1 -1
  88. package/es/core/graphic-utils.js +1 -1
  89. package/es/core/index.js +1 -1
  90. package/es/core/layer-service.js +2 -1
  91. package/es/core/layer.js +1 -1
  92. package/es/core/light.js +1 -1
  93. package/es/core/stage.d.ts +4 -1
  94. package/es/core/stage.js +22 -11
  95. package/es/core/stage.js.map +1 -1
  96. package/es/core/window.js +1 -1
  97. package/es/graphic/graphic-service/graphic-service.d.ts +4 -0
  98. package/es/graphic/graphic-service/graphic-service.js +6 -5
  99. package/es/graphic/graphic-service/graphic-service.js.map +1 -1
  100. package/es/graphic/graphic.d.ts +73 -11
  101. package/es/graphic/graphic.js +511 -150
  102. package/es/graphic/graphic.js.map +1 -1
  103. package/es/graphic/group.d.ts +5 -1
  104. package/es/graphic/group.js +36 -18
  105. package/es/graphic/group.js.map +1 -1
  106. package/es/graphic/rect.d.ts +2 -0
  107. package/es/graphic/rect.js +44 -0
  108. package/es/graphic/rect.js.map +1 -1
  109. package/es/graphic/state/shared-state-refresh.js +5 -4
  110. package/es/graphic/state/shared-state-refresh.js.map +1 -1
  111. package/es/graphic/state/shared-state-scope.js +2 -2
  112. package/es/graphic/state/shared-state-scope.js.map +1 -1
  113. package/es/graphic/state/state-engine.js +3 -3
  114. package/es/graphic/state/state-engine.js.map +1 -1
  115. package/es/graphic/state/state-perf-monitor.d.ts +1 -0
  116. package/es/graphic/state/state-perf-monitor.js +7 -0
  117. package/es/graphic/state/state-perf-monitor.js.map +1 -1
  118. package/es/graphic/state/state-style-resolver.d.ts +0 -9
  119. package/es/graphic/state/state-style-resolver.js +0 -23
  120. package/es/graphic/state/state-style-resolver.js.map +1 -1
  121. package/es/graphic/state/state-transition-orchestrator.d.ts +5 -0
  122. package/es/graphic/state/state-transition-orchestrator.js +17 -5
  123. package/es/graphic/state/state-transition-orchestrator.js.map +1 -1
  124. package/es/interface/animation/animate.d.ts +1 -0
  125. package/es/interface/animation/animate.js.map +1 -1
  126. package/es/interface/graphic.d.ts +9 -0
  127. package/es/interface/graphic.js.map +1 -1
  128. package/es/interface/node-tree.js.map +1 -1
  129. package/es/plugins/builtin-plugin/dirty-bounds-plugin.d.ts +4 -1
  130. package/es/plugins/builtin-plugin/dirty-bounds-plugin.js +20 -10
  131. package/es/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
  132. package/es/plugins/builtin-plugin/flex-layout-plugin.js +3 -2
  133. package/es/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
  134. package/es/render/contributions/render/base-render.js +8 -6
  135. package/es/render/contributions/render/base-render.js.map +1 -1
  136. 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) {
@@ -10227,18 +10182,39 @@ class StateTransitionOrchestrator {
10227
10182
  const noWorkAnimateAttr = Object.assign(Object.assign({}, ((_a = options.noWorkAnimateAttr) !== null && _a !== void 0 ? _a : {})), normalizeNoAnimateAttrConfig((_b = options.animateConfig) === null || _b === void 0 ? void 0 : _b.noAnimateAttrs));
10228
10183
  const isClear = options.isClear === true;
10229
10184
  const getDefaultAttribute = options.getDefaultAttribute;
10185
+ const shouldSkipDefaultAttribute = options.shouldSkipDefaultAttribute;
10186
+ const assignTransitionAttr = (key, value) => {
10187
+ if (noWorkAnimateAttr[key]) {
10188
+ plan.jumpAttrs[key] = value;
10189
+ plan.noAnimateAttrs[key] = value;
10190
+ return;
10191
+ }
10192
+ if (isClear && value === undefined) {
10193
+ if (shouldSkipDefaultAttribute === null || shouldSkipDefaultAttribute === void 0 ? void 0 : shouldSkipDefaultAttribute(key, targetAttrs)) {
10194
+ return;
10195
+ }
10196
+ plan.animateAttrs[key] = getDefaultAttribute ? getDefaultAttribute(key) : value;
10197
+ return;
10198
+ }
10199
+ plan.animateAttrs[key] = value;
10200
+ };
10230
10201
  for (const key in targetAttrs) {
10231
10202
  if (!Object.prototype.hasOwnProperty.call(targetAttrs, key)) {
10232
10203
  continue;
10233
10204
  }
10234
10205
  const value = targetAttrs[key];
10235
- if (noWorkAnimateAttr[key]) {
10236
- plan.jumpAttrs[key] = value;
10237
- plan.noAnimateAttrs[key] = value;
10238
- continue;
10206
+ assignTransitionAttr(key, value);
10207
+ }
10208
+ const extraAnimateAttrs = options.extraAnimateAttrs;
10209
+ if (extraAnimateAttrs) {
10210
+ for (const key in extraAnimateAttrs) {
10211
+ const hasTargetAttr = Object.prototype.hasOwnProperty.call(targetAttrs, key);
10212
+ if (!Object.prototype.hasOwnProperty.call(extraAnimateAttrs, key) ||
10213
+ (hasTargetAttr && targetAttrs[key] !== undefined)) {
10214
+ continue;
10215
+ }
10216
+ assignTransitionAttr(key, extraAnimateAttrs[key]);
10239
10217
  }
10240
- plan.animateAttrs[key] =
10241
- isClear && value === undefined && getDefaultAttribute ? getDefaultAttribute(key) : value;
10242
10218
  }
10243
10219
  return plan;
10244
10220
  }
@@ -10272,12 +10248,14 @@ class StateTransitionOrchestrator {
10272
10248
  return plan;
10273
10249
  }
10274
10250
  applyClearTransition(graphic, targetAttrs, hasAnimation, stateNames, options = {}) {
10275
- var _a, _b;
10251
+ var _a, _b, _c, _d;
10276
10252
  const plan = this.analyzeTransition({}, targetAttrs, stateNames, hasAnimation, {
10277
10253
  noWorkAnimateAttr: (_a = graphic.getNoWorkAnimateAttr) === null || _a === void 0 ? void 0 : _a.call(graphic),
10278
10254
  isClear: true,
10279
10255
  getDefaultAttribute: (_b = graphic.getDefaultAttribute) === null || _b === void 0 ? void 0 : _b.bind(graphic),
10280
- animateConfig: options.animateConfig
10256
+ shouldSkipDefaultAttribute: (_c = options.shouldSkipDefaultAttribute) !== null && _c !== void 0 ? _c : (_d = graphic.shouldSkipStateTransitionDefaultAttribute) === null || _d === void 0 ? void 0 : _d.bind(graphic),
10257
+ animateConfig: options.animateConfig,
10258
+ extraAnimateAttrs: options.extraAnimateAttrs
10281
10259
  });
10282
10260
  return this.applyTransition(graphic, plan, hasAnimation, options);
10283
10261
  }
@@ -10373,7 +10351,7 @@ function ensureSharedStateScopeFresh(scope) {
10373
10351
  if (!scope) {
10374
10352
  return undefined;
10375
10353
  }
10376
- (_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');
10377
10355
  if (scope.parentScope) {
10378
10356
  ensureSharedStateScopeFresh(scope.parentScope);
10379
10357
  }
@@ -10397,7 +10375,7 @@ function scheduleStageSharedStateRefresh(stage) {
10397
10375
  if (!stage || stage.releaseStatus === 'released') {
10398
10376
  return;
10399
10377
  }
10400
- (_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');
10401
10379
  stage.renderNextFrame();
10402
10380
  }
10403
10381
  function enqueueGraphicSharedStateRefresh(stage, graphic) {
@@ -10408,7 +10386,7 @@ function enqueueGraphicSharedStateRefresh(stage, graphic) {
10408
10386
  const pending = (_a = stage._pendingSharedStateRefreshGraphics) !== null && _a !== void 0 ? _a : (stage._pendingSharedStateRefreshGraphics = new Set());
10409
10387
  if (!pending.has(graphic)) {
10410
10388
  pending.add(graphic);
10411
- const perfMonitor = getStageStatePerfMonitor(stage);
10389
+ const perfMonitor = getActiveStageStatePerfMonitor(stage);
10412
10390
  perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordRefresh('queuedGraphics');
10413
10391
  perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordAllocation('refreshQueuePushes');
10414
10392
  }
@@ -10431,7 +10409,7 @@ function flushStageSharedStateRefresh(stage) {
10431
10409
  if (!pending || !pending.size) {
10432
10410
  return;
10433
10411
  }
10434
- const perfMonitor = getStageStatePerfMonitor(stage);
10412
+ const perfMonitor = getActiveStageStatePerfMonitor(stage);
10435
10413
  const start = perfMonitor ? performance.now() : 0;
10436
10414
  const graphics = Array.from(pending.values());
10437
10415
  pending.clear();
@@ -10443,6 +10421,9 @@ function flushStageSharedStateRefresh(stage) {
10443
10421
  if (graphic.stage !== stage) {
10444
10422
  return;
10445
10423
  }
10424
+ if (!graphic.sharedStateDirty) {
10425
+ return;
10426
+ }
10446
10427
  const refresh = graphic.refreshSharedStateBeforeRender;
10447
10428
  if (typeof refresh === 'function') {
10448
10429
  refresh.call(graphic);
@@ -10495,9 +10476,24 @@ const builtinTextureTypes = new Set([
10495
10476
  'grid',
10496
10477
  'wave'
10497
10478
  ]);
10479
+ const FULL_STATE_DEFINITION_KEYS = new Set([
10480
+ 'name',
10481
+ 'patch',
10482
+ 'priority',
10483
+ 'exclude',
10484
+ 'suppress',
10485
+ 'resolver',
10486
+ 'declaredAffectedKeys'
10487
+ ]);
10498
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;
10499
10495
  function isPlainObjectValue(value) {
10500
- return typeof value === 'object' && value != null && !isArray(value);
10496
+ return typeof value === 'object' && value != null && !Array.isArray(value);
10501
10497
  }
10502
10498
  function cloneAttributeValue(value) {
10503
10499
  if (!isPlainObjectValue(value)) {
@@ -10511,18 +10507,6 @@ function cloneAttributeValue(value) {
10511
10507
  });
10512
10508
  return clone;
10513
10509
  }
10514
- function cloneSimpleAttributeRecord(value) {
10515
- if (!isPlainObjectValue(value)) {
10516
- return value;
10517
- }
10518
- return Object.assign({}, value);
10519
- }
10520
- function shouldUseSimpleAttributeFastPath(value) {
10521
- if (!isPlainObjectValue(value)) {
10522
- return false;
10523
- }
10524
- return !Object.keys(value).some(key => isPlainObjectValue(value[key]));
10525
- }
10526
10510
  function cloneAttributeSurface(value) {
10527
10511
  if (!isPlainObjectValue(value)) {
10528
10512
  return value;
@@ -10535,6 +10519,15 @@ function cloneAttributeSurface(value) {
10535
10519
  });
10536
10520
  return clone;
10537
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
+ }
10538
10531
  function deepMergeAttributeValue(base, value) {
10539
10532
  var _a;
10540
10533
  const result = (_a = cloneAttributeValue(base)) !== null && _a !== void 0 ? _a : {};
@@ -10602,24 +10595,29 @@ class Graphic extends Node {
10602
10595
  get globalTransMatrix() {
10603
10596
  return this.tryUpdateGlobalTransMatrix(true);
10604
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
+ }
10605
10609
  constructor(params = {}) {
10606
10610
  var _a;
10607
10611
  super();
10608
- this.resolverEpoch = 0;
10609
10612
  this._AABBBounds = new AABBBounds();
10610
10613
  this._updateTag = UpdateTag.INIT;
10611
- const useSimpleAttributeFastPath = shouldUseSimpleAttributeFastPath(params);
10612
- const initialBaseAttributes = (useSimpleAttributeFastPath ? cloneSimpleAttributeRecord(params) : cloneAttributeValue(params));
10613
- this.baseAttributes = initialBaseAttributes;
10614
- this.attribute = (useSimpleAttributeFastPath
10615
- ? cloneSimpleAttributeRecord(initialBaseAttributes)
10616
- : cloneAttributeSurface(initialBaseAttributes));
10614
+ this.attribute = params;
10617
10615
  this.valid = this.isValid();
10618
10616
  this.updateAABBBoundsStamp = 0;
10619
10617
  if (params.background) {
10620
10618
  this.loadImage((_a = params.background.background) !== null && _a !== void 0 ? _a : params.background, true);
10621
10619
  }
10622
- if (isExternalTexture(params.texture)) {
10620
+ if (params.texture && isExternalTexture(params.texture)) {
10623
10621
  this.loadImage(params.texture, false);
10624
10622
  }
10625
10623
  if (params.shadowGraphic) {
@@ -10629,8 +10627,11 @@ class Graphic extends Node {
10629
10627
  get normalAttrs() {
10630
10628
  return this.baseAttributes;
10631
10629
  }
10632
- set normalAttrs(value) {
10633
- 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;
10634
10635
  }
10635
10636
  getGraphicService() {
10636
10637
  var _a, _b;
@@ -10689,13 +10690,31 @@ class Graphic extends Node {
10689
10690
  }
10690
10691
  return true;
10691
10692
  }
10692
- syncSharedStateActiveRegistrations() {
10693
+ syncSharedStateScopeBindingOnTreeChange(markDirty = true) {
10693
10694
  var _a, _b;
10694
- const nextScopes = ((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) && this.boundSharedStateScope
10695
- ? new Set(collectSharedStateScopeChain(this.boundSharedStateScope))
10696
- : new Set();
10697
- const previousScopes = (_b = this.registeredActiveScopes) !== null && _b !== void 0 ? _b : new Set();
10698
- 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 => {
10699
10718
  if (!nextScopes.has(scope)) {
10700
10719
  scope.subtreeActiveDescendants.delete(this);
10701
10720
  }
@@ -10725,7 +10744,7 @@ class Graphic extends Node {
10725
10744
  this.setStage(stage, layer);
10726
10745
  return;
10727
10746
  }
10728
- this.syncSharedStateScopeBindingFromTree();
10747
+ this.syncSharedStateScopeBindingOnTreeChange();
10729
10748
  }
10730
10749
  refreshSharedStateBeforeRender() {
10731
10750
  var _a;
@@ -10740,7 +10759,7 @@ class Graphic extends Node {
10740
10759
  this.recomputeCurrentStatePatch();
10741
10760
  this.stopStateAnimates();
10742
10761
  this._restoreAttributeFromStaticTruth({ type: AttributeUpdateType.STATE });
10743
- this._emitCustomEvent('afterStateUpdate', { type: AttributeUpdateType.STATE });
10762
+ this.emitStateUpdateEvent();
10744
10763
  this.sharedStateDirty = false;
10745
10764
  }
10746
10765
  getLocalStatesVersion() {
@@ -10822,23 +10841,22 @@ class Graphic extends Node {
10822
10841
  };
10823
10842
  }
10824
10843
  recomputeCurrentStatePatch() {
10825
- var _a, _b, _c, _d;
10844
+ var _a, _b;
10826
10845
  if (!((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length)) {
10827
10846
  this.effectiveStates = [];
10828
10847
  this.resolvedStatePatch = undefined;
10829
10848
  this.syncSharedStateActiveRegistrations();
10830
10849
  return;
10831
10850
  }
10832
- const stateResolveBaseAttrs = ((_b = this.baseAttributes) !== null && _b !== void 0 ? _b : this.attribute);
10833
- const stateModel = this.createStateModel();
10834
- (_c = this.stateEngine) === null || _c === void 0 ? void 0 : _c.setResolveContext(this, stateResolveBaseAttrs);
10851
+ const stateResolveBaseAttrs = this.getStateResolveBaseAttrs();
10852
+ const stateModel = this.createStateModel(stateResolveBaseAttrs);
10835
10853
  const transition = stateModel.useStates(this.currentStates);
10836
- const effectiveStates = (_d = transition.effectiveStates) !== null && _d !== void 0 ? _d : transition.states;
10854
+ const effectiveStates = (_b = transition.effectiveStates) !== null && _b !== void 0 ? _b : transition.states;
10837
10855
  const resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions
10838
10856
  ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
10839
10857
  this.currentStates = transition.states;
10840
10858
  this.effectiveStates = [...effectiveStates];
10841
- this.resolvedStatePatch = Object.assign({}, resolvedStateAttrs);
10859
+ this.resolvedStatePatch = resolvedStateAttrs;
10842
10860
  this.syncSharedStateActiveRegistrations();
10843
10861
  }
10844
10862
  buildStaticAttributeSnapshot() {
@@ -10859,6 +10877,37 @@ class Graphic extends Node {
10859
10877
  });
10860
10878
  return snapshot;
10861
10879
  }
10880
+ buildRemovedStateAnimationAttrs(targetStateAttrs, previousResolvedStatePatch) {
10881
+ const extraAttrs = {};
10882
+ if (!previousResolvedStatePatch) {
10883
+ return extraAttrs;
10884
+ }
10885
+ const snapshot = this.buildStaticAttributeSnapshot();
10886
+ const staticTargetAttrs = snapshot;
10887
+ Object.keys(previousResolvedStatePatch).forEach(key => {
10888
+ const hasTargetAttr = Object.prototype.hasOwnProperty.call(targetStateAttrs, key);
10889
+ if (hasTargetAttr && targetStateAttrs[key] !== undefined) {
10890
+ return;
10891
+ }
10892
+ const assignFallbackAttr = (value) => {
10893
+ if (value === undefined && this.shouldSkipStateTransitionDefaultAttribute(key, staticTargetAttrs)) {
10894
+ return;
10895
+ }
10896
+ extraAttrs[key] = value === undefined ? value : cloneAttributeValue(value);
10897
+ };
10898
+ if (hasTargetAttr) {
10899
+ assignFallbackAttr(this.getStateTransitionDefaultAttribute(key, staticTargetAttrs));
10900
+ return;
10901
+ }
10902
+ if (Object.prototype.hasOwnProperty.call(snapshot, key)) {
10903
+ const snapshotValue = snapshot[key];
10904
+ assignFallbackAttr(snapshotValue === undefined ? this.getStateTransitionDefaultAttribute(key, staticTargetAttrs) : snapshotValue);
10905
+ return;
10906
+ }
10907
+ assignFallbackAttr(this.getStateTransitionDefaultAttribute(key, staticTargetAttrs));
10908
+ });
10909
+ return extraAttrs;
10910
+ }
10862
10911
  syncObjectToSnapshot(target, snapshot) {
10863
10912
  const delta = new Map();
10864
10913
  const keySet = new Set([...Object.keys(target), ...Object.keys(snapshot)]);
@@ -10873,7 +10922,7 @@ class Graphic extends Node {
10873
10922
  return;
10874
10923
  }
10875
10924
  const nextValue = snapshot[key];
10876
- if (isEqual(previousValue, nextValue)) {
10925
+ if (areAttributeValuesEqual(previousValue, nextValue)) {
10877
10926
  return;
10878
10927
  }
10879
10928
  delta.set(key, { prev: previousValue, next: nextValue });
@@ -10882,9 +10931,13 @@ class Graphic extends Node {
10882
10931
  return delta;
10883
10932
  }
10884
10933
  _syncAttribute() {
10934
+ if (this.attribute === this.baseAttributes && this.resolvedStatePatch) {
10935
+ this.detachAttributeFromBaseAttributes();
10936
+ }
10885
10937
  const snapshot = this.buildStaticAttributeSnapshot();
10886
10938
  const delta = this.syncObjectToSnapshot(this.attribute, snapshot);
10887
10939
  this.valid = this.isValid();
10940
+ this.attributeMayContainTransientAttrs = false;
10888
10941
  return delta;
10889
10942
  }
10890
10943
  _syncFinalAttributeFromStaticTruth() {
@@ -10895,7 +10948,20 @@ class Graphic extends Node {
10895
10948
  const snapshot = this.buildStaticAttributeSnapshot();
10896
10949
  this.syncObjectToSnapshot(target, snapshot);
10897
10950
  }
10898
- submitUpdateByDelta(delta, forceUpdateTag = false) {
10951
+ mergeAttributeDeltaCategory(category, key, prev, next) {
10952
+ var _a;
10953
+ let nextCategory = key === 'stroke' || key === 'shadowBlur'
10954
+ ? classifyAttributeDelta(key, prev, next)
10955
+ : (_a = ATTRIBUTE_CATEGORY[key]) !== null && _a !== void 0 ? _a : UpdateCategory.PAINT;
10956
+ if (nextCategory & UpdateCategory.PICK) {
10957
+ nextCategory |= UpdateCategory.BOUNDS;
10958
+ }
10959
+ if (nextCategory === UpdateCategory.PAINT && this.needUpdateTag(key)) {
10960
+ nextCategory = UpdateCategory.SHAPE | UpdateCategory.BOUNDS;
10961
+ }
10962
+ return category | nextCategory;
10963
+ }
10964
+ submitUpdateByCategory(category, forceUpdateTag = false) {
10899
10965
  var _a;
10900
10966
  if (forceUpdateTag) {
10901
10967
  this.addUpdateShapeAndBoundsTag();
@@ -10903,19 +10969,15 @@ class Graphic extends Node {
10903
10969
  this.addUpdateLayoutTag();
10904
10970
  return;
10905
10971
  }
10906
- let category = UpdateCategory.NONE;
10907
- delta.forEach((entry, key) => {
10908
- let nextCategory = classifyAttributeDelta(key, entry.prev, entry.next);
10909
- if (nextCategory & UpdateCategory.PICK) {
10910
- nextCategory |= UpdateCategory.BOUNDS;
10911
- }
10912
- if (nextCategory === UpdateCategory.PAINT && this.needUpdateTag(key)) {
10913
- nextCategory = UpdateCategory.SHAPE | UpdateCategory.BOUNDS;
10914
- }
10915
- category |= nextCategory;
10916
- });
10917
10972
  if (category !== UpdateCategory.NONE) {
10918
- (_a = getStageStatePerfMonitor(this.stage)) === null || _a === void 0 ? void 0 : _a.recordCategory(category);
10973
+ const stage = this.stage;
10974
+ if (stage) {
10975
+ (_a = getActiveStageStatePerfMonitor(stage)) === null || _a === void 0 ? void 0 : _a.recordCategory(category);
10976
+ }
10977
+ }
10978
+ if ((category & BROAD_UPDATE_CATEGORY) === BROAD_UPDATE_CATEGORY) {
10979
+ this.addBroadUpdateTag();
10980
+ return;
10919
10981
  }
10920
10982
  if (category & UpdateCategory.SHAPE) {
10921
10983
  this.addUpdateShapeAndBoundsTag();
@@ -10933,36 +10995,147 @@ class Graphic extends Node {
10933
10995
  this.addUpdateLayoutTag();
10934
10996
  }
10935
10997
  }
10998
+ submitUpdateByDelta(delta, forceUpdateTag = false) {
10999
+ let category = UpdateCategory.NONE;
11000
+ delta.forEach((entry, key) => {
11001
+ category = this.mergeAttributeDeltaCategory(category, key, entry.prev, entry.next);
11002
+ });
11003
+ this.submitUpdateByCategory(category, forceUpdateTag);
11004
+ }
11005
+ submitTouchedKeyUpdate(keys, forceUpdateTag = false) {
11006
+ this.submitTouchedUpdate(forceUpdateTag || this.needUpdateTags(keys));
11007
+ }
11008
+ submitTouchedUpdate(needsShapeAndBounds) {
11009
+ if (!this.updateShapeAndBoundsTagSetted() && needsShapeAndBounds) {
11010
+ this.addUpdateShapeAndBoundsTag();
11011
+ }
11012
+ else {
11013
+ this.addUpdateBoundTag();
11014
+ }
11015
+ this.addUpdatePositionTag();
11016
+ this.addUpdateLayoutTag();
11017
+ }
10936
11018
  commitBaseAttributeMutation(forceUpdateTag = false, context) {
10937
- var _a, _b;
11019
+ var _a, _b, _c;
10938
11020
  if ((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) {
10939
- this.resolverEpoch += 1;
10940
- (_b = this.stateEngine) === null || _b === void 0 ? void 0 : _b.invalidateResolverCache();
11021
+ this.resolverEpoch = ((_b = this.resolverEpoch) !== null && _b !== void 0 ? _b : 0) + 1;
11022
+ (_c = this.stateEngine) === null || _c === void 0 ? void 0 : _c.invalidateResolverCache();
10941
11023
  this.recomputeCurrentStatePatch();
10942
11024
  }
10943
11025
  const delta = this._syncAttribute();
10944
11026
  this.submitUpdateByDelta(delta, forceUpdateTag);
10945
11027
  this.onAttributeUpdate(context);
10946
11028
  }
11029
+ canCommitBaseAttributesByTouchedKeys() {
11030
+ var _a, _b;
11031
+ if (((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) || this.resolvedStatePatch || this.attributeMayContainTransientAttrs) {
11032
+ return false;
11033
+ }
11034
+ if (!((_b = this.animates) === null || _b === void 0 ? void 0 : _b.size) && !this._animationStateManager) {
11035
+ return true;
11036
+ }
11037
+ return !this.hasAnyTrackedAnimate();
11038
+ }
11039
+ detachAttributeFromBaseAttributes() {
11040
+ if (this.attribute === this.baseAttributes) {
11041
+ this._baseAttributes = this.attribute;
11042
+ this.attribute = cloneAttributeSurface(this.attribute);
11043
+ }
11044
+ }
11045
+ commitInternalBaseAttributes(params, context) {
11046
+ if (!params || !Object.keys(params).length) {
11047
+ return;
11048
+ }
11049
+ if (this.canCommitBaseAttributesByTouchedKeys()) {
11050
+ this.commitBaseAttributesByTouchedKeys(params, false, context);
11051
+ return;
11052
+ }
11053
+ this.detachAttributeFromBaseAttributes();
11054
+ this.applyBaseAttributes(params);
11055
+ this.commitBaseAttributeMutation(false, context);
11056
+ }
11057
+ commitBaseAttributesByTouchedKeys(params, forceUpdateTag = false, context) {
11058
+ const source = params;
11059
+ const baseAttributes = this.getBaseAttributesStorage();
11060
+ let hasKeys = false;
11061
+ let needsShapeAndBounds = forceUpdateTag;
11062
+ for (const key in source) {
11063
+ if (!Object.prototype.hasOwnProperty.call(source, key)) {
11064
+ continue;
11065
+ }
11066
+ hasKeys = true;
11067
+ baseAttributes[key] = source[key];
11068
+ if (!needsShapeAndBounds && this.needUpdateTag(key)) {
11069
+ needsShapeAndBounds = true;
11070
+ }
11071
+ }
11072
+ if (!hasKeys) {
11073
+ return;
11074
+ }
11075
+ this.attribute = baseAttributes;
11076
+ this._baseAttributes = undefined;
11077
+ this.valid = this.isValid();
11078
+ this.attributeMayContainTransientAttrs = false;
11079
+ this.submitTouchedUpdate(needsShapeAndBounds);
11080
+ this.onAttributeUpdate(context);
11081
+ }
11082
+ commitBaseAttributeBySingleKey(key, value, forceUpdateTag = false, context) {
11083
+ this.getBaseAttributesStorage()[key] = value;
11084
+ this.attribute = this.getBaseAttributesStorage();
11085
+ this._baseAttributes = undefined;
11086
+ this.valid = this.isValid();
11087
+ this.attributeMayContainTransientAttrs = false;
11088
+ this.submitTouchedUpdate(forceUpdateTag || this.needUpdateTag(key));
11089
+ this.onAttributeUpdate(context);
11090
+ }
10947
11091
  applyBaseAttributes(params) {
10948
11092
  const keys = Object.keys(params);
10949
11093
  for (let i = 0; i < keys.length; i++) {
10950
11094
  const key = keys[i];
10951
- this.baseAttributes[key] = cloneAttributeValue(params[key]);
11095
+ this.getBaseAttributesStorage()[key] = params[key];
11096
+ }
11097
+ }
11098
+ applyAnimationTransientAttributes(params, forceUpdateTag = false, context) {
11099
+ const source = params;
11100
+ let target;
11101
+ let needsShapeAndBounds = forceUpdateTag;
11102
+ for (const key in source) {
11103
+ if (!Object.prototype.hasOwnProperty.call(source, key)) {
11104
+ continue;
11105
+ }
11106
+ if (!target) {
11107
+ this.detachAttributeFromBaseAttributes();
11108
+ target = this.attribute;
11109
+ }
11110
+ target[key] = source[key];
11111
+ if (!needsShapeAndBounds && this.needUpdateTag(key)) {
11112
+ needsShapeAndBounds = true;
11113
+ }
11114
+ }
11115
+ if (!target) {
11116
+ return;
10952
11117
  }
11118
+ this.attributeMayContainTransientAttrs = true;
11119
+ this.valid = this.isValid();
11120
+ this.submitTouchedUpdate(needsShapeAndBounds);
11121
+ this.onAttributeUpdate(context);
10953
11122
  }
10954
11123
  applyTransientAttributes(params, forceUpdateTag = false, context) {
11124
+ this.detachAttributeFromBaseAttributes();
10955
11125
  const delta = new Map();
10956
11126
  const keys = Object.keys(params);
10957
11127
  for (let i = 0; i < keys.length; i++) {
10958
11128
  const key = keys[i];
10959
11129
  const previousValue = this.attribute[key];
10960
11130
  const nextValue = params[key];
10961
- if (isEqual(previousValue, nextValue)) {
11131
+ if (areAttributeValuesEqual(previousValue, nextValue)) {
10962
11132
  continue;
10963
11133
  }
10964
11134
  delta.set(key, { prev: previousValue, next: nextValue });
10965
- this.attribute[key] = cloneAttributeValue(nextValue);
11135
+ this.attribute[key] = nextValue;
11136
+ }
11137
+ if (delta.size) {
11138
+ this.attributeMayContainTransientAttrs = true;
10966
11139
  }
10967
11140
  this.valid = this.isValid();
10968
11141
  this.submitUpdateByDelta(delta, forceUpdateTag);
@@ -10974,6 +11147,87 @@ class Graphic extends Node {
10974
11147
  this.submitUpdateByDelta(delta);
10975
11148
  this.onAttributeUpdate(context);
10976
11149
  }
11150
+ collectStatePatchDeltaKeys(previousPatch, nextPatch) {
11151
+ const keys = previousPatch ? Object.keys(previousPatch) : [];
11152
+ if (!nextPatch) {
11153
+ return keys;
11154
+ }
11155
+ for (const key in nextPatch) {
11156
+ if (Object.prototype.hasOwnProperty.call(nextPatch, key) &&
11157
+ !Object.prototype.hasOwnProperty.call(previousPatch !== null && previousPatch !== void 0 ? previousPatch : {}, key)) {
11158
+ keys.push(key);
11159
+ }
11160
+ }
11161
+ return keys;
11162
+ }
11163
+ getStaticTruthValueForStateKey(key, nextPatch) {
11164
+ var _a;
11165
+ const baseAttributes = ((_a = this.baseAttributes) !== null && _a !== void 0 ? _a : {});
11166
+ const patch = nextPatch;
11167
+ if (patch && Object.prototype.hasOwnProperty.call(patch, key)) {
11168
+ const patchValue = patch[key];
11169
+ const baseValue = baseAttributes[key];
11170
+ if (this.stateMergeMode === 'deep' && isPlainObjectValue(baseValue) && isPlainObjectValue(patchValue)) {
11171
+ return {
11172
+ hasValue: true,
11173
+ value: deepMergeAttributeValue(baseValue, patchValue)
11174
+ };
11175
+ }
11176
+ return {
11177
+ hasValue: true,
11178
+ value: patchValue
11179
+ };
11180
+ }
11181
+ if (Object.prototype.hasOwnProperty.call(baseAttributes, key)) {
11182
+ return {
11183
+ hasValue: true,
11184
+ value: baseAttributes[key]
11185
+ };
11186
+ }
11187
+ return {
11188
+ hasValue: false,
11189
+ value: undefined
11190
+ };
11191
+ }
11192
+ syncStatePatchDeltaToTarget(target, keys, nextPatch, collectCategory = false) {
11193
+ let category = UpdateCategory.NONE;
11194
+ for (let i = 0; i < keys.length; i++) {
11195
+ const key = keys[i];
11196
+ const previousValue = target[key];
11197
+ const next = this.getStaticTruthValueForStateKey(key, nextPatch);
11198
+ if (!next.hasValue) {
11199
+ if (Object.prototype.hasOwnProperty.call(target, key)) {
11200
+ delete target[key];
11201
+ if (collectCategory) {
11202
+ category = this.mergeAttributeDeltaCategory(category, key, previousValue, undefined);
11203
+ }
11204
+ }
11205
+ continue;
11206
+ }
11207
+ if (areAttributeValuesEqual(previousValue, next.value)) {
11208
+ continue;
11209
+ }
11210
+ const nextValue = cloneAttributeValue(next.value);
11211
+ target[key] = nextValue;
11212
+ if (collectCategory) {
11213
+ category = this.mergeAttributeDeltaCategory(category, key, previousValue, nextValue);
11214
+ }
11215
+ }
11216
+ return category;
11217
+ }
11218
+ restoreAttributeFromStatePatchDelta(previousPatch, nextPatch, context) {
11219
+ this.detachAttributeFromBaseAttributes();
11220
+ const keys = this.collectStatePatchDeltaKeys(previousPatch, nextPatch);
11221
+ const finalAttribute = this.finalAttribute;
11222
+ if (finalAttribute) {
11223
+ this.syncStatePatchDeltaToTarget(finalAttribute, keys, nextPatch, false);
11224
+ }
11225
+ const category = this.syncStatePatchDeltaToTarget(this.attribute, keys, nextPatch, true);
11226
+ this.valid = this.isValid();
11227
+ this.attributeMayContainTransientAttrs = false;
11228
+ this.submitUpdateByCategory(category);
11229
+ this.onAttributeUpdate(context);
11230
+ }
10977
11231
  setMode(mode) {
10978
11232
  mode === '3d' ? this.set3dMode() : this.set2dMode();
10979
11233
  }
@@ -10998,6 +11252,7 @@ class Graphic extends Node {
10998
11252
  return point;
10999
11253
  }
11000
11254
  onAnimateBind(animate) {
11255
+ this.detachAttributeFromBaseAttributes();
11001
11256
  this._emitCustomEvent('animate-bind', animate);
11002
11257
  }
11003
11258
  visitTrackedAnimates(cb) {
@@ -11020,8 +11275,33 @@ class Graphic extends Node {
11020
11275
  }
11021
11276
  return !!((_a = this.animates) === null || _a === void 0 ? void 0 : _a.size);
11022
11277
  }
11278
+ mayHaveTrackedAnimates() {
11279
+ var _a;
11280
+ return !!((_a = this.animates) === null || _a === void 0 ? void 0 : _a.size) || !!this._animationStateManager;
11281
+ }
11023
11282
  tryUpdateAABBBounds() {
11283
+ if (!this.shadowRoot && !(this._updateTag & UpdateTag.UPDATE_BOUNDS)) {
11284
+ return this._AABBBounds;
11285
+ }
11024
11286
  const full = this.attribute.boundsMode === 'imprecise';
11287
+ if (!this.shadowRoot) {
11288
+ const graphicService = this.getGraphicService();
11289
+ const graphicTheme = this.getGraphicTheme();
11290
+ if (!graphicService.validCheck(this.attribute, graphicTheme, this._AABBBounds, this)) {
11291
+ return this._AABBBounds;
11292
+ }
11293
+ if (!this.valid) {
11294
+ this._AABBBounds.clear();
11295
+ return this._AABBBounds;
11296
+ }
11297
+ graphicService.beforeUpdateAABBBounds(this, this.stage, true, this._AABBBounds);
11298
+ const bounds = this.doUpdateAABBBounds(full, graphicTheme);
11299
+ graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, true);
11300
+ if (this.attribute.boundsMode === 'empty') {
11301
+ bounds.clear();
11302
+ }
11303
+ return bounds;
11304
+ }
11025
11305
  if (!this.shouldUpdateAABBBounds()) {
11026
11306
  return this._AABBBounds;
11027
11307
  }
@@ -11138,13 +11418,13 @@ class Graphic extends Node {
11138
11418
  Graphic.userSymbolMap[symbolType] = _parsedPath;
11139
11419
  return _parsedPath;
11140
11420
  }
11141
- doUpdateAABBBounds(full) {
11421
+ doUpdateAABBBounds(full, graphicTheme) {
11142
11422
  this.updateAABBBoundsStamp++;
11143
- const graphicTheme = this.getGraphicTheme();
11423
+ const resolvedGraphicTheme = graphicTheme !== null && graphicTheme !== void 0 ? graphicTheme : this.getGraphicTheme();
11144
11424
  this._AABBBounds.clear();
11145
11425
  const attribute = this.attribute;
11146
- const bounds = this.updateAABBBounds(attribute, graphicTheme, this._AABBBounds, full);
11147
- const { boundsPadding = graphicTheme.boundsPadding } = attribute;
11426
+ const bounds = this.updateAABBBounds(attribute, resolvedGraphicTheme, this._AABBBounds, full);
11427
+ const { boundsPadding = resolvedGraphicTheme.boundsPadding } = attribute;
11148
11428
  const paddingArray = parsePadding(boundsPadding);
11149
11429
  if (paddingArray) {
11150
11430
  bounds.expand(paddingArray);
@@ -11255,16 +11535,117 @@ class Graphic extends Node {
11255
11535
  this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
11256
11536
  }
11257
11537
  setAttributesAndPreventAnimate(params, forceUpdateTag = false, context, ignorePriority) {
11538
+ if (!params) {
11539
+ return;
11540
+ }
11541
+ const keys = Object.keys(params);
11542
+ this.captureTransientFromAttrsBeforePreventAnimate(params, keys, context);
11543
+ this.syncFinalAttributesFromUpdateContext(context);
11258
11544
  this.visitTrackedAnimates(animate => {
11259
11545
  if (animate.priority === Infinity && !ignorePriority) {
11260
11546
  return;
11261
11547
  }
11262
- Object.keys(params).forEach(key => {
11263
- animate.preventAttr(key);
11264
- });
11548
+ animate.preventAttrs(keys);
11265
11549
  });
11266
11550
  this.applyTransientAttributes(params, forceUpdateTag, context);
11267
11551
  }
11552
+ syncFinalAttributesFromUpdateContext(context) {
11553
+ var _a;
11554
+ const updateType = context === null || context === void 0 ? void 0 : context.type;
11555
+ if (updateType === AttributeUpdateType.STATE ||
11556
+ (updateType != null &&
11557
+ updateType >= AttributeUpdateType.ANIMATE_BIND &&
11558
+ updateType <= AttributeUpdateType.ANIMATE_END)) {
11559
+ return;
11560
+ }
11561
+ const finalAttrs = (_a = this.context) === null || _a === void 0 ? void 0 : _a.finalAttrs;
11562
+ const setFinalAttributes = this.setFinalAttributes;
11563
+ if (finalAttrs && typeof setFinalAttributes === 'function') {
11564
+ setFinalAttributes.call(this, finalAttrs);
11565
+ }
11566
+ }
11567
+ captureTransientFromAttrsBeforePreventAnimate(params, keys, context) {
11568
+ var _a, _b;
11569
+ const graphicContext = this.context;
11570
+ const diffAttrs = (_a = graphicContext === null || graphicContext === void 0 ? void 0 : graphicContext.diffAttrs) !== null && _a !== void 0 ? _a : params;
11571
+ const updateType = context === null || context === void 0 ? void 0 : context.type;
11572
+ if (!keys.length ||
11573
+ !diffAttrs ||
11574
+ updateType === AttributeUpdateType.STATE ||
11575
+ (updateType != null &&
11576
+ updateType >= AttributeUpdateType.ANIMATE_BIND &&
11577
+ updateType <= AttributeUpdateType.ANIMATE_END)) {
11578
+ return;
11579
+ }
11580
+ const sameDiffAttrs = this.transientFromAttrsBeforePreventAnimateDiffAttrs === diffAttrs;
11581
+ let fromAttrs = sameDiffAttrs
11582
+ ? (_b = this.transientFromAttrsBeforePreventAnimate) !== null && _b !== void 0 ? _b : null
11583
+ : null;
11584
+ if (!sameDiffAttrs) {
11585
+ this.transientFromAttrsBeforePreventAnimate = null;
11586
+ this.transientFromAttrsBeforePreventAnimateDiffAttrs = null;
11587
+ }
11588
+ let captured = false;
11589
+ for (let i = 0; i < keys.length; i++) {
11590
+ const key = keys[i];
11591
+ if (!Object.prototype.hasOwnProperty.call(diffAttrs, key)) {
11592
+ continue;
11593
+ }
11594
+ const previousValue = this.attribute[key];
11595
+ const nextValue = params[key];
11596
+ if (isEqual(previousValue, nextValue)) {
11597
+ continue;
11598
+ }
11599
+ fromAttrs !== null && fromAttrs !== void 0 ? fromAttrs : (fromAttrs = {});
11600
+ fromAttrs[key] = cloneAttributeValue(previousValue);
11601
+ captured = true;
11602
+ }
11603
+ if (captured) {
11604
+ this.transientFromAttrsBeforePreventAnimate = fromAttrs;
11605
+ this.transientFromAttrsBeforePreventAnimateDiffAttrs = diffAttrs;
11606
+ }
11607
+ }
11608
+ consumeTransientFromAttrsBeforePreventAnimate(diffAttrs) {
11609
+ const transientFromAttrs = this.transientFromAttrsBeforePreventAnimate;
11610
+ const sourceDiffAttrs = this.transientFromAttrsBeforePreventAnimateDiffAttrs;
11611
+ if (!transientFromAttrs || !sourceDiffAttrs) {
11612
+ return null;
11613
+ }
11614
+ for (const key in diffAttrs) {
11615
+ if (Object.prototype.hasOwnProperty.call(diffAttrs, key) &&
11616
+ (!Object.prototype.hasOwnProperty.call(sourceDiffAttrs, key) || !isEqual(sourceDiffAttrs[key], diffAttrs[key]))) {
11617
+ return null;
11618
+ }
11619
+ }
11620
+ let fromAttrs = null;
11621
+ let remaining = false;
11622
+ for (const key in transientFromAttrs) {
11623
+ if (!Object.prototype.hasOwnProperty.call(transientFromAttrs, key)) {
11624
+ continue;
11625
+ }
11626
+ if (Object.prototype.hasOwnProperty.call(diffAttrs, key)) {
11627
+ fromAttrs !== null && fromAttrs !== void 0 ? fromAttrs : (fromAttrs = {});
11628
+ fromAttrs[key] = transientFromAttrs[key];
11629
+ continue;
11630
+ }
11631
+ remaining = true;
11632
+ }
11633
+ if (remaining) {
11634
+ const nextTransientFromAttrs = {};
11635
+ for (const key in transientFromAttrs) {
11636
+ if (Object.prototype.hasOwnProperty.call(transientFromAttrs, key) &&
11637
+ !Object.prototype.hasOwnProperty.call(diffAttrs, key)) {
11638
+ nextTransientFromAttrs[key] = transientFromAttrs[key];
11639
+ }
11640
+ }
11641
+ this.transientFromAttrsBeforePreventAnimate = nextTransientFromAttrs;
11642
+ }
11643
+ else {
11644
+ this.transientFromAttrsBeforePreventAnimate = null;
11645
+ this.transientFromAttrsBeforePreventAnimateDiffAttrs = null;
11646
+ }
11647
+ return fromAttrs;
11648
+ }
11268
11649
  setAttributes(params, forceUpdateTag = false, context) {
11269
11650
  if (!params) {
11270
11651
  return;
@@ -11274,7 +11655,7 @@ class Graphic extends Node {
11274
11655
  if (params.background) {
11275
11656
  this.loadImage(params.background, true);
11276
11657
  }
11277
- if (isExternalTexture(params.texture)) {
11658
+ if (params.texture && isExternalTexture(params.texture)) {
11278
11659
  this.loadImage(params.texture, false);
11279
11660
  }
11280
11661
  if (params.shadowGraphic) {
@@ -11283,14 +11664,25 @@ class Graphic extends Node {
11283
11664
  this._setAttributes(params, forceUpdateTag, context);
11284
11665
  }
11285
11666
  _setAttributes(params, forceUpdateTag = false, context) {
11667
+ if (this.canCommitBaseAttributesByTouchedKeys()) {
11668
+ this.commitBaseAttributesByTouchedKeys(params, forceUpdateTag, context);
11669
+ return;
11670
+ }
11671
+ this.detachAttributeFromBaseAttributes();
11286
11672
  this.applyBaseAttributes(params);
11287
11673
  this.commitBaseAttributeMutation(forceUpdateTag, context);
11288
11674
  }
11289
11675
  setAttribute(key, value, forceUpdateTag, context) {
11290
11676
  const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({ [key]: value }, this.attribute, key, context);
11291
11677
  if (!params) {
11292
- this.applyBaseAttributes({ [key]: value });
11293
- this.commitBaseAttributeMutation(!!forceUpdateTag, context);
11678
+ if (this.canCommitBaseAttributesByTouchedKeys()) {
11679
+ this.commitBaseAttributeBySingleKey(key, value, !!forceUpdateTag, context);
11680
+ }
11681
+ else {
11682
+ const nextAttrs = { [key]: value };
11683
+ this.applyBaseAttributes(nextAttrs);
11684
+ this.commitBaseAttributeMutation(!!forceUpdateTag, context);
11685
+ }
11294
11686
  }
11295
11687
  else {
11296
11688
  this._setAttributes(params, forceUpdateTag, context);
@@ -11327,16 +11719,15 @@ class Graphic extends Node {
11327
11719
  const context = { type: AttributeUpdateType.INIT };
11328
11720
  params =
11329
11721
  (this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context)) || params;
11330
- this.baseAttributes = cloneAttributeValue(params);
11331
- if (!this.attribute) {
11332
- this.attribute = {};
11333
- }
11722
+ this.attribute = params;
11723
+ this._baseAttributes = undefined;
11334
11724
  this.resolvedStatePatch = undefined;
11335
- this._syncAttribute();
11725
+ this.attributeMayContainTransientAttrs = false;
11726
+ this.valid = this.isValid();
11336
11727
  if (params.background) {
11337
11728
  this.loadImage(params.background, true);
11338
11729
  }
11339
- if (isExternalTexture(params.texture)) {
11730
+ if (params.texture && isExternalTexture(params.texture)) {
11340
11731
  this.loadImage(params.texture, false);
11341
11732
  }
11342
11733
  if (params.shadowGraphic) {
@@ -11361,18 +11752,20 @@ class Graphic extends Node {
11361
11752
  y = params.y;
11362
11753
  delete params.x;
11363
11754
  delete params.y;
11364
- this.applyBaseAttributes(params);
11365
11755
  }
11366
11756
  const attribute = this.baseAttributes;
11367
11757
  const postMatrix = attribute.postMatrix;
11758
+ const nextAttrs = (params || {});
11368
11759
  if (!postMatrix) {
11369
- attribute.x = ((_a = attribute.x) !== null && _a !== void 0 ? _a : DefaultTransform.x) + x;
11370
- attribute.y = ((_b = attribute.y) !== null && _b !== void 0 ? _b : DefaultTransform.y) + y;
11760
+ nextAttrs.x = ((_a = attribute.x) !== null && _a !== void 0 ? _a : DefaultTransform.x) + x;
11761
+ nextAttrs.y = ((_b = attribute.y) !== null && _b !== void 0 ? _b : DefaultTransform.y) + y;
11371
11762
  }
11372
11763
  else {
11373
- application.transformUtil.fromMatrix(postMatrix, postMatrix).translate(x, y);
11764
+ const nextPostMatrix = postMatrix.clone();
11765
+ application.transformUtil.fromMatrix(nextPostMatrix, nextPostMatrix).translate(x, y);
11766
+ nextAttrs.postMatrix = nextPostMatrix;
11374
11767
  }
11375
- this.commitBaseAttributeMutation(false, context);
11768
+ this.commitInternalBaseAttributes(nextAttrs, context);
11376
11769
  return this;
11377
11770
  }
11378
11771
  translateTo(x, y) {
@@ -11386,13 +11779,10 @@ class Graphic extends Node {
11386
11779
  const params = this.onBeforeAttributeUpdate &&
11387
11780
  this.onBeforeAttributeUpdate({ x, y }, this.attribute, tempConstantXYKey, context);
11388
11781
  if (params) {
11389
- this.applyBaseAttributes(params);
11390
- this.commitBaseAttributeMutation(false, context);
11782
+ this.commitInternalBaseAttributes(params, context);
11391
11783
  return this;
11392
11784
  }
11393
- attribute.x = x;
11394
- attribute.y = y;
11395
- this.commitBaseAttributeMutation(false, context);
11785
+ this.commitInternalBaseAttributes({ x, y }, context);
11396
11786
  return this;
11397
11787
  }
11398
11788
  scale(scaleX, scaleY, scaleCenter) {
@@ -11410,22 +11800,25 @@ class Graphic extends Node {
11410
11800
  scaleY = params.scaleY;
11411
11801
  delete params.scaleX;
11412
11802
  delete params.scaleY;
11413
- this.applyBaseAttributes(params);
11414
11803
  }
11415
11804
  const attribute = this.baseAttributes;
11805
+ const nextAttrs = (params || {});
11416
11806
  if (!scaleCenter) {
11417
- attribute.scaleX = ((_a = attribute.scaleX) !== null && _a !== void 0 ? _a : DefaultTransform.scaleX) * scaleX;
11418
- attribute.scaleY = ((_b = attribute.scaleY) !== null && _b !== void 0 ? _b : DefaultTransform.scaleY) * scaleY;
11807
+ nextAttrs.scaleX = ((_a = attribute.scaleX) !== null && _a !== void 0 ? _a : DefaultTransform.scaleX) * scaleX;
11808
+ nextAttrs.scaleY = ((_b = attribute.scaleY) !== null && _b !== void 0 ? _b : DefaultTransform.scaleY) * scaleY;
11419
11809
  }
11420
11810
  else {
11421
- let { postMatrix } = this.attribute;
11811
+ let { postMatrix } = this.baseAttributes;
11422
11812
  if (!postMatrix) {
11423
11813
  postMatrix = new Matrix();
11424
- attribute.postMatrix = postMatrix;
11814
+ }
11815
+ else {
11816
+ postMatrix = postMatrix.clone();
11425
11817
  }
11426
11818
  application.transformUtil.fromMatrix(postMatrix, postMatrix).scale(scaleX, scaleY, scaleCenter);
11819
+ nextAttrs.postMatrix = postMatrix;
11427
11820
  }
11428
- this.commitBaseAttributeMutation(false, context);
11821
+ this.commitInternalBaseAttributes(nextAttrs, context);
11429
11822
  return this;
11430
11823
  }
11431
11824
  scaleTo(scaleX, scaleY) {
@@ -11439,13 +11832,10 @@ class Graphic extends Node {
11439
11832
  const params = this.onBeforeAttributeUpdate &&
11440
11833
  this.onBeforeAttributeUpdate({ scaleX, scaleY }, this.attribute, tempConstantScaleXYKey, context);
11441
11834
  if (params) {
11442
- this.applyBaseAttributes(params);
11443
- this.commitBaseAttributeMutation(false, context);
11835
+ this.commitInternalBaseAttributes(params, context);
11444
11836
  return this;
11445
11837
  }
11446
- attribute.scaleX = scaleX;
11447
- attribute.scaleY = scaleY;
11448
- this.commitBaseAttributeMutation(false, context);
11838
+ this.commitInternalBaseAttributes({ scaleX, scaleY }, context);
11449
11839
  return this;
11450
11840
  }
11451
11841
  rotate(angle, rotateCenter) {
@@ -11458,21 +11848,24 @@ class Graphic extends Node {
11458
11848
  this.onBeforeAttributeUpdate({ angle, rotateCenter }, this.attribute, tempConstantAngleKey, context);
11459
11849
  if (params) {
11460
11850
  delete params.angle;
11461
- this.applyBaseAttributes(params);
11462
11851
  }
11463
11852
  const attribute = this.baseAttributes;
11853
+ const nextAttrs = (params || {});
11464
11854
  if (!rotateCenter) {
11465
- attribute.angle = ((_a = attribute.angle) !== null && _a !== void 0 ? _a : DefaultTransform.angle) + angle;
11855
+ nextAttrs.angle = ((_a = attribute.angle) !== null && _a !== void 0 ? _a : DefaultTransform.angle) + angle;
11466
11856
  }
11467
11857
  else {
11468
11858
  let { postMatrix } = this.baseAttributes;
11469
11859
  if (!postMatrix) {
11470
11860
  postMatrix = new Matrix();
11471
- this.baseAttributes.postMatrix = postMatrix;
11861
+ }
11862
+ else {
11863
+ postMatrix = postMatrix.clone();
11472
11864
  }
11473
11865
  application.transformUtil.fromMatrix(postMatrix, postMatrix).rotate(angle, rotateCenter);
11866
+ nextAttrs.postMatrix = postMatrix;
11474
11867
  }
11475
- this.commitBaseAttributeMutation(false, context);
11868
+ this.commitInternalBaseAttributes(nextAttrs, context);
11476
11869
  return this;
11477
11870
  }
11478
11871
  rotateTo(angle) {
@@ -11486,12 +11879,10 @@ class Graphic extends Node {
11486
11879
  const params = this.onBeforeAttributeUpdate &&
11487
11880
  this.onBeforeAttributeUpdate(angle, this.attribute, tempConstantAngleKey, context);
11488
11881
  if (params) {
11489
- this.applyBaseAttributes(params);
11490
- this.commitBaseAttributeMutation(false, context);
11882
+ this.commitInternalBaseAttributes(params, context);
11491
11883
  return this;
11492
11884
  }
11493
- attribute.angle = angle;
11494
- this.commitBaseAttributeMutation(false, context);
11885
+ this.commitInternalBaseAttributes({ angle }, context);
11495
11886
  return this;
11496
11887
  }
11497
11888
  skewTo(b, c) {
@@ -11525,9 +11916,18 @@ class Graphic extends Node {
11525
11916
  }
11526
11917
  getState(stateName) {
11527
11918
  var _a;
11528
- return (_a = this.states) === null || _a === void 0 ? void 0 : _a[stateName];
11919
+ return (_a = this.states) === null || _a === void 0 ? void 0 : _a[stateName];
11920
+ }
11921
+ getStateResolveBaseAttrs() {
11922
+ var _a;
11923
+ return ((_a = this.baseAttributes) !== null && _a !== void 0 ? _a : this.attribute);
11924
+ }
11925
+ syncStateResolveContext(stateResolveBaseAttrs = this.getStateResolveBaseAttrs()) {
11926
+ var _a;
11927
+ (_a = this.stateEngine) === null || _a === void 0 ? void 0 : _a.setResolveContext(this, stateResolveBaseAttrs);
11928
+ return stateResolveBaseAttrs;
11529
11929
  }
11530
- createStateModel() {
11930
+ createStateModel(stateResolveBaseAttrs = this.getStateResolveBaseAttrs()) {
11531
11931
  const { compiledDefinitions, stateProxyEligibility, stateProxyModeKey } = this.resolveEffectiveCompiledDefinitions();
11532
11932
  this.compiledStateDefinitions = compiledDefinitions;
11533
11933
  if (!compiledDefinitions) {
@@ -11555,6 +11955,7 @@ class Graphic extends Node {
11555
11955
  this.stateEngineMergeMode = this.stateMergeMode;
11556
11956
  this.stateEngineStateProxyModeKey = stateProxyModeKey;
11557
11957
  }
11958
+ this.syncStateResolveContext(stateResolveBaseAttrs);
11558
11959
  return new StateModel({
11559
11960
  states: this.states,
11560
11961
  currentStates: this.currentStates,
@@ -11563,25 +11964,229 @@ class Graphic extends Node {
11563
11964
  stateEngine: this.stateEngine
11564
11965
  });
11565
11966
  }
11967
+ resolveSimpleLocalStateTransition(states, previousStates) {
11968
+ var _a;
11969
+ if (!this.states ||
11970
+ this.stateProxy ||
11971
+ this.stateSort ||
11972
+ this.stateMergeMode === 'deep' ||
11973
+ this.parent ||
11974
+ ((_a = this.stage) === null || _a === void 0 ? void 0 : _a.rootSharedStateScope) ||
11975
+ this.boundSharedStateScope) {
11976
+ return null;
11977
+ }
11978
+ if (states.length === 1) {
11979
+ const stateName = states[0];
11980
+ const hasDefinition = Object.prototype.hasOwnProperty.call(this.states, stateName);
11981
+ const nextStates = [stateName];
11982
+ const changed = !this.sameStateNames(previousStates, nextStates);
11983
+ const resolvedStateAttrs = {};
11984
+ if (hasDefinition) {
11985
+ const attrs = this.states[stateName];
11986
+ if (attrs != null) {
11987
+ if (!isPlainObjectValue(attrs)) {
11988
+ return null;
11989
+ }
11990
+ const keys = Object.keys(attrs);
11991
+ for (let keyIndex = 0; keyIndex < keys.length; keyIndex++) {
11992
+ const key = keys[keyIndex];
11993
+ if (FULL_STATE_DEFINITION_KEYS.has(key)) {
11994
+ return null;
11995
+ }
11996
+ const attrValue = attrs[key];
11997
+ resolvedStateAttrs[key] = isPlainObjectValue(attrValue)
11998
+ ? cloneAttributeValue(attrValue)
11999
+ : attrValue;
12000
+ }
12001
+ }
12002
+ }
12003
+ return {
12004
+ changed,
12005
+ states: nextStates,
12006
+ effectiveStates: nextStates,
12007
+ resolvedStateAttrs
12008
+ };
12009
+ }
12010
+ const uniqueStates = Array.from(new Set(states));
12011
+ const withDefinition = [];
12012
+ const withoutDefinition = [];
12013
+ for (let i = 0; i < uniqueStates.length; i++) {
12014
+ const stateName = uniqueStates[i];
12015
+ if (Object.prototype.hasOwnProperty.call(this.states, stateName)) {
12016
+ withDefinition.push(stateName);
12017
+ }
12018
+ else {
12019
+ withoutDefinition.push(stateName);
12020
+ }
12021
+ }
12022
+ withDefinition.sort((left, right) => left.localeCompare(right));
12023
+ const nextStates = withDefinition.concat(withoutDefinition);
12024
+ const changed = !this.sameStateNames(previousStates, nextStates);
12025
+ const resolvedStateAttrs = {};
12026
+ for (let i = 0; i < nextStates.length; i++) {
12027
+ const stateName = nextStates[i];
12028
+ const hasDefinition = Object.prototype.hasOwnProperty.call(this.states, stateName);
12029
+ if (!hasDefinition) {
12030
+ continue;
12031
+ }
12032
+ const attrs = this.states[stateName];
12033
+ if (attrs == null) {
12034
+ continue;
12035
+ }
12036
+ if (!isPlainObjectValue(attrs)) {
12037
+ return null;
12038
+ }
12039
+ const keys = Object.keys(attrs);
12040
+ for (let keyIndex = 0; keyIndex < keys.length; keyIndex++) {
12041
+ const key = keys[keyIndex];
12042
+ if (FULL_STATE_DEFINITION_KEYS.has(key)) {
12043
+ return null;
12044
+ }
12045
+ const attrValue = attrs[key];
12046
+ resolvedStateAttrs[key] = isPlainObjectValue(attrValue)
12047
+ ? cloneAttributeValue(attrValue)
12048
+ : attrValue;
12049
+ }
12050
+ }
12051
+ return {
12052
+ changed,
12053
+ states: nextStates,
12054
+ effectiveStates: nextStates,
12055
+ resolvedStateAttrs
12056
+ };
12057
+ }
12058
+ resolveGraphicStateTransition(states, previousStates, forceResolverRefresh = false) {
12059
+ var _a, _b;
12060
+ let transition = this.resolveSimpleLocalStateTransition(states, previousStates);
12061
+ const isSimpleLocalTransition = !!transition;
12062
+ let resolvedStateAttrs;
12063
+ if (transition) {
12064
+ resolvedStateAttrs = transition.resolvedStateAttrs;
12065
+ }
12066
+ else {
12067
+ const stateResolveBaseAttrs = this.getStateResolveBaseAttrs();
12068
+ const stateModel = this.createStateModel(stateResolveBaseAttrs);
12069
+ if (forceResolverRefresh) {
12070
+ (_a = this.stateEngine) === null || _a === void 0 ? void 0 : _a.invalidateResolverCache();
12071
+ }
12072
+ transition = stateModel.useStates(states);
12073
+ resolvedStateAttrs =
12074
+ this.stateEngine && this.compiledStateDefinitions
12075
+ ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
12076
+ }
12077
+ const effectiveStates = (_b = transition.effectiveStates) !== null && _b !== void 0 ? _b : transition.states;
12078
+ return {
12079
+ transition,
12080
+ effectiveStates: effectiveStates,
12081
+ resolvedStateAttrs,
12082
+ isSimpleLocalTransition
12083
+ };
12084
+ }
12085
+ normalizeSetStatesOptions(options) {
12086
+ if (options && typeof options === 'object') {
12087
+ return {
12088
+ hasAnimation: options.animate,
12089
+ animateSameStatePatchChange: options.animateSameStatePatchChange === true,
12090
+ shouldRefreshSameStatePatch: true
12091
+ };
12092
+ }
12093
+ return {
12094
+ hasAnimation: typeof options === 'boolean' ? options : undefined,
12095
+ animateSameStatePatchChange: false,
12096
+ shouldRefreshSameStatePatch: false
12097
+ };
12098
+ }
12099
+ sameStatePatches(left, right) {
12100
+ const leftRecord = (left !== null && left !== void 0 ? left : {});
12101
+ const rightRecord = (right !== null && right !== void 0 ? right : {});
12102
+ const keys = new Set([...Object.keys(leftRecord), ...Object.keys(rightRecord)]);
12103
+ for (const key of keys) {
12104
+ const hasLeft = Object.prototype.hasOwnProperty.call(leftRecord, key);
12105
+ const hasRight = Object.prototype.hasOwnProperty.call(rightRecord, key);
12106
+ if (hasLeft !== hasRight) {
12107
+ return false;
12108
+ }
12109
+ if (!areAttributeValuesEqual(leftRecord[key], rightRecord[key])) {
12110
+ return false;
12111
+ }
12112
+ }
12113
+ return true;
12114
+ }
12115
+ commitSameStatePatchRefresh(states, hasAnimation, animateSameStatePatchChange = false) {
12116
+ var _a;
12117
+ const previousStates = (_a = this.currentStates) !== null && _a !== void 0 ? _a : EMPTY_STATE_NAMES;
12118
+ const previousResolvedStatePatch = this.resolvedStatePatch;
12119
+ const { transition, effectiveStates, resolvedStateAttrs, isSimpleLocalTransition } = this.resolveGraphicStateTransition(states, previousStates, true);
12120
+ const patchChanged = !this.sameStatePatches(previousResolvedStatePatch, resolvedStateAttrs);
12121
+ if (patchChanged &&
12122
+ !this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, false)) {
12123
+ return;
12124
+ }
12125
+ this.currentStates = transition.states;
12126
+ this.effectiveStates = isSimpleLocalTransition ? effectiveStates : [...effectiveStates];
12127
+ this.resolvedStatePatch = resolvedStateAttrs;
12128
+ this.sharedStateDirty = false;
12129
+ this.syncSharedStateActiveRegistrations();
12130
+ if (!patchChanged) {
12131
+ return;
12132
+ }
12133
+ if (this.stage) {
12134
+ const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
12135
+ perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.incrementCounter('stateCommits');
12136
+ perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordEvent('state-commit', {
12137
+ graphicId: this._uid,
12138
+ targetStates: [...transition.states]
12139
+ });
12140
+ }
12141
+ if (hasAnimation && animateSameStatePatchChange) {
12142
+ this._syncFinalAttributeFromStaticTruth();
12143
+ this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, false, undefined, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch));
12144
+ }
12145
+ else {
12146
+ this.stopStateAnimates();
12147
+ if (this.attributeMayContainTransientAttrs) {
12148
+ this._restoreAttributeFromStaticTruth({ type: AttributeUpdateType.STATE });
12149
+ }
12150
+ else {
12151
+ this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
12152
+ type: AttributeUpdateType.STATE
12153
+ });
12154
+ }
12155
+ this.emitStateUpdateEvent();
12156
+ }
12157
+ }
11566
12158
  resolveStateAnimateConfig(animateConfig) {
11567
12159
  var _a, _b, _c;
11568
12160
  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;
11569
12161
  }
11570
- applyStateAttrs(attrs, stateNames, hasAnimation, isClear, animateConfig) {
12162
+ applyStateAttrs(attrs, stateNames, hasAnimation, isClear, animateConfig, extraAnimateAttrs) {
11571
12163
  const resolvedAnimateConfig = hasAnimation ? this.resolveStateAnimateConfig(animateConfig) : undefined;
11572
- const transitionOptions = resolvedAnimateConfig ? { animateConfig: resolvedAnimateConfig } : undefined;
12164
+ const transitionOptions = resolvedAnimateConfig
12165
+ ? {
12166
+ animateConfig: resolvedAnimateConfig,
12167
+ extraAnimateAttrs: extraAnimateAttrs,
12168
+ shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this)
12169
+ }
12170
+ : undefined;
11573
12171
  if (isClear) {
11574
12172
  this.getStateTransitionOrchestrator().applyClearTransition(this, attrs, hasAnimation, stateNames, transitionOptions);
11575
12173
  return;
11576
12174
  }
11577
12175
  const plan = this.getStateTransitionOrchestrator().analyzeTransition({}, attrs, stateNames, hasAnimation, {
11578
12176
  noWorkAnimateAttr: this.getNoWorkAnimateAttr(),
11579
- animateConfig: resolvedAnimateConfig
12177
+ animateConfig: resolvedAnimateConfig,
12178
+ extraAnimateAttrs: extraAnimateAttrs,
12179
+ shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this)
11580
12180
  });
11581
12181
  this.getStateTransitionOrchestrator().applyTransition(this, plan, hasAnimation, transitionOptions);
11582
12182
  }
11583
- updateNormalAttrs(stateAttrs) {
11584
- this._deprecatedNormalAttrsView = cloneAttributeValue(this.baseAttributes);
12183
+ updateNormalAttrs(_stateAttrs) {
12184
+ }
12185
+ getStateTransitionDefaultAttribute(key, targetAttrs) {
12186
+ return this.getDefaultAttribute(key);
12187
+ }
12188
+ shouldSkipStateTransitionDefaultAttribute(_key, _targetAttrs) {
12189
+ return false;
11585
12190
  }
11586
12191
  stopStateAnimates(type = 'end') {
11587
12192
  const stopAnimationState = this.stopAnimationState;
@@ -11589,6 +12194,9 @@ class Graphic extends Node {
11589
12194
  stopAnimationState.call(this, 'state', type);
11590
12195
  return;
11591
12196
  }
12197
+ if (!this.mayHaveTrackedAnimates()) {
12198
+ return;
12199
+ }
11592
12200
  const stateAnimates = [];
11593
12201
  this.visitTrackedAnimates(animate => {
11594
12202
  if (animate.stateNames) {
@@ -11607,7 +12215,8 @@ class Graphic extends Node {
11607
12215
  }
11608
12216
  clearStates(hasAnimation) {
11609
12217
  var _a, _b, _c;
11610
- const previousStates = this.currentStates ? this.currentStates.slice() : [];
12218
+ const previousStates = (_a = this.currentStates) !== null && _a !== void 0 ? _a : EMPTY_STATE_NAMES;
12219
+ const previousResolvedStatePatch = this.resolvedStatePatch;
11611
12220
  const transition = this.createStateModel().clearStates();
11612
12221
  if (!transition.changed && previousStates.length === 0) {
11613
12222
  this.currentStates = [];
@@ -11617,7 +12226,9 @@ class Graphic extends Node {
11617
12226
  this.clearSharedStateActiveRegistrations();
11618
12227
  return;
11619
12228
  }
11620
- const resolvedStateAttrs = cloneAttributeValue(((_a = this.baseAttributes) !== null && _a !== void 0 ? _a : {}));
12229
+ const resolvedStateAttrs = hasAnimation || this.hasCustomEvent('beforeStateUpdate')
12230
+ ? cloneAttributeValue(((_b = this.baseAttributes) !== null && _b !== void 0 ? _b : {}))
12231
+ : ((_c = this.baseAttributes) !== null && _c !== void 0 ? _c : {});
11621
12232
  if (transition.changed &&
11622
12233
  !this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, true)) {
11623
12234
  return;
@@ -11627,19 +12238,29 @@ class Graphic extends Node {
11627
12238
  this.resolvedStatePatch = undefined;
11628
12239
  this.sharedStateDirty = false;
11629
12240
  this.clearSharedStateActiveRegistrations();
11630
- (_b = getStageStatePerfMonitor(this.stage)) === null || _b === void 0 ? void 0 : _b.incrementCounter('stateCommits');
11631
- (_c = getStageStatePerfMonitor(this.stage)) === null || _c === void 0 ? void 0 : _c.recordEvent('state-commit', {
11632
- graphicId: this._uid,
11633
- targetStates: []
11634
- });
12241
+ if (this.stage) {
12242
+ const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
12243
+ perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.incrementCounter('stateCommits');
12244
+ perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordEvent('state-commit', {
12245
+ graphicId: this._uid,
12246
+ targetStates: []
12247
+ });
12248
+ }
11635
12249
  if (hasAnimation) {
11636
12250
  this._syncFinalAttributeFromStaticTruth();
11637
- this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, true);
12251
+ this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, true, undefined, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch));
11638
12252
  }
11639
12253
  else {
11640
12254
  this.stopStateAnimates();
11641
- this._restoreAttributeFromStaticTruth({ type: AttributeUpdateType.STATE });
11642
- this._emitCustomEvent('afterStateUpdate', { type: AttributeUpdateType.STATE });
12255
+ if (this.attributeMayContainTransientAttrs) {
12256
+ this._restoreAttributeFromStaticTruth({ type: AttributeUpdateType.STATE });
12257
+ }
12258
+ else {
12259
+ this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, undefined, {
12260
+ type: AttributeUpdateType.STATE
12261
+ });
12262
+ }
12263
+ this.emitStateUpdateEvent();
11643
12264
  }
11644
12265
  }
11645
12266
  removeState(stateName, hasAnimation) {
@@ -11661,44 +12282,76 @@ class Graphic extends Node {
11661
12282
  }
11662
12283
  this.useStates(transition.states, hasAnimation);
11663
12284
  }
12285
+ setStates(states, options) {
12286
+ var _a, _b, _c;
12287
+ const { hasAnimation, animateSameStatePatchChange, shouldRefreshSameStatePatch } = this.normalizeSetStatesOptions(options);
12288
+ const nextStates = (states === null || states === void 0 ? void 0 : states.length) ? states : EMPTY_STATE_NAMES;
12289
+ const hasCurrentState = !!((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) ||
12290
+ !!((_b = this.effectiveStates) === null || _b === void 0 ? void 0 : _b.length) ||
12291
+ !!this.resolvedStatePatch ||
12292
+ !!((_c = this.registeredActiveScopes) === null || _c === void 0 ? void 0 : _c.size);
12293
+ if (!nextStates.length) {
12294
+ if (!hasCurrentState && !this.sharedStateDirty) {
12295
+ return;
12296
+ }
12297
+ this.clearStates(hasAnimation);
12298
+ return;
12299
+ }
12300
+ if (this.sameStateNames(this.currentStates, nextStates)) {
12301
+ if (shouldRefreshSameStatePatch) {
12302
+ this.commitSameStatePatchRefresh(nextStates, hasAnimation, animateSameStatePatchChange);
12303
+ return;
12304
+ }
12305
+ if (this.sharedStateDirty) {
12306
+ this.refreshSharedStateBeforeRender();
12307
+ }
12308
+ return;
12309
+ }
12310
+ this.useStates(nextStates, hasAnimation);
12311
+ }
11664
12312
  useStates(states, hasAnimation) {
11665
- var _a, _b, _c, _d, _e;
12313
+ var _a;
11666
12314
  if (!states.length) {
11667
12315
  this.clearStates(hasAnimation);
11668
12316
  return;
11669
12317
  }
11670
- const previousStates = this.currentStates ? this.currentStates.slice() : [];
11671
- const stateResolveBaseAttrs = ((_a = this.baseAttributes) !== null && _a !== void 0 ? _a : this.attribute);
11672
- const stateModel = this.createStateModel();
11673
- (_b = this.stateEngine) === null || _b === void 0 ? void 0 : _b.setResolveContext(this, stateResolveBaseAttrs);
11674
- const transition = stateModel.useStates(states);
12318
+ const previousStates = (_a = this.currentStates) !== null && _a !== void 0 ? _a : EMPTY_STATE_NAMES;
12319
+ const previousResolvedStatePatch = this.resolvedStatePatch;
12320
+ const { transition, effectiveStates, resolvedStateAttrs, isSimpleLocalTransition } = this.resolveGraphicStateTransition(states, previousStates);
11675
12321
  if (!transition.changed && this.sameStateNames(previousStates, transition.states)) {
11676
12322
  return;
11677
12323
  }
11678
- const effectiveStates = (_c = transition.effectiveStates) !== null && _c !== void 0 ? _c : transition.states;
11679
- const resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions
11680
- ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
11681
12324
  if (!this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, false)) {
11682
12325
  return;
11683
12326
  }
11684
12327
  this.currentStates = transition.states;
11685
- this.effectiveStates = [...effectiveStates];
11686
- this.resolvedStatePatch = Object.assign({}, resolvedStateAttrs);
12328
+ this.effectiveStates = isSimpleLocalTransition ? effectiveStates : [...effectiveStates];
12329
+ this.resolvedStatePatch = resolvedStateAttrs;
11687
12330
  this.sharedStateDirty = false;
11688
12331
  this.syncSharedStateActiveRegistrations();
11689
- (_d = getStageStatePerfMonitor(this.stage)) === null || _d === void 0 ? void 0 : _d.incrementCounter('stateCommits');
11690
- (_e = getStageStatePerfMonitor(this.stage)) === null || _e === void 0 ? void 0 : _e.recordEvent('state-commit', {
11691
- graphicId: this._uid,
11692
- targetStates: [...transition.states]
11693
- });
12332
+ if (this.stage) {
12333
+ const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
12334
+ perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.incrementCounter('stateCommits');
12335
+ perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordEvent('state-commit', {
12336
+ graphicId: this._uid,
12337
+ targetStates: [...transition.states]
12338
+ });
12339
+ }
11694
12340
  if (hasAnimation) {
11695
12341
  this._syncFinalAttributeFromStaticTruth();
11696
- this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation);
12342
+ this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, false, undefined, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch));
11697
12343
  }
11698
12344
  else {
11699
12345
  this.stopStateAnimates();
11700
- this._restoreAttributeFromStaticTruth({ type: AttributeUpdateType.STATE });
11701
- this._emitCustomEvent('afterStateUpdate', { type: AttributeUpdateType.STATE });
12346
+ if (this.attributeMayContainTransientAttrs) {
12347
+ this._restoreAttributeFromStaticTruth({ type: AttributeUpdateType.STATE });
12348
+ }
12349
+ else {
12350
+ this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
12351
+ type: AttributeUpdateType.STATE
12352
+ });
12353
+ }
12354
+ this.emitStateUpdateEvent();
11702
12355
  }
11703
12356
  }
11704
12357
  invalidateResolver() {
@@ -11706,19 +12359,18 @@ class Graphic extends Node {
11706
12359
  if (!this.stateEngine || !((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) || !this.compiledStateDefinitions) {
11707
12360
  return;
11708
12361
  }
11709
- const stateResolveBaseAttrs = ((_b = this.baseAttributes) !== null && _b !== void 0 ? _b : this.attribute);
11710
- this.stateEngine.setResolveContext(this, stateResolveBaseAttrs);
11711
- this.resolverEpoch += 1;
12362
+ this.syncStateResolveContext();
12363
+ this.resolverEpoch = ((_b = this.resolverEpoch) !== null && _b !== void 0 ? _b : 0) + 1;
11712
12364
  this.stateEngine.invalidateResolverCache();
11713
12365
  const transition = this.stateEngine.applyStates(this.currentStates);
11714
12366
  const resolvedStateAttrs = Object.assign({}, this.stateEngine.resolvedPatch);
11715
12367
  this.effectiveStates = [...transition.effectiveStates];
11716
- this.resolvedStatePatch = Object.assign({}, resolvedStateAttrs);
12368
+ this.resolvedStatePatch = resolvedStateAttrs;
11717
12369
  this.sharedStateDirty = false;
11718
12370
  this.syncSharedStateActiveRegistrations();
11719
12371
  this.stopStateAnimates();
11720
12372
  this._restoreAttributeFromStaticTruth({ type: AttributeUpdateType.STATE });
11721
- this._emitCustomEvent('afterStateUpdate', { type: AttributeUpdateType.STATE });
12373
+ this.emitStateUpdateEvent();
11722
12374
  }
11723
12375
  sameStateNames(left, right) {
11724
12376
  const normalizedLeft = left !== null && left !== void 0 ? left : [];
@@ -11757,6 +12409,20 @@ class Graphic extends Node {
11757
12409
  this.glyphHost.addUpdateBoundTag();
11758
12410
  }
11759
12411
  }
12412
+ addBroadUpdateTag() {
12413
+ this.shadowRoot && this.shadowRoot.addUpdateGlobalPositionTag();
12414
+ this._updateTag |=
12415
+ UpdateTag.UPDATE_SHAPE_AND_BOUNDS |
12416
+ UpdateTag.UPDATE_PAINT |
12417
+ UpdateTag.UPDATE_GLOBAL_LOCAL_MATRIX |
12418
+ UpdateTag.UPDATE_LAYOUT;
12419
+ if (this.parent) {
12420
+ this.parent.addChildUpdateBoundTag();
12421
+ }
12422
+ if (this.glyphHost) {
12423
+ this.glyphHost.addUpdateBoundTag();
12424
+ }
12425
+ }
11760
12426
  updateShapeAndBoundsTagSetted() {
11761
12427
  return (this._updateTag & UpdateTag.UPDATE_SHAPE_AND_BOUNDS) === UpdateTag.UPDATE_SHAPE_AND_BOUNDS;
11762
12428
  }
@@ -11861,17 +12527,22 @@ class Graphic extends Node {
11861
12527
  }
11862
12528
  }
11863
12529
  setStage(stage, layer) {
11864
- var _a, _b, _c, _d, _e, _f, _g, _h;
12530
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
11865
12531
  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;
11866
12532
  const previousStage = this.stage;
11867
12533
  if (this.stage !== stage || this.layer !== layer) {
11868
12534
  this.stage = stage;
11869
12535
  this.layer = layer;
11870
- this.syncSharedStateScopeBindingFromTree(!!((_d = this.currentStates) === null || _d === void 0 ? void 0 : _d.length));
12536
+ if (((_d = this.currentStates) === null || _d === void 0 ? void 0 : _d.length) ||
12537
+ this.boundSharedStateScope ||
12538
+ ((_e = this.registeredActiveScopes) === null || _e === void 0 ? void 0 : _e.size) ||
12539
+ this.sharedStateDirty) {
12540
+ this.syncSharedStateScopeBindingOnTreeChange(true);
12541
+ }
11871
12542
  this.setStageToShadowRoot(stage, layer);
11872
- if (this.hasAnyTrackedAnimate()) {
11873
- const previousTimeline = (_e = previousStage === null || previousStage === void 0 ? void 0 : previousStage.getTimeline) === null || _e === void 0 ? void 0 : _e.call(previousStage);
11874
- const nextTimeline = (_f = stage === null || stage === void 0 ? void 0 : stage.getTimeline) === null || _f === void 0 ? void 0 : _f.call(stage);
12543
+ if (this.mayHaveTrackedAnimates() && this.hasAnyTrackedAnimate()) {
12544
+ const previousTimeline = (_f = previousStage === null || previousStage === void 0 ? void 0 : previousStage.getTimeline) === null || _f === void 0 ? void 0 : _f.call(previousStage);
12545
+ const nextTimeline = (_g = stage === null || stage === void 0 ? void 0 : stage.getTimeline) === null || _g === void 0 ? void 0 : _g.call(stage);
11875
12546
  const detachedStageAnimates = [];
11876
12547
  this.visitTrackedAnimates(a => {
11877
12548
  const boundToPreviousStage = !!previousTimeline && a.timeline === previousTimeline;
@@ -11909,10 +12580,38 @@ class Graphic extends Node {
11909
12580
  }
11910
12581
  }
11911
12582
  this._onSetStage && this._onSetStage(this, stage, layer);
11912
- (_g = graphicService === null || graphicService === void 0 ? void 0 : graphicService.onSetStage) === null || _g === void 0 ? void 0 : _g.call(graphicService, this, stage);
12583
+ (_h = graphicService === null || graphicService === void 0 ? void 0 : graphicService.onSetStage) === null || _h === void 0 ? void 0 : _h.call(graphicService, this, stage);
11913
12584
  return;
11914
12585
  }
11915
- this.syncSharedStateScopeBindingFromTree(!!((_h = this.currentStates) === null || _h === void 0 ? void 0 : _h.length));
12586
+ if (((_j = this.currentStates) === null || _j === void 0 ? void 0 : _j.length) ||
12587
+ this.boundSharedStateScope ||
12588
+ ((_k = this.registeredActiveScopes) === null || _k === void 0 ? void 0 : _k.size) ||
12589
+ this.sharedStateDirty) {
12590
+ this.syncSharedStateScopeBindingOnTreeChange(true);
12591
+ }
12592
+ }
12593
+ detachStageForRelease() {
12594
+ var _a, _b, _c;
12595
+ if ((_a = this.registeredActiveScopes) === null || _a === void 0 ? void 0 : _a.size) {
12596
+ this.clearSharedStateActiveRegistrations();
12597
+ }
12598
+ if (this.mayHaveTrackedAnimates() || this.shadowRoot) {
12599
+ this.stopAnimates();
12600
+ }
12601
+ this.boundSharedStateScope = undefined;
12602
+ this.boundSharedStateRevision = undefined;
12603
+ this.localFallbackCompiledDefinitions = undefined;
12604
+ this.compiledStateDefinitions = undefined;
12605
+ this.compiledStateDefinitionsCacheKey = undefined;
12606
+ this.stateEngine = undefined;
12607
+ this.stateEngineCompiledDefinitions = undefined;
12608
+ this.stateEngineStateProxyModeKey = undefined;
12609
+ this.sharedStateDirty = false;
12610
+ this.stage = null;
12611
+ this.layer = null;
12612
+ if (this.shadowRoot) {
12613
+ (_c = (_b = this.shadowRoot).detachStageForRelease) === null || _c === void 0 ? void 0 : _c.call(_b);
12614
+ }
11916
12615
  }
11917
12616
  setStageToShadowRoot(stage, layer) {
11918
12617
  if (this.shadowRoot) {
@@ -12048,6 +12747,9 @@ class Graphic extends Node {
12048
12747
  cb && cb();
12049
12748
  }
12050
12749
  _stopAnimates() {
12750
+ if (!this.mayHaveTrackedAnimates()) {
12751
+ return;
12752
+ }
12051
12753
  const animates = [];
12052
12754
  this.visitTrackedAnimates(animate => {
12053
12755
  animates.push(animate);
@@ -12068,17 +12770,24 @@ class Graphic extends Node {
12068
12770
  }
12069
12771
  }
12070
12772
  release() {
12071
- var _a, _b, _c;
12773
+ var _a, _b, _c, _d;
12072
12774
  this.releaseStatus = 'released';
12073
- this.clearSharedStateActiveRegistrations();
12074
- this.stopAnimates();
12075
- const graphicService = (_b = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.graphicService) !== null && _b !== void 0 ? _b : application.graphicService;
12076
- (_c = graphicService === null || graphicService === void 0 ? void 0 : graphicService.onRelease) === null || _c === void 0 ? void 0 : _c.call(graphicService, this);
12775
+ if ((_a = this.registeredActiveScopes) === null || _a === void 0 ? void 0 : _a.size) {
12776
+ this.clearSharedStateActiveRegistrations();
12777
+ }
12778
+ if (this.mayHaveTrackedAnimates() || this.shadowRoot) {
12779
+ this.stopAnimates();
12780
+ }
12781
+ const graphicService = (_c = (_b = this.stage) === null || _b === void 0 ? void 0 : _b.graphicService) !== null && _c !== void 0 ? _c : application.graphicService;
12782
+ (_d = graphicService === null || graphicService === void 0 ? void 0 : graphicService.onRelease) === null || _d === void 0 ? void 0 : _d.call(graphicService, this);
12077
12783
  super.release();
12078
12784
  }
12785
+ hasCustomEvent(type) {
12786
+ return !!this._events && type in this._events;
12787
+ }
12079
12788
  _dispatchCustomEvent(type, context) {
12080
12789
  var _a, _b;
12081
- if (this._events && type in this._events) {
12790
+ if (this.hasCustomEvent(type)) {
12082
12791
  const changeEvent = new CustomEvent(type, context);
12083
12792
  changeEvent.bubbles = false;
12084
12793
  const manager = (_b = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventSystem) === null || _b === void 0 ? void 0 : _b.manager;
@@ -12091,6 +12800,9 @@ class Graphic extends Node {
12091
12800
  return true;
12092
12801
  }
12093
12802
  beforeStateUpdate(attrs, prevStates, nextStates, hasAnimation, isClear) {
12803
+ if (!this.hasCustomEvent('beforeStateUpdate')) {
12804
+ return true;
12805
+ }
12094
12806
  return this._dispatchCustomEvent('beforeStateUpdate', {
12095
12807
  type: AttributeUpdateType.STATE,
12096
12808
  attrs: Object.assign({}, attrs),
@@ -12100,6 +12812,11 @@ class Graphic extends Node {
12100
12812
  isClear: !!isClear
12101
12813
  });
12102
12814
  }
12815
+ emitStateUpdateEvent() {
12816
+ if (this.hasCustomEvent('afterStateUpdate')) {
12817
+ this._emitCustomEvent('afterStateUpdate', { type: AttributeUpdateType.STATE });
12818
+ }
12819
+ }
12103
12820
  _emitCustomEvent(type, context) {
12104
12821
  this._dispatchCustomEvent(type, context);
12105
12822
  }
@@ -13602,6 +14319,61 @@ class Rect extends Graphic {
13602
14319
  needUpdateTag(key) {
13603
14320
  return super.needUpdateTag(key, RECT_UPDATE_TAG_KEY);
13604
14321
  }
14322
+ shouldSkipStateTransitionDefaultAttribute(key, targetAttrs) {
14323
+ var _a;
14324
+ const attrs = ((_a = targetAttrs !== null && targetAttrs !== void 0 ? targetAttrs : this.baseAttributes) !== null && _a !== void 0 ? _a : this.attribute);
14325
+ const hasValue = (attrKey) => attrs[attrKey] != null;
14326
+ const isNilValue = (attrKey) => attrs[attrKey] == null;
14327
+ switch (key) {
14328
+ case 'width':
14329
+ return isNilValue('width') && hasValue('x') && hasValue('x1');
14330
+ case 'height':
14331
+ return isNilValue('height') && hasValue('y') && hasValue('y1');
14332
+ case 'x1':
14333
+ return isNilValue('x1') && hasValue('x') && hasValue('width');
14334
+ case 'y1':
14335
+ return isNilValue('y1') && hasValue('y') && hasValue('height');
14336
+ default:
14337
+ return false;
14338
+ }
14339
+ }
14340
+ getStateTransitionDefaultAttribute(key, targetAttrs) {
14341
+ var _a;
14342
+ const attrs = ((_a = targetAttrs !== null && targetAttrs !== void 0 ? targetAttrs : this.baseAttributes) !== null && _a !== void 0 ? _a : this.attribute);
14343
+ const getNumber = (attrKey) => {
14344
+ const value = attrs[attrKey];
14345
+ return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
14346
+ };
14347
+ const x = getNumber('x');
14348
+ const y = getNumber('y');
14349
+ const x1 = getNumber('x1');
14350
+ const y1 = getNumber('y1');
14351
+ const width = getNumber('width');
14352
+ const height = getNumber('height');
14353
+ switch (key) {
14354
+ case 'width':
14355
+ if (width == null && x != null && x1 != null) {
14356
+ return x1 - x;
14357
+ }
14358
+ break;
14359
+ case 'height':
14360
+ if (height == null && y != null && y1 != null) {
14361
+ return y1 - y;
14362
+ }
14363
+ break;
14364
+ case 'x1':
14365
+ if (x1 == null && x != null && width != null) {
14366
+ return x + width;
14367
+ }
14368
+ break;
14369
+ case 'y1':
14370
+ if (y1 == null && y != null && height != null) {
14371
+ return y + height;
14372
+ }
14373
+ break;
14374
+ }
14375
+ return super.getStateTransitionDefaultAttribute(key, targetAttrs);
14376
+ }
13605
14377
  toCustomPath() {
13606
14378
  let path = super.toCustomPath();
13607
14379
  if (path) {
@@ -16295,6 +17067,7 @@ class Group extends Graphic {
16295
17067
  this.type = 'group';
16296
17068
  this.parent = null;
16297
17069
  this.isContainer = true;
17070
+ this._hasSharedStateDefinitions = false;
16298
17071
  this.numberType = GROUP_NUMBER_TYPE;
16299
17072
  this._childUpdateTag = UpdateTag.UPDATE_BOUNDS;
16300
17073
  }
@@ -16305,12 +17078,17 @@ class Group extends Graphic {
16305
17078
  if (this._sharedStateDefinitions === value) {
16306
17079
  return;
16307
17080
  }
17081
+ const previousScope = this.sharedStateScope;
16308
17082
  this._sharedStateDefinitions = value;
17083
+ this._hasSharedStateDefinitions = !!value && Object.keys(value).length > 0;
16309
17084
  this.ensureSharedStateScopeBound();
16310
17085
  if (this.sharedStateScope) {
16311
17086
  setSharedStateScopeLocalDefinitions(this.sharedStateScope, value);
16312
17087
  markScopeActiveDescendantsDirty(this.sharedStateScope, this.stage);
16313
17088
  }
17089
+ if (previousScope !== this.sharedStateScope) {
17090
+ this.notifyChildrenSharedStateTreeChanged();
17091
+ }
16314
17092
  }
16315
17093
  setMode(mode) {
16316
17094
  mode === '3d' ? this.set3dMode() : this.set2dMode();
@@ -16501,8 +17279,16 @@ class Group extends Graphic {
16501
17279
  insertInto(newNode, idx) {
16502
17280
  return this._updateChildToStage(super.insertInto(newNode, idx));
16503
17281
  }
16504
- removeChild(child) {
17282
+ removeChild(child, highPerformance = false) {
17283
+ var _a;
16505
17284
  const data = super.removeChild(child);
17285
+ if (!data) {
17286
+ return data;
17287
+ }
17288
+ if (highPerformance) {
17289
+ (_a = child.detachStageForRelease) === null || _a === void 0 ? void 0 : _a.call(child);
17290
+ return data;
17291
+ }
16506
17292
  this.getGraphicService().onRemove(child);
16507
17293
  child.setStage(null, null);
16508
17294
  this.addUpdateBoundTag();
@@ -16525,29 +17311,43 @@ class Group extends Graphic {
16525
17311
  setStage(stage, layer) {
16526
17312
  var _a, _b, _c, _d, _e, _f;
16527
17313
  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;
17314
+ const needsSharedStateTreeSync = this._hasSharedStateDefinitions ||
17315
+ this.sharedStateScope ||
17316
+ ((_d = this.currentStates) === null || _d === void 0 ? void 0 : _d.length) ||
17317
+ this.boundSharedStateScope ||
17318
+ ((_e = this.registeredActiveScopes) === null || _e === void 0 ? void 0 : _e.size) ||
17319
+ this.sharedStateDirty;
16528
17320
  if (this.stage !== stage) {
16529
17321
  this.stage = stage;
16530
17322
  this.layer = layer;
16531
- this.ensureSharedStateScopeBound();
16532
- this.syncSharedStateScopeBindingFromTree(!!((_d = this.currentStates) === null || _d === void 0 ? void 0 : _d.length));
17323
+ if (needsSharedStateTreeSync) {
17324
+ this.ensureSharedStateScopeBound();
17325
+ this.syncSharedStateScopeBindingOnTreeChange(true);
17326
+ }
16533
17327
  this.setStageToShadowRoot(stage, layer);
16534
17328
  this._onSetStage && this._onSetStage(this, stage, layer);
16535
- (_e = graphicService === null || graphicService === void 0 ? void 0 : graphicService.onSetStage) === null || _e === void 0 ? void 0 : _e.call(graphicService, this, stage);
17329
+ (_f = graphicService === null || graphicService === void 0 ? void 0 : graphicService.onSetStage) === null || _f === void 0 ? void 0 : _f.call(graphicService, this, stage);
16536
17330
  this.forEachChildren(item => {
16537
17331
  item.setStage(stage, this.layer);
16538
17332
  });
16539
17333
  return;
16540
17334
  }
16541
- if (this.layer !== layer) {
17335
+ const layerChanged = this.layer !== layer;
17336
+ if (layerChanged) {
16542
17337
  this.layer = layer;
16543
17338
  }
16544
- this.ensureSharedStateScopeBound();
16545
- this.syncSharedStateScopeBindingFromTree(!!((_f = this.currentStates) === null || _f === void 0 ? void 0 : _f.length));
16546
- this.forEachChildren(item => {
16547
- if (item.onParentSharedStateTreeChanged) {
16548
- item.onParentSharedStateTreeChanged(stage, this.layer);
16549
- }
16550
- });
17339
+ if (needsSharedStateTreeSync) {
17340
+ this.ensureSharedStateScopeBound();
17341
+ this.syncSharedStateScopeBindingOnTreeChange(true);
17342
+ this.notifyChildrenSharedStateTreeChanged();
17343
+ }
17344
+ else if (layerChanged) {
17345
+ this.forEachChildren(item => {
17346
+ if (item.onParentSharedStateTreeChanged) {
17347
+ item.onParentSharedStateTreeChanged(stage, this.layer);
17348
+ }
17349
+ });
17350
+ }
16551
17351
  }
16552
17352
  addUpdatePositionTag() {
16553
17353
  super.addUpdatePositionTag();
@@ -16614,8 +17414,20 @@ class Group extends Graphic {
16614
17414
  }
16615
17415
  super.release();
16616
17416
  }
17417
+ detachStageForRelease() {
17418
+ super.detachStageForRelease();
17419
+ this.sharedStateScope = undefined;
17420
+ this.forEachChildren((item) => {
17421
+ var _a;
17422
+ (_a = item.detachStageForRelease) === null || _a === void 0 ? void 0 : _a.call(item);
17423
+ });
17424
+ }
16617
17425
  ensureSharedStateScopeBound() {
16618
17426
  var _a, _b, _c;
17427
+ if (!this.hasSharedStateDefinitions()) {
17428
+ this.sharedStateScope = undefined;
17429
+ return;
17430
+ }
16619
17431
  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;
16620
17432
  if (!this.sharedStateScope) {
16621
17433
  this.sharedStateScope = createGroupSharedStateScope(this, parentScope, this._sharedStateDefinitions);
@@ -16628,18 +17440,25 @@ class Group extends Graphic {
16628
17440
  setSharedStateScopeLocalDefinitions(this.sharedStateScope, this._sharedStateDefinitions);
16629
17441
  }
16630
17442
  }
17443
+ hasSharedStateDefinitions() {
17444
+ return this._hasSharedStateDefinitions;
17445
+ }
17446
+ notifyChildrenSharedStateTreeChanged() {
17447
+ this.forEachChildren(item => {
17448
+ if (item.onParentSharedStateTreeChanged) {
17449
+ item.onParentSharedStateTreeChanged(this.stage, this.layer);
17450
+ }
17451
+ });
17452
+ }
16631
17453
  onParentSharedStateTreeChanged(stage, layer) {
17454
+ var _a;
16632
17455
  if (this.stage !== stage || this.layer !== layer) {
16633
17456
  this.setStage(stage, layer);
16634
17457
  return;
16635
17458
  }
16636
17459
  this.ensureSharedStateScopeBound();
16637
- this.syncSharedStateScopeBindingFromTree();
16638
- this.forEachChildren(item => {
16639
- if (item.onParentSharedStateTreeChanged) {
16640
- item.onParentSharedStateTreeChanged(stage, this.layer);
16641
- }
16642
- });
17460
+ this.syncSharedStateScopeBindingOnTreeChange(!!((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length));
17461
+ this.notifyChildrenSharedStateTreeChanged();
16643
17462
  }
16644
17463
  }
16645
17464
  Group.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
@@ -17081,6 +17900,10 @@ class DefaultGraphicService {
17081
17900
  };
17082
17901
  this.tempAABBBounds1 = new AABBBounds();
17083
17902
  this.tempAABBBounds2 = new AABBBounds();
17903
+ this.tempAABBBoundsResult = {
17904
+ tb1: this.tempAABBBounds1,
17905
+ tb2: this.tempAABBBounds2
17906
+ };
17084
17907
  }
17085
17908
  onAttributeUpdate(graphic) {
17086
17909
  if (this.hooks.onAttributeUpdate.taps.length) {
@@ -17211,7 +18034,7 @@ class DefaultGraphicService {
17211
18034
  const tb2 = this.tempAABBBounds2;
17212
18035
  tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2);
17213
18036
  tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2);
17214
- return { tb1, tb2 };
18037
+ return this.tempAABBBoundsResult;
17215
18038
  }
17216
18039
  }
17217
18040
 
@@ -19114,6 +19937,7 @@ class DirtyBoundsPlugin {
19114
19937
  this.activeEvent = 'onRegister';
19115
19938
  this._uid = Generator.GenAutoIncrementId();
19116
19939
  this.key = this.name + this._uid;
19940
+ this.dirtyBoundsHooksRegistered = false;
19117
19941
  this.handlePaintOnlyUpdate = (graphic) => {
19118
19942
  var _a, _b, _c, _d;
19119
19943
  const stage = this.pluginService.stage;
@@ -19155,16 +19979,16 @@ class DirtyBoundsPlugin {
19155
19979
  }
19156
19980
  return (_b = owner._globalAABBBounds) !== null && _b !== void 0 ? _b : owner.globalAABBBounds;
19157
19981
  }
19158
- activate(context) {
19159
- this.pluginService = context;
19160
- context.stage.hooks.afterRender.tap(this.key, stage => {
19161
- if (!(stage && stage === this.pluginService.stage)) {
19162
- return;
19163
- }
19164
- stage.dirtyBounds.clear();
19165
- });
19166
- const stage = this.pluginService.stage;
19167
- if (!stage) {
19982
+ getRemoveDirtyBounds(graphic) {
19983
+ var _a;
19984
+ const owner = ((_a = graphic.glyphHost) !== null && _a !== void 0 ? _a : graphic);
19985
+ const cachedBounds = owner._globalAABBBounds;
19986
+ if (cachedBounds && typeof cachedBounds.empty === 'function' && !cachedBounds.empty()) {
19987
+ return cachedBounds;
19988
+ }
19989
+ }
19990
+ registerDirtyBoundsHooks(stage) {
19991
+ if (this.dirtyBoundsHooksRegistered) {
19168
19992
  return;
19169
19993
  }
19170
19994
  stage.graphicService.hooks.onAttributeUpdate.tap(this.key, this.handlePaintOnlyUpdate);
@@ -19205,10 +20029,29 @@ class DirtyBoundsPlugin {
19205
20029
  if (!(stage && stage === this.pluginService.stage && stage.renderCount)) {
19206
20030
  return;
19207
20031
  }
19208
- if (stage) {
19209
- stage.dirty(graphic.globalAABBBounds);
20032
+ const bounds = this.getRemoveDirtyBounds(graphic);
20033
+ if (bounds && !bounds.empty()) {
20034
+ stage.dirty(bounds);
20035
+ }
20036
+ });
20037
+ this.dirtyBoundsHooksRegistered = true;
20038
+ }
20039
+ activate(context) {
20040
+ this.pluginService = context;
20041
+ context.stage.hooks.afterRender.tap(this.key, stage => {
20042
+ if (!(stage && stage === this.pluginService.stage)) {
20043
+ return;
19210
20044
  }
20045
+ stage.dirtyBounds.clear();
20046
+ this.registerDirtyBoundsHooks(stage);
19211
20047
  });
20048
+ const stage = this.pluginService.stage;
20049
+ if (!stage) {
20050
+ return;
20051
+ }
20052
+ if (stage.renderCount) {
20053
+ this.registerDirtyBoundsHooks(stage);
20054
+ }
19212
20055
  }
19213
20056
  deactivate(context) {
19214
20057
  const stage = this.pluginService.stage;
@@ -19218,6 +20061,7 @@ class DirtyBoundsPlugin {
19218
20061
  stage.graphicService.hooks.onAttributeUpdate.taps = stage.graphicService.hooks.onAttributeUpdate.taps.filter(item => {
19219
20062
  return item.name !== this.key;
19220
20063
  });
20064
+ this.dirtyBoundsHooksRegistered = false;
19221
20065
  stage.graphicService.hooks.beforeUpdateAABBBounds.taps =
19222
20066
  stage.graphicService.hooks.beforeUpdateAABBBounds.taps.filter(item => {
19223
20067
  return item.name !== this.key;
@@ -19742,7 +20586,7 @@ class Stage extends Group {
19742
20586
  this._ticker.on('tick', this.afterTickCb);
19743
20587
  }
19744
20588
  constructor(params = {}, deps = {}) {
19745
- var _a, _b, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
20589
+ var _a, _b, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
19746
20590
  super({});
19747
20591
  this.tickedBeforeRender = true;
19748
20592
  this._onVisibleChange = (visible) => {
@@ -19764,7 +20608,10 @@ class Stage extends Group {
19764
20608
  }
19765
20609
  };
19766
20610
  this.beforeRender = (stage) => {
19767
- flushStageSharedStateRefresh(this);
20611
+ const pendingSharedRefresh = this._pendingSharedStateRefreshGraphics;
20612
+ if (pendingSharedRefresh === null || pendingSharedRefresh === void 0 ? void 0 : pendingSharedRefresh.size) {
20613
+ flushStageSharedStateRefresh(this);
20614
+ }
19768
20615
  this._beforeRenderList.forEach(cb => cb(stage));
19769
20616
  };
19770
20617
  this.afterClearScreen = (drawParams) => {
@@ -19830,16 +20677,19 @@ class Stage extends Group {
19830
20677
  this.appendChild(this.layerService.createLayer(this, { main: true }));
19831
20678
  this.nextFrameRenderLayerSet = new Set();
19832
20679
  this.willNextFrameRender = false;
19833
- ensureStageStatePerfMonitor(this);
19834
- this._stateBatchScheduler = new StateBatchScheduler(this, ensureStageStatePerfMonitor(this));
19835
- this.rootSharedStateScope = createRootSharedStateScope(this, (_x = this.theme) === null || _x === void 0 ? void 0 : _x.stateDefinitions);
19836
20680
  this.theme.onStateDefinitionsChange = () => {
19837
20681
  var _a;
19838
- if (!this.rootSharedStateScope) {
20682
+ const definitions = (_a = this.theme) === null || _a === void 0 ? void 0 : _a.stateDefinitions;
20683
+ if (!definitions || !Object.keys(definitions).length) {
20684
+ if (this.rootSharedStateScope) {
20685
+ setRootSharedStateScopeThemeDefinitions(this.rootSharedStateScope, definitions);
20686
+ markScopeActiveDescendantsDirty(this.rootSharedStateScope, this);
20687
+ }
19839
20688
  return;
19840
20689
  }
19841
- setRootSharedStateScopeThemeDefinitions(this.rootSharedStateScope, (_a = this.theme) === null || _a === void 0 ? void 0 : _a.stateDefinitions);
19842
- markScopeActiveDescendantsDirty(this.rootSharedStateScope, this);
20690
+ const rootScope = this.ensureRootSharedStateScope(definitions);
20691
+ setRootSharedStateScopeThemeDefinitions(rootScope, definitions);
20692
+ markScopeActiveDescendantsDirty(rootScope, this);
19843
20693
  };
19844
20694
  this.renderStyle = params.renderStyle;
19845
20695
  if (params.autoRender) {
@@ -19881,7 +20731,7 @@ class Stage extends Group {
19881
20731
  this.setAttributes({ background: this._background });
19882
20732
  }
19883
20733
  this.initAnimate(params);
19884
- this.rafId = (_y = params.rafId) !== null && _y !== void 0 ? _y : Math.floor(Math.random() * 6);
20734
+ this.rafId = (_x = params.rafId) !== null && _x !== void 0 ? _x : Math.floor(Math.random() * 6);
19885
20735
  }
19886
20736
  initAnimate(params) {
19887
20737
  var _a;
@@ -20261,8 +21111,22 @@ class Stage extends Group {
20261
21111
  });
20262
21112
  }
20263
21113
  }
21114
+ ensureRootSharedStateScope(themeStateDefinitions) {
21115
+ if (!this.rootSharedStateScope) {
21116
+ this.rootSharedStateScope = createRootSharedStateScope(this, themeStateDefinitions);
21117
+ return this.rootSharedStateScope;
21118
+ }
21119
+ this.rootSharedStateScope.ownerStage = this;
21120
+ return this.rootSharedStateScope;
21121
+ }
21122
+ getStateBatchScheduler() {
21123
+ if (!this._stateBatchScheduler) {
21124
+ this._stateBatchScheduler = new StateBatchScheduler(this, ensureStageStatePerfMonitor(this));
21125
+ }
21126
+ return this._stateBatchScheduler;
21127
+ }
20264
21128
  scheduleStateBatch(graphics, targetStates) {
20265
- this._stateBatchScheduler.schedule(graphics, targetStates);
21129
+ this.getStateBatchScheduler().schedule(graphics, targetStates);
20266
21130
  }
20267
21131
  getStatePerfSnapshot() {
20268
21132
  return ensureStageStatePerfMonitor(this).getSnapshot();
@@ -23852,23 +24716,27 @@ function createStage(params) {
23852
24716
  const result = { x: 0, y: 0, z: 0, lastModelMatrix: null };
23853
24717
  class BaseRender {
23854
24718
  init(contributions) {
23855
- if (contributions) {
23856
- this._renderContribitions = contributions.getContributions();
23857
- }
23858
- if (!this._renderContribitions) {
23859
- this._renderContribitions = [];
23860
- }
23861
24719
  if (!this.builtinContributions) {
23862
24720
  this.builtinContributions = [];
23863
24721
  }
23864
- this.builtinContributions.push(defaultBaseClipRenderBeforeContribution);
23865
- this.builtinContributions.push(defaultBaseClipRenderAfterContribution);
23866
- this.builtinContributions.forEach(item => this._renderContribitions.push(item));
24722
+ this._renderContribitions = contributions ? contributions.getContributions().slice() : [];
24723
+ const addContribution = (item) => {
24724
+ if (!this._renderContribitions.includes(item)) {
24725
+ this._renderContribitions.push(item);
24726
+ }
24727
+ };
24728
+ this.builtinContributions.forEach(addContribution);
24729
+ addContribution(defaultBaseClipRenderBeforeContribution);
24730
+ addContribution(defaultBaseClipRenderAfterContribution);
23867
24731
  if (this._renderContribitions.length) {
23868
24732
  this._renderContribitions.sort((a, b) => b.order - a.order);
23869
24733
  this._beforeRenderContribitions = this._renderContribitions.filter(c => c.time === BaseRenderContributionTime.beforeFillStroke);
23870
24734
  this._afterRenderContribitions = this._renderContribitions.filter(c => c.time === BaseRenderContributionTime.afterFillStroke);
23871
24735
  }
24736
+ else {
24737
+ this._beforeRenderContribitions = [];
24738
+ this._afterRenderContribitions = [];
24739
+ }
23872
24740
  }
23873
24741
  reInit() {
23874
24742
  this.init(this.graphicRenderContributions);
@@ -30906,7 +31774,10 @@ class FlexLayoutPlugin {
30906
31774
  this.tryLayout(graphic, false);
30907
31775
  }
30908
31776
  });
30909
- stage.graphicService.hooks.onSetStage.tap(this.key, graphic => {
31777
+ stage.graphicService.hooks.onSetStage.tap(this.key, (graphic, nextStage) => {
31778
+ if (!(nextStage && nextStage === this.pluginService.stage)) {
31779
+ return;
31780
+ }
30910
31781
  if (graphic.glyphHost) {
30911
31782
  graphic = graphic.glyphHost;
30912
31783
  }
@@ -30941,4 +31812,4 @@ const registerFlexLayoutPlugin = () => {
30941
31812
  Factory.registerPlugin('FlexLayoutPlugin', FlexLayoutPlugin);
30942
31813
  };
30943
31814
 
30944
- 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 };
31815
+ 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 };